Notice fixes see #7509 props DD32 and jacobsantos.

git-svn-id: http://svn.automattic.com/wordpress/trunk@8944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-09-21 20:41:25 +00:00
parent 2e11a3bf66
commit 95e26235ad
15 changed files with 91 additions and 26 deletions

View File

@ -13,7 +13,7 @@ $title = __('Categories');
wp_reset_vars(array('action', 'cat'));
if ( $_GET['action'] == 'delete' && isset($_GET['delete']) )
if ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' && isset($_GET['delete']) )
$action = 'bulk-delete';
switch($action) {
@ -154,10 +154,10 @@ endif; ?>
<div class="tablenav">
<?php
$pagenum = absint( $_GET['pagenum'] );
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
$pagenum = 1;
if( !$catsperpage || $catsperpage < 0 )
if( ! isset( $catsperpage ) || $catsperpage < 0 )
$catsperpage = 20;
$page_links = paginate_links( array(

View File

@ -6,6 +6,12 @@
* @subpackage Administration
*/
/**
* @var object
*/
if ( ! isset( $category ) )
$category = (object) array();
if ( ! empty($cat_ID) ) {
/**
* @var string
@ -24,6 +30,29 @@ if ( ! empty($cat_ID) ) {
$nonce_action = 'add-category';
do_action('add_category_form_pre', $category);
}
/**
* @ignore
* @since 2.7
* @internal Used to prevent errors in page when no category is being edited.
*
* @param object $category
*/
function _fill_empty_category(&$category) {
if ( ! isset( $category->name ) )
$category->name = '';
if ( ! isset( $category->slug ) )
$category->slug = '';
if ( ! isset( $category->parent ) )
$category->parent = '';
if ( ! isset( $category->description ) )
$category->description = '';
}
_fill_empty_category($category);
?>
<div class="wrap">

View File

@ -369,7 +369,7 @@ function post_password_meta_box($post) {
<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
</p>
<h4><?php _e( 'Post Password' ); ?></h4>
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password ); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
<?php
}

View File

@ -95,10 +95,10 @@ endif; ?>
<div class="tablenav">
<?php
$pagenum = absint( $_GET['pagenum'] );
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
$pagenum = 1;
if( !$catsperpage || $catsperpage < 0 )
if( ! isset( $catsperpage ) || $catsperpage < 0 )
$catsperpage = 20;
$page_links = paginate_links( array(

View File

@ -6,6 +6,12 @@
* @subpackage Administration
*/
/**
* @var object
*/
if ( ! isset( $category ) )
$category = (object) array();
if ( ! empty($cat_ID) ) {
/**
* @var string
@ -24,6 +30,26 @@ if ( ! empty($cat_ID) ) {
$nonce_action = 'add-link-category';
do_action('add_link_category_form_pre', $category);
}
/**
* @ignore
* @since 2.7
* @internal Used to prevent errors in page when no category is being edited.
*
* @param object $category
*/
function _fill_empty_link_category(&$category) {
if ( ! isset( $category->name ) )
$category->name = '';
if ( ! isset( $category->slug ) )
$category->slug = '';
if ( ! isset( $category->description ) )
$category->description = '';
}
_fill_empty_link_category($category);
?>
<div class="wrap">

View File

@ -36,12 +36,12 @@ if ( ! empty($tag_ID) ) {
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
<td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
<p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
<td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
<td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
<p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
</tr>
</table>

View File

@ -13,7 +13,7 @@ $title = __('Tags');
wp_reset_vars(array('action', 'tag'));
if ( $_GET['action'] == 'delete' && isset($_GET['delete_tags']) )
if ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' && isset($_GET['delete_tags']) )
$action = 'bulk-delete';
switch($action) {
@ -161,10 +161,10 @@ endif; ?>
<div class="tablenav">
<?php
$pagenum = absint( $_GET['pagenum'] );
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
if ( empty($pagenum) )
$pagenum = 1;
if( !$tagsperpage || $tagsperpage < 0 )
if( ! isset( $tagsperpage ) || $tagsperpage < 0 )
$tagsperpage = 20;
$page_links = paginate_links( array(
@ -201,7 +201,7 @@ if ( $page_links )
<tbody id="the-list" class="list:tag">
<?php
$searchterms = trim( $_GET['s'] );
$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
?>

View File

@ -230,10 +230,10 @@ function get_user_to_edit( $user_id ) {
$user->last_name = attribute_escape($user->last_name);
$user->display_name = attribute_escape($user->display_name);
$user->nickname = attribute_escape($user->nickname);
$user->aim = attribute_escape($user->aim);
$user->yim = attribute_escape($user->yim);
$user->jabber = attribute_escape($user->jabber);
$user->description = wp_specialchars($user->description);
$user->aim = isset( $user->aim ) && !empty( $user->aim ) ? attribute_escape($user->aim) : '';
$user->yim = isset( $user->yim ) && !empty( $user->yim ) ? attribute_escape($user->yim) : '';
$user->jabber = isset( $user->jabber ) && !empty( $user->jabber ) ? attribute_escape($user->jabber) : '';
$user->description = isset( $user->description ) && !empty( $user->description ) ? wp_specialchars($user->description) : '';
return $user;
}

View File

@ -59,9 +59,11 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
continue;
if ( ! isset( $widget['params'][0] ) )
$widget['params'][0] = array();
ob_start();
$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', '_show' => $show ), 1 => $widget['params'][0] ) );
$sidebar_args = call_user_func_array( 'wp_widget_control', $args );
$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', '_show' => $show ), 1 => $widget['params'][0] ) );
$sidebar_args = call_user_func_array( 'wp_widget_control', $args );
$widget_control_template = ob_get_contents();
ob_end_clean();
@ -230,6 +232,13 @@ function wp_widget_control( $sidebar_args ) {
$edit = -1 < $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget
$id_format = $widget['id'];
if ( ! isset( $sidebar_args['_show'] ) )
$sidebar_args['_show'] = '';
if ( ! isset( $sidebar_args['_display'] ) )
$sidebar_args['_display'] = '';
// We aren't showing a widget control, we're outputing a template for a mult-widget control
if ( 'all' == $sidebar_args['_show'] && 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
// number == -1 implies a template where id numbers are replaced by a generic '%i%'

View File

@ -124,7 +124,9 @@ foreach ( $menu as $id => $data ) {
unset($submenu[$old_parent][$index]);
}
unset($submenu[$old_parent]);
$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
if ( isset($_wp_submenu_nopriv[$old_parent]) )
$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
}
}

View File

@ -177,7 +177,7 @@ if ( isset($_GET['detached']) ) {
$h2_noun = $post_mime_type_label;
// Use $_GET instead of is_ since they can override each other
$h2_author = '';
$_GET['author'] = (int) $_GET['author'];
$_GET['author'] = isset( $_GET['author'] ) ? (int) $_GET['author'] : 0;
if ( $_GET['author'] != 0 ) {
if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
$h2_author = ' ' . __('by other authors');

View File

@ -157,7 +157,7 @@ include ('admin-header.php');
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( is_wp_error( $errors ) ) : ?>
<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
<div class="error">
<ul>
<?php

View File

@ -494,7 +494,7 @@ function prep_atom_text_construct($data) {
*/
function self_link() {
echo 'http'
. ( $_SERVER['https'] == 'on' ? 's' : '' ) . '://'
. ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://'
. $_SERVER['HTTP_HOST']
. wp_specialchars(stripslashes($_SERVER['REQUEST_URI']), 1);
}

View File

@ -802,10 +802,8 @@ function maybe_serialize( $data ) {
*/
function make_url_footnote( $content ) {
preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
$j = 0;
$links_summary = "\n";
for ( $i=0; $i<count($matches[0]); $i++ ) {
$links_summary = ( !$j ) ? "\n" : $links_summary;
$j++;
$link_match = $matches[0][$i];
$link_number = '['.($i+1).']';
$link_url = $matches[2][$i];

View File

@ -715,7 +715,8 @@ function &get_terms($taxonomies, $args = '') {
if ( empty($terms) ) {
$cache[ $key ] = array();
wp_cache_set( 'get_terms', $cache, 'terms' );
return apply_filters('get_terms', array(), $taxonomies, $args);
$terms = apply_filters('get_terms', array(), $taxonomies, $args);
return $terms;
}
if ( $child_of || $hierarchical ) {