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/post.php

    r3771 r3874  
    3838$can_delete    = false; 
    3939 
    40 $post_headlink = '<link rel="%s" title="%s" href="' . $core->adminurl->get('admin.post', array('id' => "%s"), '&amp;', true) . '" />'; 
    41 $post_link     = '<a href="' . $core->adminurl->get('admin.post', array('id' => "%s"), '&amp;', true) . '" title="%s">%s</a>'; 
     40$post_headlink = '<link rel="%s" title="%s" href="' . $core->adminurl->get('admin.post', ['id' => "%s"], '&amp;', true) . '" />'; 
     41$post_link     = '<a href="' . $core->adminurl->get('admin.post', ['id' => "%s"], '&amp;', true) . '" title="%s">%s</a>'; 
    4242$next_link     = $prev_link     = $next_headlink     = $prev_headlink     = null; 
    4343 
     
    5858# Formats combo 
    5959$core_formaters    = $core->getFormaters(); 
    60 $available_formats = array('' => ''); 
     60$available_formats = ['' => '']; 
    6161foreach ($core_formaters as $editor => $formats) { 
    6262    foreach ($formats as $format) { 
     
    6666 
    6767# Languages combo 
    68 $rs         = $core->blog->getLangs(array('order' => 'asc')); 
     68$rs         = $core->blog->getLangs(['order' => 'asc']); 
    6969$lang_combo = dcAdminCombos::getLangsCombo($rs, true); 
    7070 
     
    147147} 
    148148 
    149 $comments_actions_page = new dcCommentsActionsPage($core, $core->adminurl->get('admin.post'), array('id' => $post_id, '_ANCHOR' => $anchor, 'section' => $anchor)); 
     149$comments_actions_page = new dcCommentsActionsPage($core, $core->adminurl->get('admin.post'), ['id' => $post_id, '_ANCHOR' => $anchor, 'section' => $anchor]); 
    150150 
    151151if ($comments_actions_page->process()) { 
     
    176176            $core->adminurl->redirect( 
    177177                'admin.post', 
    178                 array('id' => $post_id, 'tb' => '1') 
     178                ['id' => $post_id, 'tb' => '1'] 
    179179            ); 
    180180        } 
     
    298298            $core->adminurl->redirect( 
    299299                'admin.post', 
    300                 array('id' => $post_id) 
     300                ['id' => $post_id] 
    301301            ); 
    302302        } catch (Exception $e) { 
     
    318318            $core->adminurl->redirect( 
    319319                'admin.post', 
    320                 array('id' => $return_id) 
     320                ['id' => $return_id] 
    321321            ); 
    322322        } catch (Exception $e) { 
     
    376376    if ($p_edit == $c_edit) { 
    377377        $admin_post_behavior .= $core->callBehavior('adminPostEditor', 
    378             $p_edit, 'post', array('#post_excerpt', '#post_content', '#comment_content'), $post_format); 
     378            $p_edit, 'post', ['#post_excerpt', '#post_content', '#comment_content'], $post_format); 
    379379    } else { 
    380380        $admin_post_behavior .= $core->callBehavior('adminPostEditor', 
    381             $p_edit, 'post', array('#post_excerpt', '#post_content'), $post_format); 
     381            $p_edit, 'post', ['#post_excerpt', '#post_content'], $post_format); 
    382382        $admin_post_behavior .= $core->callBehavior('adminPostEditor', 
    383             $c_edit, 'comment', array('#comment_content'), 'xhtml'); 
     383            $c_edit, 'comment', ['#comment_content'], 'xhtml'); 
    384384    } 
    385385} 
     
    397397    $next_headlink . "\n" . $prev_headlink, 
    398398    dcPage::breadcrumb( 
    399         array( 
     399        [ 
    400400            html::escapeHTML($core->blog->name)         => '', 
    401401            __('Entries')                               => $core->adminurl->get("admin.posts"), 
    402402            ($post_id ? $page_title_edit : $page_title) => '' 
    403         )) 
    404     , array( 
     403        ]) 
     404    , [ 
    405405        'x-frame-allow' => $core->blog->url 
    406     ) 
     406    ] 
    407407); 
    408408 
     
    488488    '<th>' . __('Edit') . '</th>' . 
    489489        '</tr>'; 
    490     $comments = array(); 
     490    $comments = []; 
    491491    if (isset($_REQUEST['comments'])) { 
    492492        foreach ($_REQUEST['comments'] as $v) { 
     
    496496 
    497497    while ($rs->fetch()) { 
    498         $comment_url = $core->adminurl->get("admin.comment", array('id' => $rs->comment_id)); 
     498        $comment_url = $core->adminurl->get("admin.comment", ['id' => $rs->comment_id]); 
    499499 
    500500        $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
     
    519519 
    520520        '<td class="nowrap">' . 
    521         ($has_action ? form::checkbox(array('comments[]'), $rs->comment_id, 
    522             array( 
     521        ($has_action ? form::checkbox(['comments[]'], $rs->comment_id, 
     522            [ 
    523523                'checked'    => isset($comments[$rs->comment_id]), 
    524524                'extra_html' => 'title="' . ($tb ? __('select this trackback') : __('select this comment') . '"') 
    525             ) 
     525            ] 
    526526        ) : '') . '</td>' . 
    527527        '<td class="maximal">' . html::escapeHTML($rs->comment_author) . '</td>' . 
    528528        '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $rs->comment_dt) . '</td>' . 
    529         '<td class="nowrap"><a href="' . $core->adminurl->get("admin.comments", array('ip' => $rs->comment_ip)) . '">' . $rs->comment_ip . '</a></td>' . 
     529        '<td class="nowrap"><a href="' . $core->adminurl->get("admin.comments", ['ip' => $rs->comment_ip]) . '">' . $rs->comment_ip . '</a></td>' . 
    530530        '<td class="nowrap status">' . $img_status . '</td>' . 
    531531        '<td class="nowrap status"><a href="' . $comment_url . '">' . 
     
    541541-------------------------------------------------------- */ 
    542542if ($can_edit_post) { 
    543     $sidebar_items = new ArrayObject(array( 
    544         'status-box'  => array( 
     543    $sidebar_items = new ArrayObject([ 
     544        'status-box'  => [ 
    545545            'title' => __('Status'), 
    546             'items' => array( 
     546            'items' => [ 
    547547                'post_status' => 
    548548                '<p class="entry-status"><label for="post_status">' . __('Entry status') . ' ' . $img_status . '</label>' . 
    549549                form::combo('post_status', $status_combo, 
    550                     array('default' => $post_status, 'class' => 'maximal', 'disabled' => !$can_publish)) . 
     550                    ['default' => $post_status, 'class' => 'maximal', 'disabled' => !$can_publish]) . 
    551551                '</p>', 
    552552                'post_dt'     => 
     
    557557                Dont forget to remove call to datepicker in post.js 
    558558 
    559                 form::datetime('post_dt', array( 
     559                form::datetime('post_dt', [ 
    560560                'default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', strtotime($post_dt))), 
    561561                'class' => ($bad_dt ? 'invalid' : '') 
    562                 )) . 
     562                ]) . 
    563563                 */ 
    564564                '</p>', 
     
    573573                '<p class="format_control control_no_xhtml">' . 
    574574                '<a id="convert-xhtml" class="button' . ($post_id && $post_format != 'wiki' ? ' hide' : '') . '" href="' . 
    575                 $core->adminurl->get('admin.post', array('id' => $post_id, 'xconv' => '1')) . 
     575                $core->adminurl->get('admin.post', ['id' => $post_id, 'xconv' => '1']) . 
    576576                '">' . 
    577                 __('Convert to XHTML') . '</a></p></div>')), 
    578         'metas-box'   => array( 
     577                __('Convert to XHTML') . '</a></p></div>']], 
     578        'metas-box'   => [ 
    579579            'title' => __('Filing'), 
    580             'items' => array( 
     580            'items' => [ 
    581581                'post_selected' => 
    582582                '<p><label for="post_selected" class="classic">' . 
     
    593593                    '<h5 id="create_cat">' . __('Add a new category') . '</h5>' . 
    594594                    '<p><label for="new_cat_title">' . __('Title:') . ' ' . 
    595                     form::field('new_cat_title', 30, 255, array('class' => 'maximal')) . '</label></p>' . 
     595                    form::field('new_cat_title', 30, 255, ['class' => 'maximal']) . '</label></p>' . 
    596596                    '<p><label for="new_cat_parent">' . __('Parent:') . ' ' . 
    597597                    form::combo('new_cat_parent', $categories_combo, '', 'maximal') . 
     
    599599                    '</div>' 
    600600                    : '') . 
    601                 '</div>')), 
    602         'options-box' => array( 
     601                '</div>']], 
     602        'options-box' => [ 
    603603            'title' => __('Options'), 
    604             'items' => array( 
     604            'items' => [ 
    605605                'post_open_comment_tb' => 
    606606                '<div>' . 
     
    638638                __('Warning: If you set the URL manually, it may conflict with another entry.') . 
    639639                '</p></div>' 
    640             )))); 
    641  
    642     $main_items = new ArrayObject(array( 
     640            ]]]); 
     641 
     642    $main_items = new ArrayObject([ 
    643643        "post_title"   => 
    644644        '<p class="col">' . 
    645645        '<label class="required no-margin bold" for="post_title"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label>' . 
    646         form::field('post_title', 20, 255, array( 
     646        form::field('post_title', 20, 255, [ 
    647647            'default'    => html::escapeHTML($post_title), 
    648648            'class'      => 'maximal', 
    649649            'extra_html' => 'required placeholder="' . __('Title') . '"' 
    650         )) . 
     650        ]) . 
    651651        '</p>', 
    652652 
     
    661661        'for="post_content"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Content:') . '</label> ' . 
    662662        form::textarea('post_content', 50, $core->auth->getOption('edit_size'), 
    663             array( 
     663            [ 
    664664                'default'    => html::escapeHTML($post_content), 
    665665                'extra_html' => 'required placeholder="' . __('Content') . '"' 
    666             )) . 
     666            ]) . 
    667667        '</p>', 
    668668 
     
    672672        form::textarea('post_notes', 50, 5, html::escapeHTML($post_notes)) . 
    673673        '</p>' 
    674     ) 
     674    ] 
    675675    ); 
    676676 
     
    744744    -------------------------------------------------------- */ 
    745745 
    746     $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    747  
    748     $comments = $core->blog->getComments(array_merge($params, array('comment_trackback' => 0))); 
     746    $params = ['post_id' => $post_id, 'order' => 'comment_dt ASC']; 
     747 
     748    $comments = $core->blog->getComments(array_merge($params, ['comment_trackback' => 0])); 
    749749 
    750750    echo 
     
    773773        '<p class="col right"><label for="action" class="classic">' . __('Selected comments action:') . '</label> ' . 
    774774        form::combo('action', $combo_action) . 
    775         form::hidden(array('section'), 'comments') . 
    776         form::hidden(array('id'), $post_id) . 
     775        form::hidden(['section'], 'comments') . 
     776        form::hidden(['id'], $post_id) . 
    777777        $core->formNonce() . 
    778778        '<input type="submit" value="' . __('ok') . '" /></p>' . 
     
    790790    '<div class="constrained">' . 
    791791    '<p><label for="comment_author" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Name:') . '</label>' . 
    792     form::field('comment_author', 30, 255, array( 
     792    form::field('comment_author', 30, 255, [ 
    793793        'default'    => html::escapeHTML($core->auth->getInfo('user_cn')), 
    794794        'extra_html' => 'required placeholder="' . __('Author') . '"' 
    795     )) . 
     795    ]) . 
    796796    '</p>' . 
    797797 
     
    806806    '<p class="area"><label for="comment_content" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . 
    807807    __('Comment:') . '</label> ' . 
    808     form::textarea('comment_content', 50, 8, array('extra_html' => 'required placeholder="' . __('Comment') . '"')) . 
     808    form::textarea('comment_content', 50, 8, ['extra_html' => 'required placeholder="' . __('Comment') . '"']) . 
    809809    '</p>' . 
    810810 
     
    824824    -------------------------------------------------------- */ 
    825825 
    826     $params     = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    827     $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 
     826    $params     = ['post_id' => $post_id, 'order' => 'comment_dt ASC']; 
     827    $trackbacks = $core->blog->getComments(array_merge($params, ['comment_trackback' => 1])); 
    828828 
    829829    # Actions combo box 
     
    860860        form::combo('action', $combo_action) . 
    861861        form::hidden('id', $post_id) . 
    862         form::hidden(array('section'), 'trackbacks') . 
     862        form::hidden(['section'], 'trackbacks') . 
    863863        $core->formNonce() . 
    864864        '<input type="submit" value="' . __('ok') . '" /></p>' . 
     
    875875        echo 
    876876        '<h3>' . __('Ping blogs') . '</h3>' . 
    877         '<form action="' . $core->adminurl->get("admin.post", array('id' => $post_id)) . '" id="trackback-form" method="post">' . 
     877        '<form action="' . $core->adminurl->get("admin.post", ['id' => $post_id]) . '" id="trackback-form" method="post">' . 
    878878        '<p><label for="tb_urls" class="area">' . __('URLs to ping:') . '</label>' . 
    879879        form::textarea('tb_urls', 60, 5, $tb_urls) . 
     
    888888            (empty($_GET['tb_auto']) ? 
    889889            '&nbsp;&nbsp;<a class="button" href="' . 
    890             $core->adminurl->get("admin.post", array('id' => $post_id, 'tb_auto' => 1, 'tb' => 1)) . 
     890            $core->adminurl->get("admin.post", ['id' => $post_id, 'tb_auto' => 1, 'tb' => 1]) . 
    891891            '">' . __('Auto discover ping URLs') . '</a>' 
    892892            : '') . 
Note: See TracChangeset for help on using the changeset viewer.

Sites map