芝麻web文件管理V1.00
编辑当前文件:/home/fambnfli/www/tr/wp-content/plugins/wordpress-seo/src/integrations/admin/integrations-page.php
admin_asset_manager = $admin_asset_manager; $this->options_helper = $options_helper; $this->elementor_conditional = $elementor_conditional; $this->jetpack_conditional = $jetpack_conditional; $this->site_kit_integration_data = $site_kit_integration_data; $this->site_kit_consent_management_endpoint = $site_kit_consent_management_endpoint; $this->schema_configuration = $schema_configuration; } /** * {@inheritDoc} */ public function register_hooks() { \add_filter( 'wpseo_submenu_pages', [ $this, 'add_submenu_page' ], 10 ); \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ], 11 ); } /** * Adds the integrations submenu page. * * @param array $submenu_pages The Yoast SEO submenu pages. * * @return array The filtered submenu pages. */ public function add_submenu_page( $submenu_pages ) { $integrations_page = [ 'wpseo_dashboard', '', \__( 'Integrations', 'wordpress-seo' ), 'wpseo_manage_options', 'wpseo_integrations', [ $this, 'render_target' ], ]; \array_splice( $submenu_pages, 1, 0, [ $integrations_page ] ); return $submenu_pages; } /** * Enqueue the integrations app. * * @return void */ public function enqueue_assets() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved. if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpseo_integrations' ) { return; } $this->admin_asset_manager->enqueue_style( 'admin-css' ); $this->admin_asset_manager->enqueue_style( 'tailwind' ); $this->admin_asset_manager->enqueue_style( 'monorepo' ); $this->admin_asset_manager->enqueue_script( 'integrations-page' ); $acf_seo_file = 'acf-content-analysis-for-yoast-seo/yoast-acf-analysis.php'; $acf_seo_file_github = 'yoast-acf-analysis/yoast-acf-analysis.php'; $algolia_file = 'wp-search-with-algolia/algolia.php'; $old_algolia_file = 'search-by-algolia-instant-relevant-results/algolia.php'; $schema_api_integrations = $this->schema_configuration->get_schema_api_integrations(); $woocommerce_seo_installed = $schema_api_integrations['woocommerce']['isInstalled']; $woocommerce_seo_active = $schema_api_integrations['woocommerce']['isActive']; $woocommerce_active = $schema_api_integrations['woocommerce']['isPrerequisiteActive']; $woocommerce_seo_activate_url = $schema_api_integrations['woocommerce']['activationLink']; $edd_active = $schema_api_integrations['edd']['isActive']; $tec_active = $schema_api_integrations['tec']['isActive']; $ssp_active = $schema_api_integrations['ssp']['isActive']; $wp_recipe_maker_active = $schema_api_integrations['wp-recipe-maker']['isActive']; $acf_seo_installed = \file_exists( \WP_PLUGIN_DIR . '/' . $acf_seo_file ); $acf_seo_github_installed = \file_exists( \WP_PLUGIN_DIR . '/' . $acf_seo_file_github ); $acf_seo_active = \is_plugin_active( $acf_seo_file ); $acf_seo_github_active = \is_plugin_active( $acf_seo_file_github ); $acf_active = \class_exists( 'acf' ); $algolia_active = \is_plugin_active( $algolia_file ); $old_algolia_active = \is_plugin_active( $old_algolia_file ); $mastodon_active = $this->is_mastodon_active(); if ( $acf_seo_installed ) { $acf_seo_activate_url = \wp_nonce_url( \self_admin_url( 'plugins.php?action=activate&plugin=' . $acf_seo_file ), 'activate-plugin_' . $acf_seo_file ); } else { $acf_seo_activate_url = \wp_nonce_url( \self_admin_url( 'plugins.php?action=activate&plugin=' . $acf_seo_file_github ), 'activate-plugin_' . $acf_seo_file_github ); } $acf_seo_install_url = \wp_nonce_url( \self_admin_url( 'update.php?action=install-plugin&plugin=acf-content-analysis-for-yoast-seo' ), 'install-plugin_acf-content-analysis-for-yoast-seo' ); $this->admin_asset_manager->localize_script( 'integrations-page', 'wpseoIntegrationsData', [ 'semrush_integration_active' => $this->options_helper->get( 'semrush_integration_active', true ), 'allow_semrush_integration' => $this->options_helper->get( 'allow_semrush_integration_active', true ), 'algolia_integration_active' => $this->options_helper->get( 'algolia_integration_active', false ), 'allow_algolia_integration' => $this->options_helper->get( 'allow_algolia_integration_active', true ), 'wincher_integration_active' => $this->options_helper->get( 'wincher_integration_active', true ), 'allow_wincher_integration' => null, 'elementor_integration_active' => $this->elementor_conditional->is_met(), 'jetpack_integration_active' => $this->jetpack_conditional->is_met(), 'woocommerce_seo_installed' => $woocommerce_seo_installed, 'woocommerce_seo_active' => $woocommerce_seo_active, 'woocommerce_active' => $woocommerce_active, 'woocommerce_seo_activate_url' => $woocommerce_seo_activate_url, 'acf_seo_installed' => $acf_seo_installed || $acf_seo_github_installed, 'acf_seo_active' => $acf_seo_active || $acf_seo_github_active, 'acf_active' => $acf_active, 'acf_seo_activate_url' => $acf_seo_activate_url, 'acf_seo_install_url' => $acf_seo_install_url, 'algolia_active' => $algolia_active || $old_algolia_active, 'edd_integration_active' => $edd_active, 'ssp_integration_active' => $ssp_active, 'tec_integration_active' => $tec_active, 'wp-recipe-maker_integration_active' => $wp_recipe_maker_active, 'mastodon_active' => $mastodon_active, 'is_multisite' => \is_multisite(), 'plugin_url' => \plugins_url( '', \WPSEO_FILE ), 'site_kit_configuration' => $this->site_kit_integration_data->to_array(), 'site_kit_consent_management_url' => $this->site_kit_consent_management_endpoint->get_url(), 'schema_framework_enabled' => $this->options_helper->get( 'enable_schema', true ) === true && ! $this->schema_configuration->is_schema_disabled_programmatically(), ] ); } /** * Renders the target for the React to mount to. * * @return void */ public function render_target() { ?>