trailing tabs and whitespace cleanup.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-02-27 15:24:54 +00:00
parent c7ce6107ad
commit d0f79bb3f2
36 changed files with 200 additions and 202 deletions

44
app.php
View File

@ -23,7 +23,7 @@ if ($use_querystring) {
$eid = (int) $_GET['eid']; $eid = (int) $_GET['eid'];
$_SERVER['PATH_INFO'] = $action; $_SERVER['PATH_INFO'] = $action;
if ($eid) { if ($eid) {
$_SERVER['PATH_INFO'] .= "/$eid"; $_SERVER['PATH_INFO'] .= "/$eid";
} }
@ -173,7 +173,7 @@ class AtomParser {
} else if($tag == 'category') { } else if($tag == 'category') {
array_push($this->entry->categories, $attrs); array_push($this->entry->categories, $attrs);
} }
$this->ns_decls = array(); $this->ns_decls = array();
} }
@ -201,7 +201,7 @@ class AtomParser {
} }
array_shift($this->ns_contexts); array_shift($this->ns_contexts);
#print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n"; #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
$this->depth--; $this->depth--;
@ -342,7 +342,7 @@ class AtomServer {
exit(); exit();
} else { } else {
// only allow what we have handlers for... // only allow what we have handlers for...
$this->not_allowed(array_keys($funcs)); $this->not_allowed(array_keys($funcs));
} }
} }
} }
@ -453,7 +453,7 @@ EOD;
} }
function put_post($postID) { function put_post($postID) {
// checked for valid content-types (atom+xml) // checked for valid content-types (atom+xml)
// quick check and exit // quick check and exit
$this->get_accepted_content_type($this->atom_content_types); $this->get_accepted_content_type($this->atom_content_types);
@ -508,9 +508,9 @@ EOD;
if(!current_user_can('edit_post', $postID)) { if(!current_user_can('edit_post', $postID)) {
$this->auth_required('Sorry, you do not have the right to delete this post.'); $this->auth_required('Sorry, you do not have the right to delete this post.');
} }
if ($entry['post_type'] == 'attachment') { if ($entry['post_type'] == 'attachment') {
$this->delete_attachment($postID); $this->delete_attachment($postID);
} else { } else {
$result = wp_delete_post($postID); $result = wp_delete_post($postID);
@ -523,7 +523,7 @@ EOD;
} }
} }
function get_attachment($postID = NULL) { function get_attachment($postID = NULL) {
global $entry; global $entry;
@ -551,7 +551,7 @@ EOD;
$bits .= fread($fp, 4096); $bits .= fread($fp, 4096);
} }
fclose($fp); fclose($fp);
$slug = ''; $slug = '';
if ( isset( $_SERVER['HTTP_SLUG'] ) ) if ( isset( $_SERVER['HTTP_SLUG'] ) )
$slug = sanitize_file_name( $_SERVER['HTTP_SLUG'] ); $slug = sanitize_file_name( $_SERVER['HTTP_SLUG'] );
@ -564,7 +564,7 @@ EOD;
$file = wp_upload_bits( $slug, NULL, $bits); $file = wp_upload_bits( $slug, NULL, $bits);
log_app('wp_upload_bits returns:',print_r($file,true)); log_app('wp_upload_bits returns:',print_r($file,true));
$url = $file['url']; $url = $file['url'];
$file = $file['file']; $file = $file['file'];
$filename = basename($file); $filename = basename($file);
@ -718,7 +718,7 @@ EOD;
} }
fclose($fp); fclose($fp);
fclose($localfp); fclose($localfp);
log_app('function',"put_file($postID)"); log_app('function',"put_file($postID)");
$this->ok(); $this->ok();
} }
@ -760,7 +760,7 @@ EOD;
$url = $this->get_categories_url(); $url = $this->get_categories_url();
echo $url; echo $url;
} }
function get_attachments_url($page = NULL) { function get_attachments_url($page = NULL) {
global $use_querystring; global $use_querystring;
$url = get_bloginfo('url') . '/' . $this->script_name; $url = get_bloginfo('url') . '/' . $this->script_name;
@ -790,7 +790,7 @@ EOD;
global $post; global $post;
$postID = $GLOBALS['post']->ID; $postID = $GLOBALS['post']->ID;
} }
if ($use_querystring) { if ($use_querystring) {
$url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->ENTRY_PATH . "&eid=$postID"; $url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->ENTRY_PATH . "&eid=$postID";
} else { } else {
@ -812,7 +812,7 @@ EOD;
global $post; global $post;
$postID = $GLOBALS['post']->ID; $postID = $GLOBALS['post']->ID;
} }
if ($use_querystring) { if ($use_querystring) {
$url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->MEDIA_SINGLE_PATH ."&eid=$postID"; $url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->MEDIA_SINGLE_PATH ."&eid=$postID";
} else { } else {
@ -873,8 +873,8 @@ EOD;
$page = 1; $page = 1;
} }
$page = (int) $page; $page = (int) $page;
$count = get_option('posts_per_rss'); $count = get_option('posts_per_rss');
$query = "paged=$page&posts_per_page=$count&order=DESC"; $query = "paged=$page&posts_per_page=$count&order=DESC";
if($post_type == 'attachment') { if($post_type == 'attachment') {
$query .= "&post_type=$post_type"; $query .= "&post_type=$post_type";
@ -887,7 +887,7 @@ EOD;
$wpdb = $GLOBALS['wpdb']; $wpdb = $GLOBALS['wpdb'];
$blog_id = $GLOBALS['blog_id']; $blog_id = $GLOBALS['blog_id'];
$post_cache = $GLOBALS['post_cache']; $post_cache = $GLOBALS['post_cache'];
$total_count = $this->get_posts_count(); $total_count = $this->get_posts_count();
$last_page = (int) ceil($total_count / $count); $last_page = (int) ceil($total_count / $count);
@ -1056,7 +1056,7 @@ $post = $GLOBALS['post'];
header('Content-Type: text/plain'); header('Content-Type: text/plain');
exit; exit;
} }
function not_found() { function not_found() {
log_app('Status','404: Not Found'); log_app('Status','404: Not Found');
header('Content-Type: text/plain'); header('Content-Type: text/plain');
@ -1077,7 +1077,7 @@ $post = $GLOBALS['post'];
status_header('400'); status_header('400');
exit; exit;
} }
function created($post_ID, $content, $post_type = 'post') { function created($post_ID, $content, $post_type = 'post') {
global $use_querystring; global $use_querystring;
log_app('created()::$post_ID',"$post_ID, $post_type"); log_app('created()::$post_ID',"$post_ID, $post_type");
@ -1151,7 +1151,7 @@ $post = $GLOBALS['post'];
function authenticate() { function authenticate() {
$login_data = array(); $login_data = array();
$already_md5 = false; $already_md5 = false;
log_app("authenticate()",print_r($_ENV, true)); log_app("authenticate()",print_r($_ENV, true));
// if using mod_rewrite/ENV hack // if using mod_rewrite/ENV hack
@ -1209,7 +1209,7 @@ $post = $GLOBALS['post'];
function process_conditionals() { function process_conditionals() {
if(empty($this->params)) return; if(empty($this->params)) return;
if($_SERVER['REQUEST_METHOD'] == 'DELETE') return; if($_SERVER['REQUEST_METHOD'] == 'DELETE') return;
@ -1240,7 +1240,7 @@ $post = $GLOBALS['post'];
// If string is empty, return 0. If not, attempt to parse into a timestamp // If string is empty, return 0. If not, attempt to parse into a timestamp
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
// Make a timestamp for our most recent modification... // Make a timestamp for our most recent modification...
$wp_modified_timestamp = strtotime($wp_last_modified); $wp_modified_timestamp = strtotime($wp_last_modified);
if ( ($client_last_modified && $client_etag) ? if ( ($client_last_modified && $client_etag) ?

View File

@ -226,8 +226,8 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$_POST['post_status'] = 'draft'; $_POST['post_status'] = 'draft';
$_POST['post_category'] = explode(",", $_POST['catslist']); $_POST['post_category'] = explode(",", $_POST['catslist']);
if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
unset($_POST['post_category']); unset($_POST['post_category']);
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 = wp_write_post();

View File

@ -681,7 +681,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) {
if ( count( $checked_categories ) == 0 ) { if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange // No selected categories, strange
$checked_categories[] = $default; $checked_categories[] = $default;
} }
} else { } else {
$checked_categories[] = $default; $checked_categories[] = $default;
} }
@ -737,7 +737,7 @@ function get_nested_link_categories( $default = 0, $parent = 0 ) {
if ( count( $checked_categories ) == 0 ) { if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange // No selected categories, strange
$checked_categories[] = $default; $checked_categories[] = $default;
} }
} else { } else {
$checked_categories[] = $default; $checked_categories[] = $default;
} }
@ -778,7 +778,7 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
} }
$output = ob_get_contents(); $output = ob_get_contents();
ob_end_clean(); ob_end_clean();
$output = apply_filters('cat_rows', $output); $output = apply_filters('cat_rows', $output);
echo $output; echo $output;
@ -1316,7 +1316,7 @@ function user_can_access_admin_page() {
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) ) if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false; return false;
if ( empty( $parent) ) { if ( empty( $parent) ) {
if ( isset( $_wp_menu_nopriv[$pagenow] ) ) if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false; return false;
@ -1328,7 +1328,7 @@ function user_can_access_admin_page() {
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false; return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false; return false;
} }
return true; return true;
} }
@ -1450,14 +1450,14 @@ function get_admin_page_parent() {
if ( isset( $_wp_real_parent_file[$parent_file] ) ) if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file]; $parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file; return $parent_file;
} }
} }
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) { if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
$parent_file = $pagenow; $parent_file = $pagenow;
if ( isset( $_wp_real_parent_file[$parent_file] ) ) if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file]; $parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file; return $parent_file;
} }
foreach (array_keys( $submenu ) as $parent) { foreach (array_keys( $submenu ) as $parent) {
@ -1897,7 +1897,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
// Compute the URL // Compute the URL
$url = $uploads['url'] . "/$filename"; $url = $uploads['url'] . "/$filename";
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return $return; return $return;
@ -2056,7 +2056,7 @@ function update_home_siteurl( $old_value, $value ) {
// Clear cookies for old paths. // Clear cookies for old paths.
wp_clearcookie(); wp_clearcookie();
// Set cookies for new paths. // Set cookies for new paths.
wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' )); wp_setcookie( $user_login, $user_pass_md5, true, get_option( 'home' ), get_option( 'siteurl' ));
} }
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 ); add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );

