diff options
author | mistic100 <mistic@piwigo.org> | 2013-10-19 17:43:04 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-10-19 17:43:04 +0000 |
commit | ae707279a1945e383c312cd648d288606a79e341 (patch) | |
tree | 917bdc6e0609ed0eefed5f3693de3a017685acc4 /admin/batch_manager_global.php | |
parent | 35ff1b7c1f933799397a0ce0a6723cf82f416ff3 (diff) |
remove all array_push (50% slower than []) + some changes missing for feature:2978
git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/batch_manager_global.php')
-rw-r--r-- | admin/batch_manager_global.php | 78 |
1 files changed, 28 insertions, 50 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index d3cb4774a..246616a74 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -82,7 +82,7 @@ if (isset($_POST['submit'])) // photo in the selection if (count($collection) == 0) { - array_push($page['errors'], l10n('Select at least one photo')); + $page['errors'][] = l10n('Select at least one photo'); } $action = $_POST['selectAction']; @@ -105,7 +105,7 @@ DELETE { if (empty($_POST['add_tags'])) { - array_push($page['errors'], l10n('Select at least one tag')); + $page['errors'][] = l10n('Select at least one tag'); } else { @@ -133,7 +133,7 @@ DELETE } else { - array_push($page['errors'], l10n('Select at least one tag')); + $page['errors'][] = l10n('Select at least one tag'); } } @@ -241,12 +241,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'author' => $_POST['author'] - ) + $datas[] = array( + 'id' => $image_id, + 'author' => $_POST['author'] ); } @@ -268,12 +265,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'name' => $_POST['title'] - ) + $datas[] = array( + 'id' => $image_id, + 'name' => $_POST['title'] ); } @@ -302,12 +296,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'date_creation' => $date_creation - ) + $datas[] = array( + 'id' => $image_id, + 'date_creation' => $date_creation ); } @@ -324,12 +315,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'level' => $_POST['level'] - ) + $datas[] = array( + 'id' => $image_id, + 'level' => $_POST['level'] ); } @@ -362,15 +350,9 @@ DELETE $deleted_count = delete_elements($collection, true); if ($deleted_count > 0) { - $_SESSION['page_infos'] = array( - sprintf( - l10n_dec( - '%d photo was deleted', - '%d photos were deleted', - $deleted_count - ), - $deleted_count - ) + $_SESSION['page_infos'][] = l10n_dec( + '%d photo was deleted', '%d photos were deleted', + $deleted_count ); $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; @@ -378,12 +360,12 @@ DELETE } else { - array_push($page['errors'], l10n('No photo can be deleted')); + $page['errors'][] = l10n('No photo can be deleted'); } } else { - array_push($page['errors'], l10n('You need to confirm deletion')); + $page['errors'][] = l10n('You need to confirm deletion'); } } @@ -391,11 +373,7 @@ DELETE if ('metadata' == $action) { sync_metadata($collection); - - array_push( - $page['infos'], - l10n('Metadata synchronized from file') - ); + $page['infos'][] = l10n('Metadata synchronized from file'); } if ('delete_derivatives' == $action) @@ -415,11 +393,13 @@ DELETE if ('generate_derivatives' == $action) { if ($_POST['regenerateSuccess'] != '0') - array_push($page['infos'], l10n('%s photos have been regenerated', $_POST['regenerateSuccess'])); - + { + $page['infos'][] = l10n('%s photos have been regenerated', $_POST['regenerateSuccess']); + } if ($_POST['regenerateError'] != '0') - array_push($page['warnings'], l10n('%s photos can not be regenerated', $_POST['regenerateError'])); - + { + $page['warnings'][] = l10n('%s photos can not be regenerated', $_POST['regenerateError']); + } } trigger_action('element_set_global_action', $action, $collection); @@ -444,9 +424,7 @@ $prefilters = array( if ($conf['enable_synchronization']) { - array_push($prefilters, - array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album')) - ); + $prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album')); } $prefilters = trigger_event('get_batch_manager_prefilters', $prefilters); |