summaryrefslogtreecommitdiffstats
path: root/wp-inst
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-20 10:39:28 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-20 10:39:28 +0000
commit4ebc9ae74b80b06ce5c5a215bb672b795642d56a (patch)
tree7a4224f5f146f95032ca387ba949689fdf997db4 /wp-inst
parentd0d9e6ad956ddf6aa3fbeb247f1a1894973077d5 (diff)
downloadwordpress-mu-4ebc9ae74b80b06ce5c5a215bb672b795642d56a.tar.gz
wordpress-mu-4ebc9ae74b80b06ce5c5a215bb672b795642d56a.tar.xz
wordpress-mu-4ebc9ae74b80b06ce5c5a215bb672b795642d56a.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@579 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst')
-rw-r--r--wp-inst/wp-admin/admin-functions.php2
-rw-r--r--wp-inst/wp-includes/comment.php24
-rw-r--r--wp-inst/wp-includes/functions.php160
-rw-r--r--wp-inst/wp-includes/plugin.php168
-rw-r--r--wp-inst/wp-includes/query.php14
-rw-r--r--wp-inst/wp-includes/vars.php89
-rw-r--r--wp-inst/wp-settings.php1
7 files changed, 244 insertions, 214 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index bb4b13c..e4b72b5 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -1895,7 +1895,7 @@ function wp_handle_upload(&$file, $overrides = false) {
$filename = str_replace("$number$ext", ++$number . $ext, $filename);
}
$filename = str_replace($ext, '', $filename);
- $filename = sanitize_title($filename) . $ext;
+ $filename = sanitize_title_with_dashes($filename) . $ext;
}
// Move the file to the uploads dir
diff --git a/wp-inst/wp-includes/comment.php b/wp-inst/wp-includes/comment.php
index 45547db..9751c36 100644
--- a/wp-inst/wp-includes/comment.php
+++ b/wp-inst/wp-includes/comment.php
@@ -252,7 +252,7 @@ function wp_delete_comment($comment_id) {
$post_id = $comment->comment_post_ID;
if ( $post_id && $comment->comment_approved == 1 )
- $wpdb->query( "UPDATE $wpdb->posts SET comment_count = comment_count - 1 WHERE ID = '$post_id'" );
+ wp_update_comment_count($post_id);
do_action('wp_set_comment_status', $comment_id, 'delete');
return true;
@@ -300,10 +300,9 @@ function wp_insert_comment($commentdata) {
$id = $wpdb->insert_id;
- if ( $comment_approved == 1) {
- $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
- $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$comment_post_ID'" );
- }
+ if ( $comment_approved == 1)
+ wp_update_comment_count($comment_post_ID);
+
return $id;
}
@@ -419,15 +418,24 @@ function wp_update_comment($commentarr) {
$rval = $wpdb->rows_affected;
- $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'" );
+ 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;
+ if ( !$post_id )
+ return false;
+ $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'");
+ $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'");
+ $comment_count_cache[$post_id] = $count;
+ return true;
+}
+
function pingback($content, $post_ID) {
global $wp_version, $wpdb;
include_once (ABSPATH . WPINC . '/class-IXR.php');
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index e673b1c..73bc0a9 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -578,142 +578,6 @@ function is_new_day() {
}
}
-// Filters: these are the core of WP's plugin architecture
-
-function merge_filters($tag) {
- global $wp_filter;
- if ( isset($wp_filter['all']) ) {
- foreach ($wp_filter['all'] as $priority => $functions) {
- if ( isset($wp_filter[$tag][$priority]) )
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]);
- else
- $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], array());
- $wp_filter[$tag][$priority] = array_unique($wp_filter[$tag][$priority]);
- }
- }
-
- if ( isset($wp_filter[$tag]) )
- ksort( $wp_filter[$tag] );
-}
-
-function apply_filters($tag, $string) {
- global $wp_filter;
-
- $args = array_slice(func_get_args(), 2);
-
- merge_filters($tag);
-
- if ( !isset($wp_filter[$tag]) ) {
- return $string;
- }
- foreach ($wp_filter[$tag] as $priority => $functions) {
- if ( !is_null($functions) ) {
- foreach($functions as $function) {
-
- $all_args = array_merge(array($string), $args);
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
-
- if ( $accepted_args == 1 )
- $the_args = array($string);
- elseif ( $accepted_args > 1 )
- $the_args = array_slice($all_args, 0, $accepted_args);
- elseif ( $accepted_args == 0 )
- $the_args = NULL;
- else
- $the_args = $all_args;
-
- $string = call_user_func_array($function_name, $the_args);
- }
- }
- }
- return $string;
-}
-
-function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
- global $wp_filter;
-
- // 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) {
- // uncomment if we want to match function AND accepted_args
- // if ( $filter == array($function, $accepted_args) ) {
- if ( $filter['function'] == $function_to_add ) {
- return true;
- }
- }
- }
-
- // So the format is wp_filter['tag']['array of priorities']['array of ['array (functions, accepted_args)]']
- $wp_filter[$tag]["$priority"][] = array('function'=>$function_to_add, 'accepted_args'=>$accepted_args);
- return true;
-}
-
-function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
- global $wp_filter;
-
- // rebuild the list of filters
- if ( isset($wp_filter[$tag]["$priority"]) ) {
- $new_function_list = array();
- foreach($wp_filter[$tag]["$priority"] as $filter) {
- if ( $filter['function'] != $function_to_remove ) {
- $new_function_list[] = $filter;
- }
- }
- $wp_filter[$tag]["$priority"] = $new_function_list;
- }
- return true;
-}
-
-// The *_action functions are just aliases for the *_filter functions, they take special strings instead of generic content
-
-function do_action($tag, $arg = '') {
- global $wp_filter;
- $extra_args = array_slice(func_get_args(), 2);
- if ( is_array($arg) )
- $args = array_merge($arg, $extra_args);
- else
- $args = array_merge(array($arg), $extra_args);
-
- merge_filters($tag);
-
- if ( !isset($wp_filter[$tag]) ) {
- return;
- }
- foreach ($wp_filter[$tag] as $priority => $functions) {
- if ( !is_null($functions) ) {
- foreach($functions as $function) {
-
- $function_name = $function['function'];
- $accepted_args = $function['accepted_args'];
-
- if ( $accepted_args == 1 ) {
- if ( is_array($arg) )
- $the_args = $arg;
- else
- $the_args = array($arg);
- } elseif ( $accepted_args > 1 ) {
- $the_args = array_slice($args, 0, $accepted_args);
- } elseif ( $accepted_args == 0 ) {
- $the_args = NULL;
- } else {
- $the_args = $args;
- }
-
- $string = call_user_func_array($function_name, $the_args);
- }
- }
- }
-}
-
-function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
- add_filter($tag, $function_to_add, $priority, $accepted_args);
-}
-
-function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
- remove_filter($tag, $function_to_remove, $priority, $accepted_args);
-}
-
function update_post_cache(&$posts) {
global $post_cache;
@@ -972,33 +836,15 @@ function nocache_headers() {
@ header('Pragma: no-cache');
}
-function register_activation_hook($file, $function) {
- $file = plugin_basename($file);
-
- add_action('activate_' . $file, $function);
-}
-
-function register_deactivation_hook($file, $function) {
- $file = plugin_basename($file);
-
- add_action('deactivate_' . $file, $function);
-}
-
-function plugin_basename($file) {
- $file = preg_replace('|\\\\+|', '\\\\', $file);
- $file = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
- return $file;
-}
-
function get_num_queries() {
global $wpdb;
return $wpdb->num_queries;
}
-function privacy_ping_filter() {
+function privacy_ping_filter( $sites ) {
global $current_blog;
- if ( $current_blog->public )
- return "http://rpc.pingomatic.com/\n";
+ if ( '0' != $current_blog->public )
+ return $sites;
else
return '';
}
diff --git a/wp-inst/wp-includes/plugin.php b/wp-inst/wp-includes/plugin.php
new file mode 100644
index 0000000..266c271
--- /dev/null
+++ b/wp-inst/wp-includes/plugin.php
@@ -0,0 +1,168 @@
+<?php
+
+//
+// Filter functions, the core of the WP plugin architecture.
+//
+
+function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+ global $wp_filter;
+
+ // 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) {
+ // uncomment if we want to match function AND accepted_args
+ // if ( $filter == array($function, $accepted_args) ) {
+ if ( $filter['function'] == $function_to_add ) {
+ return true;
+ }
+ }
+ }
+
+ // So the format is wp_filter['tag']['array of priorities']['array of ['array (functions, accepted_args)]']
+ $wp_filter[$tag]["$priority"][] = array('function'=>$function_to_add, 'accepted_args'=>$accepted_args);
+ return true;
+}
+
+function apply_filters($tag, $string) {
+ global $wp_filter;
+
+ $args = array_slice(func_get_args(), 2);
+
+ merge_filters($tag);
+
+ if ( !isset($wp_filter[$tag]) ) {
+ return $string;
+ }
+ foreach ($wp_filter[$tag] as $priority => $functions) {
+ if ( !is_null($functions) ) {
+ foreach($functions as $function) {
+
+ $all_args = array_merge(array($string), $args);
+ $function_name = $function['function'];
+ $accepted_args = $function['accepted_args'];
+
+ if ( $accepted_args == 1 )
+ $the_args = array($string);
+ elseif ( $accepted_args > 1 )
+ $the_args = array_slice($all_args, 0, $accepted_args);
+ elseif ( $accepted_args == 0 )
+ $the_args = NULL;
+ else
+ $the_args = $all_args;
+
+ $string = call_user_func_array($function_name, $the_args);
+ }
+ }
+ }
+ return $string;
+}
+
+
+function merge_filters($tag) {
+ global $wp_filter;
+ if ( isset($wp_filter['all']) ) {
+ foreach ($wp_filter['all'] as $priority => $functions) {
+ if ( isset($wp_filter[$tag][$priority]) )
+ $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]);
+ else
+ $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], array());
+ $wp_filter[$tag][$priority] = array_unique($wp_filter[$tag][$priority]);
+ }
+ }
+
+ if ( isset($wp_filter[$tag]) )
+ ksort( $wp_filter[$tag] );
+}
+
+
+
+function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+ global $wp_filter;
+
+ // rebuild the list of filters
+ if ( isset($wp_filter[$tag]["$priority"]) ) {
+ $new_function_list = array();
+ foreach($wp_filter[$tag]["$priority"] as $filter) {
+ if ( $filter['function'] != $function_to_remove ) {
+ $new_function_list[] = $filter;
+ }
+ }
+ $wp_filter[$tag]["$priority"] = $new_function_list;
+ }
+ return true;
+}
+
+//
+// Action functions
+//
+
+function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+ add_filter($tag, $function_to_add, $priority, $accepted_args);
+}
+
+function do_action($tag, $arg = '') {
+ global $wp_filter;
+ $extra_args = array_slice(func_get_args(), 2);
+ if ( is_array($arg) )
+ $args = array_merge($arg, $extra_args);
+ else
+ $args = array_merge(array($arg), $extra_args);
+
+ merge_filters($tag);
+
+ if ( !isset($wp_filter[$tag]) ) {
+ return;
+ }
+ foreach ($wp_filter[$tag] as $priority => $functions) {
+ if ( !is_null($functions) ) {
+ foreach($functions as $function) {
+
+ $function_name = $function['function'];
+ $accepted_args = $function['accepted_args'];
+
+ if ( $accepted_args == 1 ) {
+ if ( is_array($arg) )
+ $the_args = $arg;
+ else
+ $the_args = array($arg);
+ } elseif ( $accepted_args > 1 ) {
+ $the_args = array_slice($args, 0, $accepted_args);
+ } elseif ( $accepted_args == 0 ) {
+ $the_args = NULL;
+ } else {
+ $the_args = $args;
+ }
+
+ $string = call_user_func_array($function_name, $the_args);
+ }
+ }
+ }
+}
+
+function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+ remove_filter($tag, $function_to_remove, $priority, $accepted_args);
+}
+
+//
+// Functions for handling plugins.
+//
+
+function plugin_basename($file) {
+ $file = preg_replace('|\\\\+|', '\\\\', $file);
+ $file = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
+ return $file;
+}
+
+function register_activation_hook($file, $function) {
+ $file = plugin_basename($file);
+
+ add_action('activate_' . $file, $function);
+}
+
+function register_deactivation_hook($file, $function) {
+ $file = plugin_basename($file);
+
+ add_action('deactivate_' . $file, $function);
+}
+
+?>
diff --git a/wp-inst/wp-includes/query.php b/wp-inst/wp-includes/query.php
index 034b271..0aca74b 100644
--- a/wp-inst/wp-includes/query.php
+++ b/wp-inst/wp-includes/query.php
@@ -708,7 +708,7 @@ class WP_Query {
$q['cat'] = addslashes_gpc($q['cat']);
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
$cat_array = preg_split('/[,\s]+/', $q['cat']);
- $in_cats = $out_cats = '';
+ $in_cats = $out_cats = $out_posts = '';
foreach ( $cat_array as $cat ) {
$cat = intval($cat);
$in = strstr($cat, '-') ? false : true;
@@ -722,8 +722,16 @@ class WP_Query {
$out_cats = substr($out_cats, 0, -2);
if ( strlen($in_cats) > 0 )
$in_cats = " AND category_id IN ($in_cats)";
- if ( strlen($out_cats) > 0 )
- $out_cats = " AND category_id NOT IN ($out_cats)";
+ if ( strlen($out_cats) > 0 ) {
+ $ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id IN ($out_cats)");
+ if ( is_array($ids) && count($ids > 0) ) {
+ foreach ( $ids as $id )
+ $out_posts .= "$id, ";
+ $out_posts = substr($out_posts, 0, -2);
+ }
+ if ( strlen($out_posts) > 0 )
+ $out_cats = " AND ID NOT IN ($out_posts)";
+ }
$whichcat = $in_cats . $out_cats;
$distinct = 'DISTINCT';
}
diff --git a/wp-inst/wp-includes/vars.php b/wp-inst/wp-includes/vars.php
index ef7e7a0..bb1a18b 100644
--- a/wp-inst/wp-includes/vars.php
+++ b/wp-inst/wp-includes/vars.php
@@ -42,51 +42,50 @@ if ( isset($_SERVER['HTTP_PC_REMOTE_ADDR']) )
// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(
- ' :)' => 'icon_smile.gif',
- ' :D' => 'icon_biggrin.gif',
- ' :-D' => 'icon_biggrin.gif',
- ':grin:' => 'icon_biggrin.gif',
- ' :)' => 'icon_smile.gif',
- ' :-)' => 'icon_smile.gif',
- ':smile:' => 'icon_smile.gif',
- ' :(' => 'icon_sad.gif',
- ' :-(' => 'icon_sad.gif',
- ':sad:' => 'icon_sad.gif',
- ' :o' => 'icon_surprised.gif',
- ' :-o' => 'icon_surprised.gif',
- ':eek:' => 'icon_surprised.gif',
- ' 8O' => 'icon_eek.gif',
- ' 8-O' => 'icon_eek.gif',
- ':shock:' => 'icon_eek.gif',
- ' :?' => 'icon_confused.gif',
- ' :-?' => 'icon_confused.gif',
- ' :???:' => 'icon_confused.gif',
- ' 8)' => 'icon_cool.gif',
- ' 8-)' => 'icon_cool.gif',
- ':cool:' => 'icon_cool.gif',
- ':lol:' => 'icon_lol.gif',
- ' :x' => 'icon_mad.gif',
- ' :-x' => 'icon_mad.gif',
- ':mad:' => 'icon_mad.gif',
- ' :P' => 'icon_razz.gif',
- ' :-P' => 'icon_razz.gif',
- ':razz:' => 'icon_razz.gif',
- ':oops:' => 'icon_redface.gif',
- ':cry:' => 'icon_cry.gif',
- ':evil:' => 'icon_evil.gif',
- ':twisted:' => 'icon_twisted.gif',
- ':roll:' => 'icon_rolleyes.gif',
- ':wink:' => 'icon_wink.gif',
- ' ;)' => 'icon_wink.gif',
- ' ;-)' => 'icon_wink.gif',
- ':!:' => 'icon_exclaim.gif',
- ':?:' => 'icon_question.gif',
- ':idea:' => 'icon_idea.gif',
- ':arrow:' => 'icon_arrow.gif',
- ' :|' => 'icon_neutral.gif',
- ' :-|' => 'icon_neutral.gif',
- ':neutral:' => 'icon_neutral.gif',
- ':mrgreen:' => 'icon_mrgreen.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',
);
}
diff --git a/wp-inst/wp-settings.php b/wp-inst/wp-settings.php
index 420adcd..a7cb2b4 100644
--- a/wp-inst/wp-settings.php
+++ b/wp-inst/wp-settings.php
@@ -131,6 +131,7 @@ if( defined( "BLOGDEFINITION" ) && constant( "BLOGDEFINITION" ) == true )
define( "UPLOADS", "wp-content/blogs.dir/{$wpdb->blogid}/files" );
require (ABSPATH . WPINC . '/functions.php');
+require (ABSPATH . WPINC . '/plugin.php');
require (ABSPATH . WPINC . '/default-filters.php');
require_once (ABSPATH . WPINC . '/l10n.php');