Example #1
0
 /**
  * Initialize the class
  *
  * @since Fastfood 0.37
  */
 function init()
 {
     $this->theme_options = FastfoodOptions::get_coa();
     $this->theme_mods = fastfood_register_theme_mods();
     $this->options_hierarchy = FastfoodOptions::get_hierarchy();
     $this->prefix_global = 'fastfood_options';
     $this->prefix_panel = $this->prefix_global . '_panel_';
     $this->prefix_section = $this->prefix_global . '_section_';
     if (version_compare($GLOBALS['wp_version'], '4.1-alpha', '<')) {
         $this->force_refresh = true;
     }
 }
Example #2
0
 public static function theme_option($value, $option)
 {
     $keys = explode('[', str_replace(']', '', $option->id));
     $base = array_shift($keys);
     $slug = array_shift($keys);
     $_value = NULL;
     if (!self::$theme_options) {
         self::$theme_options = FastfoodOptions::get_coa();
     }
     $coa = isset(self::$theme_options[$slug]) ? self::$theme_options[$slug] : false;
     if ($coa) {
         switch ($coa['setting']['sanitize_method']) {
             case 'checkbox':
                 $_value = self::checkbox($value, $coa);
                 break;
             case 'select':
                 $_value = self::select($value, $coa);
                 break;
             case 'radio':
                 $_value = self::radio($value, $coa);
                 break;
             case 'color':
                 $_value = self::color($value, $coa);
                 break;
             case 'url':
                 $_value = self::url($value, $coa);
                 break;
             case 'text':
                 $_value = self::text($value, $coa);
                 break;
             case 'number':
                 $_value = self::number($value, $coa);
                 break;
             case 'textarea':
                 $_value = self::textarea($value, $coa);
                 break;
         }
     }
     return $_value;
 }
Example #3
0
 /**
  * sanitize options value
  */
 function sanitize_options($input)
 {
     $the_coa = FastfoodOptions::get_coa();
     foreach ($the_coa as $key => $val) {
         $_value = NULL;
         if (!isset($input[$key])) {
             $input[$key] = NULL;
         }
         switch ($the_coa[$key]['setting']['sanitize_method']) {
             case 'checkbox':
                 $_value = FastfoodSanitize::checkbox($input[$key], $the_coa[$key]);
                 break;
             case 'select':
                 $_value = FastfoodSanitize::select($input[$key], $the_coa[$key]);
                 break;
             case 'radio':
                 $_value = FastfoodSanitize::radio($input[$key], $the_coa[$key]);
                 break;
             case 'color':
                 $_value = FastfoodSanitize::color($input[$key], $the_coa[$key]);
                 break;
             case 'url':
                 $_value = FastfoodSanitize::url($input[$key], $the_coa[$key]);
                 break;
             case 'text':
                 $_value = FastfoodSanitize::text($input[$key], $the_coa[$key]);
                 break;
             case 'number':
                 $_value = FastfoodSanitize::number($input[$key], $the_coa[$key]);
                 break;
             case 'textarea':
                 $_value = FastfoodSanitize::textarea($input[$key], $the_coa[$key]);
                 break;
         }
         $input[$key] = $_value;
     }
     return $input;
 }