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'];
$_SERVER['PATH_INFO'] = $action;
if ($eid) {
$_SERVER['PATH_INFO'] .= "/$eid";
}
@ -173,7 +173,7 @@ class AtomParser {
} else if($tag == 'category') {
array_push($this->entry->categories, $attrs);
}
$this->ns_decls = array();
}
@ -201,7 +201,7 @@ class AtomParser {
}
array_shift($this->ns_contexts);
#print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n";
$this->depth--;
@ -342,7 +342,7 @@ class AtomServer {
exit();
} else {
// 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) {
// checked for valid content-types (atom+xml)
// quick check and exit
$this->get_accepted_content_type($this->atom_content_types);
@ -508,9 +508,9 @@ EOD;
if(!current_user_can('edit_post', $postID)) {
$this->auth_required('Sorry, you do not have the right to delete this post.');
}
if ($entry['post_type'] == 'attachment') {
$this->delete_attachment($postID);
$this->delete_attachment($postID);
} else {
$result = wp_delete_post($postID);
@ -523,7 +523,7 @@ EOD;
}
}
function get_attachment($postID = NULL) {
global $entry;
@ -551,7 +551,7 @@ EOD;
$bits .= fread($fp, 4096);
}
fclose($fp);
$slug = '';
if ( isset( $_SERVER['HTTP_SLUG'] ) )
$slug = sanitize_file_name( $_SERVER['HTTP_SLUG'] );
@ -564,7 +564,7 @@ EOD;
$file = wp_upload_bits( $slug, NULL, $bits);
log_app('wp_upload_bits returns:',print_r($file,true));
$url = $file['url'];
$file = $file['file'];
$filename = basename($file);
@ -718,7 +718,7 @@ EOD;
}
fclose($fp);
fclose($localfp);
log_app('function',"put_file($postID)");
$this->ok();
}
@ -760,7 +760,7 @@ EOD;
$url = $this->get_categories_url();
echo $url;
}
function get_attachments_url($page = NULL) {
global $use_querystring;
$url = get_bloginfo('url') . '/' . $this->script_name;
@ -790,7 +790,7 @@ EOD;
global $post;
$postID = $GLOBALS['post']->ID;
}
if ($use_querystring) {
$url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->ENTRY_PATH . "&eid=$postID";
} else {
@ -812,7 +812,7 @@ EOD;
global $post;
$postID = $GLOBALS['post']->ID;
}
if ($use_querystring) {
$url = get_bloginfo('url') . '/' . $this->script_name . '?action=/' . $this->MEDIA_SINGLE_PATH ."&eid=$postID";
} else {
@ -873,8 +873,8 @@ EOD;
$page = 1;
}
$page = (int) $page;
$count = get_option('posts_per_rss');
$count = get_option('posts_per_rss');
$query = "paged=$page&posts_per_page=$count&order=DESC";
if($post_type == 'attachment') {
$query .= "&post_type=$post_type";
@ -887,7 +887,7 @@ EOD;
$wpdb = $GLOBALS['wpdb'];
$blog_id = $GLOBALS['blog_id'];
$post_cache = $GLOBALS['post_cache'];
$total_count = $this->get_posts_count();
$last_page = (int) ceil($total_count / $count);
@ -1056,7 +1056,7 @@ $post = $GLOBALS['post'];
header('Content-Type: text/plain');
exit;
}
function not_found() {
log_app('Status','404: Not Found');
header('Content-Type: text/plain');
@ -1077,7 +1077,7 @@ $post = $GLOBALS['post'];
status_header('400');
exit;
}
function created($post_ID, $content, $post_type = 'post') {
global $use_querystring;
log_app('created()::$post_ID',"$post_ID, $post_type");
@ -1151,7 +1151,7 @@ $post = $GLOBALS['post'];
function authenticate() {
$login_data = array();
$already_md5 = false;
log_app("authenticate()",print_r($_ENV, true));
// if using mod_rewrite/ENV hack
@ -1209,7 +1209,7 @@ $post = $GLOBALS['post'];
function process_conditionals() {
if(empty($this->params)) 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
$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);
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_category'] = explode(",", $_POST['catslist']);
if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
unset($_POST['post_category']);
unset($_POST['post_category']);
if($_POST['post_ID'] < 0) {
$_POST['temp_ID'] = $_POST['post_ID'];
$id = wp_write_post();

View File

@ -681,7 +681,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) {
if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
}
} else {
$checked_categories[] = $default;
}
@ -737,7 +737,7 @@ function get_nested_link_categories( $default = 0, $parent = 0 ) {
if ( count( $checked_categories ) == 0 ) {
// No selected categories, strange
$checked_categories[] = $default;
}
}
} else {
$checked_categories[] = $default;
}
@ -778,7 +778,7 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
}
$output = ob_get_contents();
ob_end_clean();
$output = apply_filters('cat_rows', $output);
echo $output;
@ -1316,7 +1316,7 @@ function user_can_access_admin_page() {
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
return false;
if ( empty( $parent) ) {
if ( isset( $_wp_menu_nopriv[$pagenow] ) )
return false;
@ -1328,7 +1328,7 @@ function user_can_access_admin_page() {
if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
return false;
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) )
return false;
return false;
}
return true;
}
@ -1450,14 +1450,14 @@ function get_admin_page_parent() {
if ( isset( $_wp_real_parent_file[$parent_file] ) )
$parent_file = $_wp_real_parent_file[$parent_file];
return $parent_file;
}
}
}
if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) {
$parent_file = $pagenow;
if ( isset( $_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) {
@ -1897,7 +1897,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
// Compute the URL
$url = $uploads['url'] . "/$filename";
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return $return;
@ -2056,7 +2056,7 @@ function update_home_siteurl( $old_value, $value ) {
// Clear cookies for old paths.
wp_clearcookie();
// 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 );

View File

@ -17,7 +17,7 @@ class Custom_Image_Header {
function js_includes() {
wp_enqueue_script('cropper');
wp_enqueue_script('colorpicker');
wp_enqueue_script('colorpicker');
}
function js() {
@ -115,7 +115,7 @@ class Custom_Image_Header {
function colorDefault() {
pickColor('<?php echo HEADER_TEXTCOLOR; ?>');
}
function hide_text() {
$('name').style.display = 'none';
$('desc').style.display = 'none';
@ -126,7 +126,7 @@ class Custom_Image_Header {
// $('hidetext').onclick = 'show_text()';
Event.observe( $('hidetext'), 'click', show_text );
}
function show_text() {
$('name').style.display = 'block';
$('desc').style.display = 'block';
@ -134,7 +134,7 @@ class Custom_Image_Header {
$('defaultcolor').style.display = 'inline';
$('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
$('hidetext').value = '<?php _e('Hide Text'); ?>';
Event.stopObserving( $('hidetext'), 'click', show_text );
Event.stopObserving( $('hidetext'), 'click', show_text );
Event.observe( $('hidetext'), 'click', hide_text );
}

View File

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

View File

@ -91,7 +91,7 @@ class GM_Import {
if (!chdir($gmpath))
wp_die(sprintf(__("Wrong path, %s\ndoesn't exist\non the server"), $gmpath));
$this->header();
?>
<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_id = wp_insert_user($user_info);
$this->gmnames[$userdata[0]] = $user_id;
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_url=$wpdb->escape("");
$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_id = wp_insert_user($user_info);
$this->gmnames[$postinfo[1]] = $user_id;
echo ': ';
printf(__('registered deleted user %s at level 0 '), "<em>$user_login</em>");
}
if (array_key_exists($postinfo[1], $this->gmnames)) {
$post_author = $this->gmnames[$postinfo[1]];
} else {
$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');
$post_ID = wp_insert_post($postdata);
}

View File

@ -12,16 +12,16 @@ if (!$step) $step = 0;
?>
<?php
switch ($step) {
case 0:
{
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
case 0: {
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
$opmltype = 'blogrolling'; // default.
$opmltype = 'blogrolling'; // default.
?>
<div class="wrap">
<h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?>
@ -40,7 +40,6 @@ switch ($step) {
<input id="userfile" name="userfile" type="file" size="30" />
</div>
</div>
<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>
<?php
break;
} // end case 0
break;
} // end case 0
case 1: {
case 1: {
check_admin_referer('import-bookmarks');
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
include_once('admin-header.php');
if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?'));
?>
<div class="wrap">
<h2><?php _e('Importing...') ?></h2>
<h2><?php _e('Importing...') ?></h2>
<?php
$cat_id = $_POST['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) {
$cat_id = 1;
}
$cat_id = $_POST['cat_id'];
if ( $cat_id == '' || $cat_id == 0 )
$cat_id = 1;
$opml_url = $_POST['opml_url'];
if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
$blogrolling = true;
}
else // try to get the upload file.
{
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
$opml_url = $_POST['opml_url'];
if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
$blogrolling = true;
} else { // try to get the upload file.
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
if ( isset($file['error']) )
wp_die($file['error']);
if ( isset($file['error']) )
wp_die($file['error']);
$url = $file['url'];
$opml_url = $file['file'];
$blogrolling = false;
}
$url = $file['url'];
$opml_url = $file['file'];
$blogrolling = false;
}
if (isset($opml_url) && $opml_url != '') {
$opml = wp_remote_fopen($opml_url);
include_once('link-parse-opml.php');
if ( isset($opml_url) && $opml_url != '' ) {
$opml = wp_remote_fopen($opml_url);
include_once('link-parse-opml.php');
$link_count = count($names);
for ($i = 0; $i < $link_count; $i++) {
if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4))
$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]);
wp_insert_link($link);
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
}
$link_count = count($names);
for ( $i = 0; $i < $link_count; $i++ ) {
if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = '';
if ( 'http' == substr($titles[$i], 0, 4) )
$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]);
wp_insert_link($link);
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 )
@unlink($opml_url);
<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 )
@unlink($opml_url);
?>
</div>
<?php
break;
} // end case 1
break;
} // end case 1
} // end switch
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');
else
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
@ -104,7 +104,7 @@ foreach ( $menu as $id => $data ) {
if ( $new_parent != $old_parent ) {
$_wp_real_parent_file[$old_parent] = $new_parent;
$menu[$id][2] = $new_parent;
foreach ($submenu[$old_parent] as $index => $data) {
$submenu[$new_parent][$index] = $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;
}
return $value;
return $value;
}
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>";
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />";
echo "</td>
<td>$option->option_description</td>
</tr>";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -342,7 +342,7 @@ function wp_list_bookmarks($args = '') {
} else {
//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");
if ( !empty($bookmarks) ) {
if ( !empty( $title_li ) ){
$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))
$exclusions .= ')';
if ( ! empty($category_name) ) {
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
$category = $cat_id;

View File

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

View File

@ -247,7 +247,7 @@ function wp_list_categories($args = '') {
$output .= __("No categories");
} else {
global $wp_query;
if ( is_category() )
$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);
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
}
// End the element.
if ( isset($element->$id_field) && $element->$id_field != 0 ) {
$cb_args = array_merge( array($output, $element, $depth - 1), $args);
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
continue;
continue;
}
// Walk the tree.
if ( !empty($previous_element) && ($element->$parent_field == $previous_element->$id_field) ) {
// Previous element is my parent. Descend a level.
@ -512,19 +512,19 @@ class Walker_Page extends Walker {
$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>';
if ( !empty($show_date) ) {
if ( 'modified' == $show_date )
$time = $page->post_modified;
else
$time = $page->post_date;
$output .= " " . mysql2date($date_format, $time);
}
return $output;
}
function end_el($output, $page, $depth) {
$output .= "</li>\n";
@ -613,10 +613,10 @@ class Walker_Category extends Walker {
if ( empty($feed_image) )
$link .= ')';
}
if ( isset($show_count) && $show_count )
$link .= ' (' . intval($category->category_count) . ')';
if ( isset($show_date) && $show_date ) {
$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 ) {
$args = array_slice( func_get_args(), 1 );
while ( $timestamp = wp_next_scheduled( $hook, $args ) )
wp_unschedule_event( $timestamp, $hook, $args );
}
@ -73,10 +73,10 @@ function wp_next_scheduled( $hook, $args = array() ) {
function spawn_cron() {
$crons = _get_cron_array();
if ( !is_array($crons) )
return;
$keys = array_keys( $crons );
if ( array_shift( $keys ) > time() )
return;
@ -98,7 +98,7 @@ function wp_cron() {
return;
$crons = _get_cron_array();
if ( !is_array($crons) )
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());
?></title>
<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
<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>
<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'); ?>" />
<id><?php bloginfo_rss('comments_atom_url'); ?></id>
@ -41,13 +41,13 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
}
?></title>
<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" />
<author>
<name><?php comment_author_rss(); ?></name>
<?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
</author>
<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>
<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>
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
<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>

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);
$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++ ) {
$curl = $textarr[$i];

View File

@ -351,15 +351,15 @@ function wp_get_archives($args = '') {
} 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);
if ($arcresults) {
$afterafter = $after;
foreach ($arcresults as $arcresult) {
$url = get_year_link($arcresult->year);
$text = sprintf('%d', $arcresult->year);
$afterafter = $after;
foreach ($arcresults as $arcresult) {
$url = get_year_link($arcresult->year);
$text = sprintf('%d', $arcresult->year);
if ($show_post_count)
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
echo get_archives_link($url, $text, $format, $before, $after);
}
}
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
echo get_archives_link($url, $text, $format, $before, $after);
}
}
} 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);
if ( $arcresults ) {

View File

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

View File

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

View File

@ -40,7 +40,7 @@
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
$mce_browsers = implode($mce_browsers, ',');
$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 = 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";
}
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 = '') {

View File

@ -163,7 +163,7 @@ function wp_mail($to, $subject, $message, $headers = '') {
require_once(ABSPATH . WPINC . '/class-smtp.php');
$phpmailer = new PHPMailer();
}
$mail = compact('to', 'subject', 'message', 'headers');
$mail = apply_filters('wp_mail', $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) )
$output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
}
}
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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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