diff --git a/README.md b/README.md index 1644ce8d..03f68340 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Transcoding services for ANY WordPress website. Convert audio/video files of any Transcoder Banner

-* **Contributors:** [rtcamp] (http://profiles.wordpress.org/rtcamp), [mangeshp] (http://profiles.wordpress.org/mangeshp), [chandrapatel] (http://profiles.wordpress.org/chandrapatel), [manishsongirkar36] (http://profiles.wordpress.org/manishsongirkar36), [bhargavbhandari90] (http://profiles.wordpress.org/bhargavbhandari90), [kiranpotphode] (http://profiles.wordpress.org/kiranpotphode), [thrijith] (http://profiles.wordpress.org/thrijith), [devikvekariya] (http://profiles.wordpress.org/devikvekariya), [sagarnasit] (http://profiles.wordpress.org/sagarnasit), [sudhiryadav] (http://profiles.wordpress.org/sudhiryadav), [sid177] (https://profiles.wordpress.org/sid177/), [pooja1210] (https://profiles.wordpress.org/pooja1210/) +* **Contributors:** [rtcamp] (http://profiles.wordpress.org/rtcamp), [mangeshp] (http://profiles.wordpress.org/mangeshp), [chandrapatel] (http://profiles.wordpress.org/chandrapatel), [manishsongirkar36] (http://profiles.wordpress.org/manishsongirkar36), [bhargavbhandari90] (http://profiles.wordpress.org/bhargavbhandari90), [kiranpotphode] (http://profiles.wordpress.org/kiranpotphode), [thrijith] (http://profiles.wordpress.org/thrijith), [devikvekariya] (http://profiles.wordpress.org/devikvekariya), [sagarnasit] (http://profiles.wordpress.org/sagarnasit), [sudhiryadav] (http://profiles.wordpress.org/sudhiryadav), [sid177] (https://profiles.wordpress.org/sid177/), [pooja1210] (https://profiles.wordpress.org/pooja1210/), [vaishu.agola27] (https://profiles.wordpress.org/vaishuagola27/), [ravatparmar] (https://profiles.wordpress.org/ravatparmar/) * **License:** [GPL v2 or later] ( http://www.gnu.org/licenses/gpl-2.0.html) @@ -65,6 +65,15 @@ Read [Documentation](https://rtmedia.io/docs/transcoder/?utm_source=readme&utm_m 1. Transcoder Settings ## Changelog ## +#### 1.3.2 [January 12, 2021] #### + +* FIXED + + * The conflict with temp_filename filter and modified the filter + * Compatibility issues with WordPress 5.6 + * Conflicts with WP Job Manager plugin + * PHP Notices and Warnings + #### 1.3.1 [August 14, 2020] #### * ENHANCEMENTS @@ -190,4 +199,4 @@ Read [Documentation](https://rtmedia.io/docs/transcoder/?utm_source=readme&utm_m #### 1.0.0 #### Initial release -Transcoder 1.3.1, with WordPress 5.5 compatibility and media thumbnails auto update feature after transcoding is completed on rtMedia pages. +Transcoder 1.3.2, with WordPress 5.6 compatibility and some minor fixes and modification of transcoded_temp_filename filter. diff --git a/admin/rt-transcoder-handler.php b/admin/rt-transcoder-handler.php index 251534cb..8186c8c7 100755 --- a/admin/rt-transcoder-handler.php +++ b/admin/rt-transcoder-handler.php @@ -357,7 +357,7 @@ public function is_valid_key( $key ) { if ( function_exists( 'vip_safe_wp_remote_get' ) ) { $validation_page = vip_safe_wp_remote_get( $validate_url, '', 3, 3 ); } else { - $validation_page = wp_remote_get( $validate_url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get + $validation_page = wp_safe_remote_get( $validate_url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get } if ( ! is_wp_error( $validation_page ) ) { $validation_info = json_decode( $validation_page['body'] ); @@ -385,7 +385,7 @@ public function update_usage( $key ) { if ( function_exists( 'vip_safe_wp_remote_get' ) ) { $usage_page = vip_safe_wp_remote_get( $usage_url, '', 3, 3 ); } else { - $usage_page = wp_remote_get( $usage_url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get + $usage_page = wp_safe_remote_get( $usage_url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get } if ( ! is_wp_error( $usage_page ) ) { $usage_info = json_decode( $usage_page['body'] ); @@ -775,15 +775,36 @@ public function add_media_thumbnails( $post_array ) { $largest_thumb = false; $largest_thumb_url = false; $upload_thumbnail_array = array(); + $failed_thumbnails = false; foreach ( $post_thumbs_array['thumbnail'] as $thumbnail ) { - $thumbresource = function_exists( 'vip_safe_wp_remote_get' ) ? vip_safe_wp_remote_get( $thumbnail ) : wp_remote_get( $thumbnail ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get + $thumbresource = function_exists( 'vip_safe_wp_remote_get' ) ? vip_safe_wp_remote_get( $thumbnail, '', 3, 3 ) : wp_remote_get( $thumbnail, array( 'timeout' => 120 ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout $thumbinfo = pathinfo( $thumbnail ); $temp_name = $thumbinfo['basename']; $temp_name = urldecode( $temp_name ); $temp_name_array = explode( '/', $temp_name ); - $temp_name = $temp_name_array[ count( $temp_name_array ) - 1 ]; - $thumbinfo['basename'] = apply_filters( 'transcoded_temp_filename', $temp_name ); + $thumbinfo['basename'] = $temp_name_array[ count( $temp_name_array ) - 1 ]; + + /** + * Filter: 'transcoded_temp_filename' - Allows changes for the thumbnail name. + * + * @deprecated 1.3.2. Use the {@see 'transcoded_thumb_filename'} filter instead. + */ + $thumbinfo['basename'] = apply_filters_deprecated( 'transcoded_temp_filename', array( $thumbinfo['basename'] ), '1.3.2', 'transcoded_thumb_filename', __( 'Use transcoded_thumb_filename filter to modify video thumbnail name and transcoded_video_filename filter to modify video file name.', 'transcoder' ) ); + + /** + * Allows users/plugins to filter the thumbnail Name + * + * @since 1.3.2 + * + * @param string $temp_name Contains the thumbnail public name + */ + $thumbinfo['basename'] = apply_filters( 'transcoded_thumb_filename', $thumbinfo['basename'] ); + + // Verify Extension. + if ( empty( pathinfo( $thumbinfo['basename'], PATHINFO_EXTENSION ) ) ) { + $thumbinfo['basename'] .= '.' . $thumbinfo['extension']; + } if ( 'wp-media' !== $post_thumbs_array['job_for'] ) { add_filter( 'upload_dir', array( $this, 'upload_dir' ) ); @@ -792,6 +813,11 @@ public function add_media_thumbnails( $post_array ) { // Create a file in the upload folder with given content. $thumb_upload_info = wp_upload_bits( $thumbinfo['basename'], null, $thumbresource['body'] ); + // Check error. + if ( ! empty( $thumb_upload_info['error'] ) ) { + $failed_thumbnails = $thumb_upload_info; + } + /** * Allow users to filter/perform action on uploaded transcoded file. * @@ -802,7 +828,6 @@ public function add_media_thumbnails( $post_array ) { * and $thumb_upload_info['file'] contains the file physical path * @param int $post_id Contains the attachment ID for which transcoded file is uploaded */ - $thumb_upload_info = apply_filters( 'transcoded_file_stored', $thumb_upload_info, $post_id ); if ( 'wp-media' !== $post_thumbs_array['job_for'] ) { @@ -834,6 +859,10 @@ public function add_media_thumbnails( $post_array ) { } } + if ( false !== $failed_thumbnails && ! empty( $failed_thumbnails['error'] ) ) { + $this->nofity_transcoding_failed( $post_array['job_id'], sprintf( 'Failed saving of Thumbnail for %1$s.', $post_array['file_name'] ) ); + } + update_post_meta( $post_id, '_rt_media_source', $post_thumbs_array['job_for'] ); update_post_meta( $post_id, '_rt_media_thumbnails', $upload_thumbnail_array ); @@ -906,8 +935,15 @@ public function add_transcoded_files( $file_post_array, $attachment_id, $job_for $new_wp_attached_file_pathinfo = pathinfo( $download_url ); $post_mime_type = 'mp4' === $new_wp_attached_file_pathinfo['extension'] ? 'video/mp4' : 'audio/mp3'; $attachemnt_url = wp_get_attachment_url( $attachment_id ); + + $timeout = 5; + + if ( 'video/mp4' === $post_mime_type ) { + $timeout = 120; + } + try { - $response = function_exists( 'vip_safe_wp_remote_get' ) ? vip_safe_wp_remote_get( $download_url, '', 3, 3 ) : wp_remote_get( $download_url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get + $response = function_exists( 'vip_safe_wp_remote_get' ) ? vip_safe_wp_remote_get( $download_url, '', 3, 3 ) : wp_remote_get( $download_url, array( 'timeout' => $timeout ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get } catch ( Exception $e ) { $flag = $e->getMessage(); } @@ -920,7 +956,21 @@ public function add_transcoded_files( $file_post_array, $attachment_id, $job_for add_filter( 'upload_dir', array( $this, 'upload_dir' ) ); } - $upload_info = wp_upload_bits( $new_wp_attached_file_pathinfo['basename'], null, $file_content ); + /** + * Allows users/plugins to filter the transcoded file Name + * + * @since 1.3.2 + * + * @param string $new_wp_attached_file_pathinfo['basename'] Contains the file public name + */ + $file_name = apply_filters( 'transcoded_video_filename', $new_wp_attached_file_pathinfo['basename'] ); + + // Verify Extension. + if ( empty( pathinfo( $file_name, PATHINFO_EXTENSION ) ) ) { + $file_name .= '.' . $new_wp_attached_file_pathinfo['extension']; + } + + $upload_info = wp_upload_bits( $file_name, null, $file_content ); /** * Allow users to filter/perform action on uploaded transcoded file. @@ -991,6 +1041,7 @@ public function add_transcoded_files( $file_post_array, $attachment_id, $job_for } else { $uploads = wp_upload_dir(); } + if ( 'video/mp4' === $post_mime_type ) { $media_type = 'mp4'; } elseif ( 'audio/mp3' === $post_mime_type ) { @@ -1129,7 +1180,11 @@ public function handle_callback() { die(); } } else { - if ( isset( $job_id ) && class_exists( 'RTDBModel' ) ) { + + // To check if request is sumitted from the WP Job Manager plugin ( https://wordpress.org/plugins/wp-job-manager/ ). + $job_manager_form = transcoder_filter_input( INPUT_POST, 'job_manager_form', FILTER_SANITIZE_STRING ); + + if ( isset( $job_id ) && ! empty( $job_id ) && class_exists( 'RTDBModel' ) && empty( $job_manager_form ) ) { $has_thumbs = isset( $thumbnail ) ? true : false; $flag = false; @@ -1451,7 +1506,7 @@ public function get_transcoding_status( $post_id ) { if ( function_exists( 'vip_safe_wp_remote_get' ) ) { $status_page = vip_safe_wp_remote_get( $status_url, '', 3, 3 ); } else { - $status_page = wp_remote_get( $status_url, array( 'timeout' => 120 ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout + $status_page = wp_safe_remote_get( $status_url, array( 'timeout' => 120 ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout } if ( ! is_wp_error( $status_page ) ) { diff --git a/admin/rt-transcoder-rest-routes.php b/admin/rt-transcoder-rest-routes.php index 816e930c..c3576d28 100644 --- a/admin/rt-transcoder-rest-routes.php +++ b/admin/rt-transcoder-rest-routes.php @@ -34,8 +34,9 @@ public function register_routes() { $this->namespace_prefix . $this->version, '/amp-media/(?P\d+)', array( - 'methods' => WP_REST_Server::READABLE, - 'callback' => array( $this, 'get_media_data' ), + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_media_data' ), + 'permission_callback' => '__return_true', ) ); @@ -44,8 +45,9 @@ public function register_routes() { $this->namespace_prefix . $this->version, '/amp-rtmedia', array( - 'methods' => WP_REST_Server::READABLE, - 'callback' => array( $this, 'get_rtmedia_data' ), + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_rtmedia_data' ), + 'permission_callback' => '__return_true', ) ); } diff --git a/languages/transcoder.pot b/languages/transcoder.pot index 6e1a7733..f8d71f9d 100644 --- a/languages/transcoder.pot +++ b/languages/transcoder.pot @@ -1,14 +1,14 @@ -# Copyright (C) 2020 +# Copyright (C) 2021 # This file is distributed under the same license as the package. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: http://community.rtcamp.com/\n" -"POT-Creation-Date: 2020-08-14 11:39:04+00:00\n" +"POT-Creation-Date: 2021-01-12 10:42:24+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n" "Last-Translator: Transcoder \n" "Language-Team: Transcoder \n" "Language: en\n" @@ -416,7 +416,7 @@ msgstr "" msgid " page." msgstr "" -#: admin/rt-transcoder-admin.php:204 admin/rt-transcoder-handler.php:1232 +#: admin/rt-transcoder-admin.php:204 admin/rt-transcoder-handler.php:1287 msgid "Please enter the license key." msgstr "" @@ -556,99 +556,105 @@ msgstr "" msgid "Transcoding usage this month" msgstr "" -#: admin/rt-transcoder-handler.php:947 +#: admin/rt-transcoder-handler.php:793 +msgid "" +"Use transcoded_thumb_filename filter to modify video thumbnail name and " +"transcoded_video_filename filter to modify video file name." +msgstr "" + +#: admin/rt-transcoder-handler.php:997 msgid "Could not read file." msgstr "" -#: admin/rt-transcoder-handler.php:960 admin/rt-transcoder-handler.php:1113 -#: admin/rt-transcoder-handler.php:1178 +#: admin/rt-transcoder-handler.php:1010 admin/rt-transcoder-handler.php:1164 +#: admin/rt-transcoder-handler.php:1233 msgid "Transcoding: Download Failed" msgstr "" -#: admin/rt-transcoder-handler.php:961 admin/rt-transcoder-handler.php:1114 -#: admin/rt-transcoder-handler.php:1179 admin/rt-transcoder-handler.php:1376 -#: admin/rt-transcoder-handler.php:1379 +#: admin/rt-transcoder-handler.php:1011 admin/rt-transcoder-handler.php:1165 +#: admin/rt-transcoder-handler.php:1234 admin/rt-transcoder-handler.php:1431 +#: admin/rt-transcoder-handler.php:1434 msgid "Media" msgstr "" -#: admin/rt-transcoder-handler.php:961 admin/rt-transcoder-handler.php:1114 +#: admin/rt-transcoder-handler.php:1011 admin/rt-transcoder-handler.php:1165 msgid " was successfully encoded but there was an error while downloading:" msgstr "" -#: admin/rt-transcoder-handler.php:961 +#: admin/rt-transcoder-handler.php:1011 msgid "You can " msgstr "" -#: admin/rt-transcoder-handler.php:961 +#: admin/rt-transcoder-handler.php:1011 msgid "retry the download" msgstr "" -#: admin/rt-transcoder-handler.php:974 admin/rt-transcoder-handler.php:1127 -#: admin/rt-transcoder-handler.php:1192 +#: admin/rt-transcoder-handler.php:1024 admin/rt-transcoder-handler.php:1178 +#: admin/rt-transcoder-handler.php:1247 msgid "Done" msgstr "" -#: admin/rt-transcoder-handler.php:1075 +#: admin/rt-transcoder-handler.php:1126 msgid "Something went wrong. Invalid post request." msgstr "" -#: admin/rt-transcoder-handler.php:1107 admin/rt-transcoder-handler.php:1172 +#: admin/rt-transcoder-handler.php:1158 admin/rt-transcoder-handler.php:1227 msgid "" "Something went wrong. The required attachment id does not exists. It must " "have been deleted." msgstr "" -#: admin/rt-transcoder-handler.php:1179 +#: admin/rt-transcoder-handler.php:1234 msgid " was successfully transcoded but there was an error while downloading:" msgstr "" -#: admin/rt-transcoder-handler.php:1244 +#: admin/rt-transcoder-handler.php:1299 msgid "Transcoding disabled successfully." msgstr "" -#: admin/rt-transcoder-handler.php:1255 +#: admin/rt-transcoder-handler.php:1310 msgid "Transcoding enabled successfully." msgstr "" -#: admin/rt-transcoder-handler.php:1372 +#: admin/rt-transcoder-handler.php:1427 msgid "Transcoding: Something went wrong." msgstr "" -#: admin/rt-transcoder-handler.php:1375 +#: admin/rt-transcoder-handler.php:1430 msgid " There was unexpected error occurred while transcoding this following media." msgstr "" -#: admin/rt-transcoder-handler.php:1380 +#: admin/rt-transcoder-handler.php:1435 msgid " there was unexpected error occurred while transcoding this media." msgstr "" -#: admin/rt-transcoder-handler.php:1415 +#: admin/rt-transcoder-handler.php:1470 msgid "Something went wrong. Please try again!" msgstr "" -#: admin/rt-transcoder-handler.php:1433 admin/rt-transcoder-handler.php:1469 +#: admin/rt-transcoder-handler.php:1488 admin/rt-transcoder-handler.php:1524 msgid "Your file is transcoded successfully. Please refresh the page." msgstr "" -#: admin/rt-transcoder-handler.php:1464 +#: admin/rt-transcoder-handler.php:1519 msgid "" "Looks like the server is taking too long to respond, Please try again in " "sometime." msgstr "" -#: admin/rt-transcoder-handler.php:1465 +#: admin/rt-transcoder-handler.php:1520 msgid "Unfortunately, Transcoder failed to transcode this file." msgstr "" -#: admin/rt-transcoder-handler.php:1466 +#: admin/rt-transcoder-handler.php:1521 msgid "Your file is getting transcoded. Please refresh after some time." msgstr "" -#: admin/rt-transcoder-handler.php:1467 +#: admin/rt-transcoder-handler.php:1522 msgid "This file is still in the queue. Please refresh after some time." msgstr "" -#: admin/rt-transcoder-handler.php:1468 +#: admin/rt-transcoder-handler.php:1523 msgid "Your server should be ready to receive the transcoded file." msgstr "" diff --git a/readme.txt b/readme.txt index bc73b232..205a77aa 100644 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,10 @@ === Transcoder === -Contributors: rtcamp, mangeshp, chandrapatel, manishsongirkar36, bhargavbhandari90, kiranpotphode, thrijith, devikvekariya, sagarnasit, sudhiryadav, sid177, pooja1210 +Contributors: rtcamp, mangeshp, chandrapatel, manishsongirkar36, bhargavbhandari90, kiranpotphode, thrijith, devikvekariya, sagarnasit, sudhiryadav, sid177, pooja1210, vaishu.agola27,ravatparmar Tags: media, multimedia, audio, songs, music, video, ffmpeg, media-node, rtMedia, WordPress, kaltura, transcode, transcoder, encoding, encode Donate link: https://rtcamp.com/donate/ Requires at least: 4.1 -Tested up to: 5.5 -Stable tag: 1.3.1 +Tested up to: 5.6 +Stable tag: 1.3.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -62,6 +62,15 @@ Read [Documentation](https://rtmedia.io/docs/transcoder/?utm_source=readme&utm_m 1. Transcoder Settings == Changelog == += 1.3.2 [January 12, 2021] = + +* FIXED + + * The conflict with temp_filename filter and modified the filter + * Compatibility issues with WordPress 5.6 + * Conflicts with WP Job Manager plugin + * PHP Notices and Warnings + = 1.3.1 [August 14, 2020] = * ENHANCEMENTS @@ -188,5 +197,5 @@ Read [Documentation](https://rtmedia.io/docs/transcoder/?utm_source=readme&utm_m Initial release == Upgrade Notice == -= 1.3.1 = -Transcoder 1.3.1, with WordPress 5.5 compatibility and media thumbnails auto update feature after transcoding is completed on rtMedia pages. += 1.3.2 = +Transcoder 1.3.2, with WordPress 5.6 compatibility and some minor fixes and modification of transcoded_temp_filename filter. diff --git a/rt-transcoder.php b/rt-transcoder.php index 1fbb1402..17977ef5 100644 --- a/rt-transcoder.php +++ b/rt-transcoder.php @@ -3,7 +3,7 @@ * Plugin Name: Transcoder * Plugin URI: https://rtmedia.io/transcoder/?utm_source=dashboard&utm_medium=plugin&utm_campaign=transcoder * Description: Audio & video transcoding services for ANY WordPress website. Allows you to convert audio/video files of any format to a web-friendly format (mp3/mp4). - * Version: 1.3.1 + * Version: 1.3.2 * Text Domain: transcoder * Author: rtCamp * Author URI: https://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=transcoder @@ -39,7 +39,7 @@ /** * The version of the plugin */ - define( 'RT_TRANSCODER_VERSION', '1.3.1' ); + define( 'RT_TRANSCODER_VERSION', '1.3.2' ); } if ( ! defined( 'RT_TRANSCODER_NO_MAIL' ) && defined( 'VIP_GO_APP_ENVIRONMENT' ) ) {