Changeset 3874:ab8368569446 for inc/admin/actions
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- Location:
- inc/admin/actions
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/actions/class.dcaction.php
r3731 r3874 64 64 * @return mixed Value. 65 65 */ 66 public function __construct($core, $uri, $redirect_args = array())66 public function __construct($core, $uri, $redirect_args = []) 67 67 { 68 68 $this->core = $core; 69 69 $this->actions = new ArrayObject(); 70 $this->combo = array();70 $this->combo = []; 71 71 $this->uri = $uri; 72 72 $this->redir_args = $redirect_args; 73 $this->redirect_fields = array();73 $this->redirect_fields = []; 74 74 $this->action = ''; 75 75 $this->cb_title = __('Title'); 76 $this->entries = array();76 $this->entries = []; 77 77 $this->from = new ArrayObject($_POST); 78 78 $this->field_entries = 'entries'; … … 122 122 $values = array_values($a); 123 123 if (!isset($this->combo[$k])) { 124 $this->combo[$k] = array();124 $this->combo[$k] = []; 125 125 } 126 126 $this->combo[$k] = array_merge($this->combo[$k], $a); 127 127 } elseif ($a instanceof formSelectOption) { 128 $values = array($a->value);128 $values = [$a->value]; 129 129 $this->combo[$k] = $a->value; 130 130 } else { 131 $values = array($a);131 $values = [$a]; 132 132 $this->combo[$k] = $a; 133 133 } … … 193 193 $ret = ''; 194 194 foreach ($this->redir_args as $k => $v) { 195 $ret .= form::hidden( array($k), $v);195 $ret .= form::hidden([$k], $v); 196 196 } 197 197 if ($with_ids) { … … 245 245 * @return string the redirection url 246 246 */ 247 public function getRedirection($with_selected_entries = false, $params = array())247 public function getRedirection($with_selected_entries = false, $params = []) 248 248 { 249 249 $redir_args = array_merge($params, $this->redir_args); … … 265 265 * @access public 266 266 */ 267 public function redirect($with_selected_entries = false, $params = array())267 public function redirect($with_selected_entries = false, $params = []) 268 268 { 269 269 http::redirect($this->getRedirection($with_selected_entries, $params)); … … 357 357 $ret .= 358 358 '<tr><td class="minimal">' . 359 form::checkbox( array($this->field_entries . '[]'), $id, array(359 form::checkbox([$this->field_entries . '[]'], $id, [ 360 360 'checked' => true 361 )) .361 ]) . 362 362 '</td>' . 363 363 '<td>' . $title . '</td></tr>'; -
inc/admin/actions/class.dcactionblogs.php
r3731 r3874 12 12 class dcBlogsActionsPage extends dcActionsPage 13 13 { 14 public function __construct($core, $uri, $redirect_args = array())14 public function __construct($core, $uri, $redirect_args = []) 15 15 { 16 16 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']; 18 18 $this->field_entries = 'blogs'; 19 19 $this->title_cb = __('Blogs'); … … 57 57 $this->core->error->add($e->getMessage()); 58 58 $this->beginPage(dcPage::breadcrumb( 59 array(59 [ 60 60 html::escapeHTML($this->core->blog->name) => '', 61 61 __('Blogs') => $this->core->adminurl->get('admin.blogs'), 62 62 __('Blogs actions') => '' 63 ))63 ]) 64 64 ); 65 65 $this->endPage(); … … 72 72 $ret .= 73 73 '<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 [ 76 76 'checked' => true 77 )) .77 ]) . 78 78 '</td>' . 79 79 '<td>' . $res['blog'] . '</td>' . … … 90 90 protected function fetchEntries($from) 91 91 { 92 $params = array();92 $params = []; 93 93 if (!empty($from['blogs'])) { 94 94 $params['blog_id'] = $from['blogs']; … … 97 97 $bl = $this->core->getBlogs($params); 98 98 while ($bl->fetch()) { 99 $this->entries[$bl->blog_id] = array(99 $this->entries[$bl->blog_id] = [ 100 100 'blog' => $bl->blog_id, 101 101 'name' => $bl->blog_name 102 );102 ]; 103 103 } 104 104 $this->rs = $bl; … … 115 115 116 116 $ap->addAction( 117 array(__('Status') => array(117 [__('Status') => [ 118 118 __('Set online') => 'online', 119 119 __('Set offline') => 'offline', 120 120 __('Set as removed') => 'remove' 121 )),122 array('dcDefaultBlogActions', 'doChangeBlogStatus')121 ]], 122 ['dcDefaultBlogActions', 'doChangeBlogStatus'] 123 123 ); 124 124 $ap->addAction( 125 array(__('Delete') => array(126 __('Delete') => 'delete' )),127 array('dcDefaultBlogActions', 'doDeleteBlog')125 [__('Delete') => [ 126 __('Delete') => 'delete']], 127 ['dcDefaultBlogActions', 'doDeleteBlog'] 128 128 ); 129 129 } … … 175 175 } 176 176 177 $ids = array();177 $ids = []; 178 178 foreach ($ap_ids as $id) { 179 179 if ($id == $core->blog->id) { -
inc/admin/actions/class.dcactioncomments.php
r3731 r3874 12 12 class dcCommentsActionsPage extends dcActionsPage 13 13 { 14 public function __construct($core, $uri, $redirect_args = array())14 public function __construct($core, $uri, $redirect_args = []) 15 15 { 16 16 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']; 19 19 $this->field_entries = 'comments'; 20 20 $this->title_cb = __('Comments'); … … 59 59 $this->core->error->add($e->getMessage()); 60 60 $this->beginPage(dcPage::breadcrumb( 61 array(61 [ 62 62 html::escapeHTML($this->core->blog->name) => '', 63 63 __('Comments') => $this->core->adminurl->get('admin.comments'), 64 64 __('Comments actions') => '' 65 ))65 ]) 66 66 ); 67 67 $this->endPage(); … … 85 85 $ret .= 86 86 '<tr><td class="minimal">' . 87 form::checkbox( array($this->field_entries . '[]'), $id,88 array(87 form::checkbox([$this->field_entries . '[]'], $id, 88 [ 89 89 'checked' => true 90 )) .90 ]) . 91 91 '</td>' . 92 92 '<td>' . $title['author'] . '</td><td>' . $title['title'] . '</td></tr>'; … … 98 98 protected function fetchEntries($from) 99 99 { 100 $params = array();100 $params = []; 101 101 if (!empty($from['comments'])) { 102 102 $comments = $from['comments']; … … 116 116 $co = $this->core->blog->getComments($params); 117 117 while ($co->fetch()) { 118 $this->entries[$co->comment_id] = array(118 $this->entries[$co->comment_id] = [ 119 119 'title' => $co->post_title, 120 120 'author' => $co->comment_author 121 );121 ]; 122 122 } 123 123 $this->rs = $co; … … 131 131 if ($core->auth->check('publish,contentadmin', $core->blog->id)) { 132 132 $ap->addAction( 133 array(__('Status') => array(133 [__('Status') => [ 134 134 __('Publish') => 'publish', 135 135 __('Unpublish') => 'unpublish', 136 136 __('Mark as pending') => 'pending', 137 137 __('Mark as junk') => 'junk' 138 )),139 array('dcDefaultCommentActions', 'doChangeCommentStatus')138 ]], 139 ['dcDefaultCommentActions', 'doChangeCommentStatus'] 140 140 ); 141 141 } … … 143 143 if ($core->auth->check('delete,contentadmin', $core->blog->id)) { 144 144 $ap->addAction( 145 array(__('Delete') => array(146 __('Delete') => 'delete' )),147 array('dcDefaultCommentActions', 'doDeleteComment')145 [__('Delete') => [ 146 __('Delete') => 'delete']], 147 ['dcDefaultCommentActions', 'doDeleteComment'] 148 148 ); 149 149 } … … 158 158 159 159 if ($ip_filter_active) { 160 $blacklist_actions = array(__('Blacklist IP') => 'blacklist');160 $blacklist_actions = [__('Blacklist IP') => 'blacklist']; 161 161 if ($core->auth->isSuperAdmin()) { 162 162 $blacklist_actions[__('Blacklist IP (global)')] = 'blacklist_global'; … … 164 164 165 165 $ap->addAction( 166 array(__('IP address') => $blacklist_actions),167 array('dcDefaultCommentActions', 'doBlacklistIP')166 [__('IP address') => $blacklist_actions], 167 ['dcDefaultCommentActions', 'doBlacklistIP'] 168 168 ); 169 169 } -
inc/admin/actions/class.dcactionposts.php
r3731 r3874 12 12 class dcPostsActionsPage extends dcActionsPage 13 13 { 14 public function __construct($core, $uri, $redirect_args = array())14 public function __construct($core, $uri, $redirect_args = []) 15 15 { 16 16 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']; 19 19 $this->loadDefaults(); 20 20 } … … 61 61 $this->core->error->add($e->getMessage()); 62 62 $this->beginPage(dcPage::breadcrumb( 63 array(63 [ 64 64 html::escapeHTML($this->core->blog->name) => '', 65 65 $this->getCallerTitle() => $this->getRedirection(true), 66 66 __('Entries actions') => '' 67 ))67 ]) 68 68 ); 69 69 $this->endPage(); … … 72 72 protected function fetchEntries($from) 73 73 { 74 $params = array();74 $params = []; 75 75 if (!empty($from['entries'])) { 76 76 $entries = $from['entries']; … … 107 107 if ($core->auth->check('publish,contentadmin', $core->blog->id)) { 108 108 $ap->addAction( 109 array(__('Status') => array(109 [__('Status') => [ 110 110 __('Publish') => 'publish', 111 111 __('Unpublish') => 'unpublish', 112 112 __('Schedule') => 'schedule', 113 113 __('Mark as pending') => 'pending' 114 )),115 array('dcDefaultPostActions', 'doChangePostStatus')114 ]], 115 ['dcDefaultPostActions', 'doChangePostStatus'] 116 116 ); 117 117 } 118 118 $ap->addAction( 119 array(__('Mark') => array(119 [__('Mark') => [ 120 120 __('Mark as selected') => 'selected', 121 121 __('Mark as unselected') => 'unselected' 122 )),123 array('dcDefaultPostActions', 'doUpdateSelectedPost')122 ]], 123 ['dcDefaultPostActions', 'doUpdateSelectedPost'] 124 124 ); 125 125 $ap->addAction( 126 array(__('Change') => array(126 [__('Change') => [ 127 127 __('Change category') => 'category' 128 )),129 array('dcDefaultPostActions', 'doChangePostCategory')128 ]], 129 ['dcDefaultPostActions', 'doChangePostCategory'] 130 130 ); 131 131 $ap->addAction( 132 array(__('Change') => array(132 [__('Change') => [ 133 133 __('Change language') => 'lang' 134 )),135 array('dcDefaultPostActions', 'doChangePostLang')134 ]], 135 ['dcDefaultPostActions', 'doChangePostLang'] 136 136 ); 137 137 if ($core->auth->check('admin', $core->blog->id)) { 138 138 $ap->addAction( 139 array(__('Change') => array(140 __('Change author') => 'author' )),141 array('dcDefaultPostActions', 'doChangePostAuthor')139 [__('Change') => [ 140 __('Change author') => 'author']], 141 ['dcDefaultPostActions', 'doChangePostAuthor'] 142 142 ); 143 143 } 144 144 if ($core->auth->check('delete,contentadmin', $core->blog->id)) { 145 145 $ap->addAction( 146 array(__('Delete') => array(147 __('Delete') => 'delete' )),148 array('dcDefaultPostActions', 'doDeletePost')146 [__('Delete') => [ 147 __('Delete') => 'delete']], 148 ['dcDefaultPostActions', 'doDeletePost'] 149 149 ); 150 150 } … … 281 281 $ap->beginPage( 282 282 dcPage::breadcrumb( 283 array(283 [ 284 284 html::escapeHTML($core->blog->name) => '', 285 285 $ap->getCallerTitle() => $ap->getRedirection(true), 286 286 __('Change category for this selection') => '' 287 )));287 ])); 288 288 # categories list 289 289 # Getting categories … … 295 295 $ap->getCheckboxes() . 296 296 '<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); 298 298 299 299 if ($core->auth->check('categories', $core->blog->id)) { … … 312 312 $core->formNonce() . 313 313 $ap->getHiddenFields() . 314 form::hidden( array('action'), 'category') .314 form::hidden(['action'], 'category') . 315 315 '<input type="submit" value="' . __('Save') . '" /></p>' . 316 316 '</form>'; … … 349 349 $usersList = ''; 350 350 if ($core->auth->check('admin', $core->blog->id)) { 351 $params = array(351 $params = [ 352 352 'limit' => 100, 353 353 'order' => 'nb_post DESC' 354 );354 ]; 355 355 $rs = $core->getUsers($params); 356 356 $rsStatic = $rs->toStatic(); … … 364 364 $ap->beginPage( 365 365 dcPage::breadcrumb( 366 array(366 [ 367 367 html::escapeHTML($core->blog->name) => '', 368 368 $ap->getCallerTitle() => $ap->getRedirection(true), 369 __('Change author for this selection') => '' )),369 __('Change author for this selection') => '']), 370 370 dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . 371 371 '<script type="text/javascript">' . "\n" . … … 382 382 echo 383 383 $core->formNonce() . $ap->getHiddenFields() . 384 form::hidden( array('action'), 'author') .384 form::hidden(['action'], 'author') . 385 385 '<input type="submit" value="' . __('Save') . '" /></p>' . 386 386 '</form>'; … … 412 412 $ap->beginPage( 413 413 dcPage::breadcrumb( 414 array(414 [ 415 415 html::escapeHTML($core->blog->name) => '', 416 416 $ap->getCallerTitle() => $ap->getRedirection(true), 417 417 __('Change language for this selection') => '' 418 )));418 ])); 419 419 # lang list 420 420 # Languages combo 421 $rs = $core->blog->getLangs( array('order' => 'asc'));421 $rs = $core->blog->getLangs(['order' => 'asc']); 422 422 $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)]; 424 424 while ($rs->fetch()) { 425 425 if (isset($all_langs[$rs->post_lang])) { … … 442 442 echo 443 443 $core->formNonce() . $ap->getHiddenFields() . 444 form::hidden( array('action'), 'lang') .444 form::hidden(['action'], 'lang') . 445 445 '<input type="submit" value="' . __('Save') . '" /></p>' . 446 446 '</form>';
Note: See TracChangeset
for help on using the changeset viewer.