function td_theme_settings_read_for_demo()
{
    $td_cookie_value = '';
    if (isset($_COOKIE["td-cookie-demo-theme-options"])) {
        $td_cookie_value = $_COOKIE["td-cookie-demo-theme-options"];
    }
    switch ($td_cookie_value) {
        case 'style_1':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_1.txt', true)));
            break;
        case 'style_2':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_2.txt', true)));
            break;
        case 'style_3':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_3.txt', true)));
            break;
        case 'style_4':
            td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_4.txt', true)));
            break;
            //read the database theme options if no cookie is found
        //read the database theme options if no cookie is found
        default:
            td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
    }
}
示例#2
0
 /**
  * reading the theme settings
  * if we are in demo mode looks for cookies
  * else takes the settings from database
  */
 static function read_once_theme_settings()
 {
     //this is for demo mode
     if (TD_DEBUG_LIVE_THEME_STYLE) {
         td_theme_settings_read_for_demo();
         //this function is in demo folder td_theme_demo_cookies.php
         //this is for deploy and dev
     } else {
         td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
     }
 }
 static function update_theme_settings($old_theme_settings)
 {
     $settings_buffer = array();
     foreach (self::$td_options_to_be_imported as $option_id) {
         if (isset($old_theme_settings[$option_id]) and !empty($old_theme_settings[$option_id])) {
             $settings_buffer[$option_id] = $old_theme_settings[$option_id];
         }
     }
     td_global::$td_options = $settings_buffer;
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }
 static function update()
 {
     //load all the theme's settings
     td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
     /*  ----------------------------------------------------------------------------
            save the data
         */
     //print_r($_POST);
     foreach ($_POST as $post_data_source => $post_value) {
         switch ($post_data_source) {
             case 'td_category':
                 self::update_category($post_value);
                 break;
             case 'td_option':
                 self::update_td_option($post_value);
                 break;
             case 'wp_option':
                 self::update_wp_option($post_value);
                 break;
             case 'td_homepage':
                 break;
             case 'td_page_option':
                 break;
             case 'td_author':
                 self::update_td_author($post_value);
                 break;
             case 'wp_widget':
                 self::update_wp_widget($post_value);
                 break;
             case 'wp_theme_mod':
                 self::update_wp_theme_mod($post_value);
                 break;
             case 'wp_theme_menu_spot':
                 self::update_wp_theme_menu_spot($post_value);
                 break;
             case 'td_translate':
                 self::update_td_translate($post_value);
                 break;
             case 'td_ads':
                 self::update_td_ads($post_value);
                 break;
                 //social networks
             //social networks
             case 'td_social_networks':
                 self::update_td_social_networks($post_value);
                 break;
             case 'td_fonts':
                 self::update_td_fonts($post_value);
                 break;
             case 'td_block_styles':
                 self::update_td_block_styles($post_value);
                 break;
         }
     }
     //compile user css if any
     td_global::$td_options['tds_user_compile_css'] = td_css_generator();
     //save all the themes settings (td_options + td_category)
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }
示例#5
0
 /**
  * reading the theme settings
  * if we are in demo mode looks for cookies
  * else takes the settings from database
  */
 static function read_once_theme_settings()
 {
     td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
 }
            <!-- homepage -->
            <div id="td-panel-welcome" class="td-panel-active td-panel">
                <!-- One click demo install -->
                <?php 
echo td_panel_generator::box_start('Importing old category data');
?>

                <!-- Install demo data -->
                <div class="td-box-row">
                    <div class="td-box-description td-box-full">
                        <span class="td-box-title">Please wait until all the data is imported</span>
                        <p>....</p>


                        <?php 
td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
$td_categories = get_categories(array('hide_empty' => '0'));
foreach ($td_categories as $td_category) {
    echo '<p><strong>Importing: ' . $td_category->name . '</strong><br>';
    $td_cat_options = get_option('tax_meta_' . $td_category->cat_ID);
    if (!empty($td_cat_options['tdc_layout'])) {
        echo 'layout: ' . $td_cat_options['tdc_layout'] . '<br>';
        td_panel_data_source::update_category_option($td_category->cat_ID, 'tdc_layout', $td_cat_options['tdc_layout']);
    }
    if (!empty($td_cat_options['tdc_sidebar_pos'])) {
        echo 'sidebar position: ' . $td_cat_options['tdc_sidebar_pos'] . '<br>';
        td_panel_data_source::update_category_option($td_category->cat_ID, 'tdc_sidebar_pos', $td_cat_options['tdc_sidebar_pos']);
    }
    if (!empty($td_cat_options['tdc_sidebar_name'])) {
        echo 'sidebar name: ' . $td_cat_options['tdc_sidebar_name'] . '<br>';
        td_panel_data_source::update_category_option($td_category->cat_ID, 'tdc_sidebar_name', $td_cat_options['tdc_sidebar_name']);
 static function update()
 {
     //load all the theme's settings
     td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
     /*  ----------------------------------------------------------------------------
            save the data
         */
     foreach ($_POST as $post_data_source => $post_value) {
         switch ($post_data_source) {
             case 'td_category':
                 self::update_category($post_value);
                 break;
             case 'td_option':
                 self::update_td_option($post_value);
                 break;
             case 'wp_option':
                 self::update_wp_option($post_value);
                 break;
             case 'td_homepage':
                 break;
             case 'td_page_option':
                 break;
             case 'td_author':
                 self::update_td_author($post_value);
                 break;
             case 'wp_widget':
                 self::update_wp_widget($post_value);
                 break;
             case 'wp_theme_mod':
                 self::update_wp_theme_mod($post_value);
                 break;
             case 'wp_theme_menu_spot':
                 self::update_wp_theme_menu_spot($post_value);
                 break;
             case 'td_translate':
                 self::update_td_translate($post_value);
                 break;
             case 'td_ads':
                 self::update_td_ads($post_value);
                 break;
             case 'td_fonts':
                 self::update_td_fonts($post_value);
                 break;
         }
     }
     //save all the themes settings (td_options + td_category)
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }
示例#8
0
 public function import_panel_settings($file_path, $empty_ignored_settings = false)
 {
     //it's public only for testing
     // this settings will be "" out when any of the imports is runned
     $ignored_settings = array('tds_logo_upload', 'tds_logo_upload_r', 'tds_favicon_upload', 'tds_logo_menu_upload', 'tds_logo_menu_upload_r', 'tds_footer_logo_upload', 'tds_footer_retina_logo_upload', 'tds_site_background_image', 'category_options', 'td_ads', 'sidebars');
     //read the settings file
     $file_settings = unserialize(base64_decode(file_get_contents($file_path, true)));
     //apply td_cake variables
     $file_settings['td_cake_status_time'] = td_util::get_option('td_cake_status_time');
     $file_settings['td_cake_status'] = td_util::get_option('td_cake_status');
     $file_settings['envato_key'] = td_util::get_option('envato_key');
     if ($empty_ignored_settings === true) {
         // we empty the ignored settings
         td_global::$td_options = $file_settings;
         foreach ($ignored_settings as $setting) {
             td_global::$td_options[$setting] = '';
         }
     } else {
         // we leave the ignored settings alone
         foreach ($file_settings as $setting_id => $setting_value) {
             if (!in_array($setting_id, $ignored_settings)) {
                 td_global::$td_options[$setting_id] = $setting_value;
             }
         }
     }
     //compile user css if any
     td_global::$td_options['tds_user_compile_css'] = td_css_generator();
     //write the changes to the database
     update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
 }