helpers->isScreenBase( 'event-espresso' ) || aioseo()->helpers->isScreenBase( 'post' ) || aioseo()->helpers->isScreenBase( 'term' ) || aioseo()->helpers->isScreenBase( 'edit-tags' ) ) { $page = null; if ( aioseo()->helpers->isScreenBase( 'event-espresso' ) || aioseo()->helpers->isScreenBase( 'post' ) ) { $page = 'post'; } aioseo()->helpers->enqueueScript( 'aioseo-post-settings-metabox', 'js/post-settings.js' ); wp_localize_script( 'aioseo-post-settings-metabox', 'aioseo', aioseo()->helpers->getVueData( $page ) ); if ( 'post' === $page ) { $this->enqueuePublishPanelAssets(); } $rtl = is_rtl() ? '.rtl' : ''; aioseo()->helpers->enqueueStyle( 'aioseo-post-settings-metabox', "css/post-settings$rtl.css" ); } $screen = get_current_screen(); if ( 'attachment' === $screen->id ) { wp_enqueue_media(); } } /** * Enqueues the JS/CSS for the Block Editor integrations. * * @since 4.1.4 * * @return void */ private function enqueuePublishPanelAssets() { aioseo()->helpers->enqueueScript( 'aioseo-publish-panel', 'js/publish-panel.js' ); $rtl = is_rtl() ? '.rtl' : ''; aioseo()->helpers->enqueueStyle( 'aioseo-publish-panel', "css/publish-panel$rtl.css" ); } /** * Adds a meta box to page/posts screens. * * @since 4.0.0 * * @return void */ public function addPostSettingsMetabox() { $dynamicOptions = aioseo()->dynamicOptions->noConflict(); $screen = get_current_screen(); $postType = $screen->post_type; $pageAnalysisSettingsCapability = aioseo()->access->hasCapability( 'aioseo_page_analysis' ); $generalSettingsCapability = aioseo()->access->hasCapability( 'aioseo_page_general_settings' ); $socialSettingsCapability = aioseo()->access->hasCapability( 'aioseo_page_social_settings' ); $schemaSettingsCapability = aioseo()->access->hasCapability( 'aioseo_page_schema_settings' ); $advancedSettingsCapability = aioseo()->access->hasCapability( 'aioseo_page_advanced_settings' ); if ( $dynamicOptions->searchAppearance->postTypes->has( $postType ) && $dynamicOptions->searchAppearance->postTypes->$postType->advanced->showMetaBox && ! ( empty( $pageAnalysisSettingsCapability ) && empty( $generalSettingsCapability ) && empty( $socialSettingsCapability ) && empty( $schemaSettingsCapability ) && empty( $advancedSettingsCapability ) ) ) { // Translators: 1 - The plugin short name ("AIOSEO"). $aioseoMetaboxTitle = sprintf( esc_html__( '%1$s Settings', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME ); add_meta_box( 'aioseo-settings', $aioseoMetaboxTitle, [ $this, 'postSettingsMetabox' ], [ $postType ], 'normal', apply_filters( 'aioseo_post_metabox_priority', 'high' ) ); } } /** * Render the on page/posts settings metabox with Vue App wrapper. * * @since 4.0.0 * * @param WP_Post $post The current post. * @return void */ public function postSettingsMetabox() { $this->postSettingsHiddenField(); ?>