<div class="td-admin-box-text td-admin-required-plugins">
			<div class="td-admin-required-plugins-wrap">
				<p><strong>Please install Visual Composer.</strong></p>
				<p>Visual Composer is a required plugin for this theme to work best.</p>
				<a class="button button-primary" href="admin.php?page=td_theme_plugins">Go to plugin installer</a>
			</div>
		</div>
	<?php 
}
?>
    <hr/>


	<div class="td-admin-columns">
		<?php 
$installed_demo = td_demo_state::get_installed_demo();
foreach (td_global::$demo_list as $demo_id => $stack_params) {
    $tmp_class = '';
    if ($installed_demo !== false and $installed_demo['demo_id'] == $demo_id) {
        $tmp_class = 'td-demo-installed';
    }
    ?>

			<div class="td-demo-<?php 
    echo $demo_id;
    ?>
 td-wp-admin-demo theme <?php 
    echo $tmp_class;
    ?>
">
Example #2
0
 function ajax_stacks_controller()
 {
     if (!current_user_can('switch_themes')) {
         echo 'Permission denied!';
     }
     // try to extend the time limit
     @set_time_limit(240);
     $td_demo_action = td_util::get_http_post_val('td_demo_action');
     $td_demo_id = td_util::get_http_post_val('td_demo_id');
     /*  ----------------------------------------------------------------------------
            Uninstall button - do uninstall with content
         */
     if ($td_demo_action == 'uninstall_demo') {
         // remove our content
         td_demo_media::remove();
         td_demo_content::remove();
         td_demo_category::remove();
         td_demo_menus::remove();
         td_demo_widgets::remove();
         // restore all settings to the state before a demo was loaded
         $td_demo_history = new td_demo_history();
         $td_demo_history->restore_all();
         // update our state - no stack installed
         td_demo_state::update_state('', '');
     } else {
         if ($td_demo_action == 'remove_content_before_install_no_content') {
             // save the history - this class will save the history only when going from user settings -> stack
             $td_demo_history = new td_demo_history();
             $td_demo_history->save_all();
             // clean the user settings
             td_demo_media::remove();
             td_demo_content::remove();
             td_demo_category::remove();
             td_demo_menus::remove();
             td_demo_widgets::remove();
             // remove panel settings and recompile the css as empty
             foreach (td_global::$td_options as $option_id => $option_value) {
                 td_global::$td_options[$option_id] = '';
             }
             //typography settings
             td_global::$td_options['td_fonts'] = '';
             //css font files (google) buffer
             td_global::$td_options['td_fonts_css_files'] = '';
             //compile user css if any
             td_global::$td_options['tds_user_compile_css'] = td_css_generator();
             update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
         } else {
             if ($td_demo_action == 'install_no_content_demo') {
                 td_demo_state::update_state($td_demo_id, 'no_content');
                 // load panel settings - this will also recompile the css
                 $this->import_panel_settings(td_global::$demo_list[$td_demo_id]['folder'] . 'td_panel_settings.txt', false);
             } else {
                 if ($td_demo_action == 'remove_content_before_install') {
                     // save the history - this class will save the history only when going from user settings -> stack
                     $td_demo_history = new td_demo_history();
                     $td_demo_history->save_all();
                     // clean the user settings
                     td_demo_media::remove();
                     td_demo_content::remove();
                     td_demo_category::remove();
                     td_demo_menus::remove();
                     td_demo_widgets::remove();
                 } else {
                     if ($td_demo_action == 'td_media_1') {
                         // change our state
                         td_demo_state::update_state($td_demo_id, 'full');
                         // load panel settings
                         $this->import_panel_settings(td_global::$demo_list[$td_demo_id]['folder'] . 'td_panel_settings.txt', true);
                         // load the media import script
                         require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_1.php';
                     } else {
                         if ($td_demo_action == 'td_media_2') {
                             // load the media import script
                             require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_2.php';
                         } else {
                             if ($td_demo_action == 'td_media_3') {
                                 // load the media import script
                                 require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_3.php';
                             } else {
                                 if ($td_demo_action == 'td_media_4') {
                                     // load the media import script
                                     require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_4.php';
                                 } else {
                                     if ($td_demo_action == 'td_media_5') {
                                         // load the media import script
                                         require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_5.php';
                                     } else {
                                         if ($td_demo_action == 'td_media_6') {
                                             // load the media import script
                                             require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_media_6.php';
                                         } else {
                                             if ($td_demo_action == 'td_import') {
                                                 require_once td_global::$demo_list[$td_demo_id]['folder'] . 'td_import.php';
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }