summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-07 16:58:13 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-07 16:58:13 +0000
commitf9d5ef9fbb062b0c44c09207f947b515ab6dc66e (patch)
treed1cfa030e80a5f08ac79fb21281e647ee8a86026
parentd3ac809ed8a43bde6ea954329b3291fd9ca4aad5 (diff)
downloadwordpress-mu-f9d5ef9fbb062b0c44c09207f947b515ab6dc66e.tar.gz
wordpress-mu-f9d5ef9fbb062b0c44c09207f947b515ab6dc66e.tar.xz
wordpress-mu-f9d5ef9fbb062b0c44c09207f947b515ab6dc66e.zip
WP Merge to rev 4626
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@821 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/comment.php2
-rw-r--r--wp-admin/edit-form-advanced.php18
-rw-r--r--wp-admin/wp-admin.css65
-rw-r--r--wp-includes/comment.php228
-rw-r--r--wp-includes/feed.php21
-rw-r--r--wp-includes/general-template.php6
-rw-r--r--wp-includes/plugin.php4
-rw-r--r--wp-includes/post.php34
-rw-r--r--wp-includes/query.php1
-rw-r--r--wp-includes/registration.php18
-rw-r--r--wp-includes/vars.php116
11 files changed, 276 insertions, 237 deletions
diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index a583264..063b825 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -1,7 +1,7 @@
<?php
require_once('admin.php');
-$parent_file = 'edit.php';
+$parent_file = 'edit-comments.php';
$submenu_file = 'edit-comments.php';
wp_reset_vars(array('action'));
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 2c1c23e..1a16b17 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -194,23 +194,23 @@ if (current_user_can('upload_files')) {
<div id="advancedstuff" class="dbx-group" >
-<div class="dbx-box-wrapper">
+<div class="dbx-b-ox-wrapper">
<fieldset id="postexcerpt" class="dbx-box">
-<div class="dbx-handle-wrapper">
+<div class="dbx-h-andle-wrapper">
<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
</div>
-<div class="dbx-content-wrapper">
+<div class="dbx-c-ontent-wrapper">
<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
</div>
</fieldset>
</div>
-<div class="dbx-box-wrapper">
+<div class="dbx-b-ox-wrapper">
<fieldset id="trackbacksdiv" class="dbx-box">
-<div class="dbx-handle-wrapper">
+<div class="dbx-h-andle-wrapper">
<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
</div>
-<div class="dbx-content-wrapper">
+<div class="dbx-c-ontent-wrapper">
<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
<?php
if ( ! empty($pings) )
@@ -221,12 +221,12 @@ if ( ! empty($pings) )
</fieldset>
</div>
-<div class="dbx-box-wrapper">
+<div class="dbx-b-ox-wrapper">
<fieldset id="postcustom" class="dbx-box">
-<div class="dbx-handle-wrapper">
+<div class="dbx-h-andle-wrapper">
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
</div>
-<div class="dbx-content-wrapper">
+<div class="dbx-c-ontent-wrapper">
<div id="postcustomstuff" class="dbx-content">
<table cellpadding="3">
<?php
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index e31c000..805033b 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -547,12 +547,7 @@ input.disabled, textarea.disabled {
border: none;
}
-#titlediv, #guiddiv {
- margin: 0 8px 0 0;
- padding: 0px;
-}
-
-#postdiv {
+#postdiv, #titlediv, #guiddiv {
margin: 0 8px 0 0;
padding: 0px;
}
@@ -595,7 +590,7 @@ input.delete:hover {
color: #fff;
}
-#postdivrich #quicktags, #commentdivrich #quicktags {
+#postdivrich #quicktags {
background: #f0f0ee;
padding: 0px;
border: 1px solid #ccc;
@@ -689,13 +684,15 @@ input.delete:hover {
position: relative;
background: url('images/login-bkg-tile.gif') no-repeat top center;
color: #fff;
- margin: 5em auto;
- padding: 20px 50px 0;
- width: 325px;
- _width: 390px;
+ margin: 5em auto 1em;
+ padding: 20px 0 0;
+ width: 425px;
+ _width: 390px;
}
#login form {
+ background: url('images/login-bkg-bottom.gif') no-repeat bottom center;
+ padding: 0 50px 25px;
_width: 325px;
_margin: 0 auto;
}
@@ -707,9 +704,20 @@ input.delete:hover {
font-size: 11px;
font-weight: bold;
padding: .6em;
+ width: 310px;
+ margin: 0 auto;
text-align: center;
}
+#login p {
+ font-size: 12px;
+}
+
+#login p.message {
+ width: 310px;
+ margin: 0 auto 1em;
+}
+
#login #login_error a {
color: #ebcd4e;
border-color: #ebcd4e;
@@ -764,13 +772,12 @@ input.delete:hover {
padding: 4px;
}
-#login ul {
- background: url('images/login-bkg-bottom.gif') no-repeat bottom center;
+.login ul, #protected #login .bottom {
list-style: none;
- margin: 0 -50px;
- _margin: 10px auto 0;
- padding: 10px 50px 25px;;
- _padding: 0 0 5px 30px;
+ width: 325px;
+ margin: 0 auto;
+ padding: 0;
+ line-height: 1.2;
}
#login ul:after {
@@ -795,22 +802,12 @@ input.delete:hover {
text-align: center;
}
-#login ul li a {
- display: block;
- color: #84c4f0;
+.login ul li a {
+ color: #0d324f;
border: none;
- padding: 4px 1px 5px;
- width: 160px;
-}
-
-#register #login ul li a {
- width: 106px;
}
#login ul li a:hover {
- background: #0e3350;
- border: 1px solid #2571ab;
- padding: 3px 0 4px;
color: #fff;
}
@@ -1195,7 +1192,7 @@ overall, dbx-box is best left as visually unstyled as possible
background: #2685af url(images/box-head-right.gif) no-repeat top right;
}
-#advancedstuff div.dbx-handle-wrapper {
+#advancedstuff div.dbx-h-andle-wrapper {
margin: 0 0 0 -7px;
background: #fff url(images/box-head-left.gif) no-repeat top left;
}
@@ -1211,7 +1208,7 @@ overall, dbx-box is best left as visually unstyled as possible
padding-right: 17px;
}
-#advancedstuff div.dbx-content-wrapper {
+#advancedstuff div.dbx-c-ontent-wrapper {
margin-left: -7px;
margin-right: 0;
background: url(images/box-bg-left.gif) repeat-y left;
@@ -1223,11 +1220,11 @@ overall, dbx-box is best left as visually unstyled as possible
background: url(images/box-butt-right.gif) no-repeat bottom right;
}
-#advancedstuff div.dbx-box-wrapper {
+#advancedstuff div.dbx-b-ox-wrapper {
background: url(images/box-butt-left.gif) no-repeat bottom left;
}
-#advancedstuff .dbx-box-closed div.dbx-content-wrapper {
+#advancedstuff .dbx-box-closed div.dbx-c-ontent-wrapper {
padding-bottom: 2px;
background: url(images/box-butt-left.gif) no-repeat bottom left;
}
@@ -1337,7 +1334,7 @@ input #catadd {
padding-left: 3px;
}
-#postdivrich #content, #postdivrich #content:active, #commentdivrich #content, #commentdivrich #content:active {
+#postdivrich #content, #postdivrich #content:active {
border: 1px solid #ccc;
}
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 557c46b..e48214a 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -3,12 +3,13 @@
function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
global $wpdb;
- if (1 == get_option('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 ( preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $comment, $out) >= get_option('comment_max_links') )
return false; // Check # of external links
- $mod_keys = trim( get_option('moderation_keys') );
+ $mod_keys = trim(get_option('moderation_keys'));
if ( !empty($mod_keys) ) {
$words = explode("\n", $mod_keys );
@@ -16,7 +17,8 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
$word = trim($word);
// Skip empty lines
- if (empty($word)) { continue; }
+ if ( empty($word) )
+ continue;
// Do some escaping magic so that '#' chars in the
// spam words don't break things:
@@ -43,7 +45,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
return true;
else
return false;
- } elseif( $author != '' && $email != '' ) {
+ } elseif ( $author != '' && $email != '' ) {
$ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1");
if ( ( 1 == $ok_to_comment ) &&
( empty($mod_keys) || false === strpos( $email, $mod_keys) ) )
@@ -54,10 +56,10 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
return false;
}
}
-
return true;
}
+
function get_approved_comments($post_id) {
global $wpdb;
@@ -65,6 +67,7 @@ function get_approved_comments($post_id) {
return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1' ORDER BY comment_date");
}
+
// Retrieves comment data given a comment ID or comment object.
// Handles comment caching.
function &get_comment(&$comment, $output = OBJECT) {
@@ -97,38 +100,39 @@ function &get_comment(&$comment, $output = OBJECT) {
}
}
+
// Deprecate in favor of get_comment()?
function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries
global $postc, $id, $commentdata, $wpdb;
- if ($no_cache) {
+ if ( $no_cache ) {
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
- if (false == $include_unapproved) {
- $query .= " AND comment_approved = '1'";
- }
- $myrow = $wpdb->get_row($query, ARRAY_A);
+ if ( false == $include_unapproved )
+ $query .= " AND comment_approved = '1'";
+ $myrow = $wpdb->get_row($query, ARRAY_A);
} else {
- $myrow['comment_ID'] = $postc->comment_ID;
- $myrow['comment_post_ID'] = $postc->comment_post_ID;
- $myrow['comment_author'] = $postc->comment_author;
+ $myrow['comment_ID'] = $postc->comment_ID;
+ $myrow['comment_post_ID'] = $postc->comment_post_ID;
+ $myrow['comment_author'] = $postc->comment_author;
$myrow['comment_author_email'] = $postc->comment_author_email;
- $myrow['comment_author_url'] = $postc->comment_author_url;
- $myrow['comment_author_IP'] = $postc->comment_author_IP;
- $myrow['comment_date'] = $postc->comment_date;
- $myrow['comment_content'] = $postc->comment_content;
- $myrow['comment_karma'] = $postc->comment_karma;
- $myrow['comment_approved'] = $postc->comment_approved;
- $myrow['comment_type'] = $postc->comment_type;
+ $myrow['comment_author_url'] = $postc->comment_author_url;
+ $myrow['comment_author_IP'] = $postc->comment_author_IP;
+ $myrow['comment_date'] = $postc->comment_date;
+ $myrow['comment_content'] = $postc->comment_content;
+ $myrow['comment_karma'] = $postc->comment_karma;
+ $myrow['comment_approved'] = $postc->comment_approved;
+ $myrow['comment_type'] = $postc->comment_type;
}
return $myrow;
}
+
function get_lastcommentmodified($timezone = 'server') {
global $cache_lastcommentmodified, $pagenow, $wpdb;
$add_seconds_blog = get_option('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastcommentmodified[$timezone]) ) {
- switch(strtolower($timezone)) {
+ switch ( strtolower($timezone)) {
case 'gmt':
$lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1");
break;
@@ -146,6 +150,7 @@ function get_lastcommentmodified($timezone = 'server') {
return $lastcommentmodified;
}
+
function sanitize_comment_cookies() {
if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
$comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
@@ -169,6 +174,7 @@ function sanitize_comment_cookies() {
}
}
+
function wp_allow_comment($commentdata) {
global $wpdb;
extract($commentdata);
@@ -217,27 +223,28 @@ function wp_allow_comment($commentdata) {
return $approved;
}
+
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
global $wpdb;
do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) {
- foreach ($chars[1] as $char) {
+ foreach ( (array) $chars[1] as $char ) {
// If it's an encoded char in the normal ASCII set, reject
if ( 38 == $char )
continue; // Unless it's &
- if ($char < 128)
+ if ( $char < 128 )
return true;
}
}
$mod_keys = trim( get_option('blacklist_keys') );
- if ('' == $mod_keys )
+ if ( '' == $mod_keys )
return false; // If moderation keys are empty
$words = explode("\n", $mod_keys );
- foreach ($words as $word) {
+ foreach ( (array) $words as $word ) {
$word = trim($word);
// Skip empty lines
@@ -248,17 +255,20 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
$word = preg_quote($word, '#');
$pattern = "#$word#i";
- if ( preg_match($pattern, $author ) ) return true;
- if ( preg_match($pattern, $email ) ) return true;
- if ( preg_match($pattern, $url ) ) return true;
- if ( preg_match($pattern, $comment ) ) return true;
- if ( preg_match($pattern, $user_ip ) ) return true;
- if ( preg_match($pattern, $user_agent) ) return true;
+ if (
+ preg_match($pattern, $author)
+ || preg_match($pattern, $email)
+ || preg_match($pattern, $url)
+ || preg_match($pattern, $comment)
+ || preg_match($pattern, $user_ip)
+ || preg_match($pattern, $user_agent)
+ )
+ return true;
}
-
return false;
}
+
function wp_delete_comment($comment_id) {
global $wpdb;
do_action('delete_comment', $comment_id);
@@ -276,23 +286,25 @@ function wp_delete_comment($comment_id) {
return true;
}
+
function wp_get_comment_status($comment_id) {
global $wpdb;
$result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
- if ($result == NULL) {
+
+ if ( $result == NULL )
return 'deleted';
- } else if ($result == '1') {
+ elseif ( $result == '1' )
return 'approved';
- } else if ($result == '0') {
+ elseif ( $result == '0' )
return 'unapproved';
- } else if ($result == 'spam') {
+ elseif ( $result == 'spam' )
return 'spam';
- } else {
+ else
return false;
- }
}
+
function wp_get_current_commenter() {
// Cookies should already be sanitized.
@@ -311,6 +323,7 @@ function wp_get_current_commenter() {
return compact('comment_author', 'comment_author_email', 'comment_author_url');
}
+
function wp_insert_comment($commentdata) {
global $wpdb;
extract($commentdata);
@@ -342,6 +355,7 @@ function wp_insert_comment($commentdata) {
return $id;
}
+
function wp_filter_comment($commentdata) {
$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
$commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
@@ -354,6 +368,7 @@ function wp_filter_comment($commentdata) {
return $commentdata;
}
+
function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
if ( $block ) // a plugin has already blocked... we'll let that decision stand
return $block;
@@ -362,6 +377,7 @@ function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment)
return false;
}
+
function wp_new_comment( $commentdata ) {
$commentdata = apply_filters('preprocess_comment', $commentdata);
@@ -374,7 +390,6 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_date'] = current_time('mysql');
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
-
$commentdata = wp_filter_comment($commentdata);
$commentdata['comment_approved'] = wp_allow_comment($commentdata);
@@ -396,40 +411,42 @@ function wp_new_comment( $commentdata ) {
return $comment_ID;
}
+
function wp_set_comment_status($comment_id, $comment_status) {
- global $wpdb;
+ global $wpdb;
- switch($comment_status) {
+ switch ( $comment_status ) {
case 'hold':
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
- break;
+ break;
case 'approve':
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
- break;
+ break;
case 'spam':
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
- break;
+ break;
case 'delete':
return wp_delete_comment($comment_id);
- break;
+ break;
default:
return false;
- }
+ }
- if ($wpdb->query($query)) {
+ if ( $wpdb->query($query) ) {
do_action('wp_set_comment_status', $comment_id, $comment_status);
$comment = get_comment($comment_id);
$comment_post_ID = $comment->comment_post_ID;
- $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" );
- if( is_object( $c ) )
- $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
+ $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
+ if ( is_object($c) )
+ $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'");
return true;
- } else {
+ } else {
return false;
- }
+ }
}
+
function wp_update_comment($commentarr) {
global $wpdb;
@@ -437,7 +454,7 @@ function wp_update_comment($commentarr) {
$comment = get_comment($commentarr['comment_ID'], ARRAY_A);
// Escape data pulled from DB.
- foreach ($comment as $key => $value)
+ foreach ( (array) $comment as $key => $value )
$comment[$key] = $wpdb->escape($value);
// Merge old and new fields with new fields overwriting old ones.
@@ -452,23 +469,21 @@ function wp_update_comment($commentarr) {
$result = $wpdb->query(
"UPDATE $wpdb->comments SET
- comment_content = '$comment_content',
- comment_author = '$comment_author',
+ comment_content = '$comment_content',
+ comment_author = '$comment_author',
comment_author_email = '$comment_author_email',
- comment_approved = '$comment_approved',
- comment_author_url = '$comment_author_url',
- comment_date = '$comment_date'
+ comment_approved = '$comment_approved',
+ comment_author_url = '$comment_author_url',
+ comment_date = '$comment_date'
WHERE comment_ID = $comment_ID" );
$rval = $wpdb->rows_affected;
-
wp_update_comment_count($comment_post_ID);
-
do_action('edit_comment', $comment_ID);
-
return $rval;
}
+
function wp_update_comment_count($post_id) {
global $wpdb, $comment_count_cache;
$post_id = (int) $post_id;
@@ -480,6 +495,7 @@ function wp_update_comment_count($post_id) {
return true;
}
+
//
// Ping and trackback functions.
//
@@ -497,58 +513,51 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
extract(parse_url($url));
- if (!isset($host)) {
- // Not an URL. This should never happen.
+ if ( !isset($host) ) // Not an URL. This should never happen.
return false;
- }
- $path = (!isset($path)) ? '/' : $path;
- $path .= (isset($query)) ? '?'.$query : '';
- $port = (isset($port)) ? $port : 80;
+ $path = ( !isset($path) ) ? '/' : $path;
+ $path .= ( isset($query) ) ? '?' . $query : '';
+ $port = ( isset($port) ) ? $port : 80;
// Try to connect to the server at $host
$fp = @fsockopen($host, $port, $errno, $errstr, 2);
- if (!$fp) {
- // Couldn't open a connection to $host;
+ if ( !$fp ) // Couldn't open a connection to $host
return false;
- }
// Send the GET request
$request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: WordPress/$wp_version \r\n\r\n";
-// ob_end_flush();
+ // ob_end_flush();
fputs($fp, $request);
// Let's check for an X-Pingback header first
- while (!feof($fp)) {
+ while ( !feof($fp) ) {
$line = fgets($fp, 512);
- if (trim($line) == '') {
+ if ( trim($line) == '' )
break;
- }
$headers .= trim($line)."\n";
$x_pingback_header_offset = strpos(strtolower($headers), $x_pingback_str);
- if ($x_pingback_header_offset) {
+ if ( $x_pingback_header_offset ) {
// We got it!
preg_match('#x-pingback: (.+)#is', $headers, $matches);
$pingback_server_url = trim($matches[1]);
return $pingback_server_url;
}
- if(strpos(strtolower($headers), 'content-type: ')) {
+ if ( strpos(strtolower($headers), 'content-type: ') ) {
preg_match('#content-type: (.+)#is', $headers, $matches);
$content_type = trim($matches[1]);
}
}
- if (preg_match('#(image|audio|video|model)/#is', $content_type)) {
- // Not an (x)html, sgml, or xml page, no use going further
+ if ( preg_match('#(image|audio|video|model)/#is', $content_type) ) // Not an (x)html, sgml, or xml page, no use going further
return false;
- }
- while (!feof($fp)) {
+ while ( !feof($fp) ) {
$line = fgets($fp, 1024);
$contents .= trim($line);
$pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
$pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
- if ($pingback_link_offset_dquote || $pingback_link_offset_squote) {
+ if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
$quote = ($pingback_link_offset_dquote) ? '"' : '\'';
$pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
$pingback_href_pos = @strpos($contents, 'href=', $pingback_link_offset);
@@ -557,13 +566,11 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
$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 URL
- if ($pingback_server_url_len > 0) {
- // We got it!
+ if ( $pingback_server_url_len > 0 ) // We got it!
return $pingback_server_url;
- }
}
$byte_count += strlen($line);
- if ($byte_count > $timeout_bytes) {
+ if ( $byte_count > $timeout_bytes ) {
// It's no use going further, there probably isn't any pingback
// server to find in this file. (Prevents loading large files.)
return false;
@@ -574,6 +581,7 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
return false;
}
+
function do_all_pings() {
global $wpdb;
@@ -592,9 +600,8 @@ function do_all_pings() {
// Do Trackbacks
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");
if ( is_array($trackbacks) ) {
- foreach ( $trackbacks as $trackback ) {
+ foreach ( $trackbacks as $trackback )
do_trackbacks($trackback->ID);
- }
}
//Do Update Services/Generic Pings
@@ -612,7 +619,7 @@ function do_trackbacks($post_id) {
return;
}
- if (empty($post->post_excerpt))
+ if ( empty($post->post_excerpt) )
$excerpt = apply_filters('the_content', $post->post_content);
else
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
@@ -626,39 +633,42 @@ function do_trackbacks($post_id) {
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
- if ($to_ping) : foreach ($to_ping as $tb_ping) :
- $tb_ping = trim($tb_ping);
- if ( !in_array($tb_ping, $pinged) ) {
- trackback($tb_ping, $post_title, $excerpt, $post_id);
- $pinged[] = $tb_ping;
- } else {
- $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
+ if ( $to_ping ) {
+ foreach ( (array) $to_ping as $tb_ping ) {
+ $tb_ping = trim($tb_ping);
+ if ( !in_array($tb_ping, $pinged) ) {
+ trackback($tb_ping, $post_title, $excerpt, $post_id);
+ $pinged[] = $tb_ping;
+ } else {
+ $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
+ }
}
- endforeach; endif;
+ }
}
+
function generic_ping($post_id = 0) {
$services = get_option('ping_sites');
$services = preg_replace("|(\s)+|", '$1', $services); // Kill dupe lines
$services = trim($services);
if ( '' != $services ) {
$services = explode("\n", $services);
- foreach ($services as $service) {
+ foreach ( (array) $services as $service )
weblog_ping($service);
- }
}
return $post_id;
}
+
function pingback($content, $post_ID) {
global $wp_version, $wpdb;
- include_once (ABSPATH . WPINC . '/class-IXR.php');
+ include_once(ABSPATH . WPINC . '/class-IXR.php');
// original code by Mort (http://mort.mine.nu:8080)
$log = debug_fopen(ABSPATH . '/pingback.log', 'a');
$post_links = array();
- debug_fwrite($log, 'BEGIN '.date('YmdHis', time())."\n");
+ debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n");
$pung = get_pung($post_ID);
@@ -687,24 +697,24 @@ function pingback($content, $post_ID) {
// http://dummy-weblog.org/post.php
// We don't wanna ping first and second types, even if they have a valid <link/>
- foreach($post_links_temp[0] as $link_test) :
+ foreach ( $post_links_temp[0] as $link_test ) :
if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
&& !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
$test = parse_url($link_test);
- if (isset($test['query']))
+ if ( isset($test['query']) )
$post_links[] = $link_test;
- elseif(($test['path'] != '/') && ($test['path'] != ''))
+ elseif ( ($test['path'] != '/') && ($test['path'] != '') )
$post_links[] = $link_test;
endif;
endforeach;
- do_action_ref_array('pre_ping', array(&$post_links, &$pung));
+ do_action_ref_array('pre_ping', array(&$post_links, &$pung));
- foreach ($post_links as $pagelinkedto){
+ foreach ( (array) $post_links as $pagelinkedto ) {
debug_fwrite($log, "Processing -- $pagelinkedto\n");
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
- if ($pingback_server_url) {
+ if ( $pingback_server_url ) {
@ set_time_limit( 60 );
// Now, the RPC call
debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
@@ -731,7 +741,8 @@ function pingback($content, $post_ID) {
debug_fclose($log);
}
-function privacy_ping_filter( $sites ) {
+
+function privacy_ping_filter($sites) {
global $current_blog;
if ( '0' != $current_blog->public )
return $sites;
@@ -781,9 +792,10 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
return $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = '$ID'");
}
+
function weblog_ping($server = '', $path = '') {
global $wp_version;
- include_once (ABSPATH . WPINC . '/class-IXR.php');
+ include_once(ABSPATH . WPINC . '/class-IXR.php');
// using a timeout of 3 seconds should be enough to cover slow servers
$client = new IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index deebbea..529da85 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -5,10 +5,12 @@ function get_bloginfo_rss($show = '') {
return apply_filters('bloginfo_rss', convert_chars($info));
}
+
function bloginfo_rss($show = '') {
echo get_bloginfo_rss($show);
}
+
function get_the_title_rss() {
$title = get_the_title();
$title = apply_filters('the_title', $title);
@@ -16,10 +18,12 @@ function get_the_title_rss() {
return $title;
}
+
function the_title_rss() {
echo get_the_title_rss();
}
+
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content_rss', $content);
@@ -42,9 +46,8 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
$k = count($blah);
$use_dotdotdot = 0;
}
- for ( $i=0; $i<$k; $i++ ) {
+ for ( $i=0; $i<$k; $i++ )
$excerpt .= $blah[$i].' ';
- }
$excerpt .= ($use_dotdotdot) ? '...' : '';
$content = $excerpt;
}
@@ -52,37 +55,46 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
echo $content;
}
+
function the_excerpt_rss() {
$output = get_the_excerpt(true);
echo apply_filters('the_excerpt_rss', $output);
}
+
function permalink_single_rss($file = '') {
echo get_permalink();
}
+
function comment_link() {
echo get_comment_link();
}
+
function get_comment_author_rss() {
return apply_filters('comment_author_rss', get_comment_author() );
}
+
+
function comment_author_rss() {
echo get_comment_author_rss();
}
+
function comment_text_rss() {
$comment_text = get_comment_text();
$comment_text = apply_filters('comment_text_rss', $comment_text);
echo $comment_text;
}
+
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '') {
$url = comments_rss($commentsrssfilename);
echo "<a href='$url'>$link_text</a>";
}
+
function comments_rss($commentsrssfilename = '') {
global $id;
@@ -94,6 +106,7 @@ function comments_rss($commentsrssfilename = '') {
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_option('permalink_structure');
@@ -112,6 +125,7 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) {
return $link;
}
+
function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
$permalink_structure = get_option('permalink_structure');
@@ -129,6 +143,7 @@ function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
return $link;
}
+
function get_the_category_rss($type = 'rss') {
$categories = get_the_category();
$the_list = '';
@@ -142,10 +157,12 @@ function get_the_category_rss($type = 'rss') {
return apply_filters('the_category_rss', $the_list, $type);
}
+
function the_category_rss($type = 'rss') {
echo get_the_category_rss($type);
}
+
function rss_enclosure() {
global $id, $post;
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index cb80691..60fce25 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -787,10 +787,10 @@ function rich_edit_exists() {
}
function user_can_richedit() {
- global $wp_rich_edit;
-
+ global $wp_rich_edit, $pagenow;
+
if ( !isset($wp_rich_edit) )
- $wp_rich_edit = ( 'true' == get_user_option('rich_editing') && !preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) && rich_edit_exists() ) ? true : false;
+ $wp_rich_edit = ( 'true' == get_user_option('rich_editing') && !preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) && 'comment.php' != $pagenow && rich_edit_exists() ) ? true : false;
return apply_filters('user_can_richedit', $wp_rich_edit);
}
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index 64ceb9a..e06869f 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -9,7 +9,7 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
// check that we don't already have the same filter at the same priority
if ( isset($wp_filter[$tag]["$priority"]) ) {
- foreach($wp_filter[$tag]["$priority"] as $filter) {
+ foreach ( $wp_filter[$tag]["$priority"] as $filter ) {
// uncomment if we want to match function AND accepted_args
// if ( $filter == array($function, $accepted_args) ) {
if ( $filter['function'] == $function_to_add )
@@ -153,7 +153,7 @@ function do_action_ref_array($tag, $args) {
foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
if ( !is_null($functions) ) {
- foreach( (array) $functions as $function ) {
+ foreach ( (array) $functions as $function ) {
$function_name = $function['function'];
$accepted_args = $function['accepted_args'];
if ( $accepted_args > 0 )
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 0e9110e..4d5dfd4 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -930,6 +930,7 @@ function &get_page(&$page, $output = OBJECT) {
$_page = & $GLOBALS['page'];
wp_cache_add($_page->ID, $_page, 'pages');
} else {
+ // shouldn't we just return NULL at this point? ~ Mark
$_page = null;
}
} elseif ( is_object($page) ) {
@@ -938,22 +939,29 @@ function &get_page(&$page, $output = OBJECT) {
wp_cache_add($page->ID, $page, 'pages');
$_page = $page;
} else {
- if ( isset($GLOBALS['page']->ID) && ($page == $GLOBALS['page']->ID) ) {
- $_page = & $GLOBALS['page'];
- wp_cache_add($_page->ID, $_page, 'pages');
- } elseif ( !isset($_page) && $_page == $GLOBALS['post_cache'][$blog_id][$page] ) {
- return get_post($page, $output);
- } elseif ( isset($_page) && $_page == wp_cache_get($page, 'pages') ) {
- // Got it.
- } else {
- $query = "SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1";
- $_page = & $wpdb->get_row($query);
- if ( 'post' == $_page->post_type )
- return get_post($_page, $output);
- wp_cache_add($_page->ID, $_page, 'pages');
+ // first, check the cache
+ if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) {
+ // not in the page cache?
+ if ( isset($GLOBALS['page']->ID) && ($page == $GLOBALS['page']->ID) ) { // for is_page() views
+ // I don't think this code ever gets executed ~ Mark
+ $_page = & $GLOBALS['page'];
+ wp_cache_add($_page->ID, $_page, 'pages');
+ } elseif ( isset($GLOBALS['post_cache'][$blog_id][$page]) ) { // it's actually a page, and is cached
+ return get_post($page, $output);
+ } else { // it's not in any caches, so off to the DB we go
+ // Why are we using assignment for this query?
+ $_page = & $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1");
+ if ( 'post' == $_page->post_type )
+ return get_post($_page, $output);
+ // Potential issue: we're not checking to see if the post_type = 'page'
+ // So all non-'post' posts will get cached as pages.
+ wp_cache_add($_page->ID, $_page, 'pages');
+ }
}
}
+ // at this point, one way or another, $_post contains the page object
+
if ( $output == OBJECT ) {
return $_page;
} elseif ( $output == ARRAY_A ) {
diff --git a/wp-includes/query.php b/wp-includes/query.php
index c04f378..8114bd5 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -609,6 +609,7 @@ class WP_Query {
}
if ( $this->is_feed ) {
$q['posts_per_page'] = get_option('posts_per_rss');
+ $q['nopaging'] = false;
}
$q['posts_per_page'] = (int) $q['posts_per_page'];
if ( $q['posts_per_page'] < -1 )
diff --git a/wp-includes/registration.php b/wp-includes/registration.php
index 39b931c..8f99a01 100644
--- a/wp-includes/registration.php
+++ b/wp-includes/registration.php
@@ -10,12 +10,14 @@ function username_exists( $username ) {
return null;
}
+
function email_exists( $email ) {
global $wpdb;
$email = addslashes( $email );
return $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '$email'");
}
+
function validate_username( $username ) {
$name = sanitize_user($username, true);
$valid = true;
@@ -26,6 +28,7 @@ function validate_username( $username ) {
return apply_filters('validate_username', $valid, $username);
}
+
function wp_insert_user($userdata) {
global $wpdb;
@@ -123,6 +126,7 @@ function wp_insert_user($userdata) {
return $user_id;
}
+
function wp_update_user($userdata) {
global $wpdb;
@@ -146,7 +150,7 @@ function wp_update_user($userdata) {
// Update the cookies if the password changed.
$current_user = wp_get_current_user();
- if( $current_user->id == $ID ) {
+ if ( $current_user->id == $ID ) {
if ( isset($plaintext_pass) ) {
wp_clearcookie();
wp_setcookie($userdata['user_login'], $plaintext_pass);
@@ -156,11 +160,12 @@ function wp_update_user($userdata) {
return $user_id;
}
-function wp_create_user( $username, $password, $email = '') {
+
+function wp_create_user($username, $password, $email = '') {
global $wpdb;
- $user_login = $wpdb->escape( $username );
- $user_email = $wpdb->escape( $email );
+ $user_login = $wpdb->escape($username);
+ $user_email = $wpdb->escape($email);
$user_pass = $password;
$userdata = compact('user_login', 'user_email', 'user_pass');
@@ -168,9 +173,8 @@ function wp_create_user( $username, $password, $email = '') {
}
-function create_user( $username, $password, $email ) {
- return wp_create_user( $username, $password, $email );
+function create_user($username, $password, $email) {
+ return wp_create_user($username, $password, $email);
}
-
?>
diff --git a/wp-includes/vars.php b/wp-includes/vars.php
index 5bf2807..e5cf9ba 100644
--- a/wp-includes/vars.php
+++ b/wp-includes/vars.php
@@ -1,9 +1,9 @@
<?php
// On which page are we ?
-if (preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches)) {
+if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches) ) {
$pagenow = $self_matches[1];
-} else if (strstr($PHP_SELF, '?')) {
+} elseif ( strpos($PHP_SELF, '?') !== false ) {
$pagenow = explode('/', $PHP_SELF);
$pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
$pagenow = explode('?', $pagenow);
@@ -13,22 +13,23 @@ if (preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches)) {
}
// Simple browser detection
+// We should probably be doing true/false instead of 1/0 here ~ Mark
$is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0;
-if (preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT'])) {
+if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT']) )
$is_lynx = 1;
-} elseif (preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT'])) {
+elseif ( preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT']) )
$is_gecko = 1;
-} elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']))) {
+elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']) )
$is_winIE = 1;
-} elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']))) {
+elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']) )
$is_macIE = 1;
-} elseif (preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT'])) {
+elseif ( preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) )
$is_opera = 1;
-} elseif ((preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) ) || (preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']))) {
+elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']) )
$is_NS4 = 1;
-}
-$is_IE = (($is_macIE) || ($is_winIE));
+
+$is_IE = ( $is_macIE || $is_winIE );
// Server detection
$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;
@@ -37,58 +38,57 @@ $is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
- ':mrgreen:' => 'icon_mrgreen.gif',
- ':neutral:' => 'icon_neutral.gif',
- ':twisted:' => 'icon_twisted.gif',
- ':arrow:' => 'icon_arrow.gif',
- ':shock:' => 'icon_eek.gif',
- ':smile:' => 'icon_smile.gif',
- ':???:' => 'icon_confused.gif',
- ':cool:' => 'icon_cool.gif',
- ':evil:' => 'icon_evil.gif',
- ':grin:' => 'icon_biggrin.gif',
- ':idea:' => 'icon_idea.gif',
- ':oops:' => 'icon_redface.gif',
- ':razz:' => 'icon_razz.gif',
- ':roll:' => 'icon_rolleyes.gif',
- ':wink:' => 'icon_wink.gif',
- ':cry:' => 'icon_cry.gif',
- ':eek:' => 'icon_surprised.gif',
- ':lol:' => 'icon_lol.gif',
- ':mad:' => 'icon_mad.gif',
- ':sad:' => 'icon_sad.gif',
- '8-)' => 'icon_cool.gif',
- '8-O' => 'icon_eek.gif',
- ':-(' => 'icon_sad.gif',
- ':-)' => 'icon_smile.gif',
- ':-?' => 'icon_confused.gif',
- ':-D' => 'icon_biggrin.gif',
- ':-P' => 'icon_razz.gif',
- ':-o' => 'icon_surprised.gif',
- ':-x' => 'icon_mad.gif',
- ':-|' => 'icon_neutral.gif',
- ';-)' => 'icon_wink.gif',
- '8)' => 'icon_cool.gif',
- '8O' => 'icon_eek.gif',
- ':(' => 'icon_sad.gif',
- ':)' => 'icon_smile.gif',
- ':?' => 'icon_confused.gif',
- ':D' => 'icon_biggrin.gif',
- ':P' => 'icon_razz.gif',
- ':o' => 'icon_surprised.gif',
- ':x' => 'icon_mad.gif',
- ':|' => 'icon_neutral.gif',
- ';)' => 'icon_wink.gif',
- ':!:' => 'icon_exclaim.gif',
- ':?:' => 'icon_question.gif',
+ ':mrgreen:' => 'icon_mrgreen.gif',
+ ':neutral:' => 'icon_neutral.gif',
+ ':twisted:' => 'icon_twisted.gif',
+ ':arrow:' => 'icon_arrow.gif',
+ ':shock:' => 'icon_eek.gif',
+ ':smile:' => 'icon_smile.gif',
+ ':???:' => 'icon_confused.gif',
+ ':cool:' => 'icon_cool.gif',
+ ':evil:' => 'icon_evil.gif',
+ ':grin:' => 'icon_biggrin.gif',
+ ':idea:' => 'icon_idea.gif',
+ ':oops:' => 'icon_redface.gif',
+ ':razz:' => 'icon_razz.gif',
+ ':roll:' => 'icon_rolleyes.gif',
+ ':wink:' => 'icon_wink.gif',
+ ':cry:' => 'icon_cry.gif',
+ ':eek:' => 'icon_surprised.gif',
+ ':lol:' => 'icon_lol.gif',
+ ':mad:' => 'icon_mad.gif',
+ ':sad:' => 'icon_sad.gif',
+ '8-)' => 'icon_cool.gif',
+ '8-O' => 'icon_eek.gif',
+ ':-(' => 'icon_sad.gif',
+ ':-)' => 'icon_smile.gif',
+ ':-?' => 'icon_confused.gif',
+ ':-D' => 'icon_biggrin.gif',
+ ':-P' => 'icon_razz.gif',
+ ':-o' => 'icon_surprised.gif',
+ ':-x' => 'icon_mad.gif',
+ ':-|' => 'icon_neutral.gif',
+ ';-)' => 'icon_wink.gif',
+ '8)' => 'icon_cool.gif',
+ '8O' => 'icon_eek.gif',
+ ':(' => 'icon_sad.gif',
+ ':)' => 'icon_smile.gif',
+ ':?' => 'icon_confused.gif',
+ ':D' => 'icon_biggrin.gif',
+ ':P' => 'icon_razz.gif',
+ ':o' => 'icon_surprised.gif',
+ ':x' => 'icon_mad.gif',
+ ':|' => 'icon_neutral.gif',
+ ';)' => 'icon_wink.gif',
+ ':!:' => 'icon_exclaim.gif',
+ ':?:' => 'icon_question.gif',
);
}
-
// generates smilies' search & replace arrays
-foreach($wpsmiliestrans as $smiley => $img) {
- $wp_smiliessearch[] = '/(\s|^|[^<])?'.preg_quote($smiley, '/').'(\b|\s|$)/';
- $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
+foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
+ $wp_smiliessearch[] = '/(\s|^)'.preg_quote($smiley, '/').'(\s|$)/';
+ $smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
$wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}