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;
}
https://domalberto.edu.br/post-sitemap.xml
2025-06-06T19:36:53+00:00
https://domalberto.edu.br/page-sitemap.xml
2026-08-19T15:09:58+00:00
https://domalberto.edu.br/contato-sitemap.xml
2026-04-02T18:52:40+00:00
https://domalberto.edu.br/curso-sitemap.xml
2026-08-06T16:15:28+00:00
https://domalberto.edu.br/curso-sitemap2.xml
2026-02-25T21:09:56+00:00
https://domalberto.edu.br/curso-sitemap3.xml
2026-08-06T16:15:28+00:00
https://domalberto.edu.br/servico-sitemap.xml
2026-07-15T21:00:52+00:00
https://domalberto.edu.br/category-sitemap.xml
2025-06-06T19:36:53+00:00
https://domalberto.edu.br/tipo-sitemap.xml
2026-08-06T16:15:28+00:00
https://domalberto.edu.br/pos-graduacao-sitemap.xml
2026-07-10T13:21:50+00:00
https://domalberto.edu.br/graduacao-sitemap.xml
2026-08-06T16:15:28+00:00
https://domalberto.edu.br/carga-horaria-sitemap.xml
2026-08-06T16:15:28+00:00
https://domalberto.edu.br/local-sitemap.xml
2025-04-07T18:57:43+00:00
https://domalberto.edu.br/funcao-sitemap.xml
2026-07-29T18:58:22+00:00