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
  • admin/posts.php

    r3745 r3874  
    2828# Getting dates 
    2929try { 
    30     $dates = $core->blog->getDates(array('type' => 'month')); 
     30    $dates = $core->blog->getDates(['type' => 'month']); 
    3131} catch (Exception $e) { 
    3232    $core->error->add($e->getMessage()); 
     
    4444dcUtils::lexicalKeySort($users_combo); 
    4545$users_combo = array_merge( 
    46     array('-' => ''), 
     46    ['-' => ''], 
    4747    $users_combo 
    4848); 
    4949 
    5050$categories_combo = array_merge( 
    51     array( 
     51    [ 
    5252        new formSelectOption('-', ''), 
    53         new formSelectOption(__('(No cat)'), 'NULL')), 
     53        new formSelectOption(__('(No cat)'), 'NULL')], 
    5454    dcAdminCombos::getCategoriesCombo($categories, false) 
    5555); 
    56 $categories_values = array(); 
     56$categories_values = []; 
    5757foreach ($categories_combo as $cat) { 
    5858    if (isset($cat->value)) { 
     
    6262 
    6363$status_combo = array_merge( 
    64     array('-' => ''), 
     64    ['-' => ''], 
    6565    dcAdminCombos::getPostStatusesCombo() 
    6666); 
    6767 
    68 $selected_combo = array( 
     68$selected_combo = [ 
    6969    '-'                => '', 
    7070    __('Selected')     => '1', 
    7171    __('Not selected') => '0' 
    72 ); 
    73  
    74 $comment_combo = array( 
     72]; 
     73 
     74$comment_combo = [ 
    7575    '-'          => '', 
    7676    __('Opened') => '1', 
    7777    __('Closed') => '0' 
    78 ); 
    79  
    80 $trackback_combo = array( 
     78]; 
     79 
     80$trackback_combo = [ 
    8181    '-'          => '', 
    8282    __('Opened') => '1', 
    8383    __('Closed') => '0' 
    84 ); 
    85  
    86 $attachment_combo = array( 
     84]; 
     85 
     86$attachment_combo = [ 
    8787    '-'                       => '', 
    8888    __('With attachments')    => '1', 
    8989    __('Without attachments') => '0' 
    90 ); 
    91  
    92 $password_combo = array( 
     90]; 
     91 
     92$password_combo = [ 
    9393    '-'                    => '', 
    9494    __('With password')    => '1', 
    9595    __('Without password') => '0' 
    96 ); 
     96]; 
    9797 
    9898# Months array 
    9999$dt_m_combo = array_merge( 
    100     array('-' => ''), 
     100    ['-' => ''], 
    101101    dcAdminCombos::getDatesCombo($dates) 
    102102); 
    103103 
    104104$lang_combo = array_merge( 
    105     array('-' => ''), 
     105    ['-' => ''], 
    106106    dcAdminCombos::getLangsCombo($langs, false) 
    107107); 
     
    109109# Post formats 
    110110$core_formaters    = $core->getFormaters(); 
    111 $available_formats = array(); 
     111$available_formats = []; 
    112112foreach ($core_formaters as $editor => $formats) { 
    113113    foreach ($formats as $format) { 
     
    116116} 
    117117$format_combo = array_merge( 
    118     array('-' => ''), 
     118    ['-' => ''], 
    119119    $available_formats 
    120120); 
    121121 
    122 $sortby_combo = array( 
     122$sortby_combo = [ 
    123123    __('Date')                 => 'post_dt', 
    124124    __('Title')                => 'post_title', 
     
    129129    __('Number of comments')   => 'nb_comment', 
    130130    __('Number of trackbacks') => 'nb_trackback' 
    131 ); 
    132  
    133 $sortby_lex = array( 
     131]; 
     132 
     133$sortby_lex = [ 
    134134    // key in sorty_combo (see above) => field in SQL request 
    135135    'post_title' => 'post_title', 
    136136    'cat_title'  => 'cat_title', 
    137     'user_id'    => 'P.user_id'); 
    138  
    139 $order_combo = array( 
     137    'user_id'    => 'P.user_id']; 
     138 
     139$order_combo = [ 
    140140    __('Descending') => 'desc', 
    141141    __('Ascending')  => 'asc' 
    142 ); 
     142]; 
    143143 
    144144# Actions combo box 
     
    178178} 
    179179 
    180 $params['limit']      = array((($page - 1) * $nb_per_page), $nb_per_page); 
     180$params['limit']      = [(($page - 1) * $nb_per_page), $nb_per_page]; 
    181181$params['no_content'] = true; 
    182182$params['where']      = ''; 
     
    308308    dcPage::jsLoad('js/_posts_list.js') . dcPage::jsFilterControl($show_filters), 
    309309    dcPage::breadcrumb( 
    310         array( 
     310        [ 
    311311            html::escapeHTML($core->blog->name) => '', 
    312312            __('Entries')                       => '' 
    313         )) 
     313        ]) 
    314314); 
    315315if (!empty($_GET['upd'])) { 
     
    382382        form::combo('action', $posts_actions_page->getCombo()) . 
    383383        '<input id="do-action" type="submit" value="' . __('ok') . '" disabled /></p>' . 
    384         form::hidden(array('user_id'), $user_id) . 
    385         form::hidden(array('cat_id'), $cat_id) . 
    386         form::hidden(array('status'), $status) . 
    387         form::hidden(array('password'), $password) . 
    388         form::hidden(array('selected'), $selected) . 
    389         form::hidden(array('comment'), $comment) . 
    390         form::hidden(array('trackback'), $trackback) . 
    391         form::hidden(array('attachment'), $attachment) . 
    392         form::hidden(array('month'), $month) . 
    393         form::hidden(array('lang'), $lang) . 
    394         form::hidden(array('sortby'), $sortby) . 
    395         form::hidden(array('order'), $order) . 
    396         form::hidden(array('page'), $page) . 
    397         form::hidden(array('nb'), $nb_per_page) . 
     384        form::hidden(['user_id'], $user_id) . 
     385        form::hidden(['cat_id'], $cat_id) . 
     386        form::hidden(['status'], $status) . 
     387        form::hidden(['password'], $password) . 
     388        form::hidden(['selected'], $selected) . 
     389        form::hidden(['comment'], $comment) . 
     390        form::hidden(['trackback'], $trackback) . 
     391        form::hidden(['attachment'], $attachment) . 
     392        form::hidden(['month'], $month) . 
     393        form::hidden(['lang'], $lang) . 
     394        form::hidden(['sortby'], $sortby) . 
     395        form::hidden(['order'], $order) . 
     396        form::hidden(['page'], $page) . 
     397        form::hidden(['nb'], $nb_per_page) . 
    398398        $core->formNonce() . 
    399399        '</div>' . 
Note: See TracChangeset for help on using the changeset viewer.

Sites map