'; $headContent .= ''; $headContent .= ''; $template->append($tpl_var, $headContent); } public function getCloseThumbnailJavaScript() { return 'parent.window.Shadowbox.close(); return false;'; } static public function getThemes() { return array(); } } class MediaboxAdvancedWrapper implements iModalOverlayLib { public static $LIB_NAME = 'mediaboxAdvanced'; static function getName() { return self::$LIB_NAME; } static public function isInstalled() { $filename = ModalOverlayLibFactory::getFactoryPath() .DS. self::getName() .DS. 'mediaboxAdv-1.3.4b.js'; return file_exists($filename); } public function getFlashVarsTemplate() { return 'mediaURL={$VIDEO_URL}&teaserURL={$SRC_IMG}&allowSmoothing=true&autoPlay=false&buffer=6&showTimecode=true&loop=false&controlColor=0xFFFFFF&controlBackColor=0x000000&scaleIfFullScreen=true&showScalingButton=true&defaultVolume=100&crop=false'; } public function getPlayerUrl() { $path = ModalOverlayLibFactory::getFactoryUrl() .'/'. self::getName() .'/NonverBlaster.swf'; return $path; } public function getDefaultLinkRelationship() { return 'lightbox'; } public function appendHeaderContent($template, $tpl_var, $config) { global $page; $libPath = ModalOverlayLibFactory::getFactoryUrl() .'/'. self::getName(); $content = ''; // add script for services (used for "add to caddie") //{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} /* Not available for Piwigo 2.1.6 $template->func_combine_script( array( 'id' => 'core.scripts', 'load' => 'async', 'path' => 'themes/default/js/scripts.js' ), $template->smarty ); */ $content .= ''; $theme = $config->modalOverlayTheme; if ( !empty( $theme )) { $content .= ''; $content .= ''; } $content .= ''; $content .= ''; $content .= ''; $content .= ''; $template->append($tpl_var, $content); } public function getCloseThumbnailJavaScript() { return 'parent.window.Shadowbox.close(); return false;'; } static public function getThemes() { return ModalOverlayLibFactory::getDirectoriesFromPath(ModalOverlayLibFactory::getFactoryPath() .DS. self::getName() .DS. 'themes'); } } class ModalOverlayLibFactory { public static function getFactoryPath() { return dirname(__FILE__) .DS. 'libs'; } public static function getOverlayLibPath($libName) { return self::getFactoryPath() .DS. $libName; } public static function getFactoryUrl() { return get_root_url() .'plugins/'. basename(dirname(__FILE__)) .'/libs'; } public static function getInstalledOverlayLibs() { $libs = array(); if (MediaboxAdvancedWrapper::isInstalled() === true) $libs[] = MediaboxAdvancedWrapper::getName(); if (ShadowboxWrapper::isInstalled() === true) $libs[] = ShadowboxWrapper::getName(); return $libs; } public static function getDefaultOverlayLib() { return MediaboxAdvancedWrapper::getName(); } public static function getDefaultOverlayTheme() { $themes = MediaboxAdvancedWrapper::getThemes(); return (empty($themes)) ? null : $themes[0]; } public static function createModalOverlayLib($libName) { if (0 === strcmp($libName, MediaboxAdvancedWrapper::getName())) { return new MediaboxAdvancedWrapper(); } else if (0 === strcmp($libName, ShadowboxWrapper::getName())) { return new ShadowboxWrapper(); } return null; } public static function getDirectoriesFromPath($path) { static $weeds = array('.', '..'); $directories = array_diff(scandir($path), $weeds); $dirs = array(); foreach($directories as $value) { if(is_dir($path .DS. $value)) { $dirs[] = $value; } } return $dirs; } } ?>