Make WordPress Core

Changeset 32936


Ignore:
Timestamp:
06/25/2015 03:05:47 AM (9 years ago)
Author:
azaozz
Message:

Press This: support passing i parameter to add an image src.
Props stephdau, azaozz. Fixes #32173.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r32934 r32936  
    739739                }
    740740            }
     741
     742            // Support passing a single image src as `i`
     743            if ( ! empty( $_REQUEST['i'] ) && ( $img_src = $this->_limit_img( wp_unslash( $_REQUEST['i'] ) ) ) ) {
     744                if ( empty( $data['_images'] ) ) {
     745                    $data['_images'] = array( $img_src );
     746                } elseif ( ! in_array( $img_src, $data['_images'], true ) ) {
     747                    array_unshift( $data['_images'], $img_src );
     748                }
     749            }
    741750        }
    742751
Note: See TracChangeset for help on using the changeset viewer.