function load_scripts()
 {
     // if you don't want that NGG load the scripts, add this constant
     if (defined('NGG_SKIP_LOAD_SCRIPTS')) {
         return;
     }
     //	activate Thickbox
     if ($this->options['thumbEffect'] == 'thickbox') {
         wp_enqueue_script('thickbox');
         // Load the thickbox images after all other scripts
         add_action('wp_footer', array(&$this, 'load_thickbox_images'), 11);
     }
     // activate modified Shutter reloaded if not use the Shutter plugin
     if ($this->options['thumbEffect'] == "shutter" && !function_exists('srel_makeshutter')) {
         wp_register_script('shutter', NGGALLERY_URLPATH . 'shutter/shutter-reloaded.js', false, '1.3.3');
         wp_localize_script('shutter', 'shutterSettings', array('msgLoading' => __('L O A D I N Ghello', 'nggallery'), 'msgClose' => __('Click to Close', 'nggallery'), 'imageCount' => '1'));
         wp_enqueue_script('shutter');
     }
     // required for the slideshow
     if (NGGALLERY_IREXIST == true && $this->options['enableIR'] == '1' && nggGallery::detect_mobile_phone() === false) {
         wp_enqueue_script('swfobject', NGGALLERY_URLPATH . 'admin/js/swfobject.js', FALSE, '2.2');
     } else {
         wp_register_script('jquery-cycle', NGGALLERY_URLPATH . 'js/jquery.cycle.all.min.js', array('jquery'), '2.9995');
         wp_enqueue_script('ngg-slideshow', NGGALLERY_URLPATH . 'js/ngg.slideshow.min.js', array('jquery-cycle'), '1.06');
     }
     // Load AJAX navigation script, works only with shutter script as we need to add the listener
     if ($this->options['galAjaxNav']) {
         if ($this->options['thumbEffect'] == "shutter" || function_exists('srel_makeshutter')) {
             wp_enqueue_script('ngg_script', NGGALLERY_URLPATH . 'js/ngg.js', array('jquery'), '2.1');
             wp_localize_script('ngg_script', 'ngg_ajax', array('path' => NGGALLERY_URLPATH, 'callback' => trailingslashit(home_url()) . 'index.php?callback=ngg-ajax', 'loading' => __('loading', 'nggallery')));
         }
     }
     // If activated, add PicLens/Cooliris javascript to footer
     if ($this->options['usePicLens']) {
         nggMediaRss::add_piclens_javascript();
     }
 }
Beispiel #2
0
 /**
  * Load scripts depending options defined
  * 20150106: Added js for Qunit
  * 20150107: jquery is almost mandatory... Should it be enqueued only when lightbox is activated?
  */
 function load_scripts()
 {
     // if you want to prevent Nextcellent load the scripts (for testing or development purposes), add this constant
     if (defined('NGG_SKIP_LOAD_SCRIPTS')) {
         return;
     }
     //	activate Thickbox
     if ($this->options['thumbEffect'] == 'thickbox') {
         wp_enqueue_script('thickbox');
         // Load the thickbox images after all other scripts
         add_action('wp_footer', array(&$this, 'load_thickbox_images'), 11);
     }
     // activate jquery.lightbox
     if ($this->options['thumbEffect'] == 'lightbox') {
         wp_enqueue_script('jquery');
     }
     // activate modified Shutter reloaded if not use the Shutter plugin
     if ($this->options['thumbEffect'] == "shutter" && !function_exists('srel_makeshutter')) {
         wp_register_script('shutter', NGGALLERY_URLPATH . 'shutter/shutter-reloaded.js', false, '1.3.3');
         wp_localize_script('shutter', 'shutterSettings', array('msgLoading' => __('L O A D I N G', 'nggallery'), 'msgClose' => __('Click to Close', 'nggallery'), 'imageCount' => '1'));
         wp_enqueue_script('shutter');
     }
     // required for the slideshow
     if (NGGALLERY_IREXIST == true && $this->options['enableIR'] == '1' && nggGallery::detect_mobile_phone() === false) {
         wp_enqueue_script('swfobject');
     } else {
         wp_enqueue_script('owl', NGGALLERY_URLPATH . 'js/owl.carousel.min.js', array('jquery'), '2');
     }
     // Load AJAX navigation script, works only with shutter script as we need to add the listener
     if ($this->options['galAjaxNav']) {
         if ($this->options['thumbEffect'] == "shutter" || function_exists('srel_makeshutter')) {
             wp_enqueue_script('ngg_script', NGGALLERY_URLPATH . 'js/ngg.js', array('jquery', 'jquery-ui-tooltip'), '2.1');
             wp_localize_script('ngg_script', 'ngg_ajax', array('path' => NGGALLERY_URLPATH, 'callback' => trailingslashit(home_url()) . 'index.php?callback=ngg-ajax', 'loading' => __('loading', 'nggallery')));
         }
     }
     // If activated, add PicLens/Cooliris javascript to footer
     if ($this->options['usePicLens']) {
         nggMediaRss::add_piclens_javascript();
     }
     // Added Qunit for javascript unit testing
     $nxc = isset($_GET['nextcellent']) ? $_GET['nextcellent'] : "";
     if ($nxc) {
         wp_enqueue_script("qunit-init", NGGALLERY_URLPATH . "js/nxc.main.js", array('jquery'));
         //main q-unit call
         wp_enqueue_script("qunit", NGGALLERY_URLPATH . "js/qunit-1.16.0.js", array('jquery'));
         //qunit core
         wp_enqueue_script("nextcellent-test", NGGALLERY_URLPATH . "js/nxc.test.js", array('jquery'));
         //unit testing specific for nextcellent
     }
 }