文件操作 - add-switch-page.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/ionos-assistant/inc/add-switch-page.php
编辑文件内容
<?php /** * . * * @package Ionos\Assistant */ namespace Ionos\Assistant\SwitchPage; // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Helper function for wp_option 'ionos_group_brand_menu'. * Used in visible stuff to the user. */ function get_brand_menu() { return \get_option( 'ionos_group_brand_menu', 'IONOS' ); } /** * Helper function for wp_option 'ionos_group_brand'. * Used in urls and internal stuff. */ function get_brand_lowercase() { return strtolower( \get_option( 'ionos_group_brand', 'ionos' ) ); } /** * Add onboarding menu page. */ \add_action( 'admin_menu', fn () => // submenu_page without parent so it doesnt show in admin menu. \add_submenu_page( null, 'Assistant', 'Assistant', 'manage_options', get_brand_lowercase() . '-onboarding', fn () => \load_template( __DIR__ . '/views/switch-page.php' ) ) ); /** * Redirects to extendify-launch are caught. * We send the user to the ai-switch-page */ \add_filter( 'wp_redirect', function ( $location ) { if ( $location === \admin_url() . 'admin.php?page=extendify-launch' ) { return \admin_url() . 'admin.php?page=' . get_brand_lowercase() . '-onboarding'; } return $location; } ); \add_filter( 'admin_title', function ( $title ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset( $_GET['page'] ) && $_GET['page'] === get_brand_lowercase() . '-onboarding' ) { return get_brand_menu() . ' ' . __( 'Onboarding', 'ionos-assistant' ); } return $title; }, 11 ); \add_action( 'admin_enqueue_scripts', function ( $hook_suffix ) { if ( ! str_contains( $hook_suffix, '_page_' . get_brand_lowercase() . '-onboarding' ) ) { return; } \wp_enqueue_style( 'ionos-assistant-switch-page', \plugins_url( 'css/switch-page.css', __DIR__ ), [], filemtime( __DIR__ . '/css/switch-page.css' ) ); } );
修改文件时间
将文件时间修改为当前时间的前一年
删除文件