本文整理汇总了PHP中Shopp::maintenance方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::maintenance方法的具体用法?PHP Shopp::maintenance怎么用?PHP Shopp::maintenance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shopp
的用法示例。
在下文中一共展示了Shopp::maintenance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: menus
/**
* 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: maintenance
/**
* 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: shortcodes
/**
* 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: maintenance
/**
* 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);
}
}
}