Press This: support passing i parameter to add an image src.

Props stephdau, azaozz. Fixes #32173.

git-svn-id: https://develop.svn.wordpress.org/trunk@32936 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-06-25 03:05:47 +00:00
parent dc56b51c47
commit 6d6a1980b2

View File

@ -738,6 +738,15 @@ class WP_Press_This {
}
}
}
// Support passing a single image src as `i`
if ( ! empty( $_REQUEST['i'] ) && ( $img_src = $this->_limit_img( wp_unslash( $_REQUEST['i'] ) ) ) ) {
if ( empty( $data['_images'] ) ) {
$data['_images'] = array( $img_src );
} elseif ( ! in_array( $img_src, $data['_images'], true ) ) {
array_unshift( $data['_images'], $img_src );
}
}
}
/**