Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
Updating to 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelryanmcneill committed Mar 19, 2015
1 parent 799ce77 commit fe9a57f
Show file tree
Hide file tree
Showing 30 changed files with 232 additions and 102 deletions.
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
WordPress - Web publishing software

Copyright 2014 by the contributors
Copyright 2015 by the contributors

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
<br /> Version 4.1.1
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>

Expand Down
8 changes: 8 additions & 0 deletions wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
</a>
</h2>

<div class="changelog point-releases">
<h3><?php echo _n( 'Maintenance Release', 'Maintenance Releases', 1 ); ?></h3>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
'<strong>Version %1$s</strong> addressed %2$s bugs.', 21 ), '4.1.1', number_format_i18n( 21 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.1.1' ); ?>
</p>
</div>

<div class="changelog headline-feature">
<h2><?php _e( 'Introducing Twenty&nbsp;Fifteen' ); ?></h2>
<div class="featured-image">
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/async-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

require_once( ABSPATH . 'wp-admin/admin.php' );

header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );

if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );

Expand All @@ -46,8 +48,6 @@
wp_die( __( 'You do not have permission to upload files.' ) );
}

header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );

// just fetch the detail form for that attachment
if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
$post = get_post( $id );
Expand Down
56 changes: 43 additions & 13 deletions wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1832,21 +1832,36 @@ function wp_ajax_update_widget() {
*/
function wp_ajax_upload_attachment() {
check_ajax_referer( 'media-form' );
/*
* This function does not use wp_send_json_success() / wp_send_json_error()
* as the html4 Plupload handler requires a text/html content-type for older IE.
* See https://core.trac.wordpress.org/ticket/31037
*/

if ( ! current_user_can( 'upload_files' ) ) {
wp_send_json_error( array(
'message' => __( "You don't have permission to upload files." ),
'filename' => $_FILES['async-upload']['name'],
echo wp_json_encode( array(
'success' => false,
'data' => array(
'message' => __( "You don't have permission to upload files." ),
'filename' => $_FILES['async-upload']['name'],
)
) );

wp_die();
}

if ( isset( $_REQUEST['post_id'] ) ) {
$post_id = $_REQUEST['post_id'];
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_send_json_error( array(
'message' => __( "You don't have permission to attach files to this post." ),
'filename' => $_FILES['async-upload']['name'],
echo wp_json_encode( array(
'success' => false,
'data' => array(
'message' => __( "You don't have permission to attach files to this post." ),
'filename' => $_FILES['async-upload']['name'],
)
) );

wp_die();
}
} else {
$post_id = null;
Expand All @@ -1858,20 +1873,30 @@ function wp_ajax_upload_attachment() {
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false );
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
wp_send_json_error( array(
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
'filename' => $_FILES['async-upload']['name'],
echo wp_json_encode( array(
'success' => false,
'data' => array(
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
'filename' => $_FILES['async-upload']['name'],
)
) );

wp_die();
}
}

$attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );

if ( is_wp_error( $attachment_id ) ) {
wp_send_json_error( array(
'message' => $attachment_id->get_error_message(),
'filename' => $_FILES['async-upload']['name'],
echo wp_json_encode( array(
'success' => false,
'data' => array(
'message' => $attachment_id->get_error_message(),
'filename' => $_FILES['async-upload']['name'],
)
) );

wp_die();
}

if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
Expand All @@ -1885,7 +1910,12 @@ function wp_ajax_upload_attachment() {
if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) )
wp_die();

wp_send_json_success( $attachment );
echo wp_json_encode( array(
'success' => true,
'data' => $attachment,
) );

wp_die();
}

/**
Expand Down
11 changes: 7 additions & 4 deletions wp-admin/includes/taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
//

/**
* {@internal Missing Short Description}}
* Check whether a category exists.
*
* @since 2.0.0
*
* @param int|string $cat_name
* @return int
* @see term_exists()
*
* @param int|string $cat_name Category name.
* @param int $parent Optional. ID of parent term.
* @return mixed
*/
function category_exists($cat_name, $parent = 0) {
function category_exists( $cat_name, $parent = null ) {
$id = term_exists($cat_name, 'category', $parent);
if ( is_array($id) )
$id = $id['term_id'];
Expand Down
1 change: 1 addition & 0 deletions wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@
'wp-includes/js/jquery/ui/jquery.ui.tabs.min.js',
'wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js',
'wp-includes/js/jquery/ui/jquery.ui.widget.min.js',
'wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png',
);

/**
Expand Down
9 changes: 5 additions & 4 deletions wp-admin/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ $('.contextual-help-tabs').delegate('a', 'click', function(e) {
});

$(document).ready( function() {
var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions, $firstHeading,
lastClicked = false,
pageInput = $('input.current-page'),
currentPage = pageInput.val(),
Expand Down Expand Up @@ -368,9 +368,10 @@ $(document).ready( function() {
});
}

// Move .updated and .error alert boxes. Don't move boxes designed to be inline.
$('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
$('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
// Move .notice, .updated and .error alert boxes. Don't move boxes designed to be inline.
$firstHeading = $( 'div.wrap h2:first' );
$firstHeading.nextAll( 'div.updated, div.error, div.notice' ).addClass( 'below-h2' );
$( 'div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $firstHeading );

// Init screen meta
screenMeta.init();
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/common.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions wp-admin/js/customize-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@
api.utils.areElementListsEqual = function ( listA, listB ) {
var equal = (
listA.length === listB.length && // if lists are different lengths, then naturally they are not equal
-1 === _.map( // are there any false values in the list returned by map?
-1 === _.indexOf( _.map( // are there any false values in the list returned by map?
_.zip( listA, listB ), // pair up each element between the two lists
function ( pair ) {
return $( pair[0] ).is( pair[1] ); // compare to see if each pair are equal
}
).indexOf( false ) // check for presence of false in map's return value
), false ) // check for presence of false in map's return value
);
return equal;
};
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/customize-controls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-admin/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function list_plugin_updates() {
foreach ( (array) $plugins as $plugin_file => $plugin_data) {
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
if ( is_wp_error( $info ) ) {
continue;
$info = false;
}

// Get plugin compat for running version of WordPress.
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/user-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function use_ssl_preference($user) {
<tr class="user-sessions-wrap hide-if-no-js">
<th>&nbsp;</th>
<td aria-live="assertive">
<div class="destroy-sessions"><button disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
<p class="description">
<?php _e( 'You are only logged in at this location.' ); ?>
</p>
Expand All @@ -499,7 +499,7 @@ function use_ssl_preference($user) {
<tr class="user-sessions-wrap hide-if-no-js">
<th>&nbsp;</th>
<td aria-live="assertive">
<div class="destroy-sessions"><button class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
<p class="description">
<?php _e( 'Left your account logged in at a public computer? Lost your phone? This will log you out everywhere except your current browser.' ); ?>
</p>
Expand All @@ -509,7 +509,7 @@ function use_ssl_preference($user) {
<tr class="user-sessions-wrap hide-if-no-js">
<th>&nbsp;</th>
<td>
<p><button class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Sessions' ); ?></button></p>
<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Sessions' ); ?></button></p>
<p class="description">
<?php
/* translators: 1: User's display name. */
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/class-wp-customize-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ public function render_content() {}
*/
public function content_template() {
?>
<label for="{{ data.settings.default }}-button">
<label for="{{ data.settings['default'] }}-button">
<# if ( data.label ) { #>
<span class="customize-control-title">{{ data.label }}</span>
<# } #>
Expand Down Expand Up @@ -775,7 +775,7 @@ public function content_template() {
</div>
<div class="actions">
<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
<button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['change']; ?></button>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
<div style="clear:both"></div>
</div>
<# } else { #>
Expand All @@ -794,7 +794,7 @@ public function content_template() {
<# if ( data.defaultAttachment ) { #>
<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
<# } #>
<button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['select']; ?></button>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
<div style="clear:both"></div>
</div>
<# } #>
Expand Down
55 changes: 39 additions & 16 deletions wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ final class WP_Customize_Manager {
protected $registered_control_types = array();

/**
* $_POST values for Customize Settings.
* Unsanitized values for Customize Settings parsed from $_POST['customized'].
*
* @var array
* @var array|false
*/
private $_post_values;

Expand All @@ -75,11 +75,11 @@ final class WP_Customize_Manager {
* @since 3.4.0
*/
public function __construct() {
require( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
require( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
require( ABSPATH . WPINC . '/class-wp-customize-section.php' );
require( ABSPATH . WPINC . '/class-wp-customize-control.php' );
require( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );

$this->widgets = new WP_Customize_Widgets( $this );

Expand Down Expand Up @@ -399,23 +399,46 @@ public function wp_redirect_status( $status ) {
}

/**
* Decode the $_POST['customized'] values for a specific Customize Setting.
* Parse the incoming $_POST['customized'] JSON data and store the unsanitized
* settings for subsequent post_value() lookups.
*
* @since 3.4.0
* @since 4.1.1
*
* @param WP_Customize_Setting $setting A WP_Customize_Setting derived object
* @return string $post_value Sanitized value
* @return array
*/
public function post_value( $setting ) {
public function unsanitized_post_values() {
if ( ! isset( $this->_post_values ) ) {
if ( isset( $_POST['customized'] ) )
if ( isset( $_POST['customized'] ) ) {
$this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
else
}
if ( empty( $this->_post_values ) ) { // if not isset or of JSON error
$this->_post_values = false;
}
}
if ( empty( $this->_post_values ) ) {
return array();
} else {
return $this->_post_values;
}
}

if ( isset( $this->_post_values[ $setting->id ] ) )
return $setting->sanitize( $this->_post_values[ $setting->id ] );
/**
* Return the sanitized value for a given setting from the request's POST data.
*
* @since 3.4.0
* @since 4.1.1 Introduced 'default' parameter.
*
* @param WP_Customize_Setting $setting A WP_Customize_Setting derived object
* @param mixed $default value returned $setting has no post value (added in 4.2.0).
* @return string|mixed $post_value Sanitized value or the $default provided
*/
public function post_value( $setting, $default = null ) {
$post_values = $this->unsanitized_post_values();
if ( array_key_exists( $setting->id, $post_values ) ) {
return $setting->sanitize( $post_values[ $setting->id ] );
} else {
return $default;
}
}

/**
Expand Down
Loading

0 comments on commit fe9a57f

Please sign in to comment.