Differences From Artifact [42831a0855]:

To Artifact [180cd8e498]:


     4      4   
     5      5   class utils
     6      6   {
     7      7       static protected $country_list = null;
     8      8   
     9      9       static protected $g2x = null;
    10     10   
    11         -    static private $french_date_names = array(
           11  +    static private $french_date_names = [
    12     12           'January'=>'Janvier', 'February'=>'Février', 'March'=>'Mars', 'April'=>'Avril', 'May'=>'Mai',
    13     13           'June'=>'Juin', 'July'=>'Juillet', 'August'=>'Août', 'September'=>'Septembre', 'October'=>'Octobre',
    14     14           'November'=>'Novembre', 'December'=>'Décembre', 'Monday'=>'Lundi', 'Tuesday'=>'Mardi', 'Wednesday'=>'Mercredi',
    15     15           'Thursday'=>'Jeudi','Friday'=>'Vendredi','Saturday'=>'Samedi','Sunday'=>'Dimanche',
    16     16           'Feb'=>'Fév','Apr'=>'Avr','May'=>'Mai','Jun'=>'Juin', 'Jul'=>'Juil','Aug'=>'Aout','Dec'=>'Déc',
    17         -        'Mon'=>'Lun','Tue'=>'Mar','Wed'=>'Mer','Thu'=>'Jeu','Fri'=>'Ven','Sat'=>'Sam','Sun'=>'Dim');
           17  +        'Mon'=>'Lun','Tue'=>'Mar','Wed'=>'Mer','Thu'=>'Jeu','Fri'=>'Ven','Sat'=>'Sam','Sun'=>'Dim'];
    18     18   
    19     19       static public function strftime_fr($format=null, $ts=null)
    20     20       {
    21     21           if (is_null($format))
    22     22           {
    23     23               $format = '%d/%m/%Y à %H:%M';
    24     24           }
................................................................................
   168    168   
   169    169       static public function CSRF_create($key)
   170    170       {
   171    171           self::_sessionStart(true);
   172    172   
   173    173           if (!isset($_SESSION['csrf']))
   174    174           {
   175         -            $_SESSION['csrf'] = array();
          175  +            $_SESSION['csrf'] = [];
   176    176           }
   177    177   
   178    178           $_SESSION['csrf'][$key] = sha1($key . uniqid($key, true) . time());
   179    179           return $_SESSION['csrf'][$key];
   180    180       }
   181    181   
   182    182       static public function CSRF_check($key, $hash=null)
................................................................................
   300    300           }
   301    301           if($end==($total-1)) {
   302    302               $end = $total;
   303    303           }
   304    304           if($begin == 2) {
   305    305               $begin = 1;
   306    306           }
   307         -        $out = array();
          307  +        $out = [];
   308    308   
   309    309           if ($current > 1) {
   310         -            $out[] = array('id' => $current - 1, 'label' =>  '« ' . 'Page précédente', 'class' => 'prev', 'accesskey' => 'a');
          310  +            $out[] = ['id' => $current - 1, 'label' =>  '« ' . 'Page précédente', 'class' => 'prev', 'accesskey' => 'a'];
   311    311           }
   312    312   
   313    313           if ($begin > 1) {
   314         -            $out[] = array('id' => 1, 'label' => '1 ...', 'class' => 'first');
          314  +            $out[] = ['id' => 1, 'label' => '1 ...', 'class' => 'first'];
   315    315           }
   316    316   
   317    317           for ($i = $begin; $i <= $end; $i++)
   318    318           {
   319         -            $out[] = array('id' => $i, 'label' => $i, 'class' => ($i == $current) ? 'current' : '');
          319  +            $out[] = ['id' => $i, 'label' => $i, 'class' => ($i == $current) ? 'current' : ''];
   320    320           }
   321    321   
   322    322           if ($showLast && $end < $total) {
   323         -            $out[] = array('id' => $total, 'label' => '... ' . $total, 'class' => 'last');
          323  +            $out[] = ['id' => $total, 'label' => '... ' . $total, 'class' => 'last'];
   324    324           }
   325    325   
   326    326           if ($current < $total) {
   327         -            $out[] = array('id' => $current + 1, 'label' => 'Page suivante' . ' »', 'class' => 'next', 'accesskey' => 'z');
          327  +            $out[] = ['id' => $current + 1, 'label' => 'Page suivante' . ' »', 'class' => 'next', 'accesskey' => 'z'];
   328    328           }
   329    329   
   330    330           return $out;
   331    331       }
   332    332   
   333    333       static public function transliterateToAscii($str, $charset='UTF-8')
   334    334       {
................................................................................
   363    363   
   364    364       static public function htmlGarbage2xhtml($str)
   365    365       {
   366    366           if (!self::$g2x)
   367    367           {
   368    368               require_once ROOT . '/include/libs/garbage2xhtml/lib.garbage2xhtml.php';
   369    369               self::$g2x = new \garbage2xhtml;
   370         -            self::$g2x->core_attributes = array('class', 'id', 'title');
          370  +            self::$g2x->core_attributes = ['class', 'id', 'title'];
   371    371           }
   372    372   
   373    373           return self::$g2x->process($str);
   374    374       }
   375    375   
   376    376       static public function htmlSpip($str, $prefix = '')
   377    377       {
................................................................................
   394    394   
   395    395           // Adresses email
   396    396           $str = preg_replace('/<a href="((?!http).*@.*)">/iU', '<a href="mailto:$1">', $str);
   397    397   
   398    398           return $str;
   399    399       }
   400    400   
   401         -    static public function mail($to, $subject, $content, $additional_headers = array())
          401  +    static public function mail($to, $subject, $content, $additional_headers = [])
   402    402       {
   403    403           // Création du contenu du message
   404    404           $content = wordwrap($content);
   405    405           $content = trim($content);
   406    406   
   407    407           $content = preg_replace("#(?<!\r)\n#si", "\r\n", $content);
   408    408   
................................................................................
   545    545           }
   546    546   
   547    547           return $out;
   548    548       }
   549    549   
   550    550       static public function getMaxUploadSize()
   551    551       {
   552         -        return min(array(
          552  +        return min([
   553    553               self::return_bytes(ini_get('upload_max_filesize')),
   554    554               self::return_bytes(ini_get('post_max_size')),
   555    555               self::return_bytes(ini_get('memory_limit'))
   556         -        ));
          556  +        ]);
   557    557       }
   558    558   
   559    559   
   560    560       static public function return_bytes ($size_str)
   561    561       {
   562    562           switch (substr($size_str, -1))
   563    563           {