Commit b245e429 authored by lechuck's avatar lechuck Committed by lechuck

Aggiornamento wordpress 3.4.2

parent 6c8d3e02
......@@ -8,7 +8,7 @@
<body>
<h1 id="logo">
<a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
<br /> Version 3.4.1
<br /> Version 3.4.2
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
......
......@@ -34,7 +34,12 @@ 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', 1 ); ?></h3>
<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.', 20 ), '3.4.2', number_format_i18n( 20 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.4.2' ); ?>
</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.', 21 ), '3.4.1', number_format_i18n( 21 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_3.4.1' ); ?>
......
......@@ -293,7 +293,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
}
if ( current_user_can('edit_themes') )
$actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme_key ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
$actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . urlencode( $theme_key ) ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $theme_key != get_option( 'stylesheet' ) && $theme_key != get_option( 'template' ) )
$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&amp;checked[]=' . $theme_key . '&amp;theme_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>';
......
......@@ -90,7 +90,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
// Filter into individual sections
if ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
if ( is_multisite() && ! $screen->is_network && is_network_only_plugin( $plugin_file ) ) {
unset( $plugins['all'][ $plugin_file ] );
} elseif ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
unset( $plugins['all'][ $plugin_file ] );
} elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) )
|| ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) {
......
......@@ -128,7 +128,7 @@ class WP_Themes_List_Table extends WP_List_Table {
$activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
$preview_link = esc_url( add_query_arg(
array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ),
array( 'preview' => 1, 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), 'preview_iframe' => true, 'TB_iframe' => 'true' ),
home_url( '/' ) ) );
$actions = array();
......
......@@ -1507,14 +1507,14 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$preview_link = add_query_arg( array(
'preview' => 1,
'template' => $template,
'stylesheet' => $stylesheet,
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), trailingslashit( get_home_url() ) );
$activate_link = add_query_arg( array(
'action' => 'activate',
'template' => $template,
'stylesheet' => $stylesheet,
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), admin_url('themes.php') );
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
......@@ -1571,14 +1571,14 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$preview_link = add_query_arg( array(
'preview' => 1,
'template' => $template,
'stylesheet' => $stylesheet,
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), trailingslashit( get_home_url() ) );
$activate_link = add_query_arg( array(
'action' => 'activate',
'template' => $template,
'stylesheet' => $stylesheet,
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
), admin_url('themes.php') );
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
......
......@@ -688,7 +688,7 @@ function link_categories_meta_box($link) {
<p id="link-category-add" class="wp-hidden-child">
<label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
<input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />
<input type="button" id="link-category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
</p>
......
......@@ -477,7 +477,7 @@ function update_core($from, $to) {
$mysql_version = $wpdb->db_version();
$required_php_version = '5.2.4';
$required_mysql_version = '5.0';
$wp_version = '3.4.1';
$wp_version = '3.4.2';
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
$mysql_compat = true;
......@@ -680,7 +680,7 @@ function _copy_dir($from, $to, $skip_list = array() ) {
function _redirect_to_about_wordpress( $new_version ) {
global $wp_version, $pagenow, $action;
if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
if ( version_compare( $wp_version, '3.5-alpha', '>=' ) )
return;
// Ensure we only run this on the update-core.php page. wp_update_core() could be called in other contexts.
......@@ -695,12 +695,17 @@ function _redirect_to_about_wordpress( $new_version ) {
// See do_core_upgrade()
show_message( __('WordPress updated successfully') );
show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.' ), $new_version, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
$js_message = __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.' );
$js_message = str_replace( '"%s"', '"%2$s"', $js_message ); // in lieu of breaking the string.
// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
show_message( '<span class="hide-if-no-js">' . sprintf( $js_message, $new_version, 'about.php?updated' ) . '</span>' );
show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
echo '</div>';
?>
<script type="text/javascript">
window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
window.location = 'about.php?updated';
</script>
<?php
......
......@@ -2,6 +2,8 @@
/**
* Dashboard Administration Screen
*
* @internal This file should be parseable by PHP4.
*
* @package WordPress
* @subpackage Administration
*/
......@@ -32,7 +34,10 @@ else
$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>';
get_current_screen()->add_help_tab( array(
// Not using chaining here, so as to be parseable by PHP4.
$screen = get_current_screen();
$screen->add_help_tab( array(
'id' => 'overview',
'title' => __( 'Overview' ),
'content' => $help,
......@@ -43,7 +48,7 @@ get_current_screen()->add_help_tab( array(
$help = '<p>' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '</p>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-navigation',
'title' => __('Navigation'),
'content' => $help,
......@@ -54,7 +59,7 @@ $help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options ta
$help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
$help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-layout',
'title' => __('Layout'),
'content' => $help,
......@@ -78,7 +83,7 @@ if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
if ( current_user_can( 'edit_theme_options' ) )
$help .= '<p>' . __('<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.') . '</p>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-content',
'title' => __('Content'),
'content' => $help,
......@@ -86,7 +91,7 @@ get_current_screen()->add_help_tab( array(
unset( $help );
get_current_screen()->set_help_sidebar(
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
......
......@@ -220,10 +220,6 @@
};
});
// Select a tab
this.selected = this.tabs[ panels.first().data('customizeTab') ];
this.selected.both.addClass('library-selected');
// Bind tab switch events
this.library.children('ul').on( 'click', 'li', function( event ) {
var id = $(this).data('customizeTab'),
......@@ -255,6 +251,18 @@
this.tabs.uploaded.both.addClass('hidden');
}
// Select a tab
panels.each( function() {
var tab = control.tabs[ $(this).data('customizeTab') ];
// Select the first visible tab.
if ( ! tab.link.hasClass('hidden') ) {
control.selected = tab;
tab.both.addClass('library-selected');
return false;
}
});
this.dropdownInit();
},
success: function( attachment ) {
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ jQuery(document).ready( function($) {
// Ajax Cat
newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
$('#category-add-submit').click( function() { newCat.focus(); } );
$('#link-category-add-submit').click( function() { newCat.focus(); } );
syncChecks = function() {
if ( noSyncChecks )
return;
......
jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('<option value="'+parseInt(l,10)+'"></option>').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()});
\ No newline at end of file
jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#link-category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).prop("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('<option value="'+parseInt(l,10)+'"></option>').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();c("#newcategory").focus();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()});
\ No newline at end of file
......@@ -342,7 +342,7 @@ jQuery(document).ready( function($) {
return false;
});
$('#' + taxonomy + 'checklist li.popular-category :checkbox, #' + taxonomy + 'checklist-pop :checkbox').live( 'click', function(){
$('#' + taxonomy + 'checklist li.popular-category input[type="checkbox"], #' + taxonomy + 'checklist-pop input[type="checkbox"]').live( 'click', function(){
var t = $(this), c = t.is(':checked'), id = t.val();
if ( id && t.parents('#taxonomy-'+taxonomy).length )
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
......
This diff is collapsed.
......@@ -51,6 +51,11 @@ if ( $action ) {
}
if ( ! is_network_admin() ) {
if ( is_network_only_plugin( $plugin ) ) {
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
exit;
}
$recent = (array) get_option( 'recently_activated' );
unset( $recent[ $plugin ] );
update_option( 'recently_activated', $recent );
......@@ -72,10 +77,17 @@ if ( $action ) {
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
// Only activate plugins which are not already active.
$check = is_network_admin() ? 'is_plugin_active_for_network' : 'is_plugin_active';
foreach ( $plugins as $i => $plugin )
if ( $check( $plugin ) )
unset( $plugins[ $i ] );
if ( is_network_admin() ) {
foreach ( $plugins as $i => $plugin ) {
if ( is_plugin_active_for_network( $plugin ) )
unset( $plugins[ $i ] );
}
} else {
foreach ( $plugins as $i => $plugin ) {
if ( is_plugin_active( $plugin ) || is_network_only_plugin( $plugin ) )
unset( $plugins[ $i ] );
}
}
if ( empty($plugins) ) {
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
......
......@@ -44,12 +44,14 @@ define('WP_DEBUG', false);
require(ABSPATH . WPINC . '/load.php');
require(ABSPATH . WPINC . '/version.php');
// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();
require_once(ABSPATH . WPINC . '/functions.php');
// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Turn register_globals off.
wp_unregister_GLOBALS();
......@@ -217,9 +219,10 @@ switch($step) {
}
$key = 0;
foreach ( $config_file as &$line ) {
// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
foreach ( $config_file as $line_num => $line ) {
if ( '$table_prefix =' == substr( $line, 0, 16 ) ) {
$line = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
$config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
continue;
}
......@@ -234,7 +237,7 @@ switch($step) {
case 'DB_USER' :
case 'DB_PASSWORD' :
case 'DB_HOST' :
$line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
break;
case 'AUTH_KEY' :
case 'SECURE_AUTH_KEY' :
......@@ -244,7 +247,7 @@ switch($step) {
case 'SECURE_AUTH_SALT' :
case 'LOGGED_IN_SALT' :
case 'NONCE_SALT' :
$line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
break;
}
}
......
......@@ -1131,7 +1131,7 @@ function map_meta_cap( $cap, $user_id ) {
if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
$caps[] = 'do_not_allow';
elseif ( is_multisite() && ! is_super_admin( $user_id ) )
$caps[] = $cap;
$caps[] = 'do_not_allow';
else
$caps[] = $cap;
break;
......
......@@ -213,8 +213,14 @@ class WP_oEmbed {
$errors = libxml_use_internal_errors( 'true' );
$data = simplexml_load_string( $response_body );
libxml_use_internal_errors( $errors );
if ( is_object( $data ) )
return $data;
if ( ! is_object( $data ) )
return false;
$return = new stdClass;
foreach ( $data as $key => $value )
$return->$key = (string) $value;
return $return;
}
return false;
}
......
......@@ -167,9 +167,7 @@ class wp_atom_server {
array('GET' => 'get_attachment',
'POST' => 'create_attachment'),
'@/attachment/file/(\d+)$@' =>
array('GET' => 'get_file',
'PUT' => 'put_file',
'DELETE' => 'delete_file'),
array('GET' => 'get_file'),
'@/attachment/(\d+)$@' =>
array('GET' => 'get_attachment',
'PUT' => 'put_attachment',
......@@ -315,6 +313,12 @@ EOD;
$entry = array_pop($parser->feed->entries);
$publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
$cap = ($publish) ? 'publish_posts' : 'edit_posts';
if ( !current_user_can($cap) )
$this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
$catnames = array();
if ( !empty( $entry->categories ) ) {
foreach ( $entry->categories as $cat ) {
......@@ -331,13 +335,6 @@ EOD;
array_push($post_category, $cat->term_id);
}
$publish = ! ( isset( $entry->draft ) && 'yes' == trim( $entry->draft ) );
$cap = ($publish) ? 'publish_posts' : 'edit_posts';
if ( !current_user_can($cap) )
$this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
$blog_ID = get_current_blog_id();
$post_status = ($publish) ? 'publish' : 'draft';
$post_author = (int) $user_ID;
......@@ -398,7 +395,7 @@ EOD;
function get_post($postID) {
global $entry;
if ( !current_user_can( 'edit_post', $postID ) )
if ( ! get_post( $postID ) || ! current_user_can( 'edit_post', $postID ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this post.' ) );
$this->set_current_entry($postID);
......@@ -429,10 +426,14 @@ EOD;
global $entry;
$this->set_current_entry($postID);
if ( !current_user_can('edit_post', $entry['ID']) )
if ( !current_user_can('edit_post', $postID) )
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
$publish = ! ( isset($parsed->draft) && 'yes' == trim($parsed->draft) );
if ( $publish && ! current_user_can( 'publish_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to publish this post.' ) );
$post_status = ($publish) ? 'publish' : 'draft';
extract($entry);
......@@ -473,7 +474,7 @@ EOD;
global $entry;
$this->set_current_entry($postID);
if ( !current_user_can('edit_post', $postID) )
if ( !current_user_can('delete_post', $postID) )
$this->auth_required(__('Sorry, you do not have the right to delete this post.'));
if ( $entry['post_type'] == 'attachment' ) {
......@@ -504,6 +505,9 @@ EOD;
if ( !isset($postID) ) {
$this->get_attachments();
} else {
if ( ! current_user_can( 'edit_post', $postID ) )
$this->auth_required( __( 'Sorry, you do not have the right to edit this post.' ) );
$this->set_current_entry($postID);
$output = $this->get_entry($postID, 'attachment');
$this->output($output);
......@@ -589,7 +593,7 @@ EOD;
global $entry;
$this->set_current_entry($postID);
if ( !current_user_can('edit_post', $entry['ID']) )
if ( !current_user_can('edit_post', $entry['ID']) || 'attachment' != $entry['post_type'] )
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
extract($entry);
......@@ -624,7 +628,7 @@ EOD;
global $entry;
$this->set_current_entry($postID);
if ( !current_user_can('edit_post', $postID) )
if ( !current_user_can('delete_post', $postID) )
$this->auth_required(__('Sorry, you do not have the right to delete this post.'));
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
......@@ -633,11 +637,8 @@ EOD;
if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) )
$this->internal_error(__('Error occurred while accessing post metadata for file location.'));
// delete file
@unlink($location);
// delete attachment
$result = wp_delete_post($postID);
$result = wp_delete_attachment($postID);
if ( !$result )
$this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
......@@ -970,7 +971,7 @@ EOD;
$count = get_option('posts_per_rss');
wp('posts_per_page=' . $count . '&offset=' . ($count * ($page-1)) . '&orderby=modified&post_status=any');
wp('posts_per_page=' . $count . '&offset=' . ($count * ($page-1)) . '&orderby=modified&perm=readable');
$post = $GLOBALS['post'];
$posts = $GLOBALS['posts'];
......
......@@ -321,6 +321,21 @@ class WP_Customize_Image_Control extends WP_Customize_Upload_Control {
$this->add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) );
$this->add_tab( 'uploaded', __('Uploaded'), array( $this, 'tab_uploaded' ) );
// Early priority to occur before $this->manager->prepare_controls();
add_action( 'customize_controls_init', array( $this, 'prepare_control' ), 5 );
}
/**
* Prepares the control.
*
* If no tabs exist, removes the control from the manager.
*
* @since 3.4.2
*/
public function prepare_control() {
if ( ! $this->tabs )
$this->manager->remove_control( $this->id );
}
public function to_json() {
......@@ -455,6 +470,20 @@ class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control {
}
class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
/**
* The processed default headers.
* @since 3.4.2
* @var array
*/
protected $default_headers;
/**
* The uploaded headers.
* @since 3.4.2
* @var array
*/
protected $uploaded_headers;
public function __construct( $manager ) {
parent::__construct( $manager, 'header_image', array(
'label' => __( 'Header Image' ),
......@@ -474,7 +503,34 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
)
) );
$this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) );
// Remove the upload tab.
$this->remove_tab( 'upload-new' );
}
/**
* Prepares the control.
*
* If no tabs exist, removes the control from the manager.
*
* @since 3.4.2
*/
public function prepare_control() {
global $custom_image_header;
if ( empty( $custom_image_header ) )
return parent::prepare_control();
// Process default headers and uploaded headers.
$custom_image_header->process_default_headers();
$this->default_headers = $custom_image_header->default_headers;
$this->uploaded_headers = get_uploaded_header_images();
if ( $this->default_headers )
$this->add_tab( 'default', __('Default'), array( $this, 'tab_default_headers' ) );
if ( ! $this->uploaded_headers )
$this->remove_tab( 'uploaded' );
return parent::prepare_control();
}
public function print_header_image( $choice, $header ) {
......@@ -498,19 +554,14 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
}
public function tab_uploaded() {
$headers = get_uploaded_header_images();
?><div class="uploaded-target"></div><?php
foreach ( $headers as $choice => $header )
foreach ( $this->uploaded_headers as $choice => $header )
$this->print_header_image( $choice, $header );
}
public function tab_default_headers() {
global $custom_image_header;
$custom_image_header->process_default_headers();
foreach ( $custom_image_header->default_headers as $choice => $header )
foreach ( $this->default_headers as $choice => $header )
$this->print_header_image( $choice, $header );
}
}
\ No newline at end of file
......@@ -783,7 +783,7 @@ final class _WP_Editors {
<div class="link-search-wrapper">
<label>
<span><?php _e( 'Search' ); ?></span>
<input type="search" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" />
<input type="text" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" />
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</label>
</div>
......
......@@ -794,7 +794,7 @@ final class WP_Theme implements ArrayAccess {
* @return string URL to the stylesheet directory.
*/
public function get_stylesheet_directory_uri() {
return $this->get_theme_root_uri() . '/' . $this->stylesheet;
return $this->get_theme_root_uri() . '/' . str_replace( '%2F', '/', rawurlencode(