Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d3fd0bd
Remove vault dependency from workflows
rtBot Sep 10, 2020
0eb8b38
Merge pull request #206 from rtCamp/remove/vault-for-develop
rtBot Sep 11, 2020
df919b5
Added WP Job Manager plugin parameter in transcoder to fix conflict
Sep 28, 2020
738615c
Fix PHPCS issues
Sep 28, 2020
b2f067d
Merge pull request #212 from rtCamp/bug/fix-wp-job-manager-plugin-con…
ravatparmar Sep 28, 2020
0dcf870
Add filter for transcoded video and thumbnail name changes, deprecate…
vaishaliagola27 Nov 3, 2020
fca5154
Change message to show on deprecated transcoded_temp_filename filter
vaishaliagola27 Dec 23, 2020
7d95a3d
Resolve errors while transcoding thumbnails
vaishaliagola27 Dec 25, 2020
21cdf10
Resolve PHPCS warnings
vaishaliagola27 Dec 25, 2020
875ee43
Remove post array from transcoded_thumb_filename filter
vaishaliagola27 Dec 25, 2020
02c54d4
Change timeout for requests to remove notices
vaishaliagola27 Dec 28, 2020
504402b
Change timeout for requests to remove notices
vaishaliagola27 Dec 28, 2020
a38dffb
Merge pull request #220 from rtCamp/feature/Issue-218
vaishaliagola27 Dec 28, 2020
73813a0
Replace wp_remote_get with wp_safe_remote_get
vaishaliagola27 Dec 28, 2020
258f03c
Merge pull request #222 from rtCamp/feature/Issue-218-2
pooja-muchandikar Jan 7, 2021
fe5bad7
Resolve issue with Video trancoding thumbnail auto load
vaishaliagola27 Jan 8, 2021
9aa0a0a
Merge pull request #223 from rtCamp/fix/thumbnail-issue
vaishaliagola27 Jan 11, 2021
966fb66
Changes to remove notice for register_rest_route function use
vaishaliagola27 Jan 12, 2021
5a8bec1
Merge pull request #224 from rtCamp/fix/notice
vaishaliagola27 Jan 12, 2021
98a49e1
Version update v1.3.2
vaishaliagola27 Jan 12, 2021
03d60c9
Update contributors
vaishaliagola27 Jan 12, 2021
33a128a
Merge pull request #225 from rtCamp/version-update/v1.3.2
vaishaliagola27 Jan 12, 2021
b17d378
Run grunt to update assets
vaishaliagola27 Jan 12, 2021
a7c780f
Merge pull request #226 from rtCamp/version-update/v1.3.2
vaishaliagola27 Jan 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Transcoding services for ANY WordPress website. Convert audio/video files of any
<img src="https://rtmedia.io/wp-content/uploads/2016/08/trancoder-banner-01.png" alt="Transcoder Banner"/>
</p>

* **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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
75 changes: 65 additions & 10 deletions admin/rt-transcoder-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
Expand Down Expand Up @@ -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'] );
Expand Down Expand Up @@ -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' ) );
Expand All @@ -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.
*
Expand All @@ -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'] ) {
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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();
}
Expand All @@ -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.
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) ) {
Expand Down
10 changes: 6 additions & 4 deletions admin/rt-transcoder-rest-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public function register_routes() {
$this->namespace_prefix . $this->version,
'/amp-media/(?P<id>\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',
)
);

Expand All @@ -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',
)
);
}
Expand Down
66 changes: 36 additions & 30 deletions languages/transcoder.pot
Original file line number Diff line number Diff line change
@@ -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 <support@rtcamp.com>\n"
"Language-Team: Transcoder <support@rtcamp.com>\n"
"Language: en\n"
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down
Loading