From 600b71019494e1c29898a620e58c0d2602f37b74 Mon Sep 17 00:00:00 2001
From: donncha
Date: Fri, 24 Nov 2006 16:16:44 +0000
Subject: WP Merge to 4524
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@810 7be80a69-a1ef-0310-a953-fb0f7c49ff36
---
index.php | 4 +-
wp-admin/admin-ajax.php | 2 +-
wp-admin/admin-db.php | 50 +-
wp-admin/admin-functions.php | 1610 +++++++--------
wp-admin/admin-header.php | 2 +-
wp-admin/bookmarklet.php | 20 +-
wp-admin/categories.php | 25 +-
wp-admin/comment.php | 2 +-
wp-admin/custom-fields.js | 4 +-
wp-admin/dbx-admin-key-js.php | 2 +-
wp-admin/edit-category-form.php | 1 +
wp-admin/edit-comments.php | 94 +-
wp-admin/edit-form-advanced.php | 13 +-
wp-admin/edit-form-comment.php | 4 +-
wp-admin/edit-form.php | 12 +-
wp-admin/edit-link-form.php | 6 +-
wp-admin/edit-page-form.php | 14 +-
wp-admin/edit-pages.php | 16 +-
wp-admin/edit.php | 66 +-
wp-admin/export.php | 55 +-
wp-admin/import/blogger.php | 2 +-
wp-admin/import/blogware.php | 16 +-
wp-admin/import/dotclear.php | 137 +-
wp-admin/import/greymatter.php | 14 +-
wp-admin/import/mt.php | 2 +-
wp-admin/import/textpattern.php | 192 +-
wp-admin/import/wordpress.php | 2 +-
wp-admin/index-extra.php | 67 +
wp-admin/install-helper.php | 172 +-
wp-admin/link-add.php | 8 +-
wp-admin/link-import.php | 10 +-
wp-admin/link-manager.php | 23 +-
wp-admin/link-parse-opml.php | 44 +-
wp-admin/link.php | 10 +-
wp-admin/menu-header.php | 17 +-
wp-admin/menu.php | 11 +-
wp-admin/moderation.php | 36 +-
wp-admin/options-misc.php | 10 +-
wp-admin/options-permalink.php | 2 +-
wp-admin/options-reading.php | 8 +-
wp-admin/options-writing.php | 8 +-
wp-admin/plugin-editor.php | 46 +-
wp-admin/plugins.php | 15 +-
wp-admin/post.php | 4 +-
wp-admin/profile.php | 19 +-
wp-admin/setup-config.php | 152 +-
wp-admin/sidebar.php | 16 +-
wp-admin/templates.php | 50 +-
wp-admin/theme-editor.php | 34 +-
wp-admin/themes.php | 8 +-
wp-admin/update-links.php | 6 +-
wp-admin/upgrade-functions.php | 168 +-
wp-admin/upgrade-schema.php | 2 +-
wp-admin/upgrade.php | 2 +-
wp-admin/upload-functions.php | 19 +-
wp-admin/upload-js.php | 35 +-
wp-admin/upload-rtl.css | 14 +-
wp-admin/upload.css | 47 +-
wp-admin/upload.php | 8 +-
wp-admin/user-edit.php | 26 +-
wp-admin/users.php | 25 +-
wp-admin/wp-admin.css | 15 +-
wp-admin/xfn.js | 8 +-
wp-atom.php | 18 +-
wp-commentsrss2.php | 15 +-
wp-content/themes/classic/comments-popup.php | 8 +-
wp-content/themes/classic/comments.php | 4 +-
wp-content/themes/classic/header.php | 2 +-
wp-content/themes/classic/sidebar.php | 6 +-
wp-content/themes/default/archives.php | 12 +-
wp-content/themes/default/comments-popup.php | 8 +-
wp-content/themes/default/comments.php | 24 +-
wp-content/themes/default/header.php | 6 +-
wp-content/themes/default/page.php | 4 +-
wp-content/themes/default/sidebar.php | 4 +-
wp-content/themes/default/single.php | 6 +-
wp-cron.php | 10 +-
wp-feed.php | 4 +-
wp-includes/author-template.php | 2 +-
wp-includes/bookmark-template.php | 12 +-
wp-includes/bookmark.php | 16 +
wp-includes/cache.php | 10 +-
wp-includes/capabilities.php | 43 +-
wp-includes/category-template.php | 8 +-
wp-includes/category.php | 31 +-
wp-includes/classes.php | 115 +-
wp-includes/comment-template.php | 45 +-
wp-includes/comment.php | 42 +-
wp-includes/compat.php | 66 +-
wp-includes/deprecated.php | 142 +-
wp-includes/feed.php | 4 +-
wp-includes/formatting.php | 165 +-
wp-includes/functions.php | 60 +-
wp-includes/general-template.php | 71 +-
wp-includes/js/autosave.js.php | 12 +-
wp-includes/js/list-manipulation-js.php | 18 +-
wp-includes/js/tinymce/license.txt | 255 ++-
.../js/tinymce/plugins/autosave/editor_plugin.js | 8 +-
.../plugins/directionality/editor_plugin.js | 8 +-
.../tinymce/plugins/inlinepopups/editor_plugin.js | 10 +-
.../plugins/inlinepopups/jscripts/mcwindows.js | 4 +-
.../js/tinymce/plugins/paste/editor_plugin.js | 387 +++-
.../js/tinymce/plugins/paste/jscripts/pastetext.js | 4 +
.../js/tinymce/plugins/paste/jscripts/pasteword.js | 6 +
.../js/tinymce/plugins/wordpress/editor_plugin.js | 2 +-
wp-includes/js/tinymce/themes/advanced/charmap.htm | 2 +-
.../js/tinymce/themes/advanced/color_picker.htm | 2 +-
.../tinymce/themes/advanced/css/editor_content.css | 5 +
.../tinymce/themes/advanced/css/editor_popup.css | 4 +
.../js/tinymce/themes/advanced/css/editor_ui.css | 423 +---
.../js/tinymce/themes/advanced/editor_template.js | 211 +-
.../tinymce/themes/advanced/editor_template_src.js | 0
.../tinymce/themes/advanced/images/backcolor.gif | Bin 174 -> 359 bytes
.../js/tinymce/themes/advanced/images/buttons.gif | Bin 8399 -> 5662 bytes
.../tinymce/themes/advanced/images/forecolor.gif | Bin 272 -> 342 bytes
.../themes/advanced/jscripts/source_editor.js | 30 +-
wp-includes/js/tinymce/themes/advanced/langs/en.js | 8 +-
wp-includes/js/tinymce/tiny_mce.js | 2093 +++++++++++++-------
wp-includes/js/tinymce/tiny_mce_popup.js | 446 +++--
wp-includes/js/tinymce/utils/form_utils.js | 29 +-
wp-includes/js/tinymce/utils/mclayer.js | 6 +-
wp-includes/js/tinymce/utils/mctabs.js | 4 +-
wp-includes/js/tinymce/utils/validate.js | 235 ++-
wp-includes/js/wp-ajax-js.php | 5 +-
wp-includes/l10n.php | 2 +-
wp-includes/link-template.php | 72 +-
wp-includes/pluggable.php | 23 +-
wp-includes/post.php | 160 +-
wp-includes/query.php | 87 +-
wp-includes/registration.php | 4 +-
wp-includes/rewrite.php | 72 +-
wp-includes/script-loader.php | 21 +-
wp-includes/theme.php | 149 +-
wp-includes/user.php | 2 +-
wp-includes/wp-db.php | 2 +-
wp-includes/wpmu-functions.php | 15 +
wp-links-opml.php | 12 +-
wp-login.php | 2 +-
wp-rss.php | 4 +-
wp-rss2.php | 6 +-
wp-settings.php | 13 +-
wp-trackback.php | 4 +-
xmlrpc.php | 619 +++---
143 files changed, 5726 insertions(+), 4235 deletions(-)
create mode 100644 wp-admin/index-extra.php
delete mode 100644 wp-includes/js/tinymce/themes/advanced/editor_template_src.js
diff --git a/index.php b/index.php
index 3e3db40..e5076a8 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
-
\ No newline at end of file
+?>
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index 4e27900..cc93b16 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -128,7 +128,7 @@ case 'add-category' : // On the Fly
break;
case 'add-cat' : // From Manage->Categories
if ( !current_user_can( 'manage_categories' ) )
- die('-1');
+ die('-1');
if ( !$cat = wp_insert_category( $_POST ) )
die('0');
if ( !$cat = get_category( $cat ) )
diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php
index b41891f..ea6e60d 100644
--- a/wp-admin/admin-db.php
+++ b/wp-admin/admin-db.php
@@ -48,7 +48,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
if ( ! $user->has_cap('edit_others_posts') ) {
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
return array($user->id);
- else
+ else
return false;
}
@@ -157,6 +157,9 @@ function wp_update_category($catarr) {
$cat_ID = (int) $catarr['cat_ID'];
+ if( $cat_ID == $catarr['category_parent'] )
+ return false;
+
// First, get all of the original fields
$category = get_category($cat_ID, ARRAY_A);
@@ -201,7 +204,7 @@ function wp_delete_category($cat_ID) {
$cats = array($default_cat);
else
$cats = array_diff($cats, array($cat_ID));
- wp_set_post_categories($post_id, $cats);
+ wp_set_post_categories($post_id, $cats);
}
$default_link_cat = get_option('default_link_category');
@@ -212,9 +215,9 @@ function wp_delete_category($cat_ID) {
$cats = array($default_link_cat);
else
$cats = array_diff($cats, array($cat_ID));
- wp_set_link_cats($link_id, $cats);
+ wp_set_link_cats($link_id, $cats);
}
-
+
wp_cache_delete($cat_ID, 'category');
wp_cache_delete('all_category_ids', 'category');
@@ -287,9 +290,9 @@ function wp_delete_user($id, $reassign = 'novalue') {
function wp_revoke_user($id) {
$id = (int) $id;
-
+
$user = new WP_User($id);
- $user->remove_all_caps();
+ $user->remove_all_caps();
}
function wp_insert_link($linkdata) {
@@ -387,15 +390,15 @@ function wp_update_link($linkdata) {
$link = add_magic_quotes($link);
// Passed link category list overwrites existing category list if not empty.
- if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
+ if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
&& 0 != count($linkdata['link_category']) )
- $link_cats = $linkdata['link_category'];
- else
- $link_cats = $link['link_category'];
+ $link_cats = $linkdata['link_category'];
+ else
+ $link_cats = $link['link_category'];
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge($link, $linkdata);
- $linkdata['link_category'] = $link_cats;
+ $linkdata['link_category'] = $link_cats;
return wp_insert_link($linkdata);
}
@@ -404,7 +407,7 @@ function wp_delete_link($link_id) {
global $wpdb;
do_action('delete_link', $link_id);
-
+
$categories = wp_get_link_cats($link_id);
if( is_array( $categories ) ) {
foreach ( $categories as $category ) {
@@ -420,9 +423,9 @@ function wp_delete_link($link_id) {
function wp_get_link_cats($link_ID = 0) {
global $wpdb;
- $sql = "SELECT category_id
- FROM $wpdb->link2cat
- WHERE link_id = $link_ID
+ $sql = "SELECT category_id
+ FROM $wpdb->link2cat
+ WHERE link_id = $link_ID
ORDER BY category_id";
$result = $wpdb->get_col($sql);
@@ -443,8 +446,8 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
// First the old categories
$old_categories = $wpdb->get_col("
- SELECT category_id
- FROM $wpdb->link2cat
+ SELECT category_id
+ FROM $wpdb->link2cat
WHERE link_id = $link_ID");
if (!$old_categories) {
@@ -459,9 +462,9 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
if ($delete_cats) {
foreach ($delete_cats as $del) {
$wpdb->query("
- DELETE FROM $wpdb->link2cat
- WHERE category_id = $del
- AND link_id = $link_ID
+ DELETE FROM $wpdb->link2cat
+ WHERE category_id = $del
+ AND link_id = $link_ID
");
}
}
@@ -472,18 +475,21 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$wpdb->query("
- INSERT INTO $wpdb->link2cat (link_id, category_id)
+ INSERT INTO $wpdb->link2cat (link_id, category_id)
VALUES ($link_ID, $new_cat)");
}
}
-
+
// Update category counts.
$all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
foreach ( $all_affected_cats as $cat_id ) {
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->link2cat, $wpdb->links WHERE $wpdb->links.link_id = $wpdb->link2cat.link_id AND category_id = '$cat_id'");
$wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'");
wp_cache_delete($cat_id, 'category');
+ do_action('edit_category', $cat_id);
}
+
+ do_action('edit_link', $link_ID);
} // wp_set_link_cats()
function post_exists($title, $content = '', $post_date = '') {
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index 0f80efd..8da7ff0 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -2,7 +2,7 @@
function write_post() {
$result = wp_write_post();
- if( is_wp_error($result) )
+ if( is_wp_error( $result ) )
wp_die( $result->get_error_message() );
else
return $result;
@@ -13,11 +13,11 @@ function wp_write_post() {
global $user_ID;
if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can('edit_pages') )
- return new WP_Error('edit_pages', __('You are not allowed to create pages on this blog.'));
+ if ( !current_user_can( 'edit_pages' ) )
+ return new WP_Error( 'edit_pages', __( 'You are not allowed to create pages on this blog.' ) );
} else {
- if ( !current_user_can('edit_posts') )
- return new WP_Error('edit_posts', __('You are not allowed to create posts or drafts on this blog.'));
+ if ( !current_user_can( 'edit_posts' ) )
+ return new WP_Error( 'edit_posts', __( 'You are not allowed to create posts or drafts on this blog.' ) );
}
// Rename.
@@ -26,10 +26,10 @@ function wp_write_post() {
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['to_ping'] = $_POST['trackback_url'];
- if (!empty ($_POST['post_author_override'])) {
+ if (!empty ( $_POST['post_author_override'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
} else {
- if (!empty ($_POST['post_author'])) {
+ if (!empty ( $_POST['post_author'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
@@ -37,118 +37,118 @@ function wp_write_post() {
}
- if ($_POST['post_author'] != $_POST['user_ID']) {
+ if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can('edit_others_pages') )
- return new WP_Error('edit_others_pages', __('You cannot create pages as this user.'));
+ if ( !current_user_can( 'edit_others_pages' ) )
+ return new WP_Error( 'edit_others_pages', __( 'You cannot create pages as this user.' ) );
} else {
- if ( !current_user_can('edit_others_posts') )
- return new WP_Error('edit_others_posts', __('You cannot post as this user.'));
+ if ( !current_user_can( 'edit_others_posts' ) )
+ return new WP_Error( 'edit_others_posts', __( 'You cannot post as this user.' ) );
}
}
// What to do based on which button they pressed
- if ('' != $_POST['saveasdraft'])
+ if ('' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
- if ('' != $_POST['saveasprivate'])
+ if ('' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
- if ('' != $_POST['publish'])
+ if ('' != $_POST['publish'] )
$_POST['post_status'] = 'publish';
- if ('' != $_POST['advanced'])
+ if ('' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
- if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages'))
+ if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
$_POST['post_status'] = 'draft';
} else {
- if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
+ if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
$_POST['post_status'] = 'draft';
}
- if (!isset ($_POST['comment_status']))
+ if (!isset( $_POST['comment_status'] ))
$_POST['comment_status'] = 'closed';
- if (!isset ($_POST['ping_status']))
+ if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
- if (!empty ($_POST['edit_date'])) {
+ if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
- $jj = ($jj > 31) ? 31 : $jj;
- $hh = ($hh > 23) ? $hh -24 : $hh;
- $mn = ($mn > 59) ? $mn -60 : $mn;
- $ss = ($ss > 59) ? $ss -60 : $ss;
- $_POST['post_date'] = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss);
- $_POST['post_date_gmt'] = get_gmt_from_date($_POST['post_date']);
+ $jj = ($jj > 31 ) ? 31 : $jj;
+ $hh = ($hh > 23 ) ? $hh -24 : $hh;
+ $mn = ($mn > 59 ) ? $mn -60 : $mn;
+ $ss = ($ss > 59 ) ? $ss -60 : $ss;
+ $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
+ $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
}
// Create the post.
- $post_ID = wp_insert_post($_POST);
- add_meta($post_ID);
+ $post_ID = wp_insert_post( $_POST);
+ add_meta( $post_ID );
// Reunite any orphaned attachments with their parent
if ( $_POST['temp_ID'] )
- relocate_children($_POST['temp_ID'], $post_ID);
+ relocate_children( $_POST['temp_ID'], $post_ID );
// Now that we have an ID we can fix any attachment anchor hrefs
- fix_attachment_links($post_ID);
+ fix_attachment_links( $post_ID );
return $post_ID;
}
// Move child posts to a new parent
-function relocate_children($old_ID, $new_ID) {
+function relocate_children( $old_ID, $new_ID ) {
global $wpdb;
$old_ID = (int) $old_ID;
$new_ID = (int) $new_ID;
- return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID");
+ return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
}
// Replace hrefs of attachment anchors with up-to-date permalinks.
-function fix_attachment_links($post_ID) {
+function fix_attachment_links( $post_ID ) {
global $wp_rewrite;
- $post = & get_post($post_ID, ARRAY_A);
+ $post = & get_post( $post_ID, ARRAY_A );
- $search = "#]+rel=('|\")[^'\"]*attachment[^>]*>#ie";
+ $search = "# ]+rel=('|\" )[^'\"]*attachment[^>]*>#ie";
// See if we have any rel="attachment" links
- if ( 0 == preg_match_all($search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER) )
+ if ( 0 == preg_match_all( $search, $post['post_content'], $anchor_matches, PREG_PATTERN_ORDER ) )
return;
$i = 0;
- $search = "#[\s]+rel=(\"|')(.*?)wp-att-(\d+)\\1#i";
+ $search = "#[\s]+rel=(\"|' )(.*? )wp-att-(\d+ )\\1#i";
foreach ( $anchor_matches[0] as $anchor ) {
- if ( 0 == preg_match($search, $anchor, $id_matches) )
+ if ( 0 == preg_match( $search, $anchor, $id_matches ) )
continue;
$id = $id_matches[3];
// While we have the attachment ID, let's adopt any orphans.
- $attachment = & get_post($id, ARRAY_A);
- if ( ! empty($attachment) && ! is_object(get_post($attachment['post_parent'])) ) {
+ $attachment = & get_post( $id, ARRAY_A );
+ if ( ! empty( $attachment) && ! is_object( get_post( $attachment['post_parent'] ) ) ) {
$attachment['post_parent'] = $post_ID;
// Escape data pulled from DB.
- $attachment = add_magic_quotes($attachment);
- wp_update_post($attachment);
+ $attachment = add_magic_quotes( $attachment);
+ wp_update_post( $attachment);
}
$post_search[$i] = $anchor;
- $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor);
+ $post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor );
++$i;
}
- $post['post_content'] = str_replace($post_search, $post_replace, $post['post_content']);
+ $post['post_content'] = str_replace( $post_search, $post_replace, $post['post_content'] );
// Escape data pulled from DB.
- $post = add_magic_quotes($post);
+ $post = add_magic_quotes( $post);
- return wp_update_post($post);
+ return wp_update_post( $post);
}
// Update an existing post with values provided in $_POST.
@@ -158,11 +158,11 @@ function edit_post() {
$post_ID = (int) $_POST['post_ID'];
if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can('edit_page', $post_ID) )
- wp_die(__('You are not allowed to edit this page.'));
+ if ( !current_user_can( 'edit_page', $post_ID ) )
+ wp_die( __('You are not allowed to edit this page.' ));
} else {
- if ( !current_user_can('edit_post', $post_ID) )
- wp_die(__('You are not allowed to edit this post.'));
+ if ( !current_user_can( 'edit_post', $post_ID ) )
+ wp_die( __('You are not allowed to edit this post.' ));
}
// Rename.
@@ -172,82 +172,82 @@ function edit_post() {
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['to_ping'] = $_POST['trackback_url'];
- if (!empty ($_POST['post_author_override'])) {
+ if (!empty ( $_POST['post_author_override'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author_override'];
} else
- if (!empty ($_POST['post_author'])) {
+ if (!empty ( $_POST['post_author'] ) ) {
$_POST['post_author'] = (int) $_POST['post_author'];
} else {
$_POST['post_author'] = (int) $_POST['user_ID'];
}
- if ($_POST['post_author'] != $_POST['user_ID']) {
+ if ( $_POST['post_author'] != $_POST['user_ID'] ) {
if ( 'page' == $_POST['post_type'] ) {
- if ( !current_user_can('edit_others_pages') )
- wp_die(__('You cannot edit pages as this user.'));
+ if ( !current_user_can( 'edit_others_pages' ) )
+ wp_die( __('You cannot edit pages as this user.' ));
} else {
- if ( !current_user_can('edit_others_posts') )
- wp_die(__('You cannot edit posts as this user.'));
+ if ( !current_user_can( 'edit_others_posts' ) )
+ wp_die( __('You cannot edit posts as this user.' ));
}
}
// What to do based on which button they pressed
- if ('' != $_POST['saveasdraft'])
+ if ('' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
- if ('' != $_POST['saveasprivate'])
+ if ('' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
- if ('' != $_POST['publish'])
+ if ('' != $_POST['publish'] )
$_POST['post_status'] = 'publish';
- if ('' != $_POST['advanced'])
+ if ('' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
- if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages'))
+ if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_pages' ))
$_POST['post_status'] = 'draft';
} else {
- if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts'))
+ if ('publish' == $_POST['post_status'] && !current_user_can( 'edit_published_posts' ))
$_POST['post_status'] = 'draft';
}
- if (!isset ($_POST['comment_status']))
+ if (!isset( $_POST['comment_status'] ))
$_POST['comment_status'] = 'closed';
- if (!isset ($_POST['ping_status']))
+ if (!isset( $_POST['ping_status'] ))
$_POST['ping_status'] = 'closed';
- if (!empty ($_POST['edit_date'])) {
+ if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
- $jj = ($jj > 31) ? 31 : $jj;
- $hh = ($hh > 23) ? $hh -24 : $hh;
- $mn = ($mn > 59) ? $mn -60 : $mn;
- $ss = ($ss > 59) ? $ss -60 : $ss;
+ $jj = ($jj > 31 ) ? 31 : $jj;
+ $hh = ($hh > 23 ) ? $hh -24 : $hh;
+ $mn = ($mn > 59 ) ? $mn -60 : $mn;
+ $ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
- $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
+ $_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
}
// Meta Stuff
- if ($_POST['meta']) {
- foreach ($_POST['meta'] as $key => $value)
- update_meta($key, $value['key'], $value['value']);
+ if ( $_POST['meta'] ) {
+ foreach ( $_POST['meta'] as $key => $value )
+ update_meta( $key, $value['key'], $value['value'] );
}
- if ($_POST['deletemeta']) {
- foreach ($_POST['deletemeta'] as $key => $value)
- delete_meta($key);
+ if ( $_POST['deletemeta'] ) {
+ foreach ( $_POST['deletemeta'] as $key => $value )
+ delete_meta( $key );
}
- add_meta($post_ID);
+ add_meta( $post_ID );
- wp_update_post($_POST);
+ wp_update_post( $_POST);
// Now that we have an ID we can fix any attachment anchor hrefs
- fix_attachment_links($post_ID);
+ fix_attachment_links( $post_ID );
return $post_ID;
}
@@ -258,8 +258,8 @@ function edit_comment() {
$comment_ID = (int) $_POST['comment_ID'];
$comment_post_ID = (int) $_POST['comment_post_ID'];
- if (!current_user_can('edit_post', $comment_post_ID))
- wp_die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
+ if (!current_user_can( 'edit_post', $comment_post_ID ))
+ wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
$_POST['comment_author'] = $_POST['newcomment_author'];
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
@@ -268,78 +268,78 @@ function edit_comment() {
$_POST['comment_content'] = $_POST['content'];
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
- if (!empty ($_POST['edit_date'])) {
+ if (!empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
- $jj = ($jj > 31) ? 31 : $jj;
- $hh = ($hh > 23) ? $hh -24 : $hh;
- $mn = ($mn > 59) ? $mn -60 : $mn;
- $ss = ($ss > 59) ? $ss -60 : $ss;
+ $jj = ($jj > 31 ) ? 31 : $jj;
+ $hh = ($hh > 23 ) ? $hh -24 : $hh;
+ $mn = ($mn > 59 ) ? $mn -60 : $mn;
+ $ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
- wp_update_comment($_POST);
+ wp_update_comment( $_POST);
}
// Get an existing post and format it for editing.
-function get_post_to_edit($id) {
+function get_post_to_edit( $id ) {
- $post = get_post($id);
+ $post = get_post( $id );
- $post->post_content = format_to_edit($post->post_content, user_can_richedit());
- $post->post_content = apply_filters('content_edit_pre', $post->post_content);
+ $post->post_content = format_to_edit( $post->post_content, user_can_richedit() );
+ $post->post_content = apply_filters( 'content_edit_pre', $post->post_content);
- $post->post_excerpt = format_to_edit($post->post_excerpt);
- $post->post_excerpt = apply_filters('excerpt_edit_pre', $post->post_excerpt);
+ $post->post_excerpt = format_to_edit( $post->post_excerpt);
+ $post->post_excerpt = apply_filters( 'excerpt_edit_pre', $post->post_excerpt);
- $post->post_title = format_to_edit($post->post_title);
- $post->post_title = apply_filters('title_edit_pre', $post->post_title);
+ $post->post_title = format_to_edit( $post->post_title );
+ $post->post_title = apply_filters( 'title_edit_pre', $post->post_title );
- $post->post_password = format_to_edit($post->post_password);
+ $post->post_password = format_to_edit( $post->post_password );
- if ($post->post_type == 'page')
- $post->page_template = get_post_meta($id, '_wp_page_template', true);
+ if ( $post->post_type == 'page' )
+ $post->page_template = get_post_meta( $id, '_wp_page_template', true );
return $post;
}
// Default post information to use when populating the "Write Post" form.
function get_default_post_to_edit() {
- if ( !empty($_REQUEST['post_title']) )
- $post_title = wp_specialchars(stripslashes($_REQUEST['post_title']));
- else if ( !empty($_REQUEST['popuptitle']) ) {
- $post_title = wp_specialchars(stripslashes($_REQUEST['popuptitle']));
- $post_title = funky_javascript_fix($post_title);
+ if ( !empty( $_REQUEST['post_title'] ) )
+ $post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
+ else if ( !empty( $_REQUEST['popuptitle'] ) ) {
+ $post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
+ $post_title = funky_javascript_fix( $post_title );
} else {
$post_title = '';
}
- if ( !empty($_REQUEST['content']) )
- $post_content = wp_specialchars(stripslashes($_REQUEST['content']));
- else if ( !empty($post_title) ) {
- $text = wp_specialchars(stripslashes(urldecode($_REQUEST['text'])));
- $text = funky_javascript_fix($text);
- $popupurl = wp_specialchars($_REQUEST['popupurl']);
+ if ( !empty( $_REQUEST['content'] ) )
+ $post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
+ else if ( !empty( $post_title ) ) {
+ $text = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
+ $text = funky_javascript_fix( $text);
+ $popupurl = wp_specialchars( $_REQUEST['popupurl'] );
$post_content = ' '.$post_title.' '."\n$text";
}
- if ( !empty($_REQUEST['excerpt']) )
- $post_excerpt = wp_specialchars(stripslashes($_REQUEST['excerpt']));
+ if ( !empty( $_REQUEST['excerpt'] ) )
+ $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
else
$post_excerpt = '';
$post->post_status = 'draft';
- $post->comment_status = get_option('default_comment_status');
- $post->ping_status = get_option('default_ping_status');
- $post->post_pingback = get_option('default_pingback_flag');
- $post->post_category = get_option('default_category');
- $post->post_content = apply_filters('default_content', $post_content);
- $post->post_title = apply_filters('default_title', $post_title);
- $post->post_excerpt = apply_filters('default_excerpt', $post_excerpt);
+ $post->comment_status = get_option( 'default_comment_status' );
+ $post->ping_status = get_option( 'default_ping_status' );
+ $post->post_pingback = get_option( 'default_pingback_flag' );
+ $post->post_category = get_option( 'default_category' );
+ $post->post_content = apply_filters( 'default_content', $post_content);
+ $post->post_title = apply_filters( 'default_title', $post_title );
+ $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt);
$post->page_template = 'default';
$post->post_parent = 0;
$post->menu_order = 0;
@@ -347,21 +347,21 @@ function get_default_post_to_edit() {
return $post;
}
-function get_comment_to_edit($id) {
- $comment = get_comment($id);
+function get_comment_to_edit( $id ) {
+ $comment = get_comment( $id );
- $comment->comment_content = format_to_edit($comment->comment_content, user_can_richedit());
- $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
+ $comment->comment_content = format_to_edit( $comment->comment_content, user_can_richedit() );
+ $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);
- $comment->comment_author = format_to_edit($comment->comment_author);
- $comment->comment_author_email = format_to_edit($comment->comment_author_email);
- $comment->comment_author_url = format_to_edit($comment->comment_author_url);
+ $comment->comment_author = format_to_edit( $comment->comment_author );
+ $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
+ $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
return $comment;
}
-function get_category_to_edit($id) {
- $category = get_category($id);
+function get_category_to_edit( $id ) {
+ $category = get_category( $id );
return $category;
}
@@ -369,7 +369,7 @@ function get_category_to_edit($id) {
function wp_dropdown_roles( $default = false ) {
global $wp_roles;
$r = '';
- foreach($wp_roles->role_names as $role => $name)
+ foreach( $wp_roles->role_names as $role => $name )
if ( $default == $role ) // Make default first in list
$p = "\n\t$name ";
else
@@ -378,19 +378,19 @@ function wp_dropdown_roles( $default = false ) {
}
-function get_user_to_edit($user_id) {
- $user = new WP_User($user_id);
- $user->user_login = wp_specialchars($user->user_login, 1);
- $user->user_email = wp_specialchars($user->user_email, 1);
- $user->user_url = wp_specialchars($user->user_url, 1);
- $user->first_name = wp_specialchars($user->first_name, 1);
- $user->last_name = wp_specialchars($user->last_name, 1);
- $user->display_name = wp_specialchars($user->display_name, 1);
- $user->nickname = wp_specialchars($user->nickname, 1);
- $user->aim = wp_specialchars($user->aim, 1);
- $user->yim = wp_specialchars($user->yim, 1);
- $user->jabber = wp_specialchars($user->jabber, 1);
- $user->description = wp_specialchars($user->description);
+function get_user_to_edit( $user_id ) {
+ $user = new WP_User( $user_id );
+ $user->user_login = wp_specialchars( $user->user_login, 1 );
+ $user->user_email = wp_specialchars( $user->user_email, 1 );
+ $user->user_url = wp_specialchars( $user->user_url, 1 );
+ $user->first_name = wp_specialchars( $user->first_name, 1 );
+ $user->last_name = wp_specialchars( $user->last_name, 1 );
+ $user->display_name = wp_specialchars( $user->display_name, 1 );
+ $user->nickname = wp_specialchars( $user->nickname, 1 );
+ $user->aim = wp_specialchars( $user->aim, 1 );
+ $user->yim = wp_specialchars( $user->yim, 1 );
+ $user->jabber = wp_specialchars( $user->jabber, 1 );
+ $user->description = wp_specialchars( $user->description );
return $user;
}
@@ -400,147 +400,147 @@ function get_user_to_edit($user_id) {
function add_user() {
if ( func_num_args() ) { // The hackiest hack that ever did hack
global $current_user, $wp_roles;
- $user_id = func_get_arg(0);
+ $user_id = func_get_arg( 0 );
- if (isset ($_POST['role'])) {
- if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users')) {
- $user = new WP_User($user_id);
- $user->set_role($_POST['role']);
+ if ( isset( $_POST['role'] ) ) {
+ if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
+ $user = new WP_User( $user_id );
+ $user->set_role( $_POST['role'] );
}
}
} else {
- add_action('user_register', 'add_user'); // See above
+ add_action( 'user_register', 'add_user' ); // See above
return edit_user();
}
}
-function edit_user($user_id = 0) {
+function edit_user( $user_id = 0 ) {
global $current_user, $wp_roles, $wpdb;
- if ($user_id != 0) {
+ if ( $user_id != 0 ) {
$update = true;
$user->ID = $user_id;
- $userdata = get_userdata($user_id);
- $user->user_login = $wpdb->escape($userdata->user_login);
+ $userdata = get_userdata( $user_id );
+ $user->user_login = $wpdb->escape( $userdata->user_login );
} else {
$update = false;
$user = '';
}
- if (isset ($_POST['user_login']))
- $user->user_login = wp_specialchars(trim($_POST['user_login']));
+ if ( isset( $_POST['user_login'] ))
+ $user->user_login = wp_specialchars( trim( $_POST['user_login'] ));
$pass1 = $pass2 = '';
- if (isset ($_POST['pass1']))
+ if ( isset( $_POST['pass1'] ))
$pass1 = $_POST['pass1'];
- if (isset ($_POST['pass2']))
+ if ( isset( $_POST['pass2'] ))
$pass2 = $_POST['pass2'];
- if (isset ($_POST['role']) && current_user_can('edit_users')) {
- if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
+ if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
+ if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
$user->role = $_POST['role'];
}
- if (isset ($_POST['email']))
- $user->user_email = wp_specialchars(trim($_POST['email']));
- if (isset ($_POST['url'])) {
- $user->user_url = wp_specialchars(trim($_POST['url']));
- $user->user_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
- }
- if (isset ($_POST['first_name']))
- $user->first_name = wp_specialchars(trim($_POST['first_name']));
- if (isset ($_POST['last_name']))
- $user->last_name = wp_specialchars(trim($_POST['last_name']));
- if (isset ($_POST['nickname']))
- $user->nickname = wp_specialchars(trim($_POST['nickname']));
- if (isset ($_POST['display_name']))
- $user->display_name = wp_specialchars(trim($_POST['display_name']));
- if (isset ($_POST['description']))
- $user->description = trim($_POST['description']);
- if (isset ($_POST['jabber']))
- $user->jabber = wp_specialchars(trim($_POST['jabber']));
- if (isset ($_POST['aim']))
- $user->aim = wp_specialchars(trim($_POST['aim']));
- if (isset ($_POST['yim']))
- $user->yim = wp_specialchars(trim($_POST['yim']));
+ if ( isset( $_POST['email'] ))
+ $user->user_email = wp_specialchars( trim( $_POST['email'] ));
+ if ( isset( $_POST['url'] ) ) {
+ $user->user_url = wp_specialchars( trim( $_POST['url'] ));
+ $user->user_url = preg_match( '/^(https?|ftps?|mailto|news|gopher):/is', $user->user_url ) ? $user->user_url : 'http://'.$user->user_url;
+ }
+ if ( isset( $_POST['first_name'] ))
+ $user->first_name = wp_specialchars( trim( $_POST['first_name'] ));
+ if ( isset( $_POST['last_name'] ))
+ $user->last_name = wp_specialchars( trim( $_POST['last_name'] ));
+ if ( isset( $_POST['nickname'] ))
+ $user->nickname = wp_specialchars( trim( $_POST['nickname'] ));
+ if ( isset( $_POST['display_name'] ))
+ $user->display_name = wp_specialchars( trim( $_POST['display_name'] ));
+ if ( isset( $_POST['description'] ))
+ $user->description = trim( $_POST['description'] );
+ if ( isset( $_POST['jabber'] ))
+ $user->jabber = wp_specialchars( trim( $_POST['jabber'] ));
+ if ( isset( $_POST['aim'] ))
+ $user->aim = wp_specialchars( trim( $_POST['aim'] ));
+ if ( isset( $_POST['yim'] ))
+ $user->yim = wp_specialchars( trim( $_POST['yim'] ));
$errors = new WP_Error();
/* checking that username has been typed */
- if ($user->user_login == '')
- $errors->add('user_login', __('ERROR : Please enter a username.'));
+ if ( $user->user_login == '' )
+ $errors->add( 'user_login', __( 'ERROR : Please enter a username.' ));
/* checking the password has been typed twice */
- do_action_ref_array('check_passwords', array ($user->user_login, & $pass1, & $pass2));
+ do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 ));
- if (!$update) {
- if ($pass1 == '' || $pass2 == '')
- $errors->add('pass', __('ERROR : Please enter your password twice.'));
+ if (!$update ) {
+ if ( $pass1 == '' || $pass2 == '' )
+ $errors->add( 'pass', __( 'ERROR : Please enter your password twice.' ));
} else {
- if ((empty ($pass1) && !empty ($pass2)) || (empty ($pass2) && !empty ($pass1)))
- $errors->add('pass', __("ERROR : you typed your new password only once."));
+ if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) )
+ $errors->add( 'pass', __( "ERROR : you typed your new password only once." ));
}
/* Check for "\" in password */
if( strpos( " ".$pass1, "\\" ) )
- $errors->add('pass', __('ERROR : Passwords may not contain the character "\\".'));
+ $errors->add( 'pass', __( 'ERROR : Passwords may not contain the character "\\".' ));
/* checking the password has been typed twice the same */
- if ($pass1 != $pass2)
- $errors->add('pass', __('ERROR : Please type the same password in the two password fields.'));
+ if ( $pass1 != $pass2 )
+ $errors->add( 'pass', __( 'ERROR : Please type the same password in the two password fields.' ));
- if (!empty ($pass1))
+ if (!empty ( $pass1 ))
$user->user_pass = $pass1;
- if ( !validate_username($user->user_login) )
- $errors->add('user_login', __('ERROR : This username is invalid. Please enter a valid username.'));
+ if ( !validate_username( $user->user_login ) )
+ $errors->add( 'user_login', __( 'ERROR : This username is invalid. Please enter a valid username.' ));
- if (!$update && username_exists($user->user_login))
- $errors->add('user_login', __('ERROR : This username is already registered, please choose another one.'));
+ if (!$update && username_exists( $user->user_login ))
+ $errors->add( 'user_login', __( 'ERROR : This username is already registered, please choose another one.' ));
/* checking e-mail address */
- if (empty ($user->user_email)) {
- $errors->add('user_email', __("ERROR : please type an e-mail address"));
+ if ( empty ( $user->user_email ) ) {
+ $errors->add( 'user_email', __( "ERROR : please type an e-mail address" ));
} else
- if (!is_email($user->user_email)) {
- $errors->add('user_email', __("ERROR : the email address isn't correct"));
+ if (!is_email( $user->user_email ) ) {
+ $errors->add( 'user_email', __( "ERROR : the email address isn't correct" ));
}
if ( $errors->get_error_codes() )
return $errors;
- if ($update) {
- $user_id = wp_update_user(get_object_vars($user));
+ if ( $update ) {
+ $user_id = wp_update_user( get_object_vars( $user ));
} else {
- $user_id = wp_insert_user(get_object_vars($user));
- wp_new_user_notification($user_id);
+ $user_id = wp_insert_user( get_object_vars( $user ));
+ wp_new_user_notification( $user_id );
}
return $user_id;
}
-function get_link_to_edit($link_id) {
- $link = get_link($link_id);
+function get_link_to_edit( $link_id ) {
+ $link = get_link( $link_id );
- $link->link_url = wp_specialchars($link->link_url, 1);
- $link->link_name = wp_specialchars($link->link_name, 1);
- $link->link_image = wp_specialchars($link->link_image, 1);
- $link->link_description = wp_specialchars($link->link_description, 1);
- $link->link_notes = wp_specialchars($link->link_notes);
- $link->link_rss = wp_specialchars($link->link_rss, 1);
- $link->link_rel = wp_specialchars($link->link_rel, 1);
+ $link->link_url = wp_specialchars( $link->link_url, 1 );
+ $link->link_name = wp_specialchars( $link->link_name, 1 );
+ $link->link_image = wp_specialchars( $link->link_image, 1 );
+ $link->link_description = wp_specialchars( $link->link_description, 1 );
+ $link->link_notes = wp_specialchars( $link->link_notes );
+ $link->link_rss = wp_specialchars( $link->link_rss, 1 );
+ $link->link_rel = wp_specialchars( $link->link_rel, 1 );
$link->post_category = $link->link_category;
return $link;
}
function get_default_link_to_edit() {
- if ( isset($_GET['linkurl']) )
- $link->link_url = wp_specialchars($_GET['linkurl'], 1);
+ if ( isset( $_GET['linkurl'] ) )
+ $link->link_url = wp_specialchars( $_GET['linkurl'], 1 );
else
$link->link_url = '';
- if ( isset($_GET['name']) )
- $link->link_name = wp_specialchars($_GET['name'], 1);
+ if ( isset( $_GET['name'] ) )
+ $link->link_name = wp_specialchars( $_GET['name'], 1 );
else
$link->link_name = '';
@@ -553,76 +553,76 @@ function add_link() {
return edit_link();
}
-function edit_link($link_id = '') {
- if (!current_user_can('manage_links'))
- wp_die(__("Cheatin' uh ?"));
+function edit_link( $link_id = '' ) {
+ if (!current_user_can( 'manage_links' ))
+ wp_die( __("Cheatin' uh ?" ));
- $_POST['link_url'] = wp_specialchars($_POST['link_url']);
- $_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
- $_POST['link_name'] = wp_specialchars($_POST['link_name']);
- $_POST['link_image'] = wp_specialchars($_POST['link_image']);
- $_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
+ $_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
+ $_POST['link_url'] = preg_match( '/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url'] ) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
+ $_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
+ $_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
+ $_POST['link_rss'] = wp_specialchars( $_POST['link_rss'] );
$_POST['link_category'] = $_POST['post_category'];
- if ( !empty($link_id) ) {
+ if ( !empty( $link_id ) ) {
$_POST['link_id'] = $link_id;
- return wp_update_link($_POST);
+ return wp_update_link( $_POST);
} else {
- return wp_insert_link($_POST);
+ return wp_insert_link( $_POST);
}
}
-function url_shorten($url) {
- $short_url = str_replace('http://', '', stripslashes($url));
- $short_url = str_replace('www.', '', $short_url);
- if ('/' == substr($short_url, -1))
- $short_url = substr($short_url, 0, -1);
- if (strlen($short_url) > 35)
- $short_url = substr($short_url, 0, 32).'...';
+function url_shorten( $url ) {
+ $short_url = str_replace( 'http://', '', stripslashes( $url ));
+ $short_url = str_replace( 'www.', '', $short_url );
+ if ('/' == substr( $short_url, -1 ))
+ $short_url = substr( $short_url, 0, -1 );
+ if ( strlen( $short_url ) > 35 )
+ $short_url = substr( $short_url, 0, 32 ).'...';
return $short_url;
}
-function selected($selected, $current) {
- if ($selected == $current)
+function selected( $selected, $current) {
+ if ( $selected == $current)
echo ' selected="selected"';
}
-function checked($checked, $current) {
- if ($checked == $current)
+function checked( $checked, $current) {
+ if ( $checked == $current)
echo ' checked="checked"';
}
-function return_categories_list($parent = 0) {
+function return_categories_list( $parent = 0 ) {
global $wpdb;
- return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC");
+ return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC" );
}
-function sort_cats($cat1, $cat2) {
- return strcasecmp($cat1['cat_name'], $cat2['cat_name']);
+function sort_cats( $cat1, $cat2 ) {
+ return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
}
-function get_nested_categories($default = 0, $parent = 0) {
+function get_nested_categories( $default = 0, $parent = 0 ) {
global $post_ID, $link_id, $mode, $wpdb;
- if ($post_ID) {
- $checked_categories = $wpdb->get_col("
+ if ( $post_ID ) {
+ $checked_categories = $wpdb->get_col( "
SELECT category_id
FROM $wpdb->categories, $wpdb->post2cat
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
- ");
+ " );
- if (count($checked_categories) == 0) {
+ if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
- } else if ($link_id) {
- $checked_categories = $wpdb->get_col("
+ } else if ( $link_id ) {
+ $checked_categories = $wpdb->get_col( "
SELECT category_id
FROM $wpdb->categories, $wpdb->link2cat
WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id'
- ");
+ " );
- if (count($checked_categories) == 0) {
+ if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
@@ -630,59 +630,59 @@ function get_nested_categories($default = 0, $parent = 0) {
$checked_categories[] = $default;
}
- $cats = return_categories_list($parent);
+ $cats = return_categories_list( $parent);
$result = array ();
- if (is_array($cats)) {
- foreach ($cats as $cat) {
+ if ( is_array( $cats ) ) {
+ foreach ( $cats as $cat) {
if ( $cat == 0 ) { // HACK, added 2006-05-13
$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = 0");
continue;
}
- $result[$cat]['children'] = get_nested_categories($default, $cat);
+ $result[$cat]['children'] = get_nested_categories( $default, $cat);
$result[$cat]['cat_ID'] = $cat;
- $result[$cat]['checked'] = in_array($cat, $checked_categories);
- $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
+ $result[$cat]['checked'] = in_array( $cat, $checked_categories );
+ $result[$cat]['cat_name'] = get_the_category_by_ID( $cat);
}
}
- usort($result, 'sort_cats');
+ usort( $result, 'sort_cats' );
return $result;
}
-function write_nested_categories($categories) {
- foreach ($categories as $category) {
- echo ' ', wp_specialchars($category['cat_name']), " \n";
+function write_nested_categories( $categories ) {
+ foreach ( $categories as $category ) {
+ echo ' ', wp_specialchars( $category['cat_name'] ), " ";
if ( $category['children'] ) {
echo "\n";
- write_nested_categories($category['children']);
+ write_nested_categories( $category['children'] );
echo " \n";
}
}
}
-function dropdown_categories($default = 0) {
- write_nested_categories(get_nested_categories($default));
+function dropdown_categories( $default = 0 ) {
+ write_nested_categories( get_nested_categories( $default) );
}
-function return_link_categories_list($parent = 0) {
+function return_link_categories_list( $parent = 0 ) {
global $wpdb;
- return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC");
+ return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC" );
}
function get_nested_link_categories( $default = 0, $parent = 0 ) {
global $post_ID, $link_id, $mode, $wpdb;
- if ($link_id) {
- $checked_categories = $wpdb->get_col("
+ if ( $link_id ) {
+ $checked_categories = $wpdb->get_col( "
SELECT category_id
FROM $wpdb->categories, $wpdb->link2cat
WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id'
- ");
+ " );
- if (count($checked_categories) == 0) {
+ if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
@@ -690,43 +690,43 @@ function get_nested_link_categories( $default = 0, $parent = 0 ) {
$checked_categories[] = $default;
}
- $cats = return_link_categories_list($parent);
+ $cats = return_link_categories_list( $parent);
$result = array ();
- if (is_array($cats)) {
- foreach ($cats as $cat) {
- $result[$cat]['children'] = get_nested_link_categories($default, $cat);
+ if ( is_array( $cats ) ) {
+ foreach ( $cats as $cat) {
+ $result[$cat]['children'] = get_nested_link_categories( $default, $cat);
$result[$cat]['cat_ID'] = $cat;
- $result[$cat]['checked'] = in_array($cat, $checked_categories);
- $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
+ $result[$cat]['checked'] = in_array( $cat, $checked_categories );
+ $result[$cat]['cat_name'] = get_the_category_by_ID( $cat);
}
}
- usort($result, 'sort_cats');
+ usort( $result, 'sort_cats' );
return $result;
}
-function dropdown_link_categories($default = 0) {
- write_nested_categories(get_nested_link_categories($default));
+function dropdown_link_categories( $default = 0 ) {
+ write_nested_categories( get_nested_link_categories( $default) );
}
// Dandy new recursive multiple category stuff.
-function cat_rows($parent = 0, $level = 0, $categories = 0) {
+function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
global $wpdb, $class;
- if (!$categories)
- $categories = get_categories('hide_empty=0');
+ if (!$categories )
+ $categories = get_categories( 'hide_empty=0' );
- if ($categories) {
- foreach ($categories as $category) {
+ if ( $categories ) {
+ foreach ( $categories as $category ) {
if ( $category->cat_ID == 0 ) { // HACK, added 2006-05-13
$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = 0");
continue;
}
- if ($category->category_parent == $parent) {
+ if ( $category->category_parent == $parent) {
echo "\t" . _cat_row( $category, $level );
- cat_rows($category->cat_ID, $level +1, $categories);
+ cat_rows( $category->cat_ID, $level +1, $categories );
}
}
} else {
@@ -737,20 +737,20 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
function _cat_row( $category, $level, $name_override = false ) {
global $class;
- $pad = str_repeat('— ', $level);
- if ( current_user_can('manage_categories') ) {
- $edit = "".__('Edit')." ";
- $default_cat_id = get_option('default_category');
- $default_link_cat_id = get_option('default_link_category');
+ $pad = str_repeat( '— ', $level );
+ if ( current_user_can( 'manage_categories' ) ) {
+ $edit = "".__( 'Edit' )." ";
+ $default_cat_id = get_option( 'default_category' );
+ $default_link_cat_id = get_option( 'default_link_category' );
- if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
- $edit .= "cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')." ";
+ if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
+ $edit .= "cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf( __("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop." ), js_escape( $category->cat_name ), js_escape( get_catname( $default_cat_id )), js_escape( get_catname( $default_link_cat_id ) ) ) . "' );\" class='delete'>".__( 'Delete' )." ";
else
- $edit .= "".__("Default");
+ $edit .= " ".__( "Default" );
} else
$edit = '';
- $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+ $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
$category->category_count = number_format( $category->category_count );
$category->link_count = number_format( $category->link_count );
@@ -763,91 +763,90 @@ function _cat_row( $category, $level, $name_override = false ) {
$edit \n\t\n";
}
-function page_rows($parent = 0, $level = 0, $pages = 0, $hierarchy = true) {
+function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
global $wpdb, $class, $post;
- if (!$pages)
- $pages = get_pages('sort_column=menu_order');
+ if (!$pages )
+ $pages = get_pages( 'sort_column=menu_order' );
- if (! $pages)
+ if (! $pages )
return false;
- foreach ($pages as $post) {
- setup_postdata($post);
+ foreach ( $pages as $post) {
+ setup_postdata( $post);
if ( $hierarchy && ($post->post_parent != $parent) )
continue;
- $post->post_title = wp_specialchars($post->post_title);
- $pad = str_repeat('— ', $level);
+ $post->post_title = wp_specialchars( $post->post_title );
+ $pad = str_repeat( '— ', $level );
$id = $post->ID;
- $class = ('alternate' == $class) ? '' : 'alternate';
+ $class = ('alternate' == $class ) ? '' : 'alternate';
?>
ID; ?>
- post_status) _e(' - Private '); ?>
- post_modified); ?>
-
- " . __('Edit') . ""; } ?>
- " . __('Delete') . ""; } ?>
+ post_modified ) _e('Unpublished'); else echo mysql2date( 'Y-m-d g:i a', $post->post_modified ); ?>
+
+ " . __( 'Edit' ) . ""; } ?>
+ " . __( 'Delete' ) . ""; } ?>
user_email;
$url = $user_object->user_url;
- $short_url = str_replace('http://', '', $url);
- $short_url = str_replace('www.', '', $short_url);
- if ('/' == substr($short_url, -1))
- $short_url = substr($short_url, 0, -1);
- if (strlen($short_url) > 35)
- $short_url = substr($short_url, 0, 32).'...';
- $numposts = get_usernumposts($user_object->ID);
+ $short_url = str_replace( 'http://', '', $url );
+ $short_url = str_replace( 'www.', '', $short_url );
+ if ('/' == substr( $short_url, -1 ))
+ $short_url = substr( $short_url, 0, -1 );
+ if ( strlen( $short_url ) > 35 )
+ $short_url = substr( $short_url, 0, 32 ).'...';
+ $numposts = get_usernumposts( $user_object->ID );
$r = "
{$user_object->ID}
$user_object->user_login
$user_object->first_name $user_object->last_name
- $email
+ $email
$short_url ";
$r .= "\n\t\t";
- if ($numposts > 0) {
- $r .= "";
- $r .= sprintf(__('View %1$s %2$s'), $numposts, __ngettext('post', 'posts', $numposts));
+ if ( $numposts > 0 ) {
+ $r .= " ";
+ $r .= sprintf( __('View %1$s %2$s' ), $numposts, __ngettext( 'post', 'posts', $numposts ));
}
$r .= " \n\t\t";
- $edit_link = add_query_arg('wp_http_referer', wp_specialchars(urlencode(stripslashes($_SERVER['REQUEST_URI']))), "user-edit.php?user_id=$user_object->ID");
+ $edit_link = add_query_arg( 'wp_http_referer', wp_specialchars( urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" );
if ( ( is_site_admin() || $current_user->ID == $user_object->ID ) && current_user_can('edit_user', $user_object->ID) )
- $r .= "".__('Edit')." ";
+ $r .= "".__( 'Edit' )." ";
$r .= " \n\t ";
return $r;
}
-function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) {
+function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
global $wpdb;
- if (!$categories)
- $categories = get_categories('hide_empty=0');
-
- if ($categories) {
- foreach ($categories as $category) {
- if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
- $pad = str_repeat('– ', $level);
- $category->cat_name = wp_specialchars($category->cat_name);
+ if (!$categories )
+ $categories = get_categories( 'hide_empty=0' );
+
+ if ( $categories ) {
+ foreach ( $categories as $category ) {
+ if ( $currentcat != $category->cat_ID && $parent == $category->category_parent) {
+ $pad = str_repeat( '– ', $level );
+ $category->cat_name = wp_specialchars( $category->cat_name );
echo "\n\tcat_ID)
+ if ( $currentparent == $category->cat_ID )
echo " selected='selected'";
echo ">$pad$category->cat_name ";
- wp_dropdown_cats($currentcat, $currentparent, $category->cat_ID, $level +1, $categories);
+ wp_dropdown_cats( $currentcat, $currentparent, $category->cat_ID, $level +1, $categories );
}
}
} else {
@@ -855,45 +854,45 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev
}
}
-function wp_create_thumbnail($file, $max_side, $effect = '') {
+function wp_create_thumbnail( $file, $max_side, $effect = '' ) {
// 1 = GIF, 2 = JPEG, 3 = PNG
- if (file_exists($file)) {
- $type = getimagesize($file);
+ if ( file_exists( $file ) ) {
+ $type = getimagesize( $file );
// if the associated function doesn't exist - then it's not
// handle. duh. i hope.
- if (!function_exists('imagegif') && $type[2] == 1) {
- $error = __('Filetype not supported. Thumbnail not created.');
+ if (!function_exists( 'imagegif' ) && $type[2] == 1 ) {
+ $error = __( 'Filetype not supported. Thumbnail not created.' );
}
- elseif (!function_exists('imagejpeg') && $type[2] == 2) {
- $error = __('Filetype not supported. Thumbnail not created.');
+ elseif (!function_exists( 'imagejpeg' ) && $type[2] == 2 ) {
+ $error = __( 'Filetype not supported. Thumbnail not created.' );
}
- elseif (!function_exists('imagepng') && $type[2] == 3) {
- $error = __('Filetype not supported. Thumbnail not created.');
+ elseif (!function_exists( 'imagepng' ) && $type[2] == 3 ) {
+ $error = __( 'Filetype not supported. Thumbnail not created.' );
} else {
// create the initial copy from the original file
- if ($type[2] == 1) {
- $image = imagecreatefromgif($file);
+ if ( $type[2] == 1 ) {
+ $image = imagecreatefromgif( $file );
}
- elseif ($type[2] == 2) {
- $image = imagecreatefromjpeg($file);
+ elseif ( $type[2] == 2 ) {
+ $image = imagecreatefromjpeg( $file );
}
- elseif ($type[2] == 3) {
- $image = imagecreatefrompng($file);
+ elseif ( $type[2] == 3 ) {
+ $image = imagecreatefrompng( $file );
}
- if (function_exists('imageantialias'))
- imageantialias($image, TRUE);
+ if ( function_exists( 'imageantialias' ))
+ imageantialias( $image, TRUE );
- $image_attr = getimagesize($file);
+ $image_attr = getimagesize( $file );
// figure out the longest side
- if ($image_attr[0] > $image_attr[1]) {
+ if ( $image_attr[0] > $image_attr[1] ) {
$image_width = $image_attr[0];
$image_height = $image_attr[1];
$image_new_width = $max_side;
@@ -911,38 +910,38 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
//height > width
}
- $thumbnail = imagecreatetruecolor($image_new_width, $image_new_height);
- @ imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1]);
+ $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
+ @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );
// If no filters change the filename, we'll do a default transformation.
- if ( basename($file) == $thumb = apply_filters('thumbnail_filename', basename($file)) )
- $thumb = preg_replace('!(\.[^.]+)?$!', __('.thumbnail').'$1', basename($file), 1);
+ if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
+ $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 );
- $thumbpath = str_replace(basename($file), $thumb, $file);
+ $thumbpath = str_replace( basename( $file ), $thumb, $file );
// move the thumbnail to it's final destination
- if ($type[2] == 1) {
- if (!imagegif($thumbnail, $thumbpath)) {
- $error = __("Thumbnail path invalid");
+ if ( $type[2] == 1 ) {
+ if (!imagegif( $thumbnail, $thumbpath ) ) {
+ $error = __( "Thumbnail path invalid" );
}
}
- elseif ($type[2] == 2) {
- if (!imagejpeg($thumbnail, $thumbpath)) {
- $error = __("Thumbnail path invalid");
+ elseif ( $type[2] == 2 ) {
+ if (!imagejpeg( $thumbnail, $thumbpath ) ) {
+ $error = __( "Thumbnail path invalid" );
}
}
- elseif ($type[2] == 3) {
- if (!imagepng($thumbnail, $thumbpath)) {
- $error = __("Thumbnail path invalid");
+ elseif ( $type[2] == 3 ) {
+ if (!imagepng( $thumbnail, $thumbpath ) ) {
+ $error = __( "Thumbnail path invalid" );
}
}
}
} else {
- $error = __('File not found');
+ $error = __( 'File not found' );
}
- if (!empty ($error)) {
+ if (!empty ( $error ) ) {
return $error;
} else {
apply_filters( 'wp_create_thumbnail', $thumbpath );
@@ -951,21 +950,21 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
}
// Some postmeta stuff
-function has_meta($postid) {
+function has_meta( $postid ) {
global $wpdb;
- return $wpdb->get_results("
+ return $wpdb->get_results( "
SELECT meta_key, meta_value, meta_id, post_id
FROM $wpdb->postmeta
WHERE post_id = '$postid'
- ORDER BY meta_key,meta_id", ARRAY_A);
+ ORDER BY meta_key,meta_id", ARRAY_A );
}
-function list_meta($meta) {
+function list_meta( $meta ) {
global $post_ID;
// Exit if no meta
- if (!$meta) {
+ if (!$meta ) {
echo ' '; //TBODY needed for list-manipulation JS
return;
}
@@ -973,26 +972,26 @@ function list_meta($meta) {
?>
-
-
-
+
+
+
";
- foreach ($meta as $entry) {
+ foreach ( $meta as $entry ) {
++ $count;
- if ($count % 2)
+ if ( $count % 2 )
$style = 'alternate';
else
$style = '';
- if ('_' == $entry['meta_key'] { 0 })
+ if ('_' == $entry['meta_key'] { 0 } )
$style .= ' hidden';
- if ( is_serialized($entry['meta_value']) ) {
- if ( is_serialized_string($entry['meta_value']) ) {
+ if ( is_serialized( $entry['meta_value'] ) ) {
+ if ( is_serialized_string( $entry['meta_value'] ) ) {
// this is a serialized string, so we should display it
- $entry['meta_value'] = maybe_unserialize($entry['meta_value']);
+ $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
} else {
// this is a serialized array/object so we should NOT display it
--$count;
@@ -1000,16 +999,16 @@ function list_meta($meta) {
}
}
- $key_js = js_escape($entry['meta_key']);
+ $key_js = js_escape( $entry['meta_key'] );
$entry['meta_key'] = wp_specialchars( $entry['meta_key'], true );
$entry['meta_value'] = wp_specialchars( $entry['meta_value'], true );
$r .= "\n\t";
$r .= "\n\t\t ";
$r .= "\n\t\t ";
- $r .= "\n\t\t ";
+ $r .= "\n\t\t ";
$r .= "\n\t\t ";
+ $r .= sprintf( __("You are about to delete the "%s" custom field on this post.\\n"OK" to delete, "Cancel" to stop." ), $key_js );
+ $r .= "' );\" class='deletemeta' tabindex='6' value='".__( 'Delete' )."' />";
$r .= "\n\t ";
}
echo $r;
@@ -1020,45 +1019,45 @@ function list_meta($meta) {
function get_meta_keys() {
global $wpdb;
- $keys = $wpdb->get_col("
+ $keys = $wpdb->get_col( "
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
- ORDER BY meta_key");
+ ORDER BY meta_key" );
return $keys;
}
function meta_form() {
global $wpdb;
- $limit = (int) apply_filters('postmeta_form_limit', 30);
- $keys = $wpdb->get_col("
+ $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
+ $keys = $wpdb->get_col( "
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_id DESC
- LIMIT $limit");
- natcasesort($keys);
+ LIMIT $limit" );
+ natcasesort( $keys );
?>
-
+
-
+
escape(stripslashes(trim($_POST['metakeyselect'])));
- $metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
- $metavalue = maybe_serialize(stripslashes((trim($_POST['metavalue']))));
- $metavalue = $wpdb->escape($metavalue);
+ $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
+ $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
+ $metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
+ $metavalue = $wpdb->escape( $metavalue );
- if ( ('0' === $metavalue || !empty ($metavalue)) && ((('#NONE#' != $metakeyselect) && !empty ($metakeyselect)) || !empty ($metakeyinput)) ) {
+ if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
// We have a key/value pair. If both the select and the
// input for the key have data, the input takes precedence:
if ('#NONE#' != $metakeyselect)
$metakey = $metakeyselect;
- if ($metakeyinput)
+ if ( $metakeyinput)
$metakey = $metakeyinput; // default
- $result = $wpdb->query("
+ $result = $wpdb->query( "
INSERT INTO $wpdb->postmeta
- (post_id,meta_key,meta_value)
- VALUES ('$post_ID','$metakey','$metavalue')
- ");
+ (post_id,meta_key,meta_value )
+ VALUES ('$post_ID','$metakey','$metavalue' )
+ " );
return $wpdb->insert_id;
}
return false;
} // add_meta
-function delete_meta($mid) {
+function delete_meta( $mid ) {
global $wpdb;
$mid = (int) $mid;
- return $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+ return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
}
-function update_meta($mid, $mkey, $mvalue) {
+function update_meta( $mid, $mkey, $mvalue ) {
global $wpdb;
- $mvalue = maybe_serialize(stripslashes($mvalue));
- $mvalue = $wpdb->escape($mvalue);
+ $mvalue = maybe_serialize( stripslashes( $mvalue ));
+ $mvalue = $wpdb->escape( $mvalue );
$mid = (int) $mid;
- return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
+ return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
}
-function get_post_meta_by_id($mid) {
+function get_post_meta_by_id( $mid ) {
global $wpdb;
$mid = (int) $mid;
- $meta = $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
- if ( is_serialized_string($meta->meta_value) )
- $meta->meta_value = maybe_unserialize($meta->meta_value);
+ $meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
+ if ( is_serialized_string( $meta->meta_value ) )
+ $meta->meta_value = maybe_unserialize( $meta->meta_value );
return $meta;
}
-function touch_time($edit = 1, $for_post = 1) {
+function touch_time( $edit = 1, $for_post = 1 ) {
global $wp_locale, $post, $comment;
if ( $for_post )
- $edit = ( ('draft' == $post->post_status) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date) ) ? false : true;
+ $edit = ( ('draft' == $post->post_status ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
- echo ' '.__('Edit timestamp').' ';
+ echo ' '.__( 'Edit timestamp' ).' ';
- $time_adj = time() + (get_option('gmt_offset') * 3600);
+ $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
- $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
- $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
- $aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
- $hh = ($edit) ? mysql2date('H', $post_date) : gmdate('H', $time_adj);
- $mn = ($edit) ? mysql2date('i', $post_date) : gmdate('i', $time_adj);
- $ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj);
+ $jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
+ $mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
+ $aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
+ $hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
+ $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
+ $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
echo "\n";
- for ($i = 1; $i < 13; $i = $i +1) {
+ for ( $i = 1; $i < 13; $i = $i +1 ) {
echo "\t\t\t' . $wp_locale->get_month($i) . " \n";
+ echo '>' . $wp_locale->get_month( $i ) . "\n";
}
?>
- @
- :
-
-
+ @
+ :
+
+
get_month($mm) . "$jj, $aa @ $hh:$mn";
- echo sprintf(__(': %1$s %2$s, %3$s @ %4$s:%5$s'), $wp_locale->get_month($mm), $jj, $aa, $hh, $mn);
+ _e( 'Existing timestamp' );
+ //echo ': ' . $wp_locale->get_month( $mm ) . "$jj, $aa @ $hh:$mn";
+ echo sprintf( __(': %1$s %2$s, %3$s @ %4$s:%5$s' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
}
?>
@@ -1169,50 +1168,50 @@ function touch_time($edit = 1, $for_post = 1) {
}
// insert_with_markers: Owen Winkler, fixed by Eric Anderson
-// Inserts an array of strings into a file (.htaccess), placing it between
+// Inserts an array of strings into a file (.htaccess ), placing it between
// BEGIN and END markers. Replaces existing marked info. Retains surrounding
// data. Creates file if none exists.
// Returns true on write success, false on failure.
-function insert_with_markers($filename, $marker, $insertion) {
+function insert_with_markers( $filename, $marker, $insertion ) {
return true;
- if (!file_exists($filename) || is_writeable($filename)) {
- if (!file_exists($filename)) {
+ if (!file_exists( $filename ) || is_writeable( $filename ) ) {
+ if (!file_exists( $filename ) ) {
$markerdata = '';
} else {
- $markerdata = explode("\n", implode('', file($filename)));
+ $markerdata = explode( "\n", implode( '', file( $filename ) ) );
}
- $f = fopen($filename, 'w');
+ $f = fopen( $filename, 'w' );
$foundit = false;
- if ($markerdata) {
+ if ( $markerdata ) {
$state = true;
- foreach ($markerdata as $n => $markerline) {
- if (strstr($markerline, "# BEGIN {$marker}"))
+ foreach ( $markerdata as $n => $markerline ) {
+ if ( strstr( $markerline, "# BEGIN {$marker}" ))
$state = false;
- if ($state) {
- if ( $n + 1 < count($markerdata) )
- fwrite($f, "{$markerline}\n");
+ if ( $state ) {
+ if ( $n + 1 < count( $markerdata ) )
+ fwrite( $f, "{$markerline}\n" );
else
- fwrite($f, "{$markerline}");
+ fwrite( $f, "{$markerline}" );
}
- if (strstr($markerline, "# END {$marker}")) {
- fwrite($f, "# BEGIN {$marker}\n");
- if (is_array($insertion))
- foreach ($insertion as $insertline)
- fwrite($f, "{$insertline}\n");
- fwrite($f, "# END {$marker}\n");
+ if ( strstr( $markerline, "# END {$marker}" ) ) {
+ fwrite( $f, "# BEGIN {$marker}\n" );
+ if ( is_array( $insertion ))
+ foreach ( $insertion as $insertline )
+ fwrite( $f, "{$insertline}\n" );
+ fwrite( $f, "# END {$marker}\n" );
$state = true;
$foundit = true;
}
}
}
if (!$foundit) {
- fwrite($f, "# BEGIN {$marker}\n");
- foreach ($insertion as $insertline)
- fwrite($f, "{$insertline}\n");
- fwrite($f, "# END {$marker}\n");
+ fwrite( $f, "# BEGIN {$marker}\n" );
+ foreach ( $insertion as $insertline )
+ fwrite( $f, "{$insertline}\n" );
+ fwrite( $f, "# END {$marker}\n" );
}
- fclose($f);
+ fclose( $f );
return true;
} else {
return false;
@@ -1220,24 +1219,24 @@ function insert_with_markers($filename, $marker, $insertion) {
}
// extract_from_markers: Owen Winkler
-// Returns an array of strings from a file (.htaccess) from between BEGIN
+// Returns an array of strings from a file (.htaccess ) from between BEGIN
// and END markers.
-function extract_from_markers($filename, $marker) {
+function extract_from_markers( $filename, $marker ) {
$result = array ();
- if (!file_exists($filename)) {
+ if (!file_exists( $filename ) ) {
return $result;
}
- if ($markerdata = explode("\n", implode('', file($filename))));
+ if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
{
$state = false;
- foreach ($markerdata as $markerline) {
- if (strstr($markerline, "# END {$marker}"))
+ foreach ( $markerdata as $markerline ) {
+ if ( strstr( $markerline, "# END {$marker}" ))
$state = false;
- if ($state)
+ if ( $state )
$result[] = $markerline;
- if (strstr($markerline, "# BEGIN {$marker}"))
+ if ( strstr( $markerline, "# BEGIN {$marker}" ))
$state = true;
}
}
@@ -1252,8 +1251,8 @@ function got_mod_rewrite() {
if ( !$is_apache )
return false;
- if ( function_exists('apache_get_modules') ) {
- if ( !in_array('mod_rewrite', apache_get_modules()) )
+ if ( function_exists( 'apache_get_modules' ) ) {
+ if ( !in_array( 'mod_rewrite', apache_get_modules() ) )
return false;
}
@@ -1264,17 +1263,17 @@ function save_mod_rewrite_rules() {
global $is_apache, $wp_rewrite;
$home_path = get_home_path();
- if (!$wp_rewrite->using_mod_rewrite_permalinks())
+ if (!$wp_rewrite->using_mod_rewrite_permalinks() )
return;
- if (!((!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')))
+ if (!((!file_exists( $home_path.'.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path.'.htaccess' ) ) )
return;
- if (! got_mod_rewrite())
+ if (! got_mod_rewrite() )
return;
- $rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
- insert_with_markers($home_path.'.htaccess', 'WordPress', $rules);
+ $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
+ insert_with_markers( $home_path.'.htaccess', 'WordPress', $rules );
}
function get_broken_themes() {
@@ -1290,17 +1289,17 @@ function get_page_templates() {
$templates = $themes[$theme]['Template Files'];
$page_templates = array ();
- if (is_array($templates)) {
- foreach ($templates as $template) {
- $template_data = implode('', file(ABSPATH.$template));
- preg_match("|Template Name:(.*)|i", $template_data, $name);
- preg_match("|Description:(.*)|i", $template_data, $description);
+ if ( is_array( $templates ) ) {
+ foreach ( $templates as $template ) {
+ $template_data = implode( '', file( ABSPATH.$template ));
+ preg_match( "|Template Name:(.* )|i", $template_data, $name );
+ preg_match( "|Description:(.* )|i", $template_data, $description );
$name = $name[1];
$description = $description[1];
- if (!empty ($name)) {
- $page_templates[trim($name)] = basename($template);
+ if (!empty ( $name ) ) {
+ $page_templates[trim( $name )] = basename( $template );
}
}
}
@@ -1308,10 +1307,10 @@ function get_page_templates() {
return $page_templates;
}
-function page_template_dropdown($default = '') {
+function page_template_dropdown( $default = '' ) {
$templates = get_page_templates();
- foreach (array_keys($templates) as $template)
- : if ($default == $templates[$template])
+ foreach (array_keys( $templates ) as $template )
+ : if ( $default == $templates[$template] )
$selected = " selected='selected'";
else
$selected = '';
@@ -1319,26 +1318,26 @@ function page_template_dropdown($default = '') {
endforeach;
}
-function parent_dropdown($default = 0, $parent = 0, $level = 0) {
+function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
global $wpdb, $post_ID;
- $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order");
+ $items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
- if ($items) {
- foreach ($items as $item) {
+ if ( $items ) {
+ foreach ( $items as $item ) {
// A page cannot be it's own parent.
- if (!empty ($post_ID)) {
- if ($item->ID == $post_ID) {
+ if (!empty ( $post_ID ) ) {
+ if ( $item->ID == $post_ID ) {
continue;
}
}
- $pad = str_repeat(' ', $level * 3);
- if ($item->ID == $default)
+ $pad = str_repeat( ' ', $level * 3 );
+ if ( $item->ID == $default)
$current = ' selected="selected"';
else
$current = '';
echo "\n\t$pad $item->post_title ";
- parent_dropdown($default, $item->ID, $level +1);
+ parent_dropdown( $default, $item->ID, $level +1 );
}
} else {
return false;
@@ -1354,37 +1353,38 @@ function user_can_access_admin_page() {
global $plugin_page;
$parent = get_admin_page_parent();
- /*echo "pa: $parent pn: $pagenow pp: $plugin_page ";
- echo "";
- print_r($_wp_menu_nopriv);
- print_r($_wp_submenu_nopriv);
- echo " ";*/
- if ( isset($_wp_submenu_nopriv[$parent][$pagenow]) )
+
+ if ( isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
return false;
- if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$parent][$plugin_page]) )
+ if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false;
- if ( empty($parent) ) {
- if ( isset($_wp_menu_nopriv[$pagenow]) )
+ if ( empty( $parent) ) {
+ if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false;
- if ( isset($_wp_submenu_nopriv[$pagenow][$pagenow]) )
+ if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) )
return false;
- if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$pagenow][$plugin_page]) )
+ if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
return false;
- foreach (array_keys($_wp_submenu_nopriv) as $key) {
- if ( isset($_wp_submenu_nopriv[$key][$pagenow]) )
+ foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
+ if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false;
- if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$key][$plugin_page]) )
+ if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false;
}
return true;
}
- if (isset ($submenu[$parent])) {
- foreach ($submenu[$parent] as $submenu_array) {
- if ($submenu_array[2] == $pagenow) {
- if (current_user_can($submenu_array[1]))
+ if ( isset( $submenu[$parent] ) ) {
+ foreach ( $submenu[$parent] as $submenu_array ) {
+ if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
+ if ( current_user_can( $submenu_array[1] ))
+ return true;
+ else
+ return false;
+ } else if ( $submenu_array[2] == $pagenow ) {
+ if ( current_user_can( $submenu_array[1] ))
return true;
else
return false;
@@ -1392,15 +1392,15 @@ function user_can_access_admin_page() {
}
}
- foreach ($menu as $menu_array) {
- if ($menu_array[2] == $parent) {
- if (current_user_can($menu_array[1]))
+ foreach ( $menu as $menu_array ) {
+ if ( $menu_array[2] == $parent) {
+ if ( current_user_can( $menu_array[1] ))
return true;
else
return false;
}
}
-
+
return true;
}
@@ -1411,44 +1411,55 @@ function get_admin_page_title() {
global $pagenow;
global $plugin_page;
- if (isset ($title) && !empty ($title)) {
+ if ( isset( $title ) && !empty ( $title ) ) {
return $title;
}
- $hook = get_plugin_page_hook($plugin_page, $pagenow);
+ $hook = get_plugin_page_hook( $plugin_page, $pagenow );
$parent = $parent1 = get_admin_page_parent();
- if (empty ($parent)) {
- foreach ($menu as $menu_array) {
- if (isset ($menu_array[3])) {
- if ($menu_array[2] == $pagenow) {
+ if ( empty ( $parent) ) {
+ foreach ( $menu as $menu_array ) {
+ if ( isset( $menu_array[3] ) ) {
+ if ( $menu_array[2] == $pagenow ) {
$title = $menu_array[3];
return $menu_array[3];
} else
- if (isset ($plugin_page) && ($plugin_page == $menu_array[2]) && ($hook == $menu_array[3])) {
+ if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {
$title = $menu_array[3];
return $menu_array[3];
}
+ } else {
+ $title = $menu_array[0];
+ return $title;
}
}
} else {
- foreach (array_keys($submenu) as $parent) {
- foreach ($submenu[$parent] as $submenu_array) {
- if (isset ($submenu_array[3])) {
- if ($submenu_array[2] == $pagenow) {
+ foreach (array_keys( $submenu ) as $parent) {
+ foreach ( $submenu[$parent] as $submenu_array ) {
+ if ( isset( $plugin_page ) &&
+ ($plugin_page == $submenu_array[2] ) &&
+ (($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
+ ) {
$title = $submenu_array[3];
return $submenu_array[3];
- } else
- if (isset ($plugin_page) && ($plugin_page == $submenu_array[2]) && (($parent == $pagenow) || ($parent == $plugin_page) || ($plugin_page == $hook) || (($pagenow == 'admin.php') && ($parent1 != $submenu_array[2])))) {
- $title = $submenu_array[3];
- return $submenu_array[3];
- }
+ }
+
+ if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page
+ continue;
+
+ if ( isset( $submenu_array[3] ) ) {
+ $title = $submenu_array[3];
+ return $submenu_array[3];
+ } else {
+ $title = $submenu_array[0];
+ return $title;
}
}
}
}
- return '';
+ return $title;
}
function get_admin_page_parent() {
@@ -1461,46 +1472,46 @@ function get_admin_page_parent() {
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
- if ( !empty ($parent_file) ) {
- if ( isset($_wp_real_parent_file[$parent_file]) )
+ if ( !empty ( $parent_file ) ) {
+ if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
- if ($pagenow == 'admin.php' && isset ($plugin_page)) {
- foreach ($menu as $parent_menu) {
- if ($parent_menu[2] == $plugin_page) {
+ if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
+ foreach ( $menu as $parent_menu ) {
+ if ( $parent_menu[2] == $plugin_page ) {
$parent_file = $plugin_page;
- if ( isset($_wp_real_parent_file[$parent_file]) )
+ if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
}
- if ( isset($_wp_menu_nopriv[$plugin_page]) ) {
+ if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) {
$parent_file = $plugin_page;
- if ( isset($_wp_real_parent_file[$parent_file]) )
+ if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
}
- if ( isset($plugin_page) && isset($_wp_submenu_nopriv[$pagenow][$plugin_page]) ) {
+ if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
$parent_file = $pagenow;
- if ( isset($_wp_real_parent_file[$parent_file]) )
+ if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
- foreach (array_keys($submenu) as $parent) {
- foreach ($submenu[$parent] as $submenu_array) {
- if ( isset($_wp_real_parent_file[$parent]) )
+ foreach (array_keys( $submenu ) as $parent) {
+ foreach ( $submenu[$parent] as $submenu_array ) {
+ if ( isset( $_wp_real_parent_file[$parent] ) )
$parent = $_wp_real_parent_file[$parent];
- if ($submenu_array[2] == $pagenow) {
+ if ( $submenu_array[2] == $pagenow ) {
$parent_file = $parent;
return $parent;
} else
- if (isset ($plugin_page) && ($plugin_page == $submenu_array[2])) {
+ if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) {
$parent_file = $parent;
return $parent;
}
@@ -1511,36 +1522,36 @@ function get_admin_page_parent() {
return '';
}
-function add_menu_page($page_title, $menu_title, $access_level, $file, $function = '') {
+function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
global $menu, $admin_page_hooks;
- $file = plugin_basename($file);
+ $file = plugin_basename( $file );
- $menu[] = array ($menu_title, $access_level, $file, $page_title);
+ $menu[] = array ( $menu_title, $access_level, $file, $page_title );
- $admin_page_hooks[$file] = sanitize_title($menu_title);
+ $admin_page_hooks[$file] = sanitize_title( $menu_title );
- $hookname = get_plugin_page_hookname($file, '');
- if (!empty ($function) && !empty ($hookname))
- add_action($hookname, $function);
+ $hookname = get_plugin_page_hookname( $file, '' );
+ if (!empty ( $function ) && !empty ( $hookname ))
+ add_action( $hookname, $function );
return $hookname;
}
-function add_submenu_page($parent, $page_title, $menu_title, $access_level, $file, $function = '') {
+function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
global $submenu;
global $menu;
global $_wp_real_parent_file;
global $_wp_submenu_nopriv;
global $_wp_menu_nopriv;
- $file = plugin_basename($file);
+ $file = plugin_basename( $file );
- $parent = plugin_basename($parent);
- if ( isset($_wp_real_parent_file[$parent]) )
+ $parent = plugin_basename( $parent);
+ if ( isset( $_wp_real_parent_file[$parent] ) )
$parent = $_wp_real_parent_file[$parent];
- if ( !current_user_can($access_level) ) {
+ if ( !current_user_can( $access_level ) ) {
$_wp_submenu_nopriv[$parent][$file] = true;
return false;
}
@@ -1549,75 +1560,74 @@ function add_submenu_page($parent, $page_title, $menu_title, $access_level, $fil
// as the first item in the submenu. If the submenu file is the same as the
// parent file someone is trying to link back to the parent manually. In
// this case, don't automatically add a link back to avoid duplication.
- if (!isset ($submenu[$parent]) && $file != $parent ) {
- foreach ($menu as $parent_menu) {
- if ( $parent_menu[2] == $parent && current_user_can($parent_menu[1]) ) {
+ if (!isset( $submenu[$parent] ) && $file != $parent ) {
+ foreach ( $menu as $parent_menu ) {
+ if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
$submenu[$parent][] = $parent_menu;
- }
}
}
- $submenu[$parent][] = array ($menu_title, $access_level, $file, $page_title);
+ $submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title );
- $hookname = get_plugin_page_hookname($file, $parent);
- if (!empty ($function) && !empty ($hookname))
- add_action($hookname, $function);
+ $hookname = get_plugin_page_hookname( $file, $parent);
+ if (!empty ( $function ) && !empty ( $hookname ))
+ add_action( $hookname, $function );
return $hookname;
}
-function add_options_page($page_title, $menu_title, $access_level, $file, $function = '') {
- return add_submenu_page('options-general.php', $page_title, $menu_title, $access_level, $file, $function);
+function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+ return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function );
}
-function add_management_page($page_title, $menu_title, $access_level, $file, $function = '') {
- return add_submenu_page('edit.php', $page_title, $menu_title, $access_level, $file, $function);
+function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+ return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
}
-function add_theme_page($page_title, $menu_title, $access_level, $file, $function = '') {
- return add_submenu_page('themes.php', $page_title, $menu_title, $access_level, $file, $function);
+function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+ return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function );
}
-function validate_file($file, $allowed_files = '') {
- if (false !== strpos($file, './'))
+function validate_file( $file, $allowed_files = '' ) {
+ if ( false !== strpos( $file, './' ))
return 1;
- if (':' == substr($file, 1, 1))
+ if (':' == substr( $file, 1, 1 ))
return 2;
- if (!empty ($allowed_files) && (!in_array($file, $allowed_files)))
+ if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
return 3;
return 0;
}
-function validate_file_to_edit($file, $allowed_files = '') {
- $file = stripslashes($file);
+function validate_file_to_edit( $file, $allowed_files = '' ) {
+ $file = stripslashes( $file );
- $code = validate_file($file, $allowed_files);
+ $code = validate_file( $file, $allowed_files );
- if (!$code)
+ if (!$code )
return $file;
- switch ($code) {
+ switch ( $code ) {
case 1 :
- wp_die(__('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
+ wp_die( __('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
case 2 :
- wp_die(__('Sorry, can’t call files with their real path.'));
+ wp_die( __('Sorry, can’t call files with their real path.' ));
case 3 :
- wp_die(__('Sorry, that file cannot be edited.'));
+ wp_die( __('Sorry, that file cannot be edited.' ));
}
}
function get_home_path() {
- $home = get_option('home');
- if ($home != '' && $home != get_option('siteurl')) {
- $home_path = parse_url($home);
+ $home = get_option( 'home' );
+ if ( $home != '' && $home != get_option( 'siteurl' ) ) {
+ $home_path = parse_url( $home );
$home_path = $home_path['path'];
- $root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"]);
- $home_path = trailingslashit($root.$home_path);
+ $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
+ $home_path = trailingslashit( $root.$home_path );
} else {
$home_path = ABSPATH;
}
@@ -1625,8 +1635,8 @@ function get_home_path() {
return $home_path;
}
-function get_real_file_to_edit($file) {
- if ('index.php' == $file || '.htaccess' == $file) {
+function get_real_file_to_edit( $file ) {
+ if ('index.php' == $file || '.htaccess' == $file ) {
$real_file = get_home_path().$file;
} else {
$real_file = ABSPATH.$file;
@@ -1635,74 +1645,74 @@ function get_real_file_to_edit($file) {
return $real_file;
}
-$wp_file_descriptions = array ('index.php' => __('Main Index Template'), 'style.css' => __('Stylesheet'), 'comments.php' => __('Comments'), 'comments-popup.php' => __('Popup Comments'), 'footer.php' => __('Footer'), 'header.php' => __('Header'), 'sidebar.php' => __('Sidebar'), 'archive.php' => __('Archives'), 'category.php' => __('Category Template'), 'page.php' => __('Page Template'), 'search.php' => __('Search Results'), 'single.php' => __('Single Post'), '404.php' => __('404 Template'), 'my-hacks.php' => __('my-hacks.php (legacy hacks support)'), '.htaccess' => __('.htaccess (for rewrite rules)'),
+$wp_file_descriptions = array ('index.php' => __( 'Main Index Template' ), 'style.css' => __( 'Stylesheet' ), 'comments.php' => __( 'Comments' ), 'comments-popup.php' => __( 'Popup Comments' ), 'footer.php' => __( 'Footer' ), 'header.php' => __( 'Header' ), 'sidebar.php' => __( 'Sidebar' ), 'archive.php' => __( 'Archives' ), 'category.php' => __( 'Category Template' ), 'page.php' => __( 'Page Template' ), 'search.php' => __( 'Search Results' ), 'single.php' => __( 'Single Post' ), '404.php' => __( '404 Template' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ),
// Deprecated files
- 'wp-layout.css' => __('Stylesheet'), 'wp-comments.php' => __('Comments Template'), 'wp-comments-popup.php' => __('Popup Comments Template'));
+ 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
-function get_file_description($file) {
+function get_file_description( $file ) {
global $wp_file_descriptions;
- if (isset ($wp_file_descriptions[basename($file)])) {
- return $wp_file_descriptions[basename($file)];
+ if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
+ return $wp_file_descriptions[basename( $file )];
}
elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
- $template_data = implode('', file( ABSPATH . $file ));
- if (preg_match("|Template Name:(.*)|i", $template_data, $name))
+ $template_data = implode( '', file( ABSPATH . $file ) );
+ if ( preg_match( "|Template Name:(.* )|i", $template_data, $name ))
return $name[1];
}
- return basename($file);
+ return basename( $file );
}
-function update_recently_edited($file) {
- $oldfiles = (array) get_option('recently_edited');
- if ($oldfiles) {
- $oldfiles = array_reverse($oldfiles);
+function update_recently_edited( $file ) {
+ $oldfiles = (array ) get_option( 'recently_edited' );
+ if ( $oldfiles ) {
+ $oldfiles = array_reverse( $oldfiles );
$oldfiles[] = $file;
- $oldfiles = array_reverse($oldfiles);
- $oldfiles = array_unique($oldfiles);
- if (5 < count($oldfiles))
- array_pop($oldfiles);
+ $oldfiles = array_reverse( $oldfiles );
+ $oldfiles = array_unique( $oldfiles );
+ if ( 5 < count( $oldfiles ))
+ array_pop( $oldfiles );
} else {
$oldfiles[] = $file;
}
- update_option('recently_edited', $oldfiles);
+ update_option( 'recently_edited', $oldfiles );
}
-function get_plugin_data($plugin_file) {
- $plugin_data = implode('', file($plugin_file));
- preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name);
- preg_match("|Plugin URI:(.*)|i", $plugin_data, $plugin_uri);
- preg_match("|Description:(.*)|i", $plugin_data, $description);
- preg_match("|Author:(.*)|i", $plugin_data, $author_name);
- preg_match("|Author URI:(.*)|i", $plugin_data, $author_uri);
- if (preg_match("|Version:(.*)|i", $plugin_data, $version))
- $version = trim($version[1]);
+function get_plugin_data( $plugin_file ) {
+ $plugin_data = implode( '', file( $plugin_file ));
+ preg_match( "|Plugin Name:(.*)|i", $plugin_data, $plugin_name );
+ preg_match( "|Plugin URI:(.*)|i", $plugin_data, $plugin_uri );
+ preg_match( "|Description:(.*)|i", $plugin_data, $description );
+ preg_match( "|Author:(.*)|i", $plugin_data, $author_name );
+ preg_match( "|Author URI:(.*)|i", $plugin_data, $author_uri );
+ if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
+ $version = trim( $version[1] );
else
$version = '';
- $description = wptexturize(trim($description[1]));
+ $description = wptexturize( trim( $description[1] ));
$name = $plugin_name[1];
- $name = trim($name);
+ $name = trim( $name );
$plugin = $name;
- if ('' != $plugin_uri[1] && '' != $name) {
- $plugin = ''.$plugin.' ';
+ if ('' != $plugin_uri[1] && '' != $name ) {
+ $plugin = ''.$plugin.' ';
}
- if ('' == $author_uri[1]) {
- $author = trim($author_name[1]);
+ if ('' == $author_uri[1] ) {
+ $author = trim( $author_name[1] );
} else {
- $author = '' . trim($author_name[1]) . ' ';
+ $author = '' . trim( $author_name[1] ) . ' ';
}
- return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);
+ return array ('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1] );
}
function get_plugins() {
global $wp_plugins;
- if (isset ($wp_plugins)) {
+ if ( isset( $wp_plugins ) ) {
return $wp_plugins;
}
@@ -1710,23 +1720,23 @@ function get_plugins() {
$plugin_root = ABSPATH . PLUGINDIR;
// Files in wp-content/plugins directory
- $plugins_dir = @ dir($plugin_root);
- if ($plugins_dir) {
- while (($file = $plugins_dir->read()) !== false) {
- if (preg_match('|^\.+$|', $file))
+ $plugins_dir = @ dir( $plugin_root);
+ if ( $plugins_dir ) {
+ while (($file = $plugins_dir->read() ) !== false ) {
+ if ( preg_match( '|^\.+$|', $file ))
continue;
- if (is_dir($plugin_root.'/'.$file)) {
- $plugins_subdir = @ dir($plugin_root.'/'.$file);
- if ($plugins_subdir) {
- while (($subfile = $plugins_subdir->read()) !== false) {
- if (preg_match('|^\.+$|', $subfile))
+ if ( is_dir( $plugin_root.'/'.$file ) ) {
+ $plugins_subdir = @ dir( $plugin_root.'/'.$file );
+ if ( $plugins_subdir ) {
+ while (($subfile = $plugins_subdir->read() ) !== false ) {
+ if ( preg_match( '|^\.+$|', $subfile ))
continue;
- if (preg_match('|\.php$|', $subfile))
+ if ( preg_match( '|\.php$|', $subfile ))
$plugin_files[] = "$file/$subfile";
}
}
} else {
- if (preg_match('|\.php$|', $file))
+ if ( preg_match( '|\.php$|', $file ))
$plugin_files[] = $file;
}
}
@@ -1736,72 +1746,72 @@ function get_plugins() {
return $wp_plugins;
foreach ( $plugin_files as $plugin_file ) {
- if ( !is_readable("$plugin_root/$plugin_file") )
+ if ( !is_readable( "$plugin_root/$plugin_file" ) )
continue;
- $plugin_data = get_plugin_data("$plugin_root/$plugin_file");
+ $plugin_data = get_plugin_data( "$plugin_root/$plugin_file" );
- if ( empty ($plugin_data['Name']) )
+ if ( empty ( $plugin_data['Name'] ) )
continue;
- $wp_plugins[plugin_basename($plugin_file)] = $plugin_data;
+ $wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
}
- uasort($wp_plugins, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
+ uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
return $wp_plugins;
}
-function get_plugin_page_hookname($plugin_page, $parent_page) {
+function get_plugin_page_hookname( $plugin_page, $parent_page ) {
global $admin_page_hooks;
$parent = get_admin_page_parent();
- if (empty ($parent_page) || 'admin.php' == $parent_page) {
- if (isset ($admin_page_hooks[$plugin_page]))
+ if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
+ if ( isset( $admin_page_hooks[$plugin_page] ))
$page_type = 'toplevel';
else
- if (isset ($admin_page_hooks[$parent]))
+ if ( isset( $admin_page_hooks[$parent] ))
$page_type = $admin_page_hooks[$parent];
} else
- if (isset ($admin_page_hooks[$parent_page])) {
+ if ( isset( $admin_page_hooks[$parent_page] ) ) {
$page_type = $admin_page_hooks[$parent_page];
} else {
$page_type = 'admin';
}
- $plugin_name = preg_replace('!\.php!', '', $plugin_page);
+ $plugin_name = preg_replace( '!\.php!', '', $plugin_page );
return $page_type.'_page_'.$plugin_name;
}
-function get_plugin_page_hook($plugin_page, $parent_page) {
+function get_plugin_page_hook( $plugin_page, $parent_page ) {
global $wp_filter;
- $hook = get_plugin_page_hookname($plugin_page, $parent_page);
- if (isset ($wp_filter[$hook]))
+ $hook = get_plugin_page_hookname( $plugin_page, $parent_page );
+ if ( isset( $wp_filter[$hook] ))
return $hook;
else
return '';
}
function browse_happy() {
- $getit = __('WordPress recommends a better browser');
+ $getit = __( 'WordPress recommends a better browser' );
echo '
';
}
-if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
- add_action('admin_footer', 'browse_happy');
+if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ))
+ add_action( 'admin_footer', 'browse_happy' );
-function documentation_link($for) {
+function documentation_link( $for ) {
return;
}
-function register_importer($id, $name, $description, $callback) {
+function register_importer( $id, $name, $description, $callback ) {
global $wp_importers;
- $wp_importers[$id] = array ($name, $description, $callback);
+ $wp_importers[$id] = array ( $name, $description, $callback );
}
function get_importers() {
@@ -1830,14 +1840,14 @@ function current_theme_info() {
// array wp_handle_upload ( array &file [, array overrides] )
// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
-// overrides: an associative array of names=>values to override default variables with extract($overrides, EXTR_OVERWRITE).
+// overrides: an associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
// On success, returns an associative array of file attributes.
-// On failure, returns $overrides['upload_error_handler'](&$file, $message) or array('error'=>$message).
-function wp_handle_upload(&$file, $overrides = false) {
+// On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
+function wp_handle_upload( &$file, $overrides = false ) {
// The default error handler.
- if (! function_exists('wp_handle_upload_error') ) {
- function wp_handle_upload_error(&$file, $message) {
- return array('error'=>$message);
+ if (! function_exists( 'wp_handle_upload_error' ) ) {
+ function wp_handle_upload_error( &$file, $message ) {
+ return array( 'error'=>$message );
}
}
@@ -1848,13 +1858,13 @@ function wp_handle_upload(&$file, $overrides = false) {
$action = 'wp_handle_upload';
// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
- $upload_error_strings = array(false,
- __("The uploaded file exceeds the upload_max_filesize
directive in php.ini
."),
- __("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."),
- __("The uploaded file was only partially uploaded."),
- __("No file was uploaded."),
- __("Missing a temporary folder."),
- __("Failed to write file to disk."));
+ $upload_error_strings = array( false,
+ __( "The uploaded file exceeds the upload_max_filesize
directive in php.ini
." ),
+ __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ),
+ __( "The uploaded file was only partially uploaded." ),
+ __( "No file was uploaded." ),
+ __( "Missing a temporary folder." ),
+ __( "Failed to write file to disk." ));
// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
$test_form = true;
@@ -1864,93 +1874,93 @@ function wp_handle_upload(&$file, $overrides = false) {
$test_type = true;
// Install user overrides. Did we mention that this voids your warranty?
- if ( is_array($overrides) )
- extract($overrides, EXTR_OVERWRITE);
+ if ( is_array( $overrides ) )
+ extract( $overrides, EXTR_OVERWRITE );
// A correct form post will pass this test.
- if ( $test_form && (!isset($_POST['action']) || ($_POST['action'] != $action)) )
- return $upload_error_handler($file, __('Invalid form submission.'));
+ if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
+ return $upload_error_handler( $file, __( 'Invalid form submission.' ));
// A successful upload will pass this test. It makes no sense to override this one.
if ( $file['error'] > 0 )
- return $upload_error_handler($file, $upload_error_strings[$file['error']]);
+ return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
// A non-empty file will pass this test.
- if ( $test_size && !($file['size'] > 0) )
- return $upload_error_handler($file, __('File is empty. Please upload something more substantial.'));
+ if ( $test_size && !($file['size'] > 0 ) )
+ return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial.' ));
// A properly uploaded file will pass this test. There should be no reason to override this one.
- if (! @ is_uploaded_file($file['tmp_name']) )
- return $upload_error_handler($file, __('Specified file failed upload test.'));
+ if (! @ is_uploaded_file( $file['tmp_name'] ) )
+ return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
if ( $test_type ) {
- $wp_filetype = wp_check_filetype($file['name'], $mimes);
+ $wp_filetype = wp_check_filetype( $file['name'], $mimes );
- extract($wp_filetype);
+ extract( $wp_filetype );
if ( !$type || !$ext )
- return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.'));
+ return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
}
- // A writable uploads dir will pass this test. Override with $uploads = array('path'=>$path, 'url'=>$url);
- if ( ( empty( $uploads['path'] ) || empty( $uploads['url'] ) ) && ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
- return $upload_error_handler($file, $uploads['error']);
+ // A writable uploads dir will pass this test. Again, there's no point overriding this one.
+ if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+ return $upload_error_handler( $file, $uploads['error'] );
// Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
- if ( isset($unique_filename_callback) && function_exists($unique_filename_callback) ) {
- $filename = $unique_filename_callback($uploads['path'], $file['name']);
+ if ( isset( $unique_filename_callback ) && function_exists( $unique_filename_callback ) ) {
+ $filename = $unique_filename_callback( $uploads['path'], $file['name'] );
} else {
$number = '';
- $filename = str_replace('#', '_', $file['name']);
- $filename = str_replace(array('\\', "'"), '', $filename);
- if ( empty($ext) )
+ $filename = str_replace( '#', '_', $file['name'] );
+ $filename = str_replace( array( '\\', "'" ), '', $filename );
+ if ( empty( $ext) )
$ext = '';
else
$ext = ".$ext";
- while ( file_exists($uploads['path'] . "/$filename") ) {
+ while ( file_exists( $uploads['path'] . "/$filename" ) ) {
if ( '' == "$number$ext" )
$filename = $filename . ++$number . $ext;
else
- $filename = str_replace("$number$ext", ++$number . $ext, $filename);
+ $filename = str_replace( "$number$ext", ++$number . $ext, $filename );
}
- $filename = str_replace($ext, '', $filename);
- $filename = sanitize_title_with_dashes($filename) . $ext;
+ $filename = str_replace( $ext, '', $filename );
+ $filename = sanitize_title_with_dashes( $filename ) . $ext;
}
// Move the file to the uploads dir
$new_file = $uploads['path'] . "/$filename";
- if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) )
- wp_die(printf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
+ if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
+ wp_die( printf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));
// Set correct file permissions
- $stat = stat(dirname($new_file));
+ $stat = stat( dirname( $new_file ));
$perms = $stat['mode'] & 0000666;
- @ chmod($new_file, $perms);
+ @ chmod( $new_file, $perms );
// Compute the URL
$url = $uploads['url'] . "/$filename";
- $return = apply_filters( 'wp_handle_upload', array('file' => $new_file, 'url' => $url, 'type' => $type) );
+ $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return $return;
}
-function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) {
+function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
if ( $height <= $hmax && $width <= $wmax )
- return array($width, $height);
+ return array( $width, $height);
elseif ( $width / $height > $wmax / $hmax )
- return array($wmax, (int) ($height / $width * $wmax));
+ return array( $wmax, (int) ($height / $width * $wmax ));
else
- return array((int) ($width / $height * $hmax), $hmax);
+ return array( (int) ($width / $height * $hmax ), $hmax );
}
-function wp_import_cleanup($id) {
- wp_delete_attachment($id);
+function wp_import_cleanup( $id ) {
+ wp_delete_attachment( $id );
}
-function wp_import_upload_form($action) {
- $size = strtolower( ini_get('upload_max_filesize') );
+function wp_import_upload_form( $action ) {
+ $size = strtolower( ini_get( 'upload_max_filesize' ) );
$bytes = 0;
if ( strstr( $size, 'k' ) )
$bytes = $size * 1024;
@@ -1961,79 +1971,78 @@ function wp_import_upload_form($action) {
?>
false, 'test_type' => false);
- $file = wp_handle_upload($_FILES['import'], $overrides);
+ $overrides = array( 'test_form' => false, 'test_type' => false );
+ $file = wp_handle_upload( $_FILES['import'], $overrides );
- if ( isset($file['error']) )
+ if ( isset( $file['error'] ) )
return $file;
$url = $file['url'];
$file = addslashes( $file['file'] );
- $filename = basename($file);
+ $filename = basename( $file );
// Construct the object array
- $object = array(
- 'post_title' => $filename,
+ $object = array( 'post_title' => $filename,
'post_content' => $url,
'post_mime_type' => 'import',
'guid' => $url
);
// Save the data
- $id = wp_insert_attachment($object, $file);
+ $id = wp_insert_attachment( $object, $file );
- return array('file' => $file, 'id' => $id);
+ return array( 'file' => $file, 'id' => $id );
}
-function the_attachment_links($id = false) {
+function the_attachment_links( $id = false ) {
$id = (int) $id;
- $post = & get_post($id);
+ $post = & get_post( $id );
if ( $post->post_type != 'attachment' )
return false;
- $icon = get_attachment_icon($post->ID);
+ $icon = get_attachment_icon( $post->ID );
$attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
- $thumb = isset($attachment_data['thumb']);
+ $thumb = isset( $attachment_data['thumb'] );
?>
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 6227ef7..488a055 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -2,7 +2,7 @@
require_once('admin.php');
$title = __('Edit Comments');
-$parent_file = 'edit.php';
+$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
require_once('admin-header.php');
@@ -85,19 +85,57 @@ if (isset($_GET['s'])) {
comment_approved != 'spam'
ORDER BY comment_date DESC");
} else {
- if ( isset($_GET['offset']) )
- $offset = (int) $_GET['offset'] * 20;
+ if ( isset( $_GET['apage'] ) )
+ $page = (int) $_GET['apage'];
else
- $offset = 0;
+ $page = 1;
+ $start = $offset = ( $page - 1 ) * 20;
+ $end = $start + 20;
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $offset,20");
+ $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $end" );
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1'" );
}
+?>
+ 20 ) {
+$total_pages = ceil( $total / 20 );
+$r = '';
+if ( 1 < $page ) {
+ $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
+ $r .= '« '. __('Previous Page') .' ' . "\n";
+}
+if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
+ for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
+ if ( $page == $page_num ) :
+ $r .= "$page_num \n";
+ else :
+ $p = false;
+ if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
+ $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
+ $r .= '' . ( $page_num ) . " \n";
+ $in = true;
+ elseif ( $in == true ) :
+ $r .= "...\n";
+ $in = false;
+ endif;
+ endif;
+ endfor;
+}
+if ( ( $page ) * 20 < $total || -1 == $total ) {
+ $args['apage'] = $page + 1;
+ $r .= ''. __('Next Page') .' » ' . "\n";
+}
+echo "$r
";
+?>
+
+
+
+
+";
$i = 0;
@@ -105,7 +143,7 @@ if ('view' == $mode) {
++$i; $class = '';
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
- if ('unapproved' == $comment_status)
+ if ('unapproved' == $comment_status)
$class .= ' unapproved';
if ($i % 2)
$class .= ' alternate';
@@ -115,7 +153,7 @@ if ('view' == $mode) {
- — [
+
— [
comment_post_ID) ) {
echo " " . __('Edit') . ' ';
@@ -143,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
-
+
comment_post_ID" : $post_title;
} // end if ($comments)
}
?>
+ 20 ) {
+$total_pages = ceil( $total / 20 );
+$r = '';
+if ( 1 < $page ) {
+ $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
+ $r .= '« '. __('Previous Page') .' ' . "\n";
+}
+if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
+ for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
+ if ( $page == $page_num ) :
+ $r .= "$page_num \n";
+ else :
+ $p = false;
+ if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
+ $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
+ $r .= '' . ( $page_num ) . " \n";
+ $in = true;
+ elseif ( $in == true ) :
+ $r .= "...\n";
+ $in = false;
+ endif;
+ endif;
+ endfor;
+}
+if ( ( $page ) * 20 < $total || -1 == $total ) {
+ $args['apage'] = $page + 1;
+ $r .= ''. __('Next Page') .' » ' . "\n";
+}
+echo "$r
";
+?>
+
+
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index c761b67..2b18d8e 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -8,8 +8,7 @@ $messages[3] = __('Custom field deleted.');
-
+
@@ -126,7 +125,7 @@ if ( $authors && count( $authors ) > 1 ) :
:
-ID );
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
@@ -145,8 +144,8 @@ endforeach;
-
-
+
+
@@ -213,7 +212,7 @@ if (current_user_can('upload_files')) {
: ()
-
@@ -232,7 +231,7 @@ if ( ! empty($pings) )
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php
index 893e3f7..ac20ed7 100644
--- a/wp-admin/edit-form-comment.php
+++ b/wp-admin/edit-form-comment.php
@@ -54,8 +54,8 @@ addLoadEvent(focusit);
:
comment_approved, '1'); ?> />
- comment_approved, '0'); ?> />
- comment_approved, 'spam'); ?> />
+ comment_approved, '0'); ?> />
+ comment_approved, 'spam'); ?> />
diff --git a/wp-admin/edit-form.php b/wp-admin/edit-form.php
index 2d1cef6..d907a62 100644
--- a/wp-admin/edit-form.php
+++ b/wp-admin/edit-form.php
@@ -54,17 +54,17 @@ edCanvas = document.getElementById('content');
TrackBack a URL : (Separate multiple URL s with spaces.) '), 'http://wordpress.org/docs/reference/post/#trackback') ?>
-
-
+
+
-
+
';
- } ?>
-
+ echo ' ';
+ } ?>
+
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php
index ac9c831..4c0a714 100644
--- a/wp-admin/edit-link-form.php
+++ b/wp-admin/edit-link-form.php
@@ -30,7 +30,7 @@ function xfn_check($class, $value = '', $type = 'check') {
}
?>
-
+
@@ -53,7 +53,7 @@ function xfn_check($class, $value = '', $type = 'check') {
-
+
link_target == '_blank') ? 'checked="checked"' : ''); ?> />
@@ -68,7 +68,7 @@ function xfn_check($class, $value = '', $type = 'check') {
-
+
link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php
index ae52683..5f80f26 100644
--- a/wp-admin/edit-page-form.php
+++ b/wp-admin/edit-page-form.php
@@ -16,7 +16,7 @@ if (0 == $post_ID) {
$sendto = wp_get_referer();
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
- $sendto = 'redo';
+ $sendto = 'redo';
$sendto = wp_specialchars( $sendto );
?>
@@ -27,7 +27,7 @@ $sendto = wp_specialchars( $sendto );
wp_nonce_field($nonce_action);
if (isset($mode) && 'bookmarklet' == $mode) {
- echo ' ';
+ echo ' ';
}
?>
@@ -103,7 +103,7 @@ addLoadEvent(focusit);
:
-
+
diff --git a/wp-admin/edit.php b/wp-admin/edit.php
index e96b6d0..395bc6b 100644
--- a/wp-admin/edit.php
+++ b/wp-admin/edit.php
@@ -12,11 +12,11 @@ $drafts = get_users_drafts( $user_ID );
$other_drafts = get_others_drafts( $user_ID);
if ($drafts || $other_drafts) {
-?>
+?>
-
-
+ ID' title='" . __('Edit this draft') . "'>$draft->post_title";
++$i;
}
- ?>
- .
+ ?>
+ .
-
-
-
+
+ ID' title='" . __('Edit this draft') . "'>$draft->post_title";
++$i;
}
- ?>
- .
+ ?>
+ .
@@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
-
+
yyear == 0 )
@@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?>
'display name'
$posts_columns = array(
- 'id' => __('ID'),
- 'date' => __('When'),
- 'title' => __('Title'),
- 'categories' => __('Categories'),
- 'comments' => __('Comments'),
- 'author' => __('Author')
+ 'id' => __('ID'),
+ 'date' => __('When'),
+ 'title' => __('Title'),
+ 'categories' => __('Categories'),
+ 'comments' => __('Comments'),
+ 'author' => __('Author')
);
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
@@ -143,7 +143,7 @@ $posts_columns['control_delete'] = '';
?>
-
+
@@ -157,10 +157,10 @@ $posts_columns['control_delete'] = '';
+?>
$column_display_name) {
case 'date':
?>
- g:i:s a'); ?>
+ post_modified ) _e('Unpublished'); else the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?>
$column_display_name) {
case 'comments':
?>
-
-
-
+
+
+
$column_display_name) {
?>
@@ -259,9 +259,9 @@ if ( 1 == count($posts) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
if ($comments) {
- ?>
-
-
+
+
+
+
+
+
+
+
+get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
+foreach ( $authors as $id ) {
+ $o = get_userdata( $id );
+ echo "$o->display_name ";
+}
+?>
+
+
+
+
@@ -26,17 +45,35 @@ require_once ('admin-header.php');
get_results("SELECT * FROM $wpdb->posts ORDER BY post_date_gmt ASC");
+header('Content-type: text/wxr+xml; charset=' . get_option('blog_charset'), true);
+
+$where = '';
+if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
+ $author_id = (int) $_GET['author'];
+ $where = " WHERE post_author = '$author_id' ";
+}
+
+$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
?>
+
+
+
+
+
+
+
+
+
+
-get_results("SELECT * FROM $wpdb->posts ORDER BY post_date_gmt A
post_content ?>]]>
+ID; ?>
post_date; ?>
post_date_gmt; ?>
comment_status; ?>
@@ -71,7 +109,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts ORDER BY post_date_gmt A
post_parent; ?>
post_type; ?>
get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
+$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
if ( $postmeta ) {
?>
@@ -82,9 +120,10 @@ if ( $postmeta ) {
get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
+$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
if ( $comments ) { foreach ( $comments as $c ) { ?>
+comment_ID; ?>
comment_author; ?>
comment_author_email; ?>
comment_author_url; ?>
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php
index c7c41d3..d7df5ad 100644
--- a/wp-admin/import/blogger.php
+++ b/wp-admin/import/blogger.php
@@ -525,7 +525,7 @@ class Blogger_Import {
$did_one = true;
}
$output.= "$archivename $status
\n";
- }
+ }
if ( ! $did_one )
$this->set_next_step(7);
die( $this->refresher(1000) . $output );
diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php
index 780e45d..2cbf75f 100644
--- a/wp-admin/import/blogware.php
+++ b/wp-admin/import/blogware.php
@@ -20,7 +20,7 @@ class BW_Import {
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
-
+
function greet() {
echo '';
echo '
'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'
';
@@ -30,7 +30,7 @@ class BW_Import {
function import_posts() {
global $wpdb, $current_user;
-
+
set_magic_quotes_runtime(0);
$importdata = file($this->file); // Read the file into an array
$importdata = implode('', $importdata); // squish it
@@ -39,7 +39,7 @@ class BW_Import {
preg_match_all('|(
- ]+>(.*?)
)|is', $importdata, $posts);
$posts = $posts[1];
unset($importdata);
- echo '
';
+ echo '';
foreach ($posts as $post) {
flush();
preg_match('|- |is', $post, $post_type);
@@ -102,7 +102,7 @@ class BW_Import {
preg_match_all('|
(.*?) |is', $post, $comments);
$comments = $comments[1];
-
+
if ( $comments ) {
$comment_post_ID = $post_id;
$num_comments = 0;
@@ -157,7 +157,7 @@ class BW_Import {
$this->file = $file['file'];
$this->import_posts();
wp_import_cleanup($file['id']);
-
+
echo '';
printf(__('All done. Have fun! '), get_option('home'));
echo ' ';
@@ -170,7 +170,7 @@ class BW_Import {
$step = (int) $_GET['step'];
$this->header();
-
+
switch ($step) {
case 0 :
$this->greet();
@@ -179,12 +179,12 @@ class BW_Import {
$this->import();
break;
}
-
+
$this->footer();
}
function BW_Import() {
- // Nothing.
+ // Nothing.
}
}
diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php
index 026d871..02c030f 100644
--- a/wp-admin/import/dotclear.php
+++ b/wp-admin/import/dotclear.php
@@ -9,7 +9,7 @@
**/
if(!function_exists('get_catbynicename'))
{
- function get_catbynicename($category_nicename)
+ function get_catbynicename($category_nicename)
{
global $wpdb;
@@ -60,57 +60,58 @@ if(!function_exists('link_exists'))
//
// This cries out for a C-implementation to be included in PHP core
//
- function valid_1byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0x80) == 0x00;
- }
-
- function valid_2byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xE0) == 0xC0;
- }
-
- function valid_3byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xF0) == 0xE0;
- }
-
- function valid_4byte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xF8) == 0xF0;
- }
-
- function valid_nextbyte($char) {
- if(!is_int($char)) return false;
- return ($char & 0xC0) == 0x80;
- }
-
- function valid_utf8($string) {
- $len = strlen($string);
- $i = 0;
- while( $i < $len ) {
- $char = ord(substr($string, $i++, 1));
- if(valid_1byte($char)) { // continue
- continue;
- } else if(valid_2byte($char)) { // check 1 byte
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } else if(valid_3byte($char)) { // check 2 bytes
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } else if(valid_4byte($char)) { // check 3 bytes
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- if(!valid_nextbyte(ord(substr($string, $i++, 1))))
- return false;
- } // goto next char
- }
- return true; // done
- }
+
+function valid_1byte($char) {
+ if(!is_int($char)) return false;
+ return ($char & 0x80) == 0x00;
+}
+
+function valid_2byte($char) {
+ if(!is_int($char)) return false;
+ return ($char & 0xE0) == 0xC0;
+}
+
+function valid_3byte($char) {
+ if(!is_int($char)) return false;
+ return ($char & 0xF0) == 0xE0;
+}
+
+function valid_4byte($char) {
+ if(!is_int($char)) return false;
+ return ($char & 0xF8) == 0xF0;
+}
+
+function valid_nextbyte($char) {
+ if(!is_int($char)) return false;
+ return ($char & 0xC0) == 0x80;
+}
+
+function valid_utf8($string) {
+ $len = strlen($string);
+ $i = 0;
+ while( $i < $len ) {
+ $char = ord(substr($string, $i++, 1));
+ if(valid_1byte($char)) { // continue
+ continue;
+ } else if(valid_2byte($char)) { // check 1 byte
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ } else if(valid_3byte($char)) { // check 2 bytes
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ } else if(valid_4byte($char)) { // check 3 bytes
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ if(!valid_nextbyte(ord(substr($string, $i++, 1))))
+ return false;
+ } // goto next char
+ }
+ return true; // done
+}
function csc ($s) {
if (valid_utf8 ($s)) {
@@ -151,7 +152,7 @@ class Dotclear_Import {
echo ' ';
}
- function get_dc_cats()
+ function get_dc_cats()
{
global $wpdb;
// General Housekeeping
@@ -186,7 +187,7 @@ class Dotclear_Import {
// Get Posts
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
- ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
+ ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
}
function get_dc_comments()
@@ -211,7 +212,7 @@ class Dotclear_Import {
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
}
- function cat2wp($categories='')
+ function cat2wp($categories='')
{
// General Housekeeping
global $wpdb;
@@ -221,7 +222,7 @@ class Dotclear_Import {
if(is_array($categories))
{
echo ''.__('Importing Categories...').'
';
- foreach ($categories as $category)
+ foreach ($categories as $category)
{
$count++;
extract($category);
@@ -283,7 +284,7 @@ class Dotclear_Import {
'display_name' => $Realname)
);
}
- else
+ else
{
$ret_id = wp_insert_user(array(
'user_login' => $user_id,
@@ -384,7 +385,7 @@ class Dotclear_Import {
'comment_count' => $post_nb_comment + $post_nb_trackback)
);
}
- else
+ else
{
$ret_id = wp_insert_post(array(
'post_author' => $authorid,
@@ -460,7 +461,7 @@ class Dotclear_Import {
'comment_approved' => $comment_approved)
);
}
- else
+ else
{
// Insert comments
$ret_id = wp_insert_comment(array(
@@ -547,7 +548,7 @@ class Dotclear_Import {
return false;
}
- function import_categories()
+ function import_categories()
{
// Category Import
$cats = $this->get_dc_cats();
@@ -565,7 +566,7 @@ class Dotclear_Import {
function import_users()
{
// User Import
- $users = $this->get_dc_users();
+ $users = $this->get_dc_users();
$this->users2wp($users);
echo '';
@@ -655,7 +656,7 @@ class Dotclear_Import {
echo '
';
}
- function dispatch()
+ function dispatch()
{
if (empty ($_GET['step']))
@@ -664,7 +665,7 @@ class Dotclear_Import {
$step = (int) $_GET['step'];
$this->header();
- if ( $step > 0 )
+ if ( $step > 0 )
{
if($_POST['dbuser'])
{
@@ -689,25 +690,25 @@ class Dotclear_Import {
{
if(get_option('dchost'))
delete_option('dchost');
- add_option('dchost',$_POST['dbhost']);
+ add_option('dchost',$_POST['dbhost']);
}
if($_POST['dccharset'])
{
if(get_option('dccharset'))
delete_option('dccharset');
- add_option('dccharset',$_POST['dccharset']);
+ add_option('dccharset',$_POST['dccharset']);
}
if($_POST['dbprefix'])
{
if(get_option('dcdbprefix'))
delete_option('dcdbprefix');
- add_option('dcdbprefix',$_POST['dbprefix']);
+ add_option('dcdbprefix',$_POST['dbprefix']);
}
}
- switch ($step)
+ switch ($step)
{
default:
case 0 :
@@ -736,7 +737,7 @@ class Dotclear_Import {
$this->footer();
}
- function Dotclear_Import()
+ function Dotclear_Import()
{
// Nothing.
}
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php
index 5494197..ea05ff2 100644
--- a/wp-admin/import/greymatter.php
+++ b/wp-admin/import/greymatter.php
@@ -66,10 +66,10 @@ class GM_Import {
$string = str_replace("|*|"," \n",$string);
return($string);
}
-
+
function import() {
global $wpdb;
-
+
$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
for ($i=0; $i';
@@ -578,7 +578,7 @@ class Textpattern_Import {
echo '
';
}
- function dispatch()
+ function dispatch()
{
if (empty ($_GET['step']))
@@ -587,7 +587,7 @@ class Textpattern_Import {
$step = (int) $_GET['step'];
$this->header();
- if ( $step > 0 )
+ if ( $step > 0 )
{
if($_POST['dbuser'])
{
@@ -612,19 +612,19 @@ class Textpattern_Import {
{
if(get_option('txphost'))
delete_option('txphost');
- add_option('txphost',$_POST['dbhost']);
+ add_option('txphost',$_POST['dbhost']);
}
if($_POST['dbprefix'])
{
if(get_option('tpre'))
delete_option('tpre');
- add_option('tpre',$_POST['dbprefix']);
+ add_option('tpre',$_POST['dbprefix']);
}
}
- switch ($step)
+ switch ($step)
{
default:
case 0 :
@@ -653,7 +653,7 @@ class Textpattern_Import {
$this->footer();
}
- function Textpattern_Import()
+ function Textpattern_Import()
{
// Nothing.
}
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index b850382..ac965b8 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -256,7 +256,7 @@ class WP_Import {
function import() {
$this->id = (int) $_GET['id'];
-
+
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
$this->get_entries();
diff --git a/wp-admin/index-extra.php b/wp-admin/index-extra.php
new file mode 100644
index 0000000..782e0a7
--- /dev/null
+++ b/wp-admin/index-extra.php
@@ -0,0 +1,67 @@
+items) && 1 < count($rss->items) ) { // Technorati returns a 1-item feed when it has no results
+?>
+
+
+items = array_slice($rss->items, 0, 10);
+foreach ($rss->items as $item ) {
+?>
+
+
+
+items) && 0 != count($rss->items) ) {
+?>
+
+items = array_slice($rss->items, 0, 3);
+foreach ($rss->items as $item ) {
+?>
+
+
+
+
+items) && 0 != count($rss->items) ) {
+?>
+
+
+items = array_slice($rss->items, 0, 20);
+foreach ($rss->items as $item ) {
+$title = wp_specialchars($item['title']);
+$author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
+$post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
+?>
+'> -
+
+
+ »
+
\ No newline at end of file
diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index 86138db..b441c34 100644
--- a/wp-admin/install-helper.php
+++ b/wp-admin/install-helper.php
@@ -9,21 +9,21 @@ $debug = 0;
** false on error
*/
function maybe_create_table($table_name, $create_ddl) {
- global $wpdb;
- foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
- if ($table == $table_name) {
- return true;
- }
- }
- //didn't find it try to create it.
- $q = $wpdb->query($create_ddl);
- // we cannot directly tell that whether this succeeded!
- foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
- if ($table == $table_name) {
- return true;
- }
- }
- return false;
+ global $wpdb;
+ foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+ if ($table == $table_name) {
+ return true;
+ }
+ }
+ //didn't find it try to create it.
+ $q = $wpdb->query($create_ddl);
+ // we cannot directly tell that whether this succeeded!
+ foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+ if ($table == $table_name) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) {
** false on error
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
- global $wpdb, $debug;
- foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
- if ($debug) echo("checking $column == $column_name ");
- if ($column == $column_name) {
- return true;
- }
- }
- //didn't find it try to create it.
- $q = $wpdb->query($create_ddl);
- // we cannot directly tell that whether this succeeded!
- foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
- if ($column == $column_name) {
- return true;
- }
- }
- return false;
+ global $wpdb, $debug;
+ foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+ if ($debug) echo("checking $column == $column_name ");
+ if ($column == $column_name) {
+ return true;
+ }
+ }
+ //didn't find it try to create it.
+ $q = $wpdb->query($create_ddl);
+ // we cannot directly tell that whether this succeeded!
+ foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+ if ($column == $column_name) {
+ return true;
+ }
+ }
+ return false;
}
@@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
** false on error
*/
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
- global $wpdb;
- foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
- if ($column == $column_name) {
- //found it try to drop it.
- $q = $wpdb->query($drop_ddl);
- // we cannot directly tell that whether this succeeded!
- foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
- if ($column == $column_name) {
- return false;
- }
- }
- }
- }
- // else didn't find it
- return true;
+ global $wpdb;
+ foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+ if ($column == $column_name) {
+ //found it try to drop it.
+ $q = $wpdb->query($drop_ddl);
+ // we cannot directly tell that whether this succeeded!
+ foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+ if ($column == $column_name) {
+ return false;
+ }
+ }
+ }
+ }
+ // else didn't find it
+ return true;
}
@@ -92,45 +92,45 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
** Extra
*/
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
- global $wpdb, $debug;
- $diffs = 0;
- $results = $wpdb->get_results("DESC $table_name");
-
- foreach ($results as $row ) {
- if ($debug > 1) print_r($row);
- if ($row->Field == $col_name) {
- // got our column, check the params
- if ($debug) echo ("checking $row->Type against $col_type\n");
- if (($col_type != null) && ($row->Type != $col_type)) {
- ++$diffs;
- }
- if (($is_null != null) && ($row->Null != $is_null)) {
- ++$diffs;
- }
- if (($key != null) && ($row->Key != $key)) {
- ++$diffs;
- }
- if (($default != null) && ($row->Default != $default)) {
- ++$diffs;
- }
- if (($extra != null) && ($row->Extra != $extra)) {
- ++$diffs;
- }
- if ($diffs > 0) {
- if ($debug) echo ("diffs = $diffs returning false\n");
- return false;
- }
- return true;
- } // end if found our column
- }
- return false;
+ global $wpdb, $debug;
+ $diffs = 0;
+ $results = $wpdb->get_results("DESC $table_name");
+
+ foreach ($results as $row ) {
+ if ($debug > 1) print_r($row);
+ if ($row->Field == $col_name) {
+ // got our column, check the params
+ if ($debug) echo ("checking $row->Type against $col_type\n");
+ if (($col_type != null) && ($row->Type != $col_type)) {
+ ++$diffs;
+ }
+ if (($is_null != null) && ($row->Null != $is_null)) {
+ ++$diffs;
+ }
+ if (($key != null) && ($row->Key != $key)) {
+ ++$diffs;
+ }
+ if (($default != null) && ($row->Default != $default)) {
+ ++$diffs;
+ }
+ if (($extra != null) && ($row->Extra != $extra)) {
+ ++$diffs;
+ }
+ if ($diffs > 0) {
+ if ($debug) echo ("diffs = $diffs returning false\n");
+ return false;
+ }
+ return true;
+ } // end if found our column
+ }
+ return false;
}
-
+
/*
echo "testing
";
echo "";
-//check_column('wp_links', 'link_description', 'mediumtext');
+//check_column('wp_links', 'link_description', 'mediumtext');
//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
// echo "ok\n";
$error_count = 0;
@@ -138,15 +138,15 @@ $tablename = $wpdb->links;
// check the column
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
{
- $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
- $q = $wpdb->query($ddl);
+ $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
+ $q = $wpdb->query($ddl);
}
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
- $res .= $tablename . ' - ok ';
+ $res .= $tablename . ' - ok ';
} else {
- $res .= 'There was a problem with ' . $tablename . ' ';
- ++$error_count;
+ $res .= 'There was a problem with ' . $tablename . ' ';
+ ++$error_count;
}
echo " ";
*/
-?>
\ No newline at end of file
+?>
diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php
index 22dcc64..2f66e44 100644
--- a/wp-admin/link-add.php
+++ b/wp-admin/link-add.php
@@ -1,15 +1,15 @@
@@ -26,7 +26,7 @@ switch ($step) {
-
+
@@ -43,7 +43,7 @@ switch ($step) {
-
+
@@ -111,7 +111,7 @@ foreach ($categories as $category) {
echo sprintf('
'.__('Inserted %s ').'
', $names[$i]);
}
?>
-
manage those bookmarks.'), $link_count, $cat_id, 'link-manager.php') ?>
+
manage those links.'), $link_count, $cat_id, 'link-manager.php') ?>
';
$deleted = (int) $_GET['deleted'];
- printf(__('%s bookmarks deleted.'), $deleted);
+ printf(__('%s links deleted.'), $deleted);
echo '
';
}
?>
@@ -85,7 +84,7 @@ foreach ((array) $categories as $cat)
$select_cat .= " \n";
$select_order = "\n";
-$select_order .= '' . __('Bookmark ID') . " \n";
+$select_order .= '' . __('Link ID') . " \n";
$select_order .= '' . __('Name') . " \n";
$select_order .= '' . __('Address') . " \n";
$select_order .= " \n";
@@ -143,8 +142,8 @@ if ($links)
echo $link->link_description . "";
echo "
link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url ";
?>
-
-
+ link_category as $category) {
@@ -157,12 +156,12 @@ if ($links)
echo implode(', ', $cat_names);
?>
- link_rel; ?>
-
+ link_rel; ?>
+
'.__('Edit').' ';
- echo 'link_id , '".sprintf(__("You are about to delete the "%s" bookmark to %s.\\n"Cancel" to stop, "OK" to delete."), js_escape($link->link_name), js_escape($link->link_url)).'\' );" class="delete">'.__('Delete').' ';
+ echo 'link_id , '".sprintf(__("You are about to delete the "%s" link to %s.\\n"Cancel" to stop, "OK" to delete."), js_escape($link->link_name), js_escape($link->link_url)).'\' );" class="delete">'.__('Delete').' ';
echo ' ';
echo "\n \n";
}
@@ -172,7 +171,7 @@ if ($links)
- ')" />
+ ')" />
diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php
index 196f3cb..0e5edf0 100644
--- a/wp-admin/link-parse-opml.php
+++ b/wp-admin/link-parse-opml.php
@@ -4,12 +4,12 @@ require_once('../wp-config.php');
// columns we wish to find are: link_url, link_name, link_target, link_description
// we need to map XML attribute names to our columns
$opml_map = array('URL' => 'link_url',
- 'HTMLURL' => 'link_url',
- 'TEXT' => 'link_name',
- 'TITLE' => 'link_name',
- 'TARGET' => 'link_target',
- 'DESCRIPTION' => 'link_description',
- 'XMLURL' => 'link_rss'
+ 'HTMLURL' => 'link_url',
+ 'TEXT' => 'link_name',
+ 'TITLE' => 'link_name',
+ 'TARGET' => 'link_target',
+ 'DESCRIPTION' => 'link_description',
+ 'XMLURL' => 'link_rss'
);
$map = $opml_map;
@@ -20,24 +20,24 @@ $map = $opml_map;
**/
function startElement($parser, $tagName, $attrs) {
global $updated_timestamp, $all_links, $map;
- global $names, $urls, $targets, $descriptions, $feeds;
+ global $names, $urls, $targets, $descriptions, $feeds;
if ($tagName == 'OUTLINE') {
- foreach (array_keys($map) as $key) {
- if (isset($attrs[$key])) {
- $$map[$key] = $attrs[$key];
- }
- }
+ foreach (array_keys($map) as $key) {
+ if (isset($attrs[$key])) {
+ $$map[$key] = $attrs[$key];
+ }
+ }
- //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description] \n");
+ //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description] \n");
- // save the data away.
- $names[] = $link_name;
- $urls[] = $link_url;
- $targets[] = $link_target;
+ // save the data away.
+ $names[] = $link_name;
+ $urls[] = $link_url;
+ $targets[] = $link_target;
$feeds[] = $link_rss;
- $descriptions[] = $link_description;
- } // end if outline
+ $descriptions[] = $link_description;
+ } // end if outline
}
/**
@@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!xml_parse($xml_parser, $opml, true)) {
- echo(sprintf(__('XML error: %1$s at line %2$s'),
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
+ echo(sprintf(__('XML error: %1$s at line %2$s'),
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
}
// Free up memory used by the XML parser
diff --git a/wp-admin/link.php b/wp-admin/link.php
index 0590f16..425e912 100644
--- a/wp-admin/link.php
+++ b/wp-admin/link.php
@@ -29,12 +29,13 @@ switch ($action) {
$deleted = 0;
foreach ($linkcheck as $link_id) {
$link_id = (int) $link_id;
-
+
if ( wp_delete_link($link_id) )
$deleted++;
}
wp_redirect("$this_file?deleted=$deleted");
+ exit;
break;
case 'move' :
@@ -54,6 +55,7 @@ switch ($action) {
//$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
wp_redirect($this_file);
+ exit;
break;
case 'add' :
@@ -62,6 +64,7 @@ switch ($action) {
add_link();
wp_redirect(wp_get_referer().'?added=true');
+ exit;
break;
case 'save' :
@@ -84,6 +87,7 @@ switch ($action) {
wp_delete_link($link_id);
wp_redirect($this_file);
+ exit;
break;
case 'edit' :
@@ -92,10 +96,10 @@ switch ($action) {
wp_enqueue_script( 'ajaxcat' );
$parent_file = 'link-manager.php';
$submenu_file = 'link-manager.php';
- $title = __('Edit Bookmark');
+ $title = __('Edit Link');
include_once ('admin-header.php');
if (!current_user_can('manage_links'))
- wp_die(__('You do not have sufficient permissions to edit the bookmarks for this blog.'));
+ wp_die(__('You do not have sufficient permissions to edit the links for this blog.'));
$link_id = (int) $_GET['link_id'];
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php
index d113276..046590e 100644
--- a/wp-admin/menu-header.php
+++ b/wp-admin/menu-header.php
@@ -10,8 +10,15 @@ foreach ($menu as $item) {
// 0 = name, 1 = capability, 2 = file
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
-
- if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) {
+
+ if ( !empty($submenu[$item[2]]) ) {
+ $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
+ $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
+ if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+ echo "\n\t{$item[0]} ";
+ else
+ echo "\n\t{$item[0]} ";
+ } else if ( current_user_can($item[1]) ) {
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
echo "\n\t{$item[0]} ";
else
@@ -27,8 +34,8 @@ foreach ($menu as $item) {
if ( isset($submenu["$parent_file"]) ) :
?>
get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
+$submenu['edit-comments.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "$awaiting_mod "), 'edit_posts', 'moderation.php');
+
+
$submenu['edit.php'][5] = array(__('Posts'), 'edit_posts', 'edit.php');
$submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
$submenu['edit.php'][12] = array(__('Uploads'), 'upload_files', 'upload.php');
$submenu['edit.php'][15] = array(__('Categories'), 'manage_categories', 'categories.php');
-$submenu['edit.php'][20] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
-$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
-$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "$awaiting_mod "), 'edit_posts', 'moderation.php');
//$submenu['edit.php'][30] = array(__('Files'), 'edit_files', 'templates.php');
$submenu['edit.php'][35] = array(__('Import'), 'import', 'import.php');
$submenu['edit.php'][40] = array(__('Export'), 'import', 'export.php');
diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php
index b9e3f06..e9fc505 100644
--- a/wp-admin/moderation.php
+++ b/wp-admin/moderation.php
@@ -2,7 +2,7 @@
require_once('admin.php');
$title = __('Moderate comments');
-$parent_file = 'edit.php';
+$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));
@@ -31,7 +31,7 @@ case 'update':
foreach($comment as $key => $value) {
if ($feelinglucky && 'later' == $value)
$value = 'delete';
- switch($value) {
+ switch($value) {
case 'later':
// do nothing with that comment
// wp_set_comment_status($key, "hold");
@@ -41,10 +41,10 @@ case 'update':
wp_set_comment_status($key, 'delete');
++$item_deleted;
break;
- case 'spam':
- wp_set_comment_status($key, 'spam');
- ++$item_spam;
- break;
+ case 'spam':
+ wp_set_comment_status($key, 'spam');
+ ++$item_spam;
+ break;
case 'approve':
wp_set_comment_status($key, 'approve');
if ( get_option('comments_notify') == true ) {
@@ -52,7 +52,7 @@ case 'update':
}
++$item_approved;
break;
- }
+ }
}
$file = basename(__FILE__);
@@ -85,13 +85,13 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
echo sprintf(__("%s comments deleted"), $deleted) . " \n";
}
}
- if ($spam) {
- if ('1' == $spam) {
+ if ($spam) {
+ if ('1' == $spam) {
echo __("1 comment marked as spam") . " \n";
- } else {
- echo sprintf(__("%s comments marked as spam"), $spam) . " \n";
- }
- }
+ } else {
+ echo sprintf(__("%s comments marked as spam"), $spam) . " \n";
+ }
+ }
if ($ignored) {
if ('1' == $ignored) {
echo __("1 comment unchanged") . " \n";
@@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
-
+
-
+
\n";
- echo $javascript;
+ $wpcommentsjavascript = 1;
+ $javascript = "\n";
+ echo $javascript;
}
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 5d991e2..557c46b 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -18,11 +18,11 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
// Skip empty lines
if (empty($word)) { continue; }
- // Do some escaping magic so that '#' chars in the
+ // Do some escaping magic so that '#' chars in the
// spam words don't break things:
$word = preg_quote($word, '#');
- $pattern = "#$word#i";
+ $pattern = "#$word#i";
if ( preg_match($pattern, $author) ) return false;
if ( preg_match($pattern, $email) ) return false;
if ( preg_match($pattern, $url) ) return false;
@@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
if ($no_cache) {
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
if (false == $include_unapproved) {
- $query .= " AND comment_approved = '1'";
+ $query .= " AND comment_approved = '1'";
}
- $myrow = $wpdb->get_row($query, ARRAY_A);
+ $myrow = $wpdb->get_row($query, ARRAY_A);
} else {
$myrow['comment_ID'] = $postc->comment_ID;
$myrow['comment_post_ID'] = $postc->comment_post_ID;
@@ -157,7 +157,7 @@ function sanitize_comment_cookies() {
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
$comment_author_email = stripslashes($comment_author_email);
- $comment_author_email = wp_specialchars($comment_author_email, true);
+ $comment_author_email = wp_specialchars($comment_author_email, true);
$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
}
@@ -243,11 +243,11 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
// Skip empty lines
if ( empty($word) ) { continue; }
- // Do some escaping magic so that '#' chars in the
+ // Do some escaping magic so that '#' chars in the
// spam words don't break things:
$word = preg_quote($word, '#');
- $pattern = "#$word#i";
+ $pattern = "#$word#i";
if ( preg_match($pattern, $author ) ) return true;
if ( preg_match($pattern, $email ) ) return true;
if ( preg_match($pattern, $url ) ) return true;
@@ -328,9 +328,9 @@ function wp_insert_comment($commentdata) {
if ( ! isset($user_id) )
$user_id = 0;
- $result = $wpdb->query("INSERT INTO $wpdb->comments
+ $result = $wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
- VALUES
+ VALUES
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
");
@@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
}
function wp_set_comment_status($comment_id, $comment_status) {
- global $wpdb;
+ global $wpdb;
- switch($comment_status) {
+ switch($comment_status) {
case 'hold':
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'approve':
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
break;
- case 'spam':
- $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
- break;
+ case 'spam':
+ $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
+ break;
case 'delete':
return wp_delete_comment($comment_id);
break;
default:
return false;
- }
-
- if ($wpdb->query($query)) {
+ }
+
+ if ($wpdb->query($query)) {
do_action('wp_set_comment_status', $comment_id, $comment_status);
$comment = get_comment($comment_id);
@@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
if( is_object( $c ) )
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
return true;
- } else {
+ } else {
return false;
- }
+ }
}
function wp_update_comment($commentarr) {
@@ -582,7 +582,7 @@ function do_all_pings() {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
pingback($ping->post_content, $ping->ID);
}
-
+
// Do Enclosures
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
@@ -705,7 +705,7 @@ function pingback($content, $post_ID) {
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
if ($pingback_server_url) {
- @ set_time_limit( 60 );
+ @ set_time_limit( 60 );
// Now, the RPC call
debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
debug_fwrite($log, 'Page Linked From: ');
diff --git a/wp-includes/compat.php b/wp-includes/compat.php
index 3b64dfb..997307f 100644
--- a/wp-includes/compat.php
+++ b/wp-includes/compat.php
@@ -36,13 +36,13 @@ if (!function_exists('ob_clean')) {
/* Added in PHP 4.3.0 */
function printr($var, $do_not_echo = false) {
- // from php.net/print_r user contributed notes
+ // from php.net/print_r user contributed notes
ob_start();
print_r($var);
$code = htmlentities(ob_get_contents());
ob_clean();
if (!$do_not_echo) {
- echo "$code ";
+ echo "$code ";
}
ob_end_clean();
return $code;
@@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
}
if (!defined('CASE_LOWER')) {
- define('CASE_LOWER', 0);
+ define('CASE_LOWER', 0);
}
if (!defined('CASE_UPPER')) {
- define('CASE_UPPER', 1);
+ define('CASE_UPPER', 1);
}
@@ -73,43 +73,43 @@ if (!defined('CASE_UPPER')) {
* @link http://php.net/function.array_change_key_case
* @author Stephan Schmidt
* @author Aidan Lister
- * @version $Revision: 3901 $
+ * @version $Revision: 4495 $
* @since PHP 4.2.0
* @require PHP 4.0.0 (user_error)
*/
if (!function_exists('array_change_key_case')) {
- function array_change_key_case($input, $case = CASE_LOWER)
- {
- if (!is_array($input)) {
- user_error('array_change_key_case(): The argument should be an array',
- E_USER_WARNING);
- return false;
- }
-
- $output = array ();
- $keys = array_keys($input);
- $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
-
- foreach ($keys as $key) {
- $output[$casefunc($key)] = $input[$key];
- }
-
- return $output;
- }
+ function array_change_key_case($input, $case = CASE_LOWER)
+ {
+ if (!is_array($input)) {
+ user_error('array_change_key_case(): The argument should be an array',
+ E_USER_WARNING);
+ return false;
+ }
+
+ $output = array ();
+ $keys = array_keys($input);
+ $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
+
+ foreach ($keys as $key) {
+ $output[$casefunc($key)] = $input[$key];
+ }
+
+ return $output;
+ }
}
// From php.net
if(!function_exists('http_build_query')) {
- function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
- $res = array();
- foreach ((array)$formdata as $k=>$v) {
- $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
- if ($key) $tmp_key = $key.'['.$tmp_key.']';
- $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
- }
- $separator = ini_get('arg_separator.output');
- return implode($separator, $res);
- }
+ function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
+ $res = array();
+ foreach ((array)$formdata as $k=>$v) {
+ $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
+ if ($key) $tmp_key = $key.'['.$tmp_key.']';
+ $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
+ }
+ $separator = ini_get('arg_separator.output');
+ return implode($separator, $res);
+ }
}
if ( !function_exists('_') ) {
diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php
index b75e07a..38b07ca 100644
--- a/wp-includes/deprecated.php
+++ b/wp-includes/deprecated.php
@@ -129,8 +129,8 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
$post_author_data = get_userdata($post->post_author);
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
- || ($author_data->user_level > $post_author_data->user_level)
- || ($author_data->user_level >= 10) ) {
+ || ($author_data->user_level > $post_author_data->user_level)
+ || ($author_data->user_level >= 10) ) {
return true;
} else {
return false;
@@ -199,19 +199,19 @@ function user_can_edit_user($user_id, $other_user) {
** show_updated (default 0) - whether to show last updated timestamp
*/
function get_linksbyname($cat_name = "noname", $before = '', $after = ' ',
- $between = " ", $show_images = true, $orderby = 'id',
- $show_description = true, $show_rating = false,
- $limit = -1, $show_updated = 0) {
- global $wpdb;
- $cat_id = -1;
- $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
- if ($results) {
- foreach ($results as $result) {
- $cat_id = $result->cat_ID;
- }
- }
- get_links($cat_id, $before, $after, $between, $show_images, $orderby,
- $show_description, $show_rating, $limit, $show_updated);
+ $between = " ", $show_images = true, $orderby = 'id',
+ $show_description = true, $show_rating = false,
+ $limit = -1, $show_updated = 0) {
+ global $wpdb;
+ $cat_id = -1;
+ $results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
+ if ($results) {
+ foreach ($results as $result) {
+ $cat_id = $result->cat_ID;
+ }
+ }
+ get_links($cat_id, $before, $after, $between, $show_images, $orderby,
+ $show_description, $show_rating, $limit, $show_updated);
}
/** function wp_get_linksbyname()
@@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
**/
// Deprecate in favor of get_linkz().
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
- global $wpdb;
- $cat_id = -1;
- //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
- // TODO: Fix me.
- if ($results) {
- foreach ($results as $result) {
- $cat_id = $result->cat_id;
- }
- }
- return get_linkobjects($cat_id, $orderby, $limit);
+ global $wpdb;
+ $cat_id = -1;
+ //$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
+ // TODO: Fix me.
+ if ($results) {
+ foreach ($results as $result) {
+ $cat_id = $result->cat_id;
+ }
+ }
+ return get_linkobjects($cat_id, $orderby, $limit);
}
/** function get_linkobjects()
@@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
**/
// Deprecate in favor of get_linkz().
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
- global $wpdb;
-
- $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
- if ($category != -1) {
- $sql .= " AND link_category = $category ";
- }
- if ($orderby == '')
- $orderby = 'id';
- if (substr($orderby,0,1) == '_') {
- $direction = ' DESC';
- $orderby = substr($orderby,1);
- }
- if (strcasecmp('rand',$orderby) == 0) {
- $orderby = 'rand()';
- } else {
- $orderby = " link_" . $orderby;
- }
- $sql .= ' ORDER BY ' . $orderby;
- $sql .= $direction;
- /* The next 2 lines implement LIMIT TO processing */
- if ($limit != -1)
- $sql .= " LIMIT $limit";
-
- $results = $wpdb->get_results($sql);
- if ($results) {
- foreach ($results as $result) {
- $result->link_url = $result->link_url;
- $result->link_name = $result->link_name;
- $result->link_description = $result->link_description;
- $result->link_notes = $result->link_notes;
- $newresults[] = $result;
- }
- }
- return $newresults;
+ global $wpdb;
+
+ $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
+ if ($category != -1) {
+ $sql .= " AND link_category = $category ";
+ }
+ if ($orderby == '')
+ $orderby = 'id';
+ if (substr($orderby,0,1) == '_') {
+ $direction = ' DESC';
+ $orderby = substr($orderby,1);
+ }
+ if (strcasecmp('rand',$orderby) == 0) {
+ $orderby = 'rand()';
+ } else {
+ $orderby = " link_" . $orderby;
+ }
+ $sql .= ' ORDER BY ' . $orderby;
+ $sql .= $direction;
+ /* The next 2 lines implement LIMIT TO processing */
+ if ($limit != -1)
+ $sql .= " LIMIT $limit";
+
+ $results = $wpdb->get_results($sql);
+ if ($results) {
+ foreach ($results as $result) {
+ $result->link_url = $result->link_url;
+ $result->link_name = $result->link_name;
+ $result->link_description = $result->link_description;
+ $result->link_notes = $result->link_notes;
+ $newresults[] = $result;
+ }
+ }
+ return $newresults;
}
/** function get_linksbyname_withrating()
@@ -359,12 +359,12 @@ function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
** show_updated (default 0) - whether to show last updated timestamp
*/
function get_linksbyname_withrating($cat_name = "noname", $before = '',
- $after = ' ', $between = " ",
- $show_images = true, $orderby = 'id',
- $show_description = true, $limit = -1, $show_updated = 0) {
+ $after = ' ', $between = " ",
+ $show_images = true, $orderby = 'id',
+ $show_description = true, $limit = -1, $show_updated = 0) {
- get_linksbyname($cat_name, $before, $after, $between, $show_images,
- $orderby, $show_description, true, $limit, $show_updated);
+ get_linksbyname($cat_name, $before, $after, $between, $show_images,
+ $orderby, $show_description, true, $limit, $show_updated);
}
/** function get_links_withrating()
@@ -389,12 +389,12 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '',
** show_updated (default 0) - whether to show last updated timestamp
*/
function get_links_withrating($category = -1, $before = '', $after = ' ',
- $between = " ", $show_images = true,
- $orderby = 'id', $show_description = true,
- $limit = -1, $show_updated = 0) {
+ $between = " ", $show_images = true,
+ $orderby = 'id', $show_description = true,
+ $limit = -1, $show_updated = 0) {
- get_links($category, $before, $after, $between, $show_images, $orderby,
- $show_description, true, $limit, $show_updated);
+ get_links($category, $before, $after, $between, $show_images, $orderby,
+ $show_description, true, $limit, $show_updated);
}
/** function get_get_autotoggle()
@@ -403,7 +403,7 @@ function get_links_withrating($category = -1, $before = '', $after = ' ',
** uses 0
*/
function get_autotoggle($id = 0) {
- return 0;
+ return 0;
}
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
@@ -433,7 +433,7 @@ function wp_list_cats($args = '') {
$r['style'] = 'break';
$r['title_li'] = '';
- return wp_list_categories($r);
+ return wp_list_categories($r);
}
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index ec11d65..deebbea 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -135,9 +135,9 @@ function get_the_category_rss($type = 'rss') {
foreach ( (array) $categories as $category ) {
$category->cat_name = convert_chars($category->cat_name);
if ( 'rdf' == $type )
- $the_list .= "\n\t\t$category->cat_name \n";
+ $the_list .= "\n\t\tcat_name]]> \n";
else
- $the_list .= "\n\t\t$category->cat_name \n";
+ $the_list .= "\n\t\tcat_name]]> \n";
}
return apply_filters('the_category_rss', $the_list, $type);
}
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 7d083a8..14b100a 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -2,56 +2,47 @@
function wptexturize($text) {
global $wp_cockneyreplace;
+ $next = true;
$output = '';
- // Capture tags and everything inside them
- $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
- $stop = count($textarr); $next = true; // loop stuff
- for ($i = 0; $i < $stop; $i++) {
- $curl = $textarr[$i];
+ $curl = '';
+ $textarr = preg_split('/(<.*>)/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+ $stop = count($textarr);
+
+ // if a plugin has provided an autocorrect array, use it
+ if ( isset($wp_cockneyreplace) ) {
+ $cockney = array_keys($wp_cockneyreplace);
+ $cockney_replace = array_values($wp_cockneyreplace);
+ } else {
+ $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
+ $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
+ }
- if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
- $curl = str_replace('---', '—', $curl);
- $curl = str_replace(' -- ', ' — ', $curl);
- $curl = str_replace('--', '–', $curl);
- $curl = str_replace('xn–', 'xn--', $curl);
- $curl = str_replace('...', '…', $curl);
- $curl = str_replace('``', '“', $curl);
-
- // if a plugin has provided an autocorrect array, use it
- if ( isset($wp_cockneyreplace) ) {
- $cockney = array_keys($wp_cockneyreplace);
- $cockney_replace = array_values($wp_cockneyreplace);
- } else {
- $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");
- $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
- }
+ $static_characters = array_merge(array('---', ' -- ', '--', 'xn–', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
+ $static_replacements = array_merge(array('—', ' — ', '–', 'xn--', '…', '“', '’s', '”', ' ™'), $cockneyreplace);
- $curl = str_replace($cockney, $cockneyreplace, $curl);
+ $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
+ $dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1“$2', '”$1', '’$1', '$1×$2');
- $curl = preg_replace("/'s/", '’s', $curl);
- $curl = preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
- $curl = preg_replace('/(\s|\A|")\'/', '$1‘', $curl);
- $curl = preg_replace('/(\d+)"/', '$1″', $curl);
- $curl = preg_replace("/(\d+)'/", '$1′', $curl);
- $curl = preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
- $curl = preg_replace('/(\s|\A)"(?!\s)/', '$1“$2', $curl);
- $curl = preg_replace('/"(\s|\S|\Z)/', '”$1', $curl);
- $curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl);
- $curl = preg_replace("/ \(tm\)/i", ' ™', $curl);
- $curl = str_replace("''", '”', $curl);
+ for ( $i = 0; $i < $stop; $i++ ) {
+ $curl = $textarr[$i];
- $curl = preg_replace('/(\d+)x(\d+)/', "$1×$2", $curl);
+ if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
+ // static strings
+ $curl = str_replace($static_characters, $static_replacements, $curl);
+ // regular expressions
+ $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
} elseif (strstr($curl, '
\s* |', "\n\n", $pee);
// Space things out a little
- $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
+ $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
$pee = preg_replace('!((?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
- $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
+ $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
- $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "$1
\n", $pee); // make paragraphs, including one at the end
- $pee = preg_replace('|\s*?
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
+ $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "$1
\n", $pee); // make paragraphs, including one at the end
+ $pee = preg_replace('|\s*?
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!\s*(?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*
!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|(
|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|
]*)>|i', "", $pee);
$pee = str_replace('
', ' ', $pee);
$pee = preg_replace('!\s*(?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
- $pee = preg_replace('!(?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*
!', "$1", $pee);
+ $pee = preg_replace('!(?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*!', "$1", $pee);
if ($br) {
$pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", " ", "\\0")', $pee);
$pee = preg_replace('|(?)\s*\n|', " \n", $pee); // optionally make line breaks
@@ -86,7 +77,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('! (\s*?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
$pee = preg_replace('!()(.*?)!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '' ", $pee);
- return $pee;
+ return $pee;
}
@@ -109,7 +100,9 @@ function seems_utf8($Str) { # by bmorel at ssi dot fr
function wp_specialchars( $text, $quotes = 0 ) {
// Like htmlspecialchars except don't double-encode HTML entities
- $text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);
+ $text = str_replace('&&', '&&', $text);
+ $text = str_replace('&&', '&&', $text);
+ $text = preg_replace('/&(?:$|([^#])(?![a-z1-4]{1,8};))/', '&$1', $text);
$text = str_replace('<', '<', $text);
$text = str_replace('>', '>', $text);
if ( 'double' === $quotes ) {
@@ -124,35 +117,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
}
function utf8_uri_encode( $utf8_string ) {
- $unicode = '';
- $values = array();
- $num_octets = 1;
-
- for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
-
- $value = ord( $utf8_string[ $i ] );
-
- if ( $value < 128 ) {
- $unicode .= chr($value);
- } else {
- if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
-
- $values[] = $value;
-
- if ( count( $values ) == $num_octets ) {
+ $unicode = '';
+ $values = array();
+ $num_octets = 1;
+
+ for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
+
+ $value = ord( $utf8_string[ $i ] );
+
+ if ( $value < 128 ) {
+ $unicode .= chr($value);
+ } else {
+ if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
+
+ $values[] = $value;
+
+ if ( count( $values ) == $num_octets ) {
if ($num_octets == 3) {
- $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
+ $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
} else {
- $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
+ $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
}
$values = array();
$num_octets = 1;
- }
- }
- }
+ }
+ }
+ }
- return $unicode;
+ return $unicode;
}
function remove_accents($string) {
@@ -348,7 +341,7 @@ function sanitize_title_with_dashes($title) {
return $title;
}
-function convert_chars($content, $flag = 'obsolete') {
+function convert_chars($content, $flag = 'obsolete') {
// Translation of invalid Unicode references range to valid range
$wp_htmltranswinuni = array(
'' => '€', // the Euro sign
@@ -414,22 +407,22 @@ function funky_javascript_fix($text) {
/*
balanceTags
-
+
Balances Tags of string using a modified stack.
-
+
@param text Text to be balanced
@return Returns balanced text
@author Leonard Lin (leonard@acm.org)
@version v1.1
@date November 4, 2001
@license GPL v2.0
- @notes
- @changelog
+ @notes
+ @changelog
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
- 1.2 ***TODO*** Make better - change loop condition to $text
- 1.1 Fixed handling of append/stack pop order of end text
- Added Cleaning Hooks
- 1.0 First Version
+ 1.2 ***TODO*** Make better - change loop condition to $text
+ 1.1 Fixed handling of append/stack pop order of end text
+ Added Cleaning Hooks
+ 1.0 First Version
*/
function balanceTags($text, $is_comment = 0, $force = false) {
@@ -455,7 +448,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
if ($regex[1][0] == "/") { // End Tag
$tag = strtolower(substr($regex[1],1));
// if too many closing tags
- if($stacksize <= 0) {
+ if($stacksize <= 0) {
$tag = '';
//or close to be safe $tag = '/' . $tag;
}
@@ -512,7 +505,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
}
$newtext .= substr($text,0,$i) . $tag;
$text = substr($text,$i+$l);
- }
+ }
// Clear Tag Queue
$newtext .= $tagqueue;
@@ -561,10 +554,10 @@ function backslashit($string) {
}
function trailingslashit($string) {
- if ( '/' != substr($string, -1)) {
- $string .= '/';
- }
- return $string;
+ if ( '/' != substr($string, -1)) {
+ $string .= '/';
+ }
+ return $string;
}
function addslashes_gpc($gpc) {
@@ -580,11 +573,11 @@ function addslashes_gpc($gpc) {
function stripslashes_deep($value)
{
- $value = is_array($value) ?
- array_map('stripslashes_deep', $value) :
- stripslashes($value);
+ $value = is_array($value) ?
+ array_map('stripslashes_deep', $value) :
+ stripslashes($value);
- return $value;
+ return $value;
}
function antispambot($emailaddy, $mailto=0) {
@@ -740,7 +733,7 @@ function sanitize_email($email) {
return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
}
-function human_time_diff( $from, $to = '' ) {
+function human_time_diff( $from, $to = '' ) {
if ( empty($to) )
$to = time();
$diff = (int) abs($to - $from);
@@ -754,7 +747,7 @@ function human_time_diff( $from, $to = '' ) {
$hours = round($diff / 3600);
if ($hours <= 1)
$since = __('1 hour');
- else
+ else
$since = sprintf( __('%s hours'), $hours );
} elseif ($diff >= 86400) {
$days = round($diff / 86400);
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index e87724a..f6ba499 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -12,7 +12,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
if( 'U' == $dateformatstring )
return $i;
-
+
if ( -1 == $i || false == $i )
$i = 0;
@@ -479,7 +479,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
@set_time_limit( 60 );
if ( $red > 5 )
- return false;
+ return false;
$parts = parse_url( $url );
$file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
@@ -508,9 +508,9 @@ function wp_get_http_headers( $url, $red = 1 ) {
preg_match('/.*([0-9]{3}).*/', $response, $return);
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
- $code = $headers['response'];
- if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
- return wp_get_http_headers( $headers['location'], ++$red );
+ $code = $headers['response'];
+ if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
+ return wp_get_http_headers( $headers['location'], ++$red );
return $headers;
}
@@ -573,9 +573,22 @@ function update_post_category_cache($post_ids) {
return;
if ( is_array($post_ids) )
- $post_ids = implode(',', $post_ids);
+ $post_id_list = implode(',', $post_ids);
+
+ $post_id_array = (array) explode(',', $post_ids);
+ $count = count( $post_id_array);
+ for ( $i = 0; $i < $count; $i++ ) {
+ $post_id = $post_id_array[ $i ];
+ if ( isset( $category_cache[$blog_id][$post_id] ) ) {
+ unset( $post_id_array[ $i ] );
+ continue;
+ }
+ }
+ if ( count( $post_id_array ) == 0 )
+ return;
+ $post_id_list = join( ',', $post_id_array ); // with already cached stuff removed
- $dogs = $wpdb->get_results("SELECT post_id, category_id FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
+ $dogs = $wpdb->get_results("SELECT post_id, category_id FROM $wpdb->post2cat WHERE post_id IN ($post_id_list)");
if ( empty($dogs) )
return;
@@ -611,11 +624,24 @@ function update_postmeta_cache($post_id_list = '') {
// We should validate this comma-separated list for the upcoming SQL query
$post_id_list = preg_replace('|[^0-9,]|', '', $post_id_list);
+ if ( empty( $post_id_list ) )
+ return false;
+
// we're marking each post as having its meta cached (with no keys... empty array), to prevent posts with no meta keys from being queried again
// any posts that DO have keys will have this empty array overwritten with a proper array, down below
- $post_id_array = explode(',', $post_id_list);
- foreach ( (array) $post_id_array as $pid )
- $post_meta_cache[$blogi_id][$pid] = array();
+ $post_id_array = (array) explode(',', $post_id_list);
+ $count = count( $post_id_array);
+ for ( $i = 0; $i < $count; $i++ ) {
+ $post_id = $post_id_array[ $i ];
+ if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached
+ unset( $post_id_array[ $i ] );
+ continue;
+ }
+ $post_meta_cache[$blog_id][$post_id] = array();
+ }
+ if ( count( $post_id_array ) == 0 )
+ return;
+ $post_id_list = join( ',', $post_id_array ); // with already cached stuff removeds
// Get post-meta info
if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN($post_id_list) ORDER BY post_id, meta_key", ARRAY_A) ) {
@@ -755,7 +781,7 @@ function add_magic_quotes($array) {
function wp_remote_fopen( $uri ) {
if ( ini_get('allow_url_fopen') ) {
- $fp = fopen( $uri, 'r' );
+ $fp = @fopen( $uri, 'r' );
if ( !$fp )
return false;
$linea = '';
@@ -797,9 +823,9 @@ function status_header( $header ) {
$text = 'Gone';
if ( substr(php_sapi_name(), 0, 3) == 'cgi' )
- @header("Status: $header $text");
- else
@header("HTTP/1.1 $header $text");
+ else
+ @header("Status: $header $text");
}
function nocache_headers() {
@@ -822,8 +848,8 @@ function get_num_queries() {
}
function bool_from_yn($yn) {
- if ($yn == 'Y') return 1;
- return 0;
+ if ($yn == 'Y') return 1;
+ return 0;
}
function do_feed() {
@@ -836,7 +862,7 @@ function do_feed() {
$feed = 'rss2';
$for_comments = false;
- if ( is_singular() || get_query_var('withcomments') == 1 || $feed == 'comments-rss2' ) {
+ if ( 1 != get_query_var('withoutcomments') && ( is_singular() || get_query_var('withcomments') == 1 || $feed == 'comments-rss2' ) ) {
$feed = 'rss2';
$for_comments = true;
}
@@ -980,7 +1006,7 @@ function wp_upload_dir() {
return array('error' => $message);
}
- $uploads = array('path' => $dir, 'url' => $url, 'error' => false);
+ $uploads = array('path' => $dir, 'url' => $url, 'error' => false);
return apply_filters('upload_dir', $uploads);
}
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 4849360..017cedb 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -426,6 +426,15 @@ function calendar_week_mod($num) {
function get_calendar($initial = true) {
global $wpdb, $m, $monthnum, $year, $timedifference, $wp_locale, $posts;
+ $key = md5( $m . $monthnum . $year );
+ if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
+ if ( isset( $cache[ $key ] ) ) {
+ echo $cache[ $key ];
+ return;
+ }
+ }
+
+ ob_start();
// Quick check. If we have no posts at all, abort!
if ( !$posts ) {
$gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
@@ -475,7 +484,7 @@ function get_calendar($initial = true) {
FROM $wpdb->posts
WHERE post_date > '$thisyear-$thismonth-01'
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
- AND post_type = 'post' AND post_status = 'publish'
+ AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date ASC
LIMIT 1");
@@ -599,7 +608,22 @@ function get_calendar($initial = true) {
echo "\n\t\t".' ';
echo "\n\t\n\t\n\t";
+
+ $output = ob_get_contents();
+ ob_end_clean();
+ echo $output;
+ $cache[ $key ] = $output;
+ wp_cache_set( 'get_calendar', $cache, 'calendar' );
+}
+
+function delete_get_calendar_cache() {
+ wp_cache_delete( 'get_calendar', 'calendar' );
}
+add_action( 'save_post', 'delete_get_calendar_cache' );
+add_action( 'delete_post', 'delete_get_calendar_cache' );
+add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
+add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
+add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
function allowed_tags() {
@@ -763,30 +787,12 @@ function rich_edit_exists() {
}
function user_can_richedit() {
- $can = true;
+ global $wp_rich_edit;
+
+ if ( !isset($wp_rich_edit) )
+ $wp_rich_edit = ( 'true' == get_user_option('rich_editing') && !preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) && rich_edit_exists() ) ? true : false;
- if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
- $can = false;
-
- return apply_filters('user_can_richedit', $can);
-}
-
-function user_can_switchedit() {
- $can = true;
-
- $ua = $_SERVER['HTTP_USER_AGENT'];
-
- if (
- !user_can_richedit() ||
- ( // Mozilla Test
- strstr($ua, 'Mozilla/5.0') &&
- !strstr($ua, 'ompatible') &&
- !strstr($ua, 'irefox')
- )
- )
- $can = false;
-
- return apply_filters('user_can_switchedit', $can);
+ return apply_filters('user_can_richedit', $wp_rich_edit);
}
function the_editor($content, $id = 'content', $prev_id = 'title') {
@@ -799,19 +805,24 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
if ( user_can_richedit() ) :
add_filter('the_editor_content', 'wp_richedit_pre');
- if ( user_can_switchedit() ) :
+ // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
?>
+
-
+
@@ -846,9 +857,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
%s
\n");
+ $the_editor = apply_filters('the_editor', "%s
\n");
$the_editor_content = apply_filters('the_editor_content', $content);
printf($the_editor, $the_editor_content);
diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php
index c360318..2e76230 100644
--- a/wp-includes/js/autosave.js.php
+++ b/wp-includes/js/autosave.js.php
@@ -3,10 +3,20 @@ cache_javascript_headers();
?>
var autosaveLast = '';
var autosavePeriodical;
+
function autosave_start_timer() {
var form = $('post');
autosaveLast = form.post_title.value+form.content.value;
- autosavePeriodical = new PeriodicalExecuter(autosave, );
+ autosavePeriodical = new PeriodicalExecuter(autosave, );
+ //Disable autosave after the form has been submitted
+ if(form.addEventListener) {
+ form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);
+ }
+ if(form.attachEvent) {
+ $('save').attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; });
+ $('publish').attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; });
+ $('deletepost').attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; });
+ }
}
addLoadEvent(autosave_start_timer)
diff --git a/wp-includes/js/list-manipulation-js.php b/wp-includes/js/list-manipulation-js.php
index 6c89d5f..112d19f 100644
--- a/wp-includes/js/list-manipulation-js.php
+++ b/wp-includes/js/list-manipulation-js.php
@@ -1,8 +1,4 @@
-
+
addLoadEvent(function(){theList=new listMan();});
function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="";if(confirm(message))return obj.ajaxDelete(what,id);else return false;}
function dimSomething(what,id,dimClass,obj){if(!obj)obj=theList;return obj.ajaxDimmer(what,id,dimClass);}
@@ -10,7 +6,7 @@ function dimSomething(what,id,dimClass,obj){if(!obj)obj=theList;return obj.ajaxD
var listMan = Class.create();
Object.extend(listMan.prototype, {
ajaxRespEl: 'ajax-response',
- ajaxHandler: '',
+ ajaxHandler: false,
inputData: '',
clearInputs: [],
showLink: true,
@@ -51,16 +47,18 @@ Object.extend(listMan.prototype, {
if ( tempObj.showLink )
tempObj.showLink = id;
});
+ ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "" ) : '');
}
- ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "" ) : '');
if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
tempObj.addComplete( what, where, update, transport );
tempObj.recolorList();
ajaxAdd.restoreInputs = null;
});
- ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
+ if ( !update )
+ ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
ajaxAdd.request(ajaxAdd.url);
- this.clear();
+ if ( !update )
+ this.clear();
return false;
},
@@ -262,7 +260,5 @@ function killSubmit ( code, e ) {
}
}
}
-//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax
-function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; }
//Generic but lame JS closure
function encloseFunc(f){var a=arguments[1];return function(){return f(a);}}
diff --git a/wp-includes/js/tinymce/license.txt b/wp-includes/js/tinymce/license.txt
index 3b0396a..60d6d4c 100644
--- a/wp-includes/js/tinymce/license.txt
+++ b/wp-includes/js/tinymce/license.txt
@@ -1,13 +1,14 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
Preamble
@@ -16,97 +17,109 @@ freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-.
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-.
- GNU LIBRARY GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -145,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
-.
+
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@@ -203,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
-.
+
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@@ -254,8 +267,8 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
-.
- 6. As an exception to the Sections above, you may also compile or
+
+ 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
- b) Accompany the work with a written offer, valid for at
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
- c) If distribution of the work is made by offering access to copy
+ d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
- d) Verify that the user has already received a copy of these
+ e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -308,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
-.
+
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@@ -347,9 +368,9 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
this License.
-.
+
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
+versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -401,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
-.
+
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@@ -435,3 +456,49 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
index 4b88d2e..68563f9 100644
--- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
@@ -1,20 +1,18 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.11 $
- * $Date: 2006/03/22 12:21:21 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('autosave', 'en,tr,sv,cs,he,nb,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl,pt_br');
+tinyMCE.importPluginLanguagePack('autosave');
var TinyMCE_AutoSavePlugin = {
getInfo : function() {
return {
longname : 'Auto save',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
index ad0fa87..c8a6295 100644
--- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
@@ -1,20 +1,18 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.16 $
- * $Date: 2006/02/10 21:34:28 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('directionality', 'en,tr,sv,fr_ca,zh_cn,cs,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,pl,nl,fr,pt_br');
+tinyMCE.importPluginLanguagePack('directionality');
var TinyMCE_DirectionalityPlugin = {
getInfo : function() {
return {
longname : 'Directionality',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
index 74d1805..c005a9e 100644
--- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.8 $
- * $Date: 2006/02/06 20:02:38 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* Moxiecode DHTML Windows script.
*
@@ -15,7 +13,7 @@ var TinyMCE_InlinePopupsPlugin = {
getInfo : function() {
return {
longname : 'Inline Popups',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
@@ -436,7 +434,7 @@ TinyMCE_Windows.prototype.onLoad = function(name) {
TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
- var div = document.createElement("div");
+ var div = document.createElement("div"), doc;
width = parseInt(width);
height = parseInt(height)+1;
@@ -488,7 +486,7 @@ TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top,
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
- doc = window.frames[id_prefix + '_iframe'].document;
+ var doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
index a88ffd7..325d293 100644
--- a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: mcwindows.js,v $
- * $Revision: 1.2 $
- * $Date: 2005/10/18 13:59:43 $
+ * $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
*
* Moxiecode DHTML Windows script.
*
diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
index d9bd215..de5edbe 100644
--- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
@@ -1 +1,386 @@
-tinyMCE.importPluginLanguagePack('paste','en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');var TinyMCE_PastePlugin={getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(tinyMCE.isMSIE&&tinyMCE.getParam("paste_auto_cleanup_on_paste",false))tinyMCE.addEvent(inst.getBody(),"paste",TinyMCE_PastePlugin._handlePasteEvent);},getControlHTML:function(cn){switch(cn){case"pastetext":return tinyMCE.getButtonHTML(cn,'lang_paste_text_desc','{$pluginurl}/images/pastetext.gif','mcePasteText',true);case"pasteword":return tinyMCE.getButtonHTML(cn,'lang_paste_word_desc','{$pluginurl}/images/pasteword.gif','mcePasteWord',true);case"selectall":return tinyMCE.getButtonHTML(cn,'lang_selectall_desc','{$pluginurl}/images/selectall.gif','mceSelectAll',true);}return'';},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mcePasteText":if(user_interface){if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&!tinyMCE.getParam('paste_use_dialog',false))TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"),true);else{var template=new Array();template['file']='../../plugins/paste/pastetext.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",inline:"yes",mceDo:'insert'});}}else TinyMCE_PastePlugin._insertText(value['html'],value['linebreaks']);return true;case"mcePasteWord":if(user_interface){if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&!tinyMCE.getParam('paste_use_dialog',false)){var html=TinyMCE_PastePlugin._clipboardHTML();if(html&&html.length>0)TinyMCE_PastePlugin._insertWordContent(html);}else{var template=new Array();template['file']='../../plugins/paste/pasteword.htm';template['width']=450;template['height']=400;var plain_text="";tinyMCE.openWindow(template,{editor_id:editor_id,plain_text:plain_text,resizable:"yes",scrollbars:"no",inline:"yes",mceDo:'insert'});}}else TinyMCE_PastePlugin._insertWordContent(value);return true;case"mceSelectAll":tinyMCE.execInstanceCommand(editor_id,'selectall');return true;}return false;},_handlePasteEvent:function(e){switch(e.type){case"paste":var html=TinyMCE_PastePlugin._clipboardHTML();var r,inst=tinyMCE.selectedInstance;if(inst&&(r=inst.getRng())&&r.text.length>0)tinyMCE.execCommand('delete');if(html&&html.length>0)tinyMCE.execCommand('mcePasteWord',false,html);tinyMCE.cancelEvent(e);return false;}return true;},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(tinyMCE.getParam("paste_create_paragraphs",true)){var rl=tinyMCE.getParam("paste_replace_list",'\u2122,TM ,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i","gi");content=tinyMCE.regexpReplace(content,"\r\r","
","gi");content=tinyMCE.regexpReplace(content,"\n\n","
","gi");if((pos=content.indexOf('
'))!=-1){tinyMCE.execCommand("Delete");var node=tinyMCE.selectedInstance.getFocusElement();var breakElms=new Array();do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="
";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="";content=before+content.substring(pos+7)+after;}}if(tinyMCE.getParam("paste_create_linebreaks",true)){content=tinyMCE.regexpReplace(content,"\r\n"," ","gi");content=tinyMCE.regexpReplace(content,"\r"," ","gi");content=tinyMCE.regexpReplace(content,"\n"," ","gi");}}tinyMCE.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);var cb;if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('before', content)");var rl=tinyMCE.getParam("paste_replace_list",'\u2122,TM ,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'$1
');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?) ","gi"),""+middot+"$1
");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp(' ]*>/gi,"");if(tinyMCE.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(tinyMCE.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+TinyMCE_PastePlugin._reEscape(""+document.location)+'','gi'),'href="'+tinyMCE.settings['document_base_url']);content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s* <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!tinyMCE.settings['force_p_newlines']){content=content.replace('','','gi');content=content.replace('
',' ','gi');}if(!tinyMCE.isMSIE&&!tinyMCE.settings['force_p_newlines']){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(tinyMCE.getParam("paste_convert_middot_lists",true)){var div=document.createElement("div");div.innerHTML=content;var className=tinyMCE.getParam("paste_unindented_list_class","unIndentedList");while(TinyMCE_PastePlugin._convertMiddots(div,"--list--"));while(TinyMCE_PastePlugin._convertMiddots(div,middot,className));while(TinyMCE_PastePlugin._convertMiddots(div,bull));content=div.innerHTML;}if(tinyMCE.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'
');content=content.replace(//gi,'');content=content.replace(/<\/h[1-6]>/gi,'
');content=content.replace(/ <\/b>/gi,' ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if((cb=tinyMCE.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('after', content)");tinyMCE.execCommand("mceInsertContent",false,content);window.setTimeout('tinyMCE.execCommand("mceCleanup");',1);}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0)
+ tinyMCE.execCommand('delete');
+
+ if (html && html.length > 0)
+ tinyMCE.execCommand('mcePasteWord', false, html);
+
+ tinyMCE.cancelEvent(e);
+ return false;
+ }
+
+ return true;
+ },
+
+ _insertText : function(content, bLinebreaks) {
+ if (content && content.length > 0) {
+ if (bLinebreaks) {
+ // Special paragraph treatment
+ if (tinyMCE.getParam("paste_create_paragraphs", true)) {
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,TM ,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i", "gi");
+ content = tinyMCE.regexpReplace(content, "\r\r", "
", "gi");
+ content = tinyMCE.regexpReplace(content, "\n\n", "
", "gi");
+
+ // Has paragraphs
+ if ((pos = content.indexOf('
')) != -1) {
+ tinyMCE.execCommand("Delete");
+
+ var node = tinyMCE.selectedInstance.getFocusElement();
+
+ // Get list of elements to break
+ var breakElms = new Array();
+
+ do {
+ if (node.nodeType == 1) {
+ // Don't break tables and break at body
+ if (node.nodeName == "TD" || node.nodeName == "BODY")
+ break;
+
+ breakElms[breakElms.length] = node;
+ }
+ } while(node = node.parentNode);
+
+ var before = "", after = "
";
+ before += content.substring(0, pos);
+
+ for (var i=0; i";
+ after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
+ }
+
+ before += "";
+ content = before + content.substring(pos+7) + after;
+ }
+ }
+
+ if (tinyMCE.getParam("paste_create_linebreaks", true)) {
+ content = tinyMCE.regexpReplace(content, "\r\n", " ", "gi");
+ content = tinyMCE.regexpReplace(content, "\r", " ", "gi");
+ content = tinyMCE.regexpReplace(content, "\n", " ", "gi");
+ }
+ }
+
+ tinyMCE.execCommand("mceInsertRawHTML", false, content);
+ }
+ },
+
+ _insertWordContent : function(content) {
+ if (content && content.length > 0) {
+ // Cleanup Word content
+ var bull = String.fromCharCode(8226);
+ var middot = String.fromCharCode(183);
+ var cb;
+
+ if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
+ content = eval(cb + "('before', content)");
+
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,TM ,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i(.*?)<\/p>', 'gi'), '$1
');
+ }
+
+ content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
+ content = content.replace(new RegExp(bull + "(.*?) ", "gi"), "" + middot + "$1
");
+ content = content.replace(new RegExp('', 'gi'), "" + bull); // Covert to bull list
+ content = content.replace(/<\/o:p>/gi, "");
+ content = content.replace(new RegExp(' ]*>/gi, "");
+
+ if (tinyMCE.getParam("paste_remove_styles", true))
+ content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
+
+ content = content.replace(/<\/?font[^>]*>/gi, "");
+
+ // Strips class attributes.
+ switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
+ case "all":
+ content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
+ break;
+
+ case "mso":
+ content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
+ break;
+ }
+
+ content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
+ content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
+ content = content.replace(/<\\?\?xml[^>]*>/gi, "");
+ content = content.replace(/<\/?\w+:[^>]*>/gi, "");
+ content = content.replace(/-- page break --\s* <\/p>/gi, ""); // Remove pagebreaks
+ content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
+
+ // content = content.replace(/\/? */gi, "");
+ // content = content.replace(/
<\/p>/gi, '');
+
+ if (!tinyMCE.settings['force_p_newlines']) {
+ content = content.replace('', '' ,'gi');
+ content = content.replace('
', ' ' ,'gi');
+ }
+
+ if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
+ content = content.replace(/<\/?p[^>]*>/gi, "");
+ }
+
+ content = content.replace(/<\/?div[^>]*>/gi, "");
+
+ // Convert all middlot lists to UL lists
+ if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
+ var div = document.createElement("div");
+ div.innerHTML = content;
+
+ // Convert all middot paragraphs to li elements
+ var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
+
+ while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
+ while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
+ while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
+
+ content = div.innerHTML;
+ }
+
+ // Replace all headers with strong and fix some other issues
+ if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(/ <\/h[1-6]>/gi, '
');
+ content = content.replace(//gi, '');
+ content = content.replace(/<\/h[1-6]>/gi, '
');
+ content = content.replace(/ <\/b>/gi, ' ');
+ content = content.replace(/^( )*/gi, '');
+ }
+
+ content = content.replace(/--list--/gi, ""); // Remove --list--
+
+ if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
+ content = eval(cb + "('after', content)");
+
+ // Insert cleaned content
+ tinyMCE.execCommand("mceInsertContent", false, content);
+
+ if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
+ window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
+ }
+ },
+
+ _reEscape : function(s) {
+ var l = "?.\\*[](){}+^$:";
+ var o = "";
+
+ for (var i=0; i)', 'gi'), "$1\n\n");
pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
- pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "$1
\n");
+ pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "$1
\n");
pee = pee.replace(new RegExp('\\s*?
', 'gi'), '');
pee = pee.replace(new RegExp('\\s*(?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*
', 'gi'), "$1");
pee = pee.replace(new RegExp("(
", 'gi'), "$1");
diff --git a/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-includes/js/tinymce/themes/advanced/charmap.htm
index 9dac168..fbd472b 100644
--- a/wp-includes/js/tinymce/themes/advanced/charmap.htm
+++ b/wp-includes/js/tinymce/themes/advanced/charmap.htm
@@ -6,7 +6,7 @@
-
+
{$lang_theme_charmap_title}
diff --git a/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
index 725466e..e5fdc9f 100644
--- a/wp-includes/js/tinymce/themes/advanced/color_picker.htm
+++ b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
@@ -5,7 +5,7 @@
-
+
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
index 11f75df..182e791 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_content.css
@@ -14,6 +14,11 @@ body {
border: 1px dashed #BBBBBB !important;
}
+div.mceVisualAid {
+ background-image:url('../images/spacer.gif');
+ visibility: visible !important;
+}
+
.mceItemAnchor {
width: 12px;
line-height: 6px;
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
index 3b42925..079470c 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
@@ -312,6 +312,10 @@ h3 {
height: 190px;
}
+label.msg { display: none; }
+label.invalid { color: #EE0000; display: inline; }
+input.invalid { border: 1px solid #EE0000; }
+
/* Disables the advanced tab in the table plugin. */
/*
#table #advanced_tab {
diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
index 04fccc7..e70405d 100644
--- a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
+++ b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
@@ -1,348 +1,97 @@
/* This file contains the CSS data for the editor UI of TinyMCE instances */
-.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
- border: 0; margin: 0; padding: 0; background: transparent;
-}
-
-.mceSeparatorLine {
- border: 0;
- padding: 0;
- margin-left: 4px;
- margin-right: 2px;
-}
-
-.mceSelectList {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 7pt !important;
- font-weight: normal;
- margin-top: 3px;
- padding: 0;
- display: inline;
- vertical-align: top;
- background-color: #F0F0EE;
-}
-
-.mceLabel, .mceLabelDisabled {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 9pt;
-}
-
-.mceLabel {
- color: #000000;
-}
-
-.mceLabelDisabled {
- cursor: text;
- color: #999999;
-}
-
-.mceEditor {
- background: #F0F0EE;
- border: 1px solid #cccccc;
- padding: 0;
- margin: 0;
-}
-
-.mceEditorArea {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- background: #FFFFFF;
- padding: 0;
- margin: 0;
-}
-
-.mceToolbarTop, .mceToolbarBottom {
- background: #F0F0EE;
- line-height: 1px;
- font-size: 1px;
-}
-
-.mceToolbarTop {
- border-bottom: 1px solid #cccccc;
- padding-bottom: 1px;
-}
-
-.mceToolbarBottom {
- border-top: 1px solid #cccccc;
-}
-
-.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {
- height: 20px;
-}
-
-.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 9pt;
- padding: 2px;
- line-height: 16px;
- overflow: visible;
-}
-
-.mceStatusbarTop {
- border-bottom: 1px solid #cccccc;
-}
-
-.mceStatusbarBottom {
- border-top: 1px solid #cccccc;
-}
-
-.mceStatusbar {
- border-bottom: 1px solid #cccccc;
-}
-
-.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
- text-decoration: none;
- font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
- font-size: 9pt;
- color: #000000;
-}
-
-.mcePathItem:hover {
- text-decoration: underline;
-}
-
-.mceStatusbarPathText {
- float: left;
-}
-
-.mceStatusbarResize {
- float: right;
- background-image: url('../images/statusbar_resize.gif');
- background-repeat: no-repeat;
- width: 11px;
- height: 20px;
- cursor: se-resize;
-}
-
-.mceResizeBox {
- width: 10px;
- height: 10px;
- display: none;
- border: 1px dotted gray;
- margin: 0;
- padding: 0;
-}
+.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;}
+.mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;}
+.mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;}
+.mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;}
+.mceLabel {color: #000000;}
+.mceLabelDisabled {cursor: text; color: #999999;}
+.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;}
+.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; }
+.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;}
+.mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;}
+.mceToolbarBottom {border-top: 1px solid #cccccc;}
+.mceToolbarContainer {position: relative; left: 0; top: 0; display: block;}
+.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;}
+.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;}
+.mceStatusbarTop {border-bottom: 1px solid #cccccc;}
+.mceStatusbarBottom {border-top: 1px solid #cccccc;}
+.mceStatusbar {border-bottom: 1px solid #cccccc;}
+.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;}
+.mcePathItem:hover {text-decoration: underline;}
+.mceStatusbarPathText {float: left;}
+.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;}
+.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;}
+.mceEditorIframe {border: 0;}
/* Button CSS rules */
-a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {
- width: 20px;
- height: 20px;
- cursor: default;
- margin-top: 1px;
- margin-left: 1px;
-}
-
-a.mceButtonDisabled img {
- border: 0 !important;
-}
-
-a.mceButtonNormal img, a.mceButtonSelected img {
- border: 1px solid #F0F0EE !important;
-}
-
-a.mceButtonSelected img {
- border: 1px solid #6779AA !important;
- background-color: #D4D5D8;
-}
-
-a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {
- border: 1px solid #0A246A !important;
- cursor: default;
- background-color: #B6BDD2;
-}
-
-a.mceButtonDisabled img {
- -moz-opacity:0.3;
- opacity: 0.3;
- border: 1px solid #F0F0EE !important;
- cursor: default;
-}
-
-a.mceTiledButton img {
- background-image: url('../images/buttons.gif');
- background-repeat: no-repeat;
-}
-
-/* MSIE specific rules */
-
-* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {
- border: 0 !important;
- margin-top: 2px;
- margin-bottom: 1px;
-}
-
-* html a.mceButtonDisabled img {
- filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
- border: 0 !important;
-}
-
-* html a.mceButtonDisabled {
- border: 1px solid #F0F0EE !important;
-}
-
-* html a.mceButtonNormal, * html a.mceButtonSelected {
- border: 1px solid #F0F0EE !important;
- cursor: default;
-}
-
-* html a.mceButtonSelected {
- border: 1px solid #6779AA !important;
- background-color: #D4D5D8;
-}
-
-* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {
- border: 1px solid #0A246A !important;
- cursor: default;
- background-color: #B6BDD2;
-}
-
-* html .mceSelectList {
- margin-top: 2px;
-}
+a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;}
+a.mceButtonDisabled img {border: 0 !important;}
+a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;}
+a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;}
+a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;}
+a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;}
/* Menu button CSS rules */
-span.mceMenuButton img, span.mceMenuButtonSelected img {
- border: 1px solid #F0F0EE;
- margin-left: 1px;
-}
-
-span.mceMenuButtonSelected img {
- border: 1px solid #6779AA;
- background-color: #B6BDD2;
-}
-
-span.mceMenuButtonSelected img.mceMenuButton {
- border: 1px solid #F0F0EE;
- background-color: transparent;
-}
-
-span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {
- border-left: 0;
- margin-left: 0;
-}
-
-span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
-}
-
-span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {
- border-left: 0;
-}
-
-span.mceMenuButtonFocus img {
- border: 1px solid gray;
- border-right: 0;
- margin-left: 1px;
- background-color: #F5F4F2;
-}
-
-span.mceMenuButtonFocus img.mceMenuButton {
- border: 1px solid gray;
- border-left: 1px solid #F5F4F2;
- margin-left: 0;
-}
-
-/* Menu button MSIE specific rules */
-
-* html span.mceMenuButton, * html span.mceMenuButtonFocus {
- position: relative;
- left: 0;
- top: 0;
-}
-
-* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {
- position: relative;
- top: 1px;
-}
-
-* html span.mceMenuHover img {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
-}
-
-* html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
- border-left: 0;
-}
+span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;}
+span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;}
+span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;}
+span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;}
+span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
+span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;}
+span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;}
+span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;}
+span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;}
+span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;}
/* Menu */
-.mceMenu {
- position: absolute;
- left: 0;
- top: 0;
- display: none;
- z-index: 100;
- background-color: white;
- border: 1px solid gray;
- font-weight: normal;
-}
-
-.mceMenu a, .mceMenuTitle, .mceMenuDisabled {
- display: block;
- width: 100%;
- text-decoration: none;
- background-color: white;
- font-family: Tahoma, Verdana, Arial, Helvetica;
- font-size: 11px;
- line-height: 20px;
- color: black;
-}
-
-.mceMenu a:hover {
- background-color: #B6BDD2;
- color: black;
-}
-
-.mceMenu span {
- padding-left: 10px;
- padding-right: 10px;
- display: block;
- line-height: 20px;
-}
-
-.mceMenuSeparator {
- border-bottom: 1px solid gray;
- background-color: gray;
- height: 1px;
-}
-
-.mceMenuTitle span {
- padding-left: 5px;
-}
-
-.mceMenuTitle {
- background-color: #DDDDDD;
- font-weight: bold;
-}
-
-.mceMenuDisabled {
- color: gray;
-}
-
-span.mceMenuSelectedItem {
- background-image: url('../images/menu_check.gif');
- background-repeat: no-repeat;
- background-position: 5px 8px;
- padding-left: 20px;
-}
-
-span.mceMenuCheckItem {
- padding-left: 20px;
-}
-
-span.mceMenuLine {
- display: block;
- position: absolute;
- left: 0;
- top: -1px;
- background-color: #F5F4F2;
- width: 30px;
- height: 1px;
- overflow: hidden;
- padding-left: 0;
- padding-right: 0;
-}
+.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; background-color: white; border: 1px solid gray; font-weight: normal;}
+.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;}
+.mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;}
+.mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;}
+.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;}
+.mceMenuTitle span {padding-left: 5px;}
+.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;}
+.mceMenuDisabled {color: gray;}
+span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;}
+span.mceMenuCheckItem {padding-left: 20px;}
+span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;}
+.mceColors table, .mceColors td {margin: 0; padding: 2px;}
+a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;}
+.mceColorPreview {position: absolute; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;}
+a.mceMoreColors:hover {border: 1px solid #0A246A;}
+.mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;}
+
+/* MSIE 6 specific rules */
+
+* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
+* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
+* html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
+* html .mceSelectList {margin-top: 2px;}
+* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+* html a.mceMoreColors {width: 132px;}
+* html .mceColors td a {width: 10px; height: 10px;}
+* html .mceColorPreview {margin-left: 2px; margin-top: 14px;}
+
+/* MSIE 7 specific rules */
+
+*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;}
+*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;}
+*:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;}
+*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;}
+*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;}
+*:first-child+html .mceSelectList {margin-top: 2px;}
+*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;}
+*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;}
+*:first-child+html a.mceMoreColors {width: 132px;}
+*:first-child+html .mceColors td a {width: 10px; height: 10px;}
+*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;}
diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js
index 052914e..2285832 100644
--- a/wp-includes/js/tinymce/themes/advanced/editor_template.js
+++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js
@@ -1,7 +1,5 @@
/**
- * $RCSfile: editor_template_src.js,v $
- * $Revision: 1.96 $
- * $Date: 2006/04/18 13:32:52 $
+ * $Id: editor_template_src.js 129 2006-10-23 09:45:17Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
@@ -12,6 +10,7 @@ tinyMCE.importThemeLanguagePack('advanced');
var TinyMCE_AdvancedTheme = {
// Private theme fields
+ _defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",
_autoImportCSSClasses : true,
_resizer : {},
_buttons : [
@@ -43,25 +42,28 @@ var TinyMCE_AdvancedTheme = {
['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
- ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'mceForeColor', true],
- ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'mceBackColor', true],
+ ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
+ ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
],
- _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells',
+ _buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',
/**
* Returns HTML code for the specificed control.
*/
getControlHTML : function(button_name) {
- var i, x;
+ var i, x, but;
// Lookup button in button list
for (i=0; i 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
if (but[0] == button_name)
return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
@@ -153,6 +155,18 @@ var TinyMCE_AdvancedTheme = {
*/
execCommand : function(editor_id, element, command, user_interface, value) {
switch (command) {
+ case 'mceHelp':
+ tinyMCE.openWindow({
+ file : 'about.htm',
+ width : 480,
+ height : 380
+ }, {
+ tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
+ tinymce_releasedate : tinyMCE.releaseDate,
+ inline : "yes"
+ });
+ return true;
+
case "mceLink":
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
@@ -317,41 +331,94 @@ var TinyMCE_AdvancedTheme = {
return true;
- case "mceForeColor":
- var template = new Array();
- var elm = tinyMCE.selectedInstance.getFocusElement();
- var inputColor = tinyMCE.getAttrib(elm, "color");
+ case "forecolor":
+ var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
+
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ if (!fcp.exists()) {
+ fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+ elm = fcp.getElement();
+ elm._editor_id = editor_id;
+ elm._command = "forecolor";
+ elm._switchId = editor_id + "_forecolor";
+ tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+ }
+
+ img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
+ p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+ fcp.moveTo(p.absLeft, p.absTop);
+ fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
+ fcp.show();
+
+ return false;
+
+ case "forecolorMenu":
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ // Create color layer
+ var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
- if (inputColor == '')
- inputColor = elm.style.color;
+ if (!ml.exists())
+ ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
- if (!inputColor)
- inputColor = "#000000";
+ tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
+ ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 190;
+ ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
+ if (tinyMCE.isOpera)
+ ml.moveBy(0, -2);
+
+ ml.show();
return true;
- case "mceBackColor":
- var template = new Array();
- var elm = tinyMCE.selectedInstance.getFocusElement();
- var inputColor = elm.style.backgroundColor;
+ case "HiliteColor":
+ var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
+
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ if (!bcp.exists()) {
+ bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+ elm = bcp.getElement();
+ elm._editor_id = editor_id;
+ elm._command = "HiliteColor";
+ elm._switchId = editor_id + "_backcolor";
+ tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+ tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+ }
+
+ img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
+ p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+ bcp.moveTo(p.absLeft, p.absTop);
+ bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
+ bcp.show();
+
+ return false;
+
+ case "HiliteColorMenu":
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+ // Create color layer
+ var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
+
+ if (!ml.exists())
+ ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
- if (!inputColor)
- inputColor = "#000000";
+ tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
+ ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 190;
+ ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
- template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0);
+ if (tinyMCE.isOpera)
+ ml.moveBy(0, -2);
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
- //mceBackColor
+ ml.show();
return true;
case "mceColorPicker":
@@ -433,7 +500,7 @@ var TinyMCE_AdvancedTheme = {
*/
getEditorTemplate : function(settings, editorId) {
function removeFromArray(in_array, remove_array) {
- var outArray = new Array();
+ var outArray = new Array(), skip;
for (var i=0; i';
// Setup template html
- template['html'] = '';
+ template['html'] = '';
if (toolbarLocation == "top") {
- template['html'] += '' + toolbarHTML + ' ';
+ template['html'] += '' + toolbarHTML + ' ';
}
if (statusbarLocation == "top") {
@@ -544,7 +611,7 @@ var TinyMCE_AdvancedTheme = {
template['html'] += ' ';
if (toolbarLocation == "bottom") {
- template['html'] += '' + toolbarHTML + ' ';
+ template['html'] += '' + toolbarHTML + ' ';
}
// External toolbar changes
@@ -615,9 +682,10 @@ var TinyMCE_AdvancedTheme = {
var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
- for (var j=0; j 0) {
curContainerHTML += " ";
@@ -664,10 +732,34 @@ var TinyMCE_AdvancedTheme = {
inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
},
+ _handleMenuEvent : function(e) {
+ var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
+ tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
+
+ if (e.type == "click")
+ tinyMCE.execInstanceCommand(te._editor_id, te._command);
+ },
+
+ _hideMenus : function(id) {
+ var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
+
+ if (fcml.exists() && fcml.isVisible()) {
+ tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
+ fcml.hide();
+ }
+
+ if (bcml.exists() && bcml.isVisible()) {
+ tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
+ bcml.hide();
+ }
+ },
+
/**
* Node change handler.
*/
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
+ var alignNode, breakOut, classNode;
+
function selectByValue(select_elm, value, first_index) {
first_index = typeof(first_index) == "undefined" ? false : true;
@@ -702,6 +794,7 @@ var TinyMCE_AdvancedTheme = {
var pathElm = document.getElementById(editor_id + "_path");
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
+ TinyMCE_AdvancedTheme._hideMenus(editor_id);
if (pathElm) {
// Get node path
@@ -727,6 +820,9 @@ var TinyMCE_AdvancedTheme = {
var nodeName = path[i].nodeName.toLowerCase();
var nodeData = "";
+ if (nodeName.indexOf("html:") == 0)
+ nodeName = nodeName.substring(5);
+
if (nodeName == "b") {
nodeName = "strong";
}
@@ -781,7 +877,7 @@ var TinyMCE_AdvancedTheme = {
nodeData += "src: " + src + " ";
}
- if (getAttrib(path[i], 'href') != "") {
+ if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") {
var href = tinyMCE.getAttrib(path[i], "mce_href");
if (href == "")
@@ -790,9 +886,10 @@ var TinyMCE_AdvancedTheme = {
nodeData += "href: " + href + " ";
}
- if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
- nodeName = "flash";
- nodeData = "src: " + path[i].getAttribute('title');
+ className = tinyMCE.getAttrib(path[i], "class");
+ if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
+ nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
+ nodeData = path[i].getAttribute('title');
}
if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
@@ -1027,7 +1124,7 @@ var TinyMCE_AdvancedTheme = {
break;
case "IMG":
- if (getAttrib(node, 'name').indexOf('mce_') != 0) {
+ if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
}
break;
@@ -1148,6 +1245,9 @@ var TinyMCE_AdvancedTheme = {
inst.iframeElement.style.width = (iw + dx) + "px";
}
}
+
+ // Remove pesky table controls
+ inst.useCSS = false;
},
/**
@@ -1255,6 +1355,29 @@ var TinyMCE_AdvancedTheme = {
}
},
+ _getColorHTML : function(id, n, cm) {
+ var i, h, cl;
+
+ h = '';
+ cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
+
+ h += '';
+ for (i=0; i ';
+
+ if ((i+1) % 8 == 0)
+ h += ' ';
+ }
+
+ h += '
';
+ /*
+ h += 'More colors ';
+ */
+
+ return h;
+ },
+
_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
tinyMCE.execCommand('mceBeginUndoLevel');
diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template_src.js b/wp-includes/js/tinymce/themes/advanced/editor_template_src.js
deleted file mode 100644
index e69de29..0000000
diff --git a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif b/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif
index 8a532e5..d03e206 100644
Binary files a/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif and b/wp-includes/js/tinymce/themes/advanced/images/backcolor.gif differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif b/wp-includes/js/tinymce/themes/advanced/images/buttons.gif
index 6196350..5ad99a7 100644
Binary files a/wp-includes/js/tinymce/themes/advanced/images/buttons.gif and b/wp-includes/js/tinymce/themes/advanced/images/buttons.gif differ
diff --git a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif b/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif
index d5e3814..8b70361 100644
Binary files a/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif and b/wp-includes/js/tinymce/themes/advanced/images/forecolor.gif differ
diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
index b7dadc6..8395340 100644
--- a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
+++ b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js
@@ -3,29 +3,25 @@ function saveContent() {
tinyMCE.closeWindow(window);
}
-// Fixes some charcode issues
-function fixContent(html) {
-/* html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
- html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'$1>\n');
- html = tinyMCE.regexpReplace(html, ' ',' \n','gi');
- html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
- return html;
-}
-
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
- document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
+ document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
+
resizeInputs();
if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
setWrap('soft');
- document.forms[0].wraped.checked = true;
+ document.getElementById('wraped').checked = true;
}
}
function setWrap(val) {
- var s = document.forms[0].htmlSource;
+ var s = document.getElementById('htmlSource');
s.wrap = val;
@@ -48,6 +44,8 @@ function toggleWordWrap(elm) {
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
+ var el = document.getElementById('htmlSource');
+
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-16;
@@ -56,11 +54,7 @@ function resizeInputs() {
wWidth = document.body.clientWidth - 16;
}
- document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
- document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
+ el.style.height = Math.abs(wHeight) + 'px';
+ el.style.width = Math.abs(wWidth) + 'px';
}
-function renderWordWrap() {
- if (tinyMCE.isMSIE || tinyMCE.isGecko)
- document.write('{$lang_theme_code_wordwrap} ');
-}
diff --git a/wp-includes/js/tinymce/themes/advanced/langs/en.js b/wp-includes/js/tinymce/themes/advanced/langs/en.js
index ca72676..fd915ea 100644
--- a/wp-includes/js/tinymce/themes/advanced/langs/en.js
+++ b/wp-includes/js/tinymce/themes/advanced/langs/en.js
@@ -38,6 +38,11 @@ theme_h3 : 'Heading 3',
theme_h4 : 'Heading 4',
theme_h5 : 'Heading 5',
theme_h6 : 'Heading 6',
+theme_blockquote : 'Blockquote',
+theme_code : 'Code',
+theme_samp : 'Code sample',
+theme_dt : 'Definition term ',
+theme_dd : 'Definition description',
theme_colorpicker_title : 'Select a color',
theme_colorpicker_apply : 'Apply',
theme_forecolor_desc : 'Select text color',
@@ -72,5 +77,6 @@ loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
+toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
+invalid_data : 'Error: Invalid values entered, these are marked in red.'
});
diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js
index 643aab4..ecd78a2 100644
--- a/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-includes/js/tinymce/tiny_mce.js
@@ -2,9 +2,11 @@
/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */
function TinyMCE_Engine() {
+ var ua;
+
this.majorVersion = "2";
- this.minorVersion = "0.6.1";
- this.releaseDate = "2006-05-04";
+ this.minorVersion = "0.8";
+ this.releaseDate = "2006-10-23";
this.instances = new Array();
this.switchClassCache = new Array();
@@ -15,12 +17,17 @@ function TinyMCE_Engine() {
this.configs = new Array();
this.currentConfig = 0;
this.eventHandlers = new Array();
+ this.log = new Array();
+ this.undoLevels = [];
+ this.undoIndex = 0;
+ this.typingUndoIndex = -1;
// Browser check
- var ua = navigator.userAgent;
+ ua = navigator.userAgent;
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
+ this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
this.isGecko = ua.indexOf('Gecko') != -1;
this.isSafari = ua.indexOf('Safari') != -1;
this.isOpera = ua.indexOf('Opera') != -1;
@@ -42,13 +49,20 @@ function TinyMCE_Engine() {
this.isSafari = false;
}
+ this.isIE = this.isMSIE;
+ this.isRealIE = this.isMSIE && !this.isOpera;
+
// TinyMCE editor id instance counter
this.idCounter = 0;
};
TinyMCE_Engine.prototype = {
init : function(settings) {
- var theme;
+ var theme, nl, baseHREF = "", i;
+
+ // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry.
+ if (this.isMSIE5_0)
+ return;
this.settings = settings;
@@ -60,6 +74,13 @@ TinyMCE_Engine.prototype = {
if (!tinyMCE.baseURL) {
var elements = document.getElementsByTagName('script');
+ // If base element found, add that infront of baseURL
+ nl = document.getElementsByTagName('base');
+ for (i=0; i 0 && document.location.protocol != "file:") {
@@ -207,7 +235,10 @@ TinyMCE_Engine.prototype = {
this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
theme = this.settings['theme'];
- this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$", "i");
+ this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
+ this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
+ this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
+ this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL
this.uniqueTag = 'TMP
';
@@ -216,7 +247,7 @@ TinyMCE_Engine.prototype = {
// Theme url
this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE || tinyMCE.isOpera)
this.settings['force_br_newlines'] = false;
if (tinyMCE.getParam("popups_css", false)) {
@@ -238,8 +269,10 @@ TinyMCE_Engine.prototype = {
this.settings['editor_css'] = this.documentBasePath + "/" + cssPath;
else
this.settings['editor_css'] = cssPath;
- } else
- this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+ } else {
+ if (this.settings.editor_css != '')
+ this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+ }
if (tinyMCE.settings['debug']) {
var msg = "Debug: \n";
@@ -255,14 +288,10 @@ TinyMCE_Engine.prototype = {
// Only do this once
if (this.configs.length == 0) {
- // Is Safari enabled
- if (this.isSafari && this.getParam('safari_warning', false))
- alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");
-
if (typeof(TinyMCECompressed) == "undefined") {
tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad);
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ if (tinyMCE.isRealIE) {
if (document.body)
tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad);
else
@@ -288,10 +317,12 @@ TinyMCE_Engine.prototype = {
}
// Setup entities
- settings['cleanup_entities'] = new Array();
- var entities = tinyMCE.getParam('entities', '', true, ',');
- for (var i=0; i 0) {
/* Make sure it doesn't exist. */
for (i=0, lflen=this.loadedFiles.length; i 0) {
+ tinyMCE.nextUndoRedoAction = 'Undo';
+ inst = this.undoLevels[--this.undoIndex];
+ inst.select();
+
+ if (!tinyMCE.nextUndoRedoInstanceId)
+ inst.execCommand('Undo');
+ }
+ } else
+ inst.execCommand('Undo');
+ return true;
+
+ case "Redo":
+ if (this.getParam('custom_undo_redo_global')) {
+ if (this.undoIndex <= this.undoLevels.length - 1) {
+ tinyMCE.nextUndoRedoAction = 'Redo';
+ inst = this.undoLevels[this.undoIndex++];
+ inst.select();
+
+ if (!tinyMCE.nextUndoRedoInstanceId)
+ inst.execCommand('Redo');
+ }
+ } else
+ inst.execCommand('Redo');
+
+ return true;
case 'mceFocus':
var inst = tinyMCE.getInstanceById(value);
if (inst)
- inst.contentWindow.focus();
+ inst.getWin().focus();
return;
case "mceAddControl":
@@ -657,7 +733,7 @@ TinyMCE_Engine.prototype = {
case "mceResetDesignMode":
// Resets the designmode state of the editors in Gecko
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
for (var n in tinyMCE.instances) {
if (!tinyMCE.isInstance(tinyMCE.instances[n]))
continue;
@@ -673,8 +749,8 @@ TinyMCE_Engine.prototype = {
return;
}
- if (this.selectedInstance) {
- this.selectedInstance.execCommand(command, user_interface, value);
+ if (inst) {
+ inst.execCommand(command, user_interface, value);
} else if (tinyMCE.settings['focus_alert'])
alert(tinyMCELang['lang_focus_alert']);
},
@@ -696,17 +772,18 @@ TinyMCE_Engine.prototype = {
if (aw.indexOf('%') == -1) {
aw = parseInt(aw);
- aw = aw < 0 ? 300 : aw;
+ aw = (isNaN(aw) || aw < 0) ? 300 : aw;
aw = aw + "px";
}
if (ah.indexOf('%') == -1) {
ah = parseInt(ah);
- ah = ah < 0 ? 240 : ah;
+ ah = (isNaN(ah) || ah < 0) ? 240 : ah;
ah = ah + "px";
}
iframe.setAttribute("id", id);
+ iframe.setAttribute("name", id);
iframe.setAttribute("class", "mceEditorIframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
@@ -723,7 +800,7 @@ TinyMCE_Engine.prototype = {
iframe.setAttribute("scrolling", "no");
// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
iframe.setAttribute("src", this.settings['default_document']);
iframe.style.width = aw;
@@ -734,19 +811,19 @@ TinyMCE_Engine.prototype = {
iframe.style.marginBottom = '-5px';
// MSIE 5.0 issue
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
replace_element.outerHTML = iframe.outerHTML;
else
replace_element.parentNode.replaceChild(iframe, replace_element);
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ if (tinyMCE.isRealIE)
return win.frames[id];
else
return iframe;
},
setupContent : function(editor_id) {
- var inst = tinyMCE.instances[editor_id];
+ var inst = tinyMCE.instances[editor_id], i;
var doc = inst.getDoc();
var head = doc.getElementsByTagName('head').item(0);
var content = inst.startContent;
@@ -762,7 +839,7 @@ TinyMCE_Engine.prototype = {
inst.switchSettings();
// Not loaded correctly hit it again, Mozilla bug #997860
- if (!tinyMCE.isMSIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
+ if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
// This part will remove the designMode status
// Failes first time in Firefox 1.5b2 on Mac
try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
@@ -786,6 +863,14 @@ TinyMCE_Engine.prototype = {
inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo');
}
+ // BlockFormat shortcuts keys
+ for (i=1; i<=6; i++)
+ inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '');
+
+ inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '');
+ inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '
');
+ inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '
');
+
// Add default shortcuts for gecko
if (tinyMCE.isGecko) {
inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold');
@@ -795,7 +880,7 @@ TinyMCE_Engine.prototype = {
// Setup span styles
if (tinyMCE.getParam("convert_fonts_to_spans"))
- inst.getDoc().body.setAttribute('id', 'mceSpanFonts');
+ inst.getBody().setAttribute('id', 'mceSpanFonts');
if (tinyMCE.settings['nowrap'])
doc.body.style.whiteSpace = "nowrap";
@@ -804,7 +889,7 @@ TinyMCE_Engine.prototype = {
doc.editorId = editor_id;
// Add on document element in Mozilla
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE)
doc.documentElement.editorId = editor_id;
inst.setBaseHREF(tinyMCE.settings['base_href']);
@@ -823,7 +908,7 @@ TinyMCE_Engine.prototype = {
content = tinyMCE.storeAwayURLs(content);
content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
// Ugly!!!
window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
@@ -837,7 +922,7 @@ TinyMCE_Engine.prototype = {
content = tinyMCE.cleanupHTMLCode(content);
// Fix for bug #958637
- if (!tinyMCE.isMSIE) {
+ if (!tinyMCE.isIE) {
var contentElement = inst.getDoc().createElement("body");
var doc = inst.getDoc();
@@ -849,15 +934,8 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.settings['cleanup_on_startup'])
tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
- else {
- // Convert all strong/em to b/i
- content = tinyMCE.regexpReplace(content, "", "", "gi");
- content = tinyMCE.regexpReplace(content, "", "", "gi");
- content = tinyMCE.regexpReplace(content, " ", " ", "gi");
+ else
tinyMCE.setInnerHTML(inst.getBody(), content);
- }
tinyMCE.convertAllRelativeURLs(inst.getBody());
} else {
@@ -881,11 +959,11 @@ TinyMCE_Engine.prototype = {
tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
// Re-add design mode on mozilla
- if (!tinyMCE.isMSIE)
+ if (!tinyMCE.isIE)
tinyMCE.addEventHandlers(inst);
// Add blur handler
- if (tinyMCE.isMSIE) {
+ if (tinyMCE.isIE) {
tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch);
tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953
@@ -898,7 +976,7 @@ TinyMCE_Engine.prototype = {
}
// Trigger node change, this call locks buttons for tables and so forth
- tinyMCE.selectedInstance = inst;
+ inst.select();
tinyMCE.selectedElement = inst.contentWindow.document.body;
// Call custom DOM cleanup
@@ -917,19 +995,21 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.isGecko) {
// Remove mce_src from textnodes and comments
tinyMCE.selectNodes(inst.getBody(), function(n) {
- if (n.nodeType == 3 || n.nodeType == 8) {
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
- }
+ if (n.nodeType == 3 || n.nodeType == 8)
+ n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
return false;
});
}
+ // Remove Gecko spellchecking
+ if (tinyMCE.isGecko)
+ inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
// Cleanup any mess left from storyAwayURLs
tinyMCE._removeInternal(inst.getBody());
- tinyMCE.selectedInstance = inst;
+ inst.select();
tinyMCE.triggerNodeChange(false, true);
},
@@ -950,42 +1030,14 @@ TinyMCE_Engine.prototype = {
if (tinyMCE.isGecko) {
// Remove mce_src from textnodes and comments
tinyMCE.selectNodes(n, function(n) {
- if (n.nodeType == 3 || n.nodeType == 8) {
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
- n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
- }
+ if (n.nodeType == 3 || n.nodeType == 8)
+ n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
return false;
});
}
},
- removeTinyMCEFormElements : function(form_obj) {
- // Check if form is valid
- if (typeof(form_obj) == "undefined" || form_obj == null)
- return;
-
- // If not a form, find the form
- if (form_obj.nodeName != "FORM") {
- if (form_obj.form)
- form_obj = form_obj.form;
- else
- form_obj = tinyMCE.getParentElement(form_obj, "form");
- }
-
- // Still nothing
- if (form_obj == null)
- return;
-
- // Disable all UI form elements that TinyMCE created
- for (var i=0; i';
+ h += '';
h += ' ';
h += ' ';
} else {
// Normal button
- h += '';
+ h += ' ';
h += ' ';
h += ' ';
}
@@ -1334,6 +1373,58 @@ TinyMCE_Engine.prototype = {
return h;
},
+ getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) {
+ var h = '', m, x;
+
+ mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');';
+ cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+
+ if (typeof(ui) != "undefined" && ui != null)
+ cmd += ',' + ui;
+
+ if (typeof(val) != "undefined" && val != null)
+ cmd += ",'" + val + "'";
+
+ cmd += ');';
+
+ // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
+ if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+ x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+
+ if (tinyMCE.isRealIE)
+ h += ' ') - 8));
+ $trackback_pings[] = array(
+ 'pingTitle' => $title,
+ 'pingURL' => $comment->comment_author_url,
+ 'pingIP' => $comment->comment_author_IP
+ );
+ }
}
- }
- return $trackback_pings;
+ return $trackback_pings;
}
@@ -1052,30 +1051,30 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args);
- $post_ID = $args[0];
- $user_login = $args[1];
- $user_pass = $args[2];
+ $post_ID = $args[0];
+ $user_login = $args[1];
+ $user_pass = $args[2];
- if (!$this->login_pass_ok($user_login, $user_pass)) {
- return $this->error;
- }
+ if (!$this->login_pass_ok($user_login, $user_pass)) {
+ return $this->error;
+ }
- set_current_user(0, $user_login);
- if ( !current_user_can('edit_post', $post_ID) )
- return new IXR_Error(401, 'Sorry, you can not edit this post.');
+ set_current_user(0, $user_login);
+ if ( !current_user_can('edit_post', $post_ID) )
+ return new IXR_Error(401, 'Sorry, you can not edit this post.');
- $postdata = wp_get_single_post($post_ID,ARRAY_A);
+ $postdata = wp_get_single_post($post_ID,ARRAY_A);
- $postdata['post_status'] = 'publish';
+ $postdata['post_status'] = 'publish';
- // retain old cats
- $cats = wp_get_post_categories($post_ID);
- $postdata['post_category'] = $cats;
+ // retain old cats
+ $cats = wp_get_post_categories($post_ID);
+ $postdata['post_category'] = $cats;
$this->escape($postdata);
- $result = wp_update_post($postdata);
+ $result = wp_update_post($postdata);
- return $result;
+ return $result;
}
@@ -1086,7 +1085,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* pingback.ping gets a pingback and registers it */
function pingback_ping($args) {
- global $wpdb, $wp_version;
+ global $wpdb, $wp_version;
$this->escape($args);
@@ -1103,7 +1102,7 @@ class wp_xmlrpc_server extends IXR_Server {
// Check if the page linked to is in our site
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
if( !$pos1 )
- return new IXR_Error(0, 'Is there no link to us?');
+ return new IXR_Error(0, 'Is there no link to us?');
// let's find which post is linked to
// FIXME: does url_to_postid() cover all these cases already?
@@ -1236,8 +1235,8 @@ class wp_xmlrpc_server extends IXR_Server {
/* pingback.extensions.getPingbacks returns an array of URLs
- that pingbacked the given URL
- specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
+ that pingbacked the given URL
+ specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
function pingback_extensions_getPingbacks($args) {
global $wpdb;
--
cgit