View File

@ -17,7 +17,7 @@ class Custom_Image_Header {
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() {
@ -115,7 +115,7 @@ class Custom_Image_Header {
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';
@ -126,7 +126,7 @@ class Custom_Image_Header {
// $('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';
@ -134,7 +134,7 @@ class Custom_Image_Header {
$('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 );
} }

View File

@ -55,7 +55,7 @@ class Blogger_Import {
return false; return false;
} }
$this->token = $matches[1]; $this->token = $matches[1];
wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) ); wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) );
} }
@ -369,9 +369,9 @@ class Blogger_Import {
$sock = $this->_get_blogger_sock( $blog['host'] ); $sock = $this->_get_blogger_sock( $blog['host'] );
if ( ! $sock ) return; // TODO: Error handling if ( ! $sock ) return; // TODO: Error handling
$response = $this->_txrx( $sock, $request ); $response = $this->_txrx( $sock, $request );
$response = $this->parse_response( $response ); $response = $this->parse_response( $response );
// Extract the entries and send for insertion // Extract the entries and send for insertion
preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches ); preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches );
if ( count( $matches[0] ) ) { if ( count( $matches[0] ) ) {
@ -437,7 +437,7 @@ class Blogger_Import {
foreach ( $entries as $entry ) { foreach ( $entries as $entry ) {
$entry = "<feed>$entry</feed>"; $entry = "<feed>$entry</feed>";
$AtomParser = new AtomParser(); $AtomParser = new AtomParser();
$AtomParser->parse( $entry ); $AtomParser->parse( $entry );
$this->import_comment($AtomParser->entry); $this->import_comment($AtomParser->entry);
unset($AtomParser); unset($AtomParser);
} }
@ -623,7 +623,7 @@ class Blogger_Import {
$sel = ( $user->user_id == $current ) ? " selected='selected'" : ''; $sel = ( $user->user_id == $current ) ? " selected='selected'" : '';
$options .= "<option value='$user->user_id'$sel>$user->display_name</option>"; $options .= "<option value='$user->user_id'$sel>$user->display_name</option>";
} }
return $options; return $options;
} }
@ -706,7 +706,7 @@ class Blogger_Import {
function restart() { function restart() {
global $wpdb; global $wpdb;
$options = get_option( 'blogger_importer' ); $options = get_option( 'blogger_importer' );
if ( isset( $options['token'] ) ) if ( isset( $options['token'] ) )
$this->revoke( $options['token'] ); $this->revoke( $options['token'] );
@ -922,7 +922,7 @@ class AtomParser {
} else if($tag == 'category') { } else if($tag == 'category') {
array_push($this->entry->categories, $attrs['term']); array_push($this->entry->categories, $attrs['term']);
} }
$this->ns_decls = array(); $this->ns_decls = array();
} }
@ -950,7 +950,7 @@ class AtomParser {
} }
array_shift($this->ns_contexts); array_shift($this->ns_contexts);
#print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n"; #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
$this->depth--; $this->depth--;

