$nbpage)$page=$nbpage;
$pluriel='';if($nbitems>1)$pluriel='s';
$pluriel1='';if($nbpage>1)$pluriel1='s';
$pagination='
';
if($option==0)$pagination.=''.number_format($nbitems,0,'',' ').' ';
if($option!=-1)$pagination.=__('résultat','annonces').$pluriel.' /';
$pagination.=' '.$nbpage.' '.__('page','annonces').$pluriel1.'
: ';
$min=$page-$offset;
if($min<1)$min=1;
$max=$min+(2*$offset);
if($max>=$nbpage){$max=$nbpage;$min=$max-(2*$offset)-1;}
if($min<1)$min=1;
$minto=$min - ($offset)-1;
if($minto<1){$minto=1;}
$maxto=$min + (3*$offset)+1;
if($maxto>$nbpage){$max=$nbpage;}
if($option<2){ // sens croissant
if($min>1)$pagination.='<<';
else $pagination.=' ';
for($i=$min;$i<=$max;$i++){
$selected='';if($i==$page)$selected='color:'.$slctdcolor.';background:'.$slctdbackground.';font-weight:bold;';
$pagination.=''.$i.'';
}
if($max<$nbpage)$pagination.='>>';
}
else{ // sens decroissant
if($max<$nbpage)$pagination.='<<';
for($i=$max;$i>=$min;$i--){
$selected='';if($i==$page)$selected='color:'.$slctdcolor.';background:'.$slctdbackground.';font-weight:bold;';
$pagination.=''.$i.'';
}
if($min>1)$pagination.='>>';
else $pagination.=' ';
}
$pagination.='
';
return $pagination;
}
function slugify_nospace($text)
{
if (empty($text))
{
return '';
}else{
$text = preg_replace('/\s/', '+', $text);
$text = trim($text);
}
return $text;
}
function slugify($text)
{
$pattern = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü");
$rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U");
if (empty($text))
{
return '';
}
else
{
$text = str_replace($pattern, $rep_pat, utf8_decode($text));
$text = preg_replace('/\s/', '', $text);
$text = trim($text);
}
return $text;
}
function slugify_accent($text){
$pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/", "//","/"/");
$rep_pat = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü", "'",'"');
if ($text == '')
{
return '';
}
else
{
$text = preg_replace($pattern, $rep_pat, utf8_decode($text));
}
return $text;
}
public function slugify_noaccent($text){
$pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/ù/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/'/");
$rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U","e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U", "");
if ($text == '')
{
return '';
}
else
{
$text = preg_replace($pattern, $rep_pat, utf8_decode($text));
}
return $text;
}
public function slugify_noaccent_no_utf8decode($text){
$pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/ù/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/","/'/",'/"/');
$rep_pat = Array("e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U","e", "e", "e", "c", "a", "a", "i", "i", "u", "o", "E", "E", "E", "E", "I", "I", "I", "I", "O", "U", "U", "U", "",""");
if ($text == '')
{
return '';
}
else
{
$text = preg_replace($pattern, $rep_pat, $text);
}
return $text;
}
function make_recursiv_dir($dir){
$tab=explode('/',$dir);
$str='';
foreach($tab as $k => $v ){
if((trim($v)!='')){
$str.='/'.trim($v);
if( (trim($v)!='..') &&(trim($v)!='.') ){
if(!is_dir(substr($str,1)) && (!is_file(substr($str,1)) ) ){
if(!mkdir(substr($str,1), 0755))echo '
erreur mkdir ! '.$str;
if(!chmod(substr($str,1), 0755))echo '
erreur chmod ! '.$str;
}
}
}
}
}
}