/** * Get single instance of ModuleHandler */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
/** * 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; }
function render_slideshow($galleryID, $irWidth = '', $irHeight = '') { require_once dirname(__FILE__) . '/../lib/swfobject.php'; global $wpdb; $ngg_options = get_option('ngg_options'); // remove media file from RSS feed if (is_feed()) { $out = '[' . $ngg_options['galTextSlide'] . ']'; return $out; } if (empty($irWidth)) { $irWidth = (int) $ngg_options['irWidth']; } if (empty($irHeight)) { $irHeight = (int) $ngg_options['irHeight']; } // init the flash output $swfobject = new swfobject(NGGALLERY_URLPATH . 'imagerotator.swf', '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'], '000000', 'string', '#'); $swfobject->add_attributes('styleclass', 'slideshow-widget'); // adding the flash parameter $swfobject->add_flashvars('file', NGGALLERY_URLPATH . 'xml/imagerotator.php?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>'; echo $out; }
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; }
/** * Return a script for the Imagerotator flash slideshow. Can be used in any tmeplate 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; } // 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']; } // 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'], '000000', 'string', '#'); $swfobject->add_attributes('styleclass', 'slideshow'); $swfobject->add_attributes('name', 'so' . $galleryID); // adding the flash parameter $swfobject->add_flashvars('file', urlencode(get_option('siteurl') . '/' . 'index.php?slideshow=true&gid=' . $galleryID)); $swfobject->add_flashvars('shuffle', $ngg_options['irShuffle'], 'true', 'bool'); $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">'; 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); return $out; }
$cycle_interval = 1; } if ($flash_background_color && $flash_background_color[0] == '#') { $flash_background_color = substr($flash_background_color, 1); } if ($flash_text_color && $flash_text_color[0] == '#') { $flash_text_color = substr($flash_text_color, 1); } if ($flash_rollover_color && $flash_rollover_color[0] == '#') { $flash_rollover_color = substr($flash_rollover_color, 1); } if ($flash_screen_color && $flash_screen_color[0] == '#') { $flash_screen_color = substr($flash_screen_color, 1); } // init the flash output $swfobject = new swfobject($flash_path, 'so' . $displayed_gallery_id, $width, $height, '7.0.0', 'false'); $swfobject->message = '<p>' . __('Slideshows require the <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> and a <a href="http://www.mozilla.com/firefox/">browser with Javascript support</a>.', 'nggallery') . '</p>'; $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('allowfullscreen', 'true'); $swfobject->add_params('bgcolor', $flash_screen_color, 'FFFFFF', 'string', '#'); $swfobject->add_attributes('styleclass', 'slideshow'); $swfobject->add_attributes('name', 'so' . $displayed_gallery_id); // adding the flash parameter $swfobject->add_flashvars('file', urlencode($mediarss_link)); $swfobject->add_flashvars('shuffle', !empty($flash_shuffle) ? TRUE : FALSE, '', 'bool'); // option has oposite meaning : true should switch to next image $swfobject->add_flashvars('linkfromdisplay', !$flash_next_on_click, 'false', 'bool'); $swfobject->add_flashvars('shownavigation', $flash_navigation_bar, 'true', 'bool'); $swfobject->add_flashvars('showicons', $flash_loading_icon, 'true', 'bool'); $swfobject->add_flashvars('kenburns', $flash_slow_zoom, 'false', 'bool'); $swfobject->add_flashvars('overstretch', $flash_stretch_image, 'false', 'string');
/** * Handler for _video tag which embeds player in page. * * @param array $tag_params * @param array $children */ public function tag_Video($tag_params, $children) { $video = null; $manager = YouTube_VideoManager::getInstance(); if (isset($tag_params['id'])) { // video is was specified $video = $manager->getSingleItem($manager->getFieldNames(), array('id' => $tag_params['id'])); } else { if (isset($tag_params['text_id'])) { // text id was specified $video = $manager->getSingleItem($manager->getFieldNames(), array('text_id' => $tag_params['text_id'])); } else { if (isset($tag_params['random'])) { // get random video $video = $manager->getSingleItem($manager->getFieldNames(), array(), array('RAND()')); } } } // no id was specified if (is_object($video)) { if (isset($tag_params['embed']) && $tag_params['embed'] == '1' && class_exists('swfobject')) { // query parameters $query_params = array('rel' => isset($tag_params['show_related']) ? fix_id($tag_params['show_related']) : 0, 'showinfo' => isset($tag_params['show_info']) ? fix_id($tag_params['show_info']) : 0); // embed video player $module = swfobject::getInstance(); $module->embedSWF($this->getEmbedURL($video->video_id, $query_params), $tag_params['target'], isset($tag_params['width']) ? $tag_params['width'] : 320, isset($tag_params['height']) ? $tag_params['height'] : 240, array('autoplay' => isset($tag_params['autoplay']) ? fix_chars($tag_params['autoplay']) : 0, 'autohide' => isset($tag_params['autohide']) ? fix_chars($tag_params['autohide']) : 2, 'color' => isset($tag_params['color']) ? fix_chars($tag_params['color']) : 'default', 'origin' => isset($tag_params['origin']) ? fix_chars($tag_params['origin']) : 'website', 'theme' => isset($tag_params['theme']) ? fix_chars($tag_params['theme']) : 'dark', 'start' => isset($tag_params['start_time']) ? fix_id($tag_params['start_time']) : 0, 'loop' => isset($tag_params['loop']) ? fix_id($tag_params['loop']) : 0), array('wmode' => 'opaque')); } else { // parse specified template $template = $this->loadTemplate($tag_params, 'video.xml'); $params = array('id' => $video->id, 'video_id' => $video->video_id, 'title' => $video->title, 'thumbnail' => $this->getThumbnailURL($video->video_id)); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } } }