コード例 #1
0
ファイル: AdminPages.php プロジェクト: forthrobot/inuvik
 /**
  * Generates the Shopp admin menus
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function menus()
 {
     global $menu, $plugin_page;
     $access = 'shopp_menu';
     if (Shopp::maintenance()) {
         $access = 'manage_options';
     }
     // Add main menus
     $position = shopp_admin_add_menu(Shopp::__('Shopp'), 'orders', 40, false, 'shopp_orders', Shopp::clearpng());
     shopp_admin_add_menu(Shopp::__('Catalog'), 'products', $position, false, 'shopp_products', Shopp::clearpng());
     // Add after the Shopp menus to avoid being purged by the duplicate separator check
     $menu[$position - 1] = array('', 'read', 'separator-shopp', '', 'wp-menu-separator');
     // Add menus to WordPress admin
     foreach ($this->pages as $page) {
         $this->submenus($page);
     }
     $parent = get_admin_page_parent();
     if (isset($this->menus[$parent]) && false === strpos($this->menus[$parent], 'toplevel')) {
         $current_page = $plugin_page;
         $plugin_page = $parent;
         add_action('adminmenu', create_function('', 'global $plugin_page; $plugin_page = "' . $current_page . '";'));
     }
 }
コード例 #2
0
ファイル: Admin.php プロジェクト: forthrobot/inuvik
 /**
  * Adds a maintenance mode notice to every admin screen
  *
  * @since 1.3
  *
  * @return void
  **/
 public function maintenance()
 {
     if (ShoppLoader::is_activating() || Shopp::upgradedb()) {
         return;
     }
     $setting = isset($_POST['settings']['maintenance']) ? $_POST['settings']['maintenance'] : false;
     $nonce = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : false;
     if (false !== $setting && wp_verify_nonce($nonce, 'shopp-setup')) {
         shopp_set_setting('maintenance', $setting);
     }
     if (!Shopp::maintenance()) {
         return;
     }
     if (wp_verify_nonce($this->request('_wpnonce'), 'shopp_disable_maintenance')) {
         shopp_set_setting('maintenance', 'off');
     } else {
         $url = wp_nonce_url(add_query_arg('page', ShoppAdmin::pagename('settings'), admin_url('admin.php')), 'shopp_disable_maintenance');
         $this->Screen->notice(Shopp::__('Shopp is currently in maintenance mode. %sDisable Maintenance Mode%s', '<a href="' . $url . '" class="button">', '</a>'), 'error', 1);
     }
 }
コード例 #3
0
 /**
  * Sets handlers for Shopp shortcodes
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function shortcodes()
 {
     $this->shortcodes = array();
     // Additional shortcode functionality
     $this->shortcodes['catalog-product'] = array('ShoppShortcodes', 'product');
     $this->shortcodes['catalog-buynow'] = array('ShoppShortcodes', 'buynow');
     $this->shortcodes['catalog-collection'] = array('ShoppShortcodes', 'collection');
     foreach ($this->shortcodes as $name => &$callback) {
         if (shopp_setting_enabled('maintenance') || !ShoppSettings()->available() || Shopp::maintenance()) {
             add_shortcode($name, array('', 'maintenance_shortcode'));
         } else {
             add_shortcode($name, $callback);
         }
     }
 }
コード例 #4
0
ファイル: Flow.php プロジェクト: BlessySoftwares/anvelocom
 /**
  * Handles maintenance mode messages
  **/
 private function maintenance()
 {
     if (ShoppLoader::is_activating() || Shopp::upgradedb()) {
         return;
     }
     if (isset($_POST['settings']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'shopp-setup')) {
         if (isset($_POST['settings']['maintenance'])) {
             shopp_set_setting('maintenance', $_POST['settings']['maintenance']);
         }
     }
     if (Shopp::maintenance()) {
         if (isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'shopp_disable_maintenance')) {
             shopp_set_setting('maintenance', 'off');
         } else {
             $url = wp_nonce_url(add_query_arg('page', $this->Admin->pagename('setup'), admin_url('admin.php')), 'shopp_disable_maintenance');
             $this->notice(Shopp::__('Shopp is currently in maintenance mode. %sDisable Maintenance Mode%s', '<a href="' . $url . '" class="button">', '</a>'), 'error', 1);
         }
     }
 }