@@ -301,12 +301,8 @@ public function retranscode_interface() {
301
301
302
302
// Create the list of image IDs.
303
303
$ usage_info = get_site_option ( 'rt-transcoding-usage ' );
304
- $ ids = transcoder_filter_input ( INPUT_REQUEST , 'ids ' , FILTER_SANITIZE_NUMBER_INT , FILTER_REQUIRE_ARRAY );
305
-
304
+ $ ids = transcoder_filter_input ( INPUT_GET , 'ids ' , FILTER_SANITIZE_STRING );
306
305
if ( ! empty ( $ ids ) ) {
307
- if ( is_array ( $ ids ) ) {
308
- $ ids = implode ( ', ' , $ ids );
309
- }
310
306
$ media = array_map ( 'intval ' , explode ( ', ' , trim ( $ ids , ', ' ) ) );
311
307
$ ids = implode ( ', ' , $ media );
312
308
foreach ( $ media as $ key => $ each ) {
@@ -412,7 +408,7 @@ public function retranscode_interface() {
412
408
413
409
414
410
// translators: Count of media which were successfully transcoded with the time in seconds.
415
- $ text_goback = ( ! empty ( $ _GET ['goback ' ] ) ) ? sprintf ( __ ( 'To go back to the previous page, <a href="%s ">click here</a>. ' , 'transcoder ' ), ' javascript:history.go(-1) ' ) : '' ;
411
+ $ text_goback = ( ! empty ( $ _GET ['goback ' ] ) ) ? __ ( 'To go back to the previous page, <a id="retranscode-goback" href="# ">click here</a>. ' , 'transcoder ' ) : '' ;
416
412
417
413
// translators: Count of media which were successfully and media which were failed transcoded with the time in seconds and previout page link.
418
414
$ text_failures = sprintf ( __ ( 'All done! %1$s media file(s) were successfully sent for transcoding in %2$s seconds and there were %3$s failure(s). To try transcoding the failed media again, <a href="%4$s">click here</a>. %5$s ' , 'transcoder ' ), "' + rt_successes + ' " , "' + rt_totaltime + ' " , "' + rt_errors + ' " , esc_url ( wp_nonce_url ( admin_url ( 'admin.php?page=rt-retranscoder&goback=1 ' ), 'rt-retranscoder ' ) . '&ids= ' ) . "' + rt_failedlist + ' " , $ text_goback );
@@ -508,16 +504,33 @@ function RetranscodeMediaFinishUp() {
508
504
509
505
$('#retranscodemedia-stop').hide();
510
506
507
+ <?php
508
+ // Allowed tags for notice.
509
+ $ allowed_tags = array (
510
+ 'a ' => array (
511
+ 'href ' => array (),
512
+ 'id ' => array (),
513
+ ),
514
+ );
515
+ ?>
516
+
511
517
if ( rt_errors > 0 ) {
512
- rt_resulttext = '<?php echo wp_kses ( $ text_failures , array ( ' a ' => array ( ' href ' => array () ) ) ); ?> ';
518
+ rt_resulttext = '<?php echo wp_kses ( $ text_failures , $ allowed_tags ); ?> ';
513
519
} else {
514
- rt_resulttext = '<?php echo esc_html ( $ text_nofailures ); ?> ';
520
+ rt_resulttext = '<?php echo wp_kses ( $ text_nofailures, $ allowed_tags ); ?> ';
515
521
}
516
-
517
522
$("#message").html("<p><strong>" + rt_resulttext + "</strong></p>");
518
523
$("#message").show();
519
- }
520
524
525
+ $( '#retranscode-goback' ).on( 'click', function () {
526
+ window.history.go( -1 );
527
+ } );
528
+
529
+ }
530
+ <?php
531
+ // translators: Media ID.
532
+ $ error_response = sprintf ( __ ( 'The resize request was abnormally terminated (ID %s). This is likely due to the media exceeding available memory or some other type of fatal error. ' , 'transcoder ' ), '" + id + " ' );
533
+ ?>
521
534
// Regenerate a specified image via AJAX
522
535
function RetranscodeMedia( id ) {
523
536
$.ajax({
@@ -528,12 +541,7 @@ function RetranscodeMedia( id ) {
528
541
if ( response !== Object( response ) || ( typeof response.success === "undefined" && typeof response.error === "undefined" ) ) {
529
542
response = new Object;
530
543
response.success = false;
531
- response.error = "
532
- <?php
533
- // translators: Media ID.
534
- printf ( esc_js ( __ ( 'The resize request was abnormally terminated (ID %s). This is likely due to the media exceeding available memory or some other type of fatal error. ' , 'transcoder ' ) ), '" + id + " ' );
535
- ?>
536
- ";
544
+ response.error = '<?php echo esc_js ( $ error_response ); ?> ';
537
545
}
538
546
539
547
if ( response.success ) {
@@ -607,8 +615,7 @@ function RetranscodeMedia( id ) {
607
615
public function ajax_process_retranscode_request () {
608
616
609
617
header ( 'Content-type: application/json ' );
610
-
611
- $ id = transcoder_filter_input ( INPUT_REQUEST , 'id ' , FILTER_SANITIZE_NUMBER_INT );
618
+ $ id = transcoder_filter_input ( INPUT_POST , 'id ' , FILTER_SANITIZE_NUMBER_INT );
612
619
$ id = intval ( $ id );
613
620
614
621
if ( empty ( $ id ) || 0 >= $ id ) {
@@ -620,7 +627,7 @@ public function ajax_process_retranscode_request() {
620
627
if ( ! $ media || 'attachment ' !== $ media ->post_type ||
621
628
(
622
629
'audio/ ' !== substr ( $ media ->post_mime_type , 0 , 6 ) &&
623
- 'video/ ' !== substr ( $ media ->post_mime_type , 0 , 6 ) ||
630
+ 'video/ ' !== substr ( $ media ->post_mime_type , 0 , 6 ) &&
624
631
'application/pdf ' !== $ media ->post_mime_type
625
632
)
626
633
) {
0 commit comments