(int)er the dragon.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -144,7 +144,7 @@ function the_author_posts_link($deprecated = '') {
|
||||
|
||||
function get_author_posts_url($author_id, $author_nicename = '') {
|
||||
global $wpdb, $wp_rewrite, $post, $cache_userdata;
|
||||
$auth_ID = $author_id;
|
||||
$auth_ID = (int) $author_id;
|
||||
$link = $wp_rewrite->get_author_permastruct();
|
||||
|
||||
if ( empty($link) ) {
|
||||
|
||||
@@ -165,7 +165,8 @@ function get_linkcatname($id = 0) {
|
||||
if ( empty($cats) || ! is_array($cats) )
|
||||
return '';
|
||||
|
||||
$cat_id = $cats[0]; // Take the first cat.
|
||||
$cat_id = (int)
|
||||
$cats[0]; // Take the first cat.
|
||||
|
||||
$cat = get_category($cat_id);
|
||||
return $cat->cat_name;
|
||||
|
||||
@@ -64,7 +64,8 @@ global $post, $category_cache, $blog_id;
|
||||
|
||||
$id = (int) $id;
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int)
|
||||
$post->ID;
|
||||
|
||||
if ( !isset($category_cache[$blog_id][$id]) )
|
||||
update_post_category_cache($id);
|
||||
|
||||
@@ -150,7 +150,7 @@ function get_comments_number( $post_id = 0 ) {
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
if ( !$post_id )
|
||||
$post_id = $id;
|
||||
$post_id = (int) $id;
|
||||
|
||||
$post = get_post($post_id);
|
||||
if ( ! isset($post->comment_count) )
|
||||
|
||||
@@ -345,7 +345,7 @@ function wp_insert_comment($commentdata) {
|
||||
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
|
||||
");
|
||||
|
||||
$id = $wpdb->insert_id;
|
||||
$id = (int) $wpdb->insert_id;
|
||||
|
||||
if ( $comment_approved == 1)
|
||||
wp_update_comment_count($comment_post_ID);
|
||||
@@ -392,7 +392,7 @@ function wp_new_comment( $commentdata ) {
|
||||
|
||||
$commentdata['comment_approved'] = wp_allow_comment($commentdata);
|
||||
|
||||
$comment_ID = wp_insert_comment($commentdata);
|
||||
$comment_ID = (int) wp_insert_comment($commentdata);
|
||||
|
||||
do_action('comment_post', $comment_ID, $commentdata['comment_approved']);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ function comments_rss($commentsrssfilename = 'nolongerused') {
|
||||
|
||||
|
||||
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
||||
$auth_ID = $author_id;
|
||||
$auth_ID = (int) $author_id;
|
||||
$permalink_structure = get_option('permalink_structure');
|
||||
|
||||
if ( '' == $permalink_structure ) {
|
||||
|
||||
@@ -646,7 +646,7 @@ function update_post_category_cache($post_ids) {
|
||||
$post_id_array = (array) explode(',', $post_ids);
|
||||
$count = count( $post_id_array);
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$post_id = $post_id_array[ $i ];
|
||||
$post_id = (int) $post_id_array[ $i ];
|
||||
if ( isset( $category_cache[$blog_id][$post_id] ) ) {
|
||||
unset( $post_id_array[ $i ] );
|
||||
continue;
|
||||
@@ -700,7 +700,7 @@ function update_postmeta_cache($post_id_list = '') {
|
||||
$post_id_array = (array) explode(',', $post_id_list);
|
||||
$count = count( $post_id_array);
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$post_id = $post_id_array[ $i ];
|
||||
$post_id = (int) $post_id_array[ $i ];
|
||||
if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached
|
||||
unset( $post_id_array[ $i ] );
|
||||
continue;
|
||||
|
||||
@@ -119,7 +119,7 @@ function get_page_link($id = false) {
|
||||
|
||||
$id = (int) $id;
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
|
||||
$link = get_option('home');
|
||||
@@ -134,7 +134,7 @@ function _get_page_link( $id = false ) {
|
||||
global $post, $wp_rewrite;
|
||||
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
$pagestruct = $wp_rewrite->get_page_permastruct();
|
||||
|
||||
@@ -156,7 +156,7 @@ function get_attachment_link($id = false) {
|
||||
$link = false;
|
||||
|
||||
if (! $id) {
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
}
|
||||
|
||||
$object = get_post($id);
|
||||
@@ -259,7 +259,7 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
|
||||
global $id;
|
||||
|
||||
if ( empty($post_id) )
|
||||
$post_id = $id;
|
||||
$post_id = (int) $id;
|
||||
|
||||
if ( '' != get_option('permalink_structure') ) {
|
||||
$url = trailingslashit( get_permalink() ) . 'feed';
|
||||
|
||||
@@ -525,7 +525,7 @@ endif;
|
||||
if ( !function_exists('wp_verify_nonce') ) :
|
||||
function wp_verify_nonce($nonce, $action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = $user->id;
|
||||
$uid = (int) $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
@@ -539,7 +539,7 @@ endif;
|
||||
if ( !function_exists('wp_create_nonce') ) :
|
||||
function wp_create_nonce($action = -1) {
|
||||
$user = wp_get_current_user();
|
||||
$uid = $user->id;
|
||||
$uid = (int) $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ function get_post_custom($post_id = 0) {
|
||||
global $id, $post_meta_cache, $wpdb, $blog_id;
|
||||
|
||||
if ( !$post_id )
|
||||
$post_id = $id;
|
||||
$post_id = (int) $id;
|
||||
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
@@ -539,7 +539,7 @@ function wp_insert_post($postarr = array()) {
|
||||
|
||||
// Get the post ID.
|
||||
if ( $update )
|
||||
$post_ID = $ID;
|
||||
$post_ID = (int) $ID;
|
||||
|
||||
// Create a valid post name. Drafts are allowed to have an empty
|
||||
// post name.
|
||||
@@ -1256,7 +1256,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
|
||||
$update = false;
|
||||
if ( !empty($ID) ) {
|
||||
$update = true;
|
||||
$post_ID = $ID;
|
||||
$post_ID = (int) $ID;
|
||||
}
|
||||
|
||||
// Create a valid post name.
|
||||
@@ -1506,7 +1506,7 @@ function wp_mime_type_icon( $mime = 0 ) {
|
||||
$mime = (int) $mime;
|
||||
if ( !$post =& get_post( $mime ) )
|
||||
return false;
|
||||
$post_id = $post->ID;
|
||||
$post_id = (int) $post->ID;
|
||||
$mime = $post->post_mime_type;
|
||||
}
|
||||
|
||||
|
||||
@@ -587,7 +587,7 @@ class WP_Query {
|
||||
if ( '' != $qv['pagename'] ) {
|
||||
$this->queried_object =& get_page_by_path($qv['pagename']);
|
||||
if ( !empty($this->queried_object) )
|
||||
$this->queried_object_id = $this->queried_object->ID;
|
||||
$this->queried_object_id = (int) $this->queried_object->ID;
|
||||
else
|
||||
unset($this->queried_object);
|
||||
|
||||
@@ -1205,18 +1205,18 @@ class WP_Query {
|
||||
$cat = $this->get('cat');
|
||||
$category = &get_category($cat);
|
||||
$this->queried_object = &$category;
|
||||
$this->queried_object_id = $cat;
|
||||
$this->queried_object_id = (int) $cat;
|
||||
} else if ($this->is_posts_page) {
|
||||
$this->queried_object = & get_page(get_option('page_for_posts'));
|
||||
$this->queried_object_id = $this->queried_object->ID;
|
||||
$this->queried_object_id = (int) $this->queried_object->ID;
|
||||
} else if ($this->is_single) {
|
||||
$this->queried_object = $this->post;
|
||||
$this->queried_object_id = $this->post->ID;
|
||||
$this->queried_object_id = (int) $this->post->ID;
|
||||
} else if ($this->is_page) {
|
||||
$this->queried_object = $this->post;
|
||||
$this->queried_object_id = $this->post->ID;
|
||||
$this->queried_object_id = (int) $this->post->ID;
|
||||
} else if ($this->is_author) {
|
||||
$author_id = $this->get('author');
|
||||
$author_id = (int) $this->get('author');
|
||||
$author = get_userdata($author_id);
|
||||
$this->queried_object = $author;
|
||||
$this->queried_object_id = $author_id;
|
||||
@@ -1285,7 +1285,7 @@ function setup_postdata($post) {
|
||||
global $id, $postdata, $authordata, $day, $page, $pages, $multipage, $more, $numpages, $wp_query;
|
||||
global $pagenow;
|
||||
|
||||
$id = $post->ID;
|
||||
$id = (int) $post->ID;
|
||||
|
||||
$authordata = get_userdata($post->post_author);
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ function wp_insert_user($userdata) {
|
||||
$query = "UPDATE $wpdb->users SET user_pass='$user_pass', user_email='$user_email', user_url='$user_url', user_nicename = '$user_nicename', display_name = '$display_name' WHERE ID = '$ID'";
|
||||
$query = apply_filters('update_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
$user_id = $ID;
|
||||
$user_id = (int) $ID;
|
||||
} else {
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
|
||||
@@ -97,7 +97,7 @@ function wp_insert_user($userdata) {
|
||||
('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
|
||||
$query = apply_filters('create_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
$user_id = $wpdb->insert_id;
|
||||
$user_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
update_usermeta( $user_id, 'first_name', $first_name);
|
||||
|
||||
@@ -346,7 +346,7 @@ function get_home_template() {
|
||||
function get_page_template() {
|
||||
global $wp_query;
|
||||
|
||||
$id = $wp_query->post->ID;
|
||||
$id = (int) $wp_query->post->ID;
|
||||
$template = get_post_meta($id, '_wp_page_template', true);
|
||||
|
||||
if ( 'default' == $template )
|
||||
|
||||
@@ -56,7 +56,7 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
|
||||
function get_users_of_blog( $id = '' ) {
|
||||
global $wpdb, $blog_id;
|
||||
if ( empty($id) )
|
||||
$id = $blog_id;
|
||||
$id = (int) $blog_id;
|
||||
$users = $wpdb->get_results( "SELECT user_id, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND meta_key = '" . $wpdb->prefix . "capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
|
||||
return $users;
|
||||
}
|
||||
@@ -171,8 +171,8 @@ function setup_userdata($user_id = '') {
|
||||
|
||||
$userdata = $user->data;
|
||||
$user_login = $user->user_login;
|
||||
$user_level = $user->user_level;
|
||||
$user_ID = $user->ID;
|
||||
$user_level = (int) $user->user_level;
|
||||
$user_ID = (int) $user->ID;
|
||||
$user_email = $user->user_email;
|
||||
$user_url = $user->user_url;
|
||||
$user_pass_md5 = md5($user->user_pass);
|
||||
|
||||
Reference in New Issue
Block a user