/** * Settings object constructor * * If no settings are available (the table doesn't exist), * the unavailable flag is set. * * @since 1.0 * @version 1.1 **/ private function __construct() { $this->_table = $this->tablename(self::$table); $this->bootup = ShoppLoader::is_activating(); if ($this->bootup) { add_action('shopp_init', array($this, 'booted')); } }
/** * 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); } }
/** * 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); } } }