summaryrefslogtreecommitdiffstats
path: root/wp-admin
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin')
-rw-r--r--wp-admin/admin-header.php2
-rw-r--r--wp-admin/categories.php25
-rw-r--r--wp-admin/css/dashboard-rtl.css9
-rw-r--r--wp-admin/css/press-this.css82
-rw-r--r--wp-admin/edit-category-form.php2
-rw-r--r--wp-admin/edit-form-advanced.php13
-rw-r--r--wp-admin/edit-pages.php25
-rw-r--r--wp-admin/gears-manifest.php115
-rw-r--r--wp-admin/images/loading-publish.gifbin0 -> 1849 bytes
-rw-r--r--wp-admin/import/wp-cat2tag.php322
-rw-r--r--wp-admin/includes/dashboard.php5
-rw-r--r--wp-admin/includes/file.php30
-rw-r--r--wp-admin/includes/media.php66
-rw-r--r--wp-admin/includes/plugin.php13
-rw-r--r--wp-admin/includes/schema.php4
-rw-r--r--wp-admin/includes/template.php196
-rw-r--r--wp-admin/includes/upgrade.php5
-rw-r--r--wp-admin/index.php21
-rw-r--r--wp-admin/js/post.js6
-rw-r--r--wp-admin/options-writing.php20
-rw-r--r--wp-admin/options.php2
-rw-r--r--wp-admin/plugins.php91
-rw-r--r--wp-admin/press-this.php420
-rw-r--r--wp-admin/revision.php6
-rw-r--r--wp-admin/rtl.css2
-rw-r--r--wp-admin/user-edit.php35
-rw-r--r--wp-admin/wp-admin.css2
27 files changed, 947 insertions, 572 deletions
diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php
index 7073e2f..f8a30d7 100644
--- a/wp-admin/admin-header.php
+++ b/wp-admin/admin-header.php
@@ -111,7 +111,7 @@ if ( ($is_gecko || $is_winIE) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']),
<?php } ?>
-<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>') ?> | <?php if ( $gears_compat ) { ?><span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Speed up!') ?></a></span><?php } ?></p></div>
+<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( $gears_compat ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Speed up!') ?></a></span><?php } ?></p></div>
<?php
require(ABSPATH . 'wp-admin/menu-header.php');
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
index 473a3a4..d2e8fb3 100644
--- a/wp-admin/categories.php
+++ b/wp-admin/categories.php
@@ -135,6 +135,24 @@ endif; ?>
<div class="tablenav">
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+ $pagenum = 1;
+if( !$catsperpage || $catsperpage < 0 )
+ $catsperpage = 20;
+
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
+ 'format' => '',
+ 'total' => ceil(wp_count_terms('category') / $catsperpage),
+ 'current' => $pagenum
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
<div class="alignleft">
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php wp_nonce_field('bulk-categories'); ?>
@@ -156,13 +174,18 @@ endif; ?>
</thead>
<tbody id="the-list" class="list:cat">
<?php
-cat_rows();
+cat_rows(0, 0, 0, $pagenum, $catsperpage);
?>
</tbody>
</table>
</form>
<div class="tablenav">
+
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
<br class="clear" />
</div>
<br class="clear" />
diff --git a/wp-admin/css/dashboard-rtl.css b/wp-admin/css/dashboard-rtl.css
index 29e59cf..82b77a3 100644
--- a/wp-admin/css/dashboard-rtl.css
+++ b/wp-admin/css/dashboard-rtl.css
@@ -13,6 +13,10 @@
margin: 1px 0 0 6px;
}
+div.dashboard-widget-holder {
+ float: right;
+}
+
h3.dashboard-widget-title span {
text-align: right;
float: right;
@@ -56,7 +60,10 @@ div.dashboard-widget {
float:right;
margin:0 0 0.2em 0.5em;
}
+#dashboard_secondary div.dashboard-widget-content ul li {
+ float: right;
+}
#dashboard_secondary div.dashboard-widget-content ul li a {
border-right:0 none;
border-left:1px solid #DADADA;
-} \ No newline at end of file
+}
diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css
index 7a01f9a..71a4125 100644
--- a/wp-admin/css/press-this.css
+++ b/wp-admin/css/press-this.css
@@ -111,7 +111,7 @@ text-decoration: none;
.howto {
font-size: 11px;
}
-#newtag { padding: 3px; }
+#newtag { width: 60%; padding: 3px; }
#wphead {
height: 2em;
@@ -294,26 +294,38 @@ div#categories h2 {
height: 100px;
}
+#img_container a {
+ display: block;
+ width: 79px;
+ height: 79px;
+ float: left;
+}
#img_container img {
width: 75px;
height: 75px;
+ border: 0px;
padding: 2px;
background-color: #f4f4f4;
- margin-right: 7px;
- margin-bottom: 7px;
cursor: pointer;
}
+#img_container a, #img_container a:link, #img_container a:visited {
+ border: 2px solid #ccc;
+ margin: 0 4px 4px 0;
+}
+#img_container a:hover, #img_container a:active {
+ border: 2px solid #000;
+}
.submit {
--moz-border-radius-bottomleft: 3px;
--khtml-border-bottom-left-radius: 3px;
--webkit-border-bottom-left-radius: 3px;
-border-bottom-left-radius: 3px;
--moz-border-radius-bottomright: 3px;
--khtml-border-bottom-right-radius: 3px;
--webkit-border-bottom-right-radius: 3px;
-border-bottom-right-radius: 3px;
-margin: 0;
-padding: 0;
+ -moz-border-radius-bottomleft: 3px;
+ -khtml-border-bottom-left-radius: 3px;
+ -webkit-border-bottom-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ -moz-border-radius-bottomright: 3px;
+ -khtml-border-bottom-right-radius: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ margin: 0;
+ padding: 0;
}
.submitbox {
width: 100%;
@@ -449,3 +461,47 @@ margin-bottom: .25em;
text-decoration: none;
padding-bottom: 2px;
}
+
+#photo_directions {
+margin-top: .25em;
+display: block;
+position: relative;
+}
+#photo_directions span {
+display: block;
+position: absolute;
+top: 0;
+right: 3px;
+}
+#photo_saving {
+margin-bottom: 8px;
+}
+
+#post_status {
+ margin-left: 10px;
+ margin-bottom: 1em;
+ display: block;
+}
+
+#footer {
+ height: 65px;
+ display: block;
+ width: 640px;
+ padding: 10px 0 0 60px;
+ margin: 0;
+ position: absolute;
+ bottom: 0;
+ font-size: 12px;
+}
+
+#footer p {
+ margin: 0;
+ padding: 7px 0;
+}
+
+#footer p a {
+ text-decoration: none;
+}
+
+#footer p a:hover {
+ text-decoration: underline;
diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php
index a77d56e..6ddeed3 100644
--- a/wp-admin/edit-category-form.php
+++ b/wp-admin/edit-category-form.php
@@ -32,7 +32,7 @@ if ( ! empty($cat_ID) ) {
<tr class="form-field">
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
<td>
- <?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?><br />
+ <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
<?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
</td>
</tr>
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index e87945e..bb629f4 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -22,8 +22,17 @@ if ( !isset($post_ID) || 0 == $post_ID ) {
$form_action = 'editpost';
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
$autosave = wp_get_post_autosave( $post_id );
- if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
- $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
+
+ // Detect if there exists an autosave newer than the post and if that autosave is different than the post
+ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
+ foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
+ if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) {
+ $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
+ break;
+ }
+ }
+ unset($autosave_field, $_autosave_field);
+ }
}
?>
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
index 0f93d97..6a9c5f7 100644
--- a/wp-admin/edit-pages.php
+++ b/wp-admin/edit-pages.php
@@ -118,6 +118,25 @@ endif;
<div class="tablenav">
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+ $pagenum = 1;
+if( !$per_page || $pre_page < 0 )
+ $per_page = 20;
+
+$num_pages = ceil(count($posts) / $per_page);
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
+ 'format' => '',
+ 'total' => $num_pages,
+ 'current' => $pagenum
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
<div class="alignleft">
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php wp_nonce_field('bulk-pages'); ?>
@@ -151,7 +170,7 @@ if ($posts) {
</tr>
</thead>
<tbody>
- <?php page_rows($posts); ?>
+ <?php page_rows($posts, $pagenum, $per_page); ?>
</tbody>
</table>
@@ -169,6 +188,10 @@ if ($posts) {
?>
<div class="tablenav">
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
<br class="clear" />
</div>
diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php
index 6fc01da..889bc58 100644
--- a/wp-admin/gears-manifest.php
+++ b/wp-admin/gears-manifest.php
@@ -25,30 +25,6 @@ wp_default_scripts($wp_scripts);
$wp_styles = new WP_Styles();
wp_default_styles($wp_styles);
-$get_lang = file_exists( ABSPATH . '/wp-config.php') ? file( ABSPATH . '/wp-config.php' ) : file( dirname(ABSPATH) . '/wp-config.php' );
-
-if ( is_array($get_lang) ) {
- foreach ( $get_lang as $val ) {
- if ( strpos( $val, "'WPLANG'" ) !== false ) {
- eval( $val );
- break;
- }
- }
-}
-
-if ( defined('WPLANG') && '' != WPLANG ) {
- if ( file_exists(ABSPATH . '/wp-content/languages') && @is_dir(ABSPATH . '/wp-content/languages') )
- $langdir = '/wp-content/languages/';
- else
- $langdir = '/wp-includes/languages/';
-
- $locale_file = ABSPATH . $langdir . WPLANG . '.php';
- if ( is_readable($locale_file) )
- include_once($locale_file);
-}
-
-$rtl = ( isset($text_direction) && 'rtl' == $text_direction ) ? true : false;
-
$defaults = $man_version = '';
foreach ( $wp_scripts->registered as $script ) {
if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
@@ -66,7 +42,7 @@ foreach ( $wp_styles->registered as $style ) {
if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
$defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
- if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) {
+ if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
if ( is_bool( $style->extra['rtl'] ) )
$rtl_href = str_replace( '.css', '-rtl.css', $src );
else
@@ -87,7 +63,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
?>
{
"betaManifestVersion" : 1,
-"version" : "<?php echo $man_version; ?>_20080606",
+"version" : "<?php echo $man_version; ?>_20080622",
"entries" : [
<?php echo $defaults; ?>
@@ -135,49 +111,50 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/thickbox/tb-close.png" },
{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" },
-{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=3091" },
-
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=3091" },
-
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=3091" },
-{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3091" },
+{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=3101" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=3101" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=3101" },
+{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=3101" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
diff --git a/wp-admin/images/loading-publish.gif b/wp-admin/images/loading-publish.gif
new file mode 100644
index 0000000..fc1baf5
--- /dev/null
+++ b/wp-admin/images/loading-publish.gif
Binary files differ
diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php
index 3176fa4..e2d1a74 100644
--- a/wp-admin/import/wp-cat2tag.php
+++ b/wp-admin/import/wp-cat2tag.php
@@ -24,23 +24,21 @@ class WP_Categories_to_Tags {
}
function populate_cats() {
- global $wpdb;
$categories = get_categories('get=all');
foreach ( $categories as $category ) {
$this->all_categories[] = $category;
- if ( tag_exists( $wpdb->escape($category->name) ) )
+ if ( is_term( $category->slug, 'post_tag' ) )
$this->hybrids_ids[] = $category->term_id;
}
}
function populate_tags() {
- global $wpdb;
$tags = get_terms( array('post_tag'), 'get=all' );
foreach ( $tags as $tag ) {
$this->all_tags[] = $tag;
- if ( $this->_category_exists($tag->term_id) )
+ if ( is_term( $tag->slug, 'category' ) )
$this->hybrids_ids[] = $tag->term_id;
}
}
@@ -52,14 +50,12 @@ class WP_Categories_to_Tags {
echo '<br class="clear" />';
if ( $cat_num > 0 ) {
- echo '<h2>Convert Categories (' . $cat_num . ') to Tags.</h2>';
+ echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
echo '<div class="narrow">';
echo '<p>' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
$this->categories_form();
- } elseif ( $hyb_num > 0 ) {
- echo '<p>' . __('You have no categories that can be converted. However some of your categories are both a tag and a category.') . '</p>';
} else {
echo '<p>'.__('You have no categories to convert!').'</p>';
}
@@ -92,44 +88,35 @@ function check_all_rows() {
</script>
<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
-<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
<?php wp_nonce_field('import-cat2tag'); ?></p>
<ul style="list-style:none">
-<?php
- $hier = _get_term_hierarchy('category');
+
+<?php $hier = _get_term_hierarchy('category');
foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' );
- if ( (int) $category->parent == 0 ) {
- if ( in_array( intval($category->term_id), $this->hybrids_ids ) ) {
-?>
- <li style="color:#777;padding-left:1.3em;"><?php echo $category->name . ' (' . $category->count . ') *'; ?></li>
-<?php
- } else {
-?>
+ if ( (int) $category->parent == 0 ) { ?>
+
<li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
- if ( isset($hier[$category->term_id]) )
- $this->_category_children($category, $hier);
-?></li>
-<?php
- }
- }
- }
-?>
+ if ( in_array( intval($category->term_id), $this->hybrids_ids ) )
+ echo ' <a href="#note"> * </a>';
+
+ if ( isset($hier[$category->term_id]) )
+ $this->_category_children($category, $hier); ?></li>
+<?php }
+ } ?>
</ul>
-<?php
- if ( ! empty($this->hybrids_ids) ) {
- echo '<p>' . __('* This category is also a tag. It cannot be convert again.') . '</p>';
- }
-?>
+<?php if ( ! empty($this->hybrids_ids) )
+ echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
+
<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
</form>
-<?php
- }
+<?php }
function tags_tab() {
$this->populate_tags();
@@ -138,15 +125,12 @@ function check_all_rows() {
echo '<br class="clear" />';
if ( $tags_num > 0 ) {
- echo '<h2>Convert Tags (' . $tags_num . ') to Categories.</h2>';
+ echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
echo '<div class="narrow">';
echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
-
-
+
$this->tags_form();
- } elseif ( $hyb_num > 0 ) {
- echo '<p>' . __('You have no tags that can be converted. However some of your tags are both a tag and a category.') . '</p>';
} else {
echo '<p>'.__('You have no tags to convert!').'</p>';
}
@@ -179,62 +163,38 @@ function check_all_tagrows() {
</script>
<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
-<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
<?php wp_nonce_field('import-cat2tag'); ?></p>
<ul style="list-style:none">
-<?php
- foreach ( $this->all_tags as $tag ) {
- if ( in_array( intval($tag->term_id), $this->hybrids_ids ) ) {
-?>
- <li style="color:#777;padding-left:1.3em;"><?php echo attribute_escape($tag->name) . ' (' . $tag->count . ') *'; ?></li>
-<?php
- } else {
-?>
- <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label></li>
-<?php
- }
- }
-?>
+<?php foreach ( $this->all_tags as $tag ) { ?>
+ <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id), $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
+
+<?php } ?>
</ul>
-<?php
- if ( ! empty($this->hybrids_ids) )
- echo '<p>' . __('* This tag is also a category. It cannot be converted again.') . '</p>';
-?>
+<?php if ( ! empty($this->hybrids_ids) )
+ echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
</form>
-<?php
- }
+<?php }
- function _category_children($parent, $hier) {
-?>
+ function _category_children($parent, $hier) { ?>
<ul style="list-style:none">
-<?php
- foreach ($hier[$parent->term_id] as $child_id) {
- $child =& get_category($child_id);
-
- if ( in_array( intval($child->term_id), $this->hybrids_ids ) ) {
-?>
- <li style="color:#777;padding-left:1.3em;"><?php echo $child->name . ' (' . $child->count . ') *'; ?></li>
-<?php
- } else {
-?>
- <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label>
-<?php
+<?php foreach ($hier[$parent->term_id] as $child_id) {
+ $child =& get_category($child_id); ?>
+ <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label><?php
+
+ if ( in_array( intval($child->term_id), $this->hybrids_ids ) )
+ echo ' <a href="#note"> * </a>';
if ( isset($hier[$child->term_id]) )
- $this->_category_children($child, $hier);
-?> </li>
-<?php
- }
- }
-?>
- </ul>
-<?php
+ $this->_category_children($child, $hier); ?></li>
+<?php } ?>
+ </ul><?php
}
function _category_exists($cat_id) {
@@ -252,73 +212,117 @@ function check_all_tagrows() {
function convert_categories() {
global $wpdb;
- if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
- echo '<div class="narrow">';
- echo '<p>' . sprintf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
- echo '</div>';
- return;
+ if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { ?>
+ <div class="narrow">
+ <p><?php printf(__('Uh, oh. Something didn&#8217;t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p>
+ </div>
+<?php return;
}
if ( empty($this->categories_to_convert) )
$this->categories_to_convert = $_POST['cats_to_convert'];
+
$hier = _get_term_hierarchy('category');
+ $hybrid_cats = $clear_parents = $parents = false;
+ $clean_term_cache = $clean_cat_cache = array();
+ $default_cat = get_option('default_category');
echo '<ul>';
foreach ( (array) $this->categories_to_convert as $cat_id) {
$cat_id = (int) $cat_id;
- echo '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
-
- if (!$this->_category_exists($cat_id)) {
- _e('Category doesn\'t exist!');
+ if ( ! $this->_category_exists($cat_id) ) {
+ echo '<li>' . sprintf( __('Category %s doesn\'t exist!'), $cat_id ) . "</li>\n";
} else {
$category =& get_category($cat_id);
-
- if ( tag_exists($wpdb->escape($category->name)) ) {
- _e('Category is already a tag.');
- echo '</li>';
- continue;
- }
+ echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '), $category->name);
// If the category is the default, leave category in place and create tag.
- if ( get_option('default_category') == $category->term_id ) {
- $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
+ if ( $default_cat == $category->term_id ) {
+
+ if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
+ $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
+
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
+ $term_order = 0;
+
foreach ( $posts as $post ) {
- if ( !$wpdb->get_var( $wpdb->prepare("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $post, $id) ) )
- $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES (%d, %d)", $post, $id) );
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
clean_post_cache($post);
}
- } else {
- $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
- if ( $tt_ids ) {
- $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
- foreach ( (array) $posts as $post )
- clean_post_cache($post);
+
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );
+ }
+
+ echo __('Converted successfully.') . "</li>\n";
+ continue;
+ }
+
+ // if tag already exists, add it to all posts in the category
+ if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
+ $objects_ids = get_objects_in_term($category->term_id, 'category');
+ $tag_ttid = (int) $tag_ttid;
+ $term_order = 0;
+
+ foreach ( $objects_ids as $object_id )
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tag_ttid, $term_order);
+
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );
}
+ echo __('Tag added to all posts in this category.') . " *</li>\n";
- // Change the category to a tag.
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
+ $hybrid_cats = true;
+ $clean_term_cache[] = $category->term_id;
+ $clean_cat_cache[] = $category->term_id;
- $terms = $wpdb->get_col( $wpdb->prepare("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
- foreach ( (array) $terms as $term )
- clean_category_cache($term);
+ continue;
+ }
- // Set all parents to 0 (root-level) if their parent was the converted tag
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
+ $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
+ if ( $tt_ids ) {
+ $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
+ foreach ( (array) $posts as $post )
+ clean_post_cache($post);
}
- // Clean the cache
- clean_category_cache($category->term_id);
- _e('Converted successfully.');
+ // Change the category to a tag.
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
+
+ // Set all parents to 0 (root-level) if their parent was the converted tag
+ $parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
+
+ if ( $parents ) $clear_parents = true;
+ $clean_cat_cache[] = $category->term_id;
+ echo __('Converted successfully.') . "</li>\n";
}
+ }
+ echo '</ul>';
- echo '</li>';
+ if ( ! empty($clean_term_cache) ) {
+ $clean_term_cache = array_unique(array_values($clean_term_cache));
+ foreach ( $clean_term_cache as $id )
+ wp_cache_delete($id, 'post_tag');
}
- echo '</ul>';
+ if ( ! empty($clean_cat_cache) ) {
+ $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+ foreach ( $clean_cat_cache as $id )
+ wp_cache_delete($id, 'category');
+ }
+
+ if ( $clear_parents ) delete_option('category_children');
+
+ if ( $hybrid_cats )
+ echo '<p>' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the <a href="%s">Manage Categories</a> page.'), 'categories.php') . '</p>';
echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
}
@@ -332,55 +336,83 @@ function check_all_tagrows() {
return;
}
- if ( empty($this->categories_to_convert) )
+ if ( empty($this->tags_to_convert) )
$this->tags_to_convert = $_POST['tags_to_convert'];
- $clean_cache = array();
+ $hybrid_tags = $clear_parents = false;
+ $clean_cat_cache = $clean_term_cache = array();
+ $default_cat = get_option('default_category');
echo '<ul>';
foreach ( (array) $this->tags_to_convert as $tag_id) {
$tag_id = (int) $tag_id;
- echo '<li>' . sprintf(__('Converting tag #%s ... '), $tag_id);
+ if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
+ printf('<li>' . __('Converting tag <strong>%s</strong> ... '), $tag->name);
- if ( ! is_term($tag_id, 'post_tag') ) {
- _e('Tag doesn\'t exist!');
- } else {
+ if ( $cat_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $tag->term_id) ) ) {
+ $objects_ids = get_objects_in_term($tag->term_id, 'post_tag');
+ $cat_ttid = (int) $cat_ttid;
+ $term_order = 0;
- if ( is_term($tag_id, 'category') ) {
- _e('This Tag is already a Category.');
- echo '</li>';
- continue;
- }
+ foreach ( $objects_ids as $object_id ) {
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $cat_ttid, $term_order);
+ clean_post_cache($object_id);
+ }
- $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
- if ( $tt_ids ) {
- $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
- foreach ( (array) $posts as $post )
- clean_post_cache($post);
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ if ( $default_cat != $tag->term_id ) {
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );
+ }
+ }
+
+ $hybrid_tags = true;
+ $clean_term_cache[] = $tag->term_id;
+ $clean_cat_cache[] = $tag->term_id;
+ echo __('All posts were added to the category with the same name.') . " *</li>\n";
+
+ continue;
}
// Change the tag to a category.
- $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
- if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) )
+ $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
+ if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) {
$reset_parent = '';
- else $reset_parent = ", parent = '0'";
+ $clear_parents = true;
+ } else
+ $reset_parent = ", parent = '0'";
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag_id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
- // Clean the cache
- $clean_cache[] = $tag_id;
+ $clean_term_cache[] = $tag->term_id;
+ $clean_cat_cache[] = $cat['term_id'];
+ echo __('Converted successfully.') . "</li>\n";
- _e('Converted successfully.');
+ } else {
+ printf( '<li>' . __('Tag #%s doesn\'t exist!') . "</li>\n", $tag_id );
}
+ }
+
+ if ( ! empty($clean_term_cache) ) {
+ $clean_term_cache = array_unique(array_values($clean_term_cache));
+ foreach ( $clean_term_cache as $id )
+ wp_cache_delete($id, 'post_tag');
+ }
- echo '</li>';
+ if ( ! empty($clean_cat_cache) ) {
+ $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+ foreach ( $clean_cat_cache as $id )
+ wp_cache_delete($id, 'category');
}
- clean_term_cache( $clean_cache, 'post_tag' );
- delete_option('category_children');
-
+ if ( $clear_parents ) delete_option('category_children');
+
echo '</ul>';
+ if ( $hybrid_tags )
+ echo '<p>' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the <a href="%s">Manage Tags</a> page.'), 'edit-tags.php') . '</p>';
echo '<p>' . sprintf( __('We&#8217;re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&amp;step=3' ) . '</p>';
}
@@ -401,11 +433,11 @@ function check_all_tagrows() {
check_admin_referer('import-cat2tag');
$this->convert_categories();
break;
-
+
case 3 :
$this->tags_tab();
break;
-
+
case 4 :
check_admin_referer('import-cat2tag');
$this->convert_tags();
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 1b4f86e..27839fc 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -36,9 +36,10 @@ function wp_dashboard_setup() {
);
// Incoming Links Widget
- if ( !isset( $widget_options['dashboard_incoming_links'] ) ) {
+ if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
$update = true;
$widget_options['dashboard_incoming_links'] = array(
+ 'home' => get_option('home'),
'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
'items' => 5,
@@ -315,7 +316,7 @@ function wp_dashboard_incoming_links_output() {
$widgets = get_option( 'dashboard_widget_options' );
@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
$rss = @fetch_rss( $url );
- if ( isset($rss->items) && 1 < count($rss->items) ) {// Technorati returns a 1-item feed when it has no results
+ if ( isset($rss->items) && 0 < count($rss->items) ) {
echo "<ul>\n";
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 29609b2..078cb9d 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -41,6 +41,34 @@ function get_real_file_to_edit( $file ) {
return $real_file;
}
+//$folder = Full path to folder
+//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
+function list_files( $folder = '', $levels = 100 ) {
+ if( empty($folder) )
+ return false;
+
+ if( ! $levels )
+ return false;
+
+ $files = array();
+ if ( $dir = @opendir( $folder ) ) {
+ while (($file = readdir( $dir ) ) !== false ) {
+ if ( in_array($file, array('.', '..') ) )
+ continue;
+ if ( is_dir( $folder . '/' . $file ) ) {
+ $files2 = list_files( $folder . '/' . $file, $levels - 1);
+ if( $files2 )
+ $files = array_merge($files, $files2 );
+ else
+ $files[] = $folder . '/' . $file . '/';
+ } else {
+ $files[] = $folder . '/' . $file;
+ }
+ }
+ }
+ @closedir( $dir );
+ return $files;
+}
function get_temp_dir() {
if ( defined('WP_TEMP_DIR') )
@@ -171,7 +199,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
// Move the file to the uploads dir
$new_file = $uploads['path'] . "/$filename";
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
- wp_die( __('There was a problem uploading your file. Please try again.' ) );
+ return $upload_error_handler( $file, __('The uploaded file could not be moved to the upload folder.' ) );
}
// Set correct file permissions
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 4d42def..d6fdec2 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -115,41 +115,6 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
}
-
-function media_sideload_image($file, $post_id, $desc = null) {
-
- if (!empty($file) ) {
- // Upload File button was clicked
-
- $file_array['name'] = basename($file);
- $file_array['tmp_name'] = download_url($file);
- $desc = @$desc;
-
- $sideload = media_handle_sideload($file_array, $post_id, $desc);
-
- $id = $sideload['id'];
- $src = $sideload['src'];
-
- unset($file_array['tmp_name']);
- unset($file_array);
-
- if ( is_wp_error($id) ) {
- $errors['upload_error'] = $id;
- $id = false;
- }
- }
-
- if ( !empty($src) && !strpos($src, '://') )
-
- $src = "http://$src";
- $alt = @$desc;
-
- if ( !empty($src) )
- $html = "<img src='$src' alt='$alt' />";
- return $html;
-
-}
-
function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
$overrides = array('test_form'=>false);
$file = wp_handle_sideload($file_array, $overrides);
@@ -186,10 +151,9 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
$id = wp_insert_attachment($attachment, $file, $post_parent);
if ( !is_wp_error($id) ) {
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+ return $url;
}
-
- return array('id' => $id, 'src' => $url);
-
+ return $id;
}
@@ -348,6 +312,32 @@ function media_upload_image() {
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
}
+function media_sideload_image($file, $post_id, $desc = null) {
+ if (!empty($file) ) {
+ $file_array['name'] = basename($file);
+ $file_array['tmp_name'] = download_url($file);
+ $desc = @$desc;
+
+ $id = media_handle_sideload($file_array, $post_id, $desc);
+ $src = $id;
+
+ unset($file_array);
+
+ if ( is_wp_error($id) ) {
+ $errors['upload_error'] = $id;
+ return $id;
+ }
+ }
+
+ if ( !empty($src) ) {
+ if ( !strpos($src, '://') )
+ $src = "http://$src";
+ $alt = @$desc;
+ $html = "<img src='$src' alt='$alt' />";
+ return $html;
+ }
+}
+
function media_upload_audio() {
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
// Upload File button was clicked
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 3afaed9..72acd45 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -136,7 +136,6 @@ function deactivate_plugins($plugins, $silent= false) {
update_option('active_plugins', $current);
}
-//Replaces reactivate_all_plugins() / deactivate_all_plugins() = 'deactivated_plugins' is now useless
function activate_plugins($plugins, $redirect = '') {
if ( !is_array($plugins) )
$plugins = array($plugins);
@@ -167,7 +166,7 @@ function delete_plugins($plugins, $redirect = '' ) {
$checked[] = 'checked[]=' . $plugin;
ob_start();
- $url = wp_nonce_url('plugins.php?action=delete-selected&' . implode('&', $checked), 'mass-manage-plugins');
+ $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
$data = ob_get_contents();
ob_end_clean();
@@ -243,13 +242,9 @@ function validate_active_plugins() {
// If a plugin file does not exist, remove it from the list of active
// plugins.
foreach ( $check_plugins as $check_plugin ) {
- if ( !file_exists(WP_PLUGIN_DIR . '/' . $check_plugin) ) {
- $current = get_option('active_plugins');
- $key = array_search($check_plugin, $current);
- if ( false !== $key && NULL !== $key ) {
- unset($current[$key]);
- update_option('active_plugins', $current);
- }
+ $result = validate_plugin($check_plugin);
+ if ( is_wp_error( $result ) ) {
+ deactivate_plugins( $check_plugin, true);
}
}
}
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index 1c58b8f..afaee6b 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -331,7 +331,9 @@ function populate_options() {
// 2.6
add_option('avatar_default', 'mystery');
-
+ add_option('enable_app',0);
+ add_option('enable_xmlrpc',0);
+
// Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
foreach ($unusedoptions as $option) :
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index c348e7f..346fe7e 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -4,35 +4,73 @@
// Big Mess
//
-// Dandy new recursive multiple category stuff.
-function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
- if ( !$categories ) {
+// Ugly recursive category stuff.
+function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
+ $count = 0;
+ _cat_rows($categories, $count, $parent, $level, $page, $per_page);
+}
+
+function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
+ if ( empty($categories) ) {
$args = array('hide_empty' => 0);
if ( !empty($_GET['s']) )
$args['search'] = $_GET['s'];
$categories = get_categories( $args );
}
+ if ( !$categories )
+ return false;
+
$children = _get_term_hierarchy('category');
- if ( $categories ) {
- ob_start();
- foreach ( $categories as $category ) {
- if ( $category->parent == $parent) {
- echo "\t" . _cat_row( $category, $level );
- if ( isset($children[$category->term_id]) )
- cat_rows( $category->term_id, $level +1, $categories );
+ $start = ($page - 1) * $per_page;
+ $end = $start + $per_page;
+ $i = -1;
+ ob_start();
+ foreach ( $categories as $category ) {
+ if ( $count >= $end )
+ break;
+
+ $i++;
+
+ if ( $category->parent != $parent )
+ continue;
+
+ // If the page starts in a subtree, print the parents.
+ if ( $count == $start && $category->parent > 0 ) {
+ $my_parents = array();
+ $my_parent = $category->parent;
+ while ( $my_parent) {
+ $my_parent = get_category($my_parent);
+ $my_parents[] = $my_parent;
+ if ( !$my_parent->parent )
+ break;
+ $my_parent = $my_parent->parent;
+ }
+ $num_parents = count($my_parents);
+ while( $my_parent = array_pop($my_parents) ) {
+ echo "\t" . _cat_row( $my_parent, $level - $num_parents );
+ $num_parents--;
}
}
- $output = ob_get_contents();
- ob_end_clean();
- $output = apply_filters('cat_rows', $output);
+ if ( $count >= $start )
+ echo "\t" . _cat_row( $category, $level );
+
+ unset($categories[$i]); // Prune the working set
+ $count++;
+
+ if ( isset($children[$category->term_id]) )
+ _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
- echo $output;
- } else {
- return false;
}
+
+ $output = ob_get_contents();
+ ob_end_clean();
+
+ $output = apply_filters('cat_rows', $output);
+
+ echo $output;
}
function _cat_row( $category, $level, $name_override = false ) {
@@ -360,7 +398,7 @@ function wp_manage_pages_columns() {
* display one row if the page doesn't have any children
* otherwise, display the row and its children in subsequent rows
*/
-function display_page_row( $page, &$children_pages, $level = 0 ) {
+function display_page_row( $page, $level = 0 ) {
global $post;
static $class;
@@ -484,66 +522,104 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
</tr>
<?php
-
- if ( ! $children_pages )
- return true;
-
- for ( $i = 0; $i < count($children_pages); $i++ ) {
-
- $child = $children_pages[$i];
-
- if ( $child->post_parent == $id ) {
- array_splice($children_pages, $i, 1);
- display_page_row($child, $children_pages, $level+1);
- $i = -1; //as numeric keys in $children_pages are not preserved after splice
- }
- }
}
/*
* displays pages in hierarchical order
*/
-function page_rows( $pages ) {
- if ( ! $pages )
+
+function page_rows($pages, $pagenum = 1, $per_page = 20) {
+ $level = 0;
+
+ if ( ! $pages ) {
$pages = get_pages( array('sort_column' => 'menu_order') );
- if ( ! $pages )
- return false;
+ if ( ! $pages )
+ return false;
+ }
// splice pages into two parts: those without parent and those with parent
-
$top_level_pages = array();
$children_pages = array();
+ // If searching, ignore hierarchy and treat everything as top level, otherwise split
+ // into top level and children
+ if ( empty($_GET['s']) ) {
+ foreach ( $pages as $page ) {
+ // catch and repair bad pages
+ if ( $page->post_parent == $page->ID ) {
+ $page->post_parent = 0;
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
+ clean_page_cache( $page->ID );
+ }
+
+ if ( 0 == $page->post_parent )
+ $top_level_pages[] = $page;
+ else
+ $children_pages[] = $page;
+ }
+
+ $pages = &$top_level_pages;
+ }
+
+ $count = 0;
+ $start = ($pagenum - 1) * $per_page;
+ $end = $start + $per_page;
foreach ( $pages as $page ) {
+ if ( $count >= $end )
+ break;
- // catch and repair bad pages
- if ( $page->post_parent == $page->ID ) {
- $page->post_parent = 0;
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
- clean_page_cache( $page->ID );
- }
+ $i++;
- if ( 0 == $page->post_parent )
- $top_level_pages[] = $page;
- else
- $children_pages[] = $page;
+ if ( $count >= $start )
+ echo "\t" . display_page_row( $page, $level );
+
+ $count++;
+
+ if ( isset($children_pages) )
+ _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
}
+}
+
+function _page_rows( $pages, &$count, $parent, $level, $pagenum, $per_page ) {
+ $start = ($pagenum - 1) * $per_page;
+ $end = $start + $per_page;
+ $i = -1;
+ foreach ( $pages as $page ) {
+ if ( $count >= $end )
+ break;
+
+ $i++;
+
+ if ( $page->post_parent != $parent )
+ continue;
- foreach ( $top_level_pages as $page )
- display_page_row($page, $children_pages, 0);
-
- /*
- * display the remaining children_pages which are orphans
- * having orphan requires parental attention
- */
- if ( count($children_pages) > 0 ) {
- $empty_array = array();
- foreach ( $children_pages as $orphan_page ) {
- clean_page_cache( $orphan_page->ID);
- display_page_row( $orphan_page, $empty_array, 0 );
+ // If the page starts in a subtree, print the parents.
+ if ( $count == $start && $page->post_parent > 0 ) {
+ $my_parents = array();
+ $my_parent = $page->post_parent;
+ while ( $my_parent) {
+ $my_parent = get_post($my_parent);
+ $my_parents[] = $my_parent;
+ if ( !$my_parent->post_parent )
+ break;
+ $my_parent = $my_parent->post_parent;
+ }
+ $num_parents = count($my_parents);
+ while( $my_parent = array_pop($my_parents) ) {
+ echo "\t" . display_page_row( $my_parent, $level - $num_parents );
+ $num_parents--;
+ }
}
- }
+
+ if ( $count >= $start )
+ echo "\t" . display_page_row( $page, $level );
+
+ unset($pages[$i]); // Prune the working set
+ $count++;
+
+ _page_rows( $pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
+ }
}
function user_row( $user_object, $style = '', $role = '' ) {
@@ -839,7 +915,7 @@ function meta_form() {
</tr>
<tr class="submit"><td colspan="3">
<?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
- <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta::post_id=<?php echo $GLOBALS['post_ID'] ? $GLOBALS['post_ID'] : $GLOBALS['temp_ID']; ?>" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
+ <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
</td></tr>
</table>
<?php
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 1b15aae..07a4f9f 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -6,7 +6,7 @@ require_once(ABSPATH . 'wp-admin/includes/admin.php');
require_once(ABSPATH . 'wp-admin/includes/schema.php');
if ( !function_exists('wp_install') ) :
-function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
+function wp_install($blog_title, $user_name, $user_email, $public, $remote) {
global $wp_rewrite;
wp_check_mysql_version();
@@ -18,6 +18,9 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
update_option('blogname', $blog_title);
update_option('admin_email', $user_email);
update_option('blog_public', $public);
+ update_option('enable_app',$remote);
+ update_option('enable_xmlrpc',$remote);
+
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
if ( defined('WP_SITEURL') && '' != WP_SITEURL )
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 3a10bcf..3cc9e3d 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -60,6 +60,8 @@ $num_cats = wp_count_terms('category');
$num_tags = wp_count_terms('post_tag');
+$num_comm = get_comment_count( );
+
$post_type_texts = array();
if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are. Just unlink if !current_user_can
@@ -89,18 +91,31 @@ if ( current_user_can( 'manage_categories' ) ) {
$tags_text = "<a href='edit-tags.php'>$tags_text</a>";
}
+$total_comments = sprintf( __( '%1$s total' ), $num_comm['total_comments'] );
+$approved_comments = sprintf( __( '%1$s approved' ), $num_comm['approved'] );
+$spam_comments = sprintf( __( '%1$s spam' ), $num_comm['spam'] );
+$moderated_comments = sprintf( __( '%1$s awaiting moderation' ), $num_comm['awaiting_moderation'] );
+
+if( current_user_can( 'moderate_comments' ) ) {
+ $total_comments = "<a href='edit-comments.php'>{$total_comments}</a>";
+ $approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>";
+ $moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>";
+}
+
+$comm_text = sprintf( __( 'Current comment break down: %1$s, %2$s, %3$s and %4$s.' ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
+
$post_type_text = implode(', ', $post_type_texts);
// There is always a category
-$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text );
-$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text );
+$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
+$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
?>
<p class="youhave"><?php echo $sentence; ?></p>
<?php
$ct = current_theme_info();
$sidebars_widgets = wp_get_sidebars_widgets();
-$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
+$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
$widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
$widgets_text = "<a href='widgets.php'>$widgets_text</a>";
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index a81fc81..273a6a4 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -181,5 +181,9 @@ jQuery(document).ready( function() {
if ( jQuery.isFunction( autosave_update_post_ID ) ) {
autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
}
- } });
+ }, addBefore: function( s ) {
+ s.data += '&post_id=' + jQuery('#post_ID').val();
+ return s;
+ }
+ });
});
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php
index 83c2d6f..09f4ad6 100644
--- a/wp-admin/options-writing.php
+++ b/wp-admin/options-writing.php
@@ -57,6 +57,26 @@ endforeach;
</tr>
</table>
+<h3><?php _e('Remote Publishing') ?></h3>
+<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
+<table class="form-table">
+<tr valign="top">
+<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('Atom Publishing Protocol') ?></legend>
+<label for="enable_app">
+<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
+<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
+</fieldset></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('XML-RPC') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('XML-RPC') ?></legend>
+<label for="enable_xmlrpc">
+<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
+<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
+</fieldset></td>
+</tr></table>
+
<p class="submit">
<input type="hidden" name="action" value="update" />
diff --git a/wp-admin/options.php b/wp-admin/options.php
index 017f2a2..bc5d83f 100644
--- a/wp-admin/options.php
+++ b/wp-admin/options.php
@@ -13,7 +13,7 @@ $whitelist_options = array(
'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h' ),
'privacy' => array( 'blog_public' ),
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'gzipcompression', 'show_on_front', 'page_on_front', 'page_for_posts' ),
- 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category' ),
+ 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
'options' => array( '' ) );
if ( defined( 'WP_SITEURL' ) ) remove_option_update_handler( 'general', 'siteurl' );
if ( defined( 'WP_HOME' ) ) remove_option_update_handler( 'general', 'home' );
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index ef8424b..ee5d101 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -37,7 +37,7 @@ if( !empty($action) ) {
exit;
break;
case 'activate-selected':
- check_admin_referer('mass-manage-plugins');
+ check_admin_referer('bulk-manage-plugins');
activate_plugins($_POST['checked'], 'plugins.php?error=true');
$recent = (array)get_option('recently_activated');
@@ -69,7 +69,7 @@ if( !empty($action) ) {
exit;
break;
case 'deactivate-selected':
- check_admin_referer('mass-manage-plugins');
+ check_admin_referer('bulk-manage-plugins');
deactivate_plugins($_POST['checked']);
$deactivated = array();
foreach( (array)$_POST['checked'] as $plugin )
@@ -81,20 +81,87 @@ if( !empty($action) ) {
case 'delete-selected':
if( ! current_user_can('delete_plugins') )
wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
- check_admin_referer('mass-manage-plugins');
- $plugins = $_REQUEST['checked'];
+
+ check_admin_referer('bulk-manage-plugins');
+
+ $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
include(ABSPATH . 'wp-admin/update.php');
$title = __('Delete Plugin');
$parent_file = 'plugins.php';
-
- $delete_result = delete_plugins($plugins);
+
+ if( ! isset($_REQUEST['verify-delete']) ) {
+ wp_enqueue_script('jquery');
+ require_once('admin-header.php');
+ ?>
+ <div class="wrap">
+ <h2><?php _e('Delete Plugin(s)'); ?></h2>
+ <?php
+ $files_to_delete = $plugin_info = array();
+ foreach( (array) $plugins as $plugin ) {
+ if( '.' == dirname($plugin) ) {
+ $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
+ if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
+ $plugin_info[ $plugin ] = $data;
+ } else {
+ //Locate all the files in that folder:
+ $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
+ if( $files ) {
+ $files_to_delete = array_merge($files_to_delete, $files);
+ }
+ //Get plugins list from that folder
+ if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
+ $plugin_info = array_merge($plugin_info, $folder_plugins);
+ }
+ }
+ ?>
+ <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
+ <p>
+ <ul>
+ <?php
+ foreach( $plugin_info as $plugin )
+ echo '<li>', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '</li>';
+ ?>
+ </ul>
+ </p>
+ <p><?php _e('Are you sure you wish to delete these files?') ?></p>
+ <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
+ <input type="hidden" name="verify-delete" value="1" />
+ <input type="hidden" name="delete-selected" value="1" />
+ <?php
+ foreach( (array)$plugins as $plugin ) {
+ $plugin = attribute_escape($plugin);
+ echo "<input type='hidden' name='checked[]' value='$plugin' />";
+ }
+ ?>
+ <?php wp_nonce_field('bulk-manage-plugins') ?>
+ <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
+ </form>
+ <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
+ <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
+ </form>
+
+ <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
+ <div id="files-list" style="display:none;">
+ <ul>
+ <?php
+ foreach( (array)$files_to_delete as $file ) {
+ $file = str_replace(ABSPATH, '', $file);
+ echo "<li>$file</li>";
+ }
+ ?>
+ </ul>
+ </div>
+ </div>
+ <?php
+ require_once('admin-footer.php');
+ exit;
+ }
+ //$delete_result = delete_plugins($plugins);
wp_cache_delete('plugins', 'plugins');
break;
- default:
- var_dump("Unknown Action $action");
}
}
@@ -231,7 +298,7 @@ function print_plugins_table($plugins, $context = '') {
<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
-<?php wp_nonce_field('mass-manage-plugins') ?>
+<?php wp_nonce_field('bulk-manage-plugins') ?>
<div class="tablenav">
<div class="alignleft">
@@ -247,7 +314,7 @@ function print_plugins_table($plugins, $context = '') {
<?php if ( ! empty($recent_plugins) ) : ?>
<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
-<?php wp_nonce_field('mass-manage-plugins') ?>
+<?php wp_nonce_field('bulk-manage-plugins') ?>
<div class="tablenav">
<div class="alignleft">
@@ -261,8 +328,9 @@ function print_plugins_table($plugins, $context = '') {
<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
-<?php wp_nonce_field('mass-manage-plugins') ?>
+<?php wp_nonce_field('bulk-manage-plugins') ?>
+<?php if ( ! empty($available_plugins) ) : ?>
<div class="tablenav">
<div class="alignleft">
<input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
@@ -271,6 +339,7 @@ function print_plugins_table($plugins, $context = '') {
<br class="clear" />
<?php print_plugins_table($available_plugins, 'available') ?>
</form>
+<?php endif; ?>
<?php if( is_site_admin() ) { ?>
<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p>
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
index a0bfd1c..ded9e01 100644
--- a/wp-admin/press-this.php
+++ b/wp-admin/press-this.php
@@ -4,15 +4,19 @@ require_once('admin.php');
if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' )); ?>
<?php
+
+function preg_quote2($string) {
+ return str_replace('/', '\/', preg_quote($string));
+}
function press_it() {
- #define some basic variables
- $quick['post_status'] = 'publish';
+ // define some basic variables
+ $quick['post_status'] = $_REQUEST['post_status'];
$quick['post_category'] = $_REQUEST['post_category'];
$quick['tags_input'] = $_REQUEST['tags_input'];
$quick['post_title'] = $_REQUEST['post_title'];
$quick['post_content'] = '';
- # insert the post with nothing in it, to get an ID
+ // insert the post with nothing in it, to get an ID
$post_ID = wp_insert_post($quick, true);
$content = '';
@@ -23,16 +27,21 @@ function press_it() {
break;
case 'photo':
- foreach($_REQUEST['photo_src'] as $key => $data) {
+ $content = $_REQUEST['content'];
+
+ foreach($_REQUEST['photo_src'] as $key => $image) {
#quote for matching
- $quoted = str_replace('/', '\/', preg_quote($data));
+ $quoted = preg_quote2($image);
- # see if files exist in content - we don't want to upload non-used selected files.
+ // see if files exist in content - we don't want to upload non-used selected files.
preg_match('/'.$quoted.'/', $_REQUEST['content'], $matches[0]);
- if($matches[0])
- media_sideload_image($data, $post_ID, $_REQUEST['photo_description'][$key]);
+ if($matches[0]) {
+ $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
+ // Replace the POSTED content <img> with correct uploaded ones.
+ if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
+ }
}
- $content = $_REQUEST['content'];
+
break;
case "video":
@@ -42,14 +51,16 @@ function press_it() {
break;
}
# set the post_content
- $quick['post_content'] = $content;
+ $quick['post_content'] = str_replace('<br />', "\n", preg_replace('/<\/?p>/','',$content));
#error handling for $post
- if ( is_wp_error($post_ID) ) {
+ if ( is_wp_error($post_ID)) {
wp_die($id);
wp_delete_post($post_ID);
-
#error handling for media_sideload
+ } elseif ( is_wp_error($upload)) {
+ wp_die($upload);
+ wp_delete_post($post_ID);
} else {
$quick['ID'] = $post_ID;
wp_update_post($quick);
@@ -57,30 +68,6 @@ function press_it() {
return $post_ID;
}
-
-function category_div() { ?>
- <div id="categories">
- <div class="submitbox" id="submitpost">
- <div id="previewview"></div>
- <div class="inside">
- <h2><?php _e('Categories') ?></h2>
- <div id="categories-all">
- <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
- <?php wp_category_checklist() ?>
- </ul>
- </div>
- <h2><?php _e('Tags') ?></h2>
- <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
- <div id="tagchecklist"></div>
-
- </div>
- <p class="submit">
- <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
- <img src="images/loading.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/>
- </p>
- </div>
-<?php }
-
# For submitted posts.
if ( 'post' == $_REQUEST['action'] ) {
check_admin_referer('press-this'); $post_ID = press_it(); ?>
@@ -102,35 +89,47 @@ if ( 'post' == $_REQUEST['action'] ) {
?>
</head>
<body class="press-this">
+
<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();">Close Window</a></p></div>
+
+ <div id="footer">
+ <p><?php
+ do_action('in_admin_footer', '');
+ $upgrade = apply_filters( 'update_footer', '' );
+ echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>');
+ ?></p>
+ </div>
+ <?php do_action('admin_footer', ''); ?>
+
</body>
</html>
<?php die;
}
+
+function aposfix($text) {
+ $translation_table[chr(34)] = '&quot;';
+ $translation_table[chr(38)] = '&';
+ $translation_table[chr(39)] = '&apos;';
+ return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));
+}
+
// Ajax Requests
$title = wp_specialchars(stripslashes($_GET['t']));
-$selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s']))));
-$url = $_GET['u'];
+
+$selection = str_replace("\n", "<br />", aposfix( stripslashes($_GET['s']) ) );
+$url = clean_url($_GET['u']);
$image = $_GET['i'];
+
if($_REQUEST['ajax'] == 'thickbox') { ?>
- <script type="text/javascript" charset="utf-8">
+ <script type="text/javascript" charset="utf-8">
jQuery('.cancel').click(function() {
tb_remove();
});
- function image_selector() {
- desc = jQuery('#this_photo_description').val();
- src = jQuery('#this_photo').val();
- pick(src, desc);
- tb_remove();
- return false;
- }
-
jQuery('.select').click(function() {
image_selector();
});
-
</script>
<h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
<div class="titlewrap">
@@ -138,12 +137,36 @@ if($_REQUEST['ajax'] == 'thickbox') { ?>
</div>
<p><input type="hidden" name="this_photo" value="<?php echo $image; ?>" id="this_photo" />
- <a href="#" class="select" rel="<?php echo $image; ?>"><img src="<?php echo $image; ?>" width="475" alt="Click to insert." title="Click to insert." /></a></p>
+ <a href="#" class="select"><img src="<?php echo $image; ?>" width="475" alt="Click to insert." title="Click to insert." /></a></p>
- <p id="options"><a href="#" class="select" rel="<?php echo $image; ?>">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p>
+ <p id="options"><a href="#" class="select">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p>
<?php die;
}
+if($_REQUEST['ajax'] == 'thickbox_url') { ?>
+ <script type="text/javascript" charset="utf-8">
+ jQuery('.cancel').click(function() {
+ tb_remove();
+ });
+
+ jQuery('.select').click(function() {
+ image_selector();
+ });
+ </script>
+ <h3 id="title"><label for="post_title"><?php _e('URL') ?></label></h3>
+ <div class="titlewrap">
+ <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" />
+ </div>
+
+
+ <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
+ <div class="titlewrap">
+ <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+ </div>
+
+ <p id="options"><a href="#" class="select">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p>
+<?php die;
+}
if($_REQUEST['ajax'] == 'video') { ?>
<h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
@@ -154,110 +177,117 @@ if($_REQUEST['ajax'] == 'video') { ?>
}
if($_REQUEST['ajax'] == 'photo_images') {
-$url = urldecode($url);
-$url = str_replace(' ', '%20', $url);
-
function get_images_from_uri($uri) {
- if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'";
+ if(preg_match('/\.(jpg|png|gif)/', $uri) && !strpos($uri,'blogger.com'))
+ return "'".$uri."'";
+
$content = wp_remote_fopen($uri);
- $host = parse_url($uri);
if ( false === $content ) return '';
-
- $pattern = '/<img[^>]+src=[\'"]([^\'" >]+?)[\'" >]/is';
+
+ $host = parse_url($uri);
+
+ $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is';
preg_match_all($pattern, $content, $matches);
+
if ( empty($matches[1]) ) return '';
-
+
$sources = array();
-
- foreach ($matches[1] as $src) {
- if ( false !== strpos($src, '&') ) continue;
- if(strpos($src, 'http') === false) {
- if(strpos($src, '../') === false && strpos($src, './') === false) {
- $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
- } else {
- $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src);
- }
- }
- $sources[] = $src;
+ foreach ($matches[3] as $src) {
+ if(strpos($src, 'http') === false)
+ if(strpos($src, '../') === false && strpos($src, './') === false)
+ $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
+ else
+ $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src);
+
+ $sources[] = $src;
}
return "'" . implode("','", $sources) . "'";
}
-
+ $url = urldecode($url);
+ $url = str_replace(' ', '%20', $url);
echo 'new Array('.get_images_from_uri($url).')';
die;
}
if($_REQUEST['ajax'] == 'photo_js') { ?>
- var last = null
+
+ // gather images and load some default JS
+
+ var last = null
+ var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
+ var my_src = eval(
+ jQuery.ajax({
+ type: "GET",
+ url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+ cache : false,
+ async : false,
+ data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+ dataType : "script"
+ }).responseText
+ );
+
+ for (i = 0; i < my_src.length; i++) {
+ img = new Image();
+ img.src = my_src[i];
+ img_attr = 'id="img' + i + '"';
+ skip = false;
+ if (img.width && img.height) {
+ if (img.width * img.height < 2500)
+ skip = true;
+ aspect = img.width / img.height;
+ scale = (aspect > 1) ? (75 / img.width) : (75 / img.height);
- function pick(img, desc) {
- if (img) {
- length = jQuery('.photolist input').length;
- if(length == 0) length = 1;
- jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
- jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
- append_editor('<img src="' + img +'" alt="' + desc + '" />'); }
- return false;
- }
-
- var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = "";
+ w = img.width;
+ h = img.height;
- var my_src = eval(
- jQuery.ajax({
- type: "GET",
- url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
- cache : false,
- async : false,
- data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
- dataType : "script"
- }).responseText);
-
- for (i = 0; i < my_src.length; i++) {
- img = new Image();
- img.src = my_src[i];
- img_attr = 'id="img' + i;
- skip = false;
-
- if (img.width && img.height) {
- if (img.width * img.height < 2500) skip = true;
- aspect = img.width / img.height;
- if (aspect > 1) { // Image is wide
- scale = 75 / img.width;
- } else { // Image is tall or square
- scale = 75 / img.height;
- }
- if (scale < 1) {
- w = parseInt(img.width * scale);
- h = parseInt(img.height * scale);
- } else {
- w = img.width;
- h = img.height;
- }
- img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
- }
-
- if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
-
+ if (scale < 1) {
+ w = parseInt(img.width * scale);
+ h = parseInt(img.height * scale);
}
-
- jQuery('#img_container').html(strtoappend);
-
- tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox
-
+ img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
+ }
+ if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
+ }
+
+ function pick(img, desc) {
+ if (img) {
+ length = jQuery('.photolist input').length;
+ if(length == 0) length = 1;
+ jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
+ jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
+ append_editor('<img src="' + img +'" alt="' + desc + '" />');
+ }
+ tinyMCE.activeEditor.resizeToContent();
+ return false;
+ }
+
+ function image_selector() {
+ tb_remove();
+ desc = jQuery('#this_photo_description').val();
+ src = jQuery('#this_photo').val();
+ pick(src, desc);
+ return false;
+ }
+
+ jQuery(document).ready(function() {
+ jQuery('#img_container').html(strtoappend);
+ jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500');
+ tb_init('a.thickbox, area.thickbox, input.thickbox');
+ });
+
<?php die; }
if($_REQUEST['ajax'] == 'photo') { ?>
-
<div class="photolist"></div>
-
- <small><?php _e('Click images to select:') ?></small>
+
+ <small id="photo_directions"><?php _e('Click images to select:') ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e('Add from URL') ?> +</a></span></small>
+
<div class="titlewrap">
<div id="img_container"></div>
</div>
<?php die; }
-
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
@@ -284,7 +314,6 @@ if($_REQUEST['ajax'] == 'photo') { ?>
if ( isset($strings) ) echo $strings; ?>
(function() {
var base = tinymce.baseURL, sl = tinymce.ScriptLoader, ln = "<?php echo $language; ?>";
-
sl.markDone(base + '/langs/' + ln + '.js');
sl.markDone(base + '/themes/advanced/langs/' + ln + '.js');
sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js');
@@ -314,7 +343,8 @@ if($_REQUEST['ajax'] == 'photo') { ?>
accessibility_focus : false,
tab_focus : ":next",
plugins : "safari,inlinepopups",
- entities : "38,amp,60,lt,62,gt"
+ entities : "38,amp,60,lt,62,gt",
+ force_p_newlines : true
});
<?php } ?>
@@ -345,53 +375,41 @@ if($_REQUEST['ajax'] == 'photo') { ?>
jQuery('#' + type + '_button').addClass('ui-tabs-selected');
jQuery("#post_type").val(type);
}
+
function set_editor(text) {
+
if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent('');
if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
}
+
function append_editor(text) {
if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text);
}
+
function set_title(title) { jQuery("#content_type").text(title); }
- function reset_height() {
- tinyMCE.height = '170px';
- }
+
function show(tab_name) {
jQuery('body').removeClass('video_split');
jQuery('#extra_fields').hide();
switch(tab_name) {
case 'text' :
- reset_height();
- jQuery('.editor-container').show();
- jQuery('#content_type').show();
set_menu('text');
- set_title('<?php _e('Text') ?>');
- set_editor("<?php echo $selection; ?>");
+ set_title('<?php _e('Post') ?>');
return false;
- break;
+ break;
case 'quote' :
- reset_height();
- jQuery('.editor-container').show();
- jQuery('#content_type').show();
set_menu('quote');
set_title('<?php _e('Quote') ?>');
- set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo ''; ?>'><?php echo ''; ?></a></cite> </p></blockquote>");
-
+ set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?> </a> </cite> </p></blockquote>");
return false;
- break;
+ break;
case 'video' :
- reset_height();
- jQuery('.editor-container').show();
- jQuery('#content_type').show();
set_menu('video');
set_title('<?php _e('Caption') ?>');
jQuery('#extra_fields').show();
jQuery('body').addClass('video_split');
-
-
jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
-
<?php
if ( preg_match("/youtube\.com\/watch/i", $url) ) {
list($domain, $video_id) = split("v=", $url);
@@ -407,25 +425,19 @@ if($_REQUEST['ajax'] == 'photo') { ?>
$content = $selection;
} ?>
jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
- set_editor("<?php echo $title; ?>");
+ set_editor("<?php echo $title; ?>");
});
-
-
return false;
- break;
-
+ break;
case 'photo' :
- reset_height();
set_menu('photo');
set_title('Post');
<?php if($selection) { ?>
set_editor("<?php echo $selection; ?>");
- <?php } else { ?>
- set_editor('')
<?php } ?>
jQuery('#extra_fields').show();
- jQuery('#extra_fields').prepend('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');
+ jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');
jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>');
jQuery.ajax({
type: "GET",
@@ -434,15 +446,12 @@ if($_REQUEST['ajax'] == 'photo') { ?>
data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
dataType : "script",
success : function() {
- jQuery('#waiting').innerHTML('');
+ jQuery('#waiting').remove();
}
});
-
return false;
- break;
-
+ break;
}
-
}
jQuery(document).ready(function() {
@@ -452,6 +461,7 @@ if($_REQUEST['ajax'] == 'photo') { ?>
show(tab_name);
});
+ // Set default tabs
<?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
show('video');
<?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
@@ -460,44 +470,60 @@ if($_REQUEST['ajax'] == 'photo') { ?>
show('photo');
<?php } ?>
});
+
</script>
</head>
<body class="press-this">
<div id="wphead">
-<h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
+ <h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
</div>
- <ul id="menu" class="ui-tabs-nav">
- <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
- <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
- <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
- <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
- </ul>
-
- <form action="press-this.php?action=post" method="post">
-
- <?php wp_nonce_field('press-this') ?>
- <input type="hidden" name="post_type" id="post_type" value="text"/>
- <div id="posting">
-
- <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
- <div class="titlewrap">
- <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
- </div>
-
- <div id="extra_fields" style="display: none"></div>
- <div class="editor_area">
- <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
- <div class="editor-container">
- <textarea name="content" id="content" style="width:100%;" class="mceEditor">
- <?php echo $selection; ?>
- </textarea>
- </div>
- </div>
-
- </div>
- <?php category_div(); ?>
- </form>
-
+<ul id="menu" class="ui-tabs-nav">
+ <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
+ <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
+ <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
+ <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
+</ul>
+
+<form action="press-this.php?action=post" method="post">
+ <?php wp_nonce_field('press-this') ?>
+ <input type="hidden" name="post_type" id="post_type" value="text"/>
+ <div id="posting">
+ <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
+ <div class="titlewrap">
+ <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
+ </div>
+
+ <div id="extra_fields" style="display: none"></div>
+
+ <div class="editor_area">
+ <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
+ <div class="editor-container">
+ <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea>
+ </div>
+ </div>
+ </div>
+
+ <div id="categories">
+ <div class="submitbox" id="submitpost">
+ <div id="previewview"></div>
+ <div class="inside">
+ <h2><?php _e('Categories') ?></h2>
+ <div id="categories-all">
+ <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+ <?php wp_category_checklist() ?>
+ </ul>
+ </div>
+ <h2><?php _e('Tags') ?></h2>
+ <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
+ <div id="tagchecklist"></div>
+ </div>
+ <label for="post_status" id="post_status"><input type="radio" name="post_status" value="publish" checked="checked" id="published" />Published <input type="radio" name="post_status" value="draft" id="unpubplished" /> Unpublished</label>
+ <p class="submit">
+ <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
+ <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
+ </p>
+ </div>
+</form>
</body>
</html>
diff --git a/wp-admin/revision.php b/wp-admin/revision.php
index a00fa81..4ec274f 100644
--- a/wp-admin/revision.php
+++ b/wp-admin/revision.php
@@ -43,6 +43,12 @@ case 'diff' :
if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )
break;
+ // If we're comparing a revision to itself, redirect to the 'view' page for that revision or the edit page for that post
+ if ( $left_revision->ID == $right_revision->ID ) {
+ $redirect = get_edit_post_link( $left_revision->ID );
+ break;
+ }
+
// Don't allow reverse diffs?
if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) {
$redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );
diff --git a/wp-admin/rtl.css b/wp-admin/rtl.css
index c5d94b2..fd7da68 100644
--- a/wp-admin/rtl.css
+++ b/wp-admin/rtl.css
@@ -161,7 +161,7 @@ form#themeselector
#poststuff #media-buttons
{
- direction: ltr;
+ direction: rtl;
float:left;
margin-left:20px;
margin-right:0
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index 76979f6..be6f955 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -41,6 +41,18 @@ function profile_js ( ) {
}
}
+
+ function update_nickname ( ) {
+
+ var nickname = jQuery('#nickname').val();
+ var display_nickname = jQuery('#display_nickname').val();
+
+ if ( nickname == '' ) {
+ jQuery('#display_nickname').remove();
+ }
+ jQuery('#display_nickname').val(nickname).html(nickname);
+
+ }
jQuery(function($) {
$('#pass1').keyup( check_pass_strength )
@@ -49,6 +61,7 @@ function profile_js ( ) {
jQuery(document).ready( function() {
jQuery('#pass1,#pass2').attr('autocomplete','off');
+ jQuery('#nickname').blur(update_nickname);
});
</script>
<?php
@@ -252,16 +265,16 @@ echo $role_list . '</select></td></tr>';
<select name="display_name" id="display_name">
<?php
$public_display = array();
- $public_display[] = $profileuser->display_name;
- $public_display[] = $profileuser->nickname;
- $public_display[] = $profileuser->user_login;
- $public_display[] = $profileuser->first_name;
- $public_display[] = $profileuser->first_name.' '.$profileuser->last_name;
- $public_display[] = $profileuser->last_name.' '.$profileuser->first_name;
+ $public_display['display_displayname'] = $profileuser->display_name;
+ $public_display['display_nickname'] = $profileuser->nickname;
+ $public_display['display_username'] = $profileuser->user_login;
+ $public_display['display_firstname'] = $profileuser->first_name;
+ $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
+ $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
$public_display = array_unique(array_filter(array_map('trim', $public_display)));
- foreach($public_display as $item) {
+ foreach($public_display as $id => $item) {
?>
- <option value="<?php echo $item; ?>"><?php echo $item; ?></option>
+ <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
<?php
}
?>
@@ -312,11 +325,11 @@ $show_password_fields = apply_filters('show_password_fields', true);
if ( $show_password_fields ) :
?>
<tr>
- <th><label for="pass1"><?php _e('New Password:'); ?></label></th>
+ <th><label for="pass1"><?php _e('New Password'); ?></label></th>
<td><input type="password" name="pass1" id="pass1" size="16" value="" /> <?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
<input type="password" name="pass2" id="pass2" size="16" value="" /> <?php _e("Type your new password again."); ?><br />
<?php if ( $is_profile_page ): ?>
- <p><strong><?php _e('Password Strength:'); ?></strong></p>
+ <p><strong><?php _e('Password Strength'); ?></strong></p>
<div id="pass-strength-result"><?php _e('Too short'); ?></div> <?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&amp;( in your password.'); ?>
<?php endif; ?>
</td>
@@ -336,7 +349,7 @@ if ( $show_password_fields ) :
<br class="clear" />
<table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
<tr>
- <th scope="row"><?php _e('Additional Capabilities:') ?></th>
+ <th scope="row"><?php _e('Additional Capabilities') ?></th>
<td><?php
$output = '';
foreach($profileuser->caps as $cap => $value) {
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index f61932b..1cbdbcc 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -600,7 +600,7 @@ a.view-comment-post-link {
border-top-style: solid;
}
-#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a {
+#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a, #taglist a, #catlist a {
text-decoration: none;
}