summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.json-api-endpoints.php')
-rw-r--r--plugins/jetpack/class.json-api-endpoints.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/jetpack/class.json-api-endpoints.php b/plugins/jetpack/class.json-api-endpoints.php
index 48a4c40b..5830d1e8 100644
--- a/plugins/jetpack/class.json-api-endpoints.php
+++ b/plugins/jetpack/class.json-api-endpoints.php
@@ -257,7 +257,7 @@ abstract class WPCOM_JSON_API_Endpoint {
$return = json_decode( $input, true );
if ( function_exists( 'json_last_error' ) ) {
- if ( JSON_ERROR_NONE !== json_last_error() ) {
+ if ( JSON_ERROR_NONE !== json_last_error() ) { // phpcs:ignore PHPCompatibility
return null;
}
} else {
@@ -396,6 +396,13 @@ abstract class WPCOM_JSON_API_Endpoint {
$return[$key] = false;
break;
case 'url' :
+ if ( is_object( $value ) && isset( $value->url ) && false !== strpos( $value->url, 'https://videos.files.wordpress.com/' ) ) {
+ $value = $value->url;
+ }
+ // Check for string since esc_url_raw() expects one.
+ if ( ! is_string( $value ) ) {
+ break;
+ }
$return[$key] = (string) esc_url_raw( $value );
break;
case 'string' :
@@ -1909,6 +1916,7 @@ abstract class WPCOM_JSON_API_Endpoint {
*/
protected function is_file_supported_for_sideloading( $file ) {
if ( class_exists( 'finfo' ) ) { // php 5.3+
+ // phpcs:ignore PHPCompatibility.PHP.NewClasses.finfoFound
$finfo = new finfo( FILEINFO_MIME );
$mime = explode( '; ', $finfo->file( $file ) );
$type = $mime[0];