function render_slideshow($galleryID, $irWidth = '', $irHeight = '')
 {
     require_once dirname(__FILE__) . '/../lib/swfobject.php';
     $ngg_options = get_option('ngg_options');
     //Redirect all calls to the JavaScript slideshow if wanted
     if ($ngg_options['enableIR'] !== '1' || nggGallery::detect_mobile_phone() === true || NGGALLERY_IREXIST == false) {
         return nggShow_JS_Slideshow($galleryID, $irWidth, $irHeight, 'ngg-widget-slideshow');
     }
     if (empty($irWidth)) {
         $irWidth = (int) $ngg_options['irWidth'];
     }
     if (empty($irHeight)) {
         $irHeight = (int) $ngg_options['irHeight'];
     }
     // init the flash output
     $swfobject = new swfobject($ngg_options['irURL'], 'sbsl' . $galleryID, $irWidth, $irHeight, '7.0.0', 'false');
     $swfobject->classname = 'ngg-widget-slideshow';
     $swfobject->message = __('<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see the slideshow.', 'nggallery');
     $swfobject->add_params('wmode', 'opaque');
     $swfobject->add_params('bgcolor', $ngg_options['irScreencolor'], 'FFFFFF', 'string', '#');
     $swfobject->add_attributes('styleclass', 'slideshow-widget');
     // adding the flash parameter
     $swfobject->add_flashvars('file', urlencode(trailingslashit(home_url()) . 'index.php?callback=imagerotator&gid=' . $galleryID));
     $swfobject->add_flashvars('shownavigation', 'false', 'true', 'bool');
     $swfobject->add_flashvars('shuffle', $ngg_options['irShuffle'], 'true', 'bool');
     $swfobject->add_flashvars('showicons', $ngg_options['irShowicons'], 'true', 'bool');
     $swfobject->add_flashvars('overstretch', $ngg_options['irOverstretch'], 'false', 'string');
     $swfobject->add_flashvars('rotatetime', $ngg_options['irRotatetime'], 5, 'int');
     $swfobject->add_flashvars('transition', $ngg_options['irTransition'], 'random', 'string');
     $swfobject->add_flashvars('backcolor', $ngg_options['irBackcolor'], 'FFFFFF', 'string', '0x');
     $swfobject->add_flashvars('frontcolor', $ngg_options['irFrontcolor'], '000000', 'string', '0x');
     $swfobject->add_flashvars('lightcolor', $ngg_options['irLightcolor'], '000000', 'string', '0x');
     $swfobject->add_flashvars('screencolor', $ngg_options['irScreencolor'], '000000', 'string', '0x');
     $swfobject->add_flashvars('width', $irWidth, '260');
     $swfobject->add_flashvars('height', $irHeight, '320');
     // create the output
     $out = $swfobject->output();
     // add now the script code
     $out .= "\n" . '<script type="text/javascript" defer="defer">';
     $out .= "\n" . '<!--';
     $out .= "\n" . '//<![CDATA[';
     $out .= $swfobject->javascript();
     $out .= "\n" . '//]]>';
     $out .= "\n" . '-->';
     $out .= "\n" . '</script>';
     $out = apply_filters('ngg_show_slideshow_widget_content', $out, $galleryID, $irWidth, $irHeight);
     return $out;
 }
Beispiel #2
0
/**
 * Return a script for the Imagerotator flash slideshow. Can be used in any template with <?php echo nggShowSlideshow($galleryID, $width, $height) ?>
 * Require the script swfobject.js in the header or footer
 * 
 * @access public 
 * @param integer $galleryID ID of the gallery
 * @param integer $irWidth Width of the flash container
 * @param integer $irHeight Height of the flash container
 * @return the content
 */
