public function return_menu_html($menu_id, $current_url, $current_id) { #GLOBALS global $wpdb; $result = $wpdb->get_results("SELECT * FROM " . $wpdb->base_prefix . "hmenu_menu WHERE menuId = " . $menu_id . " AND deleted = '0' ORDER BY created DESC"); if ($result) { $get = new hmenu_class_get($this->plugin_dir); $generate = new hmenu_class_generate($this->plugin_dir); $menu_object = $get->get_main_menu_object(intval($menu_id), false); #GOOGLE FONTS $main_font = $menu_object['main_styles'][0]['fontFamily']; $standard_font = $menu_object['dropdown_styles'][0]['fontFamily']; $mega_font_0 = $menu_object['mega_font_styles'][0]['fontFamily']; $mega_font_1 = $menu_object['mega_font_styles'][1]['fontFamily']; $mega_font_2 = $menu_object['mega_font_styles'][2]['fontFamily']; $mega_font_3 = $menu_object['mega_font_styles'][3]['fontFamily']; $search_font = $menu_object['search_styles'][0]['fontFamily']; $font_array = array($main_font, $standard_font, $mega_font_0, $mega_font_1, $mega_font_2, $mega_font_3, $search_font); $font_array = array_unique($font_array); $the_font_string = ''; foreach ($font_array as $font) { $the_font_string .= $font . '|'; } $final_font_string = rtrim($the_font_string, '|'); $the_html = ''; #FONT LINK $the_html .= '<link href="https://fonts.googleapis.com/css?family=' . $final_font_string . '" rel="stylesheet" type="text/css">'; #MENU HTML HOLDER $the_html .= '<div id="hmenu_load_' . $menu_id . '" style="display:none" class="hmenu_load_menu" data-menu-id="' . $menu_id . '">'; $the_html .= $generate->frontend_call($menu_object, $current_url, $current_id); $the_html .= '</div>'; } else { $the_html = 'Sorry, that menu does not exist.'; } return $the_html; }
public function process_generate() { #GLOBALS global $wpdb; $result = $wpdb->get_results("SELECT * FROM " . $wpdb->base_prefix . "hmenu_menu WHERE deleted = '0' ORDER BY created DESC"); if ($result) { $backend = new hmenu_backend($this->plugin_dir); $get = new hmenu_class_get($this->plugin_dir); $generate = new hmenu_class_generate($this->plugin_dir); foreach ($result as $menu) { $menu_object = $get->get_main_menu_object(intval($menu->menuId), false); $backend->get_fonts('icons', false); $generate->generate_files($menu_object, false); } } return true; }