(int)er the dragon.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2007-03-23 00:59:21 +00:00
parent 46fa88baf1
commit 7602d17899
31 changed files with 434 additions and 432 deletions

14
app.php
View File

@ -417,9 +417,9 @@ EOD;
if(!current_user_can($cap)) if(!current_user_can($cap))
$this->auth_required('Sorry, you do not have the right to edit/publish new posts.'); $this->auth_required('Sorry, you do not have the right to edit/publish new posts.');
$blog_ID = $current_blog->blog_id; $blog_ID = (int )$current_blog->blog_id;
$post_status = ($publish) ? 'publish' : 'draft'; $post_status = ($publish) ? 'publish' : 'draft';
$post_author = $user->ID; $post_author = (int) $user->ID;
$post_title = $entry->title; $post_title = $entry->title;
$post_content = $entry->content; $post_content = $entry->content;
$post_excerpt = $entry->summary; $post_excerpt = $entry->summary;
@ -430,7 +430,7 @@ EOD;
log_app('Inserting Post. Data:', print_r($post_data,true)); log_app('Inserting Post. Data:', print_r($post_data,true));
$postID = wp_insert_post($post_data); $postID = (int) wp_insert_post($post_data);
if (!$postID) { if (!$postID) {
$this->internal_error('Sorry, your entry could not be posted. Something wrong happened.'); $this->internal_error('Sorry, your entry could not be posted. Something wrong happened.');
@ -582,7 +582,7 @@ EOD;
); );
// Save the data // Save the data
$postID = wp_insert_attachment($attachment, $file, $post); $postID = (int) wp_insert_attachment($attachment, $file, $post);
if (!$postID) { if (!$postID) {
$this->internal_error('Sorry, your entry could not be posted. Something wrong happened.'); $this->internal_error('Sorry, your entry could not be posted. Something wrong happened.');
@ -788,7 +788,7 @@ EOD;
global $use_querystring; global $use_querystring;
if(!isset($postID)) { if(!isset($postID)) {
global $post; global $post;
$postID = $GLOBALS['post']->ID; $postID = (int) $GLOBALS['post']->ID;
} }
if ($use_querystring) { if ($use_querystring) {
@ -810,7 +810,7 @@ EOD;
global $use_querystring; global $use_querystring;
if(!isset($postID)) { if(!isset($postID)) {
global $post; global $post;
$postID = $GLOBALS['post']->ID; $postID = (int) $GLOBALS['post']->ID;
} }
if ($use_querystring) { if ($use_querystring) {
@ -885,7 +885,7 @@ EOD;
$wp = $GLOBALS['wp']; $wp = $GLOBALS['wp'];
$wp_query = $GLOBALS['wp_query']; $wp_query = $GLOBALS['wp_query'];
$wpdb = $GLOBALS['wpdb']; $wpdb = $GLOBALS['wpdb'];
$blog_id = $GLOBALS['blog_id']; $blog_id = (int) $GLOBALS['blog_id'];
$post_cache = $GLOBALS['post_cache']; $post_cache = $GLOBALS['post_cache'];

View File

@ -115,8 +115,8 @@ case 'add-category' : // On the Fly
$cat_name = trim($cat_name); $cat_name = trim($cat_name);
if ( !$category_nicename = sanitize_title($cat_name) ) if ( !$category_nicename = sanitize_title($cat_name) )
die('0'); die('0');
if ( !$cat_id = category_exists( $cat_name ) ) if ( !$cat_id = (int) category_exists( $cat_name ) )
$cat_id = wp_create_category( $cat_name ); $cat_id = (int) wp_create_category( $cat_name );
$cat_name = wp_specialchars(stripslashes($cat_name)); $cat_name = wp_specialchars(stripslashes($cat_name));
$x->add( array( $x->add( array(
'what' => 'category', 'what' => 'category',
@ -156,13 +156,13 @@ case 'add-meta' :
die('-1'); die('-1');
if ( $id < 0 ) { if ( $id < 0 ) {
$now = current_time('timestamp', 1); $now = current_time('timestamp', 1);
if ( $pid = wp_insert_post( array( if ( $pid = (int) wp_insert_post( array(
'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now))
) ) ) ) ) )
$mid = add_meta( $pid ); $mid = (int) add_meta( $pid );
else else
die('0'); die('0');
} else if ( !$mid = add_meta( $id ) ) { } else if ( !$mid = (int) add_meta( $id ) ) {
die('0'); die('0');
} }
@ -204,7 +204,7 @@ case 'add-user' :
if ( !current_user_can('edit_users') ) if ( !current_user_can('edit_users') )
die('-1'); die('-1');
require_once(ABSPATH . WPINC . '/registration.php'); require_once(ABSPATH . WPINC . '/registration.php');
if ( !$user_id = add_user() ) if ( !$user_id = (int) add_user() )
die('0'); die('0');
elseif ( is_wp_error( $user_id ) ) { elseif ( is_wp_error( $user_id ) ) {
foreach( $user_id->get_error_messages() as $message ) foreach( $user_id->get_error_messages() as $message )
@ -230,7 +230,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
if($_POST['post_ID'] < 0) { if($_POST['post_ID'] < 0) {
$_POST['temp_ID'] = $_POST['post_ID']; $_POST['temp_ID'] = $_POST['post_ID'];
$id = wp_write_post(); $id = (int) wp_write_post();
if(is_wp_error($id)) if(is_wp_error($id))
die($id->get_error_message()); die($id->get_error_message());
else else

View File

@ -123,7 +123,7 @@ function wp_insert_category($catarr) {
if (!$update) { if (!$update) {
$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')"); $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");
$cat_ID = $wpdb->insert_id; $cat_ID = (int) $wpdb->insert_id;
} else { } else {
$wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'"); $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");
} }
@ -360,7 +360,7 @@ function wp_insert_link($linkdata) {
WHERE link_id='$link_id'"); WHERE link_id='$link_id'");
} else { } else {
$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
$link_id = $wpdb->insert_id; $link_id = (int) $wpdb->insert_id;
} }
wp_set_link_cats($link_id, $link_category); wp_set_link_cats($link_id, $link_category);

View File

@ -114,7 +114,7 @@ function wp_write_post() {
// Reunite any orphaned attachments with their parent // Reunite any orphaned attachments with their parent
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
$draft_ids = array(); $draft_ids = array();
if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
relocate_children( $draft_temp_id, $post_ID ); relocate_children( $draft_temp_id, $post_ID );
if ( $temp_id && $temp_id != $draft_temp_id ) if ( $temp_id && $temp_id != $draft_temp_id )
relocate_children( $temp_id, $post_ID ); relocate_children( $temp_id, $post_ID );
@ -157,7 +157,7 @@ function fix_attachment_links( $post_ID ) {
if ( 0 == preg_match( $search, $anchor, $id_matches ) ) if ( 0 == preg_match( $search, $anchor, $id_matches ) )
continue; continue;
$id = $id_matches[3]; $id = (int) $id_matches[3];
// While we have the attachment ID, let's adopt any orphans. // While we have the attachment ID, let's adopt any orphans.
$attachment = & get_post( $id, ARRAY_A ); $attachment = & get_post( $id, ARRAY_A );
@ -290,7 +290,7 @@ function edit_post() {
// Reunite any orphaned attachments with their parent // Reunite any orphaned attachments with their parent
if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
$draft_ids = array(); $draft_ids = array();
if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) )
relocate_children( $draft_temp_id, $post_ID ); relocate_children( $draft_temp_id, $post_ID );
// Now that we have an ID we can fix any attachment anchor hrefs // Now that we have an ID we can fix any attachment anchor hrefs
@ -447,7 +447,7 @@ function get_user_to_edit( $user_id ) {
function add_user() { function add_user() {
if ( func_num_args() ) { // The hackiest hack that ever did hack if ( func_num_args() ) { // The hackiest hack that ever did hack
global $current_user, $wp_roles; global $current_user, $wp_roles;
$user_id = func_get_arg( 0 ); $user_id = (int) func_get_arg( 0 );
if ( isset( $_POST['role'] ) ) { if ( isset( $_POST['role'] ) ) {
if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) { if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
@ -465,7 +465,7 @@ function edit_user( $user_id = 0 ) {
global $current_user, $wp_roles, $wpdb; global $current_user, $wp_roles, $wpdb;
if ( $user_id != 0 ) { if ( $user_id != 0 ) {
$update = true; $update = true;
$user->ID = $user_id; $user->ID = (int) $user_id;
$userdata = get_userdata( $user_id ); $userdata = get_userdata( $user_id );
$user->user_login = $wpdb->escape( $userdata->user_login ); $user->user_login = $wpdb->escape( $userdata->user_login );
} else { } else {
@ -562,9 +562,9 @@ function edit_user( $user_id = 0 ) {
return $errors; return $errors;
if ( $update ) { if ( $update ) {
$user_id = wp_update_user( get_object_vars( $user )); $user_id = (int) wp_update_user( get_object_vars( $user ));
} else { } else {
$user_id = wp_insert_user( get_object_vars( $user )); $user_id = (int) wp_insert_user( get_object_vars( $user ));
wp_new_user_notification( $user_id ); wp_new_user_notification( $user_id );
} }
return $user_id; return $user_id;
@ -793,8 +793,8 @@ function _cat_row( $category, $level, $name_override = false ) {
$pad = str_repeat( '&#8212; ', $level ); $pad = str_repeat( '&#8212; ', $level );
if ( current_user_can( 'manage_categories' ) ) { if ( current_user_can( 'manage_categories' ) ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>"; $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>";
$default_cat_id = get_option( 'default_category' ); $default_cat_id = (int) get_option( 'default_category' );
$default_link_cat_id = get_option( 'default_link_category' ); $default_link_cat_id = (int) get_option( 'default_link_category' );
if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) ) if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>"; $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
@ -833,7 +833,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
$post->post_title = wp_specialchars( $post->post_title ); $post->post_title = wp_specialchars( $post->post_title );
$pad = str_repeat( '&#8212; ', $level ); $pad = str_repeat( '&#8212; ', $level );
$id = $post->ID; $id = (int) $post->ID;
$class = ('alternate' == $class ) ? '' : 'alternate'; $class = ('alternate' == $class ) ? '' : 'alternate';
?> ?>
<tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'> <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
@ -1969,7 +1969,7 @@ function wp_import_handle_upload() {
); );
// Save the data // Save the data
$id = wp_insert_attachment( $object, $file ); $id = (int) wp_insert_attachment( $object, $file );
return array( 'file' => $file, 'id' => $id ); return array( 'file' => $file, 'id' => $id );
} }

View File

@ -1,323 +1,323 @@
<?php <?php
class Custom_Image_Header { class Custom_Image_Header {
var $admin_header_callback; var $admin_header_callback;
function Custom_Image_Header($admin_header_callback) { function Custom_Image_Header($admin_header_callback) {
$this->admin_header_callback = $admin_header_callback; $this->admin_header_callback = $admin_header_callback;
} }
function init() { function init() {
$page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page')); $page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
add_action("admin_print_scripts-$page", array(&$this, 'js_includes')); add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
add_action("admin_head-$page", array(&$this, 'js'), 50); add_action("admin_head-$page", array(&$this, 'js'), 50);
add_action("admin_head-$page", $this->admin_header_callback, 51); add_action("admin_head-$page", $this->admin_header_callback, 51);
} }
function js_includes() { function js_includes() {
wp_enqueue_script('cropper'); wp_enqueue_script('cropper');
wp_enqueue_script('colorpicker'); wp_enqueue_script('colorpicker');
} }
function js() { function js() {
if ( isset( $_POST['textcolor'] ) ) { if ( isset( $_POST['textcolor'] ) ) {
if ( 'blank' == $_POST['textcolor'] ) { if ( 'blank' == $_POST['textcolor'] ) {
set_theme_mod('header_textcolor', 'blank'); set_theme_mod('header_textcolor', 'blank');
} else { } else {
$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['textcolor']);
if ( strlen($color) == 6 || strlen($color) == 3 ) if ( strlen($color) == 6 || strlen($color) == 3 )
set_theme_mod('header_textcolor', $color); set_theme_mod('header_textcolor', $color);
} }
} }
if ( isset($_POST['resetheader']) ) if ( isset($_POST['resetheader']) )
remove_theme_mods(); remove_theme_mods();
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function onEndCrop( coords, dimensions ) { function onEndCrop( coords, dimensions ) {
$( 'x1' ).value = coords.x1; $( 'x1' ).value = coords.x1;
$( 'y1' ).value = coords.y1; $( 'y1' ).value = coords.y1;
$( 'x2' ).value = coords.x2; $( 'x2' ).value = coords.x2;
$( 'y2' ).value = coords.y2; $( 'y2' ).value = coords.y2;
$( 'width' ).value = dimensions.width; $( 'width' ).value = dimensions.width;
$( 'height' ).value = dimensions.height; $( 'height' ).value = dimensions.height;
} }
// with a supplied ratio // with a supplied ratio
Event.observe( Event.observe(
window, window,
'load', 'load',
function() { function() {
var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>; var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>; var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
var ratio = xinit / yinit; var ratio = xinit / yinit;
var ximg = $('upload').width; var ximg = $('upload').width;
var yimg = $('upload').height; var yimg = $('upload').height;
if ( yimg < yinit || ximg < xinit ) { if ( yimg < yinit || ximg < xinit ) {
if ( ximg / yimg > ratio ) { if ( ximg / yimg > ratio ) {
yinit = yimg; yinit = yimg;
xinit = yinit * ratio; xinit = yinit * ratio;
} else { } else {
xinit = ximg; xinit = ximg;
yinit = xinit / ratio; yinit = xinit / ratio;
} }
} }
new Cropper.Img( new Cropper.Img(
'upload', 'upload',
{ {
ratioDim: { x: xinit, y: yinit }, ratioDim: { x: xinit, y: yinit },
displayOnInit: true, displayOnInit: true,
onEndCrop: onEndCrop onEndCrop: onEndCrop
} }
) )
} }
); );
var cp = new ColorPicker(); var cp = new ColorPicker();
function pickColor(color) { function pickColor(color) {
$('name').style.color = color; $('name').style.color = color;
$('desc').style.color = color; $('desc').style.color = color;
$('textcolor').value = color; $('textcolor').value = color;
} }
function PopupWindow_hidePopup(magicword) { function PopupWindow_hidePopup(magicword) {
if ( magicword != 'prettyplease' ) if ( magicword != 'prettyplease' )
return false; return false;
if (this.divName != null) { if (this.divName != null) {
if (this.use_gebi) { if (this.use_gebi) {
document.getElementById(this.divName).style.visibility = "hidden"; document.getElementById(this.divName).style.visibility = "hidden";
} }
else if (this.use_css) { else if (this.use_css) {
document.all[this.divName].style.visibility = "hidden"; document.all[this.divName].style.visibility = "hidden";
} }
else if (this.use_layers) { else if (this.use_layers) {
document.layers[this.divName].visibility = "hidden"; document.layers[this.divName].visibility = "hidden";
} }
} }
else { else {
if (this.popupWindow && !this.popupWindow.closed) { if (this.popupWindow && !this.popupWindow.closed) {
this.popupWindow.close(); this.popupWindow.close();
this.popupWindow = null; this.popupWindow = null;
} }
} }
return false; return false;
} }
function colorSelect(t,p) { function colorSelect(t,p) {
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) { if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) {
cp.hidePopup('prettyplease'); cp.hidePopup('prettyplease');
} else { } else {
cp.p = p; cp.p = p;
cp.select(t,p); cp.select(t,p);
} }
} }
function colorDefault() { function colorDefault() {
pickColor('<?php echo HEADER_TEXTCOLOR; ?>'); pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
} }
function hide_text() { function hide_text() {
$('name').style.display = 'none'; $('name').style.display = 'none';
$('desc').style.display = 'none'; $('desc').style.display = 'none';
$('pickcolor').style.display = 'none'; $('pickcolor').style.display = 'none';
$('defaultcolor').style.display = 'none'; $('defaultcolor').style.display = 'none';
$('textcolor').value = 'blank'; $('textcolor').value = 'blank';
$('hidetext').value = '<?php _e('Show Text'); ?>'; $('hidetext').value = '<?php _e('Show Text'); ?>';
// $('hidetext').onclick = 'show_text()'; // $('hidetext').onclick = 'show_text()';
Event.observe( $('hidetext'), 'click', show_text ); Event.observe( $('hidetext'), 'click', show_text );
} }
function show_text() { function show_text() {
$('name').style.display = 'block'; $('name').style.display = 'block';
$('desc').style.display = 'block'; $('desc').style.display = 'block';
$('pickcolor').style.display = 'inline'; $('pickcolor').style.display = 'inline';
$('defaultcolor').style.display = 'inline'; $('defaultcolor').style.display = 'inline';
$('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
$('hidetext').value = '<?php _e('Hide Text'); ?>'; $('hidetext').value = '<?php _e('Hide Text'); ?>';
Event.stopObserving( $('hidetext'), 'click', show_text ); Event.stopObserving( $('hidetext'), 'click', show_text );
Event.observe( $('hidetext'), 'click', hide_text ); Event.observe( $('hidetext'), 'click', hide_text );
} }
<?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?> <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
Event.observe( window, 'load', hide_text ); Event.observe( window, 'load', hide_text );
<?php } ?> <?php } ?>
</script> </script>
<?php <?php
} }
function step_1() { function step_1() {
if ( $_GET['updated'] ) { ?> if ( $_GET['updated'] ) { ?>
<div id="message" class="updated fade"> <div id="message" class="updated fade">
<p><?php _e('Header updated.') ?></p> <p><?php _e('Header updated.') ?></p>
</div> </div>
<?php } ?> <?php } ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Your Header Image'); ?></h2> <h2><?php _e('Your Header Image'); ?></h2>
<p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p> <p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
<div id="headimg" style="background: url(<?php header_image() ?>) no-repeat;"> <div id="headimg" style="background: url(<?php header_image() ?>) no-repeat;">
<h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1> <h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
<div id="desc"><?php bloginfo('description');?></div> <div id="desc"><?php bloginfo('description');?></div>
</div> </div>
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?> <?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&amp;updated=true"> <form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&amp;updated=true">
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" /> <input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" /> <input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
<input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form> <input type="hidden" name="textcolor" id="textcolor" value="#<?php header_textcolor() ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?> &raquo;" /></form>
<?php } ?> <?php } ?>
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div> <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
</div> </div>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p> <h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
<p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p> <p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;"> <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" /> <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
<input type="hidden" name="action" value="save" /> <input type="hidden" name="action" value="save" />
<p class="submit"> <p class="submit">
<input type="submit" value="<?php _e('Upload'); ?> &raquo;" /> <input type="submit" value="<?php _e('Upload'); ?> &raquo;" />
</p> </p>
</form> </form>
</div> </div>
<?php if ( get_theme_mod('header_image') || get_theme_mod('header_textcolor') ) : ?> <?php if ( get_theme_mod('header_image') || get_theme_mod('header_textcolor') ) : ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Reset Header Image and Color'); ?></h2> <h2><?php _e('Reset Header Image and Color'); ?></h2>
<p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p> <p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>"> <form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" /> <input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
</form> </form>
</div> </div>
<?php endif; <?php endif;
} }
function step_2() { function step_2() {
$overrides = array('test_form' => false); $overrides = array('test_form' => false);
$file = wp_handle_upload($_FILES['import'], $overrides); $file = wp_handle_upload($_FILES['import'], $overrides);
if ( isset($file['error']) ) if ( isset($file['error']) )
die( $file['error'] ); die( $file['error'] );
$url = $file['url']; $url = $file['url'];
$file = $file['file']; $file = $file['file'];
$filename = basename($file); $filename = basename($file);
// Construct the object array // Construct the object array
$object = array( $object = array(
'post_title' => $filename, 'post_title' => $filename,
'post_content' => $url, 'post_content' => $url,
'post_mime_type' => 'import', 'post_mime_type' => 'import',
'guid' => $url); 'guid' => $url);
// Save the data // Save the data
$id = wp_insert_attachment($object, $file); $id = (int) wp_insert_attachment($object, $file);
$upload = array('file' => $file, 'id' => $id); $upload = array('file' => $file, 'id' => $id);
list($width, $height, $type, $attr) = getimagesize( $file ); list($width, $height, $type, $attr) = getimagesize( $file );
if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) { if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {
set_theme_mod('header_image', $url); set_theme_mod('header_image', $url);
$header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication $header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication
return $this->finished(); return $this->finished();
} elseif ( $width > HEADER_IMAGE_WIDTH ) { } elseif ( $width > HEADER_IMAGE_WIDTH ) {
$oitar = $width / HEADER_IMAGE_WIDTH; $oitar = $width / HEADER_IMAGE_WIDTH;
$image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
$image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
$url = str_replace(basename($url), basename($image), $url); $url = str_replace(basename($url), basename($image), $url);
$width = $width / $oitar; $width = $width / $oitar;
$height = $height / $oitar; $height = $height / $oitar;
} else { } else {
$oitar = 1; $oitar = 1;
} }
?> ?>
<div class="wrap"> <div class="wrap">
<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>"> <form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p> <p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
<div id="testWrap"> <div id="testWrap">
<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" /> <img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
</div> </div>
<p class="submit"> <p class="submit">
<input type="hidden" name="x1" id="x1" /> <input type="hidden" name="x1" id="x1" />
<input type="hidden" name="y1" id="y1" /> <input type="hidden" name="y1" id="y1" />
<input type="hidden" name="x2" id="x2" /> <input type="hidden" name="x2" id="x2" />
<input type="hidden" name="y2" id="y2" /> <input type="hidden" name="y2" id="y2" />
<input type="hidden" name="width" id="width" /> <input type="hidden" name="width" id="width" />
<input type="hidden" name="height" id="height" /> <input type="hidden" name="height" id="height" />
<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" /> <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" /> <input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
<input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" /> <input type="submit" value="<?php _e('Crop Header &raquo;'); ?>" />
</p> </p>
</form> </form>
</div> </div>
<?php <?php
} }
function step_3() { function step_3() {
if ( $_POST['oitar'] > 1 ) { if ( $_POST['oitar'] > 1 ) {
$_POST['x1'] = $_POST['x1'] * $_POST['oitar']; $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
$_POST['y1'] = $_POST['y1'] * $_POST['oitar']; $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
$_POST['width'] = $_POST['width'] * $_POST['oitar']; $_POST['width'] = $_POST['width'] * $_POST['oitar'];
$_POST['height'] = $_POST['height'] * $_POST['oitar']; $_POST['height'] = $_POST['height'] * $_POST['oitar'];
} }
$header = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); $header = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);
$header = apply_filters('wp_create_file_in_uploads', $header); // For replication $header = apply_filters('wp_create_file_in_uploads', $header); // For replication
$parent = get_post($_POST['attachment_id']); $parent = get_post($_POST['attachment_id']);
$parent_url = $parent->guid; $parent_url = $parent->guid;
$url = str_replace(basename($parent_url), basename($header), $parent_url); $url = str_replace(basename($parent_url), basename($header), $parent_url);
set_theme_mod('header_image', $url); set_theme_mod('header_image', $url);
// cleanup // cleanup
$file = get_attached_file( $_POST['attachment_id'] ); $file = get_attached_file( $_POST['attachment_id'] );
$medium = str_replace(basename($file), 'midsize-'.basename($file), $file); $medium = str_replace(basename($file), 'midsize-'.basename($file), $file);
@unlink( apply_filters( 'wp_delete_file', $medium ) ); @unlink( apply_filters( 'wp_delete_file', $medium ) );
wp_delete_attachment( $_POST['attachment_id'] ); wp_delete_attachment( $_POST['attachment_id'] );
return $this->finished(); return $this->finished();
} }
function finished() { function finished() {
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Header complete!'); ?></h2> <h2><?php _e('Header complete!'); ?></h2>
<p><?php _e('Visit your site and you should see the new header now.'); ?></p> <p><?php _e('Visit your site and you should see the new header now.'); ?></p>
</div> </div>
<?php <?php
} }
function admin_page() { function admin_page() {
if ( !isset( $_GET['step'] ) ) if ( !isset( $_GET['step'] ) )
$step = 1; $step = 1;
else else
$step = (int) $_GET['step']; $step = (int) $_GET['step'];
if ( 1 == $step ) { if ( 1 == $step ) {
$this->step_1(); $this->step_1();
} elseif ( 2 == $step ) { } elseif ( 2 == $step ) {
$this->step_2(); $this->step_2();
} elseif ( 3 == $step ) { } elseif ( 3 == $step ) {
$this->step_3(); $this->step_3();
} }
} }
} }
?> ?>

View File

@ -56,7 +56,7 @@ if ( !empty( $_POST['delete_comments'] ) ) :
$i = 0; $i = 0;
foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
$comment = (int) $comment; $comment = (int) $comment;
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
// $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
if ( current_user_can('edit_post', $post_id) ) { if ( current_user_can('edit_post', $post_id) ) {
if ( !empty( $_POST['spam_button'] ) ) if ( !empty( $_POST['spam_button'] ) )

View File

@ -546,7 +546,7 @@ class Blogger_Import {
} }
} }
$comment_post_ID = $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink]; $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink];
preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches); preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches);
$comment_author = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) ); $comment_author = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
$comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) ); $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );

View File

@ -104,7 +104,7 @@ class BW_Import {
$comments = $comments[1]; $comments = $comments[1];
if ( $comments ) { if ( $comments ) {
$comment_post_ID = $post_id; $comment_post_ID = (int) $post_id;
$num_comments = 0; $num_comments = 0;
foreach ($comments as $comment) { foreach ($comments as $comment) {
preg_match('|<body>(.*?)</body>|is', $comment, $comment_content); preg_match('|<body>(.*?)</body>|is', $comment, $comment_content);

View File

@ -437,8 +437,8 @@ class Dotclear_Import {
extract($comment); extract($comment);
// WordPressify Data // WordPressify Data
$comment_ID = ltrim($comment_id, '0'); $comment_ID = (int) ltrim($comment_id, '0');
$comment_post_ID = $postarr[$post_id]; $comment_post_ID = (int) $postarr[$post_id];
$comment_approved = "$comment_pub"; $comment_approved = "$comment_pub";
$name = $wpdb->escape(csc ($comment_auteur)); $name = $wpdb->escape(csc ($comment_auteur));
$email = $wpdb->escape($comment_email); $email = $wpdb->escape($comment_email);

View File

@ -82,7 +82,7 @@ class LJ_Import {
$comments = $comments[1]; $comments = $comments[1];
if ( $comments ) { if ( $comments ) {
$comment_post_ID = $post_id; $comment_post_ID = (int) $post_id;
$num_comments = 0; $num_comments = 0;
foreach ($comments as $comment) { foreach ($comments as $comment) {
preg_match('|<event>(.*?)</event>|is', $comment, $comment_content); preg_match('|<event>(.*?)</event>|is', $comment, $comment_content);

View File

@ -171,7 +171,7 @@ class MT_Import {
return; return;
} }
$this->file = $file['file']; $this->file = $file['file'];
$this->id = $file['id']; $this->id = (int) $file['id'];
$this->get_entries(); $this->get_entries();
$this->mt_authors_form(); $this->mt_authors_form();
@ -295,7 +295,7 @@ class MT_Import {
} }
} }
$comment_post_ID = $post_id; $comment_post_ID = (int) $post_id;
$comment_approved = 1; $comment_approved = 1;
// Now for comments // Now for comments

View File

@ -174,7 +174,7 @@ class WP_Import {
return; return;
} }
$this->file = $file['file']; $this->file = $file['file'];
$this->id = $file['id']; $this->id = (int) $file['id'];
$this->get_entries(); $this->get_entries();
$this->wp_authors_form(); $this->wp_authors_form();

View File

@ -54,7 +54,7 @@ if ( '' == $comment_content )
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID'); $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
$comment_id = wp_new_comment( $commentdata ); $comment_id = (int) wp_new_comment( $commentdata );
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
if ( !$user->ID ) : if ( !$user->ID ) :

View File

@ -144,7 +144,7 @@ function the_author_posts_link($deprecated = '') {
function get_author_posts_url($author_id, $author_nicename = '') { function get_author_posts_url($author_id, $author_nicename = '') {
global $wpdb, $wp_rewrite, $post, $cache_userdata; global $wpdb, $wp_rewrite, $post, $cache_userdata;
$auth_ID = $author_id; $auth_ID = (int) $author_id;
$link = $wp_rewrite->get_author_permastruct(); $link = $wp_rewrite->get_author_permastruct();
if ( empty($link) ) { if ( empty($link) ) {

View File

@ -165,7 +165,8 @@ function get_linkcatname($id = 0) {
if ( empty($cats) || ! is_array($cats) ) if ( empty($cats) || ! is_array($cats) )
return ''; return '';
$cat_id = $cats[0]; // Take the first cat. $cat_id = (int)
$cats[0]; // Take the first cat.
$cat = get_category($cat_id); $cat = get_category($cat_id);
return $cat->cat_name; return $cat->cat_name;

View File

@ -64,7 +64,8 @@ global $post, $category_cache, $blog_id;
$id = (int) $id; $id = (int) $id;
if ( !$id ) if ( !$id )
$id = $post->ID; $id = (int)
$post->ID;
if ( !isset($category_cache[$blog_id][$id]) ) if ( !isset($category_cache[$blog_id][$id]) )
update_post_category_cache($id); update_post_category_cache($id);

View File

@ -150,7 +150,7 @@ function get_comments_number( $post_id = 0 ) {
$post_id = (int) $post_id; $post_id = (int) $post_id;
if ( !$post_id ) if ( !$post_id )
$post_id = $id; $post_id = (int) $id;
$post = get_post($post_id); $post = get_post($post_id);
if ( ! isset($post->comment_count) ) if ( ! isset($post->comment_count) )

View File

@ -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') ('$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) if ( $comment_approved == 1)
wp_update_comment_count($comment_post_ID); wp_update_comment_count($comment_post_ID);
@ -392,7 +392,7 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_approved'] = wp_allow_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']); do_action('comment_post', $comment_ID, $commentdata['comment_approved']);

View File

@ -106,7 +106,7 @@ function comments_rss($commentsrssfilename = 'nolongerused') {
function get_author_rss_link($echo = false, $author_id, $author_nicename) { 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'); $permalink_structure = get_option('permalink_structure');
if ( '' == $permalink_structure ) { if ( '' == $permalink_structure ) {

View File

@ -646,7 +646,7 @@ function update_post_category_cache($post_ids) {
$post_id_array = (array) explode(',', $post_ids); $post_id_array = (array) explode(',', $post_ids);
$count = count( $post_id_array); $count = count( $post_id_array);
for ( $i = 0; $i < $count; $i++ ) { 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] ) ) { if ( isset( $category_cache[$blog_id][$post_id] ) ) {
unset( $post_id_array[ $i ] ); unset( $post_id_array[ $i ] );
continue; continue;
@ -700,7 +700,7 @@ function update_postmeta_cache($post_id_list = '') {
$post_id_array = (array) explode(',', $post_id_list); $post_id_array = (array) explode(',', $post_id_list);
$count = count( $post_id_array); $count = count( $post_id_array);
for ( $i = 0; $i < $count; $i++ ) { 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 if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached
unset( $post_id_array[ $i ] ); unset( $post_id_array[ $i ] );
continue; continue;

View File

@ -119,7 +119,7 @@ function get_page_link($id = false) {
$id = (int) $id; $id = (int) $id;
if ( !$id ) if ( !$id )
$id = $post->ID; $id = (int) $post->ID;
if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
$link = get_option('home'); $link = get_option('home');
@ -134,7 +134,7 @@ function _get_page_link( $id = false ) {
global $post, $wp_rewrite; global $post, $wp_rewrite;
if ( !$id ) if ( !$id )
$id = $post->ID; $id = (int) $post->ID;
$pagestruct = $wp_rewrite->get_page_permastruct(); $pagestruct = $wp_rewrite->get_page_permastruct();
@ -156,7 +156,7 @@ function get_attachment_link($id = false) {
$link = false; $link = false;
if (! $id) { if (! $id) {
$id = $post->ID; $id = (int) $post->ID;
} }
$object = get_post($id); $object = get_post($id);
@ -259,7 +259,7 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
global $id; global $id;
if ( empty($post_id) ) if ( empty($post_id) )
$post_id = $id; $post_id = (int) $id;
if ( '' != get_option('permalink_structure') ) { if ( '' != get_option('permalink_structure') ) {
$url = trailingslashit( get_permalink() ) . 'feed'; $url = trailingslashit( get_permalink() ) . 'feed';

View File

@ -525,7 +525,7 @@ endif;
if ( !function_exists('wp_verify_nonce') ) : if ( !function_exists('wp_verify_nonce') ) :
function wp_verify_nonce($nonce, $action = -1) { function wp_verify_nonce($nonce, $action = -1) {
$user = wp_get_current_user(); $user = wp_get_current_user();
$uid = $user->id; $uid = (int) $user->id;
$i = ceil(time() / 43200); $i = ceil(time() / 43200);
@ -539,7 +539,7 @@ endif;
if ( !function_exists('wp_create_nonce') ) : if ( !function_exists('wp_create_nonce') ) :
function wp_create_nonce($action = -1) { function wp_create_nonce($action = -1) {
$user = wp_get_current_user(); $user = wp_get_current_user();
$uid = $user->id; $uid = (int) $user->id;
$i = ceil(time() / 43200); $i = ceil(time() / 43200);

View File

@ -375,7 +375,7 @@ function get_post_custom($post_id = 0) {
global $id, $post_meta_cache, $wpdb, $blog_id; global $id, $post_meta_cache, $wpdb, $blog_id;
if ( !$post_id ) if ( !$post_id )
$post_id = $id; $post_id = (int) $id;
$post_id = (int) $post_id; $post_id = (int) $post_id;
@ -539,7 +539,7 @@ function wp_insert_post($postarr = array()) {
// Get the post ID. // Get the post ID.
if ( $update ) if ( $update )
$post_ID = $ID; $post_ID = (int) $ID;
// Create a valid post name. Drafts are allowed to have an empty // Create a valid post name. Drafts are allowed to have an empty
// post name. // post name.
@ -1256,7 +1256,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
$update = false; $update = false;
if ( !empty($ID) ) { if ( !empty($ID) ) {
$update = true; $update = true;
$post_ID = $ID; $post_ID = (int) $ID;
} }
// Create a valid post name. // Create a valid post name.
@ -1506,7 +1506,7 @@ function wp_mime_type_icon( $mime = 0 ) {
$mime = (int) $mime; $mime = (int) $mime;
if ( !$post =& get_post( $mime ) ) if ( !$post =& get_post( $mime ) )
return false; return false;
$post_id = $post->ID; $post_id = (int) $post->ID;
$mime = $post->post_mime_type; $mime = $post->post_mime_type;
} }

View File

@ -587,7 +587,7 @@ class WP_Query {
if ( '' != $qv['pagename'] ) { if ( '' != $qv['pagename'] ) {
$this->queried_object =& get_page_by_path($qv['pagename']); $this->queried_object =& get_page_by_path($qv['pagename']);
if ( !empty($this->queried_object) ) if ( !empty($this->queried_object) )
$this->queried_object_id = $this->queried_object->ID; $this->queried_object_id = (int) $this->queried_object->ID;
else else
unset($this->queried_object); unset($this->queried_object);
@ -1205,18 +1205,18 @@ class WP_Query {
$cat = $this->get('cat'); $cat = $this->get('cat');
$category = &get_category($cat); $category = &get_category($cat);
$this->queried_object = &$category; $this->queried_object = &$category;
$this->queried_object_id = $cat; $this->queried_object_id = (int) $cat;
} else if ($this->is_posts_page) { } else if ($this->is_posts_page) {
$this->queried_object = & get_page(get_option('page_for_posts')); $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) { } else if ($this->is_single) {
$this->queried_object = $this->post; $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) { } else if ($this->is_page) {
$this->queried_object = $this->post; $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) { } else if ($this->is_author) {
$author_id = $this->get('author'); $author_id = (int) $this->get('author');
$author = get_userdata($author_id); $author = get_userdata($author_id);
$this->queried_object = $author; $this->queried_object = $author;
$this->queried_object_id = $author_id; $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 $id, $postdata, $authordata, $day, $page, $pages, $multipage, $more, $numpages, $wp_query;
global $pagenow; global $pagenow;
$id = $post->ID; $id = (int) $post->ID;
$authordata = get_userdata($post->post_author); $authordata = get_userdata($post->post_author);

View File

@ -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 = "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); $query = apply_filters('update_user_query', $query);
$wpdb->query( $query ); $wpdb->query( $query );
$user_id = $ID; $user_id = (int) $ID;
} else { } else {
$query = "INSERT INTO $wpdb->users $query = "INSERT INTO $wpdb->users
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name) (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')"; ('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
$query = apply_filters('create_user_query', $query); $query = apply_filters('create_user_query', $query);
$wpdb->query( $query ); $wpdb->query( $query );
$user_id = $wpdb->insert_id; $user_id = (int) $wpdb->insert_id;
} }
update_usermeta( $user_id, 'first_name', $first_name); update_usermeta( $user_id, 'first_name', $first_name);

View File

@ -346,7 +346,7 @@ function get_home_template() {
function get_page_template() { function get_page_template() {
global $wp_query; global $wp_query;
$id = $wp_query->post->ID; $id = (int) $wp_query->post->ID;
$template = get_post_meta($id, '_wp_page_template', true); $template = get_post_meta($id, '_wp_page_template', true);
if ( 'default' == $template ) if ( 'default' == $template )

View File

@ -56,7 +56,7 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
function get_users_of_blog( $id = '' ) { function get_users_of_blog( $id = '' ) {
global $wpdb, $blog_id; global $wpdb, $blog_id;
if ( empty($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" ); $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; return $users;
} }
@ -171,8 +171,8 @@ function setup_userdata($user_id = '') {
$userdata = $user->data; $userdata = $user->data;
$user_login = $user->user_login; $user_login = $user->user_login;
$user_level = $user->user_level; $user_level = (int) $user->user_level;
$user_ID = $user->ID; $user_ID = (int) $user->ID;
$user_email = $user->user_email; $user_email = $user->user_email;
$user_url = $user->user_url; $user_url = $user->user_url;
$user_pass_md5 = md5($user->user_pass); $user_pass_md5 = md5($user->user_pass);

View File

@ -242,7 +242,7 @@ case 'register' :
if ( empty( $errors ) ) { if ( empty( $errors ) ) {
$user_pass = substr( md5( uniqid( microtime() ) ), 0, 7); $user_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
$user_id = wp_create_user( $user_login, $user_pass, $user_email ); $user_id = (int) wp_create_user( $user_login, $user_pass, $user_email );
if ( !$user_id ) if ( !$user_id )
$errors['registerfail'] = sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')); $errors['registerfail'] = sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email'));
else { else {

View File

@ -136,7 +136,7 @@ for ($i=1; $i <= $count; $i++) :
$post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status'); $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status');
$post_data = add_magic_quotes($post_data); $post_data = add_magic_quotes($post_data);
$post_ID = wp_insert_post($post_data); $post_ID = (int) wp_insert_post($post_data);
if (!$post_ID) { if (!$post_ID) {
// we couldn't post, for whatever reason. better move forward to the next email // we couldn't post, for whatever reason. better move forward to the next email

View File

@ -84,7 +84,7 @@ if ( !empty($tb_url) && !empty($title) ) {
$title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title; $title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title;
} }
$comment_post_ID = $tb_id; $comment_post_ID = (int) $tb_id;
$comment_author = $blog_name; $comment_author = $blog_name;
$comment_author_email = ''; $comment_author_email = '';
$comment_author_url = $tb_url; $comment_author_url = $tb_url;

View File

@ -172,8 +172,8 @@ class wp_xmlrpc_server extends IXR_Server {
function wp_getPage($args) { function wp_getPage($args) {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$page_id = $args[1]; $page_id = (int) $args[1];
$username = $args[2]; $username = $args[2];
$password = $args[3]; $password = $args[3];
@ -252,7 +252,7 @@ class wp_xmlrpc_server extends IXR_Server {
function wp_getPages($args) { function wp_getPages($args) {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
@ -320,10 +320,10 @@ class wp_xmlrpc_server extends IXR_Server {
function wp_deletePage($args) { function wp_deletePage($args) {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
$page_id = $args[3]; $page_id = (int) $args[3];
if(!$this->login_pass_ok($username, $password)) { if(!$this->login_pass_ok($username, $password)) {
return($this->error); return($this->error);
@ -360,7 +360,7 @@ class wp_xmlrpc_server extends IXR_Server {
*/ */
function wp_editPage($args) { function wp_editPage($args) {
// Items not escaped here will be escaped in editPost. // Items not escaped here will be escaped in editPost.
$blog_id = $args[0]; $blog_id = (int) $args[0];
$page_id = $this->escape((int) $args[1]); $page_id = $this->escape((int) $args[1]);
$username = $this->escape($args[2]); $username = $this->escape($args[2]);
$password = $this->escape($args[3]); $password = $this->escape($args[3]);
@ -411,7 +411,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
@ -451,7 +451,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
@ -469,7 +469,7 @@ class wp_xmlrpc_server extends IXR_Server {
function wp_newCategory($args) { function wp_newCategory($args) {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
$category = $args[3]; $category = $args[3];
@ -512,7 +512,7 @@ class wp_xmlrpc_server extends IXR_Server {
"category_description" => $category["description"] "category_description" => $category["description"]
); );
$cat_id = wp_insert_category($new_category); $cat_id = (int) wp_insert_category($new_category);
if(!$cat_id) { if(!$cat_id) {
return(new IXR_Error(500, "Sorry, the new category failed.")); return(new IXR_Error(500, "Sorry, the new category failed."));
} }
@ -529,7 +529,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_id = $args[0]; $blog_id = (int) $args[0];
$username = $args[1]; $username = $args[1];
$password = $args[2]; $password = $args[2];
$category = $args[3]; $category = $args[3];
@ -620,7 +620,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[1]; $post_ID = (int) $args[1];
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
@ -655,7 +655,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[1]; /* though we don't use it yet */ $blog_ID = (int) $args[1]; /* though we don't use it yet */
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$num_posts = $args[4]; $num_posts = $args[4];
@ -703,7 +703,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[1]; $blog_ID = (int) $args[1];
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */ $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
@ -737,7 +737,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[1]; $blog_ID = (int) $args[1];
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$content = $args[4]; $content = $args[4];
@ -774,7 +774,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[1]; /* though we don't use it yet */ $blog_ID = (int) $args[1]; /* though we don't use it yet */
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$content = $args[4]; $content = $args[4];
@ -802,7 +802,7 @@ class wp_xmlrpc_server extends IXR_Server {
$post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status'); $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
$post_ID = wp_insert_post($post_data); $post_ID = (int) wp_insert_post($post_data);
if (!$post_ID) { if (!$post_ID) {
return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.'); return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');
@ -873,7 +873,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[1]; $post_ID = (int) $args[1];
$user_login = $args[2]; $user_login = $args[2];
$user_pass = $args[3]; $user_pass = $args[3];
$publish = $args[4]; $publish = $args[4];
@ -914,7 +914,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; // we will support this in the near future $blog_ID = (int) $args[0]; // we will support this in the near future
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$content_struct = $args[3]; $content_struct = $args[3];
@ -1030,7 +1030,7 @@ class wp_xmlrpc_server extends IXR_Server {
// We've got all the data -- post it: // We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order'); $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order');
$post_ID = wp_insert_post($postdata); $post_ID = (int) wp_insert_post($postdata);
if (!$post_ID) { if (!$post_ID) {
return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.'); return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');
@ -1216,7 +1216,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
@ -1278,10 +1278,10 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$num_posts = $args[3]; $num_posts = (int) $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
@ -1351,7 +1351,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
@ -1386,7 +1386,7 @@ class wp_xmlrpc_server extends IXR_Server {
global $wpdb; global $wpdb;
$blog_ID = $wpdb->escape($args[0]); $blog_ID = (int) $args[0];
$user_login = $wpdb->escape($args[1]); $user_login = $wpdb->escape($args[1]);
$user_pass = $wpdb->escape($args[2]); $user_pass = $wpdb->escape($args[2]);
$data = $args[3]; $data = $args[3];
@ -1447,7 +1447,7 @@ class wp_xmlrpc_server extends IXR_Server {
); );
// Save the data // Save the data
$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); $id = (int) wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) ); return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
@ -1463,10 +1463,10 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$num_posts = $args[3]; $num_posts = (int) $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) { if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error; return $this->error;
@ -1508,7 +1508,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$blog_ID = $args[0]; $blog_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
@ -1537,7 +1537,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
@ -1567,7 +1567,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
$categories = $args[3]; $categories = $args[3];
@ -1650,7 +1650,7 @@ class wp_xmlrpc_server extends IXR_Server {
$this->escape($args); $this->escape($args);
$post_ID = $args[0]; $post_ID = (int) $args[0];
$user_login = $args[1]; $user_login = $args[1];
$user_pass = $args[2]; $user_pass = $args[2];
@ -1712,18 +1712,18 @@ class wp_xmlrpc_server extends IXR_Server {
} elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) { } elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
// the path defines the post_ID (archives/p/XXXX) // the path defines the post_ID (archives/p/XXXX)
$blah = explode('/', $match[0]); $blah = explode('/', $match[0]);
$post_ID = $blah[1]; $post_ID = (int) $blah[1];
$way = 'from the path'; $way = 'from the path';
} elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) { } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
// the querystring defines the post_ID (?p=XXXX) // the querystring defines the post_ID (?p=XXXX)
$blah = explode('=', $match[0]); $blah = explode('=', $match[0]);
$post_ID = $blah[1]; $post_ID = (int) $blah[1];
$way = 'from the querystring'; $way = 'from the querystring';
} elseif (isset($urltest['fragment'])) { } elseif (isset($urltest['fragment'])) {
// an #anchor is there, it's either... // an #anchor is there, it's either...
if (intval($urltest['fragment'])) { if (intval($urltest['fragment'])) {
// ...an integer #XXXX (simpliest case) // ...an integer #XXXX (simpliest case)
$post_ID = $urltest['fragment']; $post_ID = (int) $urltest['fragment'];
$way = 'from the fragment (numeric)'; $way = 'from the fragment (numeric)';
} elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) { } elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
// ...a post id in the form 'post-###' // ...a post id in the form 'post-###'
@ -1837,7 +1837,7 @@ class wp_xmlrpc_server extends IXR_Server {
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type'); $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
$comment_ID = wp_new_comment($commentdata); $comment_ID = (int) wp_new_comment($commentdata);
do_action('pingback_post', $comment_ID); do_action('pingback_post', $comment_ID);
return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
@ -1855,7 +1855,7 @@ class wp_xmlrpc_server extends IXR_Server {
$url = $args; $url = $args;
$post_ID = url_to_postid($url); $post_ID = (int) url_to_postid($url);
if (!$post_ID) { if (!$post_ID) {
// We aren't sure that the resource is available and/or pingback enabled // We aren't sure that the resource is available and/or pingback enabled
return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');