static function render_panel($all_theme_panels_list, $panel_spot_id) { self::$current_theme_panel_id = $panel_spot_id; /** the ajax boxes read this @see \td_panel_generator::ajax_box */ //print_r($global_panels_array); ?> <form id="td_panel_big_form" action="?page=td_theme_panel" method="post"> <input type="hidden" name="action" value="td_ajax_update_panel"> <div class="td_displaying_saving"></div> <div class="td_wrapper_saving_gifs"> <img class="td_displaying_saving_gif" src="<?php echo get_template_directory_uri(); ?> /includes/wp_booster/wp-admin/images/panel/loading.gif"> <img class="td_displaying_ok_gif" src="<?php echo get_template_directory_uri(); ?> /includes/wp_booster/wp-admin/images/panel/saved.gif"> </div> <div class="wrap"> <div class="td-container-wrap"> <div class="td-panel-main-header"> <img src="<?php echo get_template_directory_uri() . '/includes/wp_booster/wp-admin/images/panel/panel-wrap/panel-logo.png'; ?> " alt=""/> <span class="td-panel-header-name"><?php echo $all_theme_panels_list[$panel_spot_id]['title']; ?> </span> <span class="td-panel-header-version"><?php echo $all_theme_panels_list[$panel_spot_id]['subtitle']; ?> </span> </div> <div id="td-container-left"> <div id="td-container-right"> <!-- Panel Navigation --> <div id="td-col-left"> <ul class="td-panel-menu"> <?php //show the panel tabs on the left $td_is_first_panel = true; $td_first_menu_item_class = 'td-panel-menu-active'; //to show the class only on the first loop $td_first_menu_welcome_menu = 'td-welcome-menu'; //we are using this class to fix some rendering issues with the first menu foreach ($all_theme_panels_list[$panel_spot_id]['panels'] as $panel_id => $panel_array) { switch ($panel_array['type']) { case 'separator': //it's a group ?> <li class="td-panel-menu-sep"><?php echo $panel_array['text']; ?> </li> <?php break; case 'link': ?> <li> <a href="<?php echo $panel_array['url']; ?> "> <span class="td-sp-nav-icon td-ico-export"></span> <?php echo $panel_array['text']; ?> <span class="td-arrow"></span> </a> </li> <?php break; default: ?> <li class="<?php echo $td_first_menu_welcome_menu; ?> "> <a data-panel="<?php echo $panel_id; ?> " data-bg="<?php echo esc_attr(get_template_directory_uri() . '/includes/wp_booster/wp-admin/images/panel/bg/1.jpg'); ?> " class="<?php echo $td_first_menu_item_class; ?> " href="#"> <span class="td-sp-nav-icon <?php echo $panel_array['ico_class']; ?> "></span> <?php echo $panel_array['text']; ?> <span class="td-arrow"></span> </a> </li> <?php break; } $td_first_menu_item_class = ''; // do not show any more td-panel-menu-active $td_first_menu_welcome_menu = ''; } ?> </ul> </div> <!-- Panel Content --> <div id="td-col-right" class="td-panel-content"> <?php // show the panel views $td_panel_active = 'td-panel-active'; //to show the class only on the first loop foreach ($all_theme_panels_list[$panel_spot_id]['panels'] as $panel_id => $panel_array) { if (isset($panel_array['file'])) { ?> <div id="<?php echo $panel_id; ?> " class="<?php echo $td_panel_active; ?> td-panel"> <?php require_once $panel_array['file']; // the panel is loaded from our hardcoded global panel list - there should be no security issues ?> </div> <?php $td_panel_active = ''; } } ?> </div> </div> </div> <div class="td-clear"></div> <div class="td-panel-main-footer"> <input type="button" id="td_button_save_panel" class="td-panel-save-button" value="SAVE SETTINGS"> </div> </div> <div class="td-clear"></div> </form> <?php }
function render_td_panel_woo() { //print_r(td_global::$all_theme_panels_list); td_panel_core::render_panel(td_global::$all_theme_panels_list, 'td_panel_woo'); }
<?php td_panel_core::render_panel(td_global::$all_theme_panels_list, 'theme_panel');
/** * this panel box will load an ajax view when it will open * - the ajax views are in /wp-admin/panel/ajax_views * @param $panel_text - the display name of the panel * @param array $ajax_params - the parameters array that we want to send to the backend. MUST CONTAIN td_ajax_view and td_ajax_call * @return string HTML the box */ static function ajax_box($panel_text, $ajax_params = array(), $custom_unique_id = '', $panel_class = '') { if (!empty($custom_unique_id)) { $box_uid = $custom_unique_id; } else { $box_uid = td_global::td_generate_unique_id(); } $tad_ajax_parameters = ''; if (!empty($ajax_params)) { $ajax_params['action'] = 'td_panel_core_load_ajax_box'; //this is added so we can directly send this json-encoded data (no javascript encoding necessary) $ajax_params['td_current_theme_panel_id'] = td_panel_core::get_current_theme_panel_id(); $tad_ajax_parameters = "data-panel-ajax-params='" . json_encode($ajax_params) . "'"; } $buffy = ' <div class="td-box td-box-close ' . $panel_class . '" id="' . $box_uid . '"> <div class="td-box-header td-box-header-js-ajax" data-box-id="' . $box_uid . '" ' . $tad_ajax_parameters . ' unselectable="on"> <div class="td-box-title">' . $panel_text . '</div> <a class="td-box-toggle" data-box-id="' . $box_uid . '" href="#"><div class="td-box-close-open-icon"></div></a> </div> <div class="td-box-content-wrap"><div class="td-box-content"></div></div> </div> '; return $buffy; }