' . esc_attr( $text ) . ''; array_unshift( $links, $settings_link ); return $links; } public static function footer_text( $footer_text ) { global $pagenow; if ( $pagenow === 'admin.php' && ( isset( $_GET['page'] ) && $_GET['page'] === WPCoder::SLUG ) ) { $text = sprintf( /* translators: 1. link to the plugin page 2. plugin name */ __( 'Thank you for using %2$s! Please rate us', 'wp-coder' ), esc_url( WPCoder::PluginURL ), esc_attr( WPCoder::info( 'name' ) ) ); return str_replace( '', '', $footer_text ) . ' | ' . $text . ''; } return $footer_text; } public static function add_admin_page(): void { $icon = 'data:image/svg+xml;base64,' . base64_encode( self::icon() ); $parent = 'wp-coder'; $title = WPCoder::info( 'name' ) . ' version ' . WPCoder::info( 'version' ); $menu_title = 'All Codes'; $capability = 'unfiltered_html'; $slug = WPCoder::SLUG; add_menu_page( 'WP Coder Pro', 'WP Coder', 'unfiltered_html', $slug, [ __CLASS__, 'plugin_page' ], $icon ); add_submenu_page( $slug, $title, $menu_title, $capability, $slug, [ __CLASS__, 'plugin_page' ] ); add_submenu_page( $slug, $title, 'Add new', $capability, $slug . '-settings', [ __CLASS__, 'settings' ] ); add_submenu_page( $slug, $title, 'Snippets', $capability, $slug . '-snippets', [ __CLASS__, 'snippets' ] ); add_submenu_page( $slug, $title, 'Tools', $capability, $slug . '-tools', [ __CLASS__, 'tools' ] ); add_submenu_page( $slug, $title, 'Global PHP', $capability, $slug . '-global', [ __CLASS__, 'global_php' ] ); add_submenu_page( $slug, $title, 'Debug Log', $capability, $slug . '-debug', [ __CLASS__, 'debug_log' ] ); add_submenu_page( $slug, $title, 'Import / Export', $capability, $slug . '-import-export', [ __CLASS__, 'import_export' ] ); add_submenu_page( $slug, $title, 'Support', $capability, $slug . '-support', [ __CLASS__, 'support' ] ); } public static function icon(): string { return ' '; } public static function plugin_page(): void { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/1.list.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function settings(): void { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/2.settings.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function snippets() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/3.snippets.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function tools() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/4.tools.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function global_php() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/5.global-php.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function import_export() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/6.import-export.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function support() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/7.support.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function debug_log() { $page_path = DashboardHelper::get_folder_path( 'pages' ) . '/10.debug-log.php'; if ( file_exists( $page_path ) ) { require_once $page_path; } } public static function admin_scripts( $hook ): void { // $page = 'toplevel_page_' . WPCoder::SLUG; $assets_url = WPCoder::url() . 'assets/'; wp_enqueue_style( 'wowp-general-admin', $assets_url . 'css/admin-general.css' ); $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; if ( strpos( $page, WPCoder::SLUG ) === false ) { return; } do_action( WPCoder::PREFIX . '_admin_load_styles_scripts' ); } }