/** * ajax handle callback * @hook wp_ajax_{hw_help_popup} */ function hw_ajax_hw_help_popup() { if (!wp_verify_nonce($_REQUEST['nonce'], "hw-module-help-nonce")) { exit("No naughty business please"); } if (!isset($_REQUEST['file'])) { return; } HW_HOANGWEB::load_class('HW_WP'); //enqueue syntax highlighter library if (class_exists('HW_Libraries', false)) { HW_Libraries::enqueue_jquery_libs('syntaxhighlighter_3.0.83'); HW_Libraries::get('syntaxhighlighter_3.0.83')->enqueue_scripts('shBrushJScript.js', 'shBrushXml.js', 'shBrushPhp.js'); } $file = HW_Encryptor::decrypt(urldecode($_REQUEST['file'])); if (file_exists($file)) { echo file_get_contents($file); } HW_WP::hw_clean_wp_head(); //wp_head(); wp_footer(); //init SyntaxHighlighter echo ' <script type="text/javascript"> //SyntaxHighlighter if(typeof SyntaxHighlighter != "undefined") SyntaxHighlighter.all(); </script> '; die; }
/** * @wp_hook admin_enqueue_scripts * @return mixed|void */ public function admin_enqueue_scripts() { global $wp_scripts; $aField = $this->getFieldData(); $data = array('no_image' => $this->get_property('no_image')); //form action //if($this->get_property('internal_form_action')) { $this->config = array('action_url' => $this->get_property('upload'), 'action_path' => $this->get_property('upload_file'), 'uploads_folder' => $this->get_property('uploads_path'), 'uploads_url' => $this->get_property('uploads_directory_uri'), 'image_type' => $this->get_property('image_type'), 'random_filename' => $this->get_property('random_filename'), 'allow_types' => $this->get_property('allow_types'), 'maxsize' => $this->get_property('maxsize'), 'redirect' => $this->get_property('redirect'), 'success_callback_js' => $this->get_property('success_callback_js'), 'error_callback_js' => $this->get_property('error_callback_js')); //} //else $data['upload_handle'] = $this->get_property('upload'); $id = md5($this->get_field_name()); $data[$id] = $this->config; $handle = $this->enqueue_script('assets/upload.js', array('jquery'), 'hw-apf-field-upload'); if ($handle) { self::$script_handle = $handle; $wp_scripts->add_data($handle, $id, $data[$id]); } if (!$handle) { //$wp_scripts->add_data(self::$script_handle, $id, $data[$id] ); //echo '<textarea>';print_r($wp_scripts);echo '</textarea>'; $this->add_data(self::$script_handle, '__hw_apf_field_upload', $id, $data[$id]); } elseif ($handle) { $this->localize_script($handle, '__hw_apf_field_upload', $data); } $this->enqueue_style('assets/style.css'); //jquery form lib HW_Libraries::enqueue_jquery_libs('jquery-libs/form'); }
/** * constructor * @param $class */ public function __construct($class) { parent::__construct($class, null); HW_Libraries::enqueue_jquery_libs('ckeditor'); //load ckeditor lib $this->enqueue_assets(); }
/** * @hook admin_enqueue_scripts */ public function admin_enqueue_scripts() { if ($this->is_module_setting_page()) { HW_Libraries::enqueue_jquery_libs('jquery-colorbox'); $this->enqueue_script('assets/scripts.js'); $this->enqueue_style('assets/style.css'); } }
/** * @hook wp_enqueue_scripts */ public function enqueue_scripts() { if (!is_admin()) { $this->enqueue_style('asset/custom-cloudzoom.css'); //load cloudzoom lib HW_Libraries::enqueue_jquery_libs('cloudzoom'); } }
/** * for backend */ public function _admin_enqueue_scripts() { if (HW_HOANGWEB::is_current_screen('widgets')) { //ckeditor HW_Libraries::enqueue_jquery_libs('ckeditor'); wp_enqueue_script('media'); wp_enqueue_media(); } }
/** * @hook admin_enqueue_scripts */ public function admin_enqueue_scripts() { #if($this->is_module_setting_page()) { HW_Libraries::enqueue_jquery_libs('jquery-colorbox'); #} $data = self::get()->get_values(); if (class_exists('HW_SKIN_Option')) { $data_json = HW_SKIN_Option::build_json_options($data); if ($data_json) { $data = (array) json_decode($data_json); } } $handle = $this->enqueue_script('colorbox-module.js'); $this->localize_script($handle, '__hw_module_colorbox', $data); }
/** * background effect */ public static function do_bacground_effect() { //only frontend if (!is_admin() && hw_option('effect')) { $effect = hw_option('effect'); //snow effect if ($effect == 'snow') { HW_Libraries::get('bg-effects')->enqueue_scripts('snow.js'); } if ($effect == 'fireworks') { //wp_enqueue_script('FireWorksNewYear',plugins_url('js/effects/FireWorksNewYear.js',dirname(__FILE__)),array('jquery')); HW_Libraries::get('bg-effects')->enqueue_scripts('FireWorksNewYear.js'); } } }
/** * construct method * @param $args * @param $options */ public function __construct($args = array(), $options = array()) { parent::__construct($args, $options); //load cloudzoom lib HW_Libraries::enqueue_jquery_libs('cloudzoom'); $this->cloudzoom_id = HW_String::generateRandomString(); //valid if (!is_array($args)) { $args = array(); } //params $default_params = array('images_from_current_post' => '0', 'zoombig_width' => '300px', 'zoombig_height' => '', 'container_id' => 'cloudzoom-container', 'container_class' => '', 'thumb_anchor_class' => 'cloudzoom-thumb-anchor-class', 'thumb_img_class' => 'cloudzoom-thumb-img-class', 'smallthumb_container_class' => 'cloudzoom-smallthumb-container', 'smallthumb_class' => 'cloudzoom-smallthumb-class', 'smallthumb_item_class' => 'cloudzoom-smallthumb-item-class', 'smallthumb_anchor_class' => 'cloudzoom-smallthumb-anchor-class', 'smallthumb_img_class' => 'cloudzoom-smallthumb-img-class'); if (class_exists('HW_Module_Cloudzoom') && HW_Module_Cloudzoom::is_active()) { $setting = HW_Module_Cloudzoom::get(); $params['images_from_current_post'] = $setting->get_field_value('images_from_current_post'); $params['zoombig_width'] = $setting->get_field_value('zoombig_width'); $params['zoombig_height'] = $setting->get_field_value('zoombig_height'); $params['container_id'] = $setting->get_field_value('container_id'); $params['container_class'] = $setting->get_field_value('container_class'); $params['thumb_anchor_class'] = $setting->get_field_value('thumb_anchor_class'); $params['thumb_img_class'] = $setting->get_field_value('thumb_img_class'); $params['smallthumb_container_class'] = $setting->get_field_value('smallthumb_container_class'); $params['smallthumb_class'] = $setting->get_field_value('smallthumb_class'); $params['smallthumb_item_class'] = $setting->get_field_value('smallthumb_item_class'); $params['smallthumb_anchor_class'] = $setting->get_field_value('smallthumb_anchor_class'); $params['smallthumb_img_class'] = $setting->get_field_value('smallthumb_img_class'); } $this->set_params($default_params); if (is_array($args)) { $this->set_params($args); } //cloud options if (is_array($options)) { $this->set_options($options); } }
public function _wp_enqueue_scripts() { if (!is_admin()) { //enqueue sticky lib #HW_Libraries::enqueue_jquery_libs('sticky'); //best way HW_Libraries::get('sticky')->enqueue_scripts('jquery.sticky.js'); #wp_enqueue_script('jquery.sticky.js', plugins_url('asset/jquery.sticky.js', __FILE__)); } }
public function _wp_enqueue_scripts() { if (!is_admin()) { //enqueue fancybox lib HW_Libraries::enqueue_jquery_libs('fancybox'); } }
/** * register js libs * @param $name library name * @param $resource define resrouce */ public static function registers_jquery_libs($name = '', $resource = '') { //self::$jquery_libs ->this variable no longer use $init_libs = hw_get_autoload('jquery-libs'); if (is_callable($init_libs)) { call_user_func($init_libs); } if (!empty($name) && is_string($name) && is_array($resource)) { //do not allow override exists library if (!HW_Libraries::get($name)) { HW_Libraries::add($name, $resource); } //or HW_Libraries::add($name, $resource,false) } }
/** * return autoload config * @param $config */ public static function get_autoload($config) { return HW_Libraries::get_default_js_libs($config); }
/** * @hook admin_enqueue_scripts */ public function _admin_enqueue_scripts() { HW_Libraries::enqueue_jquery_libs('jquery-colorbox'); }
/** * render scroll tabs * @param array $args * @param $options override options */ public function display_scrolltabs($args = array(), $options = array()) { //scroll tabs js HW_Libraries::get('easytabs')->enqueue_scripts('jquery.scrolltracker.js'); HW_Libraries::get('easytabs')->enqueue_scripts('jquery.vietcodex.track-content-tabs-scroll.js'); //prepare data if (isset($args['show_tabs']) && $args['show_tabs']) { echo $this->render_ui(); } do_action('hw_tabs_display_scrolltabs_after', $this); $config = $this->get_params(); extract($config); //option $opt = array('tabs_topSpacing' => 0, 'debug' => false, 'current_tab_class' => 'current-tab'); if ($config['current_tab_class']) { $opt['current_tab_class'] = $config['current_tab_class']; } if (is_array($options)) { $opt = array_merge($opt, $options); } echo "<script>\r\n jQuery(document).ready(function(\$){\r\n jQuery('.{$tabs_menu_class}').vcdx_trackContentPos(" . json_encode($opt) . ");\r\n });\r\n </script>"; }
<?php /** * HW Template: pikachoose-96 */ $options = isset($skin_data['skin_options']) ? $skin_data['skin_options'] : array(); $gallery_id = 'gallery-' . sanitize_html_class($args['wrapper_id']); // Gallery element if (!empty($options['css'])) { HW_Libraries::get('pikachoose-96')->enqueue_styles($options['css']); //addition css file } ?> <div class="pikachoose <?php echo sanitize_html_class($args['wrapper_class']); ?> " id="<?php echo $gallery_id; ?> "> <ul class="pikame" > <?php foreach ($galleries as $id => $item) { ?> <li><a href="<?php echo $item['url']; ?> "><img src="<?php echo $item['img_src']; ?>
/** * constructor */ public function __construct() { $this->setup_actions(); //prepare actions //register system classes automatically /*self::register_class('AdminPageFramework', array( 'debug' => HW_HOANGWEB_PATH.'/lib/admin-page-framework/development/admin-page-framework.php', 'release' => HW_HOANGWEB_PATH.'/lib/admin-page-framework/admin-page-framework.min.php', 'class' => 'AdminPageFramework' ));*/ //load apf field type self::load_class('HW_APF_FormField'); //curl self::load_class('HW_URL'); //curl self::load_class('HW_CURL'); //curl self::load_class('HW_XML'); //xml self::load_class('HW_SESSION'); //php session self::load_class('HW_Logger'); //logging system self::load_class('HW_File_Directory'); //logging system self::load_class('HW_XMLRPC_Server'); //xmlrpc api //notices class HW_HOANGWEB::load_class('HW_WP_NOTICES'); //admin notice //auto load Twig template engine //HW_HOANGWEB::register_class('Twig_Loader_Filesystem', HW_HOANGWEB_PATH.'/lib/vendor/autoload.php'); //validation HW_HOANGWEB::load_class('HW_Validation'); //validation HW_HOANGWEB::load_class('HW_CLI_Command'); //wpcli command class if (!is_admin()) { self::load_class('HW_Twig_Template'); } //twig template //get more field types //self::init_fieldtypes(); //registers jquery libs stuff HW_Libraries::registers_jquery_libs(); }
/** * put stylesheet & js together on admin head page */ public function _hw_awc_admin_enqueue_scripts() { global $wp_customize; //get working page if (class_exists('HW_HOANGWEB') && HW_HOANGWEB::is_current_screen(array('widgets', 'hw_sidebar_widgets_settings')) || !empty($wp_customize)) { wp_enqueue_style('hw-awc-style', HW_AWC_URL . '/style.css'); wp_enqueue_script('hw-awc-script', HW_AWC_URL . '/js/hw-awc-admin-js.js', array('jquery')); #wp_enqueue_script('jscolor', HW_AWC_URL.('/js/jscolor/jscolor.js')); //jscolor lib HW_Libraries::enqueue_jquery_libs('colors/jscolor'); wp_localize_script('hw-awc-script', 'HW_AWC', array()); //create js object for this module //load media upload box in admin wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); } /*if(HW_HOANGWEB::is_current_screen('widgets')){ //wp link popup moved to new widget feature // need these styles wp_enqueue_style('wp-jquery-ui-dialog'); wp_enqueue_style('editor.min.css', includes_url('css/editor.min.css'), null); }*/ }
/** * @param string $hash_skin: active hash skin string * @param $fname file name * @param $base_fname: base field name * @param $options_value: store all options values * @param $hash_skin: current skin hash */ public function prepare_skin_options_fields($fname, $options_value = '', $hash_skin = '', $base_fname = '') { //if($hash_skin) $this->set_active_skin($hash_skin); $theme_options = array(); $option_file = $this->get_file_skin_options($hash_skin); $theme_setting = $this->get_file_skin_setting(); if (file_exists($theme_setting)) { include $theme_setting; if (isset($theme['js-libs'])) { if (is_array($theme['js-libs'])) { $lib = trim(reset($theme['js-libs'])); } elseif (is_string($theme['js-libs'])) { $lib = trim($theme['js-libs']); } //fetch options from lib if (!empty($lib) && HW_Libraries::get($lib)) { $lib_options = HW_Libraries::get($lib)->get_lib_options(true); if (is_array($lib_options) && count($lib_options)) { $theme_options = array_merge($theme_options, $lib_options); } //valid } } //fetch default options if (isset($theme['default_options'])) { if (!empty($theme['default_options']) && is_string($theme['default_options']) && file_exists($theme['default_options'])) { $def_options = $this->get_file_skin_options($theme['default_options'], true); if (is_array($def_options) && count($def_options)) { $theme_options = array_merge($theme_options, $def_options); } } } if (file_exists(dirname(dirname($theme_setting)) . '/options.php')) { $auto_options = $this->get_file_skin_options(dirname(dirname($theme_setting)) . '/options.php', true); if (is_array($auto_options) && count($auto_options)) { $theme_options = array_merge($theme_options, $auto_options); } } } //get document $readme = $this->get_file_skin_resource('readme.html'); //_print($readme); if (file_exists($readme)) { $readme_link = $this->get_skin_url('readme.html'); } $notice_skin_option = 'Vui lòng nhấn save để tùy chỉnh options của theme này nếu có.'; //skin options notice //get field name/id if (!empty($this->widget_ref) && $this->widget_ref instanceof WP_Widget) { $myfield_id = $this->widget_ref->get_field_id($fname); $myfield_name = $this->widget_ref->get_field_name($fname); } else { $myfield_id = !empty($base_fname) ? $base_fname . '_' . $fname : $fname; $myfield_name = !empty($base_fname) ? $base_fname . '[' . $fname . ']' : $fname; } $theme_options_output = array(); if (file_exists($option_file)) { include $option_file; //load skin config options } //prepend default skin options if (!isset($theme_options)) { $theme_options = array(); } self::default_skin_options($theme_options); if (isset($theme_options) && is_array($theme_options)) { $skin_data = $this->get_skin_data($hash_skin); //get active skin data $parse_id = isset($skin_data['screenshot']) ? md5($skin_data['screenshot']) : md5(rand()); $theme_options_output[] = '<hr/><div class="hw-skin-options-holder" data-collapse="accordion persist" id="' . $parse_id . '">'; $theme_options_output[] = '<h2>Tùy biến skin</h2><div class="skin-options">'; //toggle title //create fields foreach ($theme_options as $_field) { $theme_options_output[] = $this->renderOptionField($_field, $myfield_name, $myfield_id, $options_value); } $theme_options_output[] = '</div></div>'; //close parse_id div tag $theme_options_output[] = '<div class="hw-skin-options-notice" style="display: none;color:red !important;">' . $notice_skin_option . '</div>'; } $msg_id = 'hwskin_msg_' . $myfield_id; //div message id $theme_options_output[] = '<div class="message hw-skin-options-notice" id="' . $msg_id . '"></div>'; if (isset($readme_link)) { $theme_options_output[] = '<a href="' . $readme_link . '" target="_blank">Xem tài liệu</a>'; } if (isset($parse_id)) { $hwskin_event_change_name = 'hwskin_field_' . $this->valid_objname($myfield_id) . '_' . $parse_id . '_change_event'; //change event callback name $this->saveCallbackJs4SkinChangeEvent("if(typeof {$hwskin_event_change_name} == 'function') " . $hwskin_event_change_name . '(skin);'); //$this->skin->saveCallbackJs4SkinChangeEvent('$("#'.$skin_config_field_id.'").val(skin.screenshot);'); //call this before render skins selector $theme_options_output[] = '<script> function ' . $hwskin_event_change_name . '(skin){ console.log(skin,"' . $parse_id . '"); if(skin.md5 === "' . $parse_id . '"){ jQuery("#' . $parse_id . '").removeClass("hw-skin-options-none").show();jQuery("#' . $parse_id . '").next().hide(); jQuery("#' . $parse_id . '").find("input,select").removeAttr("disabled").css({"display":""}); } else{ jQuery("#' . $parse_id . '").addClass("hw-skin-options-none").hide();jQuery("#' . $parse_id . '").next().show(); jQuery("#' . $parse_id . '").find("input,select").attr({"disabled":"disabled"}).css("display","none"); } } </script> '; } else { $this->saveCallbackJs4SkinChangeEvent('jQuery("#' . $msg_id . '").html("' . $notice_skin_option . '");'); } return implode("\n", $theme_options_output); }
/** * display ads on the website */ public function _hw_footer_setup_flra() { if (function_exists('hwlib_load_library')) { $mobile_detect = hwlib_load_library('HW_Mobile_Detect'); // if ($mobile_detect->object->isMobile() && !hw_option('ads_active_mobile')) { return; //do not show ads on mobile device } } //show ads if (hw_option('enable_flra')) { $id = rand(); $id_left_ad = 'hw_divAdLeft_' . $id; $id_right_ad = 'hw_divAdRight_' . $id; $effect = hw_option('ads_effects'); $lad_width = hw_option('lad_width', 150); //left ad width $rad_width = hw_option('rad_width', 150); //right ad width $mcontent_div = hw_option('mcontent_div'); //div main wrapper #$mcontent_width = hw_option('mcontent_width', 1000); ?> <style> #<?php echo $id_right_ad; ?> , #<?php echo $id_left_ad; ?> { display: block;z-index: 1e+19;position: absolute; } .hw-side-ads{ position: absolute !important; width: <?php echo $lad_width; ?> px; display: none; top:0px; } <?php if ($effect == 'fixed_to_top') { ?> <?php if ($mcontent_div) { echo "\r\n {$mcontent_div} {position:relative !important;}\r\n "; } ?> #<?php echo $id_right_ad; ?> .hw-ad-right{ <?php if ($rad_width) { echo "width: {$rad_width}px"; } ?> } #<?php echo $id_left_ad; ?> .hw-ad-left{ left:-<?php echo $lad_width + 10; ?> px; <?php if ($rad_width) { echo "width: {$lad_width}px"; } ?> } <?php } ?> </style> <!-- banner truot 2 ben --> <div id="<?php echo $id_right_ad; ?> " style=""><!-- left: 286.5px; --> <div class="hw-side-ads hw-ad-right"><?php echo hw_option('ad_left'); ?> </div> </div> <div id="<?php echo $id_left_ad; ?> " style=""><!-- left: 1486.5px; --> <div class="hw-side-ads hw-ad-left"><?php echo hw_option('ad_right'); ?> </div> </div> <script> var hw_ads = { /** * return ads setting */ hw_ads_settings: function() { var mcontent_div = '<?php echo hw_option('mcontent_div', ''); ?> '; var MainContentW = 0; //for default var LeftBannerW = <?php echo hw_option('lad_width', 150); ?> ; var RightBannerW = <?php echo hw_option('rad_width', 150); ?> ; var LeftAdjust = 0; var RightAdjust = 0; var TopAdjust = <?php echo hw_option('top_adjust', 20); ?> ; return { mcontent_div: mcontent_div, MainContentW: MainContentW, LeftBannerW:LeftBannerW, RightBannerW:RightBannerW, LeftAdjust: LeftAdjust, RightAdjust: RightAdjust, TopAdjust : TopAdjust } }, /** * This will check if the element is entirely visible in the current viewport */ elementInViewport:function (el) { if(typeof el =='string') el = jQuery(el).get(0); return jQuery(el).visible(); /* var top = el.offsetTop; var left = el.offsetLeft; var width = el.offsetWidth; var height = el.offsetHeight; while(el.offsetParent) { el = el.offsetParent; top += el.offsetTop; left += el.offsetLeft; } return ( top >= window.pageYOffset && left >= window.pageXOffset && (top + height) <= (window.pageYOffset + window.innerHeight) && (left + width) <= (window.pageXOffset + window.innerWidth) ); */ }, /** * You could modify this simply to determine if any part of the element is visible in the viewport: * @param el * @returns {boolean} */ elementInViewport2: function(el) { if(typeof el =='string') el = jQuery(el).get(0); var top = el.offsetTop; var left = el.offsetLeft; var width = el.offsetWidth; var height = el.offsetHeight; while(el.offsetParent) { el = el.offsetParent; top += el.offsetTop; left += el.offsetLeft; } return ( top < (window.pageYOffset + window.innerHeight) && left < (window.pageXOffset + window.innerWidth) && (top + height) > window.pageYOffset && (left + width) > window.pageXOffset ); } }; jQuery(document).ready(function(){ hw_ads.ads_settings = hw_ads.hw_ads_settings(); //update MainContentW if(hw_ads.ads_settings.mcontent_div && jQuery(hw_ads.ads_settings.mcontent_div).length) { hw_ads.ads_settings.MainContentW = jQuery(hw_ads.ads_settings.mcontent_div).width(); hw_ads.ads_settings.ads_container = jQuery(hw_ads.ads_settings.mcontent_div); } else { var ads_container = jQuery('<div/>').addClass('hw-ads-container').css({ position: 'absolute',width:'100%',margin:'auto',top: hw_ads.ads_settings.TopAdjust + 'px'}); ads_container.appendTo('body:eq(0)'); hw_ads.ads_settings.MainContentW = ads_container.width(); //update main content width hw_ads.ads_settings.ads_container = ads_container; } }); </script> <?php //following scrollbar if ($effect == 'follow_scrollbar') { ?> <script> (function(){ /** * float top div */ function hw_FloatTopDiv() { startLX = ((document.body.clientWidth - hw_ads.ads_settings.MainContentW)/2)- hw_ads.ads_settings.LeftBannerW-hw_ads.ads_settings.LeftAdjust , startLY = hw_ads.ads_settings.TopAdjust+80; startRX = ((document.body.clientWidth - hw_ads.ads_settings.MainContentW)/2)+ hw_ads.ads_settings.MainContentW+ hw_ads.ads_settings.RightAdjust , startRY = hw_ads.ads_settings.TopAdjust+80; var d = document; function ml(id) { var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; el.x = startRX; el.y = startRY; return el; } function m2(id) { var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; e2.x = startLX; e2.y = startLY; return e2; } window.stayTopLeft=function() { if (document.documentElement && document.documentElement.scrollTop) var pY = document.documentElement.scrollTop; else if (document.body) var pY = document.body.scrollTop; if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else { startLY = hw_ads.ads_settings.TopAdjust; startRY = hw_ads.ads_settings.TopAdjust; }; ftlObj.y += (pY+startRY-ftlObj.y)/16; ftlObj.sP(ftlObj.x, ftlObj.y); ftlObj2.y += (pY+startLY-ftlObj2.y)/16; ftlObj2.sP(ftlObj2.x, ftlObj2.y); setTimeout("stayTopLeft()", 1); } ftlObj = ml("<?php echo $id_right_ad; ?> "); //stayTopLeft(); ftlObj2 = m2("<?php echo $id_left_ad; ?> "); stayTopLeft(); } /** * show ads div */ function hw_ShowAdDiv() { var objAdDivRight = document.getElementById("<?php echo $id_right_ad; ?> "); var objAdDivLeft = document.getElementById("<?php echo $id_left_ad; ?> "); if (document.body.clientWidth < hw_ads.ads_settings.MainContentW) { objAdDivRight.style.display = "none"; objAdDivLeft.style.display = "none"; } else { objAdDivRight.style.display = "block"; objAdDivLeft.style.display = "block"; hw_FloatTopDiv(); } } //events jQuery(document).ready(function(){ //show ad div hw_ShowAdDiv(); window.onresize=hw_ShowAdDiv; //show ads jQuery(".hw-side-ads").show(); }); })(); </script> <?php } elseif ($effect == 'fixed_to_top') { HW_Libraries::enqueue_jquery_libs('sticky'); ?> <script> jQuery(document).ready(function(){ var ads_container= null, ad_right =hw_ads.ads_settings.MainContentW+10, ad_left = hw_ads.ads_settings.LeftBannerW+10; //setting /*if(!hw_ads.elementInViewport('#<?php echo $id_right_ad; ?> ')) { }*/ hw_ads.ads_settings.ads_container.prepend(jQuery("#<?php echo $id_left_ad; ?> ")/*.html()*/); hw_ads.ads_settings.ads_container.prepend(jQuery("#<?php echo $id_right_ad; ?> ")/*.html()*/); //jQuery(hw_ads.ads_settings.mcontent_div).remove(); if(hw_ads.ads_settings.MainContentW < jQuery(window).width()) { ad_right +=hw_ads.ads_settings.RightBannerW; } jQuery('#<?php echo $id_right_ad; ?> .hw-ad-right').css({"right": - (ad_right)}); //fixed ad left setTimeout(function(){ console.log(hw_ads.elementInViewport('#<?php echo $id_left_ad; ?> .hw-side-ads'),ad_left); if(hw_ads.elementInViewport('#<?php echo $id_left_ad; ?> .hw-side-ads') == false){ ad_left = -10; } jQuery('#<?php echo $id_left_ad; ?> .hw-ad-left').css({"left": - (ad_left)}); },50); //show ads jQuery(".hw-side-ads").show(); jQuery("#<?php echo $id_right_ad; ?> ").sticky({topSpacing: hw_ads.ads_settings.TopAdjust}); jQuery("#<?php echo $id_left_ad; ?> ").sticky({topSpacing: hw_ads.ads_settings.TopAdjust}); }); </script> <?php } ?> <?php } }
/** * @hook admin_enqueue_scripts * enqueue scripts/styles */ public function _admin_enqueue_scripts() { if (HW_HOANGWEB::is_current_screen('hoangweb-theme-options')) { HW_Libraries::enqueue_jquery_libs('jquery-colorbox'); //jquery colorbox lib } }
/** * @hook admin_enqueue_scripts */ public function admin_enqueue_scripts() { $this->enqueue_script('admin-tooltip.js'); HW_Libraries::enqueue_jquery_libs('tooltips/tooltipster'); }
/** * @hook admin_enqueue_scripts */ public function admin_enqueue_scripts() { HW_Libraries::get('jquery-libs')->enqueue_scripts('jquery-ui-1.11.4.js'); HW_Libraries::get('jquery-libs')->enqueue_styles('jquery-ui-1.11.4.css'); HW_Libraries::enqueue_jquery_libs('blockUI'); wp_enqueue_style('hw-installer-css', HW_HOANGWEB_URL . '/css/installer.css'); //css for installation page wp_enqueue_script('hw-installer', HW_HOANGWEB_URL . '/js/installer.js', array('jquery')); wp_localize_script('hw-installer', '__hw_installer', array('ver' => '1.0')); }
/** * enqueue assets for js+css file * @hook wp_enqueue_scripts */ public static function _enqueue_scripts() { global $wp_styles; $current = self::get_current_template(false); $config = $current['object']->get_config_data(); #$current['object'] $active_assets = array(); $assets = $config->item('assets') ? $config->item('assets') : array(); //->item('assets'); /* * From WP * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } //common assets if (!empty($assets['__all__'])) { $active_assets = array_merge($active_assets, $assets['__all__']); } if (!empty($assets[$current['name']])) { //get assets for current context $active_assets = array_merge($active_assets, $assets[$current['name']]); } foreach ($active_assets as $file) { //valid file path if (!is_dir($file['name']) && !file_exists($file['name'])) { $url = get_stylesheet_directory_uri() . '/' . $file['name']; } else { $url = $file['name']; } if (!HW_URL::valid_url($url)) { continue; } $handle = isset($file['handle']) ? $file['handle'] : md5($file['name']); //for js if ($file['type'] == 'js') { if (HW_URL::valid_url($url)) { wp_enqueue_script($handle, $url, $file['depends']); } continue; } elseif ($file['type'] == 'css') { wp_enqueue_style(md5($file['name']), $url, $file['depends']); continue; } } if (is_object($current) && method_exists($current, 'enqueue_scripts')) { call_user_func(array($current, 'enqueue_scripts')); //addition stuff } //default js if (!is_admin()) { HW_Libraries::enqueue_jquery_libs('pageload/nprogress'); } //show progressbar while page loading }
/** * @hook do_before_{page-slug}_{modules-config tab} */ public function _do_before_tab_hook() { HW_Libraries::enqueue_jquery_libs('menus/superfish'); }
/** * prepare settings * @param $instance: widget instance data */ private function init_settings($instance = array()) { if (!$instance || !is_array($instance) || !count($instance)) { $instance = $this->get_widget_instance(); } //get widget settings //scrolling content if ($this->enable_scrolling()) { $jcarousellite = HW_Libraries::get('sliders/jcarousellite'); $smoothDivScroll = HW_Libraries::get('sliders/smoothDivScroll'); $jcarousellite->enqueue_scripts('jquery.kinetic.min.js'); //add drag scrolling feature $jcarousellite->enqueue_scripts('jquery.mousewheel.min.js'); #wp_enqueue_script('jquery.kinetic.min.js',plugins_url('js/jquery.kinetic.min.js',__FILE__),array('jquery'),0,true); #wp_enqueue_script('jquery.mousewheel.min.js',plugins_url('js/jquery.mousewheel.min.js',__FILE__),array('jquery'),0,true); if ($instance['scroll_type'] == 'smoothdivscroll') { if ($this->is_vertical_scrolling()) { //enqueue query.smoothDivScroll, note this modified version of original smoothDivScroll to support vertical scrolling direction /*wp_register_script('jquery.smoothDivScroll-vertical-1.2.js',plugins_url('js/jquery.smoothDivScroll-vertical-1.2.js',__FILE__),array('jquery')); wp_enqueue_script('jquery.smoothDivScroll-vertical-1.2.js');*/ $smoothDivScroll->enqueue_scripts('jquery.smoothDivScroll-vertical-1.2.js'); } else { //wp_enqueue_script('jquery.smoothdivscroll-1.3-min.js',plugins_url('js/jquery.smoothdivscroll-1.3-min.js',__FILE__),array('jquery')); $smoothDivScroll->enqueue_scripts('jquery.smoothdivscroll-1.3-min.js'); } //wp_enqueue_style('smoothDivScroll.css',plugins_url('css/smoothDivScroll.css',__FILE__)); $smoothDivScroll->enqueue_styles('smoothDivScroll.css'); } if ($instance['scroll_type'] == 'jcarousellite') { #wp_enqueue_script('jquery.easing.1.3.js',plugins_url('js/jquery.easing.1.3.js',__FILE__),array('jquery')); #wp_enqueue_script('jquery.jcarousellite.min.js',plugins_url('js/jquery.jcarousellite.min.js',__FILE__),array('jquery')); $jcarousellite->enqueue_scripts('jquery.easing.1.3.js', 'jquery.jcarousellite.min.js', 'jquery.jcarousellite.pauseOnHover.js'); } } //load scrollbar lib if (isset($instance['enable_scrollbar']) && $instance['enable_scrollbar']) { //wp_enqueue_script('jquery.lionbars.0.3.js', HWTPL_PLUGIN_URL.'/js/jquery.lionbars.0.3.js', array('jquery')); } }
//Skitter HW_Libraries::add('sliders/Skitter', array('libs' => array(array('jquery-libs' => array('scripts' => ['jquery.easing.1.3.js']))), 'scripts' => array('jquery.skitter.min.js' => array('file' => 'asset/jquery.skitter.min.js', 'required' => true, 'depends' => array('jquery'))), 'styles' => array('skitter.styles.css' => array('file' => 'skitter.styles.css', 'required' => true)))); //wonderpluginslider HW_Libraries::add('sliders/wonderpluginslider', array('scripts' => array('wonderpluginslider.js' => array('file' => 'wonderpluginslider.js', 'required' => true, 'depends' => array('jquery')), 'wonderpluginsliderskins.js' => array('file' => 'wonderpluginsliderskins.js', 'required' => true, 'depends' => array('jquery'))), 'styles' => array('wonderpluginsliderengine.css' => array('file' => 'wonderpluginsliderengine.css', 'required' => true)))); //bxslider HW_Libraries::add('sliders/bxSlider', array('scripts' => array('jquery.bxslider.min.js' => array('file' => 'jquery.bxslider.min.js', 'required' => true, 'depends' => array('jquery'))), 'styles' => array('jquery.bxslider.css' => array('file' => 'jquery.bxslider.css', 'required' => true)))); // /** * scrollbars */ //lionbars HW_Libraries::add('scrollbars/lionbars', array('scripts' => array('jquery.lionbars.0.3.js' => array('file' => 'jquery.lionbars.0.3.js', 'required' => true, 'depends' => true)), 'styles' => array('style.css' => array('file' => 'style.css', 'required' => true, 'depends' => true)))); //perfect-scrollbar HW_Libraries::add('scrollbars/perfect-scrollbar', array('scripts' => array('perfect-scrollbar.js' => array('file' => 'js/perfect-scrollbar.js', 'required' => true, 'depends' => array('jquery')), 'perfect-scrollbar.jquery.js' => array('file' => 'js/perfect-scrollbar.jquery.js', 'required' => true, 'depends' => array('jquery'))), 'styles' => array('style.css' => array('file' => 'style.css', 'required' => true), 'perfect-scrollbar.min.css' => array('file' => 'css/perfect-scrollbar.min.css', 'required' => true)))); /** * UI Components */ //ddslick HW_Libraries::add('components-ui/dropdown_ddslick', array('scripts' => array('jquery.ddslick.min.js' => array('file' => 'jquery.ddslick.min.js', 'required' => true, 'depends' => array('jquery'))))); //jquery collapse HW_Libraries::add('components-ui/collapse/jQuery-Collapse', array('scripts' => array('jquery.collapse.js' => array('file' => 'jquery.collapse.js', 'required' => true, 'depends' => array('jquery')), 'jquery.collapse_cookie_storage.js' => array('file' => 'jquery.collapse_cookie_storage.js', 'required' => true, 'depends' => array('jquery')), 'jquery.collapse_storage.js' => array('file' => 'jquery.collapse_storage.js', 'required' => true, 'depends' => array('jquery'))))); /** * colors */ //jscolor HW_Libraries::add('colors/jscolor', array('scripts' => array('jscolor.js' => array('file' => 'jscolor.js', 'required' => true, 'depends' => array('jquery'))))); //color picker HW_Libraries::add('colors/spectrum', array('scripts' => array('file' => 'spectrum.js', 'required' => true, 'depends' => array('jquery')), 'styles' => array('file' => 'spectrum.css', 'required' => true))); //page loading progressbar HW_Libraries::add('pageload/nprogress', array('scripts' => array('nprogress.js' => array('file' => 'nprogress.js', 'required' => true, 'depends' => array('jquery'))), 'styles' => array('nprogress.css' => array('file' => 'nprogress.css', 'required' => true)))); };