filter_content( ... ), 12 ); \add_filter( 'widget_text', $this->filter_content( ... ), 12 ); \add_filter( 'widget_block_content', $this->filter_content( ... ), 12 ); \add_filter( 'bricks/frontend/render_data', $this->filter_content( ... ), 12 ); \add_filter( 'breakdance_singular_content', $this->filter_content( ... ), 12 ); \add_action( 'template_redirect', $this->start_output_pass( ... ), 2 ); } public function enabled(): bool { return $this->settings->get_bool( self::OPTION_NAME ); } public function filter_content( mixed $content ): mixed { if ( ! \is_string( $content ) || '' === $content || ! $this->enabled() ) { return $content; } return $this->resolver->replace_html( $content ); } public function start_output_pass(): void { if ( ! $this->should_start_output_pass() ) { return; } $this->buffer_started = true; \ob_start( $this->filter_output( ... ) ); } public function filter_output( string $html ): string { foreach ( \headers_list() as $header ) { if ( 0 !== \stripos( $header, 'Content-Type:' ) ) { continue; } if ( false === \stripos( $header, 'text/html' ) && false === \stripos( $header, 'application/xhtml+xml' ) ) { return $html; } } return $this->resolver->replace_html( $html ); } private function should_start_output_pass(): bool { if ( $this->buffer_started || ! $this->enabled() ) { return false; } if ( \is_admin() || \is_feed() || \is_robots() || \is_trackback() || \wp_doing_ajax() || ( \defined( 'REST_REQUEST' ) && REST_REQUEST ) || ( \defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) ) { return false; } $status = \http_response_code(); if ( \is_int( $status ) && ( 204 === $status || 304 === $status ) ) { return false; } return (bool) \apply_filters( 'blocks_variables_output_buffer_enabled', true ); } }