View File

@ -91,7 +91,7 @@ class GM_Import {
if (!chdir($gmpath)) if (!chdir($gmpath))
wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath)); wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
$this->header(); $this->header();
?> ?>
<p><?php _e('The importer is running...') ?></p> <p><?php _e('The importer is running...') ?></p>
@ -128,7 +128,7 @@ class GM_Import {
$user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname"); $user_info = array("user_login"=>"$user_login", "user_pass"=>"$pass1", "user_nickname"=>"$user_nickname", "user_email"=>"$user_email", "user_url"=>"$user_url", "user_ip"=>"$user_ip", "user_domain"=>"$user_domain", "user_browser"=>"$user_browser", "dateYMDhour"=>"$user_joindate", "user_level"=>"1", "user_idmode"=>"nickname");
$user_id = wp_insert_user($user_info); $user_id = wp_insert_user($user_info);
$this->gmnames[$userdata[0]] = $user_id; $this->gmnames[$userdata[0]] = $user_id;
printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>"); printf('<li>'.__('user %s...').' <strong>'.__('Done').'</strong></li>', "<em>$user_login</em>");
} }
@ -213,21 +213,21 @@ class GM_Import {
$user_email=$wpdb->escape("user@deleted.com"); $user_email=$wpdb->escape("user@deleted.com");
$user_url=$wpdb->escape(""); $user_url=$wpdb->escape("");
$user_joindate=$wpdb->escape($user_joindate); $user_joindate=$wpdb->escape($user_joindate);
$user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname"); $user_info = array("user_login"=>$user_login, "user_pass"=>$pass1, "user_nickname"=>$user_nickname, "user_email"=>$user_email, "user_url"=>$user_url, "user_ip"=>$user_ip, "user_domain"=>$user_domain, "user_browser"=>$user_browser, "dateYMDhour"=>$user_joindate, "user_level"=>0, "user_idmode"=>"nickname");
$user_id = wp_insert_user($user_info); $user_id = wp_insert_user($user_info);
$this->gmnames[$postinfo[1]] = $user_id; $this->gmnames[$postinfo[1]] = $user_id;
echo ': '; echo ': ';
printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>"); printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
} }
if (array_key_exists($postinfo[1], $this->gmnames)) { if (array_key_exists($postinfo[1], $this->gmnames)) {
$post_author = $this->gmnames[$postinfo[1]]; $post_author = $this->gmnames[$postinfo[1]];
} else { } else {
$post_author = $user_id; $post_author = $user_id;
} }
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt'); $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
$post_ID = wp_insert_post($postdata); $post_ID = wp_insert_post($postdata);
} }

View File

