@@ -115,8 +115,8 @@ class RT_Transcoder_Handler {
115115 */
116116 public function __construct ( $ no_init = false ) {
117117
118- $ this ->api_key = get_site_option ( 'rt-transcoding-api-key ' );
119- $ this ->stored_api_key = get_site_option ( 'rt-transcoding-api-key-stored ' );
118+ $ this ->api_key = get_site_option ( 'rt-transcoding-api-key ' );
119+ $ this ->stored_api_key = get_site_option ( 'rt-transcoding-api-key-stored ' );
120120
121121 /**
122122 * Allow other plugin and wp-config to overwrite API URL.
@@ -222,13 +222,22 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
222222 $ not_allowed_type = array ( 'mp3 ' );
223223 preg_match ( '/video|audio/i ' , $ metadata ['mime_type ' ], $ type_array );
224224
225- if ( ( preg_match ( '/video|audio/i ' , $ metadata ['mime_type ' ], $ type_array ) || in_array ( $ metadata ['mime_type ' ], $ this ->allowed_mimetypes , true ) ) && ! in_array ( $ metadata ['mime_type ' ], array ( 'audio/mp3 ' ), true ) && ! in_array ( $ type , $ not_allowed_type , true ) ) {
225+ if ( (
226+ preg_match ( '/video|audio/i ' , $ metadata ['mime_type ' ], $ type_array ) ||
227+ in_array ( $ metadata ['mime_type ' ], $ this ->allowed_mimetypes , true )
228+ ) &&
229+ ! in_array ( $ metadata ['mime_type ' ], array ( 'audio/mp3 ' ), true ) &&
230+ ! in_array ( $ type , $ not_allowed_type , true )
231+ ) {
232+
226233 $ options_video_thumb = $ this ->get_thumbnails_required ( $ attachment_id );
234+
227235 if ( empty ( $ options_video_thumb ) ) {
228236 $ options_video_thumb = 5 ;
229237 }
230238
231239 $ job_type = 'video ' ;
240+
232241 if ( ( ! empty ( $ type_array ) && 'audio ' === $ type_array [0 ] ) || in_array ( $ extension , explode ( ', ' , $ this ->audio_extensions ), true ) ) {
233242 $ job_type = 'audio ' ;
234243 } elseif ( in_array ( $ extension , explode ( ', ' , $ this ->other_extensions ), true ) ) {
@@ -269,7 +278,12 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
269278
270279 $ upload_page = wp_remote_post ( $ transcoding_url , $ args );
271280
272- if ( ! is_wp_error ( $ upload_page ) && ( ( isset ( $ upload_page ['response ' ]['code ' ] ) && ( 200 === intval ( $ upload_page ['response ' ]['code ' ] ) ) ) ) ) {
281+ if ( ! is_wp_error ( $ upload_page ) &&
282+ (
283+ isset ( $ upload_page ['response ' ]['code ' ] ) &&
284+ 200 === intval ( $ upload_page ['response ' ]['code ' ] )
285+ )
286+ ) {
273287 $ upload_info = json_decode ( $ upload_page ['body ' ] );
274288 if ( isset ( $ upload_info ->status ) && $ upload_info ->status && isset ( $ upload_info ->job_id ) && $ upload_info ->job_id ) {
275289 $ job_id = $ upload_info ->job_id ;
0 commit comments