本文整理汇总了PHP中genesis_admin_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_admin_redirect函数的具体用法?PHP genesis_admin_redirect怎么用?PHP genesis_admin_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_admin_redirect函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zpsettings_register_settings
/**
* zpsettings_register_settings function.
*/
function zpsettings_register_settings()
{
register_setting(ZP_SETTINGS_FIELD, ZP_SETTINGS_FIELD);
add_option(ZP_SETTINGS_FIELD, zpsettings_default_theme_options());
if (genesis_get_option('reset', ZP_SETTINGS_FIELD)) {
update_option(ZP_SETTINGS_FIELD, zpsettings_default_theme_options());
genesis_admin_redirect(ZP_SETTINGS_FIELD, array('reset' => 'true'));
exit;
}
}
示例2: genesis_disable_scribe_nag
/**
* This function detects a query flag, and disables the Scribe nag,
* then redirects the user back to the SEO settings page.
*/
function genesis_disable_scribe_nag()
{
if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'seo-settings') {
return;
}
if (!isset($_REQUEST['dismiss-scribe']) || $_REQUEST['dismiss-scribe'] !== 'true') {
return;
}
update_option('genesis-scribe-nag-disabled', 1);
genesis_admin_redirect('seo-settings');
exit;
}
示例3: register_genesis_responsive_slider_settings
/**
* This registers the settings field
*/
function register_genesis_responsive_slider_settings()
{
register_setting(GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD, GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD);
add_option(GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD, genesis_responsive_slider_defaults(), '', 'yes');
if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis_responsive_slider') {
return;
}
if (genesis_get_responsive_slider_option('reset')) {
update_option(GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD, genesis_responsive_slider_defaults());
genesis_admin_redirect('genesis_responsive_slider', array('reset' => 'true'));
exit;
}
}
示例4: genesis_register_theme_settings
/**
* This registers the settings field and adds defaults to the options table.
* It also handles settings resets by pushing in the defaults.
*/
function genesis_register_theme_settings()
{
register_setting(GENESIS_SETTINGS_FIELD, GENESIS_SETTINGS_FIELD);
add_option(GENESIS_SETTINGS_FIELD, genesis_theme_settings_defaults());
if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis') {
return;
}
if (genesis_get_option('reset')) {
update_option(GENESIS_SETTINGS_FIELD, genesis_theme_settings_defaults());
genesis_admin_redirect('genesis', array('reset' => 'true'));
exit;
}
}
示例5: genesis_upgrade_redirect
/**
* Redirect the user back to the theme settings page, refreshing the data and notifying the user that they have
* successfully updated.
*
* @since 1.6.0
*
* @uses genesis_admin_redirect() Redirect the user to an admin page, and add query args to the URL string for alerts.
*
* @return null Returns early if not an admin page.
*/
function genesis_upgrade_redirect()
{
if (!is_admin() || !current_user_can('edit_theme_options')) {
return;
}
genesis_admin_redirect('genesis', array('upgraded' => 'true'));
#genesis_admin_redirect( 'genesis-upgraded' );
exit;
}
示例6: genesis_import
/**
* This function handles the import.
*
* @since 1.4
*/
function genesis_import()
{
if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis-import-export') {
return;
}
if (empty($_REQUEST['genesis-import'])) {
return;
}
check_admin_referer('genesis-import');
// Verify nonce
/** hookable */
do_action('genesis_import', $_REQUEST['genesis-import'], $_FILES['genesis-import-upload']);
/** Extract file contents */
$upload = file_get_contents($_FILES['genesis-import-upload']['tmp_name']);
/** Decode the JSON */
$options = json_decode($upload, true);
/** Check for errors */
if (!$options || $_FILES['genesis-import-upload']['error']) {
genesis_admin_redirect('genesis-import-export', array('error' => 'true'));
exit;
}
/** Cycle through data, import settings */
foreach ((array) $options as $key => $settings) {
update_option($key, $settings);
}
/** Redirect, add success flag to the URI */
genesis_admin_redirect('genesis-import-export', array('imported' => 'true'));
exit;
}
示例7: import
/**
* Handle the file uploaded to import settings.
*
* Upon upload, the file contents are JSON-decoded. If there were errors, or no options to import, then reload the
* page to show an error message.
*
* Otherwise, loop through the array of option sets, and update the data under those keys in the database.
* Afterwards, reload the page with a success message.
*
* Calls genesis_import action is fired after checking we can proceed, but before attempting to extract the contents
* from the uploaded file.
*
* @since 1.4.0
*
* @uses genesis_is_menu_page() Check if we're on a Genesis page
* @uses genesis_admin_redirect() Redirect user to an admin page
*
* @return null Return null if not correct admin page, we're not importing
*/
public function import()
{
if (!genesis_is_menu_page('genesis-import-export')) {
return;
}
if (empty($_REQUEST['genesis-import'])) {
return;
}
check_admin_referer('genesis-import');
do_action('genesis_import', $_REQUEST['genesis-import'], $_FILES['genesis-import-upload']);
$upload = file_get_contents($_FILES['genesis-import-upload']['tmp_name']);
$options = json_decode($upload, true);
//* Check for errors
if (!$options || $_FILES['genesis-import-upload']['error']) {
genesis_admin_redirect('genesis-import-export', array('error' => 'true'));
exit;
}
//* Identify the settings keys that we should import
$exportables = $this->get_export_options();
$importable_keys = array();
foreach ($exportables as $exportable) {
$importable_keys[] = $exportable['settings-field'];
}
//* Cycle through data, import Genesis settings
foreach ((array) $options as $key => $settings) {
if (in_array($key, $importable_keys)) {
update_option($key, $settings);
}
}
//* Redirect, add success flag to the URI
genesis_admin_redirect('genesis-import-export', array('imported' => 'true'));
exit;
}
示例8: genesis_upgrade_redirect
/**
* Redirects the user back to the theme settings page, refreshing the data and
* notifying the user that they have successfully updated.
*
* @since 1.6.0
*
* @uses genesis_admin_redirect()
*
* @return null Returns early if not an admin page.
*/
function genesis_upgrade_redirect()
{
if (!is_admin()) {
return;
}
genesis_admin_redirect('genesis', array('upgraded' => 'true'));
exit;
}
示例9: register_settings
/**
* Register the database settings for storage.
*
* @since 1.8.0
*
* @return null Return early if admin page doesn't store settings, or user is not on the correct admin page.
*/
public function register_settings()
{
// If this page doesn't store settings, no need to register them.
if (!$this->settings_field) {
return;
}
register_setting($this->settings_field, $this->settings_field);
add_option($this->settings_field, $this->default_settings);
if (!genesis_is_menu_page($this->page_id)) {
return;
}
if (genesis_get_option('reset', $this->settings_field)) {
if (update_option($this->settings_field, $this->default_settings)) {
genesis_admin_redirect($this->page_id, array('reset' => 'true'));
} else {
genesis_admin_redirect($this->page_id, array('error' => 'true'));
}
exit;
}
}
示例10: genesis_upgrade_redirect
/**
* Redirect the user back to the theme settings page, refreshing the data and notifying the user that they have
* successfully updated.
*
* @since 1.6.0
*
* @return null Return early if not an admin page.
*/
function genesis_upgrade_redirect()
{
if (!is_admin() || !current_user_can('edit_theme_options') || is_customize_preview()) {
return;
}
// @codingStandardsIgnoreStart
genesis_admin_redirect('genesis', array('upgraded' => 'true'));
#genesis_admin_redirect( 'genesis-upgraded' );
// @codingStandardsIgnoreEnd
exit;
}
示例11: prose_update_redirect
/**
* Redirects the user back to the design settings page, refreshing the data and
* notifying the user that they have successfully updated.
*
* @since 1.5.0
*
* @uses genesis_admin_redirect()
*
* @return null Returns early if not an admin page.
*/
function prose_update_redirect()
{
if (!is_admin()) {
return;
}
genesis_admin_redirect('design-settings', array('upgraded' => 'true'));
exit;
}