Notice fixes from filosofo and Viper007Bond. see #7509

git-svn-id: http://svn.automattic.com/wordpress/trunk@9506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-04 03:22:24 +00:00
parent a1c1da11f8
commit 2fdde1e736
17 changed files with 45 additions and 30 deletions

View File

@ -230,8 +230,13 @@ if ( $page_links )
<br class="clear" />
</div>
<br class="clear" />
</form>
<div class="form-wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
</div>
</div>
</div><!-- /col-right -->
@ -278,11 +283,6 @@ if ( $page_links )
<?php } ?>
<div class="form-wrap">
<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
</div>
</div>
</div><!-- /col-left -->

View File

@ -128,7 +128,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A'));
$m_time = $post->post_date;
$time = get_post_time( 'G', true );
$time = get_post_time( 'G', true, $post );
if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
if ( $t_diff < 0 )
$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );

View File

@ -204,7 +204,7 @@ if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
<?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
<?php if ( current_user_can('publish_posts') ) : ?>
<?php if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
<?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
<?php else : ?>
<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />

View File

@ -180,7 +180,7 @@ if ( $page_links )
<div id="col-left">
<div class="col-wrap">
<?php if ( current_user_can('manage_categories') ) {
<?php if ( isset( $category ) && current_user_can('manage_categories') ) {
$category = (object) array(); $category->parent = 0; do_action('add_link_category_form_pre', $category); ?>
<div class="form-wrap">

View File

@ -70,7 +70,7 @@ function link_submit_meta_box($link) {
<?php } ?>
<?php
if ( 'edit' == $_GET['action'] && current_user_can('manage_links') )
if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') )
echo "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape( sprintf( __("You are about to delete this link '%s'\n'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;link') . "</a>";
?>
</p>
@ -341,8 +341,10 @@ add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link'
</div>
-->
<?php
echo $form;
echo $link_added;
if ( !empty($form) )
echo $form;
if ( !empty($link_added) )
echo $link_added;
wp_nonce_field( $nonce_action );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );

View File

@ -190,7 +190,7 @@ if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
<?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { ?>
<?php if ( current_user_can('publish_posts') ) : ?>
<?php if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
<?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
<?php else : ?>
<input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />

View File

@ -814,7 +814,7 @@ class Blogger_Import {
echo $result->get_error_message();
} elseif ( isset($_GET['token']) )
$this->auth();
elseif ( $this->token && $this->token_is_valid() )
elseif ( isset($this->token) && $this->token_is_valid() )
$this->show_blogs();
else
$this->greet();

View File

@ -173,7 +173,6 @@ function install_search_form(){
</select>
<input type="text" name="s" id="search-field" value="<?php echo attribute_escape($term) ?>" />
<input type="submit" name="search" value="<?php echo attribute_escape(__('Search')) ?>" class="button" />
<?php echo $after_submit ?>
</form><?php
}

View File

@ -1242,7 +1242,7 @@ function _post_row($a_post, $pending_comments, $mode) {
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A'));
$m_time = $post->post_date;
$time = get_post_time('G', true);
$time = get_post_time('G', true, $post);
if ( ( abs(time() - $time) ) < 86400 ) {
if ( ( 'future' == $post->post_status) )

View File

@ -17,12 +17,12 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description
if ( ! current_user_can('manage_links') )
wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
if ('' != $_POST['deletebookmarks'])
if ( !empty($_POST['deletebookmarks']) )
$action = 'deletebookmarks';
if ('' != $_POST['move'])
if ( !empty($_POST['move']) )
$action = 'move';
if ('' != $_POST['linkcheck'])
$linkcheck = $_POST[linkcheck];
if ( !empty($_POST['linkcheck']) )
$linkcheck = $_POST['linkcheck'];
$this_file = 'link-manager.php';

View File

@ -70,6 +70,8 @@ case 'update':
if ( $options ) {
foreach ( $options as $option ) {
$option = trim($option);
$value = null;
if ( isset($_POST[$option]) )
$value = $_POST[$option];
if ( !is_array($value) ) $value = trim($value);
$value = stripslashes_deep($value);

View File

@ -184,7 +184,7 @@ $_num_posts = (array) wp_count_attachments();
$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
foreach ( $matches as $type => $reals )
foreach ( $reals as $real )
$num_posts[$type] += $_num_posts[$real];
$num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
$class = empty($_GET['post_mime_type']) && ! isset($_GET['detached']) ? ' class="current"' : '';
$type_links[] = "<li><a href=\"upload.php\"$class>".__('All Types')."</a>";
@ -194,7 +194,7 @@ foreach ( $post_mime_types as $mime_type => $label ) {
if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
continue;
if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
$class = ' class="current"';
$type_links[] = "<li><a href=\"upload.php?post_mime_type=$mime_type\"$class>" .

View File

@ -222,7 +222,7 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
</tr>
<tr>
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e( 'Enable keyboard shortcuts for comment moderation. <a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>' ); ?></label></td>
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e( 'Enable keyboard shortcuts for comment moderation. <a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>' ); ?></label></td>
</tr>
<?php
endif;

View File

@ -62,6 +62,10 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
$redirect = $original;
$redirect_url = false;
// Notice fixing
if ( !isset($redirect['path']) ) $redirect['path'] = '';
if ( !isset($redirect['query']) ) $redirect['query'] = '';
if ( is_singular() && 1 > $wp_query->post_count && ($id = get_query_var('p')) ) {
$vars = $wpdb->get_results( $wpdb->prepare("SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id) );

View File

@ -277,8 +277,10 @@ function sanitize_category_field( $field, $value, $cat_id, $context ) {
function &get_tags( $args = '' ) {
$tags = get_terms( 'post_tag', $args );
if ( empty( $tags ) )
return array();
if ( empty( $tags ) ) {
$return = array();
return $return;
}
$tags = apply_filters( 'get_tags', $tags, $args );
return $tags;

View File

@ -1626,10 +1626,14 @@ class WP_Rewrite {
}
$site_root = parse_url(get_option('siteurl'));
if ( isset( $site_root['path'] ) ) {
$site_root = trailingslashit($site_root['path']);
}
$home_root = parse_url(get_option('home'));
if ( isset( $home_root['path'] ) ) {
$home_root = trailingslashit($home_root['path']);
}
$rules = "<IfModule mod_rewrite.c>\n";
$rules .= "RewriteEngine On\n";

View File

@ -1551,6 +1551,8 @@ function wp_widget_rss_output( $rss, $args = array() ) {
return;
}
$default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
$args = wp_parse_args( $args, $default_args );
extract( $args, EXTR_SKIP );
$items = (int) $items;