Changeset 3874:ab8368569446 for admin/media.php
- Timestamp:
- 09/14/18 12:16:17 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/media.php
r3731 r3874 14 14 $post_id = !empty($_REQUEST['post_id']) ? (integer) $_REQUEST['post_id'] : null; 15 15 if ($post_id) { 16 $post = $core->blog->getPosts( array('post_id' => $post_id, 'post_type' => ''));16 $post = $core->blog->getPosts(['post_id' => $post_id, 'post_type' => '']); 17 17 if ($post->isEmpty()) { 18 18 $post_id = null; … … 58 58 59 59 # Sort combo 60 $sort_combo = array(60 $sort_combo = [ 61 61 __('By names, in ascending order') => 'name-asc', 62 62 __('By names, in descending order') => 'name-desc', 63 63 __('By dates, in ascending order') => 'date-asc', 64 64 __('By dates, in descending order') => 'date-desc' 65 );65 ]; 66 66 67 67 if (!empty($_GET['file_mode'])) { … … 90 90 $select = !empty($_REQUEST['select']) ? (integer) $_REQUEST['select'] : 0; // 0 : none, 1 : single media, >1 : multiple medias 91 91 92 $page_url_params = new ArrayObject( array('popup' => $popup, 'select' => $select, 'post_id' => $post_id, 'link_type' => $link_type));92 $page_url_params = new ArrayObject(['popup' => $popup, 'select' => $select, 'post_id' => $post_id, 'link_type' => $link_type]); 93 93 if ($d) { 94 94 $page_url_params['d'] = $d; … … 105 105 106 106 if ($popup) { 107 $open_f = array('dcPage', 'openPopup');108 $close_f = array('dcPage', 'closePopup');107 $open_f = ['dcPage', 'openPopup']; 108 $close_f = ['dcPage', 'closePopup']; 109 109 } else { 110 $open_f = array('dcPage', 'open');110 $open_f = ['dcPage', 'open']; 111 111 $close_f = function () { 112 112 dcPage::helpBlock('core_media'); … … 159 159 if ($f->d) { 160 160 // Folder 161 $link = $core->adminurl->get('admin.media', array_merge($page_url_params, array('d' => html::sanitizeURL($f->relname))));161 $link = $core->adminurl->get('admin.media', array_merge($page_url_params, ['d' => html::sanitizeURL($f->relname)])); 162 162 if ($f->parent) { 163 163 $fname = '..'; … … 169 169 // Item 170 170 $params = new ArrayObject( 171 array(171 [ 172 172 'id' => $f->media_id, 173 173 'plugin_id' => $plugin_id, … … 176 176 'post_id' => $post_id, 177 177 'link_type' => $link_type 178 )178 ] 179 179 ); 180 180 $core->callBehavior('adminMediaURLParams', $params); … … 199 199 } else { 200 200 // Multiple media selection checkbox 201 $act .= form::checkbox( array('medias[]', 'media_' . rawurlencode($file)), $file);201 $act .= form::checkbox(['medias[]', 'media_' . rawurlencode($file)], $file); 202 202 } 203 203 } else { … … 208 208 '<a class="attach-media" title="' . __('Attach this file to entry') . '" href="' . 209 209 $core->adminurl->get("admin.post.media", 210 array('media_id' => $f->media_id, 'post_id' => $post_id, 'attach' => 1, 'link_type' => $link_type)) .210 ['media_id' => $f->media_id, 'post_id' => $post_id, 'attach' => 1, 'link_type' => $link_type]) . 211 211 '">' . 212 212 '<img src="images/plus.png" alt="' . __('Attach this file to entry') . '"/>' . … … 225 225 if ($select < 2) { 226 226 // Already set for multiple media selection 227 $act .= form::checkbox( array('medias[]', 'media_' . rawurlencode($file)), $file);227 $act .= form::checkbox(['medias[]', 'media_' . rawurlencode($file)], $file); 228 228 } 229 229 } else { … … 261 261 // Show player if relevant 262 262 if ($file_type[0] == 'audio') { 263 $lst .= '<li>' . dcMedia::audioPlayer($f->type, $f->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), null, $core->blog->settings->system->media_flash_fallback, false) . '</li>';263 $lst .= '<li>' . dcMedia::audioPlayer($f->type, $f->file_url, $core->adminurl->get("admin.home", ['pf' => 'player_mp3.swf']), null, $core->blog->settings->system->media_flash_fallback, false) . '</li>'; 264 264 } 265 265 … … 321 321 $fav_dirs = $core->auth->user_prefs->interface->media_fav_dirs; 322 322 if (!is_array($fav_dirs)) { 323 $fav_dirs = array();323 $fav_dirs = []; 324 324 } 325 325 if (!in_array($fav_dir, $fav_dirs) && $_GET['fav'] == 'y') { … … 347 347 $last_dirs = $core->auth->user_prefs->interface->media_last_dirs; 348 348 if (!is_array($last_dirs)) { 349 $last_dirs = array();349 $last_dirs = []; 350 350 } 351 351 if (!in_array($recent_dir, $last_dirs)) { … … 383 383 if ($dir && !empty($_FILES['upfile'])) { 384 384 // only one file per request : @see option singleFileUploads in admin/js/jsUpload/jquery.fileupload 385 $upfile = array('name' => $_FILES['upfile']['name'][0],385 $upfile = ['name' => $_FILES['upfile']['name'][0], 386 386 'type' => $_FILES['upfile']['type'][0], 387 387 'tmp_name' => $_FILES['upfile']['tmp_name'][0], … … 389 389 'size' => $_FILES['upfile']['size'][0], 390 390 'title' => html::escapeHTML($_FILES['upfile']['name'][0]) 391 );391 ]; 392 392 393 393 if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) { 394 394 header('Content-type: application/json'); 395 $message = array();395 $message = []; 396 396 397 397 try { … … 399 399 $new_file_id = $core->media->uploadFile($upfile['tmp_name'], $upfile['name'], $upfile['title']); 400 400 401 $message['files'][] = array(401 $message['files'][] = [ 402 402 'name' => $upfile['name'], 403 403 'size' => $upfile['size'], 404 404 'html' => $mediaItemLine($core->media->getFile($new_file_id), 1, $query) 405 );405 ]; 406 406 } catch (Exception $e) { 407 $message['files'][] = array('name' => $upfile['name'],407 $message['files'][] = ['name' => $upfile['name'], 408 408 'size' => $upfile['size'], 409 409 'error' => $e->getMessage() 410 );410 ]; 411 411 } 412 412 echo json_encode($message); … … 486 486 call_user_func($open_f, __('Media manager'), '', 487 487 dcPage::breadcrumb( 488 array(488 [ 489 489 html::escapeHTML($core->blog->name) => '', 490 490 __('Media manager') => '', 491 491 __('confirm removal') => '' 492 ),493 array('home_link' => !$popup)492 ], 493 ['home_link' => !$popup] 494 494 ) 495 495 ); … … 519 519 if (!isset($core->media)) { 520 520 $breadcrumb = dcPage::breadcrumb( 521 array(521 [ 522 522 html::escapeHTML($core->blog->name) => '', 523 523 __('Media manager') => '' 524 ),525 array('home_link' => !$popup)524 ], 525 ['home_link' => !$popup] 526 526 ); 527 527 } else { … … 532 532 $count = $query ? count($dir['files']) : 0; 533 533 $breadcrumb = dcPage::breadcrumb( 534 array(534 [ 535 535 html::escapeHTML($core->blog->name) => '', 536 536 __('Media manager') => $core->adminurl->get('admin.media', $home_params), 537 537 __('Search:') . ' ' . $q . ' (' . sprintf(__('%s file found', '%s files found', $count), $count) . ')' => '' 538 ),539 array('home_link' => !$popup)538 ], 539 ['home_link' => !$popup] 540 540 ); 541 541 } else { … … 546 546 if ($breadcrumb_media == '') { 547 547 $breadcrumb = dcPage::breadcrumb( 548 array(548 [ 549 549 html::escapeHTML($core->blog->name) => '', 550 550 __('Media manager') => $core->adminurl->get('admin.media', $home_params) 551 ),552 array('home_link' => !$popup)551 ], 552 ['home_link' => !$popup] 553 553 ); 554 554 } else { … … 557 557 558 558 $breadcrumb = dcPage::breadcrumb( 559 array(559 [ 560 560 html::escapeHTML($core->blog->name) => '', 561 561 __('Media manager') => $core->adminurl->get('admin.media', $home_params), 562 562 $breadcrumb_media => '' 563 ),564 array(563 ], 564 [ 565 565 'home_link' => !$popup, 566 566 'hl' => false 567 )567 ] 568 568 ); 569 569 } … … 582 582 $fav_dirs = $core->auth->user_prefs->interface->media_fav_dirs; 583 583 if (!is_array($fav_dirs)) { 584 $fav_dirs = array();584 $fav_dirs = []; 585 585 } 586 586 foreach ($fav_dirs as $ld) { … … 649 649 dcPage::jsModal() . 650 650 dcPage::jsLoad('js/_media.js') . 651 ($core_media_writable ? dcPage::jsUpload( array('d=' . $d)) : ''),651 ($core_media_writable ? dcPage::jsUpload(['d=' . $d]) : ''), 652 652 $breadcrumb 653 653 ); … … 738 738 '<div class="files-group">%s</div>' . 739 739 '<p class="hidden">' . $core->formNonce() . 740 form::hidden( array('d'), $d) .741 form::hidden( array('q'), $q) .742 form::hidden( array('popup'), $popup) .743 form::hidden( array('select'), $select) .744 form::hidden( array('plugin_id'), $plugin_id) .745 form::hidden( array('post_id'), $post_id) .746 form::hidden( array('link_type'), $link_type) .740 form::hidden(['d'], $d) . 741 form::hidden(['q'], $q) . 742 form::hidden(['popup'], $popup) . 743 form::hidden(['select'], $select) . 744 form::hidden(['plugin_id'], $plugin_id) . 745 form::hidden(['post_id'], $post_id) . 746 form::hidden(['link_type'], $link_type) . 747 747 '</p>'; 748 748 … … 776 776 '<input type="submit" value="' . __('OK') . '" />' . ' ' . 777 777 '<span class="form-note">' . __('Will search into media filename (including path), title and description') . '</span>' . 778 form::hidden( array('popup'), $popup) .779 form::hidden( array('select'), $select) .780 form::hidden( array('plugin_id'), $plugin_id) .781 form::hidden( array('post_id'), $post_id) .782 form::hidden( array('link_type'), $link_type) .778 form::hidden(['popup'], $popup) . 779 form::hidden(['select'], $select) . 780 form::hidden(['plugin_id'], $plugin_id) . 781 form::hidden(['post_id'], $post_id) . 782 form::hidden(['link_type'], $link_type) . 783 783 '</p>' . 784 784 '</form>'; … … 797 797 '<form action="' . $core->adminurl->get("admin.media") . '" method="get" id="filters-form">' . 798 798 '<span class="media-file-mode">' . 799 '<a href="' . $core->adminurl->get("admin.media", array_merge($page_url_params, array('file_mode' => 'grid'))) . '" title="' . __('Grid display mode') . '">' .799 '<a href="' . $core->adminurl->get("admin.media", array_merge($page_url_params, ['file_mode' => 'grid'])) . '" title="' . __('Grid display mode') . '">' . 800 800 '<img src="images/grid-' . ($file_mode == 'grid' ? 'on' : 'off') . '.png" alt="' . __('Grid display mode') . '" />' . 801 801 '</a>' . 802 '<a href="' . $core->adminurl->get("admin.media", array_merge($page_url_params, array('file_mode' => 'list'))) . '" title="' . __('List display mode') . '">' .802 '<a href="' . $core->adminurl->get("admin.media", array_merge($page_url_params, ['file_mode' => 'list'])) . '" title="' . __('List display mode') . '">' . 803 803 '<img src="images/list-' . ($file_mode == 'list' ? 'on' : 'off') . '.png" alt="' . __('List display mode') . '" />' . 804 804 '</a>' . … … 809 809 form::number('nb_per_page', 0, 999, $nb_per_page) . ' ' . 810 810 '<input type="submit" value="' . __('OK') . '" />' . 811 form::hidden( array('popup'), $popup) .812 form::hidden( array('select'), $select) .813 form::hidden( array('plugin_id'), $plugin_id) .814 form::hidden( array('post_id'), $post_id) .815 form::hidden( array('link_type'), $link_type) .816 form::hidden( array('q'), $q) .811 form::hidden(['popup'], $popup) . 812 form::hidden(['select'], $select) . 813 form::hidden(['plugin_id'], $plugin_id) . 814 form::hidden(['post_id'], $post_id) . 815 form::hidden(['link_type'], $link_type) . 816 form::hidden(['q'], $q) . 817 817 '</p>' . 818 818 '</form>' . … … 910 910 '<h4 class="pretty-title">' . sprintf(__('Backup content of %s'), ($d == '' ? '“' . __('Media manager') . '”' : '“' . $d . '”')) . '</h4>' . 911 911 '<p><a class="button submit" href="' . $core->adminurl->get('admin.media', 912 array_merge($page_url_params, array('zipdl' => 1))) . '">' . __('Download zip file') . '</a></p>' .912 array_merge($page_url_params, ['zipdl' => 1])) . '">' . __('Download zip file') . '</a></p>' . 913 913 '</div>'; 914 914 } … … 933 933 '<p class="more-info">' . __('Please take care to publish media that you own and that are not protected by copyright.') . '</p>' . 934 934 '<form id="fileupload" action="' . html::escapeURL($core->adminurl->get('admin.media', $page_url_params)) . '" method="post" enctype="multipart/form-data" aria-disabled="false">' . 935 '<p>' . form::hidden( array('MAX_FILE_SIZE'), DC_MAX_UPLOAD_SIZE) .935 '<p>' . form::hidden(['MAX_FILE_SIZE'], DC_MAX_UPLOAD_SIZE) . 936 936 $core->formNonce() . '</p>' . 937 937 '<div class="fileupload-ctrl"><p class="queue-message"></p><ul class="files"></ul></div>'; … … 956 956 echo 957 957 '<p class="one-file form-help info">' . __('To send several files at the same time, you can activate the enhanced uploader in') . 958 ' <a href="' . $core->adminurl->get("admin.user.preferences", array('tab' => 'user-options')) . '">' . __('My preferences') . '</a></p>';958 ' <a href="' . $core->adminurl->get("admin.user.preferences", ['tab' => 'user-options']) . '">' . __('My preferences') . '</a></p>'; 959 959 } 960 960 … … 967 967 echo 968 968 '<p style="clear:both;">' . 969 form::hidden( array('d'), $d) .970 form::hidden( array('q'), $q) .971 form::hidden( array('popup'), $popup) .972 form::hidden( array('select'), $select) .973 form::hidden( array('plugin_id'), $plugin_id) .974 form::hidden( array('post_id'), $post_id) .975 form::hidden( array('link_type'), $link_type) .969 form::hidden(['d'], $d) . 970 form::hidden(['q'], $q) . 971 form::hidden(['popup'], $popup) . 972 form::hidden(['select'], $select) . 973 form::hidden(['plugin_id'], $plugin_id) . 974 form::hidden(['post_id'], $post_id) . 975 form::hidden(['link_type'], $link_type) . 976 976 '</p>' . 977 977 '</form>' . … … 986 986 form::hidden('rmyes', 1) . 987 987 form::hidden('d', html::escapeHTML($d)) . 988 form::hidden( array('q'), $q) .989 form::hidden( array('popup'), $popup) .990 form::hidden( array('select'), $select) .991 form::hidden( array('plugin_id'), $plugin_id) .992 form::hidden( array('post_id'), $post_id) .993 form::hidden( array('link_type'), $link_type) .988 form::hidden(['q'], $q) . 989 form::hidden(['popup'], $popup) . 990 form::hidden(['select'], $select) . 991 form::hidden(['plugin_id'], $plugin_id) . 992 form::hidden(['post_id'], $post_id) . 993 form::hidden(['link_type'], $link_type) . 994 994 form::hidden('remove', '') . 995 995 $core->formNonce() .
Note: See TracChangeset
for help on using the changeset viewer.