@ -12,16 +12,16 @@ if (!$step) $step = 0;
?> ?>
<?php <?php
switch ($step) { switch ($step) {
case 0: case 0: {
{ include_once('admin-header.php');
include_once('admin-header.php'); if ( !current_user_can('manage_links') )
if ( !current_user_can('manage_links') ) wp_die(__('Cheatin&#8217; uh?'));
wp_die(__('Cheatin&#8217; uh?'));
$opmltype = 'blogrolling'; // default. $opmltype = 'blogrolling'; // default.
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Import your blogroll from another system') ?> </h2> <h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll"> <form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?> <?php wp_nonce_field('import-bookmarks') ?>
@ -40,7 +40,6 @@ switch ($step) {
<input id="userfile" name="userfile" type="file" size="30" /> <input id="userfile" name="userfile" type="file" size="30" />
</div> </div>
</div> </div>
<p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br /> <p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
@ -60,74 +59,73 @@ foreach ($categories as $category) {
</div> </div>
<?php <?php
break; break;
} // end case 0 } // end case 0
case 1: { case 1: {
check_admin_referer('import-bookmarks'); check_admin_referer('import-bookmarks');
include_once('admin-header.php'); include_once('admin-header.php');
if ( !current_user_can('manage_links') ) if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?')); wp_die(__('Cheatin&#8217; uh?'));
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Importing...') ?></h2> <h2><?php _e('Importing...') ?></h2>
<?php <?php
$cat_id = $_POST['cat_id']; $cat_id = $_POST['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) { if ( $cat_id == '' || $cat_id == 0 )
$cat_id = 1; $cat_id = 1;
}
$opml_url = $_POST['opml_url']; $opml_url = $_POST['opml_url'];
if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') { if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
$blogrolling = true; $blogrolling = true;
} } else { // try to get the upload file.
else // try to get the upload file. $overrides = array('test_form' => false, 'test_type' => false);
{ $file = wp_handle_upload($_FILES['userfile'], $overrides);
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
if ( isset($file['error']) ) if ( isset($file['error']) )
wp_die($file['error']); wp_die($file['error']);
$url = $file['url']; $url = $file['url'];
$opml_url = $file['file']; $opml_url = $file['file'];
$blogrolling = false; $blogrolling = false;
} }
if (isset($opml_url) && $opml_url != '') { if ( isset($opml_url) && $opml_url != '' ) {
$opml = wp_remote_fopen($opml_url); $opml = wp_remote_fopen($opml_url);
include_once('link-parse-opml.php'); include_once('link-parse-opml.php');
$link_count = count($names); $link_count = count($names);
for ($i = 0; $i < $link_count; $i++) { for ( $i = 0; $i < $link_count; $i++ ) {
if ('Last' == substr($titles[$i], 0, 4)) if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = ''; $titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4)) if ( 'http' == substr($titles[$i], 0, 4) )
$titles[$i] = ''; $titles[$i] = '';
$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]); $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
wp_insert_link($link); wp_insert_link($link);
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]); echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
} }
?> ?>
<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
<?php
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
if ( ! $blogrolling ) <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
@unlink($opml_url);
<?php
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
if ( ! $blogrolling )
@unlink($opml_url);
?> ?>
</div> </div>
<?php <?php
break; break;
} // end case 1 } // end case 1
} // end switch } // end switch
include('admin-footer.php'); include('admin-footer.php');
?> ?>

View File

