uses_editor() ) { $content = apply_filters( 'brizy_content', $post->get_compiled_html(), Brizy_Editor_Project::get(), $post->get_wp_post() ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound echo do_shortcode( $content ); } } /** * Load styles and scripts. * * @param int $post_id Post id. * * @since 1.6.0 */ public function enqueue_scripts( $post_id ) { $prefix = method_exists( 'Brizy_Editor', 'prefix' ) ? Brizy_Editor::prefix() : 'brizy'; if ( isset( $_GET[ "{$prefix}-edit-iframe" ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return; } try { $post = Brizy_Editor_Post::get( $post_id ); $main = method_exists( 'Brizy_Public_Main', 'get' ) ? Brizy_Public_Main::get( $post ) : new Brizy_Public_Main( $post ); } catch ( Exception $e ) { return; } $needs_compile = ! $post->isCompiledWithCurrentVersion() || $post->get_needs_compile(); if ( $needs_compile ) { try { $post->compile_page(); $post->saveStorage(); $post->savePost(); } catch ( Exception $e ) { return; } } // Add page CSS. add_filter( 'body_class', array( $main, 'body_class_frontend' ) ); add_action( 'wp_enqueue_scripts', function() use ( $main ) { if ( ! wp_script_is( 'brizy-preview' ) ) { add_action( 'wp_enqueue_scripts', array( $main, '_action_enqueue_preview_assets' ), 10001 ); } }, 10000 ); add_action( 'wp_head', function() use ( $post ) { $html = new Brizy_Editor_CompiledHtml( $post->get_compiled_html() ); echo do_shortcode( $html->get_head() ); } ); if ( $post && $post->uses_editor() ) { // Add page admin edit menu. add_action( 'admin_bar_menu', function( $wp_admin_bar ) use ( $post ) { $wp_post_id = $post->get_wp_post()->ID; $args = array( 'id' => 'brizy_Edit_page_' . $wp_post_id . '_link', /* translators: %s is the page title */ 'title' => sprintf( __( 'Edit %1$s with %2$s', 'astra-addon' ), get_the_title( $wp_post_id ), is_callable( 'Brizy_Editor::get' ) ? Brizy_Editor::get()->get_name() : 'Brizy' ), 'href' => $post->edit_url(), 'meta' => array(), ); if ( true === $wp_admin_bar->get_node( 'brizy_Edit_page_link' ) ) { $args['parent'] = 'brizy_Edit_page_link'; } $wp_admin_bar->add_node( $args ); }, 1000 ); } } } endif; // Add support for Advannced Hooks. Astra_Addon_Brizy_Compatibility::get_instance();