Commit 87987b67 authored by lechuck's avatar lechuck Committed by lucha

Upgrade Wordpress to version 4.2.4

parent 678b5abf
......@@ -9,7 +9,7 @@
<body>
<h1 id="logo">
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
<br /> Version 4.2.3
<br /> Version 4.2.4
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
......
......@@ -41,7 +41,11 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
</h2>
<div class="changelog point-releases">
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 3 ); ?></h3>
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 4 ); ?></h3>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 4 ), '4.2.4', number_format_i18n( 4 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.4' ); ?>
</p>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 20 ), '4.2.3', number_format_i18n( 20 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.3' ); ?>
......
......@@ -972,11 +972,14 @@ class Plugin_Upgrader extends WP_Upgrader {
// Check the folder contains at least 1 valid plugin.
$plugins_found = false;
foreach ( glob( $working_directory . '*.php' ) as $file ) {
$info = get_plugin_data($file, false, false);
if ( !empty( $info['Name'] ) ) {
$plugins_found = true;
break;
$files = glob( $working_directory . '*.php' );
if ( $files ) {
foreach ( $files as $file ) {
$info = get_plugin_data( $file, false, false );
if ( ! empty( $info['Name'] ) ) {
$plugins_found = true;
break;
}
}
}
......
......@@ -1542,7 +1542,7 @@ function _admin_notice_post_locked() {
// Allow plugins to prevent some users overriding the post lock
if ( $override ) {
?>
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?php _e('Take over'); ?></a>
<?php
}
......
......@@ -1249,8 +1249,11 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
$files[] = "{$directory}example.html";
}
foreach ( glob( $directory . '*', GLOB_ONLYDIR ) as $dir ) {
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
$dirs = glob( $directory . '*', GLOB_ONLYDIR );
if ( $dirs ) {
foreach ( $dirs as $dir ) {
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
}
}
return $files;
......
......@@ -492,7 +492,7 @@ var wpNavMenu;
title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
}
$this.prop('title', title).html( title );
$this.prop('title', title).text( title );
// Mark this item's accessibility as refreshed
$this.data( 'needs_accessibility_refresh', false );
......
This diff is collapsed.
......@@ -160,6 +160,7 @@ case 'edit':
wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
if ( ! empty( $_GET['get-post-lock'] ) ) {
check_admin_referer( 'lock-post_' . $post_id );
wp_set_post_lock( $post_id );
wp_redirect( get_edit_post_link( $post_id, 'url' ) );
exit();
......
......@@ -6,7 +6,7 @@
Plugin Name: Akismet
Plugin URI: http://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.1.3
Version: 3.1.1
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
......@@ -35,7 +35,7 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
define( 'AKISMET_VERSION', '3.1.3' );
define( 'AKISMET_VERSION', '3.1.1' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
......
......@@ -232,7 +232,7 @@ class Akismet_Admin {
if ( defined( 'WPCOM_API_KEY' ) )
return false; //shouldn't have option to save key if already defined
$new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
$new_key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
$old_key = Akismet::get_api_key();
if ( empty( $new_key ) ) {
......@@ -290,6 +290,15 @@ class Akismet_Admin {
// WP 2.5+
public static function rightnow_stats() {
global $submenu, $wp_db_version;
if ( 8645 < $wp_db_version ) // 2.7
$link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
elseif ( isset( $submenu['edit-comments.php'] ) )
$link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit-comments.php' ) );
else
$link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit.php' ) );
if ( $count = get_option('akismet_spam_count') ) {
$intro = sprintf( _n(
'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already. ',
......@@ -300,16 +309,15 @@ class Akismet_Admin {
$intro = sprintf( __('<a href="%s">Akismet</a> blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' );
}
$link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
$link = function_exists( 'esc_url' ) ? esc_url( $link ) : clean_url( $link );
if ( $queue_count = self::get_spam_count() ) {
$queue_text = sprintf( _n(
'There&#8217;s <a href="%2$s">%1$s comment</a> in your spam queue right now.',
'There are <a href="%2$s">%1$s comments</a> in your spam queue right now.',
$queue_count
, 'akismet'), number_format_i18n( $queue_count ), esc_url( $link ) );
, 'akismet'), number_format_i18n( $queue_count ), $link );
} else {
$queue_text = sprintf( __( "There&#8217;s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), esc_url( $link ) );
$queue_text = sprintf( __( "There&#8217;s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), $link );
}
$text = $intro . '<br />' . $queue_text;
......@@ -371,22 +379,17 @@ class Akismet_Admin {
update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' );
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-spam' );
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and caught this comment as spam', 'akismet'), 'check-spam' );
} elseif ( 'false' == $response[1] ) {
update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' );
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-ham' );
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and cleared this comment', 'akismet'), 'check-ham' );
// abnormal result: error
} else {
update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
Akismet::update_comment_history(
$c['comment_ID'],
'',
'recheck-error',
array( 'response' => substr( $response[1], 0, 50 ) )
);
Akismet::update_comment_history( $c['comment_ID'], sprintf( __('Akismet was unable to re-check this comment (response: %s)', 'akismet'), substr($response[1], 0, 50)), 'check-error' );
}
delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
......@@ -491,95 +494,11 @@ class Akismet_Admin {
if ( $history ) {
echo '<div class="akismet-history" style="margin: 13px;">';
foreach ( $history as $row ) {
$time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT';
$message = '';
if ( ! empty( $row['message'] ) ) {
// Old versions of Akismet stored the message as a literal string in the commentmeta.
// New versions don't do that for two reasons:
// 1) Save space.
// 2) The message can be translated into the current language of the blog, not stuck
// in the language of the blog when the comment was made.
$message = $row['message'];
}
// If possible, use a current translation.
switch ( $row['event'] ) {
case 'recheck-spam';
$message = __( 'Akismet re-checked and caught this comment as spam.', 'akismet' );
break;
case 'check-spam':
$message = __( 'Akismet caught this comment as spam.', 'akismet' );
break;
case 'recheck-ham':
$message = __( 'Akismet re-checked and cleared this comment.', 'akismet' );
break;
case 'check-ham':
$message = __( 'Akismet cleared this comment.', 'akismet' );
break;
case 'wp-blacklisted':
$message = __( 'Comment was caught by wp_blacklist_check.', 'akismet' );
break;
case 'report-spam':
if ( isset( $row['user'] ) ) {
$message = sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] );
}
else if ( ! $message ) {
$message = __( 'This comment was reported as spam.', 'akismet' );
}
break;
case 'report-ham':
if ( isset( $row['user'] ) ) {
$message = sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] );
}
else if ( ! $message ) {
$message = __( 'This comment was reported as not spam.', 'akismet' );
}
break;
case 'cron-retry-spam':
$message = __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet');
break;
case 'cron-retry-ham':
$message = __( 'Akismet cleared this comment during an automatic retry.', 'akismet');
break;
case 'check-error':
if ( isset( $row['meta'], $row['meta']['response'] ) ) {
$message = sprintf( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet'), $row['meta']['response'] );
}
break;
case 'recheck-error':
if ( isset( $row['meta'], $row['meta']['response'] ) ) {
$message = sprintf( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet'), $row['meta']['response'] );
}
break;
default:
if ( preg_match( '/^status-changed/', $row['event'] ) ) {
// Half of these used to be saved without the dash after 'status-changed'.
// See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
$new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
$message = sprintf( __( 'Comment status was changed to %s', 'akismet' ), $new_status );
}
else if ( preg_match( '/^status-/', $row['event'] ) ) {
$new_status = preg_replace( '/^status-/', '', $row['event'] );
if ( isset( $row['user'] ) ) {
$message = sprintf( __( '%1$s changed the comment status to %2$s.', 'akismet' ), $row['user'], $new_status );
}
}
break;
}
echo '<div style="margin-bottom: 13px;">';
echo '<span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span>';
echo ' - ';
echo esc_html( $message );
echo '</div>';
echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span> - ';
echo esc_html( $row['message'] ) . '</div>';
}
echo '</div>';
}
}
......@@ -712,16 +631,13 @@ class Akismet_Admin {
}
public static function get_akismet_user( $api_key ) {
$akismet_user = false;
$subscription_verification = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_bloginfo( 'url' ) ) ), 'get-subscription' );
if ( ! empty( $subscription_verification[1] ) ) {
if ( 'invalid' !== $subscription_verification[1] ) {
$akismet_user = json_decode( $subscription_verification[1] );
}
}
$akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key ) ), 'get-subscription' );
if ( ! empty( $akismet_user[1] ) )
$akismet_user = json_decode( $akismet_user[1] );
else
$akismet_user = false;
return $akismet_user;
}
......@@ -729,13 +645,12 @@ class Akismet_Admin {
$stat_totals = array();
foreach( array( '6-months', 'all' ) as $interval ) {
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_bloginfo( 'url' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
if ( ! empty( $response[1] ) ) {
$stat_totals[$interval] = json_decode( $response[1] );
}
}
return $stat_totals;
}
......@@ -812,7 +727,7 @@ class Akismet_Admin {
}
}
if ( $api_key = Akismet::get_api_key() && ( empty( self::$notices['status'] ) || 'existing-key-invalid' != self::$notices['status'] ) ) {
if ( $api_key = Akismet::get_api_key() ) {
self::display_configuration_page();
return;
}
......@@ -853,16 +768,8 @@ class Akismet_Admin {
public static function display_configuration_page() {
$api_key = Akismet::get_api_key();
$akismet_user = self::get_akismet_user( $api_key );
if ( ! $akismet_user ) {
// This could happen if the user's key became invalid after it was previously valid and successfully set up.
self::$notices['status'] = 'existing-key-invalid';
self::display_start_page();
return;
}
$stat_totals = self::get_stats( $api_key );
// If unset, create the new strictness option using the old discard option to determine its default
if ( get_option( 'akismet_strictness' ) === false )
add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') );
......
=== Akismet ===
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Tags: akismet, comments, spam
Requires at least: 3.2
Tested up to: 4.2.2
Stable tag: 3.1.3
Tested up to: 4.2.1
Stable tag: 3.1.1
License: GPLv2 or later
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
......@@ -30,21 +30,6 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
= 3.1.3 =
*Release Date - 6 July 2015*
* Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
= 3.1.2 =
*Release Date - 7 June 2015*
* Reduced the amount of space Akismet uses in the commentmeta table.
* Fixed a bug where some comments with quotes in the author name weren't getting history entries
* Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation.
* Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted.
* When deactivating the plugin, notify the Akismet API so the site can be marked as inactive.
* Clearer error messages.
= 3.1.1 =
*Release Date - 17th March, 2015*
......
......@@ -67,7 +67,7 @@
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
<td width="5%"/>
<td align="left">
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
<span class="api-key"><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
</td>
</tr>
<?php endif; ?>
......
......@@ -75,11 +75,7 @@
<?php elseif ( $type == 'no-sub' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e( 'Your subscription is missing.', 'akismet'); ?></h3>
<p class="description">
<?php printf( __( 'Since 2012, Akismet began using subscriptions for all accounts (even free ones). It looks like a subscription has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?>
</p>
<p class="description"><?php printf( __('Since 2012, Akismet began using subscriptions for all accounts (even free ones). It looks like a subscription has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/' ); ?></p>
</div>
<?php elseif ( $type == 'new-key-valid' ) :?>
<div class="wrap alert active">
......@@ -89,31 +85,18 @@
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'existing-key-invalid' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'Your API key is no longer valid. Please enter a new key or contact support@akismet.com.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'new-key-failed' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified.' , 'akismet'); ?></h3>
<p class="description"><?php printf( __('The connection to akismet.com cannot be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
<h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
<div class="wrap alert critical">
<?php if ( $level == 'yellow' ): ?>
<h3 class="key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
<p class="description">
<?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'http://docs.akismet.com/billing/add-more-sites/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
</p>
<h3 class="key-status failed"><?php esc_html_e("You're using your Akismet key on more sites than your Pro subscription allows.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your Pro subscription allows the use of Akismet on only one site. Please <a href="http://docs.akismet.com/billing/add-more-sites/">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.<br /><br />If you have any questions, please get in touch with our support team.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<?php elseif ( $level == 'red' ): ?>
<h3 class="key-status failed"><?php esc_html_e( 'You&#8217;re using Akismet on far too many sites for your Pro subscription.', 'akismet' ); ?></h3>
<p class="description">
<?php printf( __( 'To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?></p>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?></p>
</p>
<h3 class="key-status failed"><?php esc_html_e("You're using Akismet on far too many sites for your Pro subscription.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<?php endif; ?>
</div>
<?php endif;?>
\ No newline at end of file
<?php endif;?>
......@@ -8,7 +8,7 @@
<?php echo esc_attr( $akismet_user->user_email ); ?>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/>
<input type="hidden" name="redirect" value="plugin-signup"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register Akismet' , 'akismet'); ?>"/>
......@@ -22,7 +22,7 @@
<?php printf( esc_html__( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ); ?>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="user_id" value="<?php echo $akismet_user->ID;?>"/>
<input type="hidden" name="redirect" value="upgrade"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet'); ?>"/>
......@@ -64,7 +64,7 @@
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
</div>
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
<input id="key" name="key" type="text" size="15" value="" class="regular-text code">
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
......@@ -85,7 +85,7 @@
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
</div>
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
<input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( Akismet::get_api_key() ); ?>" class="regular-text code">
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
......
......@@ -1124,7 +1124,7 @@ final class WP_Customize_Widgets {
return null;
}
if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
if ( ! hash_equals( $this->get_instance_hash_key( $decoded ), $value['instance_hash_key'] ) ) {
return null;
}
......
......@@ -312,11 +312,14 @@ class WP_Embed {
* @return string Potentially modified $content.
*/
public function autoembed( $content ) {
// Strip newlines from all elements.
$content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
// Replace line breaks from all HTML elements with placeholders.
$content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) );
// Find URLs that are on their own line.
return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
$content = preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
// Put the line breaks back.
return str_replace( '<!-- wp-line-break -->', "\n", $content );
}
/**
......
......@@ -1410,7 +1410,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $title ); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
......
......@@ -419,10 +419,10 @@ function wpautop($pee, $br = true) {
$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
// Standardize newline characters to "\n".
$pee = str_replace(array("\r\n", "\r"), "\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee);
// Strip newlines from all elements.
$pee = wp_replace_in_html_tags( $pee, array( "\n" => " " ) );
// Find newlines in all elements and add placeholders.
$pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
// Collapse line breaks before and after <option> elements so they don't get autop'd.
if ( strpos( $pee, '<option' ) !== false ) {
......@@ -509,9 +509,59 @@ function wpautop($pee, $br = true) {
if ( !empty($pre_tags) )
$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
// Restore newlines in all elements.
$pee = str_replace( " <!-- wpnl --> ", "\n", $pee );
return $pee;
}
/**
* Separate HTML elements and comments from the text.
*
* @since 4.2.4
*
* @param string $input The text which has to be formatted.
* @return array The formatted text.
*/
function wp_html_split( $input ) {
static $regex;
if ( ! isset( $regex ) ) {
$comments =
'!' // Start of comment, after the <.
. '(?:' // Unroll the loop: Consume everything until --> is found.
. '-(?!->)' // Dash not followed by end of comment.
. '[^\-]*+' // Consume non-dashes.
. ')*+' // Loop possessively.
. '(?:-->)?'; // End of comment. If not found, match all input.
$cdata =
'!\[CDATA\[' // Start of comment, after the <.
. '[^\]]*+' // Consume non-].
. '(?:' // Unroll the loop: Consume everything until ]]> is found.
. '](?!]>)' // One ] not followed by end of comment.
. '[^\]]*+' // Consume non-].
. ')*+' // Loop possessively.
. '(?:]]>)?'; // End of comment. If not found, match all input.
$regex =
'/(' // Capture the entire match.
. '<' // Find start of element.
. '(?(?=!--)' // Is this a comment?
. $comments // Find end of comment.
. '|'
. '(?(?=!\[CDATA\[)' // Is this a comment?
. $cdata // Find end of comment.
. '|'
. '[^>]*>?' // Find end of element. If not found, match all input.
. ')'
. ')'
. ')/s';
}
return preg_split( $regex, $input, -1, PREG_SPLIT_DELIM_CAPTURE );
}
/**
* Replace characters or phrases within HTML elements only.
*
......@@ -523,25 +573,7 @@ function wpautop($pee, $br = true) {
*/
function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
// Find all elements.
$comments =
'!' // Start of comment, after the <.
. '(?:' // Unroll the loop: Consume everything until --> is found.
. '-(?!->)' // Dash not followed by end of comment.
. '[^\-]*+' // Consume non-dashes.
. ')*+' // Loop possessively.
. '(?:-->)?'; // End of comment. If not found, match all input.
$regex =
'/(' // Capture the entire match.
. '<' // Find start of element.
. '(?(?=!--)' // Is this a comment?
. $comments // Find end of comment.
. '|'
. '[^>]*>?' // Find end of element. If not found, match all input.
. ')'
. ')/s';
$textarr = preg_split( $regex, $haystack, -1, PREG_SPLIT_DELIM_CAPTURE );
$textarr = wp_html_split( $haystack );
$changed = false;