/** * auto load class * note: we rename autoload function to hw__autoload and load directly class in method HW_HOANGWEB::loadclass * ->why? because some hosting web server call autoload different behavior. * @param $lib: which class will be load */ public static function hw__autoload($lib) { static $onces = array(); //include $class_name . '.php'; $libs = isset(HW_HOANGWEB::$hw_global['classes']) ? HW_HOANGWEB::$hw_global['classes'] : array(); //load all libs $_lib = HW_HOANGWEB::get_class($lib); //= $libs[$lib] if (!empty($_lib) && is_string($lib) && !isset($onces[$lib]) && isset($_lib['class']) && !class_exists($_lib['class'], false)) { $debug = defined('WP_DEBUG') && WP_DEBUG; //debug version if (0 && $debug && isset($_lib['debug']) && file_exists($_lib['debug'])) { //for convernion i alway run release version $file = $libs[$lib]['debug']; } elseif (isset($_lib['release']) && file_exists($_lib['release'])) { $file = $_lib['release']; } //check required other if (isset($_lib['deps'])) { foreach ((array) $_lib['deps'] as $require) { if (!$require || class_exists($require, false)) { continue; } HW_HOANGWEB::register_class($require, HW_HOANGWEB::setup_classes($require)); } } if (isset($file)) { require_once $file; } $onces[$lib] = true; } }
/** * main constructor */ public function __construct() { HW_HOANGWEB::register_class('HW_Tabs', dirname(__FILE__) . '/class-ui-tabs.php'); #HW_HOANGWEB::load_class('HW_Tabs'); $this->enable_tab_settings(); $this->enable_submit_button(); }
/** * register all widget features */ function hwawc_register_widget_features() { $group = 'widget-features'; $features = array('saveconfig' => array('class' => 'AWC_WidgetFeature_saveconfig', 'alias' => 'save config'), 'grid_posts' => array('class' => 'AWC_WidgetFeature_grid_posts', 'alias' => 'grid posts'), 'fancybox' => array('class' => 'AWC_WidgetFeature_fancybox', 'alias' => 'fancybox'), 'fonticons' => array('class' => 'AWC_WidgetFeature_fonticons', 'alias' => 'font icons'), 'title_link' => array('class' => 'AWC_WidgetFeature_title_link', 'alias' => 'Widget title Link'), 'shortcode_params' => array('class' => 'AWC_WidgetFeature_shortcode_params', 'alias' => 'Shortcode params'), 'fixed_widget' => array('class' => 'AWC_WidgetFeature_fixed_widget', 'alias' => 'Fixed widget'), 'hide_widget' => array('class' => 'AWC_WidgetFeature_hide_widget', 'alias' => 'Hide Widget'), 'export' => array('class' => 'AWC_WidgetFeature_export', 'alias' => 'Export Widget')); foreach ($features as $name => $arg) { HW_HOANGWEB::register_class($arg['class'], HW_AWC_WidgetFeatures_PATH . "/{$name}/awc-widgetfeature-{$name}.php", $arg['alias'], $group); } }
/** * main class constructor */ public function __construct() { HW_HOANGWEB::register_class('HW_Gmap', dirname(__FILE__) . '/includes/class-ui-gmap.php'); //enable setting tab for this module $this->enable_tab_settings(); $this->enable_submit_button(); //register shortcode for display map add_shortcode('hw_googlemap', array($this, '_hw_render_google_map')); }
/** * Main class constructor */ public function __construct() { include_once dirname(__FILE__) . '/widget/hw-widget-multitranslate.php'; //translate selector widget //load HW_mqtranslate class HW_HOANGWEB::register_class('HW_mqtranslate', dirname(__FILE__) . '/class-hw_mqtranslate.php'); HW_HOANGWEB::load_class('HW_mqtranslate'); add_action('wp_footer', array($this, '_hw_wp_footer')); }
/** * load api class * @param $api * @return null|api instance if pass 1 name */ public function load_api() { $args = func_get_args(); foreach ($args as $api) { if (isset($this->api_classes[$api]) && (!is_object($this->api_classes[$api]) || !$this->api_classes[$api] instanceof HW_Admin_Options)) { HW_HOANGWEB::register_class($api, $this->api_classes[$api]); include_once $this->api_classes[$api]; $this->api_classes[$api] = new $api(); $this->api_classes[$api]->load(); } } if (count($args) == 1) { return $this->api_classes[$args[0]]; } }
/** * load given field type * @param string $typename: field type class * @return field class name */ public static function load_fieldtype($typename = '') { if (count(self::$field_types) == 0) { self::init_fieldtypes(); } //load all register fields type //list all fields type $types = HW_APF_FieldTypes::get_apf_field_types(); if (isset($types[$typename])) { //get field class name from field type $typename = $types[$typename]; } if (isset(self::$field_types[$typename])) { HW_HOANGWEB::register_class($typename, self::$field_types[$typename]); HW_HOANGWEB::load_class($typename); } return $typename; }
/** * register module help * usage: HW_HELP::register_help('name1','name2',...) //register more helps */ public static function register_help() { $args = func_get_args(); foreach ($args as $class) { //all help class of module should be lowercase if (class_exists('HW_HOANGWEB') && self::get($class)) { if (file_exists(self::get($class)->help_path)) { //HW_HOANGWEB::register_class('HW_HELP_'.strtoupper($class),HW_HELP_PATH.'helps/'.strtolower($class).'.php'); HW_HOANGWEB::register_class('HW_HELP_' . strtoupper($class), rtrim(self::get($class)->help_path, '/') . '/' . strtolower($class) . '.php'); } } } }
/** * init */ public static function init() { //register template pages HW_HOANGWEB::register_class('HW__Template_taxonomy', HW_HOANGWEB_INCLUDES . '/layout-templates/template-category-taxonomy.php', 'hw-template_taxonomy'); HW_HOANGWEB::register_class('HW__Template_404', HW_HOANGWEB_INCLUDES . '/layout-templates/template-404.php', 'hw-template-404'); HW_HOANGWEB::register_class('HW__Template_page', HW_HOANGWEB_INCLUDES . '/layout-templates/template-page.php', 'hw-template-page'); HW_HOANGWEB::register_class('HW__Template_single', HW_HOANGWEB_INCLUDES . '/layout-templates/template-single.php', 'hw-template-single'); HW_HOANGWEB::register_class('HW__Template_admin', HW_HOANGWEB_INCLUDES . '/layout-templates/template-admin.php', 'hw-template-admin'); //parse config file _hw_global('theme_config', self::get_theme_config()); //$config['sidebars']; //determine current template _hw_global('current_template', self::get_current_template()); //register positions for current theme self::register_theme_positions(); }
/** * Module Name: Ecommerce Product (WooCommerce) * Module URI: * Description: * Version: 1.0 * Author URI: http://hoangweb.com * Author: Hoangweb */ // exit if accessed directly if (!defined('ABSPATH')) { exit; } include 'includes/functions.php'; HW_HOANGWEB::register_class('HW_Product', dirname(__FILE__) . '/class-product-type.php'); HW_HOANGWEB::register_class('HW_Cloudzoom', dirname(__FILE__) . '/includes/class-ui-cloudzoom.php'); /** * Class HW_Module_product */ class HW_Module_product extends HW_Module { /** * attributes * @var array */ private $attrs = array(); /** * class construct method */ public function __construct() {