コード例 #1
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);
     }
 }
コード例 #2
0
ファイル: AdminPages.php プロジェクト: forthrobot/inuvik
 /**
  * Adds a ShoppAdminPage entry to the WordPress menus under the Shopp menus
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @param ShoppAdminPage $Page A ShoppAdminPage object
  * @return void
  **/
 private function submenus(ShoppAdminPage $Page)
 {
     $name = $Page->name;
     $pagehook = $Page->page;
     // Set capability
     $capability = isset($this->caps[$name]) ? $this->caps[$name] : 'none';
     $taxonomies = get_object_taxonomies(ShoppProduct::$posttype, 'names');
     if (in_array("shopp_{$name}", $taxonomies)) {
         $capability = 'shopp_categories';
     }
     // Set controller (callback handler)
     $controller = array(ShoppAdmin(), 'route');
     if (Shopp::upgradedb()) {
         $controller = array('ShoppAdmin', 'updatedb');
     }
     $menu = $Page->parent ? $Page->parent : $this->mainmenu;
     shopp_admin_add_submenu($Page->label, $pagehook, $menu, $controller, $capability);
 }
コード例 #3
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);
         }
     }
 }