$nbpage)$page=$nbpage;
$pluriel='';if($nbitems>1)$pluriel='s';
$pluriel1='';if($nbpage>1)$pluriel1='s';
$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_ut8($text){
$pattern = Array("/é/", "/è/", "/ê/", "/ç/", "/à/", "/â/", "/î/", "/ï/", "/û/", "/ô/", "/È/", "/É/", "/Ê/", "/Ë/", "/Ì/", "/Í/", "/Î/", "/Ï/", "/Ö/", "/Ù/", "/Û/", "/Ü/", "//","/"/");
$rep_pat = Array("é", "è", "ê", "ç", "à", "â", "î", "ï", "ù", "ô", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ö", "Ù", "Û", "Ü", "'",'"');
if ($text == '')
{
return '';
}
else
{
$text = preg_replace($pattern, $rep_pat, ($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($directory)
{
$directoryComponent = explode('/',$directory);
$str = '';
foreach($directoryComponent as $k => $component)
{
if((trim($component) != '') && (trim($component) != '..') && (trim($component) != '.'))
{
$str .= '/' . trim($component);
if(long2ip(ip2long($_SERVER["REMOTE_ADDR"])) == '127.0.0.1')
{
if(!is_dir(substr($str,1)) && (!is_file(substr($str,1)) ) )
{
mkdir( substr($str,1) );
}
}
else
{
if(!is_dir($str) && (!is_file($str) ) )
{
mkdir( $str );
}
}
}
}
tools::changeAccesAuthorisation($directory);
}
function changeAccesAuthorisation($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)) ) )
{
chmod(str_replace('//','/',$str), 0755);
}
}
}
}
}
function copyEntireDirectory($sourceDirectory, $destinationDirectory)
{
if(is_dir($sourceDirectory))
{
if(!is_dir($destinationDirectory))
{
mkdir($destinationDirectory, 0755, true);
}
$hdir = opendir($sourceDirectory);
while($item = readdir($hdir))
{
if(is_dir($sourceDirectory . '/' . $item) && ($item != '.') && ($item != '..') && ($item != '.svn') )
{
tools::copyEntireDirectory($sourceDirectory . '/' . $item, $destinationDirectory . '/' . $item);
}
elseif(is_file($sourceDirectory . '/' . $item))
{
copy($sourceDirectory . '/' . $item, $destinationDirectory . '/' . $item);
}
}
closedir( $hdir );
}
}
}