public function Enqueue_Frontend_Scripts() { # Check for HTML5 galleries if (!Current_Theme_Supports('html5', 'gallery')) { $this->Enqueue_Frontend_Stylehseet($this->base_url . '/assets/css/html5-galleries.css'); } # Enqueue Template Stylesheets foreach ($this->Get_Template_Files() as $template_name => $template_properties) { if ($stylesheet_uri = $template_properties['stylesheet_uri']) { $this->Enqueue_Frontend_Stylehseet($stylesheet_uri); } } # Enqueue the Script WP_Enqueue_Script('fancy-gallery', $this->base_url . '/assets/js/fancy-gallery.js', array('jquery'), $this->version, $this->options->Get('script_position') != 'header'); $arr_options = $this->options->Get(); unset($arr_options['disable_update_notification'], $arr_options['update_username'], $arr_options['update_password']); $arr_options['stylesheets'] = $this->arr_stylesheets; WP_Localize_Script('fancy-gallery', 'FANCYGALLERY', $arr_options); }
function Enqueue_Frontend_Scripts() { WP_Enqueue_Script('jquery.mousewheel', $this->base_url . '/js/jquery.mousewheel.js', array('jquery'), '3.0.6', $this->get_option('script_position') != 'header'); WP_Enqueue_Script('fancybox', $this->base_url . '/fancybox/jquery.fancybox.js', array('jquery'), '2.1.4', $this->get_option('script_position') != 'header'); WP_Enqueue_Style('fancybox', $this->base_url . '/fancybox/fancybox.css', Null, '2.1.4'); WP_Enqueue_Script('fancybox-buttons', $this->base_url . '/fancybox/jquery.fancybox-buttons.js', array('jquery', 'fancybox'), '1.0.5', $this->get_option('script_position') != 'header'); WP_Enqueue_Script('fancybox-media', $this->base_url . '/fancybox/jquery.fancybox-media.js', array('jquery', 'fancybox'), '1.0.5', $this->get_option('script_position') != 'header'); WP_Enqueue_Script('fancybox-thumbs', $this->base_url . '/fancybox/jquery.fancybox-thumbs.js', array('jquery', 'fancybox'), '1.0.7', $this->get_option('script_position') != 'header'); WP_Enqueue_Script('fancy-gallery', $this->base_url . '/js/fancy-gallery.js', array('jquery', 'fancybox'), $this->version, $this->get_option('script_position') != 'header'); // Add image descriptions as title if required if ($this->get_option('use_as_image_title') == 'description') { // Collect image titles $arr_image_titles = array(); foreach (Get_Posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'ID')) as $i => $image) { $arr_image_titles[$image->ID] = $this->get_image_title($image); } // Add image title to the images WP_Localize_Script('fancy-gallery', 'IMAGETITLES', $arr_image_titles); } // Add the plugin options to the JS front end $arr_options = $this->Get_Option(); unset($arr_options['disable_update_notification']); unset($arr_options['update_username']); unset($arr_options['update_password']); WP_Localize_Script('fancy-gallery', 'FANCYGALLERY', $arr_options); // Enqueue Template Stylesheets foreach ($this->Get_Template_Files() as $template_name => $template_properties) { $style_sheet_name = BaseName($template_properties['file'], '.php') . '.css'; $style_sheet_file = DirName($template_properties['file']) . '/' . $style_sheet_name; if (!Is_File($style_sheet_file)) { continue; } $template_dir = DirName($style_sheet_file); $style_sheet_id = 'fancy-gallery-template-' . Sanitize_Title($template_name); $template_base_url = Get_Bloginfo('wpurl') . '/' . SubStr($template_dir, Strlen(ABSPATH)); $template_base_url = Str_Replace("\\", '/', $template_base_url); // Windows workaround WP_Enqueue_Style($style_sheet_id, $template_base_url . '/' . $style_sheet_name); } }