/**
  * register widget fields feature
  * @param $widget: widget instance
  * @param $feature: give feature name by hoangweb
  */
 public static function register_widget_feature($widget, $feature)
 {
     if (!isset(self::$widgets_fields[$feature])) {
         self::$widgets_fields[$feature] = array();
     }
     $register_features = HW_AWC_WidgetFeatures::get_all_features();
     //get all register features
     //load widget feature from enternal
     $class = self::get_feature_class_byName($feature);
     //'AWC_WidgetFeature_' . $feature;
     if (class_exists($class)) {
         $class = new $class($widget, array());
         $class->feature_name = $feature;
         //widget feature identifier
         $class->feature_url = HW_AWC_WidgetFeatures_URL . '/' . $feature;
         $class->feature_path = HW_AWC_WidgetFeatures_PATH . '/' . $feature;
         $class->option('feature_alias', $register_features[$feature]);
         //set static options
         $class->_static_option('feature_name', $class->feature_name);
         $class->_static_option('feature_url', $class->feature_url);
         $class->_static_option('feature_path', $class->feature_path);
         $class->feature_loaded();
         //add widget feature to manager
         HW_Widget_Features_Setting::add_widget_feature($feature, $class);
         self::_setup_actions($class);
     }
     //prevent to duplicate widgets in one feature ($widget->id_base)
     self::$widgets_fields[$feature][$widget->id_base . '-' . $widget->number] = array('widget' => $widget, 'class' => $class);
 }
 /**
  * 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;
     }
 }