Этот коммит содержится в:
Igor V Belousov 2015-08-07 14:07:08 +03:00
родитель cfa89679c1
Коммит 41a4b0e0da
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -58,7 +58,7 @@ function batch_operations_page_view() {
?>
<script type="text/javascript">
var batch_id='<?php print $id; ?>',successful_page='<?php print get_admin_url(); ?>';
var batch_id='<?php print $id; ?>',successful_page='<?php echo $current_array['successful_page']; ?>';
</script>
<div class="wrap">
<h2><?php echo $title ?></h2>
@ -185,8 +185,9 @@ function batch_operations_process () {
* </pre>
*
* @param array $batch_arr array operations and more
* @param string $redirect Url to redirect to when the batch has finished processing
*/
function batch_operations_start($batch_arr)
function batch_operations_start( $batch_arr, $redirect = NULL )
{
$id = rand( 100, 999 ) . strtoupper( md5( date( 'YMDBs' ) ) ) . rand( 1000, 9999 );
@ -199,6 +200,12 @@ function batch_operations_start($batch_arr)
$batch_arr['count'] = count( $batch_arr['operations'] );
$batch_arr['current'] = 0;
if ( empty( $redirect ) ) {
$batch_arr['successful_page'] = get_admin_url();
} else {
$batch_arr['successful_page'] = $redirect;
}
if ( empty( $batch_arr['progress_message'] ) ) {
$batch_arr['progress_message'] = __( 'Completed %current% of %total%.' );
}

Просмотреть файл

@ -69,6 +69,11 @@ function batch_operations_test_page_view() {
batch_operations_start($batch);
break;
case 9:
$batch['operations'][]=array('test_batch_operation_params',array('c',3));
batch_operations_start($batch,get_admin_url( null, 'tools.php' ) . "?page=batch-operations-test");
break;
default:
break;
}
@ -85,6 +90,7 @@ function batch_operations_test_page_view() {
<li><a href="tools.php?page=batch-operations-test&test=6">Test <strong>$context['finished']</strong></a>
<li><a href="tools.php?page=batch-operations-test&test=7">Test params</a>
<li><a href="tools.php?page=batch-operations-test&test=8">Test operations in class</a>
<li><a href="tools.php?page=batch-operations-test&test=9">Test redirect</a>
</ol>
</div>
<?php