public function optimize( $html, $options = array(), $object_id = 0, $object_type = 'post' ) { if ( empty( $html ) || ! $object_id ) return $html; $blog_id = get_current_blog_id(); // Cria a subpasta isolada por site e por ID (ex: assets/blog-2/term-22/) $this->assets_dir = WP_CONTENT_DIR . '/cache/ftl-enhancer/assets/blog-' . $blog_id . '/' . $object_type . '-' . intval( $object_id ) . '/'; $this->assets_url = content_url( 'cache/ftl-enhancer/assets/blog-' . $blog_id . '/' . $object_type . '-' . intval( $object_id ) . '/' ); if ( ! file_exists( $this->assets_dir ) ) wp_mkdir_p( $this->assets_dir ); $dom = new DOMDocument(); libxml_use_internal_errors( true ); @$dom->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ), LIBXML_NOERROR | LIBXML_NOWARNING ); libxml_clear_errors(); $xpath = new DOMXPath( $dom ); $is_auto = isset( $options['auto_unify'] ) && $options['auto_unify']; if ( $is_auto ) { if ( ! empty( $options['unify_css'] ) ) $this->process_css( $dom, $xpath, $options, true ); if ( ! empty( $options['unify_js'] ) ) $this->process_js( $dom, $xpath, $options, true ); if ( ! empty( $options['optimize_images'] ) ) $this->process_images( $xpath, $options, true ); } else { if ( ! empty( $options['selected_css'] ) ) $this->process_css( $dom, $xpath, $options, false ); if ( ! empty( $options['selected_js'] ) ) $this->process_js( $dom, $xpath, $options, false ); if ( ! empty( $options['selected_images'] ) ) $this->process_images( $xpath, $options, false ); } $html = $dom->saveHTML(); if ( ! empty( $options['minify_html'] ) ) { $html = preg_replace( '/).)*-->/s', '', $html ); $html = trim( preg_replace( array( '/\>[^\S ]+/s', '/[^\S ]+\', '<', '\\1' ), $html ) ); } return $html; }
Warning: Cannot modify header information - headers already sent by (output started at /home/homologacentral/public_html/wp-content/plugins/headless-pwa-wp/includes/class-ftl-optimizer.php:1) in /home/homologacentral/public_html/wp-includes/pluggable.php on line 1539

Warning: Cannot modify header information - headers already sent by (output started at /home/homologacentral/public_html/wp-content/plugins/headless-pwa-wp/includes/class-ftl-optimizer.php:1) in /home/homologacentral/public_html/wp-includes/pluggable.php on line 1542