function nggShowSlideshow($galleryID, $width, $height)
{
    require_once dirname(__FILE__) . '/lib/swfobject.php';
    $ngg_options = nggGallery::get_option('ngg_options');
    // remove media file from RSS feed
    if (is_feed()) {
        $out = '[' . nggGallery::i18n($ngg_options['galTextSlide']) . ']';
        return $out;
    }
    //Redirect all calls to the JavaScript slideshow if wanted
    if ($ngg_options['enableIR'] !== '1' || nggGallery::detect_mobile_phone() === true) {
        return nggShow_JS_Slideshow($galleryID, $width, $height);
    }
    // If the Imagerotator didn't exist, skip the output
    if (NGGALLERY_IREXIST == false) {
        return;
    }
    if (empty($width)) {
        $width = (int) $ngg_options['irWidth'];
    }
    if (empty($height)) {
        $height = (int) $ngg_options['irHeight'];
    }
    // Doesn't work fine with zero
    $ngg_options['irRotatetime'] = $ngg_options['irRotatetime'] == 0 ? 5 : $ngg_options['irRotatetime'];
    // init the flash output
    $swfobject = new swfobject($ngg_options['irURL'], 'so' . $galleryID, $width, $height, '7.0.0', 'false');
    $swfobject->message = '<p>' . __('The <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> and <a href="http://www.mozilla.com/firefox/">a browser with Javascript support</a> are needed.', 'nggallery') . '</p>';
    $swfobject->add_params('wmode', 'opaque');
    $swfobject->add_params('allowfullscreen', 'true');
    $swfobject->add_params('bgcolor', $ngg_options['irScreencolor'], 'FFFFFF', 'string', '#');
    $swfobject->add_attributes('styleclass', 'slideshow');
    $swfobject->add_attributes('name', 'so' . $galleryID);
    // adding the flash parameter
    $swfobject->add_flashvars('file', urlencode(trailingslashit(home_url()) . 'index.php?callback=imagerotator&gid=' . $galleryID));
    $swfobject->add_flashvars('shuffle', $ngg_options['irShuffle'], 'true', 'bool');
    // option has oposite meaning : true should switch to next image
    $swfobject->add_flashvars('linkfromdisplay', !$ngg_options['irLinkfromdisplay'], 'false', 'bool');
    $swfobject->add_flashvars('shownavigation', $ngg_options['irShownavigation'], 'true', 'bool');
    $swfobject->add_flashvars('showicons', $ngg_options['irShowicons'], 'true', 'bool');
    $swfobject->add_flashvars('kenburns', $ngg_options['irKenburns'], 'false', 'bool');
    $swfobject->add_flashvars('overstretch', $ngg_options['irOverstretch'], 'false', 'string');
    $swfobject->add_flashvars('rotatetime', $ngg_options['irRotatetime'], 5, 'int');
    $swfobject->add_flashvars('transition', $ngg_options['irTransition'], 'random', 'string');
    $swfobject->add_flashvars('backcolor', $ngg_options['irBackcolor'], 'FFFFFF', 'string', '0x');
    $swfobject->add_flashvars('frontcolor', $ngg_options['irFrontcolor'], '000000', 'string', '0x');
    $swfobject->add_flashvars('lightcolor', $ngg_options['irLightcolor'], '000000', 'string', '0x');
    $swfobject->add_flashvars('screencolor', $ngg_options['irScreencolor'], '000000', 'string', '0x');
    if ($ngg_options['irWatermark']) {
        $swfobject->add_flashvars('logo', $ngg_options['wmPath'], '', 'string');
    }
    $swfobject->add_flashvars('audio', $ngg_options['irAudio'], '', 'string');
    $swfobject->add_flashvars('width', $width, '260');
    $swfobject->add_flashvars('height', $height, '320');
    // create the output
    $out = '<div class="slideshow">' . $swfobject->output() . '</div>';
    // add now the script code
    $out .= "\n" . '<script type="text/javascript" defer="defer">';
    // load script via jQuery afterwards
    // $out .= "\n".'jQuery.getScript( "'  . NGGALLERY_URLPATH . 'admin/js/swfobject.js' . '", function() {} );';
    if ($ngg_options['irXHTMLvalid']) {
        $out .= "\n" . '<!--';
    }
    if ($ngg_options['irXHTMLvalid']) {
        $out .= "\n" . '//<![CDATA[';
    }
    $out .= $swfobject->javascript();
    if ($ngg_options['irXHTMLvalid']) {
        $out .= "\n" . '//]]>';
    }
    if ($ngg_options['irXHTMLvalid']) {
        $out .= "\n" . '-->';
    }
    $out .= "\n" . '</script>';
    $out = apply_filters('ngg_show_slideshow_content', $out, $galleryID, $width, $height);
    return $out;
}
Beispiel #3
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
     }
 }
Beispiel #4
0
 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.0');
         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', 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.88');
         wp_enqueue_script('ngg-slideshow', NGGALLERY_URLPATH . 'js/ngg.slideshow.min.js', array('jquery-cycle'), '1.05');
     }
     // 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.0');
             wp_localize_script('ngg_script', 'ngg_ajax', array('path' => NGGALLERY_URLPATH, 'callback' => site_url() . '/' . 'index.php?callback=ngg-ajax', 'loading' => __('loading', 'nggallery')));
         }
     }
 }
Beispiel #5
0
		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 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_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();

		}