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/admin/lib.dc.page.php

    r3872 r3874  
    1414class dcPage 
    1515{ 
    16     private static $loaded_js     = array(); 
    17     private static $loaded_css    = array(); 
     16    private static $loaded_js     = []; 
     17    private static $loaded_css    = []; 
    1818    private static $xframe_loaded = false; 
    19     private static $N_TYPES       = array( 
     19    private static $N_TYPES       = [ 
    2020        "success" => "success", 
    2121        "warning" => "warning-msg", 
    2222        "error"   => "error", 
    2323        "message" => "message", 
    24         "static"  => "static-msg"); 
     24        "static"  => "static-msg"]; 
    2525 
    2626    # Auth check 
     
    5353 
    5454    # Top of admin page 
    55     public static function open($title = '', $head = '', $breadcrumb = '', $options = array()) 
     55    public static function open($title = '', $head = '', $breadcrumb = '', $options = []) 
    5656    { 
    5757        global $core; 
     
    6868            $blog_box .= '</p>'; 
    6969        } else { 
    70             $rs_blogs = $core->getBlogs(array('order' => 'LOWER(blog_name)', 'limit' => 20)); 
    71             $blogs    = array(); 
     70            $rs_blogs = $core->getBlogs(['order' => 'LOWER(blog_name)', 'limit' => 20]); 
     71            $blogs    = []; 
    7272            while ($rs_blogs->fetch()) { 
    7373                $blogs[html::escapeHTML($rs_blogs->blog_name . ' - ' . $rs_blogs->blog_url)] = $rs_blogs->blog_id; 
     
    8484 
    8585        # Display 
    86         $headers = new ArrayObject(array()); 
     86        $headers = new ArrayObject([]); 
    8787 
    8888        # Content-Type 
     
    102102        if (!$safe_mode && $core->blog->settings->system->csp_admin_on) { 
    103103            // Get directives from settings if exist, else set defaults 
    104             $csp = new ArrayObject(array()); 
     104            $csp = new ArrayObject([]); 
    105105 
    106106                                                                                // SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value 
     
    135135 
    136136            // Construct CSP header 
    137             $directives = array(); 
     137            $directives = []; 
    138138            foreach ($csp as $key => $value) { 
    139139                if ($value) { 
     
    168168 
    169169        if ($core->auth->user_prefs->interface->darkmode) { 
    170             echo self::jsVars(array('dotclear_darkMode' => 1)); 
     170            echo self::jsVars(['dotclear_darkMode' => 1]); 
    171171            echo self::cssLoad('style/default-dark.css'); 
    172172        } else { 
    173             echo self::jsVars(array('dotclear_darkMode' => 0)); 
     173            echo self::jsVars(['dotclear_darkMode' => 0]); 
    174174            echo self::cssLoad('style/default.css'); 
    175175        } 
     
    237237        '<li><a class="smallscreen' . (preg_match('/' . preg_quote($core->adminurl->get('admin.user.preferences')) . '(\?.*)?$/', $_SERVER['REQUEST_URI']) ? ' active' : '') . 
    238238        '" href="' . $core->adminurl->get("admin.user.preferences") . '">' . __('My preferences') . '</a></li>' . 
    239         '<li><a href="' . $core->adminurl->get("admin.home", array('logout' => 1)) . '" class="logout"><span class="nomobile">' . sprintf(__('Logout %s'), $core->auth->userID()) . 
     239        '<li><a href="' . $core->adminurl->get("admin.home", ['logout' => 1]) . '" class="logout"><span class="nomobile">' . sprintf(__('Logout %s'), $core->auth->userID()) . 
    240240            '</span><img src="images/logout.png" alt="" /></a></li>' . 
    241241            '</ul>' . 
     
    303303    } 
    304304 
    305     public static function addNotice($type, $message, $options = array()) 
     305    public static function addNotice($type, $message, $options = []) 
    306306    { 
    307307        if (isset(self::$N_TYPES[$type])) { 
     
    313313            $notifications = $_SESSION['notifications']; 
    314314        } else { 
    315             $notifications = array(); 
    316         } 
    317  
    318         $n = array_merge($options, array('class' => $class, 'ts' => time(), 'text' => $message)); 
     315            $notifications = []; 
     316        } 
     317 
     318        $n = array_merge($options, ['class' => $class, 'ts' => time(), 'text' => $message]); 
    319319        if ($type != "static") { 
    320320            $notifications[] = $n; 
     
    325325    } 
    326326 
    327     public static function addSuccessNotice($message, $options = array()) 
     327    public static function addSuccessNotice($message, $options = []) 
    328328    { 
    329329        self::addNotice("success", $message, $options); 
    330330    } 
    331331 
    332     public static function addWarningNotice($message, $options = array()) 
     332    public static function addWarningNotice($message, $options = []) 
    333333    { 
    334334        self::addNotice("warning", $message, $options); 
    335335    } 
    336336 
    337     public static function addErrorNotice($message, $options = array()) 
     337    public static function addErrorNotice($message, $options = []) 
    338338    { 
    339339        self::addNotice("error", $message, $options); 
     
    449449 
    450450        if ($core->auth->user_prefs->interface->darkmode) { 
    451             echo self::jsVars(array('dotclear_darkMode' => 1)); 
     451            echo self::jsVars(['dotclear_darkMode' => 1]); 
    452452            echo self::cssLoad('style/default-dark.css'); 
    453453        } else { 
    454             echo self::jsVars(array('dotclear_darkMode' => 0)); 
     454            echo self::jsVars(['dotclear_darkMode' => 0]); 
    455455            echo self::cssLoad('style/default.css'); 
    456456        } 
     
    520520    } 
    521521 
    522     public static function breadcrumb($elements = null, $options = array()) 
     522    public static function breadcrumb($elements = null, $options = []) 
    523523    { 
    524524        global $core; 
     
    742742            } 
    743743        } else { 
    744             $unfolded_sections = array(); 
     744            $unfolded_sections = []; 
    745745        } 
    746746        return '<script type="text/javascript">' . "\n" . 
     
    10031003    } 
    10041004 
    1005     public static function jsUpload($params = array(), $base_url = null) 
     1005    public static function jsUpload($params = [], $base_url = null) 
    10061006    { 
    10071007        if (!$base_url) { 
     
    10091009        } 
    10101010 
    1011         $params = array_merge($params, array( 
     1011        $params = array_merge($params, [ 
    10121012            'sess_id=' . session_id(), 
    10131013            'sess_uid=' . $_SESSION['sess_browser_uid'], 
    10141014            'xd_check=' . $GLOBALS['core']->getNonce() 
    1015         )); 
     1015        ]); 
    10161016 
    10171017        return 
     
    10681068    } 
    10691069 
    1070     public static function jsLoadCodeMirror($theme = '', $multi = true, $modes = array('css', 'htmlmixed', 'javascript', 'php', 'xml')) 
     1070    public static function jsLoadCodeMirror($theme = '', $multi = true, $modes = ['css', 'htmlmixed', 'javascript', 'php', 'xml']) 
    10711071    { 
    10721072        $ret = 
     
    11151115    public static function getCodeMirrorThemes() 
    11161116    { 
    1117         $themes      = array(); 
     1117        $themes      = []; 
    11181118        $themes_root = dirname(__FILE__) . '/../../admin' . '/js/codemirror/theme/'; 
    11191119        if (is_dir($themes_root) && is_readable($themes_root)) { 
     
    11321132    public static function getPF($file) 
    11331133    { 
    1134         return $GLOBALS['core']->adminurl->get('load.plugin.file', array('pf' => $file)); 
     1134        return $GLOBALS['core']->adminurl->get('load.plugin.file', ['pf' => $file]); 
    11351135    } 
    11361136 
    11371137    public static function getVF($file) 
    11381138    { 
    1139         return $GLOBALS['core']->adminurl->get('load.var.file', array('vf' => $file)); 
     1139        return $GLOBALS['core']->adminurl->get('load.var.file', ['vf' => $file]); 
    11401140    } 
    11411141 
Note: See TracChangeset for help on using the changeset viewer.

Sites map