public function save($value = null)
 {
     /* dirty hack to make multiple elms on customize.php page */
     $submited_value = json_decode(stripslashes($_REQUEST['customized']));
     $value = $submited_value->{$this->field->alias};
     if (is_object($value)) {
         $value = "";
     }
     SingletonSaveCusomizeData::getInstance()->set_option($this->page->option_key);
     SingletonSaveCusomizeData::getInstance()->save_data($this->field->alias, $value, $this->type);
 }
 public function save($value = '')
 {
     if (is_a($value, 'WP_Customize_Settings') || is_a($value, 'WP_Customize_Setting')) {
         $value = null;
     }
     if (!isset($_REQUEST['customized'])) {
         $page_options = get_option($this->page->option_key);
         if (is_object($value)) {
             $value = "";
         }
         $page_options[$this->field->alias] = $value;
         $page_options['field_types'][$this->field->alias] = $this->type;
         update_option($this->page->option_key, $page_options);
     } else {
         $submited_value = json_decode(stripslashes($_REQUEST['customized']));
         $value = $submited_value->{$this->field->alias};
         if (is_object($value)) {
             $arr = array();
             foreach ($value as $k => $v) {
                 $arr[$k] = $v;
             }
             $value = $arr;
         }
         SingletonSaveCusomizeData::getInstance()->set_option($this->page->option_key);
         SingletonSaveCusomizeData::getInstance()->save_data($this->field->alias, $value, $this->type);
     }
 }
 public function save($value = '')
 {
     if ($value == '' || is_a($value, 'WP_Customize_Settings') || is_a($value, 'WP_Customize_Setting')) {
         $submited_value = json_decode(stripslashes($_REQUEST['customized']));
         $value = $submited_value->{$this->field->alias};
     }
     if (is_string($value)) {
         if (strstr($value, '#') == false) {
             $value = '#' . $value;
         }
     } else {
         if (is_array($value)) {
             foreach ($value as $tmp_key => $tmp_val) {
                 if (strstr($tmp_val, '#') == false) {
                     $value[$tmp_key] = '#' . $tmp_val;
                 }
             }
         }
     }
     if (is_object($value)) {
         $value = "";
     }
     SingletonSaveCusomizeData::getInstance()->set_option($this->page->option_key);
     SingletonSaveCusomizeData::getInstance()->save_data($this->field->alias, $value, $this->type);
 }
Exemplo n.º 4
0
 public function set_option($key)
 {
     if (self::$key !== $key) {
         self::$data = get_option($key);
         self::$key = $key;
     }
 }