@ -14,7 +14,7 @@ if ( strstr($_SERVER['REQUEST_URI'], 'page-new.php') )
$menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php'); $menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
else else
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php'); $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php'); $menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php'); $menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php'); $menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
@ -104,7 +104,7 @@ foreach ( $menu as $id => $data ) {
if ( $new_parent != $old_parent ) { if ( $new_parent != $old_parent ) {
$_wp_real_parent_file[$old_parent] = $new_parent; $_wp_real_parent_file[$old_parent] = $new_parent;
$menu[$id][2] = $new_parent; $menu[$id][2] = $new_parent;
foreach ($submenu[$old_parent] as $index => $data) { foreach ($submenu[$old_parent] as $index => $data) {
$submenu[$new_parent][$index] = $submenu[$old_parent][$index]; $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
unset($submenu[$old_parent][$index]); unset($submenu[$old_parent][$index]);

View File

@ -78,7 +78,7 @@ function sanitize_option($option, $value) { // Remember to call stripslashes!
break; break;
} }
return $value; return $value;
} }
switch($action) { switch($action) {
@ -150,7 +150,7 @@ foreach ( (array) $options as $option) :
if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>"; if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>";
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />"; else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
echo "</td> echo "</td>
<td>$option->option_description</td> <td>$option->option_description</td>
</tr>"; </tr>";

View File

@ -107,7 +107,7 @@ case 'editpost':
} }
if ( isset($_POST['save']) ) if ( isset($_POST['save']) )
$location = "page.php?action=edit&post=$page_ID"; $location = "page.php?action=edit&post=$page_ID";
} else { } else {
if ($_POST['save']) { if ($_POST['save']) {
$location = "page.php?action=edit&post=$page_ID"; $location = "page.php?action=edit&post=$page_ID";

View File

@ -47,7 +47,7 @@ case 'edit':
$editing = true; $editing = true;
$post_ID = $p = (int) $_GET['post']; $post_ID = $p = (int) $_GET['post'];
$post = get_post($post_ID); $post = get_post($post_ID);
if ( 'page' == $post->post_type ) { if ( 'page' == $post->post_type ) {
wp_redirect("page.php?action=edit&post=$post_ID"); wp_redirect("page.php?action=edit&post=$post_ID");
exit(); exit();
@ -119,7 +119,7 @@ case 'editpost':
if ( !empty($_POST['referredby']) ) if ( !empty($_POST['referredby']) )
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer()); $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ($_POST['save']) { if ($_POST['save']) {
$location = "post.php?action=edit&post=$post_ID"; $location = "post.php?action=edit&post=$post_ID";
} elseif ($_POST['updatemeta']) { } elseif ($_POST['updatemeta']) {

View File

@ -2,12 +2,12 @@
// Here we keep the DB structure and option values // Here we keep the DB structure and option values
$charset_collate = ''; $charset_collate = '';
if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) { if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
if ( ! empty($wpdb->charset) ) if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) ) if ( ! empty($wpdb->collate) )
$charset_collate .= " COLLATE $wpdb->collate"; $charset_collate .= " COLLATE $wpdb->collate";
} }
$wp_queries="CREATE TABLE $wpdb->categories ( $wp_queries="CREATE TABLE $wpdb->categories (

View File

@ -13,13 +13,13 @@ function wp_upload_display( $dims = false, $href = '' ) {
} }
if ( isset($attachment_data['width']) ) if ( isset($attachment_data['width']) )
list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128); list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
ob_start(); ob_start();
the_title(); the_title();
$post_title = attribute_escape(ob_get_contents()); $post_title = attribute_escape(ob_get_contents());
ob_end_clean(); ob_end_clean();
$post_content = apply_filters( 'content_edit_pre', $post->post_content ); $post_content = apply_filters( 'content_edit_pre', $post->post_content );
$class = 'text'; $class = 'text';
$innerHTML = get_attachment_innerHTML( $id, false, $dims ); $innerHTML = get_attachment_innerHTML( $id, false, $dims );
if ( $image_src = get_attachment_icon_src() ) { if ( $image_src = get_attachment_icon_src() ) {
@ -285,7 +285,7 @@ function wp_upload_posts_where( $where ) {
function wp_upload_tab_browse() { function wp_upload_tab_browse() {
global $wpdb, $action, $paged; global $wpdb, $action, $paged;
$old_vars = compact( 'paged' ); $old_vars = compact( 'paged' );
switch ( $action ) : switch ( $action ) :
case 'edit' : case 'edit' :
case 'view' : case 'view' :

View File

@ -189,7 +189,7 @@ addLoadEvent( function() {
new Insertion.Top('upload-content', h); new Insertion.Top('upload-content', h);
if (e) Event.stop(e); if (e) Event.stop(e);
return false; return false;
}, },
prepView: function(id) { prepView: function(id) {
@ -264,7 +264,7 @@ addLoadEvent( function() {
} }
return false; return false;
} }
}; };
theFileList.initializeVars(); theFileList.initializeVars();
theFileList.initializeLinks(); theFileList.initializeLinks();

View File

@ -342,7 +342,7 @@ function wp_list_bookmarks($args = '') {
} else { } else {
//output one single list using title_li for the title //output one single list using title_li for the title
$bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated"); $bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated");
if ( !empty($bookmarks) ) { if ( !empty($bookmarks) ) {
if ( !empty( $title_li ) ){ if ( !empty( $title_li ) ){
$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before); $output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);

View File

@ -72,7 +72,7 @@ function get_bookmarks($args = '') {
} }
if (!empty($exclusions)) if (!empty($exclusions))
$exclusions .= ')'; $exclusions .= ')';
if ( ! empty($category_name) ) { if ( ! empty($category_name) ) {
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") ) if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
$category = $cat_id; $category = $cat_id;

View File

@ -386,7 +386,7 @@ class WP_Object_Cache {
function WP_Object_Cache() { function WP_Object_Cache() {
return $this->__construct(); return $this->__construct();
} }
function __construct() { function __construct() {
global $blog_id; global $blog_id;
@ -429,7 +429,7 @@ class WP_Object_Cache {
function __destruct() { function __destruct() {
$this->save(); $this->save();
return true; return true;
} }
} }
?> ?>

View File

@ -247,7 +247,7 @@ function wp_list_categories($args = '') {
$output .= __("No categories"); $output .= __("No categories");
} else { } else {
global $wp_query; global $wp_query;
if ( is_category() ) if ( is_category() )
$r['current_category'] = $wp_query->get_queried_object_id(); $r['current_category'] = $wp_query->get_queried_object_id();

View File

@ -414,16 +414,16 @@ class Walker {
$cb_args = array_merge( array($output, $element, $depth - 1), $args); $cb_args = array_merge( array($output, $element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args); $output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
} }
// End the element. // End the element.
if ( isset($element->$id_field) && $element->$id_field != 0 ) { if ( isset($element->$id_field) && $element->$id_field != 0 ) {
$cb_args = array_merge( array($output, $element, $depth - 1), $args); $cb_args = array_merge( array($output, $element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args); $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
} }
continue; continue;
} }
// Walk the tree. // Walk the tree.
if ( !empty($previous_element) && ($element->$parent_field == $previous_element->$id_field) ) { if ( !empty($previous_element) && ($element->$parent_field == $previous_element->$id_field) ) {
// Previous element is my parent. Descend a level. // Previous element is my parent. Descend a level.
@ -512,19 +512,19 @@ class Walker_Page extends Walker {
$css_class .= ' current_page_parent'; $css_class .= ' current_page_parent';
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '">' . $page->post_title . '</a>'; $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '">' . $page->post_title . '</a>';
if ( !empty($show_date) ) { if ( !empty($show_date) ) {
if ( 'modified' == $show_date ) if ( 'modified' == $show_date )
$time = $page->post_modified; $time = $page->post_modified;
else else
$time = $page->post_date; $time = $page->post_date;
$output .= " " . mysql2date($date_format, $time); $output .= " " . mysql2date($date_format, $time);
} }
return $output; return $output;
} }
function end_el($output, $page, $depth) { function end_el($output, $page, $depth) {
$output .= "</li>\n"; $output .= "</li>\n";
@ -613,10 +613,10 @@ class Walker_Category extends Walker {
if ( empty($feed_image) ) if ( empty($feed_image) )
$link .= ')'; $link .= ')';
} }
if ( isset($show_count) && $show_count ) if ( isset($show_count) && $show_count )
$link .= ' (' . intval($category->category_count) . ')'; $link .= ' (' . intval($category->category_count) . ')';
if ( isset($show_date) && $show_date ) { if ( isset($show_date) && $show_date ) {
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
} }

View File

@ -54,7 +54,7 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
function wp_clear_scheduled_hook( $hook ) { function wp_clear_scheduled_hook( $hook ) {
$args = array_slice( func_get_args(), 1 ); $args = array_slice( func_get_args(), 1 );
while ( $timestamp = wp_next_scheduled( $hook, $args ) ) while ( $timestamp = wp_next_scheduled( $hook, $args ) )
wp_unschedule_event( $timestamp, $hook, $args ); wp_unschedule_event( $timestamp, $hook, $args );
} }
@ -73,10 +73,10 @@ function wp_next_scheduled( $hook, $args = array() ) {
function spawn_cron() { function spawn_cron() {
$crons = _get_cron_array(); $crons = _get_cron_array();
if ( !is_array($crons) ) if ( !is_array($crons) )
return; return;
$keys = array_keys( $crons ); $keys = array_keys( $crons );
if ( array_shift( $keys ) > time() ) if ( array_shift( $keys ) > time() )
return; return;
@ -98,7 +98,7 @@ function wp_cron() {
return; return;
$crons = _get_cron_array(); $crons = _get_cron_array();
if ( !is_array($crons) ) if ( !is_array($crons) )
return; return;

View File

@ -16,10 +16,10 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
?></title> ?></title>
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator> <generator uri="http://wordpress.org/" version="<?php bloginfo('version'); ?>">WordPress</generator>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" content="<?php bloginfo_rss('home'); ?>" /> <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" content="<?php bloginfo_rss('home'); ?>" />
<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" /> <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
<id><?php bloginfo_rss('comments_atom_url'); ?></id> <id><?php bloginfo_rss('comments_atom_url'); ?></id>
@ -41,13 +41,13 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
} }
?></title> ?></title>
<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" /> <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" />
<author> <author>
<name><?php comment_author_rss(); ?></name> <name><?php comment_author_rss(); ?></name>
<?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?> <?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
</author> </author>
<id><?php comment_link(); ?></id> <id><?php comment_link(); ?></id>
<updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated> <updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated>
<published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published> <published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published>

View File

@ -13,7 +13,7 @@ $more = 1;
> >
<title type="text"><?php bloginfo_rss('name') ?></title> <title type="text"><?php bloginfo_rss('name') ?></title>
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
<generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator> <generator uri="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>

View File

@ -21,7 +21,7 @@ function wptexturize($text) {
$static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace); $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace);
$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/'); $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
$dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2'); $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
for ( $i = 0; $i < $stop; $i++ ) { for ( $i = 0; $i < $stop; $i++ ) {
$curl = $textarr[$i]; $curl = $textarr[$i];

View File

@ -351,15 +351,15 @@ function wp_get_archives($args = '') {
} elseif ('yearly' == $type) { } elseif ('yearly' == $type) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit);
if ($arcresults) { if ($arcresults) {
$afterafter = $after; $afterafter = $after;
foreach ($arcresults as $arcresult) { foreach ($arcresults as $arcresult) {
$url = get_year_link($arcresult->year); $url = get_year_link($arcresult->year);
$text = sprintf('%d', $arcresult->year); $text = sprintf('%d', $arcresult->year);
if ($show_post_count) if ($show_post_count)
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter; $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
echo get_archives_link($url, $text, $format, $before, $after); echo get_archives_link($url, $text, $format, $before, $after);
} }
} }
} elseif ( 'daily' == $type ) { } elseif ( 'daily' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit); $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit);
if ( $arcresults ) { if ( $arcresults ) {

View File

@ -308,7 +308,7 @@ class gettext_reader {
# poEdit doesn't put any semicolons, which # poEdit doesn't put any semicolons, which
# results in parse error in eval # results in parse error in eval
$string .= ';'; $string .= ';';
$total = 0; $total = 0;
$plural = 0; $plural = 0;

View File

@ -28,7 +28,7 @@ function autosave_cur_time() {
((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() + ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() +
((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
} }
function autosave_update_nonce() { function autosave_update_nonce() {
var response = nonceAjax.response; var response = nonceAjax.response;
document.getElementsByName('_wpnonce')[0].value = response; document.getElementsByName('_wpnonce')[0].value = response;
@ -38,7 +38,7 @@ function autosave_update_post_ID() {
var response = autosaveAjax.response; var response = autosaveAjax.response;
var res = parseInt(response); var res = parseInt(response);
var message; var message;
if(isNaN(res)) { if(isNaN(res)) {
message = "<?php echo js_escape(__('Error: ')); ?>" + response; message = "<?php echo js_escape(__('Error: ')); ?>" + response;
} else { } else {
@ -70,7 +70,7 @@ function autosave_saved() {
var response = autosaveAjax.response; var response = autosaveAjax.response;
var res = parseInt(response); var res = parseInt(response);
var message; var message;
if(isNaN(res)) { if(isNaN(res)) {
message = "<?php echo js_escape(__('Error: ')); ?>" + response; message = "<?php echo js_escape(__('Error: ')); ?>" + response;
} else { } else {
@ -127,7 +127,7 @@ function autosave() {
goodcats.push(cats[i].value); goodcats.push(cats[i].value);
} }
catslist = goodcats.join(","); catslist = goodcats.join(",");
autosaveAjax.setVar("action", "autosave"); autosaveAjax.setVar("action", "autosave");
autosaveAjax.setVar("cookie", document.cookie); autosaveAjax.setVar("cookie", document.cookie);
autosaveAjax.setVar("catslist", catslist); autosaveAjax.setVar("catslist", catslist);
@ -139,15 +139,15 @@ function autosave() {
if ( form.ping_status.checked ) if ( form.ping_status.checked )
autosaveAjax.setVar("ping_status", 'open'); autosaveAjax.setVar("ping_status", 'open');
if(form.excerpt) if(form.excerpt)
autosaveAjax.setVar("excerpt", form.excerpt.value); autosaveAjax.setVar("excerpt", form.excerpt.value);
if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
autosaveAjax.setVar("content", form.content.value); autosaveAjax.setVar("content", form.content.value);
} else { } else {
tinyMCE.wpTriggerSave(); tinyMCE.wpTriggerSave();
autosaveAjax.setVar("content", form.content.value); autosaveAjax.setVar("content", form.content.value);
} }
autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
autosaveAjax.method = "POST"; autosaveAjax.method = "POST";
autosaveAjax.element = null; autosaveAjax.element = null;

View File

@ -40,7 +40,7 @@
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari')); $mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
$mce_browsers = implode($mce_browsers, ','); $mce_browsers = implode($mce_browsers, ',');
$mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css'; $mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
$mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css'; $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
$mce_css = apply_filters('mce_css', $mce_css); $mce_css = apply_filters('mce_css', $mce_css);

View File

@ -262,7 +262,7 @@ function get_post_comments_feed_link($post_id = '', $feed = 'rss2') {
$url = get_option('home') . "/?feed=$feed&amp;p=$id"; $url = get_option('home') . "/?feed=$feed&amp;p=$id";
} }
return apply_filters('post_comments_feed_link', $url); return apply_filters('post_comments_feed_link', $url);
} }
function edit_post_link($link = 'Edit This', $before = '', $after = '') { function edit_post_link($link = 'Edit This', $before = '', $after = '') {

View File

@ -163,7 +163,7 @@ function wp_mail($to, $subject, $message, $headers = '') {
require_once(ABSPATH . WPINC . '/class-smtp.php'); require_once(ABSPATH . WPINC . '/class-smtp.php');
$phpmailer = new PHPMailer(); $phpmailer = new PHPMailer();
} }
$mail = compact('to', 'subject', 'message', 'headers'); $mail = compact('to', 'subject', 'message', 'headers');
$mail = apply_filters('wp_mail', $mail); $mail = apply_filters('wp_mail', $mail);
extract($mail); extract($mail);

View File

@ -101,7 +101,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
if ( ! empty($more_link_text) ) if ( ! empty($more_link_text) )
$output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>"; $output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
} }
} }
if ( $preview ) // preview fix for javascript bug with foreign languages if ( $preview ) // preview fix for javascript bug with foreign languages
$output = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output); $output = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);

View File

@ -80,7 +80,7 @@ function get_extended($post) {
$main = $post; $main = $post;
$extended = ''; $extended = '';
} }
// Strip leading and trailing whitespace // Strip leading and trailing whitespace
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
@ -555,7 +555,7 @@ function wp_insert_post($postarr = array()) {
if ( 'draft' != $post_status ) if ( 'draft' != $post_status )
$post_date_gmt = get_gmt_from_date($post_date); $post_date_gmt = get_gmt_from_date($post_date);
} }
if ( 'publish' == $post_status ) { if ( 'publish' == $post_status ) {
$now = gmdate('Y-m-d H:i:59'); $now = gmdate('Y-m-d H:i:59');
if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) ) if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
@ -704,7 +704,7 @@ function wp_insert_post($postarr = array()) {
// Schedule publication. // Schedule publication.
if ( 'future' == $post_status ) if ( 'future' == $post_status )
wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($post_ID)); wp_schedule_single_event(strtotime($post_date_gmt. ' GMT'), 'publish_future_post', array($post_ID));
do_action('save_post', $post_ID); do_action('save_post', $post_ID);
do_action('wp_insert_post', $post_ID); do_action('wp_insert_post', $post_ID);
@ -1107,7 +1107,7 @@ function &get_pages($args = '') {
$author_query = ''; $author_query = '';
if (!empty($authors)) { if (!empty($authors)) {
$post_authors = preg_split('/[\s,]+/',$authors); $post_authors = preg_split('/[\s,]+/',$authors);
if ( count($post_authors) ) { if ( count($post_authors) ) {
foreach ( $post_authors as $post_author ) { foreach ( $post_authors as $post_author ) {
//Do we have an author id or an author login? //Do we have an author id or an author login?

View File

@ -200,7 +200,7 @@ function is_single ($post = '') {
function is_singular() { function is_singular() {
global $wp_query; global $wp_query;
return $wp_query->is_singular; return $wp_query->is_singular;
} }
function is_time () { function is_time () {
@ -285,7 +285,7 @@ class WP_Query {
var $current_post = -1; var $current_post = -1;
var $in_the_loop = false; var $in_the_loop = false;
var $post; var $post;
var $comments; var $comments;
var $comment_count = 0; var $comment_count = 0;
var $current_comment = -1; var $current_comment = -1;
@ -360,7 +360,7 @@ class WP_Query {
function parse_query_vars() { function parse_query_vars() {
$this->parse_query(''); $this->parse_query('');
} }
function fill_query_vars($array) { function fill_query_vars($array) {
$keys = array( $keys = array(
'error' 'error'
@ -395,7 +395,7 @@ class WP_Query {
if ( !isset($array[$key])) if ( !isset($array[$key]))
$array[$key] = ''; $array[$key] = '';
} }
return $array; return $array;
} }
@ -410,9 +410,9 @@ class WP_Query {
$this->query = $query; $this->query = $query;
$this->query_vars = $qv; $this->query_vars = $qv;
} }
$qv = $this->fill_query_vars($qv); $qv = $this->fill_query_vars($qv);
if ( ! empty($qv['robots']) ) { if ( ! empty($qv['robots']) ) {
$this->is_robots = true; $this->is_robots = true;
return; return;
@ -609,7 +609,7 @@ class WP_Query {
// Shorthand. // Shorthand.
$q = &$this->query_vars; $q = &$this->query_vars;
$q = $this->fill_query_vars($q); $q = $this->fill_query_vars($q);
// First let's clear some variables // First let's clear some variables
@ -1001,7 +1001,7 @@ class WP_Query {
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page']; $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
} }
} }
// Comments feeds // Comments feeds
if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) { if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
if ( $this->is_archive || $this->is_search ) { if ( $this->is_archive || $this->is_search ) {
@ -1013,19 +1013,19 @@ class WP_Query {
$cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'"; $cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'";
$cgroupby = ''; $cgroupby = '';
} }
$cjoin = apply_filters('comment_feed_join', $cjoin); $cjoin = apply_filters('comment_feed_join', $cjoin);
$cwhere = apply_filters('comment_feed_where', $cwhere); $cwhere = apply_filters('comment_feed_where', $cwhere);
$cgroupby = apply_filters('comment_feed_groupby', $cgroupby); $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
$this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss')); $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss'));
$this->comment_count = count($this->comments); $this->comment_count = count($this->comments);
$post_ids = array(); $post_ids = array();
foreach ($this->comments as $comment) foreach ($this->comments as $comment)
$post_ids[] = (int) $comment->comment_post_ID; $post_ids[] = (int) $comment->comment_post_ID;
$post_ids = join(',', $post_ids); $post_ids = join(',', $post_ids);
$join = ''; $join = '';
if ( $post_ids ) if ( $post_ids )
@ -1061,14 +1061,14 @@ class WP_Query {
$this->comments = $wpdb->get_results($comments_request); $this->comments = $wpdb->get_results($comments_request);
$this->comment_count = count($this->comments); $this->comment_count = count($this->comments);
} }
if ( !empty($limits) ) { if ( !empty($limits) ) {
$found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' ); $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' );
$this->found_posts = $wpdb->get_var( $found_posts_query ); $this->found_posts = $wpdb->get_var( $found_posts_query );
$this->found_posts = apply_filters( 'found_posts', $this->found_posts ); $this->found_posts = apply_filters( 'found_posts', $this->found_posts );
$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
} }
// Check post status to determine if post should be displayed. // Check post status to determine if post should be displayed.
if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) { if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
$status = get_post_status($this->posts[0]); $status = get_post_status($this->posts[0]);
@ -1148,34 +1148,34 @@ class WP_Query {
$this->post = $this->posts[0]; $this->post = $this->posts[0];
} }
} }
function next_comment() { function next_comment() {
$this->current_comment++; $this->current_comment++;
$this->comment = $this->comments[$this->current_comment]; $this->comment = $this->comments[$this->current_comment];
return $this->comment; return $this->comment;
} }
function the_comment() { function the_comment() {
global $comment; global $comment;
$comment = $this->next_comment(); $comment = $this->next_comment();
if ($this->current_comment == 0) { if ($this->current_comment == 0) {
do_action('comment_loop_start'); do_action('comment_loop_start');
} }
} }
function have_comments() { function have_comments() {
if ($this->current_comment + 1 < $this->comment_count) { if ($this->current_comment + 1 < $this->comment_count) {
return true; return true;
} elseif ($this->current_comment + 1 == $this->comment_count) { } elseif ($this->current_comment + 1 == $this->comment_count) {
$this->rewind_comments(); $this->rewind_comments();
} }
return false; return false;
} }
function rewind_comments() { function rewind_comments() {
$this->current_comment = -1; $this->current_comment = -1;
if ($this->comment_count > 0) { if ($this->comment_count > 0) {

View File

@ -186,7 +186,7 @@ function get_themes() {
if ( !file_exists("$theme_root/$template/index.php") ) { if ( !file_exists("$theme_root/$template/index.php") ) {
$parent_dir = dirname(dirname($theme_file)); $parent_dir = dirname(dirname($theme_file));
if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) { if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) {
$template = "$parent_dir/$template"; $template = "$parent_dir/$template";
} else { } else {
$wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.')); $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'));
continue; continue;
@ -484,7 +484,7 @@ function get_header_textcolor() {
} }
function header_textcolor() { function header_textcolor() {
echo get_header_textcolor(); echo get_header_textcolor();
} }
function get_header_image() { function get_header_image() {
@ -492,7 +492,7 @@ function get_header_image() {
} }
function header_image() { function header_image() {
echo get_header_image(); echo get_header_image();
} }
function add_custom_image_header($header_callback, $admin_header_callback) { function add_custom_image_header($header_callback, $admin_header_callback) {

View File

@ -48,7 +48,7 @@ class wpdb {
function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
} }
function __construct($dbuser, $dbpassword, $dbname, $dbhost) { function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
register_shutdown_function(array(&$this, "__destruct")); register_shutdown_function(array(&$this, "__destruct"));
@ -79,7 +79,7 @@ class wpdb {
} }
function __destruct() { function __destruct() {
return true; return true;
} }
/** /**
@ -181,7 +181,7 @@ class wpdb {
$this->result = @mysql_query($query, $this->dbh); $this->result = @mysql_query($query, $this->dbh);
++$this->num_queries; ++$this->num_queries;
if (SAVEQUERIES) if (SAVEQUERIES)
$this->queries[] = array( $query, $this->timer_stop() ); $this->queries[] = array( $query, $this->timer_stop() );
@ -255,7 +255,7 @@ class wpdb {
$this->func_call = "\$db->get_row(\"$query\",$output,$y)"; $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
if ( $query ) if ( $query )
$this->query($query); $this->query($query);
if ( !isset($this->last_result[$y]) ) if ( !isset($this->last_result[$y]) )
return null; return null;

View File

@ -96,7 +96,7 @@ case 'retrievepassword' :
$errors['user_email'] = __('<strong>ERROR</strong>: The e-mail field is empty.'); $errors['user_email'] = __('<strong>ERROR</strong>: The e-mail field is empty.');
do_action('lostpassword_post'); do_action('lostpassword_post');
if ( empty( $errors ) ) { if ( empty( $errors ) ) {
$user_data = get_userdatabylogin(trim($_POST['user_login'])); $user_data = get_userdatabylogin(trim($_POST['user_login']));
// redefining user_login ensures we return the right case in the email // redefining user_login ensures we return the right case in the email
@ -328,7 +328,7 @@ default:
$errors['expiredsession'] = __('Your session has expired.'); $errors['expiredsession'] = __('Your session has expired.');
} }
} }
if ( $_POST && empty( $user_login ) ) if ( $_POST && empty( $user_login ) )
$errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.'); $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.');
if ( $_POST && empty( $user_pass ) ) if ( $_POST && empty( $user_pass ) )

View File

@ -504,7 +504,7 @@ class wp_xmlrpc_server extends IXR_Server {
if(empty($category["description"])) { if(empty($category["description"])) {
$category["description"] = ""; $category["description"] = "";
} }
$new_category = array( $new_category = array(
"cat_name" => $category["name"], "cat_name" => $category["name"],
"category_nicename" => $category["slug"], "category_nicename" => $category["slug"],