/** * Display search form for searching plugins. * * @since 2.7.0 */ function _install_search_form($type_selector = true) { $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; if (HW_SESSION::get_session('search_module')) { //because i using APF form to list modules from repository, so we not recommend to search via form method thourhg post by default $term = HW_SESSION::get_session('search_module'); HW_SESSION::del_session('search_module'); } else { if (isset($_REQUEST['sm'])) { $term = wp_unslash($_REQUEST['sm']); } else { $term = ''; } } $input_attrs = ''; $button_type = 'button screen-reader-text'; // assume no $type_selector means it's a simplified search form if (!$type_selector) { $input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__('Search Plugins') . '" '; } ?> <!-- <form class="search-form search-plugins" method="get"> <input type="hidden" name="tab" value="search" /> --> <?php /*if ( $type_selector ) : ?> <select name="type" id="typeselector"> <option value="term"<?php selected('term', $type) ?>><?php _e('Keyword'); ?></option> <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option> <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option> </select> <?php endif;*/ ?> <label><span class="screen-reader-text"><?php _e('Search Plugins'); ?> </span> <input type="text" name="sm" id="hw_module_search_text" value="<?php echo esc_attr($term); ?> " <?php echo $input_attrs; ?> /> </label> <?php submit_button(__('Search Plugins'), $button_type, false, false, array('id' => 'search-submit')); ?> <label> <input type="button" id="search-submit" onclick="_search_module(this, $('#hw_module_search_text').val())" class="button " value="Tìm module"> </label> <!-- </form> --> <?php }
/** * Generate WP-compatible $menu and $submenu arrays from a custom menu tree. */ private function _build_custom_wp_menu() { $new_menu = array(); $new_submenu = array(); global $menu, $submenu; $cache_submenu = HW_HOANGWEB::get_wp_option('hw_custom_wp_submenu'); $cache_modules_submenus = HW_HOANGWEB::get_wp_option('other_modules_submenus'); if (empty($cache_submenu) || empty($cache_modules_submenus)) { #$root = new HW_Array_List_items_path($submenu, __CLASS__); $parent =& HW_Module_Settings_page::get_root_wp_menu_data($submenu); $parent1 =& HW_Widget_Features_Setting::get_root_wp_menu_data($submenu); $root_hoangweb =& HW_HOANGWEB_Settings::get_root_wp_menu_data($submenu); /*#eval('$parent = &$submenu'. $parent.';'); $parent[] = Array ( 'abc', 'manage_options', 'http://localhost/wp1/wp-admin/admin.php?tab=gallery&page=hw_modules_settings&module=gallery&tgmpa-tab-nonce=2ad45f5013&_wpnonce=922a2d6727', ); set_transient('hw-replace-admin-submenu', $submenu);*/ self::build_custom_wp_menu(array('menu' => &$menu, 'submenu' => &$submenu, 'root' => &$parent, 'root_widget_features' => &$parent1, 'root_hoangweb' => &$root_hoangweb)); HW_SESSION::save_session('submenu', $submenu); HW_SESSION::save_session('menu', $menu); $this->custom_wp_menu = $menu; $this->custom_wp_submenu = $submenu; } }
/** * build & save custom wp menus */ public function save_custom_wp_menus() { //refresh cache for first $this->refresh_wp_menus_cache(); $submenu = HW_SESSION::get_session('submenu'); $menu = HW_SESSION::get_session('menu'); #HW_Modules_Manager::build_modules_wp_menu(); if ($menu) { HW_HOANGWEB::add_wp_option('hw_custom_wp_menu', $menu); } if ($submenu) { HW_HOANGWEB::add_wp_option('hw_custom_wp_submenu', $submenu); } //remove sessions HW_SESSION::del_session('submenu', 'menu'); $this->command_log('Build & Save custom wp menus !'); }
/** * fields values validation * @param $values * @return mixed|void */ public function validation_tab_filter($values) { //var_dump($values); //var_dump($this->create_field_name('upload')); APF_hw_upload_field::do_form_action($values, $this->create_field_name('uploader')); //return array(); //not save any fields value //exit(); //the way allow ajax upload work, no any output allow here, if you not specific upload handle if (hw__post('s')) { $_REQUEST['s'] = hw__post('s'); HW_SESSION::save_session('search_module', hw__post('s')); } return $values; //allow to save fields value }
function __save_session($key, $val, $merge_array = false, $group = 'hoangweb') { HW_SESSION::__save_session($key, $val, $merge_array, $group); }
/** * main class constructor * @param bool $reset */ public function __construct($reset = true) { @session_start(); $this->data =& HW_SESSION::get_data_group('logs_installer', $reset); }