/**
  * Add all settings sections and fields
  *
  * @since 2.0
  * @return void
  */
 function register_settings()
 {
     foreach ($this->get_registered_settings() as $tab => $settings) {
         add_settings_section('fp5_settings_' . $tab, __return_null(), '__return_false', 'flowplayer5_settings');
         foreach ($settings as $key => $option) {
             $callback = !empty($option['callback']) ? $option['callback'] : array($this, $option['type'] . '_callback');
             add_settings_field('fp5_settings_general[' . $key . ']', isset($option['name']) ? $option['name'] : '', is_callable($callback) ? $callback : array($this, 'missing_callback'), 'flowplayer5_settings', 'fp5_settings_' . $tab, array('id' => $key, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : null, 'button' => isset($option['button']) ? $option['button'] : __('Upload', 'flowplayer5'), 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
         }
     }
     // Creates our settings in the options table
     register_setting('fp5_settings_group', 'fp5_settings_general', array($this, 'sanitize_settings'));
 }
Esempio n. 2
0
/**
 * Add settings sections and fields
 *
 * @since       1.0.0
 * @return      void
 */
function saasaparilla_register_settings()
{
    if (get_option('saasaparilla_settings') == false) {
        add_option('saasaparilla_settings');
    }
    foreach (saasaparilla_get_registered_settings() as $tab => $settings) {
        add_settings_section('saasaparilla_settings_' . $tab, __return_null(), '__return_false', 'saasaparilla_settings_' . $tab);
        foreach ($settings as $option) {
            $name = isset($option['name']) ? $option['name'] : '';
            add_settings_field('saasaparilla_settings[' . $option['id'] . ']', $name, function_exists('saasaparilla_' . $option['type'] . '_callback') ? 'saasaparilla_' . $option['type'] . '_callback' : 'saasaparilla_missing_callback', 'saasaparilla_settings_' . $tab, 'saasaparilla_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, 'rows' => isset($option['rows']) ? $option['rows'] : null, 'buttons' => isset($option['buttons']) ? $option['buttons'] : null, 'wpautop' => isset($option['wpautop']) ? $option['wpautop'] : null, 'teeny' => isset($option['teeny']) ? $option['teeny'] : null, 'notice' => isset($option['notice']) ? $option['notice'] : false, 'style' => isset($option['style']) ? $option['style'] : null, 'header' => isset($option['header']) ? $option['header'] : null, 'icon' => isset($option['icon']) ? $option['icon'] : null, 'class' => isset($option['class']) ? $option['class'] : null));
        }
    }
    register_setting('saasaparilla_settings', 'saasaparilla_settings', 'saasaparilla_settings_sanitize');
}
/**
 * Add all settings sections and fields
 *
 * @since  1.0
 * @author Bryan Monzon
 * @return void
*/
function egt_register_settings()
{
    if (false == get_option('egt_settings')) {
        add_option('egt_settings');
    }
    foreach (egt_get_registered_settings() as $tab => $settings) {
        add_settings_section('egt_settings_' . $tab, __return_null(), '__return_false', 'egt_settings_' . $tab);
        foreach ($settings as $option) {
            add_settings_field('egt_settings[' . $option['id'] . ']', $option['name'], function_exists('egt_' . $option['type'] . '_callback') ? 'egt_' . $option['type'] . '_callback' : 'egt_missing_callback', 'egt_settings_' . $tab, 'egt_settings_' . $tab, array('id' => $option['id'], 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => $option['name'], 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
        }
    }
    // Creates our settings in the options table
    register_setting('egt_settings', 'egt_settings', 'egt_settings_sanitize');
}
Esempio n. 4
0
 /**
  * Registers the actual options via WordPress Settings API.
  *
  * @return void
  */
 static function admin_init()
 {
     if (false == get_option('portfolio_slideshow_options')) {
         add_option('portfolio_slideshow_options');
     }
     $registered_settings = self::get_registered_settings();
     foreach ($registered_settings as $tab => $settings) {
         add_settings_section('portfolio_slideshow_' . $tab, __return_null(), '__return_false', 'portfolio_slideshow');
         foreach ($settings as $option) {
             $name = isset($option['name']) ? $option['name'] : '';
             add_settings_field('portfolio_slideshow_' . $option['id'], $name, array(__CLASS__, 'callback_' . $option['type']), 'portfolio_slideshow', 'portfolio_slideshow_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null));
         }
     }
     register_setting('portfolio_slideshow_options', 'portfolio_slideshow_options', array(__CLASS__, 'sanitize_options'));
 }
/**
 * Add all settings sections and fields
 *
 * @since 1.0
 * @return void
 */
function popmake_register_settings()
{
    if (false == get_option('popmake_settings')) {
        add_option('popmake_settings', popmake_default_settings());
    }
    foreach (popmake_get_registered_settings() as $tab => $settings) {
        add_settings_section('popmake_settings_' . $tab, __return_null(), '__return_false', 'popmake_settings_' . $tab);
        foreach ($settings as $option) {
            $name = isset($option['name']) ? $option['name'] : '';
            add_settings_field('popmake_settings[' . $option['id'] . ']', $name, function_exists('popmake_' . $option['type'] . '_callback') ? 'popmake_' . $option['type'] . '_callback' : 'popmake_missing_callback', 'popmake_settings_' . $tab, 'popmake_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null));
        }
    }
    // Creates our settings in the options table
    register_setting('popmake_settings', 'popmake_settings', 'popmake_settings_sanitize');
}
Esempio n. 6
0
 /**
  * Add all settings sections and fields
  *
  * @since 1.0
  * @return void
  */
 function register_settings()
 {
     if (false == get_option('affwp_settings')) {
         add_option('affwp_settings');
     }
     foreach ($this->get_registered_settings() as $tab => $settings) {
         add_settings_section('affwp_settings_' . $tab, __return_null(), '__return_false', 'affwp_settings_' . $tab);
         foreach ($settings as $key => $option) {
             $name = isset($option['name']) ? $option['name'] : '';
             add_settings_field('affwp_settings[' . $key . ']', $name, is_callable(array($this, $option['type'] . '_callback')) ? array($this, $option['type'] . '_callback') : array($this, 'missing_callback'), 'affwp_settings_' . $tab, 'affwp_settings_' . $tab, array('id' => $key, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'min' => isset($option['min']) ? $option['min'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
         }
     }
     // Creates our settings in the options table
     register_setting('affwp_settings', 'affwp_settings', array($this, 'sanitize_settings'));
 }
 /**
  * Register the plugins core settings and options.
  *
  * @access private
  * @since  1.0
  * @static
  */
 public static function register()
 {
     if (FALSE === get_option('ez-toc-settings')) {
         add_option('ez-toc-settings', self::getDefaults());
     }
     foreach (self::getRegistered() as $section => $settings) {
         add_settings_section('ez_toc_settings_' . $section, __return_null(), '__return_false', 'ez_toc_settings_' . $section);
         foreach ($settings as $option) {
             $name = isset($option['name']) ? $option['name'] : '';
             add_settings_field('ez-toc-settings[' . $option['id'] . ']', $name, method_exists(__CLASS__, $option['type']) ? array(__CLASS__, $option['type']) : array(__CLASS__, 'missingCallback'), 'ez_toc_settings_' . $section, 'ez_toc_settings_' . $section, array('section' => $section, 'id' => isset($option['id']) ? $option['id'] : NULL, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : NULL, 'size' => isset($option['size']) ? $option['size'] : NULL, 'options' => isset($option['options']) ? $option['options'] : '', 'default' => isset($option['default']) ? $option['default'] : '', 'min' => isset($option['min']) ? $option['min'] : NULL, 'max' => isset($option['max']) ? $option['max'] : NULL, 'step' => isset($option['step']) ? $option['step'] : NULL, 'chosen' => isset($option['chosen']) ? $option['chosen'] : NULL, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : NULL, 'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : TRUE, 'readonly' => isset($option['readonly']) ? $option['readonly'] : FALSE, 'faux' => isset($option['faux']) ? $option['faux'] : FALSE));
         }
     }
     // Creates our settings in the options table
     register_setting('ez-toc-settings', 'ez-toc-settings', array(__CLASS__, 'sanitize'));
 }
 /**
  * Register all settings sections and fields.
  *
  * @since 	1.0.0
  * @return 	void
  */
 public function register_settings()
 {
     if (false == get_option('plugin_name_settings')) {
         add_option('plugin_name_settings', array(), '', 'yes');
     }
     foreach ($this->registered_settings as $tab => $settings) {
         // add_settings_section( $id, $title, $callback, $page )
         add_settings_section('plugin_name_settings_' . $tab, __return_null(), '__return_false', 'plugin_name_settings_' . $tab);
         foreach ($settings as $key => $option) {
             $_name = isset($option['name']) ? $option['name'] : $key;
             // add_settings_field( $id, $title, $callback, $page, $section, $args )
             add_settings_field('plugin_name_settings[' . $key . ']', $_name, method_exists($this->callback, $option['type'] . '_callback') ? array($this->callback, $option['type'] . '_callback') : array($this->callback, 'missing_callback'), 'plugin_name_settings_' . $tab, 'plugin_name_settings_' . $tab, array('id' => $key, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => $_name, 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : 'regular', 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'max' => isset($option['max']) ? $option['max'] : 999999, 'min' => isset($option['min']) ? $option['min'] : 0, 'step' => isset($option['step']) ? $option['step'] : 1));
         }
         // end foreach
     }
     // end foreach
     // Creates our settings in the options table
     register_setting('plugin_name_settings', 'plugin_name_settings', array($this->sanitization, 'settings_sanitize'));
 }
Esempio n. 9
0
 /**
  * Add all settings sections and fields
  *
  * @since 1.0
  * @return void
  */
 function register_settings()
 {
     if (false == get_option('affwp_settings')) {
         add_option('affwp_settings');
     }
     foreach ($this->get_registered_settings() as $tab => $settings) {
         add_settings_section('affwp_settings_' . $tab, __return_null(), '__return_false', 'affwp_settings_' . $tab);
         foreach ($settings as $key => $option) {
             if ($option['type'] == 'checkbox' || $option['type'] == 'multicheck' || $option['type'] == 'radio') {
                 $name = isset($option['name']) ? $option['name'] : '';
             } else {
                 $name = isset($option['name']) ? '<label for="affwp_settings[' . $key . ']">' . $option['name'] . '</label>' : '';
             }
             $callback = !empty($option['callback']) ? $option['callback'] : array($this, $option['type'] . '_callback');
             add_settings_field('affwp_settings[' . $key . ']', $name, is_callable($callback) ? $callback : array($this, 'missing_callback'), 'affwp_settings_' . $tab, 'affwp_settings_' . $tab, array('id' => $key, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'min' => isset($option['min']) ? $option['min'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
         }
     }
     // Creates our settings in the options table
     register_setting('affwp_settings', 'affwp_settings', array($this, 'sanitize_settings'));
 }
Esempio n. 10
0
 /**
  * Add all settings sections and fields
  *
  * @since 1.0.0
  *
  * @return void
  */
 public function register_settings()
 {
     // If blox_settings does not exist, create it. It should always exist, so this is just a backup
     if (false == get_option('blox_settings')) {
         add_option('blox_settings');
     }
     foreach ($this->get_registered_settings() as $tab => $settings) {
         add_settings_section('blox_settings_' . $tab, __return_null(), '__return_false', 'blox_settings_' . $tab);
         foreach ($settings as $option) {
             $name = isset($option['name']) ? $option['name'] : '';
             $callback = method_exists(__CLASS__, $option['type'] . '_callback') ? array($this, $option['type'] . '_callback') : array($this, 'missing_callback');
             add_settings_field('blox_settings[' . $option['id'] . ']', $name, $callback, 'blox_settings_' . $tab, 'blox_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'name' => isset($option['name']) ? $option['name'] : null, 'label' => !empty($option['label']) ? $option['label'] : '', 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, 'class' => isset($option['class']) ? $option['class'] : null, 'default' => isset($option['default']) ? $option['default'] : '', 'sanitize' => isset($option['sanitize']) ? $option['sanitize'] : ''));
         }
     }
     // Creates our settings in the options table
     register_setting('blox_settings', 'blox_settings', array($this, 'settings_sanitize'));
 }
 public static function maybe_process_form()
 {
     $nonce_value = isset($_REQUEST['sa_estimate_' . self::DEFAULT_NONCE]) ? $_REQUEST['sa_estimate_' . self::DEFAULT_NONCE] : false;
     if (!$nonce_value) {
         return;
     }
     if (!wp_verify_nonce($nonce_value, self::DEFAULT_NONCE)) {
         return;
     }
     do_action('si_process_estimate_submission');
     $success = self::process_form_submission();
     if ($success) {
         self::set_message(__('Estimate Submitted.', 'sprout-invoices'), self::MESSAGE_STATUS_INFO);
         wp_redirect(add_query_arg(self::SUBMISSION_SUCCESS_QV, true), apply_filters('si_estimate_submitted_redirect_url', __return_null()));
         exit;
     }
 }
Esempio n. 12
0
 public static function _save_null()
 {
     __return_null();
 }
/**
 * Add all settings sections and fields
 *
 * @since 1.0
 * @return void
*/
function edd_register_settings()
{
    if (false == get_option('edd_settings')) {
        add_option('edd_settings');
    }
    foreach (edd_get_registered_settings() as $tab => $sections) {
        foreach ($sections as $section => $settings) {
            // Check for backwards compatibility
            $section_tabs = edd_get_settings_tab_sections($tab);
            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
                $section = 'main';
                $settings = $sections;
            }
            add_settings_section('edd_settings_' . $tab . '_' . $section, __return_null(), '__return_false', 'edd_settings_' . $tab . '_' . $section);
            foreach ($settings as $option) {
                // For backwards compatibility
                if (empty($option['id'])) {
                    continue;
                }
                $args = wp_parse_args($option, array('section' => $section, 'id' => null, 'desc' => '', 'name' => '', 'size' => null, 'options' => '', 'std' => '', 'min' => null, 'max' => null, 'step' => null, 'chosen' => null, 'placeholder' => null, 'allow_blank' => true, 'readonly' => false, 'faux' => false, 'tooltip_title' => false, 'tooltip_desc' => false, 'field_class' => ''));
                add_settings_field('edd_settings[' . $args['id'] . ']', $args['name'], function_exists('edd_' . $args['type'] . '_callback') ? 'edd_' . $args['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_' . $tab . '_' . $section, 'edd_settings_' . $tab . '_' . $section, $args);
            }
        }
    }
    // Creates our settings in the options table
    register_setting('edd_settings', 'edd_settings', 'edd_settings_sanitize');
}
/**
 * Alias of __return_null
 */
function shoestrap_blank()
{
    _shoestrap_deprecated_function(__FUNCTION__, '3.2', '__return_null()');
    return __return_null();
}
Esempio n. 15
0
/**
 * Add all settings sections and fields.
 *
 * @since	1.0
 * @return	void
*/
function kbs_register_settings()
{
    if (false == get_option('kbs_settings')) {
        add_option('kbs_settings');
    }
    foreach (kbs_get_registered_settings() as $tab => $sections) {
        foreach ($sections as $section => $settings) {
            // Check for backwards compatibility
            $section_tabs = kbs_get_settings_tab_sections($tab);
            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
                $section = 'main';
                $settings = $sections;
            }
            add_settings_section('kbs_settings_' . $tab . '_' . $section, __return_null(), '__return_false', 'kbs_settings_' . $tab . '_' . $section);
            foreach ($settings as $option) {
                // For backwards compatibility
                if (empty($option['id'])) {
                    continue;
                }
                $name = isset($option['name']) ? $option['name'] : '';
                add_settings_field('kbs_settings[' . $option['id'] . ']', $name, function_exists('kbs_' . $option['type'] . '_callback') ? 'kbs_' . $option['type'] . '_callback' : 'kbs_missing_callback', 'kbs_settings_' . $tab . '_' . $section, 'kbs_settings_' . $tab . '_' . $section, array('section' => $section, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'chosen' => isset($option['chosen']) ? $option['chosen'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, 'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true, 'readonly' => isset($option['readonly']) ? $option['readonly'] : false, 'faux' => isset($option['faux']) ? $option['faux'] : false));
            }
        }
    }
    // Creates our settings in the options table
    register_setting('kbs_settings', 'kbs_settings', 'kbs_settings_sanitize');
}
Esempio n. 16
0
/**
 * Add all settings sections and fields
 *
 * @since 1.0
 * @return void
*/
function edd_register_settings()
{
    if (false == get_option('edd_settings')) {
        add_option('edd_settings');
    }
    foreach (edd_get_registered_settings() as $tab => $settings) {
        add_settings_section('edd_settings_' . $tab, __return_null(), '__return_false', 'edd_settings_' . $tab);
        foreach ($settings as $option) {
            $name = isset($option['name']) ? $option['name'] : '';
            add_settings_field('edd_settings[' . $option['id'] . ']', $name, function_exists('edd_' . $option['type'] . '_callback') ? 'edd_' . $option['type'] . '_callback' : 'edd_missing_callback', 'edd_settings_' . $tab, 'edd_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'chosen' => isset($option['chosen']) ? $option['chosen'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, 'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true, 'readonly' => isset($option['readonly']) ? $option['readonly'] : false, 'faux' => isset($option['faux']) ? $option['faux'] : false));
        }
    }
    // Creates our settings in the options table
    register_setting('edd_settings', 'edd_settings', 'edd_settings_sanitize');
}
 /**
  * Registers all the settings sections and fields.
  *
  * @access public
  * @since  1.0.0
  * @return void
  */
 public function register_settings()
 {
     // If the settings field doesn't exist in the database, add it.
     if (false == get_option($this->options_slug . '_settings')) {
         add_option($this->options_slug . '_settings');
     }
     // Loop through each settings option to register the tabs.
     foreach ($this->fields as $tab => $settings) {
         // Add a section for this tab.
         add_settings_section($this->options_slug . '_settings_' . $tab, __return_null(), '__return_false', $this->options_slug . '_settings_' . $tab);
         if (!isset($settings['fields'])) {
             continue;
         }
         // Loop through each setting in this tab.
         foreach ($settings['fields'] as $key => $option) {
             // There's no type set, bail
             if (!isset($option['type'])) {
                 continue;
             }
             $name = isset($option['name']) ? $option['name'] : '';
             // Add this settings field.
             add_settings_field($this->options_slug . '[' . $option['id'] . ']', $name, method_exists($this, $option['type'] . '_callback') ? array($this, $option['type'] . '_callback') : array($this, 'missing_callback'), $this->options_slug . '_settings_' . $tab, $this->options_slug . '_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => isset($option['desc']) ? $option['desc'] : '', 'type' => isset($option['type']) ? $option['type'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'on' => isset($option['on']) ? $option['on'] : __('On', $this->options_slug), 'off' => isset($option['off']) ? $option['off'] : __('Off', $this->options_slug), 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null, 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null, 'required' => isset($option['required']) ? $option['required'] : ''));
         }
     }
     // Register the setting in the options table.
     register_setting($this->options_slug . '_settings', $this->options_slug . '_settings', array($this, 'sanitize_settings'));
 }
Esempio n. 18
0
 /**
  * Tests designed to detect improperly setup subclass
  */
 public function testSetUp()
 {
     $this->assertNotSame($this->route_name, '', get_class($this));
     $this->assertNotSame($this->namespaced_route, __return_null(), get_class($this));
 }
 /**
  * Register setting.
  *
  * @return  void
  * @access  public
  * @since   1.0.0
  */
 public function register_settings()
 {
     if (!charitable_is_settings_view()) {
         return;
     }
     register_setting('charitable_settings', 'charitable_settings', array($this, 'sanitize_settings'));
     $fields = $this->get_fields();
     if (empty($fields)) {
         return;
     }
     $sections = array_merge($this->get_sections(), $this->get_dynamic_groups());
     /* Register each section */
     foreach ($sections as $section_key => $section) {
         $section_id = 'charitable_settings_' . $section_key;
         add_settings_section($section_id, __return_null(), '__return_false', $section_id);
         if (!isset($fields[$section_key]) || empty($fields[$section_key])) {
             continue;
         }
         /* Sort by priority */
         $section_fields = $fields[$section_key];
         uasort($section_fields, 'charitable_priority_sort');
         /* Add the individual fields within the section */
         foreach ($section_fields as $key => $field) {
             $this->register_field($field, array($section_key, $key));
         }
     }
 }
Esempio n. 20
0
 /**
  * This function adds all our settings sections, settings form fields, and registers
  * a single setting, which holds all of our settings, i.e., get_option( 'my_product' ) will
  * contain the raw settings as seen in the *_options table.
  *
  * @since   1.0.0
  * @return  void
  */
 public function registerSettings()
 {
     $options = $this->getSaneOptions();
     foreach ($this->settings() as $id => $section) {
         add_settings_section($this->namespace . '_' . $id, __return_null(), '__return_false', $this->namespace . '_' . $id);
         foreach ($section['fields'] as $field) {
             $field_id = $this->getFieldId($field);
             if (isset($field['value'])) {
                 $value = $options[$field_id];
             } else {
                 if (isset($field_id) && isset($options[$field_id])) {
                     $value = $options[$field_id];
                 } elseif (isset($field['std'])) {
                     $value = $field['std'];
                 } else {
                     $value = null;
                 }
             }
             // Determine the callback
             // @todo document, this also allows for method overloading
             $method_name = 'do' . ucwords($field['type']);
             if (method_exists($this, $method_name)) {
                 $callback = array($this, $method_name);
             } else {
                 $callback = array($this, 'missingCallback');
             }
             $field['namespace'] = $this->namespace;
             // These are extra params passed into our function/method
             $params = array_merge($this->getAttributes($field), array('echo' => true, 'id' => $this->getFieldHtmlId($field), 'value' => $value, 'options' => isset($field['options']) ? $field['options'] : '', 'name' => $this->namespace . '[' . $field_id . ']', 'title' => '', 'namespace' => $this->namespace, 'settings_id' => $field_id));
             $title = isset($field['title']) ? $field['title'] : '';
             add_settings_field($this->namespace . '[' . $field_id . ']', $title, $callback, $this->namespace . '_' . $id, $this->namespace . '_' . $id, $params);
         }
     }
     register_setting($this->namespace, $this->namespace, array(&$this, 'sanitizeSingle'));
 }
Esempio n. 21
0
/**
 * Register settings‘ input fields.
 *
 * @since 1.0.0
 * @return void
 */
function cce_register_settings()
{
    if (false == get_option('cce_options')) {
        add_option('cce_options');
    }
    foreach (cce_get_registered_settings() as $tab => $settings) {
        add_settings_section('cce_settings_' . $tab, __return_null(), '__return_false', 'cce_settings_' . $tab);
        foreach ($settings as $option) {
            add_settings_field('cce_settings[' . $option['id'] . ']', '<label for="cce_settings_' . $tab . '[' . $option['id'] . ']">' . $option['name'] . '</label>', function_exists('cce_' . $option['type'] . '_callback') ? 'cce_' . $option['type'] . '_callback' : 'cce_missing_callback', 'cce_settings_' . $tab, 'cce_settings_' . $tab, array('id' => $option['id'], 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'placeholder' => !empty($option['placeholder']) ? $option['placeholder'] : '', 'name' => $option['name'], 'section' => $tab, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : ''));
        }
    }
    register_setting('cce_options', 'cce_options', 'cce_settings_sanitize');
}
 /**
  * Add the sections and fields according with the providers list.
  */
 public function add_providers_settings()
 {
     if (false == get_option('stepify_settings')) {
         add_option('stepify_settings');
     }
     foreach ($this->get_providers_settings() as $tab => $settings) {
         add_settings_section('stepify_settings_' . $tab, __return_null(), '__return_false', 'stepify_settings_' . $tab);
         foreach ($settings as $option) {
             $name = isset($option['name']) ? $option['name'] : '';
             add_settings_field('stepify_settings[' . $option['id'] . ']', $name, method_exists($this, 'stepify_' . $option['type'] . '_callback') ? array($this, 'stepify_' . $option['type'] . '_callback') : array($this, 'stepify_missing_callback'), 'stepify_settings_' . $tab, 'stepify_settings_' . $tab, array('section' => $tab, 'id' => isset($option['id']) ? $option['id'] : null, 'desc' => !empty($option['desc']) ? $option['desc'] : '', 'name' => isset($option['name']) ? $option['name'] : null, 'size' => isset($option['size']) ? $option['size'] : null, 'options' => isset($option['options']) ? $option['options'] : '', 'std' => isset($option['std']) ? $option['std'] : '', 'min' => isset($option['min']) ? $option['min'] : null, 'max' => isset($option['max']) ? $option['max'] : null, 'step' => isset($option['step']) ? $option['step'] : null));
         }
     }
     // Creates our settings in the options table
     register_setting('stepify_settings', 'stepify_settings', array($this, 'stepify_settings_sanitize'));
 }
Esempio n. 23
0
 public function add_settings_section($tab)
 {
     add_settings_section($this->set_name . '_' . $tab, __return_null(), '__return_false', $this->set_name . '_' . $tab);
 }
Esempio n. 24
0
/**
 * Alias of __return_null
 */
function stachestack_blank()
{
    _stachestack_deprecated_function(__FUNCTION__, '3.2', '__return_null()');
    return __return_null();
}