* @param string $pluginFile The plugin file. * @param array $actionLinks The action links. * @param string $position The position. * @return array The parsed actions. */ protected function parseActionLinks( $actions, $pluginFile, $actionLinks = [], $position = 'after' ) { if ( empty( $this->plugin ) ) { $this->plugin = AIOSEO_PLUGIN_BASENAME; } if ( $this->plugin === $pluginFile && ! empty( $actionLinks ) ) { foreach ( $actionLinks as $key => $value ) { $link = [ $key => '' . $value['label'] . '' ]; $actions = 'after' === $position ? array_merge( $actions, $link ) : array_merge( $link, $actions ); } } return $actions; } /** * Add our routes to this plugins allow list. * * @since 4.1.4 * * @param array $allowList The original list. * @return array The modified list. */ public function allowRestRoutes( $allowList ) { return array_merge( $allowList, [ '/aioseo/' ] ); } /** * Clear the site authors cache when user is updated or registered. * * @since 4.1.8 * * @return void */ public function clearAuthorsCache() { aioseo()->core->cache->delete( 'site_authors' ); } /** * Filters out post types that aren't really public when getPublicPostTypes() is called. * * @since 4.1.9 * * @param array[object]|array[string] $postTypes The post types. * @return array[object]|array[string] The filtered post types. */ public function removeInvalidPublicPostTypes( $postTypes ) { $postTypesToRemove = [ 'fusion_element', // Avada 'elementor_library', 'redirect_rule', // Safe Redirect Manager 'seedprod' ]; foreach ( $postTypes as $index => $postType ) { if ( is_string( $postType ) && in_array( $postType, $postTypesToRemove, true ) ) { unset( $postTypes[ $index ] ); continue; } if ( is_array( $postType ) && in_array( $postType['name'], $postTypesToRemove, true ) ) { unset( $postTypes[ $index ] ); } } return array_values( $postTypes ); } /** * Filters out taxonomies that aren't really public when getPublicTaxonomies() is called. * * @since 4.2.4 * * @param array[object]|array[string] $taxonomies The taxonomies. * @return array[object]|array[string] The filtered taxonomies. */ public function removeInvalidPublicTaxonomies( $taxonomies ) { // Check if the Avada Builder plugin is enabled. if ( ! defined( 'FUSION_BUILDER_VERSION' ) ) { return $taxonomies; } $taxonomiesToRemove = [ 'fusion_tb_category', 'element_category', 'template_category' ]; foreach ( $taxonomies as $index => $taxonomy ) { if ( is_string( $taxonomy ) && in_array( $taxonomy, $taxonomiesToRemove, true ) ) { unset( $taxonomies[ $index ] ); continue; } if ( is_array( $taxonomy ) && in_array( $taxonomy['name'], $taxonomiesToRemove, true ) ) { unset( $taxonomies[ $index ] ); } } return array_values( $taxonomies ); } /** * Disable Jetpack sitemaps module. * * @since 4.2.2 */ public function disableJetpackSitemaps( $active ) { unset( $active['sitemaps'] ); return $active; } /** * Dequeues third-party scripts from the other plugins or themes that crashes our menu pages. * * @since 4.1.9 * @version 4.3.1 * * @return void */ public function dequeueThirdPartyAssets() { // TagDiv Opt-in Builder plugin. wp_dequeue_script( 'tds_js_vue_files_last' ); // MyListing theme. if ( function_exists( 'mylisting' ) ) { wp_dequeue_script( 'vuejs' ); wp_dequeue_script( 'theme-script-vendor' ); wp_dequeue_script( 'theme-script-main' ); } // Voxel theme. if ( class_exists( '\Voxel\Controllers\Assets_Controller' ) ) { wp_dequeue_script( 'vue' ); wp_dequeue_script( 'vx:backend.js' ); } // Meta tags for seo plugin. if ( class_exists( '\Pagup\MetaTags\Settings' ) ) { wp_dequeue_script( 'pmt__vuejs' ); wp_dequeue_script( 'pmt__script' ); } // Plugin: Wpbingo Core (By TungHV). if ( strpos( wp_styles()->query( 'bwp-lookbook-css' )->src ?? '', 'wpbingo' ) !== false ) { wp_dequeue_style( 'bwp-lookbook-css' ); } } /** * Dequeues third-party scripts from the other plugins or themes that crashes our menu pages. * * @version 4.3.2 * * @return void */ public function dequeueThirdPartyAssetsEarly() { // Disables scripts for plugins StmMotorsExtends and StmPostType. if ( class_exists( 'STM_Metaboxes' ) ) { remove_action( 'admin_enqueue_scripts', [ 'STM_Metaboxes', 'wpcfto_scripts' ] ); } // Disables scripts for LearnPress plugin. if ( function_exists( 'learn_press_admin_assets' ) ) { remove_action( 'admin_enqueue_scripts', [ learn_press_admin_assets(), 'load_scripts' ] ); } } /** * Removes the duplicate meta description tag from the Hello Elementor theme. * * @since 4.4.3 * * @link https://developers.elementor.com/docs/hello-elementor-theme/hello_elementor_add_description_meta_tag/ * * @return void */ public function removeHelloElementorDescriptionTag() { remove_action( 'wp_head', 'hello_elementor_add_description_meta_tag' ); } /** * Prevent WP-Optimize from deleting our tables. * * @since 4.4.5 * * @param array $tables List of tables. * @return array Filtered tables. */ public function wpOptimizeAioseoTables( $tables ) { foreach ( $tables as &$table ) { if ( is_object( $table ) && property_exists( $table, 'Name' ) && false !== stripos( $table->Name, 'aioseo_' ) ) { $table->is_using = true; $table->can_be_removed = false; } } return $tables; } }