public function __construct() { if (!ShoppAdminPages()->shoppscreen()) { return; } // Get the query request $this->query(); // Setup the screen controller $ControllerClass = $this->route(); if (false == $ControllerClass || !class_exists($ControllerClass)) { return; } $this->Screen = new $ControllerClass($this->ui); // Queue JavaScript & CSS add_action('admin_enqueue_scripts', array($this, 'assets'), 50); // Screen setup global $pagenow; $screen = ShoppAdmin::screen(); if ($screen == $this->request('post_type')) { $screen = $pagenow; } add_action('load-' . $screen, array($this, 'help')); add_action('load-' . $screen, array($this, 'layout')); add_action('load-' . $screen, array($this, 'maintenance')); }
/** * Defines the Shopp admin page and menu structure * * @since 1.1 * * @return void **/ public function menu() { if (!is_admin()) { return; } $Pages = ShoppAdminPages(); do_action('shopp_admin_menu'); $Pages->menus(); }
function is_shopp_admin_screen() { $Pages = ShoppAdminPages(); }
/** * Renders screen tabs from a given associative array * * The tab array uses a tab page slug as the key and the * localized title as the value. * * @since 1.3 * * @param array $tabs The tab map array * @return void **/ protected function tabs() { global $plugin_page; $tabs = ShoppAdminPages()->tabs($plugin_page); $first = current($tabs); $default = $first[1]; $markup = ''; foreach ($tabs as $index => $entry) { list($title, $tab, $parent, $icon) = $entry; $slug = substr($tab, strrpos($tab, '-') + 1); // Check settings to ensure enabled if ($this->hiddentab($slug)) { continue; } $classes = array($tab); if ($plugin_page == $parent && $default == $tab || $plugin_page == $tab) { $classes[] = 'current'; } $url = add_query_arg(array('page' => $tab), admin_url('admin.php')); $markup .= '<li class="' . esc_attr(join(' ', $classes)) . '"><a href="' . esc_url($url) . '">' . ' <div class="shopp-settings-icon ' . $icon . '"></div>' . ' <div class="shopp-settings-label">' . esc_html($title) . '</div>' . '</a></li>'; } $pagehook = sanitize_key($plugin_page); return '<div id="shopp-settings-menu" class="clearfix"><ul class="wp-submenu">' . apply_filters('shopp_admin_' . $pagehook . '_screen_tabs', $markup) . '</ul></div>'; }