diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-12 09:56:20 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-12 09:56:20 +0000 |
| commit | 08c5d92c5e2b3f41b2067a4f18a878eb7a6d461d (patch) | |
| tree | a1bfc6794fd6391ab18cde2be9ab7d5fdb53a8f4 | |
| parent | aa61097b2b86ec542ce29cc169f7686f555fb79c (diff) | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@310 7be80a69-a1ef-0310-a953-fb0f7c49ff36
| -rw-r--r-- | wp-inst/wp-admin/admin-functions.php | 50 | ||||
| -rw-r--r-- | wp-inst/wp-admin/admin.php | 4 | ||||
| -rw-r--r-- | wp-inst/wp-admin/edit-form-ajax-cat.php | 13 | ||||
| -rw-r--r-- | wp-inst/wp-admin/execute-pings.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-admin/import/rss.php | 240 | ||||
| -rw-r--r-- | wp-inst/wp-admin/link-import.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-admin/list-manipulation.js | 6 | ||||
| -rw-r--r-- | wp-inst/wp-admin/options-personal.php | 3 | ||||
| -rw-r--r-- | wp-inst/wp-admin/post.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-content/themes/default/archive.php | 8 | ||||
| -rw-r--r-- | wp-inst/wp-includes/capabilities.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-includes/classes.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-includes/functions-post.php | 2 | ||||
| -rw-r--r-- | wp-inst/wp-includes/functions.php | 7 | ||||
| -rw-r--r-- | wp-inst/wp-includes/template-functions-author.php | 4 | ||||
| -rw-r--r-- | wp-inst/wp-includes/template-functions-links.php | 12 | ||||
| -rw-r--r-- | wp-inst/wp-rdf.php | 10 |
17 files changed, 200 insertions, 169 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index 8cc5139..cd2389a 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/wp-admin/admin-functions.php @@ -130,6 +130,8 @@ function edit_post() { endif; add_meta($post_ID); + + return $post_ID; } function edit_comment() { @@ -260,17 +262,15 @@ function wp_insert_category($catarr) { $result = $wpdb->query($query); if ( $update ) { - $rval = $wpdb->rows_affected; do_action('edit_category', $cat_ID); } else { - $rval = $wpdb->insert_id; do_action('create_category', $rval); do_action('add_category', $rval); } list( $update, $cat_ID, $category_nicename, $cat_name, $rval ) = apply_filters( "new_category", $update, $cat_ID, $category_nicename, $cat_name, $rval ); - return $rval; + return $cat_ID; } function wp_update_category($catarr) { @@ -317,6 +317,35 @@ function wp_delete_category($cat_ID) { return 1; } +function wp_create_category($cat_name) { + $cat_array = compact('cat_name'); + return wp_insert_category($cat_array); +} + + +function wp_create_categories($categories, $post_id = '') { + $cat_ids = array(); + foreach ($categories as $category) { + if ( $id = category_exists($category) ) + $cat_ids[] = $id; + else if ( $id = wp_create_category($category) ) + $cat_ids[] = $id; + } + + if ( $post_id ) + wp_set_post_cats('', $post_id, $cat_ids); + + return $cat_ids; +} + +function category_exists($cat_name) { + global $wpdb; + if ( !$category_nicename = sanitize_title($cat_name) ) + return 0; + + return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); +} + function wp_delete_user($id, $reassign = 'novalue') { global $wpdb; @@ -354,6 +383,21 @@ function wp_delete_user($id, $reassign = 'novalue') { return true; } + +function post_exists($title, $content = '', $post_date = '') { + global $wpdb; + + if ( !empty($post_date) ) + $post_date = "AND post_date = '$post_date'"; + + if ( ! empty($title) ) + return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date"); + else if ( ! empty($content) ) + return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date"); + + return 0; +} + function url_shorten ($url) { $short_url = str_replace('http://', '', stripslashes($url)); $short_url = str_replace('www.', '', $short_url); diff --git a/wp-inst/wp-admin/admin.php b/wp-inst/wp-admin/admin.php index 289c8a3..2a65c30 100644 --- a/wp-inst/wp-admin/admin.php +++ b/wp-inst/wp-admin/admin.php @@ -74,7 +74,7 @@ if (isset($_GET['page'])) { if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) die(__('Cannot load importer.')); - + include(ABSPATH . "wp-admin/import/$importer.php"); $parent_file = 'import.php'; @@ -85,6 +85,8 @@ if (isset($_GET['page'])) { require_once(ABSPATH . 'wp-admin/upgrade-functions.php'); + define('WP_IMPORTING', true); + call_user_func($wp_importers[$importer][2]); include(ABSPATH . 'wp-admin/admin-footer.php'); diff --git a/wp-inst/wp-admin/edit-form-ajax-cat.php b/wp-inst/wp-admin/edit-form-ajax-cat.php index 63659b6..4bd4ceb 100644 --- a/wp-inst/wp-admin/edit-form-ajax-cat.php +++ b/wp-inst/wp-admin/edit-form-ajax-cat.php @@ -7,27 +7,18 @@ get_currentuserinfo(); if ( !current_user_can('manage_categories') ) die('-1'); -function grab_id() { - global $new_cat_id; - $new_cat_id = func_get_arg(0); -} - function get_out_now() { exit; } - -add_action('edit_category', 'grab_id'); -add_action('create_category', 'grab_id'); add_action('shutdown', 'get_out_now', -1); $cat_name = rawurldecode($_GET['ajaxnewcat']); if ( !$category_nicename = sanitize_title($cat_name) ) die('0'); -if ( $already = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'") ) +if ( $already = category_exists($cat_name) ) die((string) $already); $cat_name = $wpdb->escape($cat_name); -$cat_array = compact('cat_name', 'category_nicename'); -wp_insert_category($cat_array); +$new_cat_id = wp_create_category($cat_name); die((string) $new_cat_id); ?> diff --git a/wp-inst/wp-admin/execute-pings.php b/wp-inst/wp-admin/execute-pings.php index 97499ba..5a4288a 100644 --- a/wp-inst/wp-admin/execute-pings.php +++ b/wp-inst/wp-admin/execute-pings.php @@ -30,7 +30,7 @@ function execute_all_pings() { if($trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != ''")) { foreach($trackbacks as $trackback) { //echo "trackback : $trackback->ID<br/>"; - do_trackback($trackback->ID); + do_trackbacks($trackback->ID); } } } diff --git a/wp-inst/wp-admin/import/rss.php b/wp-inst/wp-admin/import/rss.php index c43367d..3662013 100644 --- a/wp-inst/wp-admin/import/rss.php +++ b/wp-inst/wp-admin/import/rss.php @@ -1,7 +1,11 @@ <?php + +// Example: +// define('RSSFILE', '/home/example/public_html/rss.xml'); +define('RSSFILE', 'rss.xml'); + class RSS_Import { - var $authors = array (); var $posts = array (); function header() { @@ -13,167 +17,152 @@ class RSS_Import { echo '</div>'; } + function unhtmlentities($string) { // From php.net for < 4.3 compat + $trans_tbl = get_html_translation_table(HTML_ENTITIES); + $trans_tbl = array_flip($trans_tbl); + return strtr($string, $trans_tbl); + } + function greet() { - $this->header(); -?> -<p>Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. To get started you must edit the following line in this file (<code>import/rss.php</code>) </p> + _e("<p>Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. To get started you must edit the following line in this file (<code>import/rss.php</code>) </p> <p><code>define('RSSFILE', '');</code></p> <p>You want to define where the RSS file we'll be working with is, for example: </p> <p><code>define('RSSFILE', 'rss.xml');</code></p> -<p>You have to do this manually for security reasons. When you're done reload this page and we'll take you to the next step.</p> -<?php if ('' != RSSFILE) : ?> -<a href="admin.php?import=rss&step=1">Begin RSS Import »</a> -<?php - - endif; - $this->footer(); +<p>You have to do this manually for security reasons. When you're done reload this page and we'll take you to the next step.</p>"); + if ('' != RSSFILE) + echo '<a href="admin.php?import=rss&step=1">' . __('Begin RSS Import »') . '</a>'; } function get_posts() { + global $wpdb; + set_magic_quotes_runtime(0); $datalines = file(RSSFILE); // Read the file into an array $importdata = implode('', $datalines); // squish it $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata); - preg_match_all('|<item>(.*?)</item>|is', $importdata, $posts); - $this->posts = $posts[1]; + preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts); + $this->posts = $this->posts[1]; + $index = 0; + foreach ($this->posts as $post) { + preg_match('|<title>(.*?)</title>|is', $post, $post_title); + $post_title = $wpdb->escape(trim($post_title[1])); + + preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $post_date); + + if ($post_date) { + $post_date = strtotime($post_date[1]); + } else { + // if we don't already have something from pubDate + preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $post_date); + $post_date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $post_date[1]); + $post_date = str_replace('T', ' ', $post_date); + $post_date = strtotime($post_date); + } + + $post_date = gmdate('Y-m-d H:i:s', $post_date); + + preg_match_all('|<category>(.*?)</category>|is', $post, $categories); + $categories = $categories[1]; + + if (!$categories) { + preg_match_all('|<dc:subject>(.*?)</dc:subject>|is', $post, $categories); + $categories = $categories[1]; + } + + $cat_index = 0; + foreach ($categories as $category) { + $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category)); + $cat_index++; + } + + preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid); + if ($guid) + $guid = $wpdb->escape(trim($guid[1])); + else + $guid = ''; + + preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $post_content); + $post_content = str_replace(array ('<![CDATA[', ']]>'), '', $wpdb->escape(trim($post_content[1]))); + + if (!$post_content) { + // This is for feeds that put content in description + preg_match('|<description>(.*?)</description>|is', $post, $post_content); + $post_content = $wpdb->escape($this->unhtmlentities(trim($post_content[1]))); + } + + // Clean up content + $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content); + $post_content = str_replace('<br>', '<br />', $post_content); + $post_content = str_replace('<hr>', '<hr />', $post_content); + + $post_author = 1; + $post_status = 'publish'; + $post_date_gmt = $post_date; // FIXME + $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); + $index++; + } } function import_posts() { echo '<ol>'; - foreach ($this->posts as $post) - : $title = $date = $categories = $content = $post_id = ''; - echo "<li>Importing post... "; - preg_match('|<title>(.*?)</title>|is', $post, $title); - $title = $wpdb->escape(trim($title[1])); - $post_name = sanitize_title($title); + foreach ($this->posts as $post) { + echo "<li>".__('Importing post...'); - preg_match('|<pubdate>(.*?)</pubdate>|is', $post, $date); + extract($post); - if ($date) - : $date = strtotime($date[1]); - else - : // if we don't already have something from pubDate - preg_match('|<dc:date>(.*?)</dc:date>|is', $post, $date); - $date = preg_replace('|([-+])([0-9]+):([0-9]+)$|', '\1\2\3', $date[1]); - $date = str_replace('T', ' ', $date); - $date = strtotime($date); - endif; - - $post_date = gmdate('Y-m-d H:i:s', $date); - - preg_match_all('|<category>(.*?)</category>|is', $post, $categories); - $categories = $categories[1]; - - if (!$categories) - : preg_match_all('|<dc:subject>(.*?)</dc:subject>|is', $post, $categories); - $categories = $categories[1]; - endif; - - preg_match('|<guid.+?>(.*?)</guid>|is', $post, $guid); - if ($guid) - $guid = $wpdb->escape(trim($guid[1])); - else - $guid = ''; - - preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $content); - $content = str_replace(array ('<![CDATA[', ']]>'), '', $wpdb->escape(trim($content[1]))); - - if (!$content) - : // This is for feeds that put content in description - preg_match('|<description>(.*?)</description>|is', $post, $content); - $content = $wpdb->escape(unhtmlentities(trim($content[1]))); - endif; - - // Clean up content - $content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $content); - $content = str_replace('<br>', '<br />', $content); - $content = str_replace('<hr>', '<hr />', $content); - - // This can mess up on posts with no titles, but checking content is much slower - // So we do it as a last resort - if ('' == $title) - : $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'"); - else - : $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); - endif; - - // Now lets put it in the DB - if ($dupe) - : echo 'Post already imported'; - else - : $wpdb->query("INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name, guid) - VALUES - ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name', '$guid')"); - $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); - if (!$post_id) - die("couldn't get post ID"); - if (0 != count($categories)) - : foreach ($categories as $post_category) - : $post_category = unhtmlentities($post_category); - // See if the category exists yet - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - if (!$cat_id && '' != trim($post_category)) { - $cat_nicename = sanitize_title($post_category); - $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')"); - $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); - } - if ('' == trim($post_category)) - $cat_id = 1; - // Double check it's not there already - $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id"); - - if (!$exists) { - $wpdb->query(" - INSERT INTO $wpdb->post2cat - (post_id, category_id) - VALUES - ($post_id, $cat_id) - "); + if ($post_id = post_exists($post_title, $post_content, $post_date)) { + echo __('Post already imported'); + } else { + $post_id = wp_insert_post($post); + if (!$post_id) + die(__("Couldn't get post ID")); + + if (0 != count($categories)) + wp_create_categories($categories, $post_id); + echo __('Done !'); + } + echo '</li>'; } - endforeach; - else - : $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); - if (!$exists) - $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); - endif; - echo 'Done!</li>'; - endif; - - endforeach; + echo '</ol>'; } - - + function import() { - // FIXME: Don't die. - if ('' != RSSFILE && !file_exists(RSSFILE)) die("The file you specified does not seem to exist. Please check the path you've given."); - if ('' == RSSFILE) die("You must edit the RSSFILE line as described on the <a href='import-mt.php'>previous page</a> to continue."); - + // FIXME: Don't die + if ('' == RSSFILE) + die("You must edit the RSSFILE line as described on the <a href='import-mt.php'>previous page</a> to continue."); + + if (!file_exists(RSSFILE)) + die("The file you specified does not seem to exist. Please check the path you've given."); + $this->get_posts(); $this->import_posts(); - echo '<h3>All done. <a href="../">Have fun!</a></h3>'; + echo '<h3>All done. <a href="' . get_option('home') . '">Have fun!</a></h3>'; } - + function dispatch() { - if (empty($_GET['step'])) + if (empty ($_GET['step'])) $step = 0; else $step = (int) $_GET['step']; + + $this->header(); switch ($step) { - case 0: + case 0 : $this->greet(); break; - case 1: + case 1 : $this->import(); break; } + + $this->footer(); } - + function RSS_Import() { // Nothing. } @@ -181,6 +170,5 @@ class RSS_Import { $rss_import = new RSS_Import(); -register_importer('rss', 'RSS', 'Import posts from and RSS feed', array($rss_import, 'dispatch')); - -?>
\ No newline at end of file +register_importer('rss', 'RSS', __('Import posts from an RSS feed'), array ($rss_import, 'dispatch')); +?> diff --git a/wp-inst/wp-admin/link-import.php b/wp-inst/wp-admin/link-import.php index 2ba8332..3066eb1 100644 --- a/wp-inst/wp-admin/link-import.php +++ b/wp-inst/wp-admin/link-import.php @@ -97,7 +97,7 @@ switch ($step) { } if (isset($opml_url) && $opml_url != '') { - $opml = implode('', file($opml_url)); + $opml = wp_remote_fopen($opml_url); include_once('link-parse-opml.php'); $link_count = count($names); diff --git a/wp-inst/wp-admin/list-manipulation.js b/wp-inst/wp-admin/list-manipulation.js index 1b1956b..38cc602 100644 --- a/wp-inst/wp-admin/list-manipulation.js +++ b/wp-inst/wp-admin/list-manipulation.js @@ -44,9 +44,9 @@ function removeThisItem(id) { if ( -1 == response ) { ajaxDel.myResponseElement.innerHTML = "You don't have permission to do that."; } else if ( 0 == response ) { ajaxDel.myResponseElement.interHTML = "Something odd happened. Try refreshing the page? Either that or what you tried to delete never existed in the first place."; } else if ( 1 == response ) { - item = document.getElementById(id); - Fat.fade_element(item.id,null,700,'#FF3333'); - setTimeout('item.parentNode.removeChild(item)', 705); + theItem = document.getElementById(id); + Fat.fade_element(id,null,700,'#FF3333'); + setTimeout('theItem.parentNode.removeChild(theItem)', 705); var pos = getListPos(id); listItems.splice(pos,1); recolorList(pos); diff --git a/wp-inst/wp-admin/options-personal.php b/wp-inst/wp-admin/options-personal.php index e8d8c2d..66e0f7f 100644 --- a/wp-inst/wp-admin/options-personal.php +++ b/wp-inst/wp-admin/options-personal.php @@ -10,6 +10,7 @@ include('admin-header.php'); <div class="wrap"> <h2><?php _e('Personal Options') ?></h2> <form id="personal-options" method="post" action="options-personal-update.php"> +<fieldset> <p><?php _e('Personal options are just for you, they don’t affect other users on blog.'); ?><input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'rich_editing'<?php do_action('personal_option_list'); ?>" /></p> <table width="100%" cellspacing="2" cellpadding="5" class="editform"> @@ -32,4 +33,4 @@ include('admin-header.php'); </p> </form> </div> -<?php include('admin-footer.php'); ?>
\ No newline at end of file +<?php include('admin-footer.php'); ?> diff --git a/wp-inst/wp-admin/post.php b/wp-inst/wp-admin/post.php index f44be1e..f22401a 100644 --- a/wp-inst/wp-admin/post.php +++ b/wp-inst/wp-admin/post.php @@ -92,7 +92,7 @@ case 'edit': break; case 'editpost': - edit_post(); + $post_ID = edit_post(); if ($_POST['save']) { $location = $_SERVER['HTTP_REFERER']; diff --git a/wp-inst/wp-content/themes/default/archive.php b/wp-inst/wp-content/themes/default/archive.php index b6f42d2..b9f346e 100644 --- a/wp-inst/wp-content/themes/default/archive.php +++ b/wp-inst/wp-content/themes/default/archive.php @@ -30,8 +30,8 @@ <div class="navigation"> - <div class="alignleft"><?php previous_posts_link('« Previous Entries') ?></div> - <div class="alignright"><?php next_posts_link('Next Entries »') ?></div> + <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> + <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> </div> <?php while (have_posts()) : the_post(); ?> @@ -50,8 +50,8 @@ <?php endwhile; ?> <div class="navigation"> - <div class="alignleft"><?php previous_posts_link('« Previous Entries') ?></div> - <div class="alignright"><?php next_posts_link('Next Entries »') ?></div> + <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> + <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> </div> <?php else : ?> diff --git a/wp-inst/wp-includes/capabilities.php b/wp-inst/wp-includes/capabilities.php index f1bd4b5..1943689 100644 --- a/wp-inst/wp-includes/capabilities.php +++ b/wp-inst/wp-includes/capabilities.php @@ -189,7 +189,7 @@ class WP_User { } function remove_cap($cap) { - if ( empty($this->roles[$cap]) ) return; + if ( empty($this->caps[$cap]) ) return; unset($this->caps[$cap]); update_usermeta($this->id, $this->cap_key, $this->caps); } diff --git a/wp-inst/wp-includes/classes.php b/wp-inst/wp-includes/classes.php index 770f848..3219462 100644 --- a/wp-inst/wp-includes/classes.php +++ b/wp-inst/wp-includes/classes.php @@ -1365,7 +1365,7 @@ class WP { // The requested permalink is in $pathinfo for path info requests and // $req_uri for other requests. - if (! empty($pathinfo)) { + if (! empty($pathinfo) && ($wp_rewrite->index != $pathinfo)) { $request = $pathinfo; } else { $request = $req_uri; diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php index e5ddbfd..b0167dd 100644 --- a/wp-inst/wp-includes/functions-post.php +++ b/wp-inst/wp-includes/functions-post.php @@ -154,7 +154,7 @@ function wp_insert_post($postarr = array()) { if ($post_status == 'publish') { do_action('publish_post', $post_ID); - if ($post_pingback) + if ($post_pingback && !defined('WP_IMPORTING')) $result = $wpdb->query(" INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index 8d486ff..d730d6a 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -370,7 +370,12 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false // thx Alex Stapleton, http://alex.vort-x.net/blog/ function add_option($name, $value = '', $description = '', $autoload = 'yes') { - global $wpdb; + global $wpdb, $cache_settings; + + // Make sure the option doesn't already exist + if ( isset($cache_settings->$name) ) + return; + $original = $value; if ( is_array($value) || is_object($value) ) $value = serialize($value); diff --git a/wp-inst/wp-includes/template-functions-author.php b/wp-inst/wp-includes/template-functions-author.php index 86aaa48..890e87b 100644 --- a/wp-inst/wp-includes/template-functions-author.php +++ b/wp-inst/wp-includes/template-functions-author.php @@ -2,7 +2,7 @@ function get_the_author($idmode = '') { global $authordata; - return $authordata->display_name; + return apply_filters('the_author', $authordata->display_name); } function the_author($idmode = '', $echo = true) { @@ -208,4 +208,4 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam } } -?>
\ No newline at end of file +?> diff --git a/wp-inst/wp-includes/template-functions-links.php b/wp-inst/wp-includes/template-functions-links.php index 224667e..3536e7b 100644 --- a/wp-inst/wp-includes/template-functions-links.php +++ b/wp-inst/wp-includes/template-functions-links.php @@ -179,7 +179,7 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') { } $location = get_settings('siteurl') . "/wp-admin/post.php?action=edit&post=$post->ID"; - echo "$before <a href=\"$location\">$link</a> $after"; + echo $before . "<a href=\"$location\">$link</a>" . $after; } function edit_comment_link($link = 'Edit This', $before = '', $after = '') { @@ -192,7 +192,7 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') { } $location = get_settings('siteurl') . "/wp-admin/post.php?action=editcomment&comment=$comment->comment_ID"; - echo "$before <a href='$location'>$link</a> $after"; + echo $before . "<a href='$location'>$link</a>" . $after; } // Navigation links @@ -437,9 +437,9 @@ function next_posts_link($label='Next Page »', $max_page=0) { if ( isset($max_num_pages) ) { $max_page = $max_num_pages; } else { - preg_match('#FROM (.*) GROUP BY#', $request, $matches); + preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); $fromwhere = $matches[1]; - $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere"); + $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); $max_page = $max_num_pages = ceil($numposts / $posts_per_page); } } @@ -479,9 +479,9 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx if (get_query_var('what_to_show') == 'posts') { if ( ! isset($max_num_pages) ) { - preg_match('#FROM (.*) GROUP BY#', $request, $matches); + preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); $fromwhere = $matches[1]; - $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere"); + $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); $max_num_pages = ceil($numposts / $posts_per_page); } } else { diff --git a/wp-inst/wp-rdf.php b/wp-inst/wp-rdf.php index 643ac13..a38d1ea 100644 --- a/wp-inst/wp-rdf.php +++ b/wp-inst/wp-rdf.php @@ -32,13 +32,13 @@ $more = 1; <?php do_action('rdf_header'); ?> <items> <rdf:Seq> - <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?> + <?php while (have_posts()): the_post(); ?> <rdf:li rdf:resource="<?php permalink_single_rss() ?>"/> - <?php $wp_items[] = $row; $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?> + <?php endwhile; ?> </rdf:Seq> </items> </channel> -<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?> +<?php rewind_posts(); while (have_posts()): the_post(); ?> <item rdf:about="<?php permalink_single_rss() ?>"> <title><?php the_title_rss() ?></title> <link><?php permalink_single_rss() ?></link> @@ -53,5 +53,5 @@ $more = 1; <?php endif; ?> <?php do_action('rdf_item'); ?> </item> -<?php } } ?> -</rdf:RDF>
\ No newline at end of file +<?php endwhile; ?> +</rdf:RDF> |
