summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-11 15:20:48 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-11 15:20:48 +0000
commit91c2d227e28206ec57d2b857822d90b11af256d3 (patch)
treeb5eb7cf33ac2251d358b16b6d62af570d69aa224 /wp-includes
parent93b61271ad288c6031c6b33405711e89a1575be2 (diff)
downloadwordpress-mu-91c2d227e28206ec57d2b857822d90b11af256d3.tar.gz
wordpress-mu-91c2d227e28206ec57d2b857822d90b11af256d3.tar.xz
wordpress-mu-91c2d227e28206ec57d2b857822d90b11af256d3.zip
WP Merge to 4182
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@736 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/functions.php4
-rw-r--r--wp-includes/plugin.php37
-rw-r--r--wp-includes/post-template.php2
-rw-r--r--wp-includes/post.php31
4 files changed, 48 insertions, 26 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index de40712..230bf96 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -275,7 +275,7 @@ function update_option($option_name, $newvalue) {
$option_name = $wpdb->escape($option_name);
$wpdb->query("UPDATE $wpdb->options SET option_value = '$newvalue' WHERE option_name = '$option_name'");
if ( $wpdb->rows_affected == 1 ) {
- do_action("update_option_{$option_name}", array('old'=>$oldvalue, 'new'=>$_newvalue));
+ do_action("update_option_{$option_name}", $oldvalue, $_newvalue);
return true;
}
return false;
@@ -1107,7 +1107,7 @@ function wp_explain_nonce($action) {
}
}
- return __('Are you sure you want to do this?');
+ return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __('Are you sure you want to do this?'), $matches[4] );
}
function wp_nonce_ays($action) {
diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
index 266c271..1fe2c80 100644
--- a/wp-includes/plugin.php
+++ b/wp-includes/plugin.php
@@ -26,7 +26,9 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
function apply_filters($tag, $string) {
global $wp_filter;
- $args = array_slice(func_get_args(), 2);
+ $args = array();
+ for ( $a = 2; $a < func_num_args(); $a++ )
+ $args[] = func_get_arg($a);
merge_filters($tag);
@@ -37,18 +39,15 @@ function apply_filters($tag, $string) {
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);
+ $the_args = $args;
+ array_unshift($the_args, $string);
+ if ( $accepted_args > 0 )
+ $the_args = array_slice($the_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);
}
@@ -102,11 +101,13 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
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);
+ $args = array();
+ if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this)
+ $args[] =& $arg[0];
else
- $args = array_merge(array($arg), $extra_args);
+ $args[] = $arg;
+ for ( $a = 2; $a < func_num_args(); $a++ )
+ $args[] = func_get_arg($a);
merge_filters($tag);
@@ -120,18 +121,12 @@ function do_action($tag, $arg = '') {
$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 ) {
+ if ( $accepted_args > 0 )
$the_args = array_slice($args, 0, $accepted_args);
- } elseif ( $accepted_args == 0 ) {
+ elseif ( $accepted_args == 0 )
$the_args = NULL;
- } else {
+ else
$the_args = $args;
- }
$string = call_user_func_array($function_name, $the_args);
}
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 7acd655..8207720 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -265,7 +265,7 @@ function wp_list_pages($args = '') {
parse_str($args, $r);
$defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'),
- 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1);
+ 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '');
$r = array_merge($defaults, $r);
$output = '';
diff --git a/wp-includes/post.php b/wp-includes/post.php
index ebb1799..1894225 100644
--- a/wp-includes/post.php
+++ b/wp-includes/post.php
@@ -507,7 +507,7 @@ function wp_insert_post($postarr = array()) {
$ping_status = apply_filters('ping_status_pre', $ping_status);
}
- if ( ('' == $post_content) && ('' == $post_title) )
+ if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) )
return 0;
// Make sure we set a valid category
@@ -1037,7 +1037,7 @@ function &get_pages($args = '') {
parse_str($args, $r);
$defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title',
- 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '');
+ 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
$r = array_merge($defaults, $r);
extract($r);
@@ -1075,10 +1075,37 @@ function &get_pages($args = '') {
if (!empty($exclusions))
$exclusions .= ')';
+ $author_query = '';
+ if (!empty($authors)) {
+ $post_authors = preg_split('/[\s,]+/',$authors);
+
+ if ( count($post_authors) ) {
+ foreach ( $post_authors as $post_author ) {
+ //Do we have an author id or an author login?
+ if ( 0 == intval($post_author) ) {
+ $post_author = get_userdatabylogin($post_author);
+ if ( empty($post_author) )
+ continue;
+ if ( empty($post_author->ID) )
+ continue;
+ $post_author = $post_author->ID;
+ }
+
+ if ( '' == $author_query )
+ $author_query = ' post_author = ' . intval($post_author) . ' ';
+ else
+ $author_query .= ' OR post_author = ' . intval($post_author) . ' ';
+ }
+ if ( '' != $author_query )
+ $author_query = " AND ($author_query)";
+ }
+ }
+
$query = "SELECT * FROM $wpdb->posts " ;
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
$query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ;
$query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
+ $query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order ;
$pages = $wpdb->get_results($query);