load_metabox( $this->get_current_page() ) ) { return; } \wp_enqueue_script( 'yoast-seo-premium-draft-js-plugins' ); \wp_enqueue_style( 'yoast-seo-premium-draft-js-plugins' ); $draft_js_external_script_location = 'https://yoast.com/shared-assets/scripts/wp-seo-premium-draft-js-plugins-source-2.0.0.min.js'; if ( \file_exists( \WPSEO_PREMIUM_PATH . 'assets/js/external/draft-js-emoji-picker.min.js' ) ) { $draft_js_external_script_location = \plugins_url( 'wordpress-seo-premium/assets/js/external/draft-js-emoji-picker.min.js' ); } \wp_enqueue_script( 'yoast-seo-premium-draft-js-plugins-external', $draft_js_external_script_location, [ 'yoast-seo-premium-commons', WPSEO_Admin_Asset_Manager::PREFIX . 'search-metadata-previews', ], \WPSEO_PREMIUM_VERSION, false ); } /** * Checks whether or not the metabox related scripts should be loaded. * * @codeCoverageIgnore * * @param string $current_page The page we are on. * * @return bool True when it should be loaded. */ protected function load_metabox( $current_page ) { $page_helper = new Current_Page_Helper(); // When the current page is a term related one. if ( WPSEO_Taxonomy::is_term_edit( $current_page ) || WPSEO_Taxonomy::is_term_overview( $current_page ) ) { return WPSEO_Options::get( 'display-metabox-tax-' . $page_helper->get_current_taxonomy() ); } // When the current page isn't a post related one. if ( WPSEO_Metabox::is_post_edit( $current_page ) || WPSEO_Metabox::is_post_overview( $current_page ) ) { return WPSEO_Post_Type::has_metabox_enabled( $page_helper->get_current_post_type() ); } // Make sure ajax integrations are loaded. return \wp_doing_ajax(); } /** * Retrieves the value of the pagenow variable. * * @codeCoverageIgnore * * @return string The value of pagenow. */ private function get_current_page() { global $pagenow; return $pagenow; } }