Dotclear


Ignore:
Timestamp:
09/14/18 12:16:17 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

short notation for array (array() → [])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/public/lib.tpl.context.php

    r3832 r3874  
    1212class context 
    1313{ 
    14     public $stack = array(); 
     14    public $stack = []; 
    1515 
    1616    public function __set($name, $var) 
     
    105105        return self::global_filters( 
    106106            $str, 
    107             array(0       => null, 
     107            [0       => null, 
    108108                'encode_xml'  => $encode_xml, 
    109109                'remove_html' => $remove_html, 
     
    112112                'upper_case'  => ($upper_case == 1 ? 1 : 0), 
    113113                'capitalize'  => ($upper_case == 2 ? 1 : 0), 
    114                 'encode_url'  => $encode_url), 
     114                'encode_url'  => $encode_url], 
    115115            $tag); 
    116116    } 
     
    149149    public static function global_filters($str, $args, $tag = '') 
    150150    { 
    151         $filters = array( 
     151        $filters = [ 
    152152            'strip_tags',                             // Removes HTML tags (mono line) 
    153153            'remove_html',                            // Removes HTML tags 
     
    156156            'lower_case', 'capitalize', 'upper_case', // Case transformations 
    157157            'encode_url'                             // URL encode (as for insert in query string) 
    158         ); 
     158        ]; 
    159159 
    160160        $args[0] = &$str; 
     
    209209    public static function strip_tags($str) 
    210210    { 
    211         return trim(preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t"), ' ', html::clean($str)))); 
     211        return trim(preg_replace('/ {2,}/', ' ', str_replace(["\r", "\n", "\t"], ' ', html::clean($str)))); 
    212212    } 
    213213 
     
    336336    public static function robotsPolicy($base, $over) 
    337337    { 
    338         $pol  = array('INDEX' => 'INDEX', 'FOLLOW' => 'FOLLOW', 'ARCHIVE' => 'ARCHIVE'); 
     338        $pol  = ['INDEX' => 'INDEX', 'FOLLOW' => 'FOLLOW', 'ARCHIVE' => 'ARCHIVE']; 
    339339        $base = array_flip(preg_split('/\s*,\s*/', $base)); 
    340340        $over = array_flip(preg_split('/\s*,\s*/', $over)); 
     
    359359    public static function getSmilies($blog) 
    360360    { 
    361         $path = array(); 
     361        $path = []; 
    362362        if (isset($GLOBALS['__theme'])) { 
    363363            $path[] = $GLOBALS['__theme']; 
     
    370370        $base_url   = $blog->settings->system->themes_url . '/%s/smilies/'; 
    371371 
    372         $res = array(); 
     372        $res = []; 
    373373 
    374374        foreach ($path as $t) { 
     
    385385        $def = file($f); 
    386386 
    387         $res = array(); 
     387        $res = []; 
    388388        foreach ($def as $v) { 
    389389            $v = trim($v); 
     
    448448        # 
    449449        $index  = 0; 
    450         $tokens = array(); 
     450        $tokens = []; 
    451451 
    452452        $match = '(?s:<!(?:--.*?--\s*)+>)|' . # comment 
     
    459459        foreach ($parts as $part) { 
    460460            if (++$index % 2 && $part != '') { 
    461                 $tokens[] = array('text', $part); 
     461                $tokens[] = ['text', $part]; 
    462462            } else { 
    463                 $tokens[] = array('tag', $part); 
     463                $tokens[] = ['tag', $part]; 
    464464            } 
    465465 
Note: See TracChangeset for help on using the changeset viewer.

Sites map