EOD;
_e('ACF Migration Cleanup', 'acf-migrator');
echo '
';
// If the button was clicked
if ( ! empty( $_POST['acf-migrator'] ) || ! empty( $_REQUEST['posts'] ) || get_acfm_options( 'debug_mode' ) ) {
if ( ! get_acfm_options( 'debug_mode' ) ) {
// Form nonce check
check_admin_referer( 'acf-migrator' );
}
// Create the list of image IDs
if ( ! empty( $_REQUEST['posts'] ) ) {
$posts = array_map( 'intval', explode( ',', trim( $_REQUEST['posts'], ',' ) ) );
$count = count( $posts );
$posts = implode( ',', $posts );
} else {
$posts = array();
$count = 0;
if ( false ) {
$posts = $this->get_postmeta();
$count = count( $posts );
}
if ( get_acfm_options( 'revert_migration' ) ) {
$posts = $this->get_options();
$count = count( $posts );
}
// always run cleanup_autoload
if ( get_acfm_options( 'reset_autoload' ) ) {
$posts[] = '0:cleanup_autoload';
$count++;
}
if ( ! get_acfm_options( 'debug_mode' ) && ! $count ) {
echo '
' . _e( 'All done. No further postmeta to migrate.', 'acf-migrator' ) . "
";
return;
}
}
if ( get_acfm_options( 'debug_mode' ) ) {
print_r($posts); echo '' . __( "Please be patient while postmeta records are migrated. Do not navigate away from this page until this script is done or the migrate will not be completed. You will be notified via this page when the migratation is completed.", 'acf-migrator' ) . '
';
echo '' . sprintf( __( 'Estimated time required to migrate is %1$s minutes.', 'acf-migrator' ), number_format( $count * .20 ) ) . '
';
$text_goback = ( ! empty( $_GET['goback'] ) ) ? sprintf( __( 'To go back to the previous page,