pache or something else. * * @global bool $is_apache */ $is_apache = ( str_contains( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) || str_contains( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) ); /** * Whether the server software is Nginx or something else. * * @global bool $is_nginx */ $is_nginx = ( str_contains( $_SERVER['SERVER_SOFTWARE'], 'nginx' ) ); /** * Whether the server software is Caddy / FrankenPHP or something else. * * @global bool $is_caddy */ $is_caddy = ( str_contains( $_SERVER['SERVER_SOFTWARE'], 'Caddy' ) || str_contains( $_SERVER['SERVER_SOFTWARE'], 'FrankenPHP' ) ); /** * Whether the server software is IIS or something else. * * @global bool $is_IIS */ $is_IIS = ! $is_apache && ( str_contains( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) || str_contains( $_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer' ) ); /** * Whether the server software is IIS 7.X or greater. * * @global bool $is_iis7 */ $is_iis7 = $is_IIS && (int) substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) >= 7; /** * Test if the current browser runs on a mobile device (smart phone, tablet, etc.). * * @since 3.4.0 * @since 6.4.0 Added checking for the Sec-CH-UA-Mobile request header. * * @return bool */ function wp_is_mobile() { if ( isset( $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ) ) { // This is the `Sec-CH-UA-Mobile` user agent client hint HTTP request header. // See . $is_mobile = ( '?1' === $_SERVER['HTTP_SEC_CH_UA_MOBILE'] ); } elseif ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $is_mobile = false; } elseif ( str_contains( $_SERVER['HTTP_USER_AGENT'], 'Mobile' ) // Many mobile devices (all iPhone, iPad, etc.) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'Android' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'Silk/' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'Kindle' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'BlackBerry' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) || str_contains( $_SERVER['HTTP_USER_AGENT'], 'Opera Mobi' ) ) { $is_mobile = true; } else { $is_mobile = false; } /** * Filters whether the request should be treated as coming from a mobile device or not. * * @since 4.9.0 * * @param bool $is_mobile Whether the request is from a mobile device or not. */ return apply_filters( 'wp_is_mobile', $is_mobile ); } ddon_Manager $addon_manager, Task_List_Configuration $task_list_configuration ) { $this->asset_manager = $asset_manager; $this->current_page_helper = $current_page_helper; $this->product_helper = $product_helper; $this->shortlink_helper = $shortlink_helper; $this->notification_helper = $notification_helper; $this->alert_dismissal_action = $alert_dismissal_action; $this->promotion_manager = $promotion_manager; $this->dashboard_configuration = $dashboard_configuration; $this->user_helper = $user_helper; $this->options_helper = $options_helper; $this->woocommerce_conditional = $woocommerce_conditional; $this->addon_manager = $addon_manager; $this->task_list_configuration = $task_list_configuration; } /** * Returns the conditionals based on which this loadable should be active. * * @return array */ public static function get_conditionals() { return [ Admin_Conditional::class, Non_Network_Admin_Conditional::class ]; } /** * Initializes the integration. * * This is the place to register hooks and filters. * * @return void */ public function register_hooks() { // Add page. \add_filter( 'wpseo_submenu_pages', [ $this, 'add_page' ] ); // Are we on the dashboard page? if ( $this->current_page_helper->get_current_yoast_seo_page() === self::PAGE ) { \add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] ); } } /** * Adds the page. * * @param array> $pages The pages. * * @return array> The pages. */ public function add_page( $pages ) { \array_splice( $pages, 0, 0, [ [ self::PAGE, '', \__( 'General', 'wordpress-seo' ), 'wpseo_manage_options', self::PAGE, [ $this, 'display_page' ], ], ] ); return $pages; } /** * Displays the page. * * @return void */ public function display_page() { echo '
'; } /** * Enqueues the assets. * * @return void */ public function enqueue_assets() { // Remove the emoji script as it is incompatible with both React and any contenteditable fields. \remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); \wp_enqueue_media(); $this->asset_manager->enqueue_script( 'general-page' ); $this->asset_manager->enqueue_style( 'general-page' ); if ( $this->promotion_manager->is( 'black-friday-promotion' ) ) { $this->asset_manager->enqueue_style( 'black-friday-banner' ); } $this->asset_manager->localize_script( 'general-page', 'wpseoScriptData', $this->get_script_data() ); } /** * Creates the script data. * * @return array The script data. */ private function get_script_data() { return [ 'preferences' => [ 'isPremium' => $this->product_helper->is_premium(), 'isRtl' => \is_rtl(), 'pluginUrl' => \plugins_url( '', \WPSEO_FILE ), 'upsellSettings' => [ 'actionId' => 'load-nfd-ctb', 'premiumCtbId' => 'f6a84663-465f-4cb5-8ba5-f7a6d72224b2', ], 'llmTxtEnabled' => $this->options_helper->get( 'enable_llms_txt', true ), 'isWooCommerceActive' => $this->woocommerce_conditional->is_met(), 'addonsStatus' => [ 'isWooSeoActive' => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ) ), 'isLocalSEOActive' => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::LOCAL_SLUG ) ), 'isNewsSEOActive' => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::NEWS_SLUG ) ), 'isVideoSEOActive' => \is_plugin_active( $this->addon_manager->get_plugin_file( WPSEO_Addon_Manager::VIDEO_SLUG ) ), 'isDuplicatePostActive' => \defined( 'DUPLICATE_POST_FILE' ), ], ], 'adminUrl' => \admin_url( 'admin.php' ), 'linkParams' => $this->shortlink_helper->get_query_params(), 'userEditUrl' => \add_query_arg( 'user_id', '{user_id}', \admin_url( 'user-edit.php' ) ), 'alerts' => $this->notification_helper->get_alerts(), 'currentPromotions' => $this->promotion_manager->get_current_promotions(), 'dismissedAlerts' => $this->alert_dismissal_action->all_dismissed(), 'dashboard' => $this->dashboard_configuration->get_configuration(), 'optInNotificationSeen' => [ 'task_list' => $this->is_task_list_opt_in_notification_seen(), ], 'taskListConfiguration' => $this->task_list_configuration->get_configuration(), ]; } /** * Gets if the llms.txt opt-in notification has been seen. * * @return bool True if the notification has been seen, false otherwise. */ private function is_task_list_opt_in_notification_seen(): bool { $current_user_id = $this->user_helper->get_current_user_id(); return (bool) $this->user_helper->get_meta( $current_user_id, '_yoast_wpseo_task_list_opt_in_notification_seen', true ); } } Page non trouvée -