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.moduleslist.php

    r3812 r3874  
    2323 
    2424    public static $allow_multi_install = false; /**< @var    boolean    Work with multiple root directories */ 
    25     public static $distributed_modules = array(); /**< @var    array    List of modules distributed with Dotclear */ 
     25    public static $distributed_modules = []; /**< @var    array    List of modules distributed with Dotclear */ 
    2626 
    2727    protected $list_id = 'unknow'; /**< @var    string    Current list ID */ 
    28     protected $data    = array(); /**< @var    array    Current modules */ 
     28    protected $data    = []; /**< @var    array    Current modules */ 
    2929 
    3030    protected $config_module  = ''; /**< @var    string    Module ID to configure */ 
     
    4242 
    4343    public static $nav_indexes = 'abcdefghijklmnopqrstuvwxyz0123456789'; /**< @var    string    Index list */ 
    44     protected $nav_list        = array(); /**< @var    array    Index list with special index */ 
     44    protected $nav_list        = []; /**< @var    array    Index list with special index */ 
    4545    protected $nav_special     = 'other'; /**< @var    string    Text for other special index */ 
    4646 
     
    7878    public function setList($id) 
    7979    { 
    80         $this->data     = array(); 
     80        $this->data     = []; 
    8181        $this->page_tab = ''; 
    8282        $this->list_id  = $id; 
     
    299299    { 
    300300        $this->nav_special = (string) $str; 
    301         $this->nav_list    = array_merge(str_split(self::$nav_indexes), array($this->nav_special)); 
     301        $this->nav_list    = array_merge(str_split(self::$nav_indexes), [$this->nav_special]); 
    302302 
    303303        return $this; 
     
    326326 
    327327        # Fetch modules required field 
    328         $indexes = array(); 
     328        $indexes = []; 
    329329        foreach ($this->data as $id => $module) { 
    330330            if (!isset($module[$this->sort_field])) { 
     
    341341        } 
    342342 
    343         $buttons = array(); 
     343        $buttons = []; 
    344344        foreach ($this->nav_list as $char) { 
    345345            # Selected letter 
     
    412412    public function setModules($modules) 
    413413    { 
    414         $this->data = array(); 
     414        $this->data = []; 
    415415        if (!empty($modules) && is_array($modules)) { 
    416416            foreach ($modules as $id => $module) { 
     
    447447        return array_merge( 
    448448            # Default values 
    449             array( 
     449            [ 
    450450                'desc'              => '', 
    451451                'author'            => '', 
     
    465465                'score'             => 0, 
    466466                'type'              => null, 
    467                 'require'           => array(), 
    468                 'settings'          => array() 
    469             ), 
     467                'require'           => [], 
     468                'settings'          => [] 
     469            ], 
    470470            # Module's values 
    471471            $module, 
    472472            # Clean up values 
    473             array( 
     473            [ 
    474474                'id'    => $id, 
    475475                'sid'   => self::sanitizeString($id), 
     
    477477                'name'  => $name, 
    478478                'sname' => self::sanitizeString($name) 
    479             ) 
     479            ] 
    480480        ); 
    481481    } 
     
    504504    public static function sortModules($modules, $field, $asc = true) 
    505505    { 
    506         $origin = $sorter = array(); 
     506        $origin = $sorter = []; 
    507507 
    508508        foreach ($modules as $id => $module) { 
     
    528528     * @return    adminModulesList self instance 
    529529     */ 
    530     public function displayModules($cols = array('name', 'version', 'desc'), $actions = array(), $nav_limit = false) 
     530    public function displayModules($cols = ['name', 'version', 'desc'], $actions = [], $nav_limit = false) 
    531531    { 
    532532        echo 
     
    612612                echo 
    613613                '<td class="module-icon nowrap">' . 
    614                 form::checkbox(array('modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)), html::escapeHTML($id)) . 
     614                form::checkbox(['modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)], html::escapeHTML($id)) . 
    615615                    '</td>'; 
    616616            } 
     
    642642                echo 
    643643                html::escapeHTML($module['name']) . ($id != $module['name'] ? sprintf(__(' (%s)'), $id) : '') . 
    644                 form::hidden(array('modules[' . $count . ']'), html::escapeHTML($id)); 
     644                form::hidden(['modules[' . $count . ']'], html::escapeHTML($id)); 
    645645            } 
    646646            echo 
     
    732732                    } 
    733733 
    734                     $more = array(); 
     734                    $more = []; 
    735735                    if (!empty($module['details'])) { 
    736736                        $more[] = '<a class="module-details" href="' . $module['details'] . '">' . __('Details') . '</a>'; 
     
    821821    public static function getSettingsUrls($core, $id, $check = false, $self = true) 
    822822    { 
    823         $st = array(); 
     823        $st = []; 
    824824 
    825825        $mr       = $core->plugins->moduleRoot($id); 
     
    831831                    $core->auth->isSuperAdmin() || 
    832832                    $core->auth->check($core->plugins->moduleInfo($id, 'permissions'), $core->blog->id)) { 
    833                     $params = array('module' => $id, 'conf' => '1'); 
     833                    $params = ['module' => $id, 'conf' => '1']; 
    834834                    if (!$core->plugins->moduleInfo($id, 'standalone_config') && !$self) { 
    835835                        $params['redir'] = $core->adminurl->get('admin.plugin.' . $id); 
     
    890890    protected function getActions($id, $module, $actions) 
    891891    { 
    892         $submits = array(); 
     892        $submits = []; 
    893893 
    894894        # Use loop to keep requested order 
     
    952952    protected function getGlobalActions($actions, $with_selection = false) 
    953953    { 
    954         $submits = array(); 
     954        $submits = []; 
    955955 
    956956        # Use loop to keep requested order 
     
    10151015        } 
    10161016 
    1017         $modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : array(); 
     1017        $modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : []; 
    10181018 
    10191019        if ($this->core->auth->isSuperAdmin() && !empty($_POST['delete'])) { 
     
    12871287        '<input type="file" name="pkg_file" id="pkg_file" required /></p>' . 
    12881288        '<p class="field"><label for="your_pwd1" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Your password:') . '</label> ' . 
    1289         form::password(array('your_pwd', 'your_pwd1'), 20, 255, 
    1290             array( 
     1289        form::password(['your_pwd', 'your_pwd1'], 20, 255, 
     1290            [ 
    12911291                'extra_html'   => 'required placeholder="' . __('Password') . '"', 
    12921292                'autocomplete' => 'current-password' 
    1293             ) 
     1293            ] 
    12941294        ) . '</p>' . 
    12951295        '<p><input type="submit" name="upload_pkg" value="' . __('Upload') . '" />' . 
     
    13021302        '<h4>' . __('Download a zip file') . '</h4>' . 
    13031303        '<p class="field"><label for="pkg_url" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Zip file URL:') . '</label> ' . 
    1304         form::field('pkg_url', 40, 255, array( 
     1304        form::field('pkg_url', 40, 255, [ 
    13051305            'extra_html' => 'required placeholder="' . __('URL') . '"' 
    1306         )) . 
     1306        ]) . 
    13071307        '</p>' . 
    13081308        '<p class="field"><label for="your_pwd2" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Your password:') . '</label> ' . 
    1309         form::password(array('your_pwd', 'your_pwd2'), 20, 255, 
    1310             array( 
     1309        form::password(['your_pwd', 'your_pwd2'], 20, 255, 
     1310            [ 
    13111311                'extra_html'   => 'required placeholder="' . __('Password') . '"', 
    13121312                'autocomplete' => 'current-password' 
    1313             ) 
     1313            ] 
    13141314        ) . '</p>' . 
    13151315        '<p><input type="submit" name="fetch_pkg" value="' . __('Download') . '" />' . 
     
    14791479    } 
    14801480 
    1481     public function displayModules($cols = array('name', 'config', 'version', 'desc'), $actions = array(), $nav_limit = false) 
     1481    public function displayModules($cols = ['name', 'config', 'version', 'desc'], $actions = [], $nav_limit = false) 
    14821482    { 
    14831483        echo 
     
    15191519                    $line .= 
    15201520                    '<label for="' . html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id) . '">' . 
    1521                     form::checkbox(array('modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)), html::escapeHTML($id)) . 
     1521                    form::checkbox(['modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)], html::escapeHTML($id)) . 
    15221522                    html::escapeHTML($module['name']) . 
    15231523                        '</label>'; 
     
    15251525                } else { 
    15261526                    $line .= 
    1527                     form::hidden(array('modules[' . $count . ']'), html::escapeHTML($id)) . 
     1527                    form::hidden(['modules[' . $count . ']'], html::escapeHTML($id)) . 
    15281528                    html::escapeHTML($module['name']); 
    15291529                } 
     
    15691569                    $line .= 
    15701570                    '<label for="' . html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id) . '">' . 
    1571                     form::checkbox(array('modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)), html::escapeHTML($id)) . 
     1571                    form::checkbox(['modules[' . $count . ']', html::escapeHTML($this->list_id) . '_modules_' . html::escapeHTML($id)], html::escapeHTML($id)) . 
    15721572                    html::escapeHTML($module['name']) . 
    15731573                        '</label>'; 
    15741574                } else { 
    15751575                    $line .= 
    1576                     form::hidden(array('modules[' . $count . ']'), html::escapeHTML($id)) . 
     1576                    form::hidden(['modules[' . $count . ']'], html::escapeHTML($id)) . 
    15771577                    html::escapeHTML($module['name']); 
    15781578                } 
     
    17121712    protected function getActions($id, $module, $actions) 
    17131713    { 
    1714         $submits = array(); 
     1714        $submits = []; 
    17151715 
    17161716        $this->core->blog->settings->addNamespace('system'); 
     
    17321732    protected function getGlobalActions($actions, $with_selection = false) 
    17331733    { 
    1734         $submits = array(); 
     1734        $submits = []; 
    17351735 
    17361736        foreach ($actions as $action) { 
     
    17681768        } 
    17691769 
    1770         $modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : array(); 
     1770        $modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : []; 
    17711771 
    17721772        if (!empty($_POST['select'])) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map