mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 21:00:59 +01:00
Press This: Verify intent before fetching in-page resources using Press This.
Props vortfu Merges [40195] to the 4.5 branch. Built from https://develop.svn.wordpress.org/branches/4.5@40198 git-svn-id: http://core.svn.wordpress.org/branches/4.5@40137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a9f9235d88
commit
806d303a20
@ -720,7 +720,11 @@ class WP_Press_This {
|
||||
* making PT fully backward compatible with the older bookmarklet.
|
||||
*/
|
||||
if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
|
||||
$data = $this->source_data_fetch_fallback( $data['u'], $data );
|
||||
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
|
||||
$data = $this->source_data_fetch_fallback( $data['u'], $data );
|
||||
} else {
|
||||
$data['errors'] = 'missing nonce';
|
||||
}
|
||||
} else {
|
||||
foreach ( array( '_images', '_embeds' ) as $type ) {
|
||||
if ( empty( $_POST[ $type ] ) ) {
|
||||
@ -1265,7 +1269,7 @@ class WP_Press_This {
|
||||
$site_data = array(
|
||||
'v' => ! empty( $data['v'] ) ? $data['v'] : '',
|
||||
'u' => ! empty( $data['u'] ) ? $data['u'] : '',
|
||||
'hasData' => ! empty( $data ),
|
||||
'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
|
||||
);
|
||||
|
||||
if ( ! empty( $images ) ) {
|
||||
@ -1397,8 +1401,9 @@ class WP_Press_This {
|
||||
<div id="scanbar" class="scan">
|
||||
<form method="GET">
|
||||
<label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
|
||||
<input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
|
||||
<input type="url" name="u" id="url-scan" class="scan-url" value="<?php echo esc_attr( $site_data['u'] ) ?>" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
|
||||
<input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
|
||||
<?php wp_nonce_field( 'scan-site' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user