function encodeOptionArray($option_array)
 {
     foreach ($option_array as $option) {
         if (is_array($option)) {
             $option = ccf_utils::encodeOptionArray($option);
         } else {
             $option = ccf_utils::encodeOption($option);
         }
     }
     return $option_array;
 }
 function encodeData()
 {
     $data_array = $this->getDataArray();
     $encoded_data = '';
     foreach ($data_array as $key => $value) {
         $key = ccf_utils::encodeOption($key);
         if (!is_array($value)) {
             $value = ccf_utils::encodeOption($value);
         } else {
             $value = ccf_utils::encodeOptionArray($value);
             $value = implode(', ', $value);
         }
         $encoded_data .= 's:' . strlen($key) . ':"' . $key . '";';
         $encoded_data .= 's:' . strlen($value) . ':"' . $value . '";';
     }
     $this->setEncodedData($encoded_data);
 }
 function updateStyle($style, $sid)
 {
     global $wpdb;
     if (empty($style['style_slug'])) {
         return false;
     }
     $test = $this->selectStyle('', $this->formatSlug($style['style_slug']));
     if (!empty($test) and $test->id != $sid) {
         // if style_slug is different then make sure it is unique
         return false;
     }
     $style['style_slug'] = $this->formatSlug($style['style_slug']);
     foreach ($style as $key => $value) {
         $style[$key] = ccf_utils::encodeOption($value);
     }
     $wpdb->update(CCF_STYLES_TABLE, $style, array('id' => $sid));
     return true;
 }