theme_info = wp_get_theme(); add_action( 'admin_menu', array( $this, 'menu' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ), true, '1.0.0' ); } /** * Register Menu */ public function menu() { add_theme_page( $this->theme_info->name, $this->theme_info->name, 'manage_options', 'theme-page', array( $this, 'callback') ); } /** * Render Menu */ public function callback() { echo '

' . $this->theme_info->name . '

'; $this->pages(); } public function tabs( $current = 'introduction' ) { $tabs = array( 'introduction' => esc_html__( 'Introduction', 'camaraderie' ), ); $admin_nonce = wp_create_nonce( 'admin_nonce' ); echo '

'; foreach ( $tabs as $tab => $name ) { $class = ( $tab === $current ) ? ' nav-tab-active' : ''; echo "$name"; // XSS OK. } echo '

'; } public function pages() { global $pagenow; if ( isset( $_GET['tab'] ) && isset( $_GET['_wp_nonce'] ) && false !== wp_verify_nonce( $_GET['_wp_nonce'], 'admin_nonce' ) ) {// WPCS: input var ok. $this->tabs( esc_html( wp_unslash( $_GET['tab'] ) ) ); // WPCS: input var ok, sanitization ok. } else { $this->tabs( 'introduction' ); } echo '
'; if ( 'themes.php' === $pagenow && 'theme-page' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) { // WPCS: input var ok. if ( isset( $_GET['tab'] ) && isset( $_GET['_wp_nonce'] ) && false !== wp_verify_nonce( $_GET['_wp_nonce'], 'admin_nonce' ) ) { // WPCS: input var ok, sanitization ok. $this->tab = esc_html( wp_unslash( $_GET['tab'] ) ); // WPCS: input var ok, sanitization ok. } else { $this->tab = 'introduction'; } switch ( $this->tab ) { case 'introduction': $this->introduction(); break; } } echo '
'; } public function introduction() { ?>

theme_info->description ); ?>