loadHtmlDom($content); $this->disablePagespeedModuleForIframes(); // Add a custom category for panel widget return $this->getProcessedHtml(); } private function disablePagespeedModuleForIframes() { if ($this->isDomLoaded()) { foreach ($this->htmlDom->find('iframe') as $iframe) { if (!empty( $iframe->src)) { $iframe->src .= (parse_url($iframe->src, PHP_URL_QUERY) ? '&' : '?') . 'PageSpeed=off'; } } } } public function enqueue_wp_admin_pagespeed_fixes_scripts() { wp_register_script(TENWEB_PREFIX . '_scripts_wp-admin-pagespeed-fixes', TENWEB_URL . '/assets/js/wp-admin-pagespeed-fixes.js', array(), TENWEB_VERSION); wp_enqueue_script(TENWEB_PREFIX . '_scripts_wp-admin-pagespeed-fixes'); } public static function enable() { if (self::$instance === null) { self::$instance = new self; } return self::$instance; } private function loadHtmlDom($content) { $this->content = $content ; $this->htmlDom = HtmlDomParser::str_get_html( $this->content ); } private function getProcessedHtml() { return $this->isDomLoaded() ? $this->htmlDom->save() : $this->content; } private function isDomLoaded() { return !empty($this->htmlDom); } } }