Skip to content

Commit

Permalink
Merge pull request #276 from rtCamp/fix/PHP-deprecation-error
Browse files Browse the repository at this point in the history
Fix PHP deprecation errors for [email protected]
  • Loading branch information
Utsav-Ladani authored Oct 18, 2023
2 parents af373f5 + 69dd88b commit 686feee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
24 changes: 13 additions & 11 deletions admin/rt-transcoder-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ public function get_thumbnails_required( $attachment_id = '' ) {
$thumb_count = apply_filters( 'rt_media_total_video_thumbnails', $thumb_count, $attachment_id );

return $thumb_count > 10 ? 10 : $thumb_count;

}

/**
Expand Down Expand Up @@ -489,8 +488,10 @@ public function save_api_key() {
add_action( 'admin_notices', array( $this, 'public_host_needed_notice' ) );
}

$apikey = trim( transcoder_filter_input( INPUT_GET, 'apikey', FILTER_SANITIZE_STRING ) );
$page = transcoder_filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
$filtered_apikey = transcoder_filter_input( INPUT_GET, 'apikey', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$apikey = ! empty( $filtered_apikey ) ? trim( $filtered_apikey ) : '';

$page = transcoder_filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

if ( ! empty( $apikey ) && is_admin() && ! empty( $page ) && ( 'rt-transcoder' === $page ) ) {
/* Do not activate transcoding service on localhost */
Expand Down Expand Up @@ -1332,14 +1333,12 @@ public function upload_dir( $upload_dir ) {
$rtmedia_upload_prefix = 'groups/';
$id = $this->uploaded['context_id'];
}
} else {
if ( 'group' !== $rtmedia_interaction->context->type ) {
} elseif ( 'group' !== $rtmedia_interaction->context->type ) {
$rtmedia_upload_prefix = 'users/';
$id = $this->uploaded['media_author'];
} else {
$rtmedia_upload_prefix = 'groups/';
$id = $rtmedia_interaction->context->id;
}
} else {
$rtmedia_upload_prefix = 'groups/';
$id = $rtmedia_interaction->context->id;
}

if ( ! $id ) {
Expand All @@ -1366,11 +1365,15 @@ public function upload_dir( $upload_dir ) {
* @param string $message Email message.
* @param boolean $include_admin If true then send an email to admin also else not.
*/
public function send_notification( $email_ids = array(), $subject, $message, $include_admin = true ) {
public function send_notification( $email_ids, $subject, $message, $include_admin = true ) {
if ( defined( 'RT_TRANSCODER_NO_MAIL' ) ) {
return;
}

if ( ! is_array( $email_ids ) ) {
$email_ids = array();
}

if ( empty( $subject ) || empty( $message ) ) {
return true;
}
Expand Down Expand Up @@ -1629,7 +1632,6 @@ class_exists( 'ImagickPixel', false ) &&
}

$this->wp_media_transcoding( array( 'mime_type' => 'application/pdf' ), $post_id );

}

/**
Expand Down
3 changes: 1 addition & 2 deletions inc/helpers/custom-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @return mixed Value of the requested variable on success, FALSE if the filter fails, or NULL if the
* variable_name variable is not set.
*/
function transcoder_filter_input( $type, $variable_name, $filter = FILTER_DEFAULT, $options = null ) {
function transcoder_filter_input( $type, $variable_name, $filter = FILTER_DEFAULT, $options = 0 ) {

if ( php_sapi_name() !== 'cli' ) {

Expand Down Expand Up @@ -118,5 +118,4 @@ function transcoder_filter_input( $type, $variable_name, $filter = FILTER_DEFAUL
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE

return filter_var( $input, $filter );

}

0 comments on commit 686feee

Please sign in to comment.