@@ -301,12 +301,8 @@ public function retranscode_interface() {
301301
302302 // Create the list of image IDs.
303303 $ 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 );
306305 if ( ! empty ( $ ids ) ) {
307- if ( is_array ( $ ids ) ) {
308- $ ids = implode ( ', ' , $ ids );
309- }
310306 $ media = array_map ( 'intval ' , explode ( ', ' , trim ( $ ids , ', ' ) ) );
311307 $ ids = implode ( ', ' , $ media );
312308 foreach ( $ media as $ key => $ each ) {
@@ -412,7 +408,7 @@ public function retranscode_interface() {
412408
413409
414410 // 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 ' ) : '' ;
416412
417413 // translators: Count of media which were successfully and media which were failed transcoded with the time in seconds and previout page link.
418414 $ 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() {
508504
509505 $('#retranscodemedia-stop').hide();
510506
507+ <?php
508+ // Allowed tags for notice.
509+ $ allowed_tags = array (
510+ 'a ' => array (
511+ 'href ' => array (),
512+ 'id ' => array (),
513+ ),
514+ );
515+ ?>
516+
511517 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 ); ?> ';
513519 } else {
514- rt_resulttext = '<?php echo esc_html ( $ text_nofailures ); ?> ';
520+ rt_resulttext = '<?php echo wp_kses ( $ text_nofailures, $ allowed_tags ); ?> ';
515521 }
516-
517522 $("#message").html("<p><strong>" + rt_resulttext + "</strong></p>");
518523 $("#message").show();
519- }
520524
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+ ?>
521534 // Regenerate a specified image via AJAX
522535 function RetranscodeMedia( id ) {
523536 $.ajax({
@@ -528,12 +541,7 @@ function RetranscodeMedia( id ) {
528541 if ( response !== Object( response ) || ( typeof response.success === "undefined" && typeof response.error === "undefined" ) ) {
529542 response = new Object;
530543 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 ); ?> ';
537545 }
538546
539547 if ( response.success ) {
@@ -607,8 +615,7 @@ function RetranscodeMedia( id ) {
607615 public function ajax_process_retranscode_request () {
608616
609617 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 );
612619 $ id = intval ( $ id );
613620
614621 if ( empty ( $ id ) || 0 >= $ id ) {
@@ -620,7 +627,7 @@ public function ajax_process_retranscode_request() {
620627 if ( ! $ media || 'attachment ' !== $ media ->post_type ||
621628 (
622629 '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 ) &&
624631 'application/pdf ' !== $ media ->post_mime_type
625632 )
626633 ) {
0 commit comments