1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| public static function minialbumWidget(&$w)
{
global $core;
if ($w->homeonly && $core->url->type != 'default') {return;}
$url1 = str_replace("\r",'',$w->url1);
$url1 = explode("\n",$url1);
/* Echap les caractères Xhtml */
$titre= $w->Titre ? html::escapeHTML($w->Titre) : __('minialbum');
/* Description optionnel de l'album*/
$description= $w->description ? html::escapeHTML($w->description) : '';
$mesimg_ft = array();
$cpt_ft = 0;
# Si dossier créer
if ($handle_ft = @opendir($core->blog->public_path."/minialbum")) {
// traverser un dossier correctement
while (false !== ($file_ft = readdir($handle_ft))) {
if ($file_ft != "." && $file_ft != "..") {
if (substr($file_ft,0,1)!="."){
$verifimg.=','.$file_ft;
$mesimg_ft[$cpt_ft] = $file_ft;
//incremente
$cpt_ft++;
}
}
}
closedir($handle_ft);
}#sinon j'affiche
$chemin = http::concatURL($core->blog->url,$core->blog->settings->public_url.'/minialbum/');
$return = '<div class="aff_div" id="minialbum">';
$return .= '<h2>'.$titre.'</h2>';
$return .= '<div style="text-align: center;">'.$description.'</div><br />';
if (is_dir($core->blog->public_path."/minialbum")){
foreach ($mesimg_ft as &$value) {
$value ='<a href="'.$chemin.''.$value.'" rel="lightbox[groupe]">
<img src="'.$chemin.''.$value.'" width="47" height="45" alt="'.$description.'"/></a>';
$return .= $value;
}
}else {
$return .= '<div style="color:red;">'. __('The administrator do not have to create yet the repertory minialbum with the root of the manager of media').'</div><br />';
}
/*foreach ($url1 as &$value2) {
$value2 ='<a href="'.$value2.'" rel="lightbox[groupe]">
<img src="'.$value2.'" width="47" height="45" alt="'.$description.'"/></a>';
$return .= $value2;
}*/
$return .='</div>';
return $return;
} |
Partager