/**
* 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
0
/**
 * 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
0
/**
 * 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;
    }
}
/**
 * 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
0
/**
 * 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;
}
/**
 * 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
0
 /**
  * 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
0
파일: upgrade.php 프로젝트: hscale/webento
/**
 * 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
0
파일: admin.php 프로젝트: netmagik/netmagik
 /**
  * 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
0
/**
 * 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
0
파일: update.php 프로젝트: hscale/webento
/**
 * 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;
}