Changeset 3874:ab8368569446 for inc/admin/lib.moduleslist.php
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.moduleslist.php
r3812 r3874 23 23 24 24 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 */ 26 26 27 27 protected $list_id = 'unknow'; /**< @var string Current list ID */ 28 protected $data = array(); /**< @var array Current modules */28 protected $data = []; /**< @var array Current modules */ 29 29 30 30 protected $config_module = ''; /**< @var string Module ID to configure */ … … 42 42 43 43 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 */ 45 45 protected $nav_special = 'other'; /**< @var string Text for other special index */ 46 46 … … 78 78 public function setList($id) 79 79 { 80 $this->data = array();80 $this->data = []; 81 81 $this->page_tab = ''; 82 82 $this->list_id = $id; … … 299 299 { 300 300 $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]); 302 302 303 303 return $this; … … 326 326 327 327 # Fetch modules required field 328 $indexes = array();328 $indexes = []; 329 329 foreach ($this->data as $id => $module) { 330 330 if (!isset($module[$this->sort_field])) { … … 341 341 } 342 342 343 $buttons = array();343 $buttons = []; 344 344 foreach ($this->nav_list as $char) { 345 345 # Selected letter … … 412 412 public function setModules($modules) 413 413 { 414 $this->data = array();414 $this->data = []; 415 415 if (!empty($modules) && is_array($modules)) { 416 416 foreach ($modules as $id => $module) { … … 447 447 return array_merge( 448 448 # Default values 449 array(449 [ 450 450 'desc' => '', 451 451 'author' => '', … … 465 465 'score' => 0, 466 466 'type' => null, 467 'require' => array(),468 'settings' => array()469 ),467 'require' => [], 468 'settings' => [] 469 ], 470 470 # Module's values 471 471 $module, 472 472 # Clean up values 473 array(473 [ 474 474 'id' => $id, 475 475 'sid' => self::sanitizeString($id), … … 477 477 'name' => $name, 478 478 'sname' => self::sanitizeString($name) 479 )479 ] 480 480 ); 481 481 } … … 504 504 public static function sortModules($modules, $field, $asc = true) 505 505 { 506 $origin = $sorter = array();506 $origin = $sorter = []; 507 507 508 508 foreach ($modules as $id => $module) { … … 528 528 * @return adminModulesList self instance 529 529 */ 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) 531 531 { 532 532 echo … … 612 612 echo 613 613 '<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)) . 615 615 '</td>'; 616 616 } … … 642 642 echo 643 643 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)); 645 645 } 646 646 echo … … 732 732 } 733 733 734 $more = array();734 $more = []; 735 735 if (!empty($module['details'])) { 736 736 $more[] = '<a class="module-details" href="' . $module['details'] . '">' . __('Details') . '</a>'; … … 821 821 public static function getSettingsUrls($core, $id, $check = false, $self = true) 822 822 { 823 $st = array();823 $st = []; 824 824 825 825 $mr = $core->plugins->moduleRoot($id); … … 831 831 $core->auth->isSuperAdmin() || 832 832 $core->auth->check($core->plugins->moduleInfo($id, 'permissions'), $core->blog->id)) { 833 $params = array('module' => $id, 'conf' => '1');833 $params = ['module' => $id, 'conf' => '1']; 834 834 if (!$core->plugins->moduleInfo($id, 'standalone_config') && !$self) { 835 835 $params['redir'] = $core->adminurl->get('admin.plugin.' . $id); … … 890 890 protected function getActions($id, $module, $actions) 891 891 { 892 $submits = array();892 $submits = []; 893 893 894 894 # Use loop to keep requested order … … 952 952 protected function getGlobalActions($actions, $with_selection = false) 953 953 { 954 $submits = array();954 $submits = []; 955 955 956 956 # Use loop to keep requested order … … 1015 1015 } 1016 1016 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']) : []; 1018 1018 1019 1019 if ($this->core->auth->isSuperAdmin() && !empty($_POST['delete'])) { … … 1287 1287 '<input type="file" name="pkg_file" id="pkg_file" required /></p>' . 1288 1288 '<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 [ 1291 1291 'extra_html' => 'required placeholder="' . __('Password') . '"', 1292 1292 'autocomplete' => 'current-password' 1293 )1293 ] 1294 1294 ) . '</p>' . 1295 1295 '<p><input type="submit" name="upload_pkg" value="' . __('Upload') . '" />' . … … 1302 1302 '<h4>' . __('Download a zip file') . '</h4>' . 1303 1303 '<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, [ 1305 1305 'extra_html' => 'required placeholder="' . __('URL') . '"' 1306 )) .1306 ]) . 1307 1307 '</p>' . 1308 1308 '<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 [ 1311 1311 'extra_html' => 'required placeholder="' . __('Password') . '"', 1312 1312 'autocomplete' => 'current-password' 1313 )1313 ] 1314 1314 ) . '</p>' . 1315 1315 '<p><input type="submit" name="fetch_pkg" value="' . __('Download') . '" />' . … … 1479 1479 } 1480 1480 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) 1482 1482 { 1483 1483 echo … … 1519 1519 $line .= 1520 1520 '<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)) . 1522 1522 html::escapeHTML($module['name']) . 1523 1523 '</label>'; … … 1525 1525 } else { 1526 1526 $line .= 1527 form::hidden( array('modules[' . $count . ']'), html::escapeHTML($id)) .1527 form::hidden(['modules[' . $count . ']'], html::escapeHTML($id)) . 1528 1528 html::escapeHTML($module['name']); 1529 1529 } … … 1569 1569 $line .= 1570 1570 '<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)) . 1572 1572 html::escapeHTML($module['name']) . 1573 1573 '</label>'; 1574 1574 } else { 1575 1575 $line .= 1576 form::hidden( array('modules[' . $count . ']'), html::escapeHTML($id)) .1576 form::hidden(['modules[' . $count . ']'], html::escapeHTML($id)) . 1577 1577 html::escapeHTML($module['name']); 1578 1578 } … … 1712 1712 protected function getActions($id, $module, $actions) 1713 1713 { 1714 $submits = array();1714 $submits = []; 1715 1715 1716 1716 $this->core->blog->settings->addNamespace('system'); … … 1732 1732 protected function getGlobalActions($actions, $with_selection = false) 1733 1733 { 1734 $submits = array();1734 $submits = []; 1735 1735 1736 1736 foreach ($actions as $action) { … … 1768 1768 } 1769 1769 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']) : []; 1771 1771 1772 1772 if (!empty($_POST['select'])) {
Note: See TracChangeset
for help on using the changeset viewer.