contentFilter = $contentFilter; } /** * Register all hooks */ public function register(): void { // Debug: Log that registration is happening file_put_contents('/tmp/yt-debug.log', date('H:i:s') . " HooksRegistrar::register() called\n", FILE_APPEND); // Filter post content to replace YouTube iframes with facades // Priority 101 = after rcp_filter_restricted_content (100) add_filter('the_content', [$this->contentFilter, 'filter'], 101); file_put_contents('/tmp/yt-debug.log', date('H:i:s') . " the_content filter registered\n", FILE_APPEND); // Enqueue facade assets add_action('wp_enqueue_scripts', [$this, 'enqueueAssets'], 15); } /** * Enqueue CSS and JS for YouTube facades */ public function enqueueAssets(): void { // Only on single posts where videos might appear if (!is_single()) { return; } wp_enqueue_style( 'roi-youtube-facade', get_template_directory_uri() . '/Public/YoutubeFacade/Infrastructure/Ui/Assets/Css/youtube-facade.css', [], ROI_VERSION, 'all' ); wp_enqueue_script( 'roi-youtube-facade', get_template_directory_uri() . '/Public/YoutubeFacade/Infrastructure/Ui/Assets/Js/youtube-facade.js', [], ROI_VERSION, [ 'in_footer' => true, 'strategy' => 'defer', ] ); } }