Changeset 3874:ab8368569446 for plugins/simpleMenu/index.php
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
plugins/simpleMenu/index.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/simpleMenu/index.php
r3731 r3874 23 23 24 24 # Liste des catégories 25 $categories_label = array();26 $rs = $core->blog->getCategories( array('post_type' => 'post'));25 $categories_label = []; 26 $rs = $core->blog->getCategories(['post_type' => 'post']); 27 27 $categories_combo = dcAdminCombos::getCategoriesCombo($rs, false, true); 28 28 $rs->moveStart(); … … 33 33 # Liste des langues utilisées 34 34 $langs_combo = dcAdminCombos::getLangscombo( 35 $core->blog->getLangs( array('order' => 'asc'))35 $core->blog->getLangs(['order' => 'asc']) 36 36 ); 37 37 38 38 # Liste des mois d'archive 39 $rs = $core->blog->getDates( array('type' => 'month'));39 $rs = $core->blog->getDates(['type' => 'month']); 40 40 $months_combo = array_merge( 41 array(__('All months') => '-'),41 [__('All months') => '-'], 42 42 dcAdmincombos::getDatesCombo($rs) 43 43 ); … … 57 57 58 58 # Liste des pages -- Doit être pris en charge plus tard par le plugin ? 59 $pages_combo = array();59 $pages_combo = []; 60 60 try { 61 $rs = $core->blog->getPosts( array('post_type' => 'page'));61 $rs = $core->blog->getPosts(['post_type' => 'page']); 62 62 while ($rs->fetch()) { 63 63 $pages_combo[$rs->post_title] = $rs->getURL(); … … 67 67 68 68 # Liste des tags -- Doit être pris en charge plus tard par le plugin ? 69 $tags_combo = array();69 $tags_combo = []; 70 70 try { 71 $rs = $core->meta->getMetadata( array('meta_type' => 'tag'));71 $rs = $core->meta->getMetadata(['meta_type' => 'tag']); 72 72 $tags_combo[__('All tags')] = '-'; 73 73 while ($rs->fetch()) { … … 79 79 # Liste des types d'item de menu 80 80 $items = new ArrayObject(); 81 $items['home'] = new ArrayObject( array(__('Home'), false));81 $items['home'] = new ArrayObject([__('Home'), false]); 82 82 83 83 if (count($langs_combo) > 1) { 84 $items['lang'] = new ArrayObject( array(__('Language'), true));84 $items['lang'] = new ArrayObject([__('Language'), true]); 85 85 } 86 86 if (count($categories_combo)) { 87 $items['category'] = new ArrayObject( array(__('Category'), true));87 $items['category'] = new ArrayObject([__('Category'), true]); 88 88 } 89 89 if (count($months_combo) > 1) { 90 $items['archive'] = new ArrayObject( array(__('Archive'), true));90 $items['archive'] = new ArrayObject([__('Archive'), true]); 91 91 } 92 92 if ($core->plugins->moduleExists('pages')) { 93 93 if (count($pages_combo)) { 94 $items['pages'] = new ArrayObject( array(__('Page'), true));94 $items['pages'] = new ArrayObject([__('Page'), true]); 95 95 } 96 96 … … 98 98 if ($core->plugins->moduleExists('tags')) { 99 99 if (count($tags_combo) > 1) { 100 $items['tags'] = new ArrayObject( array(__('Tags'), true));100 $items['tags'] = new ArrayObject([__('Tags'), true]); 101 101 } 102 102 … … 104 104 105 105 # --BEHAVIOR-- adminSimpleMenuAddType 106 # Should add an item to $items[<id>] as an array(<label>,<optional step (true or false)>)106 # Should add an item to $items[<id>] as an [<label>,<optional step (true or false)>] 107 107 $core->callBehavior('adminSimpleMenuAddType', $items); 108 108 109 $items['special'] = new ArrayObject( array(__('User defined'), false));110 111 $items_combo = array();109 $items['special'] = new ArrayObject([__('User defined'), false]); 110 111 $items_combo = []; 112 112 foreach ($items as $k => $v) { 113 113 $items_combo[$v[0]] = $k; … … 117 117 $menu = $core->blog->settings->system->get('simpleMenu'); 118 118 if (!is_array($menu)) { 119 $menu = array();119 $menu = []; 120 120 } 121 121 … … 227 227 # Should set if necessary $item_select_label (displayed on further admin step only) 228 228 $core->callBehavior('adminSimpleMenuBeforeEdit', $item_type, $item_select, 229 array(&$item_label, &$item_descr, &$item_url, &$item_select_label));229 [&$item_label, &$item_descr, &$item_url, &$item_select_label]); 230 230 break; 231 231 } … … 236 236 if (($item_label != '') && ($item_url != '')) { 237 237 // Add new item menu in menu array 238 $menu[] = array(238 $menu[] = [ 239 239 'label' => $item_label, 240 240 'descr' => $item_descr, 241 241 'url' => $item_url, 242 242 'targetBlank' => $item_targetBlank 243 );243 ]; 244 244 245 245 // Save menu in blog settings … … 269 269 $menu[$v]['label'] = ''; 270 270 } 271 $newmenu = array();271 $newmenu = []; 272 272 foreach ($menu as $k => $v) { 273 273 if ($v['label']) { 274 $newmenu[] = array(274 $newmenu[] = [ 275 275 'label' => $v['label'], 276 276 'descr' => $v['descr'], 277 277 'url' => $v['url'], 278 278 'targetBlank' => $v['targetBlank'] 279 );279 ]; 280 280 } 281 281 } … … 311 311 312 312 } 313 $newmenu = array();313 $newmenu = []; 314 314 for ($i = 0; $i < count($_POST['items_label']); $i++) { 315 $newmenu[] = array(315 $newmenu[] = [ 316 316 'label' => $_POST['items_label'][$i], 317 317 'descr' => $_POST['items_descr'][$i], 318 318 'url' => $_POST['items_url'][$i], 319 319 'targetBlank' => (empty($_POST['items_targetBlank' . $i])) ? false : true 320 );320 ]; 321 321 } 322 322 $menu = $newmenu; … … 334 334 335 335 # Order menu items 336 $order = array();336 $order = []; 337 337 if (empty($_POST['im_order']) && !empty($_POST['order'])) { 338 338 $order = $_POST['order']; … … 349 349 if (!empty($_POST['updateaction']) && !empty($order)) { 350 350 try { 351 $newmenu = array();351 $newmenu = []; 352 352 foreach ($order as $i => $k) { 353 $newmenu[] = array(353 $newmenu[] = [ 354 354 'label' => $menu[$k]['label'], 355 355 'descr' => $menu[$k]['descr'], 356 'url' => $menu[$k]['url'] );356 'url' => $menu[$k]['url']]; 357 357 } 358 358 $menu = $newmenu; … … 413 413 } 414 414 echo dcPage::breadcrumb( 415 array(415 [ 416 416 html::escapeHTML($core->blog->name) => '', 417 417 $page_title => $p_url, 418 418 __('Add item') => '', 419 419 $step_label => '' 420 ),421 array(422 'hl_pos' => -2 )420 ], 421 [ 422 'hl_pos' => -2] 423 423 ) . 424 424 dcPage::notices(); 425 425 } else { 426 426 echo dcPage::breadcrumb( 427 array(427 [ 428 428 html::escapeHTML($core->blog->name) => '', 429 429 $page_title => '' 430 )) .430 ]) . 431 431 dcPage::notices(); 432 432 } … … 488 488 echo '<p class="field"><label for="item_label" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . 489 489 __('Label of item menu:') . '</label>' . 490 form::field('item_label', 20, 255, array(490 form::field('item_label', 20, 255, [ 491 491 'default' => $item_label, 492 492 'extra_html' => 'required placeholder="' . __('Label') . '"' 493 )) .493 ]) . 494 494 '</p>'; 495 495 echo '<p class="field"><label for="item_descr" class="classic">' . … … 497 497 echo '<p class="field"><label for="item_url" class="classic required"><abbr title="' . __('Required field') . '">*</abbr> ' . 498 498 __('URL of item menu:') . '</label>' . 499 form::field('item_url', 40, 255, array(499 form::field('item_url', 40, 255, [ 500 500 'default' => $item_url, 501 501 'extra_html' => 'required placeholder="' . __('URL') . '"' 502 )) .502 ]) . 503 503 '</p>'; 504 504 echo form::hidden('item_type', $item_type) . form::hidden('item_select', $item_select); … … 567 567 $count++; 568 568 echo '<td class="handle minimal">' . 569 form::number( array('order[' . $i . ']'), array(569 form::number(['order[' . $i . ']'], [ 570 570 'min' => 1, 571 571 'default' => $count, 572 572 'class' => 'position', 573 573 'extra_html' => 'title="' . sprintf(__('position of %s'), html::escapeHTML(__($m['label']))) . '"' 574 )) .575 form::hidden( array('dynorder[]', 'dynorder-' . $i), $i) . '</td>';576 echo '<td class="minimal">' . form::checkbox( array('items_selected[]', 'ims-' . $i), $i) . '</td>';577 echo '<td class="nowrap" scope="row">' . form::field( array('items_label[]', 'iml-' . $i), '', 255, html::escapeHTML(__($m['label']))) . '</td>';578 echo '<td class="nowrap">' . form::field( array('items_descr[]', 'imd-' . $i), '30', 255, html::escapeHTML(__($m['descr']))) . '</td>';579 echo '<td class="nowrap">' . form::field( array('items_url[]', 'imu-' . $i), '30', 255, html::escapeHTML($m['url'])) . '</td>';574 ]) . 575 form::hidden(['dynorder[]', 'dynorder-' . $i], $i) . '</td>'; 576 echo '<td class="minimal">' . form::checkbox(['items_selected[]', 'ims-' . $i], $i) . '</td>'; 577 echo '<td class="nowrap" scope="row">' . form::field(['items_label[]', 'iml-' . $i], '', 255, html::escapeHTML(__($m['label']))) . '</td>'; 578 echo '<td class="nowrap">' . form::field(['items_descr[]', 'imd-' . $i], '30', 255, html::escapeHTML(__($m['descr']))) . '</td>'; 579 echo '<td class="nowrap">' . form::field(['items_url[]', 'imu-' . $i], '30', 255, html::escapeHTML($m['url'])) . '</td>'; 580 580 echo '<td class="nowrap">' . form::checkbox('items_targetBlank' . $i, 'blank', $targetBlank) . '</td>'; 581 581 } else {
Note: See TracChangeset
for help on using the changeset viewer.
