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() → [])

Location:
inc/admin/actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/actions/class.dcaction.php

    r3731 r3874  
    6464     * @return mixed Value. 
    6565     */ 
    66     public function __construct($core, $uri, $redirect_args = array()) 
     66    public function __construct($core, $uri, $redirect_args = []) 
    6767    { 
    6868        $this->core            = $core; 
    6969        $this->actions         = new ArrayObject(); 
    70         $this->combo           = array(); 
     70        $this->combo           = []; 
    7171        $this->uri             = $uri; 
    7272        $this->redir_args      = $redirect_args; 
    73         $this->redirect_fields = array(); 
     73        $this->redirect_fields = []; 
    7474        $this->action          = ''; 
    7575        $this->cb_title        = __('Title'); 
    76         $this->entries         = array(); 
     76        $this->entries         = []; 
    7777        $this->from            = new ArrayObject($_POST); 
    7878        $this->field_entries   = 'entries'; 
     
    122122                $values = array_values($a); 
    123123                if (!isset($this->combo[$k])) { 
    124                     $this->combo[$k] = array(); 
     124                    $this->combo[$k] = []; 
    125125                } 
    126126                $this->combo[$k] = array_merge($this->combo[$k], $a); 
    127127            } elseif ($a instanceof formSelectOption) { 
    128                 $values          = array($a->value); 
     128                $values          = [$a->value]; 
    129129                $this->combo[$k] = $a->value; 
    130130            } else { 
    131                 $values          = array($a); 
     131                $values          = [$a]; 
    132132                $this->combo[$k] = $a; 
    133133            } 
     
    193193        $ret = ''; 
    194194        foreach ($this->redir_args as $k => $v) { 
    195             $ret .= form::hidden(array($k), $v); 
     195            $ret .= form::hidden([$k], $v); 
    196196        } 
    197197        if ($with_ids) { 
     
    245245     * @return string the redirection url 
    246246     */ 
    247     public function getRedirection($with_selected_entries = false, $params = array()) 
     247    public function getRedirection($with_selected_entries = false, $params = []) 
    248248    { 
    249249        $redir_args = array_merge($params, $this->redir_args); 
     
    265265     * @access public 
    266266     */ 
    267     public function redirect($with_selected_entries = false, $params = array()) 
     267    public function redirect($with_selected_entries = false, $params = []) 
    268268    { 
    269269        http::redirect($this->getRedirection($with_selected_entries, $params)); 
     
    357357            $ret .= 
    358358            '<tr><td class="minimal">' . 
    359             form::checkbox(array($this->field_entries . '[]'), $id, array( 
     359            form::checkbox([$this->field_entries . '[]'], $id, [ 
    360360                'checked' => true 
    361             )) . 
     361            ]) . 
    362362                '</td>' . 
    363363                '<td>' . $title . '</td></tr>'; 
  • inc/admin/actions/class.dcactionblogs.php

    r3731 r3874  
    1212class dcBlogsActionsPage extends dcActionsPage 
    1313{ 
    14     public function __construct($core, $uri, $redirect_args = array()) 
     14    public function __construct($core, $uri, $redirect_args = []) 
    1515    { 
    1616        parent::__construct($core, $uri, $redirect_args); 
    17         $this->redirect_fields = array('status', 'sortby', 'order', 'page', 'nb'); 
     17        $this->redirect_fields = ['status', 'sortby', 'order', 'page', 'nb']; 
    1818        $this->field_entries   = 'blogs'; 
    1919        $this->title_cb        = __('Blogs'); 
     
    5757        $this->core->error->add($e->getMessage()); 
    5858        $this->beginPage(dcPage::breadcrumb( 
    59             array( 
     59            [ 
    6060                html::escapeHTML($this->core->blog->name) => '', 
    6161                __('Blogs')                               => $this->core->adminurl->get('admin.blogs'), 
    6262                __('Blogs actions')                       => '' 
    63             )) 
     63            ]) 
    6464        ); 
    6565        $this->endPage(); 
     
    7272            $ret .= 
    7373            '<tr>' . 
    74             '<td class="minimal">' . form::checkbox(array($this->field_entries . '[]'), $id, 
    75                 array( 
     74            '<td class="minimal">' . form::checkbox([$this->field_entries . '[]'], $id, 
     75                [ 
    7676                    'checked' => true 
    77                 )) . 
     77                ]) . 
    7878                '</td>' . 
    7979                '<td>' . $res['blog'] . '</td>' . 
     
    9090    protected function fetchEntries($from) 
    9191    { 
    92         $params = array(); 
     92        $params = []; 
    9393        if (!empty($from['blogs'])) { 
    9494            $params['blog_id'] = $from['blogs']; 
     
    9797        $bl = $this->core->getBlogs($params); 
    9898        while ($bl->fetch()) { 
    99             $this->entries[$bl->blog_id] = array( 
     99            $this->entries[$bl->blog_id] = [ 
    100100                'blog' => $bl->blog_id, 
    101101                'name' => $bl->blog_name 
    102             ); 
     102            ]; 
    103103        } 
    104104        $this->rs = $bl; 
     
    115115 
    116116        $ap->addAction( 
    117             array(__('Status') => array( 
     117            [__('Status') => [ 
    118118                __('Set online')     => 'online', 
    119119                __('Set offline')    => 'offline', 
    120120                __('Set as removed') => 'remove' 
    121             )), 
    122             array('dcDefaultBlogActions', 'doChangeBlogStatus') 
     121            ]], 
     122            ['dcDefaultBlogActions', 'doChangeBlogStatus'] 
    123123        ); 
    124124        $ap->addAction( 
    125             array(__('Delete') => array( 
    126                 __('Delete') => 'delete')), 
    127             array('dcDefaultBlogActions', 'doDeleteBlog') 
     125            [__('Delete') => [ 
     126                __('Delete') => 'delete']], 
     127            ['dcDefaultBlogActions', 'doDeleteBlog'] 
    128128        ); 
    129129    } 
     
    175175        } 
    176176 
    177         $ids = array(); 
     177        $ids = []; 
    178178        foreach ($ap_ids as $id) { 
    179179            if ($id == $core->blog->id) { 
  • inc/admin/actions/class.dcactioncomments.php

    r3731 r3874  
    1212class dcCommentsActionsPage extends dcActionsPage 
    1313{ 
    14     public function __construct($core, $uri, $redirect_args = array()) 
     14    public function __construct($core, $uri, $redirect_args = []) 
    1515    { 
    1616        parent::__construct($core, $uri, $redirect_args); 
    17         $this->redirect_fields = array('type', 'author', 'status', 
    18             'sortby', 'ip', 'order', 'page', 'nb', 'section'); 
     17        $this->redirect_fields = ['type', 'author', 'status', 
     18            'sortby', 'ip', 'order', 'page', 'nb', 'section']; 
    1919        $this->field_entries = 'comments'; 
    2020        $this->title_cb      = __('Comments'); 
     
    5959        $this->core->error->add($e->getMessage()); 
    6060        $this->beginPage(dcPage::breadcrumb( 
    61             array( 
     61            [ 
    6262                html::escapeHTML($this->core->blog->name) => '', 
    6363                __('Comments')                            => $this->core->adminurl->get('admin.comments'), 
    6464                __('Comments actions')                    => '' 
    65             )) 
     65            ]) 
    6666        ); 
    6767        $this->endPage(); 
     
    8585            $ret .= 
    8686            '<tr><td class="minimal">' . 
    87             form::checkbox(array($this->field_entries . '[]'), $id, 
    88                 array( 
     87            form::checkbox([$this->field_entries . '[]'], $id, 
     88                [ 
    8989                    'checked' => true 
    90                 )) . 
     90                ]) . 
    9191                '</td>' . 
    9292                '<td>' . $title['author'] . '</td><td>' . $title['title'] . '</td></tr>'; 
     
    9898    protected function fetchEntries($from) 
    9999    { 
    100         $params = array(); 
     100        $params = []; 
    101101        if (!empty($from['comments'])) { 
    102102            $comments = $from['comments']; 
     
    116116        $co = $this->core->blog->getComments($params); 
    117117        while ($co->fetch()) { 
    118             $this->entries[$co->comment_id] = array( 
     118            $this->entries[$co->comment_id] = [ 
    119119                'title'  => $co->post_title, 
    120120                'author' => $co->comment_author 
    121             ); 
     121            ]; 
    122122        } 
    123123        $this->rs = $co; 
     
    131131        if ($core->auth->check('publish,contentadmin', $core->blog->id)) { 
    132132            $ap->addAction( 
    133                 array(__('Status') => array( 
     133                [__('Status') => [ 
    134134                    __('Publish')         => 'publish', 
    135135                    __('Unpublish')       => 'unpublish', 
    136136                    __('Mark as pending') => 'pending', 
    137137                    __('Mark as junk')    => 'junk' 
    138                 )), 
    139                 array('dcDefaultCommentActions', 'doChangeCommentStatus') 
     138                ]], 
     139                ['dcDefaultCommentActions', 'doChangeCommentStatus'] 
    140140            ); 
    141141        } 
     
    143143        if ($core->auth->check('delete,contentadmin', $core->blog->id)) { 
    144144            $ap->addAction( 
    145                 array(__('Delete') => array( 
    146                     __('Delete') => 'delete')), 
    147                 array('dcDefaultCommentActions', 'doDeleteComment') 
     145                [__('Delete') => [ 
     146                    __('Delete') => 'delete']], 
     147                ['dcDefaultCommentActions', 'doDeleteComment'] 
    148148            ); 
    149149        } 
     
    158158 
    159159        if ($ip_filter_active) { 
    160             $blacklist_actions = array(__('Blacklist IP') => 'blacklist'); 
     160            $blacklist_actions = [__('Blacklist IP') => 'blacklist']; 
    161161            if ($core->auth->isSuperAdmin()) { 
    162162                $blacklist_actions[__('Blacklist IP (global)')] = 'blacklist_global'; 
     
    164164 
    165165            $ap->addAction( 
    166                 array(__('IP address') => $blacklist_actions), 
    167                 array('dcDefaultCommentActions', 'doBlacklistIP') 
     166                [__('IP address') => $blacklist_actions], 
     167                ['dcDefaultCommentActions', 'doBlacklistIP'] 
    168168            ); 
    169169        } 
  • inc/admin/actions/class.dcactionposts.php

    r3731 r3874  
    1212class dcPostsActionsPage extends dcActionsPage 
    1313{ 
    14     public function __construct($core, $uri, $redirect_args = array()) 
     14    public function __construct($core, $uri, $redirect_args = []) 
    1515    { 
    1616        parent::__construct($core, $uri, $redirect_args); 
    17         $this->redirect_fields = array('user_id', 'cat_id', 'status', 
    18             'selected', 'attachment', 'month', 'lang', 'sortby', 'order', 'page', 'nb'); 
     17        $this->redirect_fields = ['user_id', 'cat_id', 'status', 
     18            'selected', 'attachment', 'month', 'lang', 'sortby', 'order', 'page', 'nb']; 
    1919        $this->loadDefaults(); 
    2020    } 
     
    6161        $this->core->error->add($e->getMessage()); 
    6262        $this->beginPage(dcPage::breadcrumb( 
    63             array( 
     63            [ 
    6464                html::escapeHTML($this->core->blog->name) => '', 
    6565                $this->getCallerTitle()                   => $this->getRedirection(true), 
    6666                __('Entries actions')                     => '' 
    67             )) 
     67            ]) 
    6868        ); 
    6969        $this->endPage(); 
     
    7272    protected function fetchEntries($from) 
    7373    { 
    74         $params = array(); 
     74        $params = []; 
    7575        if (!empty($from['entries'])) { 
    7676            $entries = $from['entries']; 
     
    107107        if ($core->auth->check('publish,contentadmin', $core->blog->id)) { 
    108108            $ap->addAction( 
    109                 array(__('Status') => array( 
     109                [__('Status') => [ 
    110110                    __('Publish')         => 'publish', 
    111111                    __('Unpublish')       => 'unpublish', 
    112112                    __('Schedule')        => 'schedule', 
    113113                    __('Mark as pending') => 'pending' 
    114                 )), 
    115                 array('dcDefaultPostActions', 'doChangePostStatus') 
     114                ]], 
     115                ['dcDefaultPostActions', 'doChangePostStatus'] 
    116116            ); 
    117117        } 
    118118        $ap->addAction( 
    119             array(__('Mark') => array( 
     119            [__('Mark') => [ 
    120120                __('Mark as selected')   => 'selected', 
    121121                __('Mark as unselected') => 'unselected' 
    122             )), 
    123             array('dcDefaultPostActions', 'doUpdateSelectedPost') 
     122            ]], 
     123            ['dcDefaultPostActions', 'doUpdateSelectedPost'] 
    124124        ); 
    125125        $ap->addAction( 
    126             array(__('Change') => array( 
     126            [__('Change') => [ 
    127127                __('Change category') => 'category' 
    128             )), 
    129             array('dcDefaultPostActions', 'doChangePostCategory') 
     128            ]], 
     129            ['dcDefaultPostActions', 'doChangePostCategory'] 
    130130        ); 
    131131        $ap->addAction( 
    132             array(__('Change') => array( 
     132            [__('Change') => [ 
    133133                __('Change language') => 'lang' 
    134             )), 
    135             array('dcDefaultPostActions', 'doChangePostLang') 
     134            ]], 
     135            ['dcDefaultPostActions', 'doChangePostLang'] 
    136136        ); 
    137137        if ($core->auth->check('admin', $core->blog->id)) { 
    138138            $ap->addAction( 
    139                 array(__('Change') => array( 
    140                     __('Change author') => 'author')), 
    141                 array('dcDefaultPostActions', 'doChangePostAuthor') 
     139                [__('Change') => [ 
     140                    __('Change author') => 'author']], 
     141                ['dcDefaultPostActions', 'doChangePostAuthor'] 
    142142            ); 
    143143        } 
    144144        if ($core->auth->check('delete,contentadmin', $core->blog->id)) { 
    145145            $ap->addAction( 
    146                 array(__('Delete') => array( 
    147                     __('Delete') => 'delete')), 
    148                 array('dcDefaultPostActions', 'doDeletePost') 
     146                [__('Delete') => [ 
     147                    __('Delete') => 'delete']], 
     148                ['dcDefaultPostActions', 'doDeletePost'] 
    149149            ); 
    150150        } 
     
    281281            $ap->beginPage( 
    282282                dcPage::breadcrumb( 
    283                     array( 
     283                    [ 
    284284                        html::escapeHTML($core->blog->name)      => '', 
    285285                        $ap->getCallerTitle()                    => $ap->getRedirection(true), 
    286286                        __('Change category for this selection') => '' 
    287                     ))); 
     287                    ])); 
    288288            # categories list 
    289289            # Getting categories 
     
    295295            $ap->getCheckboxes() . 
    296296            '<p><label for="new_cat_id" class="classic">' . __('Category:') . '</label> ' . 
    297             form::combo(array('new_cat_id'), $categories_combo); 
     297            form::combo(['new_cat_id'], $categories_combo); 
    298298 
    299299            if ($core->auth->check('categories', $core->blog->id)) { 
     
    312312            $core->formNonce() . 
    313313            $ap->getHiddenFields() . 
    314             form::hidden(array('action'), 'category') . 
     314            form::hidden(['action'], 'category') . 
    315315            '<input type="submit" value="' . __('Save') . '" /></p>' . 
    316316                '</form>'; 
     
    349349            $usersList = ''; 
    350350            if ($core->auth->check('admin', $core->blog->id)) { 
    351                 $params = array( 
     351                $params = [ 
    352352                    'limit' => 100, 
    353353                    'order' => 'nb_post DESC' 
    354                 ); 
     354                ]; 
    355355                $rs       = $core->getUsers($params); 
    356356                $rsStatic = $rs->toStatic(); 
     
    364364            $ap->beginPage( 
    365365                dcPage::breadcrumb( 
    366                     array( 
     366                    [ 
    367367                        html::escapeHTML($core->blog->name)    => '', 
    368368                        $ap->getCallerTitle()                  => $ap->getRedirection(true), 
    369                         __('Change author for this selection') => '')), 
     369                        __('Change author for this selection') => '']), 
    370370                dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . 
    371371                '<script type="text/javascript">' . "\n" . 
     
    382382            echo 
    383383            $core->formNonce() . $ap->getHiddenFields() . 
    384             form::hidden(array('action'), 'author') . 
     384            form::hidden(['action'], 'author') . 
    385385            '<input type="submit" value="' . __('Save') . '" /></p>' . 
    386386                '</form>'; 
     
    412412            $ap->beginPage( 
    413413                dcPage::breadcrumb( 
    414                     array( 
     414                    [ 
    415415                        html::escapeHTML($core->blog->name)      => '', 
    416416                        $ap->getCallerTitle()                    => $ap->getRedirection(true), 
    417417                        __('Change language for this selection') => '' 
    418                     ))); 
     418                    ])); 
    419419            # lang list 
    420420            # Languages combo 
    421             $rs         = $core->blog->getLangs(array('order' => 'asc')); 
     421            $rs         = $core->blog->getLangs(['order' => 'asc']); 
    422422            $all_langs  = l10n::getISOcodes(0, 1); 
    423             $lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1, 1)); 
     423            $lang_combo = ['' => '', __('Most used') => [], __('Available') => l10n::getISOcodes(1, 1)]; 
    424424            while ($rs->fetch()) { 
    425425                if (isset($all_langs[$rs->post_lang])) { 
     
    442442            echo 
    443443            $core->formNonce() . $ap->getHiddenFields() . 
    444             form::hidden(array('action'), 'lang') . 
     444            form::hidden(['action'], 'lang') . 
    445445            '<input type="submit" value="' . __('Save') . '" /></p>' . 
    446446                '</form>'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map