summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
committerAnthony G. Basile <blueness@gentoo.org>2018-06-08 10:09:24 -0400
commita6b006c0f1ef757f23375f7906193370337d8bd7 (patch)
tree4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/class.jetpack-post-images.php
parentUpdate akismet 4.0.7 (diff)
downloadblogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2
blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/class.jetpack-post-images.php')
-rw-r--r--plugins/jetpack/class.jetpack-post-images.php47
1 files changed, 25 insertions, 22 deletions
diff --git a/plugins/jetpack/class.jetpack-post-images.php b/plugins/jetpack/class.jetpack-post-images.php
index 90430abf..6f7d5caf 100644
--- a/plugins/jetpack/class.jetpack-post-images.php
+++ b/plugins/jetpack/class.jetpack-post-images.php
@@ -51,28 +51,31 @@ class Jetpack_PostImages {
$start = strpos( $slideshow, '[', $pos );
$end = strpos( $slideshow, ']', $start );
$post_images = json_decode( wp_specialchars_decode( str_replace( "'", '"', substr( $slideshow, $start, $end - $start + 1 ) ), ENT_QUOTES ) ); // parse via JSON
- foreach ( $post_images as $post_image ) {
- if ( !$post_image_id = absint( $post_image->id ) )
- continue;
-
- $meta = wp_get_attachment_metadata( $post_image_id );
-
- // Must be larger than 200x200 (or user-specified)
- if ( !isset( $meta['width'] ) || $meta['width'] < $width )
- continue;
- if ( !isset( $meta['height'] ) || $meta['height'] < $height )
- continue;
-
- $url = wp_get_attachment_url( $post_image_id );
-
- $images[] = array(
- 'type' => 'image',
- 'from' => 'slideshow',
- 'src' => $url,
- 'src_width' => $meta['width'],
- 'src_height' => $meta['height'],
- 'href' => $permalink,
- );
+ // If the JSON didn't decode don't try and act on it.
+ if ( is_array( $post_images ) ) {
+ foreach ( $post_images as $post_image ) {
+ if ( !$post_image_id = absint( $post_image->id ) )
+ continue;
+
+ $meta = wp_get_attachment_metadata( $post_image_id );
+
+ // Must be larger than 200x200 (or user-specified)
+ if ( !isset( $meta['width'] ) || $meta['width'] < $width )
+ continue;
+ if ( !isset( $meta['height'] ) || $meta['height'] < $height )
+ continue;
+
+ $url = wp_get_attachment_url( $post_image_id );
+
+ $images[] = array(
+ 'type' => 'image',
+ 'from' => 'slideshow',
+ 'src' => $url,
+ 'src_width' => $meta['width'],
+ 'src_height' => $meta['height'],
+ 'href' => $permalink,
+ );
+ }
}
}
ob_end_clean();