summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-08-13 15:13:05 +0000
commitbfa3b629e0d67016ec83050c5db762479af40609 (patch)
tree4c9ae204172d0fad3ae056ccc65ffe9ea91134d2 /wp-admin/includes
parent7258ea2d7eeedb439607b72a1f74dee98e4b9d12 (diff)
downloadwordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.gz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.tar.xz
wordpress-mu-bfa3b629e0d67016ec83050c5db762479af40609.zip
Merge with WP revision 8635
git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1421 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes')
-rw-r--r--wp-admin/includes/media.php70
-rw-r--r--wp-admin/includes/plugin.php7
-rw-r--r--wp-admin/includes/post.php1
-rw-r--r--wp-admin/includes/schema.php5
-rw-r--r--wp-admin/includes/taxonomy.php2
-rw-r--r--wp-admin/includes/template.php2
-rw-r--r--wp-admin/includes/upgrade.php4
-rw-r--r--wp-admin/includes/user.php2
8 files changed, 40 insertions, 53 deletions
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index abdb44d..d91ffc2 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -67,8 +67,7 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
- // CAPTIONS_OFF is temporary. Do not use it.
- if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
+ if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
preg_match( '/width="([0-9]+)/', $html, $matches );
@@ -103,7 +102,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
$file = wp_handle_upload($_FILES[$file_id], $overrides);
if ( isset($file['error']) )
- return new wp_error( 'upload_error', $file['error'] );
+ return new WP_Error( 'upload_error', $file['error'] );
$url = $file['url'];
$type = $file['type'];
@@ -143,7 +142,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
$file = wp_handle_sideload($file_array, $overrides);
if ( isset($file['error']) )
- return new wp_error( 'upload_error', $file['error'] );
+ return new WP_Error( 'upload_error', $file['error'] );
$url = $file['url'];
$type = $file['type'];
@@ -281,7 +280,7 @@ function media_upload_form_handler() {
if ( isset($_POST['send']) ) {
$keys = array_keys($_POST['send']);
$send_id = (int) array_shift($keys);
- $attachment = $_POST['attachments'][$send_id];
+ $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
$html = $attachment['post_title'];
if ( !empty($attachment['url']) ) {
if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
@@ -510,14 +509,8 @@ function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
- // CAPTIONS_OFF is temporary. Do not use it.
- if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
- $form_fields['post_excerpt']['label'] = __('Alternate Text');
- $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
- } else {
- $form_fields['post_excerpt']['label'] = __('Caption');
- $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
- }
+ $form_fields['post_excerpt']['label'] = __('Caption');
+ $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
$form_fields['post_content']['label'] = __('Description');
@@ -606,19 +599,13 @@ function get_attachment_fields_to_edit($post, $errors = null) {
$file = wp_get_attachment_url($post->ID);
$link = get_attachment_link($post->ID);
- // CAPTIONS_OFF is temporary. Do not use it.
- if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
- $alt = __('Alternate Text');
- else
- $alt = __('Caption');
-
$form_fields = array(
'post_title' => array(
'label' => __('Title'),
'value' => $edit_post->post_title,
),
'post_excerpt' => array(
- 'label' => $alt,
+ 'label' => __('Caption'),
'value' => $edit_post->post_excerpt,
),
'post_content' => array(
@@ -884,7 +871,6 @@ function media_upload_form( $errors = null ) {
$post_id = intval($_REQUEST['post_id']);
?>
-<input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' />
<div id="media-upload-notice">
<?php if (isset($errors['upload_notice']) ) { ?>
<?php echo $errors['upload_notice']; ?>
@@ -947,9 +933,8 @@ jQuery(function($){
<div id="html-upload-ui">
<?php do_action('pre-html-upload-ui'); ?>
<p>
- <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
+ <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
</p>
- <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<br class="clear" />
<?php if ( is_lighttpd_before_150() ): ?>
<p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
@@ -1021,7 +1006,7 @@ var addExtImage = {
if ( f.alt.value ) {
alt = f.alt.value.replace(/['"<>]+/g, '');
-<?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
+<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
<?php } ?>
}
@@ -1082,6 +1067,7 @@ var addExtImage = {
</div>
</div>
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+</form>
<?php
endif;
}
@@ -1278,14 +1264,23 @@ jQuery(function($){
}
function type_form_image() {
- $form = '
+
+ if ( apply_filters( 'disable_captions', '' ) ) {
+ $alt = __('Alternate Text');
+ $alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
+ } else {
+ $alt = __('Image Caption');
+ $alt_help = __('Also used as alternate text for the image');
+ }
+
+ return '
<table class="describe"><tbody>
<tr>
<th valign="top" scope="row" class="label" style="width:120px;">
<span class="alignleft"><label for="src">' . __('Source') . '</label></span>
<span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
</th>
- <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()"></td>
+ <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
</tr>
<tr>
@@ -1295,31 +1290,15 @@ function type_form_image() {
</th>
<td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
</tr>
-';
- // CAPTIONS_OFF is temporary. Do not use it.
- if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
- $form .= '
- <tr>
- <th valign="top" scope="row" class="label">
- <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
- </th>
- <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
- <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
- </tr>
-';
- } else {
- $form .= '
<tr>
<th valign="top" scope="row" class="label">
- <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
+ <span class="alignleft"><label for="alt">' . $alt . '</label></span>
</th>
<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
- <p class="help">' . __('Also used as alternate text for the image') . '</p></td>
+ <p class="help">' . $alt_help . '</p></td>
</tr>
-';
- }
- $form .= '
+
<tr class="align">
<th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
<td class="field">
@@ -1354,7 +1333,6 @@ function type_form_image() {
</tbody></table>
';
- return $form;
}
function type_form_audio() {
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 2822dac..aca5242 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -34,7 +34,7 @@ function get_plugin_data( $plugin_file ) {
function get_plugins($plugin_folder = '') {
if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
- $cached_plugins = array();
+ $cache_plugins = array();
if ( isset($cache_plugins[ $plugin_folder ]) )
return $cache_plugins[ $plugin_folder ];
@@ -239,14 +239,19 @@ function validate_active_plugins() {
return;
}
+ //Invalid is any plugin that is deactivated due to error.
+ $invalid = array();
+
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ( $check_plugins as $check_plugin ) {
$result = validate_plugin($check_plugin);
if ( is_wp_error( $result ) ) {
+ $invalid[$check_plugin] = $result;
deactivate_plugins( $check_plugin, true);
}
}
+ return $invalid;
}
function validate_plugin($plugin) {
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index a34aeab..49ede25 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -603,7 +603,6 @@ function get_sample_permalink($id, $title=null, $name = null) {
$post->post_status = $original_status;
$post->post_date = $original_date;
$post->post_name = $original_name;
- $post->post_title = $original_title;
return $permalink;
}
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 3d15013..cec40fb 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -15,11 +15,12 @@ if ( $wpdb->supports_collation() ) {
$wp_queries="CREATE TABLE $wpdb->terms (
term_id bigint(20) NOT NULL auto_increment,
- name varchar(55) NOT NULL default '',
+ name varchar(200) NOT NULL default '',
slug varchar(200) NOT NULL default '',
term_group bigint(10) NOT NULL default 0,
PRIMARY KEY (term_id),
- UNIQUE KEY slug (slug)
+ UNIQUE KEY slug (slug),
+ KEY name (name)
) $charset_collate;
CREATE TABLE $wpdb->term_taxonomy (
term_taxonomy_id bigint(20) NOT NULL auto_increment,
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index f3c5fcf..a0b95a7 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -133,7 +133,7 @@ function get_tags_to_edit( $post_id ) {
foreach ( $tags as $tag )
$tag_names[] = $tag->name;
- $tags_to_edit = join( ', ', $tag_names );
+ $tags_to_edit = join( ',', $tag_names );
$tags_to_edit = attribute_escape( $tags_to_edit );
$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
return $tags_to_edit;
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 3a1abfd..3d6aac5 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -670,7 +670,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
} else {
$edit = $user_object->user_login;
}
- $role_name = translate_with_context($wp_roles->role_names[$role]);
+ $role_name = $wp_roles->role_names[$role] ? translate_with_context($wp_roles->role_names[$role]) : __('None');
$r = "<tr id='user-$user_object->ID'$style>
<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>
<td><strong>$edit</strong></td>
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 830a0d6..459c449 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -551,6 +551,10 @@ function upgrade_230() {
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
foreach ($categories as $category) {
$term_id = (int) $category->cat_ID;
+ $name = $category->cat_name;
+ $description = $category->category_description;
+ $slug = $category->category_nicename;
+ $parent = $category->category_parent;
$term_group = 0;
// Associate terms with the same slug in a term group and make slugs unique.
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index 3bf4fd7..94aa8bb 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -259,7 +259,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
} else {
$reassign = (int) $reassign;
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d}", $reassign, $id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $id) );
}
// FINALLY, delete user