Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b63a9e4b6 |
@@ -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.9
|
||||
<br /> Version 4.2.2
|
||||
</h1>
|
||||
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
||||
|
||||
|
||||
@@ -41,42 +41,14 @@ 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', 9 ); ?></h3>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 9 ), '4.2.9' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.9' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 6 ), '4.2.8' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.8' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 2 ), '4.2.7' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.7' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 1 ), '4.2.6' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.6' ); ?>
|
||||
</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.', 2 ), '4.2.5', number_format_i18n( 2 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.5' ); ?>
|
||||
</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.', 4 ), '4.2.4', number_format_i18n( 4 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://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>.' ), 'https://codex.wordpress.org/Version_4.2.3' ); ?>
|
||||
</p>
|
||||
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 2 ); ?></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.', 13 ), '4.2.2', number_format_i18n( 13 ) ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.2' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.2' ); ?>
|
||||
</p>
|
||||
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
|
||||
'<strong>Version %1$s</strong> addressed some security issues.', 1 ), '4.2.1' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.2.1' ); ?>
|
||||
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.1' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -545,7 +545,6 @@ span.wp-media-buttons-icon:before {
|
||||
.notification-dialog {
|
||||
position: fixed;
|
||||
top: 30%;
|
||||
max-height: 70%;
|
||||
right: 50%;
|
||||
width: 450px;
|
||||
margin-right: -225px;
|
||||
@@ -554,7 +553,6 @@ span.wp-media-buttons-icon:before {
|
||||
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
|
||||
line-height: 1.5;
|
||||
z-index: 1000005;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.notification-dialog-background {
|
||||
|
||||
@@ -545,7 +545,6 @@ span.wp-media-buttons-icon:before {
|
||||
.notification-dialog {
|
||||
position: fixed;
|
||||
top: 30%;
|
||||
max-height: 70%;
|
||||
left: 50%;
|
||||
width: 450px;
|
||||
margin-left: -225px;
|
||||
@@ -554,7 +553,6 @@ span.wp-media-buttons-icon:before {
|
||||
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
|
||||
line-height: 1.5;
|
||||
z-index: 1000005;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.notification-dialog-background {
|
||||
|
||||
@@ -862,7 +862,6 @@ table.form-table td .updated p {
|
||||
|
||||
.request-filesystem-credentials-dialog .notification-dialog {
|
||||
top: 15%;
|
||||
max-height: 85%;
|
||||
}
|
||||
|
||||
.request-filesystem-credentials-dialog-content {
|
||||
@@ -1158,11 +1157,11 @@ table.form-table td .updated p {
|
||||
.request-filesystem-credentials-dialog .notification-dialog{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
margin: 0;
|
||||
right: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -862,7 +862,6 @@ table.form-table td .updated p {
|
||||
|
||||
.request-filesystem-credentials-dialog .notification-dialog {
|
||||
top: 15%;
|
||||
max-height: 85%;
|
||||
}
|
||||
|
||||
.request-filesystem-credentials-dialog-content {
|
||||
@@ -1158,11 +1157,11 @@ table.form-table td .updated p {
|
||||
.request-filesystem-credentials-dialog .notification-dialog{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
wp-admin/css/login-rtl.min.css
vendored
2
wp-admin/css/login-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
2
wp-admin/css/login.min.css
vendored
2
wp-admin/css/login.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -846,7 +846,6 @@ input[type="search"].categories-search,
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
font-size: 14px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
|
||||
2
wp-admin/css/press-this-rtl.min.css
vendored
2
wp-admin/css/press-this-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -846,7 +846,6 @@ input[type="search"].categories-search,
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
font-size: 14px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
|
||||
2
wp-admin/css/press-this.min.css
vendored
2
wp-admin/css/press-this.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -350,10 +350,6 @@ div#widgets-right .closed .widgets-sortables {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.js .widgets-holder-wrap.closed .widget.ui-sortable-helper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Hide Widget Settings by Default */
|
||||
.widget-inside,
|
||||
.widget-description {
|
||||
@@ -510,10 +506,6 @@ div#widgets-right .widget-top:hover,
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#available-widgets .widget.ui-draggable-dragging .widget-top {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/* =Media Queries
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
|
||||
@@ -350,10 +350,6 @@ div#widgets-right .closed .widgets-sortables {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.js .widgets-holder-wrap.closed .widget.ui-sortable-helper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Hide Widget Settings by Default */
|
||||
.widget-inside,
|
||||
.widget-description {
|
||||
@@ -510,10 +506,6 @@ div#widgets-right .widget-top:hover,
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#available-widgets .widget.ui-draggable-dragging .widget-top {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/* =Media Queries
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
|
||||
2
wp-admin/css/wp-admin-rtl.min.css
vendored
2
wp-admin/css/wp-admin-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
2
wp-admin/css/wp-admin.min.css
vendored
2
wp-admin/css/wp-admin.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -18,11 +18,9 @@ if ( ! current_user_can( 'customize' ) ) {
|
||||
|
||||
wp_reset_vars( array( 'url', 'return' ) );
|
||||
$url = wp_unslash( $url );
|
||||
$url = esc_url_raw( $url );
|
||||
$url = wp_validate_redirect( $url, home_url( '/' ) );
|
||||
if ( $return ) {
|
||||
$return = wp_unslash( $return );
|
||||
$return = esc_url_raw( $return );
|
||||
$return = wp_validate_redirect( $return );
|
||||
}
|
||||
if ( ! $return ) {
|
||||
|
||||
@@ -1540,12 +1540,10 @@ function wp_ajax_inline_save() {
|
||||
$data['parent_id'] = $data['post_parent'];
|
||||
|
||||
// Status.
|
||||
if ( isset( $data['keep_private'] ) && 'private' == $data['keep_private'] ) {
|
||||
$data['visibility'] = 'private';
|
||||
if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
|
||||
$data['post_status'] = 'private';
|
||||
} else {
|
||||
else
|
||||
$data['post_status'] = $data['_status'];
|
||||
}
|
||||
|
||||
if ( empty($data['comment_status']) )
|
||||
$data['comment_status'] = 'closed';
|
||||
@@ -2603,7 +2601,7 @@ function wp_ajax_get_revision_diffs() {
|
||||
if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) )
|
||||
wp_send_json_error();
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $post->ID ) )
|
||||
if ( ! current_user_can( 'read_post', $post->ID ) )
|
||||
wp_send_json_error();
|
||||
|
||||
// Really just pre-loading the cache here.
|
||||
@@ -2885,8 +2883,6 @@ function wp_ajax_destroy_sessions() {
|
||||
* @see Plugin_Upgrader
|
||||
*/
|
||||
function wp_ajax_update_plugin() {
|
||||
global $wp_filesystem;
|
||||
|
||||
$plugin = urldecode( $_POST['plugin'] );
|
||||
|
||||
$status = array(
|
||||
@@ -2896,7 +2892,6 @@ function wp_ajax_update_plugin() {
|
||||
'oldVersion' => '',
|
||||
'newVersion' => '',
|
||||
);
|
||||
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||
if ( $plugin_data['Version'] ) {
|
||||
$status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
|
||||
@@ -2911,17 +2906,15 @@ function wp_ajax_update_plugin() {
|
||||
|
||||
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
||||
|
||||
wp_update_plugins();
|
||||
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
$upgrader = new Plugin_Upgrader( $skin );
|
||||
$result = $upgrader->bulk_upgrade( array( $plugin ) );
|
||||
|
||||
if ( is_array( $result ) && empty( $result[$plugin] ) && is_wp_error( $skin->result ) ) {
|
||||
$result = $skin->result;
|
||||
$current = get_site_transient( 'update_plugins' );
|
||||
if ( empty( $current ) ) {
|
||||
wp_update_plugins();
|
||||
}
|
||||
|
||||
if ( is_array( $result ) && !empty( $result[ $plugin ] ) ) {
|
||||
$upgrader = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
|
||||
$result = $upgrader->bulk_upgrade( array( $plugin ) );
|
||||
|
||||
if ( is_array( $result ) ) {
|
||||
$plugin_update_data = current( $result );
|
||||
|
||||
/*
|
||||
@@ -2936,8 +2929,7 @@ function wp_ajax_update_plugin() {
|
||||
wp_send_json_error( $status );
|
||||
}
|
||||
|
||||
$plugin_data = get_plugins( '/' . $result[ $plugin ]['destination_name'] );
|
||||
$plugin_data = reset( $plugin_data );
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||
|
||||
if ( $plugin_data['Version'] ) {
|
||||
$status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
|
||||
@@ -2947,18 +2939,10 @@ function wp_ajax_update_plugin() {
|
||||
} else if ( is_wp_error( $result ) ) {
|
||||
$status['error'] = $result->get_error_message();
|
||||
wp_send_json_error( $status );
|
||||
|
||||
} else if ( is_bool( $result ) && ! $result ) {
|
||||
} else if ( is_bool( $result ) && ! $result ) {
|
||||
$status['errorCode'] = 'unable_to_connect_to_filesystem';
|
||||
$status['error'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
|
||||
|
||||
// Pass through the error from WP_Filesystem if one was raised
|
||||
if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
|
||||
$status['error'] = $wp_filesystem->errors->get_error_message();
|
||||
}
|
||||
|
||||
wp_send_json_error( $status );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
||||
<?php echo $att_title; ?></a>
|
||||
<?php };
|
||||
_media_states( $post ); ?></strong>
|
||||
<p class="filename"><?php echo esc_html( wp_basename( $post->guid ) ); ?></p>
|
||||
<p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
|
||||
<?php
|
||||
echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
|
||||
?>
|
||||
|
||||
@@ -224,7 +224,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
echo "<td $attributes><a href='" . esc_url( "mailto:$user->user_email" ) . "'>$user->user_email</a></td>";
|
||||
echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
|
||||
break;
|
||||
|
||||
case 'registered':
|
||||
|
||||
@@ -972,14 +972,11 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
|
||||
// Check the folder contains at least 1 valid plugin.
|
||||
$plugins_found = false;
|
||||
$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;
|
||||
}
|
||||
foreach ( glob( $working_directory . '*.php' ) as $file ) {
|
||||
$info = get_plugin_data($file, false, false);
|
||||
if ( !empty( $info['Name'] ) ) {
|
||||
$plugins_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
$r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
|
||||
break;
|
||||
case 'email':
|
||||
$r .= "<td $attributes><a href='" . esc_url( "mailto:$email" ) . "' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
|
||||
$r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
|
||||
break;
|
||||
case 'role':
|
||||
$r .= "<td $attributes>$role_name</td>";
|
||||
|
||||
@@ -418,10 +418,6 @@ function wp_network_dashboard_right_now() {
|
||||
function wp_dashboard_quick_press( $error_msg = false ) {
|
||||
global $post_ID;
|
||||
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
|
||||
$last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
|
||||
if ( $last_post_id ) {
|
||||
|
||||
@@ -165,13 +165,6 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||
$post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
|
||||
}
|
||||
|
||||
if ( isset( $post_data['post_category'] ) ) {
|
||||
$category_object = get_taxonomy( 'category' );
|
||||
if ( ! current_user_can( $category_object->cap->assign_terms ) ) {
|
||||
unset( $post_data['post_category'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
@@ -1299,15 +1292,15 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . esc_html( $post_name_abridged ) . '</span>';
|
||||
$display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, esc_html( urldecode( $permalink ) ) );
|
||||
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
|
||||
$display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) );
|
||||
$pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) );
|
||||
|
||||
$return = '<strong>' . __( 'Permalink:' ) . "</strong>\n";
|
||||
$return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
|
||||
$return .= '‎'; // Fix bi-directional text display defect in RTL languages.
|
||||
$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __( 'Edit' ) . "</a></span>\n";
|
||||
$return .= '<span id="editable-post-name-full">' . esc_html( $post_name ) . "</span>\n";
|
||||
$return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
|
||||
}
|
||||
|
||||
if ( isset( $view_post ) ) {
|
||||
@@ -1321,7 +1314,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
$pretty_permalink = $permalink;
|
||||
}
|
||||
|
||||
$return .= "<span id='view-post-btn'><a href='" . esc_url( $pretty_permalink ) . "' class='button button-small'>$view_post</a></span>\n";
|
||||
$return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1549,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', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?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', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -1249,11 +1249,8 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
|
||||
$files[] = "{$directory}example.html";
|
||||
}
|
||||
|
||||
$dirs = glob( $directory . '*', GLOB_ONLYDIR );
|
||||
if ( $dirs ) {
|
||||
foreach ( $dirs as $dir ) {
|
||||
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
|
||||
}
|
||||
foreach ( glob( $directory . '*', GLOB_ONLYDIR ) as $dir ) {
|
||||
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
|
||||
}
|
||||
|
||||
return $files;
|
||||
|
||||
@@ -524,11 +524,14 @@ function upgrade_all() {
|
||||
if ( $wp_current_db_version < 29630 )
|
||||
upgrade_400();
|
||||
|
||||
// Don't harsh my mellow. upgrade_422() must be called before
|
||||
// upgrade_420() to catch bad comments prior to any auto-expansion of
|
||||
// MySQL column widths.
|
||||
if ( $wp_current_db_version < 31534 )
|
||||
upgrade_422();
|
||||
|
||||
if ( $wp_current_db_version < 31536 )
|
||||
upgrade_423();
|
||||
if ( $wp_current_db_version < 31351 )
|
||||
upgrade_420();
|
||||
|
||||
maybe_disable_link_manager();
|
||||
|
||||
@@ -1423,6 +1426,19 @@ function upgrade_400() {
|
||||
* @since 4.2.0
|
||||
*/
|
||||
function upgrade_420() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
|
||||
if ( is_multisite() ) {
|
||||
$tables = $wpdb->tables( 'blog' );
|
||||
} else {
|
||||
$tables = $wpdb->tables( 'all' );
|
||||
}
|
||||
|
||||
foreach ( $tables as $table ) {
|
||||
maybe_convert_table_to_utf8mb4( $table );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1481,31 +1497,6 @@ function upgrade_422() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute changes made in WordPress 4.2.0.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*/
|
||||
function upgrade_423() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
|
||||
if ( is_multisite() ) {
|
||||
$tables = $wpdb->tables( 'blog' );
|
||||
} else {
|
||||
$tables = $wpdb->tables( 'all' );
|
||||
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
$global_tables = $wpdb->tables( 'global' );
|
||||
$tables = array_diff_assoc( $tables, $global_tables );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $tables as $table ) {
|
||||
maybe_convert_table_to_utf8mb4( $table );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes network-level upgrade routines.
|
||||
*
|
||||
@@ -1605,7 +1596,7 @@ function upgrade_network() {
|
||||
|
||||
// 4.2
|
||||
if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
|
||||
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
|
||||
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||
$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
|
||||
$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||
@@ -1621,7 +1612,7 @@ function upgrade_network() {
|
||||
|
||||
// 4.2.2
|
||||
if ( $wp_current_db_version < 31535 && 'utf8mb4' === $wpdb->charset ) {
|
||||
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
if ( ! ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && DO_NOT_UPGRADE_GLOBAL_TABLES ) ) {
|
||||
$upgrade = false;
|
||||
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
||||
foreach( $indexes as $index ) {
|
||||
@@ -1636,17 +1627,6 @@ function upgrade_network() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4.2.3
|
||||
if ( $wp_current_db_version < 31536 && $wpdb->charset === 'utf8mb4' ) {
|
||||
if ( ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
$tables = $wpdb->tables( 'global' );
|
||||
|
||||
foreach ( $tables as $table ) {
|
||||
maybe_convert_table_to_utf8mb4( $table );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1779,17 +1759,6 @@ function maybe_convert_table_to_utf8mb4( $table ) {
|
||||
}
|
||||
}
|
||||
|
||||
$table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" );
|
||||
if ( ! $table_details ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
list( $table_charset ) = explode( '_', $table_details->Collation );
|
||||
$table_charset = strtolower( $table_charset );
|
||||
if ( 'utf8mb4' === $table_charset ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
|
||||
}
|
||||
|
||||
@@ -2477,9 +2446,14 @@ function pre_schema_upgrade() {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 30133 ) {
|
||||
// dbDelta() can recreate but can't drop the index.
|
||||
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug" );
|
||||
}
|
||||
|
||||
// Upgrade versions prior to 4.2.
|
||||
if ( $wp_current_db_version < 31351 ) {
|
||||
if ( ! is_multisite() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
if ( ! is_multisite() ) {
|
||||
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
|
||||
}
|
||||
$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" );
|
||||
|
||||
@@ -860,7 +860,7 @@ $(document).ready( function() {
|
||||
window.wpResponsive.init();
|
||||
setPinMenu();
|
||||
|
||||
$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
||||
$document.on( 'wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
||||
});
|
||||
|
||||
// Fire a custom jQuery event at the end of window resize
|
||||
|
||||
2
wp-admin/js/common.min.js
vendored
2
wp-admin/js/common.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -124,7 +124,7 @@ jQuery(document).ready( function($) {
|
||||
};
|
||||
quickPressLoad();
|
||||
|
||||
$( '.meta-box-sortables' ).sortable( 'option', 'containment', '#wpwrap' );
|
||||
$( '.meta-box-sortables' ).sortable( 'option', 'containment', 'document' );
|
||||
|
||||
function autoResizeTextarea() {
|
||||
if ( document.documentMode && document.documentMode < 9 ) {
|
||||
|
||||
2
wp-admin/js/dashboard.min.js
vendored
2
wp-admin/js/dashboard.min.js
vendored
@@ -1 +1 @@
|
||||
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){if(!(document.documentMode&&document.documentMode<9)){a("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');var b=a(".quick-draft-textarea-clone"),c=a("#content"),d=c.height(),e=a(window).height()-100;b.css({"font-family":c.css("font-family"),"font-size":c.css("font-size"),"line-height":c.css("line-height"),"padding-bottom":c.css("paddingBottom"),"padding-left":c.css("paddingLeft"),"padding-right":c.css("paddingRight"),"padding-top":c.css("paddingTop"),"white-space":"pre-wrap","word-wrap":"break-word",display:"none"}),c.on("focus input propertychange",function(){var f=a(this),g=f.val()+" ",h=b.css("width",f.css("width")).text(g).outerHeight()+2;c.css("overflow-y","auto"),h===d||h>=e&&d>=e||(d=h>e?e:h,c.css("overflow","hidden"),f.css("height",d+"px"))})}}var c,d=a("#welcome-panel"),e=a("#wp_welcome_panel-hide");c=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},d.hasClass("hidden")&&e.prop("checked")&&d.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",d).click(function(b){b.preventDefault(),d.addClass("hidden"),c(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),e.click(function(){d.toggleClass("hidden",!this.checked),c(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var c,d=a("#quickpost-action");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!1),c=a("#quick-press").submit(function(){function b(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(c.attr("action"),c.serializeArray(),function(c){a("#dashboard_quick_press .inside").html(c),a("#quick-press").removeClass("initial-form"),quickPressLoad(),b(),a("#title").focus()}),!1}),a("#publish").click(function(){d.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){wpActiveEditor="content"}),b()},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","#wpwrap")});
|
||||
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){if(!(document.documentMode&&document.documentMode<9)){a("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');var b=a(".quick-draft-textarea-clone"),c=a("#content"),d=c.height(),e=a(window).height()-100;b.css({"font-family":c.css("font-family"),"font-size":c.css("font-size"),"line-height":c.css("line-height"),"padding-bottom":c.css("paddingBottom"),"padding-left":c.css("paddingLeft"),"padding-right":c.css("paddingRight"),"padding-top":c.css("paddingTop"),"white-space":"pre-wrap","word-wrap":"break-word",display:"none"}),c.on("focus input propertychange",function(){var f=a(this),g=f.val()+" ",h=b.css("width",f.css("width")).text(g).outerHeight()+2;c.css("overflow-y","auto"),h===d||h>=e&&d>=e||(d=h>e?e:h,c.css("overflow","hidden"),f.css("height",d+"px"))})}}var c,d=a("#welcome-panel"),e=a("#wp_welcome_panel-hide");c=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},d.hasClass("hidden")&&e.prop("checked")&&d.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",d).click(function(b){b.preventDefault(),d.addClass("hidden"),c(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),e.click(function(){d.toggleClass("hidden",!this.checked),c(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var c,d=a("#quickpost-action");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!1),c=a("#quick-press").submit(function(){function b(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(c.attr("action"),c.serializeArray(),function(c){a("#dashboard_quick_press .inside").html(c),a("#quick-press").removeClass("initial-form"),quickPressLoad(),b(),a("#title").focus()}),!1}),a("#publish").click(function(){d.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){wpActiveEditor="content"}),b()},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","document")});
|
||||
@@ -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).text( title );
|
||||
$this.prop('title', title).html( title );
|
||||
|
||||
// Mark this item's accessibility as refreshed
|
||||
$this.data( 'needs_accessibility_refresh', false );
|
||||
|
||||
2
wp-admin/js/nav-menu.min.js
vendored
2
wp-admin/js/nav-menu.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -250,7 +250,7 @@ window.wp = window.wp || {};
|
||||
wp.updates.updateError = function( response ) {
|
||||
var $message, name;
|
||||
wp.updates.updateDoneSuccessfully = false;
|
||||
if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' && wp.updates.shouldRequestFilesystemCredentials ) {
|
||||
if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' ) {
|
||||
wp.updates.credentialError( response, 'update-plugin' );
|
||||
return;
|
||||
}
|
||||
@@ -263,18 +263,10 @@ window.wp = window.wp || {};
|
||||
$message.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', name ) );
|
||||
}
|
||||
$message.removeClass( 'updating-message' );
|
||||
$message.html( wp.updates.l10n.updateFailed + ': ' + response.error );
|
||||
$message.text( wp.updates.l10n.updateFailed );
|
||||
wp.a11y.speak( wp.updates.l10n.updateFailed );
|
||||
|
||||
/*
|
||||
* The lock can be released since this failure was
|
||||
* after the credentials form.
|
||||
*/
|
||||
wp.updates.updateLock = false;
|
||||
|
||||
$(document).trigger( 'wp-plugin-update-error', response );
|
||||
|
||||
wp.updates.queueChecker();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -475,11 +467,6 @@ window.wp = window.wp || {};
|
||||
wp.updates.requestForCredentialsModalCancel();
|
||||
});
|
||||
|
||||
// Hide SSH fields when not selected
|
||||
$( '#request-filesystem-credentials-dialog input[name="connection_type"]' ).on( 'change', function() {
|
||||
$( this ).parents( 'form' ).find( '#private_key, #public_key' ).parents( 'label' ).toggle( ( 'ssh' == $( this ).val() ) );
|
||||
}).change();
|
||||
|
||||
// Click handler for plugin updates in List Table view.
|
||||
$( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) {
|
||||
e.preventDefault();
|
||||
@@ -503,6 +490,7 @@ window.wp = window.wp || {};
|
||||
wp.updates.updatePlugin( $button.data( 'plugin' ), $button.data( 'slug' ) );
|
||||
} );
|
||||
|
||||
//
|
||||
$( '#plugin_update_from_iframe' ).on( 'click' , function( e ) {
|
||||
var target, data;
|
||||
|
||||
|
||||
2
wp-admin/js/updates.min.js
vendored
2
wp-admin/js/updates.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,7 +1,6 @@
|
||||
/*global ajaxurl, isRtl */
|
||||
var wpWidgets;
|
||||
(function($) {
|
||||
var $document = $( document );
|
||||
|
||||
wpWidgets = {
|
||||
|
||||
@@ -23,13 +22,10 @@ wpWidgets = {
|
||||
} else {
|
||||
$wrap.addClass('closed');
|
||||
}
|
||||
|
||||
$document.triggerHandler( 'wp-pin-menu' );
|
||||
});
|
||||
|
||||
$('#widgets-left .sidebar-name').click( function() {
|
||||
$(this).closest('.widgets-holder-wrap').toggleClass('closed');
|
||||
$document.triggerHandler( 'wp-pin-menu' );
|
||||
});
|
||||
|
||||
$(document.body).bind('click.widgets-toggle', function(e) {
|
||||
@@ -93,7 +89,7 @@ wpWidgets = {
|
||||
distance: 2,
|
||||
helper: 'clone',
|
||||
zIndex: 100,
|
||||
containment: '#wpwrap',
|
||||
containment: 'document',
|
||||
start: function( event, ui ) {
|
||||
var chooser = $(this).find('.widgets-chooser');
|
||||
|
||||
@@ -123,7 +119,7 @@ wpWidgets = {
|
||||
handle: '> .widget-top > .widget-title',
|
||||
cursor: 'move',
|
||||
distance: 2,
|
||||
containment: '#wpwrap',
|
||||
containment: 'document',
|
||||
start: function( event, ui ) {
|
||||
var height, $this = $(this),
|
||||
$wrap = $this.parent(),
|
||||
@@ -178,7 +174,7 @@ wpWidgets = {
|
||||
|
||||
wpWidgets.save( $widget, 0, 0, 1 );
|
||||
$widget.find('input.add_new').val('');
|
||||
$document.trigger( 'widget-added', [ $widget ] );
|
||||
$( document ).trigger( 'widget-added', [ $widget ] );
|
||||
}
|
||||
|
||||
$sidebar = $widget.parent();
|
||||
@@ -385,7 +381,7 @@ wpWidgets = {
|
||||
if ( r && r.length > 2 ) {
|
||||
$( 'div.widget-content', widget ).html( r );
|
||||
wpWidgets.appendTitle( widget );
|
||||
$document.trigger( 'widget-updated', [ widget ] );
|
||||
$( document ).trigger( 'widget-updated', [ widget ] );
|
||||
}
|
||||
}
|
||||
if ( order ) {
|
||||
@@ -450,7 +446,7 @@ wpWidgets = {
|
||||
// No longer "new" widget
|
||||
widget.find( 'input.add_new' ).val('');
|
||||
|
||||
$document.trigger( 'widget-added', [ widget ] );
|
||||
$( document ).trigger( 'widget-added', [ widget ] );
|
||||
|
||||
/*
|
||||
* Check if any part of the sidebar is visible in the viewport. If it is, don't scroll.
|
||||
@@ -493,6 +489,6 @@ wpWidgets = {
|
||||
}
|
||||
};
|
||||
|
||||
$document.ready( function(){ wpWidgets.init(); } );
|
||||
$(document).ready( function(){ wpWidgets.init(); } );
|
||||
|
||||
})(jQuery);
|
||||
|
||||
2
wp-admin/js/widgets.min.js
vendored
2
wp-admin/js/widgets.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -273,7 +273,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||
<tr>
|
||||
<th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
|
||||
<td>
|
||||
<input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo esc_attr( get_site_option('first_comment_author') ); ?>" />
|
||||
<input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo get_site_option('first_comment_author') ?>" />
|
||||
<p class="description" id="first-comment-author-desc">
|
||||
<?php _e( 'The author of the first comment on a new site.' ) ?>
|
||||
</p>
|
||||
|
||||
@@ -115,9 +115,8 @@ case 'post-quickdraft-save':
|
||||
if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
|
||||
$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
|
||||
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
exit;
|
||||
}
|
||||
if ( ! current_user_can( 'edit_posts' ) )
|
||||
$error_msg = __( 'Oops, you don’t have access to add new drafts.' );
|
||||
|
||||
if ( $error_msg )
|
||||
return wp_dashboard_quick_press( $error_msg );
|
||||
@@ -160,7 +159,6 @@ case 'edit':
|
||||
wp_die( __( 'You can’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();
|
||||
|
||||
@@ -63,7 +63,7 @@ default :
|
||||
if ( ! $post = get_post( $revision->post_parent ) )
|
||||
break;
|
||||
|
||||
if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
|
||||
if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
|
||||
break;
|
||||
|
||||
// Revisions disabled and we're not looking at an autosave
|
||||
|
||||
@@ -99,7 +99,7 @@ if ( is_multisite()
|
||||
// Execute confirmed email change. See send_confirmation_on_profile_email().
|
||||
if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
|
||||
$new_email = get_option( $current_user->ID . '_new_email' );
|
||||
if ( $new_email && hash_equals( $new_email[ 'hash' ], $_GET[ 'newuseremail' ] ) ) {
|
||||
if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
|
||||
$user = new stdClass;
|
||||
$user->ID = $current_user->ID;
|
||||
$user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
|
||||
@@ -110,8 +110,7 @@ if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $c
|
||||
wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
|
||||
die();
|
||||
}
|
||||
} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) {
|
||||
check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
|
||||
} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
|
||||
delete_option( $current_user->ID . '_new_email' );
|
||||
wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
|
||||
die();
|
||||
@@ -403,7 +402,7 @@ if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_c
|
||||
$new_email = get_option( $current_user->ID . '_new_email' );
|
||||
if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
|
||||
<div class="updated inline">
|
||||
<p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), esc_html( $new_email['newemail'] ), esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ) ); ?></p>
|
||||
<p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
@@ -1143,10 +1143,8 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'edit_post':
|
||||
case 'edit_page':
|
||||
$post = get_post( $args[0] );
|
||||
if ( empty( $post ) ) {
|
||||
$caps[] = 'do_not_allow';
|
||||
if ( empty( $post ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( 'revision' == $post->post_type ) {
|
||||
$post = get_post( $post->post_parent );
|
||||
@@ -1260,16 +1258,7 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
if ( empty( $comment ) )
|
||||
break;
|
||||
$post = get_post( $comment->comment_post_ID );
|
||||
|
||||
/*
|
||||
* If the post doesn't exist, we have an orphaned comment.
|
||||
* Fall back to the edit_posts capability, instead.
|
||||
*/
|
||||
if ( $post ) {
|
||||
$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
|
||||
} else {
|
||||
$caps = map_meta_cap( 'edit_posts', $user_id );
|
||||
}
|
||||
$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
|
||||
break;
|
||||
case 'unfiltered_upload':
|
||||
if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) )
|
||||
|
||||
@@ -999,23 +999,20 @@ class Snoopy
|
||||
if(!empty($this->user) || !empty($this->pass))
|
||||
$headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
|
||||
|
||||
$headerfile = tempnam( $this->temp_dir, "sno" );
|
||||
$cmdline_params = '-k -D ' . escapeshellarg( $headerfile );
|
||||
|
||||
foreach ( $headers as $header ) {
|
||||
$cmdline_params .= ' -H ' . escapeshellarg( $header );
|
||||
for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
|
||||
$safer_header = strtr( $headers[$curr_header], "\"", " " );
|
||||
$cmdline_params .= " -H \"".$safer_header."\"";
|
||||
}
|
||||
|
||||
if ( ! empty( $body ) ) {
|
||||
$cmdline_params .= ' -d ' . escapeshellarg( $body );
|
||||
}
|
||||
if(!empty($body))
|
||||
$cmdline_params .= " -d \"$body\"";
|
||||
|
||||
if ( $this->read_timeout > 0 ) {
|
||||
$cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout );
|
||||
}
|
||||
if($this->read_timeout > 0)
|
||||
$cmdline_params .= " -m ".$this->read_timeout;
|
||||
|
||||
$headerfile = tempnam($this->temp_dir, "sno");
|
||||
|
||||
exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return );
|
||||
exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);
|
||||
|
||||
if($return)
|
||||
{
|
||||
|
||||
@@ -1124,7 +1124,7 @@ final class WP_Customize_Widgets {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( ! hash_equals( $this->get_instance_hash_key( $decoded ), $value['instance_hash_key'] ) ) {
|
||||
if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class WP_Embed {
|
||||
add_shortcode( 'embed', array( $this, 'shortcode' ) );
|
||||
|
||||
// Do the shortcode (only the [embed] one is registered)
|
||||
$content = do_shortcode( $content, true );
|
||||
$content = do_shortcode( $content );
|
||||
|
||||
// Put the original shortcodes back
|
||||
$shortcode_tags = $orig_shortcode_tags;
|
||||
@@ -312,14 +312,7 @@ class WP_Embed {
|
||||
* @return string Potentially modified $content.
|
||||
*/
|
||||
public function autoembed( $content ) {
|
||||
// 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.
|
||||
$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 );
|
||||
return preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -217,7 +217,7 @@ final class WP_Theme implements ArrayAccess {
|
||||
} elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) {
|
||||
$this->headers['Name'] = $this->stylesheet;
|
||||
if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
|
||||
$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) );
|
||||
$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), $this->stylesheet ) );
|
||||
else
|
||||
$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
|
||||
$this->template = $this->stylesheet;
|
||||
@@ -264,7 +264,7 @@ final class WP_Theme implements ArrayAccess {
|
||||
$theme_root_template = $directories[ $this->template ]['theme_root'];
|
||||
} else {
|
||||
// Parent theme is missing.
|
||||
$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) );
|
||||
$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), $this->template ) );
|
||||
$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
|
||||
$this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
|
||||
return;
|
||||
@@ -276,11 +276,11 @@ final class WP_Theme implements ArrayAccess {
|
||||
// If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
|
||||
if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
|
||||
$_child->parent = null;
|
||||
$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) );
|
||||
$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) );
|
||||
$_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) );
|
||||
// The two themes actually reference each other with the Template header.
|
||||
if ( $_child->stylesheet == $this->template ) {
|
||||
$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) );
|
||||
$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $this->template ) );
|
||||
$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -1150,56 +1150,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return $count > 1;
|
||||
}
|
||||
|
||||
private function _validate_boolean( $var ) {
|
||||
if ( is_bool( $var ) ) {
|
||||
return $var;
|
||||
}
|
||||
|
||||
if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulate the logic for sticking a post
|
||||
* and determining if the user has permission to do so
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $post_data
|
||||
* @param bool $update
|
||||
* @return void|IXR_Error
|
||||
*/
|
||||
private function _toggle_sticky( $post_data, $update = false ) {
|
||||
$post_type = get_post_type_object( $post_data['post_type'] );
|
||||
|
||||
// Private and password-protected posts cannot be stickied.
|
||||
if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) {
|
||||
// Error if the client tried to stick the post, otherwise, silently unstick.
|
||||
if ( ! empty( $post_data['sticky'] ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
unstick_post( $post_data['ID'] );
|
||||
}
|
||||
} elseif ( isset( $post_data['sticky'] ) ) {
|
||||
if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
|
||||
}
|
||||
|
||||
$sticky = $this->_validate_boolean( $post_data['sticky'] );
|
||||
if ( $sticky ) {
|
||||
stick_post( $post_data['ID'] );
|
||||
} else {
|
||||
unstick_post( $post_data['ID'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for wp_newPost and wp_editPost, containing shared logic.
|
||||
*
|
||||
@@ -1292,9 +1242,20 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_ID = $post_data['ID'];
|
||||
|
||||
if ( $post_data['post_type'] == 'post' ) {
|
||||
$error = $this->_toggle_sticky( $post_data, $update );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
// Private and password-protected posts cannot be stickied.
|
||||
if ( $post_data['post_status'] == 'private' || ! empty( $post_data['post_password'] ) ) {
|
||||
// Error if the client tried to stick the post, otherwise, silently unstick.
|
||||
if ( ! empty( $post_data['sticky'] ) )
|
||||
return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
|
||||
if ( $update )
|
||||
unstick_post( $post_ID );
|
||||
} elseif ( isset( $post_data['sticky'] ) ) {
|
||||
if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
|
||||
return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
|
||||
if ( $post_data['sticky'] )
|
||||
stick_post( $post_ID );
|
||||
else
|
||||
unstick_post( $post_ID );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4619,12 +4580,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
// Only posts can be sticky
|
||||
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
|
||||
$data = $postdata;
|
||||
$data['sticky'] = $content_struct['sticky'];
|
||||
$error = $this->_toggle_sticky( $data );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
}
|
||||
if ( $content_struct['sticky'] == true )
|
||||
stick_post( $post_ID );
|
||||
elseif ( $content_struct['sticky'] == false )
|
||||
unstick_post( $post_ID );
|
||||
}
|
||||
|
||||
if ( isset($content_struct['custom_fields']) )
|
||||
@@ -4914,8 +4873,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null;
|
||||
|
||||
if ( 'publish' == $post_status || 'private' == $post_status ) {
|
||||
if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) {
|
||||
if ( ('publish' == $post_status) ) {
|
||||
if ( ( 'page' == $post_type ) && ! current_user_can( 'publish_pages' ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) );
|
||||
} elseif ( ! current_user_can( 'publish_posts' ) ) {
|
||||
return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) );
|
||||
@@ -4959,13 +4918,10 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
// Only posts can be sticky
|
||||
if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
|
||||
$data = $newpost;
|
||||
$data['sticky'] = $content_struct['sticky'];
|
||||
$data['post_type'] = 'post';
|
||||
$error = $this->_toggle_sticky( $data, true );
|
||||
if ( $error ) {
|
||||
return $error;
|
||||
}
|
||||
if ( $content_struct['sticky'] == true )
|
||||
stick_post( $post_ID );
|
||||
elseif ( $content_struct['sticky'] == false )
|
||||
unstick_post( $post_ID );
|
||||
}
|
||||
|
||||
if ( isset($content_struct['custom_fields']) )
|
||||
|
||||
@@ -2252,9 +2252,6 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||
*/
|
||||
$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
|
||||
|
||||
// Ensure that the filtered args contain all required default values.
|
||||
$args = array_merge( $defaults, $args );
|
||||
|
||||
if ( comments_open( $post_id ) ) : ?>
|
||||
<?php
|
||||
/**
|
||||
|
||||
@@ -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 esc_attr( $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 $title; ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
|
||||
|
||||
@@ -419,10 +419,7 @@ 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);
|
||||
|
||||
// Find newlines in all elements and add placeholders.
|
||||
$pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee);
|
||||
|
||||
// Collapse line breaks before and after <option> elements so they don't get autop'd.
|
||||
if ( strpos( $pee, '<option' ) !== false ) {
|
||||
@@ -509,109 +506,9 @@ 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.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $haystack The text which has to be formatted.
|
||||
* @param array $replace_pairs In the form array('from' => 'to', ...).
|
||||
* @return string The formatted text.
|
||||
*/
|
||||
function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
|
||||
// Find all elements.
|
||||
$textarr = wp_html_split( $haystack );
|
||||
$changed = false;
|
||||
|
||||
// Optimize when searching for one item.
|
||||
if ( 1 === count( $replace_pairs ) ) {
|
||||
// Extract $needle and $replace.
|
||||
foreach ( $replace_pairs as $needle => $replace );
|
||||
|
||||
// Loop through delimeters (elements) only.
|
||||
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
|
||||
if ( false !== strpos( $textarr[$i], $needle ) ) {
|
||||
$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Extract all $needles.
|
||||
$needles = array_keys( $replace_pairs );
|
||||
|
||||
// Loop through delimeters (elements) only.
|
||||
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
|
||||
foreach ( $needles as $needle ) {
|
||||
if ( false !== strpos( $textarr[$i], $needle ) ) {
|
||||
$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
|
||||
$changed = true;
|
||||
// After one strtr() break out of the foreach loop and look at next element.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $changed ) {
|
||||
$haystack = implode( $textarr );
|
||||
}
|
||||
|
||||
return $haystack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Newline preservation help function for wpautop
|
||||
*
|
||||
@@ -1208,8 +1105,7 @@ function remove_accents($string) {
|
||||
* operating systems and special characters requiring special escaping
|
||||
* to manipulate at the command line. Replaces spaces and consecutive
|
||||
* dashes with a single dash. Trims period, dash and underscore from beginning
|
||||
* and end of filename. It is not guaranteed that this function will return a
|
||||
* filename that is allowed to be uploaded.
|
||||
* and end of filename.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
@@ -1234,14 +1130,6 @@ function sanitize_file_name( $filename ) {
|
||||
$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
|
||||
$filename = trim( $filename, '.-_' );
|
||||
|
||||
if ( false === strpos( $filename, '.' ) ) {
|
||||
$mime_types = wp_get_mime_types();
|
||||
$filetype = wp_check_filetype( 'test.' . $filename, $mime_types );
|
||||
if ( $filetype['ext'] === $filename ) {
|
||||
$filename = 'unnamed-file.' . $filetype['ext'];
|
||||
}
|
||||
}
|
||||
|
||||
// Split the filename into a base and extension[s]
|
||||
$parts = explode('.', $filename);
|
||||
|
||||
@@ -3439,19 +3327,16 @@ function wp_make_link_relative( $link ) {
|
||||
*/
|
||||
function sanitize_option($option, $value) {
|
||||
global $wpdb;
|
||||
$error = '';
|
||||
|
||||
switch ( $option ) {
|
||||
case 'admin_email' :
|
||||
case 'new_admin_email' :
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
$value = sanitize_email( $value );
|
||||
if ( ! is_email( $value ) ) {
|
||||
$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
|
||||
}
|
||||
$value = sanitize_email( $value );
|
||||
if ( ! is_email( $value ) ) {
|
||||
$value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
|
||||
if ( function_exists( 'add_settings_error' ) )
|
||||
add_settings_error( $option, 'invalid_admin_email', __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3496,12 +3381,8 @@ function sanitize_option($option, $value) {
|
||||
case 'blogdescription':
|
||||
case 'blogname':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
$value = wp_kses_post( $value );
|
||||
$value = esc_html( $value );
|
||||
}
|
||||
$value = wp_kses_post( $value );
|
||||
$value = esc_html( $value );
|
||||
break;
|
||||
|
||||
case 'blog_charset':
|
||||
@@ -3523,12 +3404,8 @@ function sanitize_option($option, $value) {
|
||||
case 'mailserver_pass':
|
||||
case 'upload_path':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
$value = strip_tags( $value );
|
||||
$value = wp_kses_data( $value );
|
||||
}
|
||||
$value = strip_tags( $value );
|
||||
$value = wp_kses_data( $value );
|
||||
break;
|
||||
|
||||
case 'ping_sites':
|
||||
@@ -3544,27 +3421,23 @@ function sanitize_option($option, $value) {
|
||||
|
||||
case 'siteurl':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) {
|
||||
$value = esc_url_raw($value);
|
||||
} else {
|
||||
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
|
||||
$value = esc_url_raw( $value );
|
||||
} else {
|
||||
$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
|
||||
}
|
||||
$value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
|
||||
if ( function_exists('add_settings_error') )
|
||||
add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'home':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) {
|
||||
$value = esc_url_raw($value);
|
||||
} else {
|
||||
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
|
||||
$value = esc_url_raw( $value );
|
||||
} else {
|
||||
$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
|
||||
}
|
||||
$value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
|
||||
if ( function_exists('add_settings_error') )
|
||||
add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.'));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3580,45 +3453,38 @@ function sanitize_option($option, $value) {
|
||||
|
||||
case 'illegal_names':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
if ( ! is_array( $value ) )
|
||||
$value = explode( ' ', $value );
|
||||
if ( ! is_array( $value ) )
|
||||
$value = explode( ' ', $value );
|
||||
|
||||
$value = array_values( array_filter( array_map( 'trim', $value ) ) );
|
||||
$value = array_values( array_filter( array_map( 'trim', $value ) ) );
|
||||
|
||||
if ( ! $value )
|
||||
$value = '';
|
||||
}
|
||||
if ( ! $value )
|
||||
$value = '';
|
||||
break;
|
||||
|
||||
case 'limited_email_domains':
|
||||
case 'banned_email_domains':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
if ( ! is_array( $value ) )
|
||||
$value = explode( "\n", $value );
|
||||
if ( ! is_array( $value ) )
|
||||
$value = explode( "\n", $value );
|
||||
|
||||
$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
|
||||
$value = array();
|
||||
$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
|
||||
$value = array();
|
||||
|
||||
foreach ( $domains as $domain ) {
|
||||
if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
|
||||
$value[] = $domain;
|
||||
}
|
||||
}
|
||||
if ( ! $value )
|
||||
$value = '';
|
||||
foreach ( $domains as $domain ) {
|
||||
if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
|
||||
$value[] = $domain;
|
||||
}
|
||||
if ( ! $value )
|
||||
$value = '';
|
||||
break;
|
||||
|
||||
case 'timezone_string':
|
||||
$allowed_zones = timezone_identifiers_list();
|
||||
if ( ! in_array( $value, $allowed_zones ) && ! empty( $value ) ) {
|
||||
$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
|
||||
$value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
|
||||
if ( function_exists('add_settings_error') )
|
||||
add_settings_error('timezone_string', 'invalid_timezone_string', __('The timezone you have entered is not valid. Please select a valid timezone.') );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3626,12 +3492,8 @@ function sanitize_option($option, $value) {
|
||||
case 'category_base':
|
||||
case 'tag_base':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
$value = esc_url_raw( $value );
|
||||
$value = str_replace( 'http://', '', $value );
|
||||
}
|
||||
$value = esc_url_raw( $value );
|
||||
$value = str_replace( 'http://', '', $value );
|
||||
break;
|
||||
|
||||
case 'default_role' :
|
||||
@@ -3642,24 +3504,13 @@ function sanitize_option($option, $value) {
|
||||
case 'moderation_keys':
|
||||
case 'blacklist_keys':
|
||||
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
|
||||
if ( is_wp_error( $value ) ) {
|
||||
$error = $value->get_error_message();
|
||||
} else {
|
||||
$value = explode( "\n", $value );
|
||||
$value = array_filter( array_map( 'trim', $value ) );
|
||||
$value = array_unique( $value );
|
||||
$value = implode( "\n", $value );
|
||||
}
|
||||
$value = explode( "\n", $value );
|
||||
$value = array_filter( array_map( 'trim', $value ) );
|
||||
$value = array_unique( $value );
|
||||
$value = implode( "\n", $value );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! empty( $error ) ) {
|
||||
$value = get_option( $option );
|
||||
if ( function_exists( 'add_settings_error' ) ) {
|
||||
add_settings_error( $option, "invalid_{$option}", $error );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter an option value following sanitization.
|
||||
*
|
||||
@@ -4289,9 +4140,8 @@ function print_emoji_detection_script() {
|
||||
);
|
||||
|
||||
$version = 'ver=' . $wp_version;
|
||||
$develop_src = false !== strpos( $wp_version, '-src' );
|
||||
|
||||
if ( $develop_src || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
|
||||
if ( SCRIPT_DEBUG ) {
|
||||
$settings['source'] = array(
|
||||
/** This filter is documented in wp-includes/class.wp-scripts.php */
|
||||
'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ),
|
||||
|
||||
@@ -466,7 +466,7 @@ function wp_http_validate_url( $url ) {
|
||||
|
||||
if ( ! $same_host ) {
|
||||
$host = trim( $parsed_url['host'], '.' );
|
||||
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) {
|
||||
if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
|
||||
$ip = $host;
|
||||
} else {
|
||||
$ip = gethostbyname( $host );
|
||||
@@ -475,7 +475,7 @@ function wp_http_validate_url( $url ) {
|
||||
}
|
||||
if ( $ip ) {
|
||||
$parts = array_map( 'intval', explode( '.', $ip ) );
|
||||
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]
|
||||
if ( 127 === $parts[0] || 10 === $parts[0]
|
||||
|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
|
||||
|| ( 192 === $parts[0] && 168 === $parts[1] )
|
||||
) {
|
||||
|
||||
@@ -93,7 +93,8 @@ window.wp = window.wp || {};
|
||||
setMarkers: function( content ) {
|
||||
var pieces = [ { content: content } ],
|
||||
self = this,
|
||||
instance, current;
|
||||
instance,
|
||||
current;
|
||||
|
||||
_.each( views, function( view, type ) {
|
||||
current = pieces.slice();
|
||||
@@ -101,7 +102,7 @@ window.wp = window.wp || {};
|
||||
|
||||
_.each( current, function( piece ) {
|
||||
var remaining = piece.content,
|
||||
result, text;
|
||||
result;
|
||||
|
||||
// Ignore processed pieces, but retain their location.
|
||||
if ( piece.processed ) {
|
||||
@@ -118,11 +119,10 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
instance = self.createInstance( type, result.content, result.options );
|
||||
text = instance.loader ? '.' : instance.text;
|
||||
|
||||
// Add the processed piece for the match.
|
||||
pieces.push( {
|
||||
content: '<p data-wpview-marker="' + instance.encodedText + '">' + text + '</p>',
|
||||
content: '<p data-wpview-marker="' + instance.encodedText + '">' + instance.text + '</p>',
|
||||
processed: true
|
||||
} );
|
||||
|
||||
@@ -138,8 +138,7 @@ window.wp = window.wp || {};
|
||||
} );
|
||||
} );
|
||||
|
||||
content = _.pluck( pieces, 'content' ).join( '' );
|
||||
return content.replace( /<p>\s*<p data-wpview-marker=/g, '<p data-wpview-marker=' ).replace( /<\/p>\s*<\/p>/g, '</p>' );
|
||||
return _.pluck( pieces, 'content' ).join( '' );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -156,15 +155,14 @@ window.wp = window.wp || {};
|
||||
encodedText,
|
||||
instance;
|
||||
|
||||
text = tinymce.DOM.decode( text );
|
||||
instance = this.getInstance( text );
|
||||
text = tinymce.DOM.decode( text ),
|
||||
encodedText = encodeURIComponent( text ),
|
||||
instance = this.getInstance( encodedText );
|
||||
|
||||
if ( instance ) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
encodedText = encodeURIComponent( text );
|
||||
|
||||
options = _.extend( options || {}, {
|
||||
text: text,
|
||||
encodedText: encodedText
|
||||
@@ -418,7 +416,7 @@ window.wp = window.wp || {};
|
||||
*/
|
||||
replaceMarkers: function() {
|
||||
this.getMarkers( function( editor, node ) {
|
||||
if ( ! this.loader && $( node ).text() !== this.text ) {
|
||||
if ( $( node ).text() !== this.text ) {
|
||||
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
||||
return;
|
||||
}
|
||||
|
||||
2
wp-includes/js/mce-view.min.js
vendored
2
wp-includes/js/mce-view.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -704,7 +704,7 @@ VideoDetails = MediaDetails.extend({
|
||||
|
||||
if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
|
||||
content += [
|
||||
'<track srclang="en" label="English" kind="subtitles" src="',
|
||||
'<track srclang="en" label="English"kind="subtitles" src="',
|
||||
attachment.get( 'url' ),
|
||||
'" />'
|
||||
].join('');
|
||||
|
||||
2
wp-includes/js/media-audiovideo.min.js
vendored
2
wp-includes/js/media-audiovideo.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -152,20 +152,19 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
||||
};
|
||||
}
|
||||
|
||||
function resetViewsCallback( match, viewText ) {
|
||||
return '<p>' + window.decodeURIComponent( viewText ) + '</p>';
|
||||
}
|
||||
// Remove the content of view wrappers from HTML string
|
||||
function emptyViews( content ) {
|
||||
content = content.replace( /<div[^>]+data-wpview-text="([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>[^<>]*<\/p>\s*<\/div>/g, function( all, match ) {
|
||||
return '<p>' + window.decodeURIComponent( match ) + '</p>';
|
||||
});
|
||||
|
||||
// Replace the view tags with the view string
|
||||
function resetViews( content ) {
|
||||
return content.replace( /<div[^>]+data-wpview-text="([^"]+)"[^>]*>(?:[\s\S]+?wpview-selection-after[^>]+>[^<>]*<\/p>\s*|\.)<\/div>/g, resetViewsCallback )
|
||||
.replace( /<p [^>]*?data-wpview-marker="([^"]+)"[^>]*>[\s\S]*?<\/p>/g, resetViewsCallback );
|
||||
return content.replace( / data-wpview-marker="[^"]+"/g, '' );
|
||||
}
|
||||
|
||||
// Prevent adding undo levels on changes inside a view wrapper
|
||||
editor.on( 'BeforeAddUndo', function( event ) {
|
||||
if ( event.level.content ) {
|
||||
event.level.content = resetViews( event.level.content );
|
||||
event.level.content = emptyViews( event.level.content );
|
||||
}
|
||||
});
|
||||
|
||||
@@ -349,29 +348,31 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
||||
}
|
||||
});
|
||||
|
||||
// Empty the wpview wrap and marker nodes
|
||||
function emptyViewNodes( rootNode ) {
|
||||
$( 'div[data-wpview-text], p[data-wpview-marker]', rootNode ).each( function( i, node ) {
|
||||
node.innerHTML = '.';
|
||||
function resetViews( rootNode ) {
|
||||
// Replace view nodes
|
||||
$( 'div[data-wpview-text]', rootNode ).each( function( i, node ) {
|
||||
var $node = $( node ),
|
||||
text = window.decodeURIComponent( $node.attr( 'data-wpview-text' ) || '' );
|
||||
|
||||
if ( text && node.parentNode ) {
|
||||
$node.replaceWith( $( editor.dom.create('p') ).text( text ) );
|
||||
}
|
||||
});
|
||||
|
||||
// Remove marker attributes
|
||||
$( 'p[data-wpview-marker]', rootNode ).attr( 'data-wpview-marker', null );
|
||||
}
|
||||
|
||||
// Run that before the DOM cleanup
|
||||
editor.on( 'PreProcess', function( event ) {
|
||||
emptyViewNodes( event.node );
|
||||
// Replace the view nodes with their text in the DOM clone.
|
||||
resetViews( event.node );
|
||||
}, true );
|
||||
|
||||
editor.on( 'hide', function() {
|
||||
// Replace the view nodes with their text directly in the editor body.
|
||||
wp.mce.views.unbind();
|
||||
deselect();
|
||||
emptyViewNodes();
|
||||
});
|
||||
|
||||
editor.on( 'PostProcess', function( event ) {
|
||||
if ( event.content ) {
|
||||
event.content = event.content.replace( /<div [^>]*?data-wpview-text="([^"]+)"[^>]*>[\s\S]*?<\/div>/g, resetViewsCallback )
|
||||
.replace( /<p [^>]*?data-wpview-marker="([^"]+)"[^>]*>[\s\S]*?<\/p>/g, resetViewsCallback );
|
||||
}
|
||||
resetViews( editor.getBody() );
|
||||
});
|
||||
|
||||
// Excludes arrow keys, delete, backspace, enter, space bar.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
2
wp-includes/js/wp-emoji-release.min.js
vendored
2
wp-includes/js/wp-emoji-release.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -70,13 +70,13 @@
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
if ( ! node || node.nodeType !== 1 || ( 'ownerSVGElement' in node ) ||
|
||||
( node.className && typeof node.className === 'string' && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
|
||||
if ( ! node || ( node.className && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
parse( node );
|
||||
if ( node && node.nodeType === 1 ) {
|
||||
parse( node );
|
||||
}
|
||||
}
|
||||
}
|
||||
} ).observe( document.body, {
|
||||
|
||||
2
wp-includes/js/wp-emoji.min.js
vendored
2
wp-includes/js/wp-emoji.min.js
vendored
@@ -1 +1 @@
|
||||
!function(a,b){function c(){function c(){if(!i){if("undefined"==typeof a.twemoji){if(j>600)return;return a.clearTimeout(f),f=a.setTimeout(c,50),void j++}e=a.twemoji,i=!0,g&&new g(function(a){for(var b,c,e,f,g=a.length;g--;){if(b=a[g].addedNodes,c=a[g].removedNodes,e=b.length,1===e&&1===c.length&&3===b[0].nodeType&&"IMG"===c[0].nodeName&&b[0].data===c[0].alt)return;for(;e--;)f=b[e],3===f.nodeType&&(f=f.parentNode),!f||1!==f.nodeType||"ownerSVGElement"in f||f.className&&"string"==typeof f.className&&-1!==f.className.indexOf("wp-exclude-emoji")||d(f)}}).observe(document.body,{childList:!0,subtree:!0}),d(document.body)}}function d(a,c){return h&&e?(c=c||{},e.parse(a,{base:b.baseUrl,ext:b.ext,className:c.className||"emoji",imgAttr:c.imgAttr,callback:function(a,c){switch(a){case"a9":case"ae":case"2122":case"2194":case"2660":case"2663":case"2665":case"2666":return!1}return b.supports.flag||!b.supports.simple||/^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test(a)?"".concat(c.base,a,c.ext):!1}})):a}var e,f,g=a.MutationObserver||a.WebKitMutationObserver||a.MozMutationObserver,h=!1,i=!1,j=0;return b&&(h=!b.supports.simple||!b.supports.flag,b.DOMReady?c():b.readyCallback=c),{replaceEmoji:h,parse:d}}a.wp=a.wp||{},a.wp.emoji=new c}(window,window._wpemojiSettings);
|
||||
!function(a,b){function c(){function c(){if(!i){if("undefined"==typeof a.twemoji){if(j>600)return;return a.clearTimeout(f),f=a.setTimeout(c,50),void j++}e=a.twemoji,i=!0,g&&new g(function(a){for(var b,c,e,f,g=a.length;g--;){if(b=a[g].addedNodes,c=a[g].removedNodes,e=b.length,1===e&&1===c.length&&3===b[0].nodeType&&"IMG"===c[0].nodeName&&b[0].data===c[0].alt)return;for(;e--;)f=b[e],3===f.nodeType&&(f=f.parentNode),!f||f.className&&-1!==f.className.indexOf("wp-exclude-emoji")||f&&1===f.nodeType&&d(f)}}).observe(document.body,{childList:!0,subtree:!0}),d(document.body)}}function d(a,c){return h&&e?(c=c||{},e.parse(a,{base:b.baseUrl,ext:b.ext,className:c.className||"emoji",imgAttr:c.imgAttr,callback:function(a,c){switch(a){case"a9":case"ae":case"2122":case"2194":case"2660":case"2663":case"2665":case"2666":return!1}return b.supports.flag||!b.supports.simple||/^1f1(?:e[6-9a-f]|f[0-9a-f])-1f1(?:e[6-9a-f]|f[0-9a-f])$/.test(a)?"".concat(c.base,a,c.ext):!1}})):a}var e,f,g=a.MutationObserver||a.WebKitMutationObserver||a.MozMutationObserver,h=!1,i=!1,j=0;return b&&(h=!b.supports.simple||!b.supports.flag,b.DOMReady?c():b.readyCallback=c),{replaceEmoji:h,parse:d}}a.wp=a.wp||{},a.wp.emoji=new c}(window,window._wpemojiSettings);
|
||||
@@ -528,82 +528,6 @@ function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
|
||||
return wp_kses_split($string, $allowed_html, $allowed_protocols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters one attribute only and ensures its value is allowed.
|
||||
*
|
||||
* This function has the advantage of being more secure than esc_attr() and can
|
||||
* escape data in some situations where wp_kses() must strip the whole attribute.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $string The 'whole' attribute, including name and value.
|
||||
* @param string $element The element name to which the attribute belongs.
|
||||
* @return string Filtered attribute.
|
||||
*/
|
||||
function wp_kses_one_attr( $string, $element ) {
|
||||
$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
|
||||
$allowed_html = wp_kses_allowed_html( 'post' );
|
||||
$allowed_protocols = wp_allowed_protocols();
|
||||
$string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
|
||||
$string = wp_kses_js_entities( $string );
|
||||
$string = wp_kses_normalize_entities( $string );
|
||||
|
||||
// Preserve leading and trailing whitespace.
|
||||
$matches = array();
|
||||
preg_match('/^\s*/', $string, $matches);
|
||||
$lead = $matches[0];
|
||||
preg_match('/\s*$/', $string, $matches);
|
||||
$trail = $matches[0];
|
||||
if ( empty( $trail ) ) {
|
||||
$string = substr( $string, strlen( $lead ) );
|
||||
} else {
|
||||
$string = substr( $string, strlen( $lead ), -strlen( $trail ) );
|
||||
}
|
||||
|
||||
// Parse attribute name and value from input.
|
||||
$split = preg_split( '/\s*=\s*/', $string, 2 );
|
||||
$name = $split[0];
|
||||
if ( count( $split ) == 2 ) {
|
||||
$value = $split[1];
|
||||
|
||||
// Remove quotes surrounding $value.
|
||||
// Also guarantee correct quoting in $string for this one attribute.
|
||||
if ( '' == $value ) {
|
||||
$quote = '';
|
||||
} else {
|
||||
$quote = $value[0];
|
||||
}
|
||||
if ( '"' == $quote || "'" == $quote ) {
|
||||
if ( substr( $value, -1 ) != $quote ) {
|
||||
return '';
|
||||
}
|
||||
$value = substr( $value, 1, -1 );
|
||||
} else {
|
||||
$quote = '"';
|
||||
}
|
||||
|
||||
// Sanitize quotes and angle braces.
|
||||
$value = htmlspecialchars( $value, ENT_QUOTES, null, false );
|
||||
|
||||
// Sanitize URI values.
|
||||
if ( in_array( strtolower( $name ), $uris ) ) {
|
||||
$value = wp_kses_bad_protocol( $value, $allowed_protocols );
|
||||
}
|
||||
|
||||
$string = "$name=$quote$value$quote";
|
||||
$vless = 'n';
|
||||
} else {
|
||||
$value = '';
|
||||
$vless = 'y';
|
||||
}
|
||||
|
||||
// Sanitize attribute by name.
|
||||
wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
|
||||
|
||||
// Restore whitespace.
|
||||
return $lead . $string . $trail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of allowed tags and attributes for a given context.
|
||||
*
|
||||
@@ -824,11 +748,45 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
|
||||
// Go through $attrarr, and save the allowed attributes for this element
|
||||
// in $attr2
|
||||
$attr2 = '';
|
||||
foreach ( $attrarr as $arreach ) {
|
||||
if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
|
||||
$attr2 .= ' '.$arreach['whole'];
|
||||
|
||||
$allowed_attr = $allowed_html[strtolower($element)];
|
||||
foreach ($attrarr as $arreach) {
|
||||
if ( ! isset( $allowed_attr[strtolower($arreach['name'])] ) )
|
||||
continue; // the attribute is not allowed
|
||||
|
||||
$current = $allowed_attr[strtolower($arreach['name'])];
|
||||
if ( $current == '' )
|
||||
continue; // the attribute is not allowed
|
||||
|
||||
if ( strtolower( $arreach['name'] ) == 'style' ) {
|
||||
$orig_value = $arreach['value'];
|
||||
$value = safecss_filter_attr( $orig_value );
|
||||
|
||||
if ( empty( $value ) )
|
||||
continue;
|
||||
|
||||
$arreach['value'] = $value;
|
||||
$arreach['whole'] = str_replace( $orig_value, $value, $arreach['whole'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_array($current) ) {
|
||||
$attr2 .= ' '.$arreach['whole'];
|
||||
// there are no checks
|
||||
|
||||
} else {
|
||||
// there are some checks
|
||||
$ok = true;
|
||||
foreach ($current as $currkey => $currval) {
|
||||
if ( ! wp_kses_check_attr_val($arreach['value'], $arreach['vless'], $currkey, $currval) ) {
|
||||
$ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $ok )
|
||||
$attr2 .= ' '.$arreach['whole']; // it passed them
|
||||
} // if !is_array($current)
|
||||
} // foreach
|
||||
|
||||
// Remove any "<" or ">" characters
|
||||
$attr2 = preg_replace('/[<>]/', '', $attr2);
|
||||
@@ -836,53 +794,6 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
|
||||
return "<$element$attr2$xhtml_slash>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an attribute is allowed.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $name The attribute name. Returns empty string when not allowed.
|
||||
* @param string $value The attribute value. Returns a filtered value.
|
||||
* @param string $whole The name=value input. Returns filtered input.
|
||||
* @param string $vless 'y' when attribute like "enabled", otherwise 'n'.
|
||||
* @param string $element The name of the element to which this attribute belongs.
|
||||
* @param array $allowed_html The full list of allowed elements and attributes.
|
||||
* @return bool Is the attribute allowed?
|
||||
*/
|
||||
function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
|
||||
$allowed_attr = $allowed_html[strtolower( $element )];
|
||||
|
||||
$name_low = strtolower( $name );
|
||||
if ( ! isset( $allowed_attr[$name_low] ) || '' == $allowed_attr[$name_low] ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'style' == $name_low ) {
|
||||
$new_value = safecss_filter_attr( $value );
|
||||
|
||||
if ( empty( $new_value ) ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
$whole = str_replace( $value, $new_value, $whole );
|
||||
$value = $new_value;
|
||||
}
|
||||
|
||||
if ( is_array( $allowed_attr[$name_low] ) ) {
|
||||
// there are some checks
|
||||
foreach ( $allowed_attr[$name_low] as $currkey => $currval ) {
|
||||
if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) {
|
||||
$name = $value = $whole = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an attribute list from string containing attributes.
|
||||
*
|
||||
@@ -1012,109 +923,6 @@ function wp_kses_hair($attr, $allowed_protocols) {
|
||||
return $attrarr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all attributes of an HTML element.
|
||||
*
|
||||
* Does not modify input. May return "evil" output.
|
||||
*
|
||||
* Based on wp_kses_split2() and wp_kses_attr()
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $element HTML element/tag
|
||||
* @return array|bool List of attributes found in $element. Returns false on failure.
|
||||
*/
|
||||
function wp_kses_attr_parse( $element ) {
|
||||
$valid = preg_match('%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches);
|
||||
if ( 1 !== $valid ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$begin = $matches[1];
|
||||
$slash = $matches[2];
|
||||
$elname = $matches[3];
|
||||
$attr = $matches[4];
|
||||
$end = $matches[5];
|
||||
|
||||
if ( '' !== $slash ) {
|
||||
// Closing elements do not get parsed.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is there a closing XHTML slash at the end of the attributes?
|
||||
if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) {
|
||||
$xhtml_slash = $matches[0];
|
||||
$attr = substr( $attr, 0, -strlen( $xhtml_slash ) );
|
||||
} else {
|
||||
$xhtml_slash = '';
|
||||
}
|
||||
|
||||
// Split it
|
||||
$attrarr = wp_kses_hair_parse( $attr );
|
||||
if ( false === $attrarr ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure all input is returned by adding front and back matter.
|
||||
array_unshift( $attrarr, $begin . $slash . $elname );
|
||||
array_push( $attrarr, $xhtml_slash . $end );
|
||||
|
||||
return $attrarr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an attribute list from string containing attributes.
|
||||
*
|
||||
* Does not modify input. May return "evil" output.
|
||||
* In case of unexpected input, returns false instead of stripping things.
|
||||
*
|
||||
* Based on wp_kses_hair() but does not return a multi-dimensional array.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $attr Attribute list from HTML element to closing HTML element tag
|
||||
* @return array|bool List of attributes found in $attr. Returns false on failure.
|
||||
*/
|
||||
function wp_kses_hair_parse( $attr ) {
|
||||
if ( '' === $attr ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$regex =
|
||||
'(?:'
|
||||
. '[-a-zA-Z:]+' // Attribute name.
|
||||
. '|'
|
||||
. '\[\[?[^\[\]]+\]\]?' // Shortcode in the name position implies unfiltered_html.
|
||||
. ')'
|
||||
. '(?:' // Attribute value.
|
||||
. '\s*=\s*' // All values begin with '='
|
||||
. '(?:'
|
||||
. '"[^"]*"' // Double-quoted
|
||||
. '|'
|
||||
. "'[^']*'" // Single-quoted
|
||||
. '|'
|
||||
. '[^\s"\']+' // Non-quoted
|
||||
. '(?:\s|$)' // Must have a space
|
||||
. ')'
|
||||
. '|'
|
||||
. '(?:\s|$)' // If attribute has no value, space is required.
|
||||
. ')'
|
||||
. '\s*'; // Trailing space is optional except as mentioned above.
|
||||
|
||||
// Although it is possible to reduce this procedure to a single regexp,
|
||||
// we must run that regexp twice to get exactly the expected result.
|
||||
|
||||
$validation = "%^($regex)+$%";
|
||||
$extraction = "%$regex%";
|
||||
|
||||
if ( 1 === preg_match( $validation, $attr ) ) {
|
||||
preg_match_all( $extraction, $attr, $attrarr );
|
||||
return $attrarr[0];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs different checks for attribute values.
|
||||
*
|
||||
|
||||
@@ -763,15 +763,11 @@ function translate_user_role( $name ) {
|
||||
function get_available_languages( $dir = null ) {
|
||||
$languages = array();
|
||||
|
||||
$lang_files = glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' );
|
||||
if ( $lang_files ) {
|
||||
foreach( $lang_files as $lang_file ) {
|
||||
$lang_file = basename( $lang_file, '.mo' );
|
||||
if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
|
||||
0 !== strpos( $lang_file, 'admin-' ) ) {
|
||||
$languages[] = $lang_file;
|
||||
}
|
||||
}
|
||||
foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
|
||||
$lang_file = basename($lang_file, '.mo');
|
||||
if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
|
||||
0 !== strpos( $lang_file, 'admin-' ))
|
||||
$languages[] = $lang_file;
|
||||
}
|
||||
|
||||
return $languages;
|
||||
|
||||
@@ -847,8 +847,6 @@ function img_caption_shortcode( $attr, $content = null ) {
|
||||
$content = $matches[1];
|
||||
$attr['caption'] = trim( $matches[2] );
|
||||
}
|
||||
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
|
||||
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1014,14 +1014,18 @@ function auth_redirect() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the authentication redirect scheme.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param string $scheme Authentication redirect scheme. Default empty.
|
||||
*/
|
||||
$scheme = apply_filters( 'auth_redirect_scheme', '' );
|
||||
if ( is_user_admin() ) {
|
||||
$scheme = 'logged_in';
|
||||
} else {
|
||||
/**
|
||||
* Filter the authentication redirect scheme.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param string $scheme Authentication redirect scheme. Default empty.
|
||||
*/
|
||||
$scheme = apply_filters( 'auth_redirect_scheme', '' );
|
||||
}
|
||||
|
||||
if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) {
|
||||
/**
|
||||
@@ -1292,8 +1296,7 @@ function wp_validate_redirect($location, $default = '') {
|
||||
// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
|
||||
$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
|
||||
|
||||
// @-operator is used to prevent possible warnings in PHP < 5.3.3.
|
||||
$lp = @parse_url($test);
|
||||
$lp = parse_url($test);
|
||||
|
||||
// Give up if malformed URL
|
||||
if ( false === $lp )
|
||||
@@ -1303,17 +1306,9 @@ function wp_validate_redirect($location, $default = '') {
|
||||
if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
|
||||
return $default;
|
||||
|
||||
// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
|
||||
if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
|
||||
// Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
|
||||
if ( isset($lp['scheme']) && !isset($lp['host']) )
|
||||
return $default;
|
||||
}
|
||||
|
||||
// Reject malformed components parse_url() can return on odd inputs.
|
||||
foreach ( array( 'user', 'pass', 'host' ) as $component ) {
|
||||
if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
$wpp = parse_url(home_url());
|
||||
|
||||
|
||||
@@ -1562,7 +1562,7 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals
|
||||
* @param bool $icon Whether to include an icon. Default false.
|
||||
* @param string|bool $text If string, will be link text. Default false.
|
||||
*/
|
||||
return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text );
|
||||
return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2905,11 +2905,10 @@ function wp_untrash_post_comments( $post = null ) {
|
||||
|
||||
foreach ( $group_by_status as $status => $comments ) {
|
||||
// Sanity check. This shouldn't happen.
|
||||
if ( 'post-trashed' == $status ) {
|
||||
if ( 'post-trashed' == $status )
|
||||
$status = '0';
|
||||
}
|
||||
$comments_in = implode( ', ', array_map( 'intval', $comments ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
|
||||
$comments_in = implode( "', '", $comments );
|
||||
$wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" );
|
||||
}
|
||||
|
||||
clean_comment_cache( array_keys($statuses) );
|
||||
|
||||
@@ -310,7 +310,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
|
||||
$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.10', 1 );
|
||||
|
||||
$scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.16.4-a', 1 );
|
||||
$scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.16.2', 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
|
||||
'language' => get_bloginfo( 'language' ),
|
||||
'strings' => array(
|
||||
|
||||
@@ -184,10 +184,9 @@ function has_shortcode( $content, $tag ) {
|
||||
* @global array $shortcode_tags List of shortcode tags and their callback hooks.
|
||||
*
|
||||
* @param string $content Content to search for shortcodes.
|
||||
* @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcode( $content, $ignore_html = false ) {
|
||||
function do_shortcode($content) {
|
||||
global $shortcode_tags;
|
||||
|
||||
if ( false === strpos( $content, '[' ) ) {
|
||||
@@ -197,24 +196,8 @@ function do_shortcode( $content, $ignore_html = false ) {
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags))
|
||||
return $content;
|
||||
|
||||
$tagnames = array_keys($shortcode_tags);
|
||||
$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
|
||||
$pattern = "/\\[($tagregexp)/s";
|
||||
|
||||
if ( 1 !== preg_match( $pattern, $content ) ) {
|
||||
// Avoids parsing HTML when there are no shortcodes or embeds anyway.
|
||||
return $content;
|
||||
}
|
||||
|
||||
$content = do_shortcodes_in_html_tags( $content, $ignore_html );
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
$content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
|
||||
|
||||
// Always restore square braces so we don't break things like <!--[if IE ]>
|
||||
$content = unescape_invalid_shortcodes( $content );
|
||||
|
||||
return $content;
|
||||
return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,127 +290,6 @@ function do_shortcode_tag( $m ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search only inside HTML elements for shortcodes and process them.
|
||||
*
|
||||
* Any [ or ] characters remaining inside elements will be HTML encoded
|
||||
* to prevent interference with shortcodes that are outside the elements.
|
||||
* Assumes $content processed by KSES already. Users with unfiltered_html
|
||||
* capability may get unexpected output if angle braces are nested in tags.
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $content Content to search for shortcodes
|
||||
* @param bool $ignore_html When true, all square braces inside elements will be encoded.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcodes_in_html_tags( $content, $ignore_html ) {
|
||||
// Normalize entities in unfiltered HTML before adding placeholders.
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
$content = strtr( $content, $trans );
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
$textarr = wp_html_split( $content );
|
||||
|
||||
foreach ( $textarr as &$element ) {
|
||||
if ( '' == $element || '<' !== $element[0] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$noopen = false === strpos( $element, '[' );
|
||||
$noclose = false === strpos( $element, ']' );
|
||||
if ( $noopen || $noclose ) {
|
||||
// This element does not contain shortcodes.
|
||||
if ( $noopen xor $noclose ) {
|
||||
// Need to encode stray [ or ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) {
|
||||
// Encode all [ and ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributes = wp_kses_attr_parse( $element );
|
||||
if ( false === $attributes ) {
|
||||
// Some plugins are doing things like [name] <[email]>.
|
||||
if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
|
||||
$element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
|
||||
}
|
||||
|
||||
// Looks like we found some crazy unfiltered HTML. Skipping it for sanity.
|
||||
$element = strtr( $element, $trans );
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get element name
|
||||
$front = array_shift( $attributes );
|
||||
$back = array_pop( $attributes );
|
||||
$matches = array();
|
||||
preg_match('%[a-zA-Z0-9]+%', $front, $matches);
|
||||
$elname = $matches[0];
|
||||
|
||||
// Look for shortcodes in each attribute separately.
|
||||
foreach ( $attributes as &$attr ) {
|
||||
$open = strpos( $attr, '[' );
|
||||
$close = strpos( $attr, ']' );
|
||||
if ( false === $open || false === $close ) {
|
||||
continue; // Go to next attribute. Square braces will be escaped at end of loop.
|
||||
}
|
||||
$double = strpos( $attr, '"' );
|
||||
$single = strpos( $attr, "'" );
|
||||
if ( ( false === $single || $open < $single ) && ( false === $double || $open < $double ) ) {
|
||||
// $attr like '[shortcode]' or 'name = [shortcode]' implies unfiltered_html.
|
||||
// In this specific situation we assume KSES did not run because the input
|
||||
// was written by an administrator, so we should avoid changing the output
|
||||
// and we do not need to run KSES here.
|
||||
$attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr );
|
||||
} else {
|
||||
// $attr like 'name = "[shortcode]"' or "name = '[shortcode]'"
|
||||
// We do not know if $content was unfiltered. Assume KSES ran before shortcodes.
|
||||
$count = 0;
|
||||
$new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count );
|
||||
if ( $count > 0 ) {
|
||||
// Sanitize the shortcode output using KSES.
|
||||
$new_attr = wp_kses_one_attr( $new_attr, $elname );
|
||||
if ( '' !== $new_attr ) {
|
||||
// The shortcode is safe to use now.
|
||||
$attr = $new_attr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$element = $front . implode( '', $attributes ) . $back;
|
||||
|
||||
// Now encode any remaining [ or ] chars.
|
||||
$element = strtr( $element, $trans );
|
||||
}
|
||||
|
||||
$content = implode( '', $textarr );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove placeholders added by do_shortcodes_in_html_tags().
|
||||
*
|
||||
* @since 4.2.3
|
||||
*
|
||||
* @param string $content Content to search for placeholders.
|
||||
* @return string Content with placeholders removed.
|
||||
*/
|
||||
function unescape_invalid_shortcodes( $content ) {
|
||||
// Clean up entire string, avoids re-parsing HTML.
|
||||
$trans = array( '[' => '[', ']' => ']' );
|
||||
$content = strtr( $content, $trans );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all attributes from the shortcodes tag.
|
||||
*
|
||||
@@ -457,15 +319,6 @@ function shortcode_parse_atts($text) {
|
||||
elseif (isset($m[8]))
|
||||
$atts[] = stripcslashes($m[8]);
|
||||
}
|
||||
|
||||
// Reject any unclosed HTML elements
|
||||
foreach( $atts as &$value ) {
|
||||
if ( false !== strpos( $value, '<' ) ) {
|
||||
if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) {
|
||||
$value = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$atts = ltrim($text);
|
||||
}
|
||||
@@ -536,15 +389,9 @@ function strip_shortcodes( $content ) {
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags))
|
||||
return $content;
|
||||
|
||||
$content = do_shortcodes_in_html_tags( $content, true );
|
||||
|
||||
$pattern = get_shortcode_regex();
|
||||
$content = preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
|
||||
|
||||
// Always restore square braces so we don't break things like <!--[if IE ]>
|
||||
$content = unescape_invalid_shortcodes( $content );
|
||||
|
||||
return $content;
|
||||
return preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
|
||||
}
|
||||
|
||||
function strip_shortcode_tag( $m ) {
|
||||
|
||||
@@ -602,7 +602,7 @@ function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
|
||||
|
||||
$term_ids = array_map('intval', $term_ids );
|
||||
|
||||
$taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
|
||||
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
|
||||
$term_ids = "'" . implode( "', '", $term_ids ) . "'";
|
||||
|
||||
$object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order");
|
||||
@@ -1776,7 +1776,7 @@ function get_terms( $taxonomies, $args = '' ) {
|
||||
$order = 'ASC';
|
||||
}
|
||||
|
||||
$where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
|
||||
$where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
|
||||
|
||||
$exclude = $args['exclude'];
|
||||
$exclude_tree = $args['exclude_tree'];
|
||||
@@ -2702,7 +2702,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
||||
|
||||
$taxonomy_array = $taxonomies;
|
||||
$object_id_array = $object_ids;
|
||||
$taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
|
||||
$taxonomies = "'" . implode("', '", $taxonomies) . "'";
|
||||
$object_ids = implode(', ', $object_ids);
|
||||
|
||||
$select_this = '';
|
||||
|
||||
@@ -673,6 +673,8 @@ function preview_theme() {
|
||||
|
||||
// Prevent theme mods to current theme being used on theme being previewed
|
||||
add_filter( 'pre_option_theme_mods_' . get_option( 'stylesheet' ), '__return_empty_array' );
|
||||
|
||||
ob_start( 'preview_theme_ob_filter' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -709,7 +711,7 @@ function _preview_theme_stylesheet_filter() {
|
||||
* @return string
|
||||
*/
|
||||
function preview_theme_ob_filter( $content ) {
|
||||
return $content;
|
||||
return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -724,7 +726,26 @@ function preview_theme_ob_filter( $content ) {
|
||||
* @return string
|
||||
*/
|
||||
function preview_theme_ob_filter_callback( $matches ) {
|
||||
return $matches[0];
|
||||
if ( strpos($matches[4], 'onclick') !== false )
|
||||
$matches[4] = preg_replace('#onclick=([\'"]).*?(?<!\\\)\\1#i', '', $matches[4]); //Strip out any onclicks from rest of <a>. (?<!\\\) means to ignore the '" if it's escaped by \ to prevent breaking mid-attribute.
|
||||
if (
|
||||
( false !== strpos($matches[3], '/wp-admin/') )
|
||||
||
|
||||
( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) )
|
||||
||
|
||||
( false !== strpos($matches[3], '/feed/') )
|
||||
||
|
||||
( false !== strpos($matches[3], '/trackback/') )
|
||||
)
|
||||
return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4];
|
||||
|
||||
$stylesheet = isset( $_GET['stylesheet'] ) ? $_GET['stylesheet'] : '';
|
||||
$template = isset( $_GET['template'] ) ? $_GET['template'] : '';
|
||||
|
||||
$link = add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1 ), $matches[3] );
|
||||
if ( 0 === strpos($link, 'preview=1') )
|
||||
$link = "?$link";
|
||||
return $matches[1] . esc_attr( $link ) . $matches[4];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -633,8 +633,19 @@ function wp_schedule_update_checks() {
|
||||
if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
|
||||
wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
|
||||
|
||||
if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! defined('WP_INSTALLING') )
|
||||
wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
|
||||
if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
|
||||
// Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
|
||||
$next = strtotime( 'today 7am' );
|
||||
$now = time();
|
||||
// Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
|
||||
while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
|
||||
$next += 12 * HOUR_IN_SECONDS;
|
||||
}
|
||||
$next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
|
||||
// Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
|
||||
$next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
|
||||
wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2.9';
|
||||
$wp_version = '4.2.2';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 31536;
|
||||
$wp_db_version = 31535;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version
|
||||
|
||||
@@ -738,7 +738,8 @@ class wpdb {
|
||||
$this->charset = DB_CHARSET;
|
||||
}
|
||||
|
||||
if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
|
||||
if ( ( $this->use_mysqli && ! ( $this->dbh instanceof mysqli ) )
|
||||
|| ( empty( $this->dbh ) || ! ( $this->dbh instanceof mysqli ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2081,7 +2082,7 @@ class wpdb {
|
||||
public function get_var( $query = null, $x = 0, $y = 0 ) {
|
||||
$this->func_call = "\$db->get_var(\"$query\", $x, $y)";
|
||||
|
||||
if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
|
||||
if ( $this->check_safe_collation( $query ) ) {
|
||||
$this->check_current_query = false;
|
||||
}
|
||||
|
||||
@@ -2114,7 +2115,7 @@ class wpdb {
|
||||
public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
|
||||
$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
|
||||
|
||||
if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
|
||||
if ( $this->check_safe_collation( $query ) ) {
|
||||
$this->check_current_query = false;
|
||||
}
|
||||
|
||||
@@ -2155,7 +2156,7 @@ class wpdb {
|
||||
* @return array Database query result. Array indexed from 0 by SQL result row number.
|
||||
*/
|
||||
public function get_col( $query = null , $x = 0 ) {
|
||||
if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
|
||||
if ( $this->check_safe_collation( $query ) ) {
|
||||
$this->check_current_query = false;
|
||||
}
|
||||
|
||||
@@ -2187,7 +2188,7 @@ class wpdb {
|
||||
public function get_results( $query = null, $output = OBJECT ) {
|
||||
$this->func_call = "\$db->get_results(\"$query\", $output)";
|
||||
|
||||
if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
|
||||
if ( $this->check_safe_collation( $query ) ) {
|
||||
$this->check_current_query = false;
|
||||
}
|
||||
|
||||
@@ -2594,13 +2595,8 @@ class wpdb {
|
||||
|
||||
if ( is_array( $value['length'] ) ) {
|
||||
$length = $value['length']['length'];
|
||||
$truncate_by_byte_length = 'byte' === $value['length']['type'];
|
||||
} else {
|
||||
$length = false;
|
||||
// Since we have no length, we'll never truncate.
|
||||
// Initialize the variable to false. true would take us
|
||||
// through an unnecessary (for this case) codepath below.
|
||||
$truncate_by_byte_length = false;
|
||||
}
|
||||
|
||||
// There's no charset to work with.
|
||||
@@ -2613,6 +2609,8 @@ class wpdb {
|
||||
continue;
|
||||
}
|
||||
|
||||
$truncate_by_byte_length = 'byte' === $value['length']['type'];
|
||||
|
||||
$needs_validation = true;
|
||||
if (
|
||||
// latin1 can store any byte sequence
|
||||
@@ -2678,45 +2676,56 @@ class wpdb {
|
||||
$queries = array();
|
||||
foreach ( $data as $col => $value ) {
|
||||
if ( ! empty( $value['db'] ) ) {
|
||||
// We're going to need to truncate by characters or bytes, depending on the length value we have.
|
||||
if ( 'byte' === $value['length']['type'] ) {
|
||||
// Using binary causes LEFT() to truncate by bytes.
|
||||
$charset = 'binary';
|
||||
} else {
|
||||
$charset = $value['charset'];
|
||||
if ( ! isset( $queries[ $value['charset'] ] ) ) {
|
||||
$queries[ $value['charset'] ] = array();
|
||||
}
|
||||
|
||||
if ( is_array( $value['length'] ) ) {
|
||||
$queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] );
|
||||
} else if ( 'binary' !== $charset ) {
|
||||
// If we don't have a length, there's no need to convert binary - it will always return the same result.
|
||||
$queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING {$this->charset} )", $value['value'] );
|
||||
// We're going to need to truncate by characters or bytes, depending on the length value we have.
|
||||
if ( 'byte' === $value['length']['type'] ) {
|
||||
// Split the CONVERT() calls by charset, so we can make sure the connection is right
|
||||
$queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %d ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
|
||||
} else {
|
||||
$queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %d )", $value['value'], $value['length']['length'] );
|
||||
}
|
||||
|
||||
unset( $data[ $col ]['db'] );
|
||||
}
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
foreach ( $queries as $column => $query ) {
|
||||
$connection_charset = $this->charset;
|
||||
foreach ( $queries as $charset => $query ) {
|
||||
if ( ! $query ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql[] = $query . " AS x_$column";
|
||||
}
|
||||
// Change the charset to match the string(s) we're converting
|
||||
if ( $charset !== $connection_charset ) {
|
||||
$connection_charset = $charset;
|
||||
$this->set_charset( $this->dbh, $charset );
|
||||
}
|
||||
|
||||
$this->check_current_query = false;
|
||||
$row = $this->get_row( "SELECT " . implode( ', ', $sql ), ARRAY_A );
|
||||
if ( ! $row ) {
|
||||
return new WP_Error( 'wpdb_strip_invalid_text_failure' );
|
||||
}
|
||||
$this->check_current_query = false;
|
||||
|
||||
foreach ( array_keys( $data ) as $column ) {
|
||||
if ( isset( $row["x_$column"] ) ) {
|
||||
$sql = array();
|
||||
foreach ( $query as $column => $column_query ) {
|
||||
$sql[] = $column_query . " AS x_$column";
|
||||
}
|
||||
|
||||
$row = $this->get_row( "SELECT " . implode( ', ', $sql ), ARRAY_A );
|
||||
if ( ! $row ) {
|
||||
$this->set_charset( $this->dbh, $connection_charset );
|
||||
return new WP_Error( 'wpdb_strip_invalid_text_failure' );
|
||||
}
|
||||
|
||||
foreach ( array_keys( $query ) as $column ) {
|
||||
$data[ $column ]['value'] = $row["x_$column"];
|
||||
}
|
||||
}
|
||||
|
||||
// Don't forget to change the charset back!
|
||||
if ( $connection_charset !== $this->charset ) {
|
||||
$this->set_charset( $this->dbh );
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
@@ -2825,8 +2834,11 @@ class wpdb {
|
||||
// Allow (select...) union [...] style queries. Use the first query's table name.
|
||||
$query = ltrim( $query, "\r\n\t (" );
|
||||
|
||||
// Strip everything between parentheses except nested selects.
|
||||
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query );
|
||||
/*
|
||||
* Strip everything between parentheses except nested selects and use only 1,000
|
||||
* chars of the query.
|
||||
*/
|
||||
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', substr( $query, 0, 1000 ) );
|
||||
|
||||
// Quickly match most common queries.
|
||||
if ( preg_match( '/^\s*(?:'
|
||||
@@ -2835,7 +2847,7 @@ class wpdb {
|
||||
. '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?'
|
||||
. '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?'
|
||||
. '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?'
|
||||
. ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) {
|
||||
. ')\s+((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) {
|
||||
return str_replace( '`', '', $maybe[1] );
|
||||
}
|
||||
|
||||
@@ -2843,7 +2855,7 @@ class wpdb {
|
||||
if ( preg_match( '/^\s*(?:'
|
||||
. 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
|
||||
. '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
|
||||
. ')\W((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {
|
||||
. ')\W((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {
|
||||
return str_replace( '`', '', $maybe[1] );
|
||||
}
|
||||
|
||||
@@ -2862,7 +2874,7 @@ class wpdb {
|
||||
. '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE'
|
||||
. '|(?:GRANT|REVOKE).*ON\s+TABLE'
|
||||
. '|SHOW\s+(?:.*FROM|.*TABLE)'
|
||||
. ')\s+\(*\s*((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) {
|
||||
. ')\s+\(*\s*((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) {
|
||||
return str_replace( '`', '', $maybe[1] );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user