function tfuse_process_options()
 {
     if (empty($this->tfuse_options)) {
         return;
     }
     $this->cfg_install_options = $this->framework->theme->theme_info['install_options'];
     foreach ($this->tfuse_options as $name => $value) {
         // Urlencoded string cannot contain ':}";' characters
         $imposible_urlencoded_chars = array(':', '{', '"', ';');
         $is_CDATA = false;
         foreach ($imposible_urlencoded_chars as $char) {
             if (stripos($value, $char) !== false) {
                 // If value contains that char, that means it can't be urlencoded, it is value from CDATA
                 $is_CDATA = true;
                 $CDATA_value = tf_cdata_decode($value);
                 // it chan't contain <![CDATA[ because it is extracted via SimpleXML class, but just to be sure
                 break;
             }
         }
         $new_val = $is_CDATA ? @tf_mb_unserialize($CDATA_value) : tfuse_unpk($value);
         if ($new_val === false) {
             if ($is_CDATA) {
                 $new_val = $CDATA_value;
             } else {
                 $new_val = $value;
             }
         }
         $tmp = intval($new_val);
         if (($name == 'page_on_front' || $name == 'page_for_posts') && !empty($tmp)) {
             $new_val = $this->processed_posts[intval($new_val)];
         }
         // verificam id-urile posturilor si categoriilor din sidebars
         if (TF_THEME_PREFIX . '_tfuse_sidebars' == $name && !empty($new_val['settings'])) {
             // obtinem setarile pentru fiecare placeholder
             $settings = array_keys($new_val['settings']);
             foreach ($settings as $setting) {
                 $isposts = explode('by_id_', $setting);
                 $isposts = post_type_exists(end($isposts));
                 // cele care pastreaza id-uri de post-uri
                 if (strstr($setting, 'by_id_') && $isposts) {
                     // fiecare palceholder are un id sau mai multe separate prin virgula
                     $palceholders = array_keys($new_val['settings'][$setting]);
                     foreach ($palceholders as $_ids) {
                         $processed_ids = array();
                         $p_ids = explode(',', $_ids);
                         foreach ($p_ids as $p_id) {
                             $processed_ids[] = isset($this->processed_posts[intval($p_id)]) ? $this->processed_posts[intval($p_id)] : $p_id;
                         }
                         $new_ids = implode(',', $processed_ids);
                         $old_val = $new_val['settings'][$setting][$_ids];
                         unset($new_val['settings'][$setting][$_ids]);
                         $new_val['settings'][$setting][$new_ids] = $old_val;
                     }
                 }
                 // cele care pastreaza id-uri de categorii/taxonomii
                 if (strstr($setting, 'by_category_') || strstr($setting, 'by_id_') && !$isposts) {
                     // fiecare palceholder are un id sau mai multe separate prin virgula
                     $palceholders = array_keys($new_val['settings'][$setting]);
                     foreach ($palceholders as $_ids) {
                         $processed_ids = array();
                         $p_ids = explode(',', $_ids);
                         foreach ($p_ids as $p_id) {
                             $processed_ids[] = isset($this->processed_terms[intval($p_id)]) ? $this->processed_terms[intval($p_id)] : $p_id;
                         }
                         $new_ids = implode(',', $processed_ids);
                         $old_val = $new_val['settings'][$setting][$_ids];
                         unset($new_val['settings'][$setting][$_ids]);
                         $new_val['settings'][$setting][$new_ids] = $old_val;
                     }
                 }
             }
         }
         if ($name == 'theme_mods') {
             unset($this->tfuse_options[$name]);
             $name .= '_' . get_stylesheet();
             $menu_id = 0;
             if (!empty($new_val['nav_menu_locations']) && is_array($new_val['nav_menu_locations'])) {
                 foreach ($new_val['nav_menu_locations'] as $arrid => $key) {
                     if (!isset($this->processed_terms[intval($key)])) {
                         continue;
                     }
                     $menu_id = $this->processed_terms[intval($key)];
                     $new_val['nav_menu_locations'][$arrid] = $menu_id;
                 }
             }
         }
         // schimbam idurile la taxonomy options
         if ($name == TF_THEME_PREFIX . '_tfuse_taxonomy_options' && is_array($new_val)) {
             $new_tax_array = array();
             foreach ($new_val as $key => $ops) {
                 if (isset($this->processed_terms[$key])) {
                     $new_tax_array[$this->processed_terms[$key]] = $ops;
                 } else {
                     $new_tax_array[$key] = $ops;
                 }
             }
             $new_val = $new_tax_array;
         }
         if (is_array($new_val) && TF_THEME_PREFIX . '_tfuse_sidebars' != $name) {
             array_walk_recursive($new_val, array($this, 'tfuse_change_link'));
         }
         $this->tfuse_options[$name] = $new_val;
         update_option($name, $new_val);
     }
 }
예제 #2
0
function tfuse_mb_unserialize($serialized)
{
    return tf_mb_unserialize($serialized);
}