add custom redirect
Этот коммит содержится в:
родитель
cfa89679c1
Коммит
41a4b0e0da
11
batch.php
11
batch.php
@ -58,7 +58,7 @@ function batch_operations_page_view() {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<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>
|
</script>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php echo $title ?></h2>
|
<h2><?php echo $title ?></h2>
|
||||||
@ -185,8 +185,9 @@ function batch_operations_process () {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param array $batch_arr array operations and more
|
* @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 );
|
$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['count'] = count( $batch_arr['operations'] );
|
||||||
$batch_arr['current'] = 0;
|
$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'] ) ) {
|
if ( empty( $batch_arr['progress_message'] ) ) {
|
||||||
$batch_arr['progress_message'] = __( 'Completed %current% of %total%.' );
|
$batch_arr['progress_message'] = __( 'Completed %current% of %total%.' );
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,11 @@ function batch_operations_test_page_view() {
|
|||||||
batch_operations_start($batch);
|
batch_operations_start($batch);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
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=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=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=8">Test operations in class</a>
|
||||||
|
<li><a href="tools.php?page=batch-operations-test&test=9">Test redirect</a>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user