summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-08-31 14:55:29 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-08-31 14:55:29 +0000
commitb764f60728be1d4e026f9d7ae618ab47e23322f8 (patch)
tree1f1b45c4f1c1cf027b3240f605346e56209be8ff /wp-includes
parentdad010666b767a1d06588d1d09c771c62f67c387 (diff)
downloadwordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.tar.gz
wordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.tar.xz
wordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.zip
WP Merge to rev #4147
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@729 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/author-template.php35
-rw-r--r--wp-includes/bookmark-template.php189
-rw-r--r--wp-includes/bookmark.php6
-rw-r--r--wp-includes/capabilities.php24
-rw-r--r--wp-includes/category-template.php4
-rw-r--r--wp-includes/classes.php70
-rw-r--r--wp-includes/comment-template.php14
-rw-r--r--wp-includes/comment.php28
-rw-r--r--wp-includes/cron.php2
-rw-r--r--wp-includes/default-filters.php27
-rw-r--r--wp-includes/deprecated.php18
-rw-r--r--wp-includes/feed.php14
-rw-r--r--wp-includes/formatting.php10
-rw-r--r--wp-includes/functions.php62
-rw-r--r--wp-includes/general-template.php94
-rw-r--r--wp-includes/js/autosave.js.php12
-rw-r--r--wp-includes/js/tinymce/wp-mce-help.php2
-rw-r--r--wp-includes/link-template.php64
-rw-r--r--wp-includes/pluggable.php48
-rw-r--r--wp-includes/post-template.php70
-rw-r--r--wp-includes/post.php30
-rw-r--r--wp-includes/query.php39
-rw-r--r--wp-includes/registration.php4
-rw-r--r--wp-includes/rewrite.php24
-rw-r--r--wp-includes/script-loader.php4
-rw-r--r--wp-includes/theme.php10
-rw-r--r--wp-includes/vars.php2
27 files changed, 510 insertions, 396 deletions
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php
index c52a17e..a98bc63 100644
--- a/wp-includes/author-template.php
+++ b/wp-includes/author-template.php
@@ -1,14 +1,15 @@
<?php
-function get_the_author($idmode = '') {
+function get_the_author($deprecated = '') {
global $authordata;
return apply_filters('the_author', $authordata->display_name);
}
-function the_author($idmode = '', $echo = true) {
- if ( $echo )
- echo get_the_author($idmode);
- return get_the_author($idmode);
+// Using echo = false is deprecated. Use get_the_author instead.
+function the_author($deprecated = '', $deprecated_echo = true) {
+ if ( $deprecated_echo )
+ echo get_the_author();
+ return get_the_author();
}
function get_the_author_description() {
@@ -80,6 +81,14 @@ function the_author_url() {
echo get_the_author_url();
}
+function the_author_link() {
+ if (get_the_author_url()) {
+ echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
+ } else {
+ the_author();
+ }
+}
+
function get_the_author_icq() {
global $authordata;
return $authordata->icq;
@@ -126,20 +135,20 @@ function the_author_posts() {
echo get_the_author_posts();
}
-/* the_author_posts_link() requires no get_, use get_author_link() */
-function the_author_posts_link($idmode='') {
+/* the_author_posts_link() requires no get_, use get_author_posts_url() */
+function the_author_posts_link($deprecated = '') {
global $authordata;
- echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(the_author($idmode, false))) . '">' . the_author($idmode, false) . '</a>';
+ echo '<a href="' . get_author_posts_url($authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(get_the_author())) . '">' . get_the_author() . '</a>';
}
-function get_author_link($echo = false, $author_id, $author_nicename = '') {
+function get_author_posts_url($author_id, $author_nicename = '') {
global $wpdb, $wp_rewrite, $post, $cache_userdata;
$auth_ID = $author_id;
$link = $wp_rewrite->get_author_permastruct();
if ( empty($link) ) {
- $file = get_settings('home') . '/';
+ $file = get_option('home') . '/';
$link = $file . '?author=' . $auth_ID;
} else {
if ( '' == $author_nicename ) {
@@ -148,13 +157,11 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
$author_nicename = $user->user_nicename;
}
$link = str_replace('%author%', $author_nicename, $link);
- $link = get_settings('home') . trailingslashit($link);
+ $link = get_option('home') . trailingslashit($link);
}
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
- if ( $echo )
- echo $link;
return $link;
}
@@ -195,7 +202,7 @@ function wp_list_authors($args = '') {
if ( !$hide_empty )
$link = $name;
} else {
- $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
+ $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' ';
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 1e762e0..da3626b 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -20,17 +20,17 @@ function wp_get_links($args = '') {
parse_str($args);
- if (! isset($category)) $category = -1;
- if (! isset($before)) $before = '';
- if (! isset($after)) $after = '<br />';
- if (! isset($between)) $between = ' ';
- if (! isset($show_images)) $show_images = true;
- if (! isset($orderby)) $orderby = 'name';
- if (! isset($show_description)) $show_description = true;
- if (! isset($show_rating)) $show_rating = false;
- if (! isset($limit)) $limit = -1;
- if (! isset($show_updated)) $show_updated = 1;
- if (! isset($echo)) $echo = true;
+ if ( !isset($category) ) $category = -1;
+ if ( !isset($before) ) $before = '';
+ if ( !isset($after) ) $after = '<br />';
+ if ( !isset($between) ) $between = ' ';
+ if ( !isset($show_images) ) $show_images = true;
+ if ( !isset($orderby) ) $orderby = 'name';
+ if ( !isset($show_description) ) $show_description = true;
+ if ( !isset($show_rating) ) $show_rating = false;
+ if ( !isset($limit) ) $limit = -1;
+ if ( !isset($show_updated) ) $show_updated = 1;
+ if ( !isset($echo) ) $echo = true;
return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo);
} // end wp_get_links
@@ -73,89 +73,76 @@ function get_links($category = -1,
global $wpdb;
$order = 'ASC';
- if (substr($orderby, 0, 1) == '_') {
+ if ( substr($orderby, 0, 1) == '_' ) {
$order = 'DESC';
$orderby = substr($orderby, 1);
}
-
- if ($category == -1) { //get_bookmarks uses '' to signify all categories
+
+ if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
$category = '';
- }
$results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit");
- if (!$results) {
+ if ( !$results )
return;
- }
-
$output = '';
- foreach ($results as $row) {
- if (!isset($row->recently_updated)) $row->recently_updated = false;
- $output .= $before;
- if ($show_updated && $row->recently_updated) {
- $output .= get_settings('links_recently_updated_prepend');
- }
-
+ foreach ( (array) $results as $row ) {
+ if ( !isset($row->recently_updated) )
+ $row->recently_updated = false;
+ $output .= $before;
+ if ( $show_updated && $row->recently_updated )
+ $output .= get_option('links_recently_updated_prepend');
$the_link = '#';
- if (!empty($row->link_url))
+ if ( !empty($row->link_url) )
$the_link = wp_specialchars($row->link_url);
-
$rel = $row->link_rel;
- if ($rel != '') {
+ if ( '' != $rel )
$rel = ' rel="' . $rel . '"';
- }
$desc = wp_specialchars($row->link_description, ENT_QUOTES);
$name = wp_specialchars($row->link_name, ENT_QUOTES);
$title = $desc;
- if ($show_updated) {
- if (substr($row->link_updated_f, 0, 2) != '00') {
- $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')';
- }
- }
+ if ( $show_updated )
+ if (substr($row->link_updated_f, 0, 2) != '00')
+ $title .= ' (Last updated ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
- if ('' != $title) {
+ if ( '' != $title )
$title = ' title="' . $title . '"';
- }
$alt = ' alt="' . $name . '"';
$target = $row->link_target;
- if ('' != $target) {
+ if ( '' != $target )
$target = ' target="' . $target . '"';
- }
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
- if (($row->link_image != null) && $show_images) {
- if (strstr($row->link_image, 'http'))
+ if ( $row->link_image != null && $show_images ) {
+ if ( strpos($row->link_image, 'http') !== false )
$output .= "<img src=\"$row->link_image\" $alt $title />";
else // If it's a relative path
- $output .= "<img src=\"" . get_settings('siteurl') . "$row->link_image\" $alt $title />";
+ $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
} else {
$output .= $name;
}
$output .= '</a>';
- if ($show_updated && $row->recently_updated) {
- $output .= get_settings('links_recently_updated_append');
- }
+ if ( $show_updated && $row->recently_updated )
+ $output .= get_option('links_recently_updated_append');
- if ($show_description && ($desc != '')) {
+ if ( $show_description && '' != $desc )
$output .= $between . $desc;
- }
+
$output .= "$after\n";
} // end while
- if ($echo) {
- echo $output;
- } else {
+ if ( !$echo )
return $output;
- }
+ echo $output;
}
function get_linkrating($link) {
@@ -170,9 +157,9 @@ function get_linkrating($link) {
function get_linkcatname($id = 0) {
$id = (int) $id;
- if ( empty($id) )
- return '';
-
+ if ( empty($id) )
+ return '';
+
$cats = wp_get_link_cats($id);
if ( empty($cats) || ! is_array($cats) )
@@ -194,24 +181,18 @@ function get_linkcatname($id = 0) {
** file (default linkspopup.php) - the page to open in the popup window
** count (default true) - the number of links in the db
*/
-function links_popup_script($text = 'Links', $width=400, $height=400,
- $file='links.all.php', $count = true) {
- if ($count == true) {
- $counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links");
- }
-
- $javascript = "<a href=\"#\" " .
- " onclick=\"javascript:window.open('$file?popup=1', '_blank', " .
- "'width=$width,height=$height,scrollbars=yes,status=no'); " .
- " return false\">";
- $javascript .= $text;
-
- if ($count == true) {
- $javascript .= " ($counts)";
- }
-
- $javascript .="</a>\n\n";
- echo $javascript;
+function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
+ if ( $count )
+ $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
+
+ $javascript = "<a href=\"#\" onclick=\"javascript:window.open('$file?popup=1', '_blank', 'width=$width,height=$height,scrollbars=yes,status=no'); return false\">";
+ $javascript .= $text;
+
+ if ( $count )
+ $javascript .= " ($counts)";
+
+ $javascript .= "</a>\n\n";
+ echo $javascript;
}
@@ -233,25 +214,25 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
// Handle link category sorting
$direction = 'ASC';
- if (substr($order,0,1) == '_') {
+ if ( '_' == substr($order,0,1) ) {
$direction = 'DESC';
$order = substr($order,1);
}
- if (!isset($direction)) $direction = '';
+ if ( !isset($direction) )
+ $direction = '';
$cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");
// Display each category
- if ($cats) {
- foreach ($cats as $cat) {
+ if ( $cats ) {
+ foreach ( (array) $cats as $cat ) {
// Handle each category.
// Display the category name
echo ' <li id="linkcat-' . $cat->cat_ID . '"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n";
// Call get_links() with all the appropriate params
- get_links($cat->cat_ID,
- '<li>',"</li>","\n", true, 'name', false);
+ get_links($cat->cat_ID, '<li>', "</li>", "\n", true, 'name', false);
// Close the last category
echo "\n\t</ul>\n</li>\n";
@@ -271,62 +252,55 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
extract($r);
foreach ( (array) $bookmarks as $bookmark ) {
- if (!isset($bookmark->recently_updated)) $bookmark->recently_updated = false;
- $output .= $before;
- if ($show_updated && $bookmark->recently_updated) {
- $output .= get_settings('links_recently_updated_prepend');
- }
+ if ( !isset($bookmark->recently_updated) )
+ $bookmark->recently_updated = false;
+ $output .= $before;
+ if ( $show_updated && $bookmark->recently_updated )
+ $output .= get_option('links_recently_updated_prepend');
$the_link = '#';
- if (!empty($bookmark->link_url))
+ if ( !empty($bookmark->link_url) )
$the_link = wp_specialchars($bookmark->link_url);
$rel = $bookmark->link_rel;
- if ($rel != '') {
+ if ( '' != $rel )
$rel = ' rel="' . $rel . '"';
- }
$desc = wp_specialchars($bookmark->link_description, ENT_QUOTES);
$name = wp_specialchars($bookmark->link_name, ENT_QUOTES);
$title = $desc;
- if ($show_updated) {
- if (substr($bookmark->link_updated_f, 0, 2) != '00') {
- $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $bookmark->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')';
- }
- }
+ if ( $show_updated )
+ if ( '00' != substr($bookmark->link_updated_f, 0, 2) )
+ $title .= ' (Last updated ' . date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
- if ('' != $title) {
+ if ( '' != $title )
$title = ' title="' . $title . '"';
- }
$alt = ' alt="' . $name . '"';
$target = $bookmark->link_target;
- if ('' != $target) {
+ if ( '' != $target )
$target = ' target="' . $target . '"';
- }
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
- if (($bookmark->link_image != null) && $show_images) {
- if (strstr($bookmark->link_image, 'http'))
+ if ( $bookmark->link_image != null && $show_images ) {
+ if ( strpos($bookmark->link_image, 'http') !== false )
$output .= "<img src=\"$bookmark->link_image\" $alt $title />";
else // If it's a relative path
- $output .= "<img src=\"" . get_settings('siteurl') . "$bookmark->link_image\" $alt $title />";
+ $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
} else {
$output .= $name;
}
$output .= '</a>';
- if ($show_updated && $bookmark->recently_updated) {
- $output .= get_settings('links_recently_updated_append');
- }
+ if ( $show_updated && $bookmark->recently_updated )
+ $output .= get_option('links_recently_updated_append');
- if ($show_description && ($desc != '')) {
+ if ( $show_description && '' != $desc )
$output .= $between . $desc;
- }
$output .= "$after\n";
} // end while
@@ -345,10 +319,10 @@ function wp_list_bookmarks($args = '') {
'category_orderby' => 'name', 'category_order' => 'ASC');
$r = array_merge($defaults, $r);
extract($r);
-
+
// TODO: The rest of it.
// If $categorize, group links by category with the category name being the
- // title of each li, otherwise just list them with title_li as the li title.
+ // title of each li, otherwise just list them with title_li as the li title.
// If $categorize and $category or $category_name, list links for the given category
// with the category name as the title li. If not $categorize, use title_li.
// When using each category's name as a title li, use before and after args for specifying
@@ -369,10 +343,9 @@ function wp_list_bookmarks($args = '') {
}
}
- if ($echo)
- echo $output;
-
- return $output;
+ if ( !$echo )
+ return $output;
+ echo $output;
}
?>
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php
index 350d91e..306a33f 100644
--- a/wp-includes/bookmark.php
+++ b/wp-includes/bookmark.php
@@ -91,8 +91,8 @@ function get_bookmarks($args = '') {
$join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
}
- if (get_settings('links_recently_updated_time')) {
- $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_settings('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated ";
+ if (get_option('links_recently_updated_time')) {
+ $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_option('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated ";
} else {
$recently_updated_test = '';
}
@@ -131,4 +131,4 @@ function get_bookmarks($args = '') {
return apply_filters('get_bookmarks', $results, $r);
}
-?> \ No newline at end of file
+?>
diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 3e85e4f..b2d2662 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -6,6 +6,7 @@ class WP_Roles {
var $role_objects = array();
var $role_names = array();
var $role_key;
+ var $use_db = true;
function WP_Roles() {
$this->_init();
@@ -13,9 +14,14 @@ class WP_Roles {
function _init () {
global $wpdb;
+ global $wp_user_roles;
$this->role_key = $wpdb->prefix . 'user_roles';
-
- $this->roles = get_option($this->role_key);
+ if ( ! empty($wp_user_roles) ) {
+ $this->roles = $wp_user_roles;
+ $this->use_db = false;
+ } else {
+ $this->roles = get_option($this->role_key);
+ }
if ( empty($this->roles) )
return;
@@ -35,7 +41,8 @@ class WP_Roles {
$this->roles[$role] = array(
'name' => $display_name,
'capabilities' => $capabilities);
- update_option($this->role_key, $this->roles);
+ if ( $this->use_db )
+ update_option($this->role_key, $this->roles);
$this->role_objects[$role] = new WP_Role($role, $capabilities);
$this->role_names[$role] = $display_name;
return $this->role_objects[$role];
@@ -48,18 +55,21 @@ class WP_Roles {
unset($this->role_objects[$role]);
unset($this->role_names[$role]);
unset($this->roles[$role]);
-
- update_option($this->role_key, $this->roles);
+
+ if ( $this->use_db )
+ update_option($this->role_key, $this->roles);
}
function add_cap($role, $cap, $grant = true) {
$this->roles[$role]['capabilities'][$cap] = $grant;
- update_option($this->role_key, $this->roles);
+ if ( $this->use_db )
+ update_option($this->role_key, $this->roles);
}
function remove_cap($role, $cap) {
unset($this->roles[$role]['capabilities'][$cap]);
- update_option($this->role_key, $this->roles);
+ if ( $this->use_db )
+ update_option($this->role_key, $this->roles);
}
function &get_role($role) {
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 0ca0e62..2c7db3a 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -23,7 +23,7 @@ function get_category_link($category_id) {
$catlink = $wp_rewrite->get_category_permastruct();
if ( empty($catlink) ) {
- $file = get_settings('home') . '/';
+ $file = get_option('home') . '/';
$catlink = $file . '?cat=' . $category_id;
} else {
$category = &get_category($category_id);
@@ -33,7 +33,7 @@ function get_category_link($category_id) {
$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/';
$catlink = str_replace('%category%', $category_nicename, $catlink);
- $catlink = get_settings('home') . trailingslashit($catlink);
+ $catlink = get_option('home') . trailingslashit($catlink);
}
return apply_filters('category_link', $catlink, $category_id);
}
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index f2d823f..bf6caba 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -8,7 +8,7 @@ class retrospam_mgr {
function retrospam_mgr() {
global $wpdb;
- $list = explode("\n", get_settings('moderation_keys') );
+ $list = explode("\n", get_option('moderation_keys') );
$list = array_unique( $list );
$this->spam_words = $list;
@@ -94,7 +94,9 @@ class WP {
$this->query_vars = array();
- if (! empty($extra_query_vars))
+ if ( is_array($extra_query_vars) )
+ $this->extra_query_vars = & $extra_query_vars;
+ else if (! empty($extra_query_vars))
parse_str($extra_query_vars, $this->extra_query_vars);
// Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
@@ -114,7 +116,7 @@ class WP {
$req_uri_array = explode('?', $req_uri);
$req_uri = $req_uri_array[0];
$self = $_SERVER['PHP_SELF'];
- $home_path = parse_url(get_settings('home'));
+ $home_path = parse_url(get_option('home'));
$home_path = $home_path['path'];
$home_path = trim($home_path, '/');
@@ -212,19 +214,20 @@ class WP {
$this->query_vars[$wpvar] = $_GET[$wpvar];
elseif (!empty($perma_query_vars[$wpvar]))
$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
- else
- $this->query_vars[$wpvar] = '';
}
- for ($i=0; $i<count($this->private_query_vars); $i += 1) {
- $wpvar = $this->private_query_vars[$i];
- if (isset($this->extra_query_vars[$wpvar]))
- $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
+ foreach ($this->private_query_vars as $var) {
+ if (isset($this->extra_query_vars[$var]))
+ $this->query_vars[$var] = $this->extra_query_vars[$var];
+ elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var])
+ $this->query_vars[$var] = $GLOBALS[$var];
}
if ( isset($error) )
$this->query_vars['error'] = $error;
+ $this->query_vars = apply_filters('request', $this->query_vars);
+
do_action('parse_request', array(&$this));
}
@@ -272,7 +275,6 @@ class WP {
function build_query_string() {
$this->query_string = '';
-
foreach (array_keys($this->query_vars) as $wpvar) {
if ( '' != $this->query_vars[$wpvar] ) {
$this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
@@ -280,14 +282,12 @@ class WP {
}
}
- foreach ($this->private_query_vars as $wpvar) {
- if (isset($GLOBALS[$wpvar]) && '' != $GLOBALS[$wpvar] && ! isset($this->extra_query_vars[$wpvar]) ) {
- $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
- $this->query_string .= $wpvar . '=' . rawurlencode($GLOBALS[$wpvar]);
- }
+ // query_string filter deprecated. Use request filter instead.
+ global $wp_filter;
+ if ( isset($wp_filter['query_string']) ) { // Don't bother filtering and parsing if no plugins are hooked in.
+ $this->query_string = apply_filters('query_string', $this->query_string);
+ parse_str($this->query_string, $this->query_vars);
}
-
- $this->query_string = apply_filters('query_string', $this->query_string);
}
function register_globals() {
@@ -314,7 +314,7 @@ class WP {
function query_posts() {
$this->build_query_string();
- query_posts($this->query_string);
+ query_posts($this->query_vars);
}
function handle_404() {
@@ -348,10 +348,16 @@ class WP {
class WP_Error {
var $errors = array();
+ var $error_data = array();
+
+ function WP_Error($code = '', $message = '', $data = '') {
+ if ( empty($code) )
+ return;
+
+ $this->errors[$code][] = $message;
- function WP_Error($code = '', $message = '') {
- if ( ! empty($code) )
- $this->errors[$code][] = $message;
+ if ( ! empty($data) )
+ $this->error_data[$code] = $data;
}
function get_error_codes() {
@@ -395,8 +401,26 @@ class WP_Error {
return $messages[0];
}
- function add($code, $message) {
- $this->errors[$code][] = $message;
+ function get_error_data($code = '') {
+ if ( empty($code) )
+ $code = $this->get_error_code();
+
+ if ( isset($this->error_data[$code]) )
+ return $this->error_data[$code];
+ return null;
+ }
+
+ function add($code, $message, $data = '') {
+ $this->errors[$code][] = $message;
+ if ( ! empty($data) )
+ $this->error_data[$code] = $data;
+ }
+
+ function add_data($data, $code = '') {
+ if ( empty($code) )
+ $code = $this->get_error_code();
+
+ $this->error_data[$code] = $data;
}
}
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 1172bdf..8e8d457 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -90,7 +90,7 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
function get_comment_date( $d = '' ) {
global $comment;
if ( '' == $d )
- $date = mysql2date( get_settings('date_format'), $comment->comment_date);
+ $date = mysql2date( get_option('date_format'), $comment->comment_date);
else
$date = mysql2date($d, $comment->comment_date);
return apply_filters('get_comment_date', $date);
@@ -187,7 +187,7 @@ function get_comment_time( $d = '', $gmt = false ) {
global $comment;
$comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
if ( '' == $d )
- $date = mysql2date(get_settings('time_format'), $comment_date);
+ $date = mysql2date(get_option('time_format'), $comment_date);
else
$date = mysql2date($d, $comment_date);
return apply_filters('get_comment_time', $date);
@@ -222,9 +222,9 @@ function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pin
function get_trackback_url() {
global $id;
- $tb_url = get_settings('siteurl') . '/wp-trackback.php?p=' . $id;
+ $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
- if ( '' != get_settings('permalink_structure') )
+ if ( '' != get_option('permalink_structure') )
$tb_url = trailingslashit(get_permalink()) . 'trackback/';
return $tb_url;
@@ -276,7 +276,7 @@ function comments_template( $file = '/comments.php' ) {
if ( ! (is_single() || is_page() || $withcomments) )
return;
- $req = get_settings('require_name_email');
+ $req = get_option('require_name_email');
$commenter = wp_get_current_commenter();
extract($commenter);
@@ -334,9 +334,9 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com
echo '<a href="';
if ($wpcommentsjavascript) {
if ( empty($wpcommentspopupfile) )
- $home = get_settings('home');
+ $home = get_option('home');
else
- $home = get_settings('siteurl');
+ $home = get_option('siteurl');
echo $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id;
echo '" onclick="wpopen(this.href); return false"';
} else { // if comments_popup_script() is not in the template, display simple comment link
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 69ff8a9..514197f 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -3,12 +3,12 @@
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
global $wpdb;
- if (1 == get_settings('comment_moderation')) return false; // If moderation is set to manual
+ if (1 == get_option('comment_moderation')) return false; // If moderation is set to manual
- if ( (count(explode('http:', $comment)) - 1) >= get_settings('comment_max_links') )
+ if ( (count(explode('http:', $comment)) - 1) >= get_option('comment_max_links') )
return false; // Check # of external links
- $mod_keys = trim( get_settings('moderation_keys') );
+ $mod_keys = trim( get_option('moderation_keys') );
if ( !empty($mod_keys) ) {
$words = explode("\n", $mod_keys );
@@ -33,7 +33,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
}
// Comment whitelisting:
- if ( 1 == get_settings('comment_whitelist')) {
+ if ( 1 == get_option('comment_whitelist')) {
if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll
$uri = parse_url($url);
$domain = $uri['host'];
@@ -124,7 +124,7 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
function get_lastcommentmodified($timezone = 'server') {
global $cache_lastcommentmodified, $pagenow, $wpdb;
- $add_seconds_blog = get_settings('gmt_offset') * 3600;
+ $add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastcommentmodified[$timezone]) ) {
@@ -233,7 +233,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
}
}
- $mod_keys = trim( get_settings('blacklist_keys') );
+ $mod_keys = trim( get_option('blacklist_keys') );
if ('' == $mod_keys )
return false; // If moderation keys are empty
$words = explode("\n", $mod_keys );
@@ -386,7 +386,7 @@ function wp_new_comment( $commentdata ) {
$post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
- if ( get_settings('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
+ if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
}
@@ -553,7 +553,7 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
$pingback_href_end = @strpos($contents, $quote, $pingback_href_start);
$pingback_server_url_len = $pingback_href_end - $pingback_href_start;
$pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
- // We may find rel="pingback" but an incomplete pingback URI
+ // We may find rel="pingback" but an incomplete pingback URL
if ($pingback_server_url_len > 0) {
// We got it!
return $pingback_server_url;
@@ -616,7 +616,7 @@ function do_trackbacks($post_id) {
$excerpt = str_replace(']]>', ']]&gt;', $excerpt);
$excerpt = strip_tags($excerpt);
if ( function_exists('mb_strcut') ) // For international trackbacks
- $excerpt = mb_strcut($excerpt, 0, 252, get_settings('blog_charset')) . '...';
+ $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...';
else
$excerpt = substr($excerpt, 0, 252) . '...';
@@ -635,7 +635,7 @@ function do_trackbacks($post_id) {
}
function generic_ping($post_id = 0) {
- $services = get_settings('ping_sites');
+ $services = get_option('ping_sites');
$services = preg_replace("|(\s)+|", '$1', $services); // Kill dupe lines
$services = trim($services);
if ( '' != $services ) {
@@ -745,14 +745,14 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
$title = urlencode($title);
$excerpt = urlencode($excerpt);
- $blog_name = urlencode(get_settings('blogname'));
+ $blog_name = urlencode(get_option('blogname'));
$tb_url = $trackback_url;
$url = urlencode(get_permalink($ID));
$query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt";
$trackback_url = parse_url($trackback_url);
$http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?'.$trackback_url['query'] : '') . " HTTP/1.0\r\n";
$http_request .= 'Host: '.$trackback_url['host']."\r\n";
- $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_settings('blog_charset')."\r\n";
+ $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n";
$http_request .= 'Content-Length: '.strlen($query_string)."\r\n";
$http_request .= "User-Agent: WordPress/" . $wp_version;
$http_request .= "\r\n\r\n";
@@ -790,8 +790,8 @@ function weblog_ping($server = '', $path = '') {
// when set to true, this outputs debug messages by itself
$client->debug = false;
$home = trailingslashit( get_option('home') );
- if ( !$client->query('weblogUpdates.extendedPing', get_settings('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
- $client->query('weblogUpdates.ping', get_settings('blogname'), $home);
+ if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
+ $client->query('weblogUpdates.ping', get_option('blogname'), $home);
}
?>
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index 116a24a..6f3d6b0 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -80,7 +80,7 @@ function spawn_cron() {
if ( array_shift( $keys ) > time() )
return;
- $cron_url = get_settings( 'siteurl' ) . '/wp-cron.php';
+ $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
$parts = parse_url( $cron_url );
$argyle = @ fsockopen( $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01 );
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 2cdd211..61afd0a 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -55,6 +55,31 @@ add_filter('pre_category_name', 'wp_filter_kses');
add_filter('pre_category_name', 'wp_specialchars', 30);
add_filter('pre_category_description', 'wp_filter_kses');
+//Links
+add_filter('pre_link_name', 'strip_tags');
+add_filter('pre_link_name', 'trim');
+add_filter('pre_link_name', 'wp_filter_kses');
+add_filter('pre_link_name', 'wp_specialchars', 30);
+add_filter('pre_link_description', 'wp_filter_kses');
+add_filter('pre_link_notes', 'wp_filter_kses');
+add_filter('pre_link_url', 'strip_tags');
+add_filter('pre_link_url', 'trim');
+add_filter('pre_link_url', 'clean_url');
+add_filter('pre_link_image', 'strip_tags');
+add_filter('pre_link_image', 'trim');
+add_filter('pre_link_image', 'clean_url');
+add_filter('pre_link_rss', 'strip_tags');
+add_filter('pre_link_rss', 'trim');
+add_filter('pre_link_rss', 'clean_url');
+add_filter('pre_link_target', 'strip_tags');
+add_filter('pre_link_target', 'trim');
+add_filter('pre_link_target', 'wp_filter_kses');
+add_filter('pre_link_target', 'wp_specialchars', 30);
+add_filter('pre_link_rel', 'strip_tags');
+add_filter('pre_link_rel', 'trim');
+add_filter('pre_link_rel', 'wp_filter_kses');
+add_filter('pre_link_rel', 'wp_specialchars', 30);
+
// Users
add_filter('pre_user_display_name', 'strip_tags');
add_filter('pre_user_display_name', 'trim');
@@ -115,6 +140,7 @@ add_filter('the_author', 'ent2ncr', 8);
// Misc filters
add_filter('option_ping_sites', 'privacy_ping_filter');
+add_filter('option_blog_charset', 'wp_specialchars');
// Actions
add_action('wp_head', 'rsd_link');
@@ -130,4 +156,5 @@ add_action('do_feed_atom', 'do_feed_atom', 10, 1);
add_action('do_pings', 'do_all_pings', 10, 1);
add_action('do_robots', 'do_robots');
add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
+add_action('admin_print_scripts', 'wp_print_scripts', 20);
?>
diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php
index bd8d21a..b75e07a 100644
--- a/wp-includes/deprecated.php
+++ b/wp-includes/deprecated.php
@@ -477,4 +477,22 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
return wp_get_archives($args);
}
+// Deprecated. Use get_author_posts_url().
+function get_author_link($echo = false, $author_id, $author_nicename = '') {
+ $link = get_author_posts_url($author_id, $author_nicename);
+
+ if ( $echo )
+ echo $link;
+ return $link;
+}
+
+function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
+ $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
+ return wp_link_pages($args);
+}
+
+function get_settings($option) {
+ return get_option($option);
+}
+
?>
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index c406b7b..fd8b8a0 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -87,20 +87,20 @@ function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '
function comments_rss($commentsrssfilename = '') {
global $id;
- if ('' != get_settings('permalink_structure'))
+ if ('' != get_option('permalink_structure'))
$url = trailingslashit( get_permalink() ) . 'feed/';
else
- $url = get_settings('home') . "/$commentsrssfilename?feed=rss2&amp;p=$id";
+ $url = get_option('home') . "/$commentsrssfilename?feed=rss2&amp;p=$id";
return apply_filters('post_comments_feed_link', $url);
}
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
$auth_ID = $author_id;
- $permalink_structure = get_settings('permalink_structure');
+ $permalink_structure = get_option('permalink_structure');
if ('' == $permalink_structure) {
- $link = get_settings('home') . '?feed=rss2&amp;author=' . $author_id;
+ $link = get_option('home') . '?feed=rss2&amp;author=' . $author_id;
} else {
$link = get_author_link(0, $author_id, $author_nicename);
$link = $link . "feed/";
@@ -113,10 +113,10 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) {
}
function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
- $permalink_structure = get_settings('permalink_structure');
+ $permalink_structure = get_option('permalink_structure');
if ('' == $permalink_structure) {
- $link = get_settings('home') . '?feed=rss2&amp;cat=' . $cat_ID;
+ $link = get_option('home') . '?feed=rss2&amp;cat=' . $cat_ID;
} else {
$link = get_category_link($cat_ID);
$link = $link . "feed/";
@@ -161,4 +161,4 @@ function rss_enclosure() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index f027869..1be7f1e 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -598,7 +598,7 @@ function wp_rel_nofollow( $text ) {
global $wpdb;
// This is a pre save filter, so text is already escaped.
$text = stripslashes($text);
- $text = preg_replace('|<a (.+?)>|i', '<a $1 rel="nofollow">', $text);
+ $text = preg_replace('|<a (.+?)>|ie', "'<a ' . str_replace(' rel=\"nofollow\"','',stripslashes('$1')) . ' rel=\"nofollow\">'", $text);
$text = $wpdb->escape($text);
return $text;
}
@@ -606,7 +606,7 @@ function wp_rel_nofollow( $text ) {
function convert_smilies($text) {
global $wp_smiliessearch, $wp_smiliesreplace;
$output = '';
- if (get_settings('use_smilies')) {
+ if (get_option('use_smilies')) {
// HTML loop taken from texturize function, could possible be consolidated
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop = count($textarr);// loop stuff
@@ -656,7 +656,7 @@ function get_gmt_from_date($string) {
// note: this only substracts $time_difference from the given date
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
- $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_settings('gmt_offset') * 3600);
+ $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600);
return $string_gmt;
}
@@ -665,7 +665,7 @@ function get_date_from_gmt($string) {
// note: this only adds $time_difference to the given date
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
- $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_settings('gmt_offset')*3600);
+ $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600);
return $string_localtime;
}
@@ -690,7 +690,7 @@ function iso8601_to_datetime($date_string, $timezone = USER) {
if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
$offset = iso8601_timezone_to_offset($date_bits[7]);
} else { // we don't have a timezone, so we assume user local timezone (not server's!)
- $offset = 3600 * get_settings('gmt_offset');
+ $offset = 3600 * get_option('gmt_offset');
}
$timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
$timestamp -= $offset;
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 8719f7e..68e9427 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -45,12 +45,12 @@ function current_time($type, $gmt = 0) {
switch ($type) {
case 'mysql':
if ( $gmt ) $d = gmdate('Y-m-d H:i:s');
- else $d = gmdate('Y-m-d H:i:s', (time() + (get_settings('gmt_offset') * 3600)));
+ else $d = gmdate('Y-m-d H:i:s', (time() + (get_option('gmt_offset') * 3600)));
return $d;
break;
case 'timestamp':
if ( $gmt ) $d = time();
- else $d = time() + (get_settings('gmt_offset') * 3600);
+ else $d = time() + (get_option('gmt_offset') * 3600);
return $d;
break;
}
@@ -88,13 +88,13 @@ function get_weekstartend($mysqlstring, $start_of_week) {
$weekday = date('w',$day);
$i = 86400;
- if ( $weekday < get_settings('start_of_week') )
- $weekday = 7 - (get_settings('start_of_week') - $weekday);
+ if ( $weekday < get_option('start_of_week') )
+ $weekday = 7 - (get_option('start_of_week') - $weekday);
- while ($weekday > get_settings('start_of_week')) {
+ while ($weekday > get_option('start_of_week')) {
$weekday = date('w',$day);
- if ( $weekday < get_settings('start_of_week') )
- $weekday = 7 - (get_settings('start_of_week') - $weekday);
+ if ( $weekday < get_option('start_of_week') )
+ $weekday = 7 - (get_option('start_of_week') - $weekday);
$day = $day - 86400;
$i = 0;
@@ -107,7 +107,7 @@ function get_weekstartend($mysqlstring, $start_of_week) {
function get_lastpostdate($timezone = 'server') {
global $cache_lastpostdate, $pagenow, $wpdb;
- $add_seconds_blog = get_settings('gmt_offset') * 3600;
+ $add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
if ( !isset($cache_lastpostdate[$timezone]) ) {
switch(strtolower($timezone)) {
@@ -130,7 +130,7 @@ function get_lastpostdate($timezone = 'server') {
function get_lastpostmodified($timezone = 'server') {
global $cache_lastpostmodified, $pagenow, $wpdb;
- $add_seconds_blog = get_settings('gmt_offset') * 3600;
+ $add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
if ( !isset($cache_lastpostmodified[$timezone]) ) {
switch(strtolower($timezone)) {
@@ -174,7 +174,7 @@ function is_switched( $setting = 'N/A' ) {
}
-function get_settings($setting) {
+function get_option($setting) {
global $wpdb, $switched, $current_blog;
if ( is_switched() == false ) {
@@ -211,7 +211,7 @@ function get_settings($setting) {
// If home is not set use siteurl.
if ( 'home' == $setting && '' == $value )
- return get_settings('siteurl');
+ return get_option('siteurl');
if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
$value = preg_replace('|/+$|', '', $value);
@@ -221,12 +221,8 @@ function get_settings($setting) {
return apply_filters( 'option_' . $setting, maybe_unserialize($value) );
}
-function get_option($option) {
- return get_settings($option);
-}
-
function form_option($option) {
- echo htmlspecialchars( get_option($option), ENT_QUOTES );
+ echo wp_specialchars( get_option($option), 1 );
}
function get_alloptions() {
@@ -273,7 +269,7 @@ function update_option($option_name, $newvalue) {
if ( is_array($newvalue) || is_object($newvalue) )
$newvalue = serialize($newvalue);
- wp_cache_delete($option_name, 'options');
+ wp_cache_set($option_name, $newvalue, 'options');
$newvalue = $wpdb->escape($newvalue);
$option_name = $wpdb->escape($option_name);
@@ -296,7 +292,7 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
if ( is_array($value) || is_object($value) )
$value = serialize($value);
- wp_cache_delete($name, 'options');
+ wp_cache_set($name, $value, 'options');
$name = $wpdb->escape($name);
$value = $wpdb->escape($value);
@@ -317,7 +313,7 @@ function delete_option($name) {
}
function gzip_compression() {
- if ( !get_settings('gzipcompression') ) return false;
+ if ( !get_option('gzipcompression') ) return false;
if ( extension_loaded('zlib') ) {
ob_start('ob_gzhandler');
@@ -351,7 +347,7 @@ function make_url_footnote($content) {
$link_url = $matches[2][$i];
$link_text = $matches[4][$i];
$content = str_replace($link_match, $link_text.' '.$link_number, $content);
- $link_url = ((strtolower(substr($link_url,0,7)) != 'http://') && (strtolower(substr($link_url,0,8)) != 'https://')) ? get_settings('home') . $link_url : $link_url;
+ $link_url = ((strtolower(substr($link_url,0,7)) != 'http://') && (strtolower(substr($link_url,0,8)) != 'https://')) ? get_option('home') . $link_url : $link_url;
$links_summary .= "\n".$link_number.' '.$link_url;
}
$content = strip_tags($content);
@@ -637,6 +633,11 @@ function add_query_arg() {
$uri = @func_get_arg(2);
}
+ if ( $frag = strstr($uri, '#') )
+ $uri = substr($uri, 0, -strlen($frag));
+ else
+ $frag = '';
+
if ( preg_match('|^https?://|i', $uri, $matches) ) {
$protocol = $matches[0];
$uri = substr($uri, strlen($protocol));
@@ -676,7 +677,7 @@ function add_query_arg() {
$ret .= "$k=$v";
}
}
- $ret = $protocol . $base . $ret;
+ $ret = $protocol . $base . $ret . $frag;
if ( get_magic_quotes_gpc() )
$ret = stripslashes($ret); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str
return trim($ret, '?');
@@ -768,6 +769,13 @@ function nocache_headers() {
@ header('Pragma: no-cache');
}
+function cache_javascript_headers() {
+ $expiresOffset = 864000; // 10 days
+ header("Content-type: text/javascript; charset=" . get_bloginfo('charset'));
+ header("Vary: Accept-Encoding"); // Handle proxies
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
+}
+
function get_num_queries() {
global $wpdb;
return $wpdb->num_queries;
@@ -788,7 +796,7 @@ function do_feed() {
$feed = 'rss2';
$for_comments = false;
- if ( is_single() || (get_query_var('withcomments') == 1) ) {
+ if ( is_singular() || get_query_var('withcomments') == 1 || $feed == 'comments-rss2' ) {
$feed = 'rss2';
$for_comments = true;
}
@@ -901,9 +909,9 @@ function wp_mkdir_p($target) {
// Returns an array containing the current upload directory's path and url, or an error message.
function wp_upload_dir() {
- $siteurl = get_settings('siteurl');
+ $siteurl = get_option('siteurl');
//prepend ABSPATH to $dir and $siteurl to $url if they're not already there
- $path = str_replace(ABSPATH, '', trim(get_settings('upload_path')));
+ $path = str_replace(ABSPATH, '', trim(get_option('upload_path')));
$dir = ABSPATH . $path;
$url = trailingslashit($siteurl) . $path;
@@ -916,7 +924,7 @@ function wp_upload_dir() {
$url = trailingslashit($siteurl) . UPLOADS;
}
- if ( get_settings('uploads_use_yearmonth_folders')) {
+ if ( get_option('uploads_use_yearmonth_folders')) {
// Generate the yearly and monthly dirs
$time = current_time( 'mysql' );
$y = substr( $time, 0, 4 );
@@ -1121,7 +1129,7 @@ function wp_explain_nonce($action) {
function wp_nonce_ays($action) {
global $pagenow, $menu, $submenu, $parent_file, $submenu_file;
- $adminurl = get_settings('siteurl') . '/wp-admin';
+ $adminurl = get_option('siteurl') . '/wp-admin';
if ( wp_get_referer() )
$adminurl = wp_get_referer();
@@ -1196,7 +1204,7 @@ function wp_die($message, $title = '') {
</style>
</head>
<body>
- <h1 id="logo"><img alt="WordPress" src="<?php echo get_settings('siteurl'); ?>/wp-admin/images/wordpress-logo.png" /></h1>
+ <h1 id="logo"><img alt="WordPress" src="<?php echo get_option('siteurl'); ?>/wp-admin/images/wordpress-logo.png" /></h1>
<p><?php echo $message; ?></p>
</body>
</html>
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 643aa06..34ed1c3 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -28,9 +28,9 @@ function get_sidebar() {
function wp_loginout() {
if ( ! is_user_logged_in() )
- $link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>';
+ $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Login') . '</a>';
else
- $link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>';
+ $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>';
echo apply_filters('loginout', $link);
}
@@ -39,12 +39,12 @@ function wp_loginout() {
function wp_register( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
- if ( get_settings('users_can_register') )
- $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
+ if ( get_option('users_can_register') )
+ $link = $before . '<a href="' . get_option('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
else
$link = '';
} else {
- $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
+ $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
}
echo apply_filters('register', $link);
@@ -75,13 +75,13 @@ function get_bloginfo($show='') {
case 'url' :
case 'home' :
case 'siteurl' :
- $output = get_settings('home');
+ $output = get_option('home');
break;
case 'wpurl' :
- $output = get_settings('siteurl');
+ $output = get_option('siteurl');
break;
case 'description':
- $output = get_settings('blogdescription');
+ $output = get_option('blogdescription');
break;
case 'rdf_url':
$output = get_feed_link('rdf');
@@ -99,7 +99,7 @@ function get_bloginfo($show='') {
$output = get_feed_link('comments_rss2');
break;
case 'pingback_url':
- $output = get_settings('siteurl') .'/xmlrpc.php';
+ $output = get_option('siteurl') .'/xmlrpc.php';
break;
case 'stylesheet_url':
$output = get_stylesheet_uri();
@@ -112,10 +112,10 @@ function get_bloginfo($show='') {
$output = get_template_directory_uri();
break;
case 'admin_email':
- $output = get_settings('admin_email');
+ $output = get_option('admin_email');
break;
case 'charset':
- $output = get_settings('blog_charset');
+ $output = get_option('blog_charset');
if ('' == $output) $output = 'UTF-8';
break;
case 'html_type' :
@@ -127,7 +127,7 @@ function get_bloginfo($show='') {
break;
case 'name':
default:
- $output = get_settings('blogname');
+ $output = get_option('blogname');
break;
}
return $output;
@@ -149,7 +149,7 @@ function wp_title($sep = '&raquo;', $display = true) {
if ( !empty($cat) ) {
// category exclusion
if ( !stristr($cat,'-') )
- $title = get_the_category_by_ID($cat);
+ $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
}
if ( !empty($category_name) ) {
if ( stristr($category_name,'/') ) {
@@ -160,6 +160,7 @@ function wp_title($sep = '&raquo;', $display = true) {
$category_name = $category_name[count($category_name)-2]; // there was a trailling slash
}
$title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'");
+ $title = apply_filters('single_cat_title', $title);
}
// If there's an author
@@ -230,7 +231,7 @@ function single_post_title($prefix = '', $display = true) {
function single_cat_title($prefix = '', $display = true ) {
$cat = intval( get_query_var('cat') );
if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
- $my_cat_name = get_the_category_by_ID($cat);
+ $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
if ( !empty($my_cat_name) ) {
if ( $display )
echo $prefix.strip_tags($my_cat_name);
@@ -308,13 +309,13 @@ function wp_get_archives($args = '') {
$archive_week_end_date_format = 'Y/m/d';
if ( !$archive_date_format_over_ride ) {
- $archive_day_date_format = get_settings('date_format');
- $archive_week_start_date_format = get_settings('date_format');
- $archive_week_end_date_format = get_settings('date_format');
+ $archive_day_date_format = get_option('date_format');
+ $archive_week_start_date_format = get_option('date_format');
+ $archive_week_end_date_format = get_option('date_format');
}
- $add_hours = intval(get_settings('gmt_offset'));
- $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
+ $add_hours = intval(get_option('gmt_offset'));
+ $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
if ( 'monthly' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
@@ -331,6 +332,21 @@ function wp_get_archives($args = '') {
echo get_archives_link($url, $text, $format, $before, $after);
}
}
+ } elseif ('yearly' == $type) {
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit);
+ if ($arcresults) {
+ $afterafter = $after;
+ foreach ($arcresults as $arcresult) {
+ $url = get_year_link($arcresult->year);
+ if ($show_post_count) {
+ $text = sprintf('%d', $arcresult->year);
+ $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
+ } else {
+ $text = sprintf('%d', $arcresult->year);
+ }
+ echo get_archives_link($url, $text, $format, $before, $after);
+ }
+ }
} elseif ( 'daily' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
if ( $arcresults ) {
@@ -342,7 +358,7 @@ function wp_get_archives($args = '') {
}
}
} elseif ( 'weekly' == $type ) {
- $start_of_week = get_settings('start_of_week');
+ $start_of_week = get_option('start_of_week');
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
$arc_w_last = '';
if ( $arcresults ) {
@@ -350,10 +366,10 @@ function wp_get_archives($args = '') {
if ( $arcresult->week != $arc_w_last ) {
$arc_year = $arcresult->yr;
$arc_w_last = $arcresult->week;
- $arc_week = get_weekstartend($arcresult->yyyymmdd, get_settings('start_of_week'));
+ $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
- $url = sprintf('%s/%s%sm%s%s%sw%s%d', get_settings('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
+ $url = sprintf('%s/%s%sm%s%s%sw%s%d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
echo get_archives_link($url, $text, $format, $before, $after);
}
@@ -400,9 +416,9 @@ function get_calendar($initial = true) {
$w = ''.intval($_GET['w']);
// week_begins = 0 stands for Sunday
- $week_begins = intval(get_settings('start_of_week'));
- $add_hours = intval(get_settings('gmt_offset'));
- $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
+ $week_begins = intval(get_option('start_of_week'));
+ $add_hours = intval(get_option('gmt_offset'));
+ $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
// Let's figure out when we are
if ( !empty($monthnum) && !empty($year) ) {
@@ -421,8 +437,8 @@ function get_calendar($initial = true) {
else
$thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
} else {
- $thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600);
- $thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600);
+ $thisyear = gmdate('Y', current_time('timestamp') + get_option('gmt_offset') * 3600);
+ $thismonth = gmdate('m', current_time('timestamp') + get_option('gmt_offset') * 3600);
}
$unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
@@ -542,7 +558,7 @@ function get_calendar($initial = true) {
echo "\n\t</tr>\n\t<tr>\n\t\t";
$newrow = false;
- if ( $day == gmdate('j', (time() + (get_settings('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_settings('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_settings('gmt_offset') * 3600)) )
+ if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )
echo '<td id="today">';
else
echo '<td>';
@@ -597,7 +613,7 @@ function the_date($d='', $before='', $after='', $echo = true) {
if ( $day != $previousday ) {
$the_date .= $before;
if ( $d=='' )
- $the_date .= mysql2date(get_settings('date_format'), $post->post_date);
+ $the_date .= mysql2date(get_option('date_format'), $post->post_date);
else
$the_date .= mysql2date($d, $post->post_date);
$the_date .= $after;
@@ -611,6 +627,20 @@ function the_date($d='', $before='', $after='', $echo = true) {
}
+function the_modified_date($d = '') {
+ echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
+}
+
+
+function get_the_modified_date($d = '') {
+ if ( '' == $d )
+ $the_time = get_post_modified_time(get_option('date_format'));
+ else
+ $the_time = get_post_modified_time($d);
+ return apply_filters('get_the_modified_date', $the_time, $d);
+}
+
+
function the_time( $d = '' ) {
echo apply_filters('the_time', get_the_time( $d ), $d);
}
@@ -618,7 +648,7 @@ function the_time( $d = '' ) {
function get_the_time( $d = '' ) {
if ( '' == $d )
- $the_time = get_post_time(get_settings('time_format'));
+ $the_time = get_post_time(get_option('time_format'));
else
$the_time = get_post_time($d);
return apply_filters('get_the_time', $the_time, $d);
@@ -644,7 +674,7 @@ function the_modified_time($d = '') {
function get_the_modified_time($d = '') {
if ( '' == $d )
- $the_time = get_post_modified_time(get_settings('time_format'));
+ $the_time = get_post_modified_time(get_option('time_format'));
else
$the_time = get_post_modified_time($d);
return apply_filters('get_the_modified_time', $the_time, $d);
@@ -712,7 +742,7 @@ function noindex() {
* @param string (optional) Previous form field's ID (for tabbing support)
*/
function the_editor($content, $id = 'content', $prev_id = 'title') {
- $rows = get_settings('default_post_edit_rows');
+ $rows = get_option('default_post_edit_rows');
if (($rows < 3) || ($rows > 100))
$rows = 12;
diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php
index f0c3520..4db6ff9 100644
--- a/wp-includes/js/autosave.js.php
+++ b/wp-includes/js/autosave.js.php
@@ -1,11 +1,5 @@
<?php @require_once('../../wp-config.php');
-$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires
-
-header("Content-type: text/javascript; charset: UTF-8");
-header("Vary: Accept-Encoding"); // Handle proxies
-header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
-
-
+cache_javascript_headers();
?>
var autosaveLast = '';
function autosave_timer() {
@@ -50,7 +44,7 @@ function autosave_update_post_ID() {
nonceAjax.setVar("post_ID", res);
nonceAjax.setVar("cookie", document.cookie);
nonceAjax.setVar("post_type", $('post_type').value);
- nonceAjax.requestFile = "<?php echo get_bloginfo('siteurl'); ?>/wp-admin/admin-ajax.php";
+ nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
nonceAjax.onCompletion = autosave_update_nonce;
nonceAjax.method = "POST";
nonceAjax.runAJAX();
@@ -119,7 +113,7 @@ function autosave() {
autosaveAjax.setVar("content", form.content.value);
}
- autosaveAjax.requestFile = "<?php echo get_bloginfo('siteurl'); ?>/wp-admin/admin-ajax.php";
+ autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
autosaveAjax.method = "POST";
autosaveAjax.element = null;
autosaveAjax.onLoading = autosave_loading;
diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php
index ffe385f..bdb5119 100644
--- a/wp-includes/js/tinymce/wp-mce-help.php
+++ b/wp-includes/js/tinymce/wp-mce-help.php
@@ -7,7 +7,7 @@ require_once('../../../wp-config.php');
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php _e('Rich Editor Help') ?></title>
-<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
+<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" />
<style type="text/css">
#wphead {
padding-top: 5px;
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 81f4d7c..965c4e4 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -47,7 +47,7 @@ function get_permalink($id = 0) {
elseif ($post->post_type == 'attachment')
return get_attachment_link($post->ID);
- $permalink = get_settings('permalink_structure');
+ $permalink = get_option('permalink_structure');
if ( '' != $permalink && 'draft' != $post->post_status ) {
$unixtime = strtotime($post->post_date);
@@ -77,9 +77,9 @@ function get_permalink($id = 0) {
$author,
$post->post_name,
);
- return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post);
+ return apply_filters('post_link', get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post);
} else { // if they're not using the fancy permalink option
- $permalink = get_settings('home') . '/?p=' . $post->ID;
+ $permalink = get_option('home') . '/?p=' . $post->ID;
return apply_filters('post_link', $permalink, $post);
}
}
@@ -100,13 +100,13 @@ function get_page_link($id = false) {
if ( '' != $pagestruct && 'draft' != $post->post_status ) {
$link = get_page_uri($id);
$link = str_replace('%pagename%', $link, $pagestruct);
- $link = get_settings('home') . "/$link/";
+ $link = get_option('home') . "/$link/";
} else {
- $link = get_settings('home') . "/?page_id=$id";
+ $link = get_option('home') . "/?page_id=$id";
}
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
- $link = get_settings('home');
+ $link = get_option('home');
return apply_filters('page_link', $link, $id);
}
@@ -138,56 +138,56 @@ function get_attachment_link($id = false) {
function get_year_link($year) {
global $wp_rewrite;
if ( !$year )
- $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
+ $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
$yearlink = $wp_rewrite->get_year_permastruct();
if ( !empty($yearlink) ) {
$yearlink = str_replace('%year%', $year, $yearlink);
- return apply_filters('year_link', get_settings('home') . trailingslashit($yearlink), $year);
+ return apply_filters('year_link', get_option('home') . trailingslashit($yearlink), $year);
} else {
- return apply_filters('year_link', get_settings('home') . '/?m=' . $year, $year);
+ return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year);
}
}
function get_month_link($year, $month) {
global $wp_rewrite;
if ( !$year )
- $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
+ $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
if ( !$month )
- $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
+ $month = gmdate('m', time()+(get_option('gmt_offset') * 3600));
$monthlink = $wp_rewrite->get_month_permastruct();
if ( !empty($monthlink) ) {
$monthlink = str_replace('%year%', $year, $monthlink);
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
- return apply_filters('month_link', get_settings('home') . trailingslashit($monthlink), $year, $month);
+ return apply_filters('month_link', get_option('home') . trailingslashit($monthlink), $year, $month);
} else {
- return apply_filters('month_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
+ return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
}
}
function get_day_link($year, $month, $day) {
global $wp_rewrite;
if ( !$year )
- $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
+ $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600));
if ( !$month )
- $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
+ $month = gmdate('m', time()+(get_option('gmt_offset') * 3600));
if ( !$day )
- $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600));
+ $day = gmdate('j', time()+(get_option('gmt_offset') * 3600));
$daylink = $wp_rewrite->get_day_permastruct();
if ( !empty($daylink) ) {
$daylink = str_replace('%year%', $year, $daylink);
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
- return apply_filters('day_link', get_settings('home') . trailingslashit($daylink), $year, $month, $day);
+ return apply_filters('day_link', get_option('home') . trailingslashit($daylink), $year, $month, $day);
} else {
- return apply_filters('day_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
+ return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
}
}
function get_feed_link($feed='rss2') {
global $wp_rewrite;
$do_perma = 0;
- $feed_url = get_settings('siteurl');
+ $feed_url = get_option('siteurl');
$comment_feed_url = $feed_url;
$permalink = $wp_rewrite->get_feed_permastruct();
@@ -202,12 +202,12 @@ function get_feed_link($feed='rss2') {
$permalink = str_replace('%feed%', $feed, $permalink);
$permalink = preg_replace('#/+#', '/', "/$permalink/");
- $output = get_settings('home') . $permalink;
+ $output = get_option('home') . $permalink;
} else {
if ( false !== strpos($feed, 'comments_') )
$feed = str_replace('comments_', 'comments-', $feed);
- $output = get_settings('home') . "/?feed={$feed}";
+ $output = get_option('home') . "/?feed={$feed}";
}
return apply_filters('feed_link', $output, $feed);
@@ -229,7 +229,7 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') {
$file = 'post';
}
- $location = get_settings('siteurl') . "/wp-admin/{$file}.php?action=edit&amp;post=$post->ID";
+ $location = get_option('siteurl') . "/wp-admin/{$file}.php?action=edit&amp;post=$post->ID";
echo $before . "<a href=\"$location\">$link</a>" . $after;
}
@@ -244,7 +244,7 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
return;
}
- $location = get_settings('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;comment=$comment->comment_ID";
+ $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;comment=$comment->comment_ID";
echo $before . "<a href='$location'>$link</a>" . $after;
}
@@ -362,7 +362,7 @@ function get_pagenum_link($pagenum = 1) {
$page_modregex = "page/?";
$permalink = 0;
- $home_root = parse_url(get_settings('home'));
+ $home_root = parse_url(get_option('home'));
$home_root = $home_root['path'];
$home_root = trailingslashit($home_root);
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
@@ -390,7 +390,7 @@ function get_pagenum_link($pagenum = 1) {
// so append the query string (using &, since we already have ?)
$qstr .= '&amp;' . $page_querystring . '=' . $pagenum;
// otherwise, it could be rewritten, OR just the default index ...
- } elseif( '' != get_settings('permalink_structure') && ! is_admin() ) {
+ } elseif( '' != get_option('permalink_structure') && ! is_admin() ) {
$permalink = 1;
$index = $wp_rewrite->index;
// If it's not a path info permalink structure, trim the index.
@@ -398,7 +398,7 @@ function get_pagenum_link($pagenum = 1) {
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
} else {
// If using path info style permalinks, make sure the index is in
- // the URI.
+ // the URL.
if ( strpos($qstr, $index) === false )
$qstr = '/' . $index . $qstr;
}
@@ -412,14 +412,14 @@ function get_pagenum_link($pagenum = 1) {
$qstr = preg_replace('|^/+|', '', $qstr);
if ( $permalink )
$qstr = trailingslashit($qstr);
- $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
+ $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_option('home') ) . $qstr );
// showing /page/1/ or ?paged=1 is redundant
if ( 1 === $pagenum ) {
$qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style
$qstr = remove_query_arg('paged', $qstr); // for query style
}
- return str_replace( "wp-inst/", "", $qstr );
+ return $qstr;
}
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
@@ -476,17 +476,19 @@ function _max_num_pages() {
global $wpdb, $wp_query;
if (isset($max_num_pages)) return $max_num_pages;
-
+ $posts_per = (int) get_option('posts_per_page');
+ if ( empty($posts_per) ) $posts_per = 1;
+
if ( 'posts' == get_query_var('what_to_show') ) {
preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
- $max_num_pages = ceil($numposts / get_option('posts_per_page'));
+ $max_num_pages = ceil($numposts / $posts_per);
} else {
preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
$fromwhere = preg_replace('/( AND )?post_date >= (\'|\")(.*?)(\'|\")( AND post_date <= (\'\")(.*?)(\'\"))?/siU', '', $matches[1]);
$num_days = $wpdb->query("SELECT DISTINCT post_date FROM $fromwhere GROUP BY year(post_date), month(post_date), dayofmonth(post_date)");
- $max_num_pages = ceil($num_days / get_option('posts_per_page'));
+ $max_num_pages = ceil($num_days / $posts_per);
}
return $max_num_pages;
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index d2e7137..93294a4 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -168,8 +168,8 @@ if ( !function_exists('wp_mail') ) :
function wp_mail($to, $subject, $message, $headers = '') {
if( $headers == '' ) {
$headers = "MIME-Version: 1.0\n" .
- "From: " . get_settings('admin_email') . "\n" .
- "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
+ "From: " . get_option('admin_email') . "\n" .
+ "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
}
return @mail($to, $subject, $message, $headers);
@@ -227,7 +227,7 @@ function auth_redirect() {
(empty($_COOKIE[USER_COOKIE])) ) {
nocache_headers();
- wp_redirect(get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
+ wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
exit();
}
}
@@ -235,7 +235,7 @@ endif;
if ( !function_exists('check_admin_referer') ) :
function check_admin_referer($action = -1) {
- $adminurl = strtolower(get_settings('siteurl')).'/wp-admin';
+ $adminurl = strtolower(get_option('siteurl')).'/wp-admin';
$referer = strtolower(wp_get_referer());
if ( !wp_verify_nonce($_REQUEST['_wpnonce'], $action) &&
!(-1 == $action && strstr($referer, $adminurl)) ) {
@@ -343,7 +343,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
- $blogname = get_settings('blogname');
+ $blogname = get_option('blogname');
if ( empty( $comment_type ) ) $comment_type = 'comment';
@@ -351,7 +351,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
- $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
$notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
$notify_message .= __('You can see all comments on this post here: ') . "\r\n";
@@ -359,23 +359,23 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
} elseif ('trackback' == $comment_type) {
$notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
- $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
} elseif ('pingback' == $comment_type) {
$notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
$notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
- $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
$notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
$notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
}
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
- $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
- $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
+ $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
+ $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
- $admin_email = get_settings('admin_email');
+ $admin_email = get_option('admin_email');
if ( '' == $comment->comment_author ) {
$from = "From: \"$blogname\" <$admin_email>";
@@ -389,7 +389,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
$message_headers = "MIME-Version: 1.0\n"
. "$from\n"
- . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
+ . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
if ( isset($reply_to) )
$message_headers .= $reply_to . "\n";
@@ -413,7 +413,7 @@ if ( !function_exists('wp_notify_moderator') ) :
function wp_notify_moderator($comment_id) {
global $wpdb;
- if( get_settings( "moderation_notify" ) == 0 )
+ if( get_option( "moderation_notify" ) == 0 )
return true;
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
@@ -426,17 +426,17 @@ function wp_notify_moderator($comment_id) {
$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
$notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
$notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
- $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
$notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
$notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
- $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
- $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
- $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
+ $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
+ $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
+ $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n";
$notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";
- $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
+ $notify_message .= get_option('siteurl') . "/wp-admin/moderation.php\r\n";
- $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title );
- $admin_email = get_settings('admin_email');
+ $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
+ $admin_email = get_option('admin_email');
$notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);
$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
@@ -454,20 +454,20 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
- $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";
+ $message = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
- @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
+ @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
if ( empty($plaintext_pass) )
return;
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
- $message .= get_settings('siteurl') . "/wp-login.php\r\n";
+ $message .= get_option('siteurl') . "/wp-login.php\r\n";
- wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);
+ wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
}
endif;
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 58ba562..d339c7f 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -127,70 +127,66 @@ function get_the_excerpt($fakeit = true) {
function wp_link_pages($args = '') {
- parse_str($args, $r);
- if ( !isset($r['before']) )
- $r['before'] = '<p>' . __('Pages:');
- if ( !isset($r['after']) )
- $r['after'] = '</p>';
- if ( !isset($r['next_or_number']) )
- $r['next_or_number'] = 'number';
- if ( !isset($r['nextpagelink']) )
- $r['nextpagelink'] = 'Next page';
- if ( !isset($r['previouspagelink']) )
- $r['previouspagelink'] = 'Previous page';
- if ( !isset($r['pagelink']) )
- $r['pagelink'] = '%';
- if ( !isset($r['more_file']) )
- $r['more_file'] = '';
-
- link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file']);
-}
+ if ( is_array($args) )
+ $r = &$args;
+ else
+ parse_str($args, $r);
+ $defaults = array('before' => '<p>' . __('Pages:'), 'after' => '</p>', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
+ 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1);
+ $r = array_merge($defaults, $r);
+ extract($r);
-function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
global $id, $page, $numpages, $multipage, $more, $pagenow;
if ( $more_file != '' )
$file = $more_file;
else
$file = $pagenow;
+
+ $output = '';
if ( $multipage ) {
if ( 'number' == $next_or_number ) {
- echo $before;
+ $output .= $before;
for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
$j = str_replace('%',"$i",$pagelink);
- echo ' ';
+ $output .= ' ';
if ( ($i != $page) || ((!$more) && ($page==1)) ) {
- if ( '' == get_settings('permalink_structure') )
- echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
else
- echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
+ $output .= '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
}
- echo $j;
+ $output .= $j;
if ( ($i != $page) || ((!$more) && ($page==1)) )
- echo '</a>';
+ $output .= '</a>';
}
- echo $after;
+ $output .= $after;
} else {
if ( $more ) {
- echo $before;
+ $output .= $before;
$i = $page - 1;
if ( $i && $more ) {
- if ( '' == get_settings('permalink_structure') )
- echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$previouspagelink.'</a>';
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$previouspagelink.'</a>';
else
- echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
+ $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
- if ( '' == get_settings('permalink_structure') )
- echo '<a href="'.get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
+ if ( '' == get_option('permalink_structure') )
+ $output .= '<a href="'.get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
else
- echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
+ $output .= '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
}
- echo $after;
+ $output .= $after;
}
}
}
+
+ if ( $echo )
+ echo $output;
+
+ return $output;
}
@@ -268,7 +264,7 @@ function wp_list_pages($args = '') {
else
parse_str($args, $r);
- $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_settings('date_format'),
+ $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'),
'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1);
$r = array_merge($defaults, $r);
@@ -444,7 +440,7 @@ function prepend_attachment($content) {
//
function get_the_password_form() {
- $output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post">
+ $output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
<p><label>' . __("Password:") . ' <input name="post_password" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . __("Submit") . '" /></p>
</form>
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 45af008..ebb1799 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -507,6 +507,9 @@ function wp_insert_post($postarr = array()) {
$ping_status = apply_filters('ping_status_pre', $ping_status);
}
+ if ( ('' == $post_content) && ('' == $post_title) )
+ return 0;
+
// Make sure we set a valid category
if (0 == count($post_category) || !is_array($post_category)) {
$post_category = array(get_option('default_category'));
@@ -557,10 +560,10 @@ function wp_insert_post($postarr = array()) {
if ( $update )
$comment_status = 'closed';
else
- $comment_status = get_settings('default_comment_status');
+ $comment_status = get_option('default_comment_status');
}
if ( empty($ping_status) )
- $ping_status = get_settings('default_ping_status');
+ $ping_status = get_option('default_ping_status');
if ( empty($post_pingback) )
$post_pingback = get_option('default_pingback_flag');
@@ -661,6 +664,8 @@ function wp_insert_post($postarr = array()) {
if ($post_status == 'publish' && $post_type == 'post') {
do_action('publish_post', $post_ID);
+ if ( defined('XMLRPC_REQUEST') )
+ do_action('xmlrpc_publish_post', $post_ID);
if ( !defined('WP_IMPORTING') ) {
if ( $post_pingback )
@@ -756,7 +761,7 @@ function wp_publish_post($post_id) {
function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
global $wpdb;
// If $post_categories isn't already an array, make it one:
- if (!is_array($post_categories) || 0 == count($post_categories))
+ if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories))
$post_categories = array(get_option('default_category'));
$post_categories = array_unique($post_categories);
@@ -791,9 +796,10 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
if ($add_cats) {
foreach ($add_cats as $new_cat) {
- $wpdb->query("
- INSERT INTO $wpdb->post2cat (post_id, category_id)
- VALUES ($post_ID, $new_cat)");
+ if ( !empty($new_cat) )
+ $wpdb->query("
+ INSERT INTO $wpdb->post2cat (post_id, category_id)
+ VALUES ($post_ID, $new_cat)");
}
}
@@ -810,7 +816,7 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
// Trackback and ping functions
//
-function add_ping($post_id, $uri) { // Add a URI to those already pung
+function add_ping($post_id, $uri) { // Add a URL to those already pung
global $wpdb;
$pung = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_id");
$pung = trim($pung);
@@ -840,7 +846,7 @@ function get_enclosed($post_id) { // Get enclosures already enclosed for a post
return $pung;
}
-function get_pung($post_id) { // Get URIs already pung for a post
+function get_pung($post_id) { // Get URLs already pung for a post
global $wpdb;
$pung = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_id");
$pung = trim($pung);
@@ -849,7 +855,7 @@ function get_pung($post_id) { // Get URIs already pung for a post
return $pung;
}
-function get_to_ping($post_id) { // Get any URIs in the todo list
+function get_to_ping($post_id) { // Get any URLs in the todo list
global $wpdb;
$to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_id");
$to_ping = trim($to_ping);
@@ -1105,7 +1111,7 @@ function generate_page_uri_index() {
foreach ($posts as $id => $post) {
- // URI => page name
+ // URL => page name
$uri = get_page_uri($id);
$attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$id'");
if ( $attachments ) {
@@ -1195,10 +1201,10 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
if ( $update )
$comment_status = 'closed';
else
- $comment_status = get_settings('default_comment_status');
+ $comment_status = get_option('default_comment_status');
}
if ( empty($ping_status) )
- $ping_status = get_settings('default_ping_status');
+ $ping_status = get_option('default_ping_status');
if ( empty($post_pingback) )
$post_pingback = get_option('default_pingback_flag');
diff --git a/wp-includes/query.php b/wp-includes/query.php
index f94c79f..925eff5 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -190,6 +190,12 @@ function is_single ($post = '') {
return false;
}
+function is_singular() {
+ global $wp_query;
+
+ return $wp_query->is_singular;
+}
+
function is_time () {
global $wp_query;
@@ -278,6 +284,7 @@ class WP_Query {
var $is_comments_popup = false;
var $is_admin = false;
var $is_attachment = false;
+ var $is_singular = false;
var $is_robots = false;
var $is_posts_page = false;
@@ -300,6 +307,7 @@ class WP_Query {
$this->is_paged = false;
$this->is_admin = false;
$this->is_attachment = false;
+ $this->is_singular = false;
$this->is_robots = false;
$this->is_posts_page = false;
}
@@ -326,7 +334,10 @@ class WP_Query {
function parse_query ($query) {
if ( !empty($query) || !isset($this->query) ) {
$this->init();
- parse_str($query, $qv);
+ if ( is_array($query) )
+ $qv = & $query;
+ else
+ parse_str($query, $qv);
$this->query = $query;
$this->query_vars = $qv;
}
@@ -364,7 +375,7 @@ class WP_Query {
// If year, month, day, hour, minute, and second are set, a single
// post is being queried.
$this->is_single = true;
- } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
+ } elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) {
$this->is_page = true;
$this->is_single = false;
} elseif (!empty($qv['s'])) {
@@ -479,7 +490,10 @@ class WP_Query {
$this->is_admin = true;
}
- if ( ! ($this->is_attachment || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
+ if ( $this->is_single || $this->is_page || $this->is_attachment )
+ $this->is_singular = true;
+
+ if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
$this->is_home = true;
}
@@ -531,9 +545,9 @@ class WP_Query {
$q['post_type'] = 'post';
$post_type = $q['post_type'];
if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 )
- $q['posts_per_page'] = get_settings('posts_per_page');
+ $q['posts_per_page'] = get_option('posts_per_page');
if ( !isset($q['what_to_show']) )
- $q['what_to_show'] = get_settings('what_to_show');
+ $q['what_to_show'] = get_option('what_to_show');
if ( isset($q['showposts']) && $q['showposts'] ) {
$q['showposts'] = (int) $q['showposts'];
$q['posts_per_page'] = $q['showposts'];
@@ -548,9 +562,14 @@ class WP_Query {
}
}
if ( $this->is_feed ) {
- $q['posts_per_page'] = get_settings('posts_per_rss');
+ $q['posts_per_page'] = get_option('posts_per_rss');
$q['what_to_show'] = 'posts';
}
+ $q['posts_per_page'] = (int) $q['posts_per_page'];
+ if ( $q['posts_per_page'] < -1 )
+ $q['posts_per_page'] = abs($q['posts_per_page']);
+ else if ( $q['posts_per_page'] == 0 )
+ $q['posts_per_page'] = 1;
if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
$this->is_page = true;
@@ -564,8 +583,8 @@ class WP_Query {
$q['page'] = abs($q['page']);
}
- $add_hours = intval(get_settings('gmt_offset'));
- $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
+ $add_hours = intval(get_option('gmt_offset'));
+ $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
// If a month is specified in the querystring, load that month
@@ -745,7 +764,7 @@ class WP_Query {
$distinct = 'DISTINCT';
}
- // Category stuff for nice URIs
+ // Category stuff for nice URLs
global $cache_categories;
if ('' != $q['category_name']) {
@@ -804,7 +823,7 @@ class WP_Query {
$whichauthor .= ')';
}
- // Author stuff for nice URIs
+ // Author stuff for nice URLs
if ('' != $q['author_name']) {
if (stristr($q['author_name'],'/')) {
diff --git a/wp-includes/registration.php b/wp-includes/registration.php
index 97797cc..8ec38a4 100644
--- a/wp-includes/registration.php
+++ b/wp-includes/registration.php
@@ -102,14 +102,14 @@ function wp_insert_user($userdata) {
update_usermeta( $user_id, 'aim', $aim );
update_usermeta( $user_id, 'yim', $yim );
- if ( $update && !empty($role) ) {
+ if ( $update && isset($role) ) {
$user = new WP_User($user_id);
$user->set_role($role);
}
if ( !$update ) {
$user = new WP_User($user_id);
- $user->set_role(get_settings('default_role'));
+ $user->set_role(get_option('default_role'));
}
wp_cache_delete($user_id, 'users');
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php
index 178ee07..7865351 100644
--- a/wp-includes/rewrite.php
+++ b/wp-includes/rewrite.php
@@ -84,28 +84,28 @@ function url_to_postid($url) {
$url_split = explode('#', $url);
$url = $url_split[0];
- // Get rid of URI ?query=string
+ // Get rid of URL ?query=string
$url_split = explode('?', $url);
$url = $url_split[0];
// Add 'www.' if it is absent and should be there
- if ( false !== strpos(get_settings('home'), '://www.') && false === strpos($url, '://www.') )
+ if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') )
$url = str_replace('://', '://www.', $url);
// Strip 'www.' if it is present and shouldn't be
- if ( false === strpos(get_settings('home'), '://www.') )
+ if ( false === strpos(get_option('home'), '://www.') )
$url = str_replace('://www.', '://', $url);
// Strip 'index.php/' if we're not using path info permalinks
if ( false === strpos($rewrite, 'index.php/') )
$url = str_replace('index.php/', '', $url);
- if ( false !== strpos($url, get_settings('home')) ) {
+ if ( false !== strpos($url, get_option('home')) ) {
// Chop off http://domain.com
- $url = str_replace(get_settings('home'), '', $url);
+ $url = str_replace(get_option('home'), '', $url);
} else {
// Chop off /path/to/blog
- $home_path = parse_url(get_settings('home'));
+ $home_path = parse_url(get_option('home'));
$home_path = $home_path['path'];
$url = str_replace($home_path, '', $url);
}
@@ -259,8 +259,8 @@ class WP_Rewrite {
}
function page_rewrite_rules() {
- $uris = get_settings('page_uris');
- $attachment_uris = get_settings('page_attachment_uris');
+ $uris = get_option('page_uris');
+ $attachment_uris = get_option('page_attachment_uris');
$rewrite_rules = array();
$page_structure = $this->get_page_permastruct();
@@ -757,10 +757,10 @@ class WP_Rewrite {
return '';
}
- $site_root = parse_url(get_settings('siteurl'));
+ $site_root = parse_url(get_option('siteurl'));
$site_root = trailingslashit($site_root['path']);
- $home_root = parse_url(get_settings('home'));
+ $home_root = parse_url(get_option('home'));
$home_root = trailingslashit($home_root['path']);
$rules = "<IfModule mod_rewrite.c>\n";
@@ -853,13 +853,13 @@ class WP_Rewrite {
function init() {
$this->extra_rules = $this->non_wp_rules = $this->endpoints = array();
- $this->permalink_structure = get_settings('permalink_structure');
+ $this->permalink_structure = get_option('permalink_structure');
$this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
$this->root = '';
if ($this->using_index_permalinks()) {
$this->root = $this->index . '/';
}
- $this->category_base = get_settings('category_base');
+ $this->category_base = get_option('category_base');
unset($this->category_structure);
unset($this->author_structure);
unset($this->date_structure);
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 06330e4..d5a8986 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -18,7 +18,7 @@ class WP_Scripts {
$this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '08152006' );
$this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
- $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4102');
+ $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4107');
if ( is_admin() ) {
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
$this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '4042' ); // Make changeset # the correct one
@@ -65,7 +65,7 @@ class WP_Scripts {
$ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version;
if ( isset($this->args[$handle]) )
$ver .= '&amp;' . $this->args[$handle];
- $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_settings( 'siteurl' ) . $this->scripts[$handle]->src;
+ $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src;
echo "<script type='text/javascript' src='$src?ver=$ver'></script>\n";
$this->printed[] = $handle;
}
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 9130394..36f001d 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -4,7 +4,7 @@
*/
function get_stylesheet() {
- return apply_filters('stylesheet', get_settings('stylesheet'));
+ return apply_filters('stylesheet', get_option('stylesheet'));
}
function get_stylesheet_directory() {
@@ -26,7 +26,7 @@ function get_stylesheet_uri() {
}
function get_template() {
- return apply_filters('template', get_settings('template'));
+ return apply_filters('template', get_option('template'));
}
function get_template_directory() {
@@ -237,8 +237,8 @@ function get_theme($theme) {
function get_current_theme() {
$themes = get_themes();
$theme_names = array_keys($themes);
- $current_template = get_settings('template');
- $current_stylesheet = get_settings('stylesheet');
+ $current_template = get_option('template');
+ $current_stylesheet = get_option('stylesheet');
$current_theme = 'WordPress Default';
if ( $themes ) {
@@ -259,7 +259,7 @@ function get_theme_root() {
}
function get_theme_root_uri() {
- return apply_filters('theme_root_uri', get_settings('siteurl') . "/wp-content/themes", get_settings('siteurl'));
+ return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
}
function get_query_template($type) {
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index beec34c..62253c1 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -89,7 +89,7 @@ if (!isset($wpsmiliestrans)) {
foreach($wpsmiliestrans as $smiley => $img) {
$wp_smiliessearch[] = $smiley;
$smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
- $wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
+ $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}
?>