Your IP : 216.73.216.240
<?php
/*
* Module GalleryFP pour Joomla! 3.x
* Version J3.4F
* Creation date: Octobre 2015
* Author: Fabrice4821 - www.gmapfp.org
* Author email: webmaster@gmapfp.org
* License GNU/GPL
*/
defined('_JEXEC') or die;
$id = $module->id;
$path = 'modules/mod_galleryfp/';
$compurl = JURI::base(). $path; $cn = 0;
$pic = 'modules/mod_galleryfp/galleries/'.$id.'/';
$lang = JFactory::getLanguage();
$doc = JFactory::getDocument();
//Ajout JQuery si non exist
$jVersion=new JVersion();
$jVer=$jVersion->RELEASE;
// $jVerShort=$jVersion->getShortVersion();
unset($jVersion);
if ($jVer[0] >= 3) {
JHtml::_('jquery.framework');
} else {
$head_data = $doc->getHeadData();
$jquery = false;
$noconflict = false;
foreach (array_keys($head_data['scripts']) as $script) {
if (stristr($script, 'jquery')) {
$jquery = true;
}
if (stristr($script, 'jquery-noconflict.js')) {
$noconflict = true;
}
}
if (!$jquery) {
$doc->addScript($compurl.'js/jquery.min.js');
}
if (!$noconflict) {
$doc->addScript($compurl.'js/jquery-noconflict.js');
}
}
//pour être sur que jQuery soit lancé avant
if (!defined('PLUG_GALLERIA')) {
$doc->addCustomTag( '<script type="text/javascript" src="'.$compurl.'js/galleria-1.4.2.min.js"></script>');
define('PLUG_GALLERIA', true);
}
if ($params->get('Background', ''))
echo '<style>.galleria-container, .galleria-thumbnails-container, .galleria-info-text{background-color: '.$params->get('Background', '#b0b0b0').' !important;}</style>';
$param_json = json_decode($params->get('commentaires_photos'));
?>
<div class="galleria" style="min-width: 200px; min-height: 40px;">
<?php
$dirFiles = array();
// opens images folder
if ($handle = opendir($pic)) {
while (false !== ($file = readdir($handle))) {
// strips files extensions
$crap = array("jpg", "jpeg", "png", "gif", "bmp");
$newstring = JText::sprintf('MOD_GALERIE_FP_FREE', $compurl);
// hides folders, writes out ul of images and thumbnails from two folders
$extension = strtolower(substr(strrchr($file,'.'),1));
if (in_array($extension, $crap) && $file != "." && $file != ".." && $file != "index.php" && $file != "index.html" && $file != "thumbs" && $file != "Thumbnails" && count($dirFiles)<6) {
$dirFiles[] = $file;
}
}
closedir($handle);
}
sort($dirFiles);
foreach($dirFiles as $file)
{ if ($cn >= 6) break;
$json_name = 'json'.str_replace(array('.', '-', ' '), array('ùùù', 'ààà', 'ééé'), $file);
$json_tag_lang = str_replace('-', '_', $lang->getTag());
eval('$json_value = @$param_json->'.$json_name.'->'.$json_tag_lang.';');
$filename = $json_value.'<br/>';
$commentaires = '';
if ($params->get('commentaire', '')) $commentaires = $params->get('commentaire', '').'<br/>';
echo '<a href="'.JURI::base().$pic.$file.'" title="'.$newstring.'"><img src="'.JURI::base().$pic.$file.'" title="'.$commentaires.$filename.$newstring.'" /></a>'."\n";$cn++;
}
?>
</div>
<?php
$html = '<div class="galleryfp_copyright">';
$link = @file_get_contents('http://www.gmapfp.org/link.txt');
if ($link) {
$link = explode("\n", $link);
$html .= '<div style="text-align:center;">';
$html .= JText::_('MOD_GALERIE_FP_SPONSOR_LINK').'<a href="'.$link[1].'" target="_blank">'.$link[0].'</a>';
$html .= '</div>';
}
$html .= '<div style="text-align:center;">';
$html .= '<a href="http://gmapfp.org" target="_blank">GMapFP</a> : '.JText::_('MOD_GALERIE_FP_COPYRIGHT');
$html .= '</div></div>';
echo $html;
//option
switch ($params->get('thumbcrop', 'true')) {
case 'true':
$thumbCrop = 'true';
break;
case 'false':
$thumbCrop = 'false';
break;
case 'height':
$thumbCrop = '"height"';
break;
case 'width':
$thumbCrop = '"width"';
break;
};
switch ($params->get('imageCrop', 'true')) {
case 'true':
$imageCrop = 'true';
break;
case 'false':
$imageCrop = 'false';
break;
case 'height':
$imageCrop = '"height"';
break;
case 'width':
$imageCrop = '"width"';
break;
};
if ($params->get('theme', 'classic')=='twelve')
$_showTooltip = $params->get('twelve_showTooltip', 'true');
else
$_showTooltip = $params->get('azur_showCaption', 'true');
$option = '
lightbox: '.$params->get('lightbox', 'false').',
overlayBackground: "'.$params->get('overlayBackground', '#b0b0b0').'",
responsive: '.$params->get('responive', 'true').',
trueFullscreen: '.$params->get('trueFullscreen', 'true').',
transition: "'.$params->get('transition', 'pulse').'",
transitionSpeed: "'.$params->get('transitionSpeed', '1000').'",
thumbCrop: '.$thumbCrop.',
imageCrop: '.$imageCrop.',
carousel: '.$params->get('carousel', 'true').',
imagePan: '.$params->get('imagePan', 'true').',
clicknext: '.$params->get('clicknext', 'true').',
autoplay: '.$params->get('autoplay', 'false').',
showImagenav: '.$params->get('showImagenav', 'false').',
showInfo: '.$params->get('showInfo', 'true').',
showCounter: '.$params->get('showCounter', 'true').',
thumbnails: '.$params->get('thumbnails', 'true').',
_showFullscreen: '.$params->get('twelve_showFullscreen', 'true').',
_showPopout: '.$params->get('twelve_showPopout', 'true').',
_showProgress: '.$params->get('twelve_showProgress', 'true').',
_showTooltip: '.$_showTooltip.',
_webkitCursor: '.$params->get('folio_webkitCursor', 'true').',
_animate: '.$params->get('folio_animate', 'true').',
_center: '.$params->get('folio_center', 'true').',
_hideDock: '.$params->get('fullscreen_hideDock', 'true').',
_toggleCaption: '.$params->get('azur_toggleCaption', 'true').',
_showCaption: '.$params->get('azur_showCaption', 'true').',
_locale: {
show_captions: "'.JText::_('MOD_GALERIE_FP_SHOW_CAPTION').'",
hide_captions: "'.JText::_('MOD_GALERIE_FP_HIDE_CAPTION').'",
next: "'.JText::_('MOD_GALERIE_FP_NEXT').'",
prev: "'.JText::_('MOD_GALERIE_FP_PREVIEW').'",
show_thumbnails: "'.JText::_('MOD_GALERIE_FP_SHOW_THUMBNAILS').'",
hide_thumbnails: "'.JText::_('MOD_GALERIE_FP_HIDE_THUMBNAILS').'",
play: "'.JText::_('MOD_GALERIE_FP_PLAY').'",
pause: "'.JText::_('MOD_GALERIE_FP_PAUSE').'",
enter_fullscreen: "'.JText::_('MOD_GALERIE_FP_ENTER_FULLSCREEN').'",
exit_fullscreen: "'.JText::_('MOD_GALERIE_FP_EXIT_FULLSCREEN').'",
popout_image: "'.JText::_('MOD_GALERIE_FP_POPOUT_IMAGE').'",
showing_image: "'.JText::_('MOD_GALERIE_FP_SHOWING_IMAGE').'"
}
';
?>
<script type="text/javascript">
Galleria.configure({
<?php echo $option;?>
});
</script>
<script type="text/javascript">
// Initialize Gallerie
Galleria.loadTheme('<?php echo $compurl; ?>themes/<?php echo $params->get('theme', 'classic'); ?>/galleria.<?php echo $params->get('theme', 'classic'); ?>.min.js');
Galleria.run('.galleria', {
height: <?php echo $params->get('proportion', '0.5625'); ?>
});
</script>