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; }
/** * 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; }