static function ajax_view_controller()
 {
     //if user is logged in and can switch themes
     if (current_user_can('switch_themes')) {
         // what view to load?
         $td_ajax_view = td_util::get_http_post_val('td_ajax_view');
         $buffy = '';
         switch ($td_ajax_view) {
             //@todo trebuie refacuta
             case 'td_thumbs':
                 require_once 'ajax_views/td_block_settings_ajax.php';
                 $buffy = td_block_settings_ajax::thumbs_panel();
                 break;
             case 'td_category':
                 require_once 'ajax_views/td_category.php';
                 $buffy = td_category_form_ajax(td_util::get_http_post_val('category_id'));
                 break;
             case 'td_translations':
                 require_once 'ajax_views/td_translations.php';
                 $buffy = td_translations_form_ajax();
                 break;
             case 'td_theme_fonts':
                 //start section
                 $td_start_section = intval(json_decode($_POST['start_section']));
                 //end section
                 $td_end_section = intval(json_decode($_POST['end_section']));
                 require_once 'ajax_views/td_theme_fonts.php';
                 $object_custom_typography_ajax = new td_panel_custom_typography_ajax();
                 $buffy = $object_custom_typography_ajax->td_custom_typology_generate_font_controls(array($td_start_section, $td_end_section));
                 break;
         }
         // each panel has to have a td-clear at the end
         $buffy .= '<div class="td-clear"></div>';
         //return the view counts
         die(json_encode($buffy));
     } else {
         die;
     }
     //end if user can switch themes
 }
 static function ajax_view_panel_loading()
 {
     //if user is logged in and can switch themes
     if (current_user_can('switch_themes')) {
         //DECODE PANEL PARAMS
         //json decode ajax_view
         if (!empty($_POST['td_ajax_view'])) {
             $td_ajax_view = $_POST['td_ajax_view'];
             //json_decode(stripslashes($_POST['td_view']), true);//didn't work with json_decode
         }
         //json decode category_id (used by category panel)
         if (!empty($_POST['category_id'])) {
             $td_category_id = json_decode(stripslashes($_POST['category_id']), true);
         }
         //json decode category_id (used by typography panel)
         if (!empty($_POST['section_id'])) {
             $td_section_id = $_POST['section_id'];
             //$td_section_id = json_decode(stripslashes($_POST['section_id']), true);//didn't work with json_decode
         }
         //FORMAT PANEL AND SEND DATA BACK
         $buffy = '';
         switch ($td_ajax_view) {
             case 'td_category':
                 include_once 'ajax_views/td_category.php';
                 $buffy = td_category_form_ajax($td_category_id) . '<div class="td-clear"></div>';
                 break;
             case 'td_translations':
                 include_once 'ajax_views/td_translations.php';
                 $buffy = td_translations_form_ajax() . '<div class="td-clear"></div>';
                 break;
             case 'td_theme_fonts':
                 if (!empty($td_section_id)) {
                     include_once 'ajax_views/td_theme_fonts.php';
                     //call the generate function to create the fonts control pannel
                     $object_custom_typography_ajax = new td_panel_custom_typography_ajax();
                     $buffy = $object_custom_typography_ajax->td_custom_typology_generate_font_controls($td_section_id) . '<div class="td-clear"></div>';
                 }
                 break;
         }
         //return the view counts
         die(json_encode($buffy));
     } else {
         die;
     }
     //end if user can switch themes
 }