mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Notice fixes. Props DD32. see #7509
git-svn-id: http://svn.automattic.com/wordpress/trunk@8646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7f894ae416
commit
113c014920
@ -56,13 +56,13 @@ if ( is_single() ) {
|
||||
$post_status_label = _c('Manage Posts|manage posts header');
|
||||
if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) )
|
||||
$post_status_label = $post_stati[$_GET['post_status']][1];
|
||||
if ( $post_listing_pageable && !is_archive() && !is_search() )
|
||||
$h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
|
||||
else
|
||||
//if ( $post_listing_pageable && !is_archive() && !is_search() ) //Unreachable code: $post_listing_pageable is undefined, Similar code in upload.php
|
||||
// $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
|
||||
//else
|
||||
$h2_noun = $post_status_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');
|
||||
@ -93,7 +93,7 @@ foreach ( $post_stati as $status => $label ) {
|
||||
|
||||
if ( empty( $num_posts->$status ) )
|
||||
continue;
|
||||
if ( $status == $_GET['post_status'] )
|
||||
if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
|
||||
$class = ' class="current"';
|
||||
|
||||
$status_links[] = "<li><a href='edit.php?post_status=$status' $class>" .
|
||||
@ -146,16 +146,18 @@ $arc_result = $wpdb->get_results( $arc_query );
|
||||
|
||||
$month_count = count($arc_result);
|
||||
|
||||
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
|
||||
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
|
||||
$m = isset($_GET['m']) ? (int)$_GET['m'] : 0;
|
||||
?>
|
||||
<select name='m'>
|
||||
<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
|
||||
<option<?php selected( $m, 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
|
||||
<?php
|
||||
foreach ($arc_result as $arc_row) {
|
||||
if ( $arc_row->yyear == 0 )
|
||||
continue;
|
||||
$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
|
||||
|
||||
if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
|
||||
if ( $arc_row->yyear . $arc_row->mmonth == $m )
|
||||
$default = ' selected="selected"';
|
||||
else
|
||||
$default = '';
|
||||
|
@ -490,8 +490,8 @@ function wp_edit_posts_query( $q = false ) {
|
||||
global $wpdb;
|
||||
if ( false === $q )
|
||||
$q = $_GET;
|
||||
$q['m'] = (int) $q['m'];
|
||||
$q['cat'] = (int) $q['cat'];
|
||||
$q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
|
||||
$q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
|
||||
$post_stati = array( // array( adj, noun )
|
||||
'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
|
||||
'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
|
||||
@ -510,10 +510,10 @@ function wp_edit_posts_query( $q = false ) {
|
||||
$post_status_q .= '&perm=readable';
|
||||
}
|
||||
|
||||
if ( 'pending' === $q['post_status'] ) {
|
||||
if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
|
||||
$order = 'ASC';
|
||||
$orderby = 'modified';
|
||||
} elseif ( 'draft' === $q['post_status'] ) {
|
||||
} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
|
||||
$order = 'DESC';
|
||||
$orderby = 'modified';
|
||||
} else {
|
||||
|
@ -343,9 +343,9 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
|
||||
function wp_manage_posts_columns() {
|
||||
$posts_columns = array();
|
||||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
if ( 'draft' === $_GET['post_status'] )
|
||||
if ( isset($_GET['post_status']) && 'draft' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Modified');
|
||||
elseif ( 'pending' === $_GET['post_status'] )
|
||||
elseif ( isset($_GET['post_status']) && 'pending' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Submitted');
|
||||
else
|
||||
$posts_columns['date'] = __('Date');
|
||||
@ -353,7 +353,7 @@ function wp_manage_posts_columns() {
|
||||
$posts_columns['author'] = __('Author');
|
||||
$posts_columns['categories'] = __('Categories');
|
||||
$posts_columns['tags'] = __('Tags');
|
||||
if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
|
||||
if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
|
||||
$posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
|
||||
$posts_columns['status'] = __('Status');
|
||||
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
|
||||
@ -1092,6 +1092,7 @@ function the_attachment_links( $id = false ) {
|
||||
|
||||
function wp_dropdown_roles( $default = false ) {
|
||||
global $wp_roles;
|
||||
$p = '';
|
||||
$r = '';
|
||||
foreach( $wp_roles->role_names as $role => $name ) {
|
||||
$name = translate_with_context($name);
|
||||
|
@ -44,7 +44,7 @@ function get_page_templates() {
|
||||
$description = $description[1];
|
||||
|
||||
if ( !empty( $name ) ) {
|
||||
$page_templates[trim( $name )] = basename( $template );
|
||||
$page_templates[trim( $name )] = theme_basename( $template );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,6 +301,7 @@ class WP_User_Search {
|
||||
var $total_users_for_query = 0;
|
||||
var $too_many_total_users = false;
|
||||
var $search_errors;
|
||||
var $paging_text;
|
||||
|
||||
function WP_User_Search ($search_term = '', $page = '', $role = '') { // constructor
|
||||
$this->search_term = $search_term;
|
||||
|
@ -12,7 +12,7 @@ foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'c
|
||||
if( isset($_GET['action']) )
|
||||
$action = $_GET['action'];
|
||||
|
||||
$plugin = $_REQUEST['plugin'];
|
||||
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
|
||||
|
||||
if( !empty($action) ) {
|
||||
switch( $action ) {
|
||||
|
@ -8,7 +8,7 @@ if ( !current_user_can('edit_users') )
|
||||
$title = __('Users');
|
||||
$parent_file = 'users.php';
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
||||
$update = '';
|
||||
|
||||
if ( empty($action) ) {
|
||||
@ -25,6 +25,7 @@ if ( empty($_REQUEST) ) {
|
||||
$referer = '<input type="hidden" name="wp_http_referer" value="' . attribute_escape($redirect) . '" />';
|
||||
} else {
|
||||
$redirect = 'users.php';
|
||||
$referer = '';
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@ -192,15 +193,19 @@ default:
|
||||
|
||||
include('admin-header.php');
|
||||
|
||||
$usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;
|
||||
$userspage = isset($_GET['userspage']) ? $_GET['userspage'] : null;
|
||||
$role = isset($_GET['role']) ? $_GET['role'] : null;
|
||||
|
||||
// Query the users
|
||||
$wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage'], $_GET['role']);
|
||||
$wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
|
||||
|
||||
if ( isset($_GET['update']) ) :
|
||||
switch($_GET['update']) {
|
||||
case 'del':
|
||||
case 'del_many':
|
||||
?>
|
||||
<?php $delete_count = (int) $_GET['delete_count']; ?>
|
||||
<?php $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0; ?>
|
||||
<div id="message" class="updated fade"><p><?php printf(__ngettext('%s user deleted', '%s users deleted', $delete_count), $delete_count); ?></p></div>
|
||||
<?php
|
||||
break;
|
||||
@ -229,7 +234,7 @@ default:
|
||||
}
|
||||
endif; ?>
|
||||
|
||||
<?php if ( is_wp_error( $errors ) ) : ?>
|
||||
<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
|
||||
<div class="error">
|
||||
<ul>
|
||||
<?php
|
||||
@ -265,22 +270,22 @@ foreach ( (array) $users_of_blog as $b_user ) {
|
||||
unset($users_of_blog);
|
||||
|
||||
$current_role = false;
|
||||
$class = empty($_GET['role']) ? ' class="current"' : '';
|
||||
$class = empty($role) ? ' class="current"' : '';
|
||||
$role_links[] = "<li><a href=\"users.php\"$class>" . __('All Users') . "</a>";
|
||||
foreach ( $wp_roles->get_names() as $role => $name ) {
|
||||
foreach ( $wp_roles->get_names() as $this_role => $name ) {
|
||||
if ( !isset($avail_roles[$role]) )
|
||||
continue;
|
||||
|
||||
$class = '';
|
||||
|
||||
if ( $role == $_GET['role'] ) {
|
||||
$current_role = $_GET['role'];
|
||||
if ( $this_role == $role ) {
|
||||
$current_role = $role;
|
||||
$class = ' class="current"';
|
||||
}
|
||||
|
||||
$name = translate_with_context($name);
|
||||
$name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]);
|
||||
$role_links[] = "<li><a href=\"users.php?role=$role\"$class>" . $name . '</a>';
|
||||
$name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$this_role]);
|
||||
$role_links[] = "<li><a href=\"users.php?role=$this_role\"$class>" . $name . '</a>';
|
||||
}
|
||||
echo implode(' |</li>', $role_links) . '</li>';
|
||||
unset($role_links);
|
||||
@ -369,13 +374,11 @@ foreach ( $wp_user_search->get_results() as $userid ) {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( is_wp_error($add_user_errors) ) {
|
||||
foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
|
||||
$var = 'new_' . $var;
|
||||
$$var = attribute_escape(stripslashes($_REQUEST[$formpost]));
|
||||
}
|
||||
unset($name);
|
||||
foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
|
||||
$var = 'new_' . $var;
|
||||
$$var = isset($_REQUEST[$formpost]) ? attribute_escape(stripslashes($_REQUEST[$formpost])) : '';
|
||||
}
|
||||
unset($name);
|
||||
?>
|
||||
|
||||
<br class="clear" />
|
||||
@ -384,7 +387,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
|
||||
<div class="wrap">
|
||||
<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
|
||||
|
||||
<?php if ( is_wp_error( $add_user_errors ) ) : ?>
|
||||
<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
|
||||
<div class="error">
|
||||
<?php
|
||||
foreach ( $add_user_errors->get_error_messages() as $message )
|
||||
|
@ -137,6 +137,9 @@ class WP_User {
|
||||
var $cap_key;
|
||||
var $roles = array();
|
||||
var $allcaps = array();
|
||||
|
||||
var $first_name = '';
|
||||
var $last_name = '';
|
||||
|
||||
function WP_User( $id, $name = '' ) {
|
||||
|
||||
|
@ -110,7 +110,8 @@ class WP {
|
||||
$query = preg_replace("!^.+\?!", '', $query);
|
||||
|
||||
// Substitute the substring matches into the query.
|
||||
eval("\$query = \"" . addslashes($query) . "\";");
|
||||
eval("@\$query = \"" . addslashes($query) . "\";");
|
||||
|
||||
$this->matched_query = $query;
|
||||
|
||||
// Parse the query.
|
||||
|
@ -1935,6 +1935,7 @@ function get_page_by_path($page_path, $output = OBJECT) {
|
||||
$page_paths = '/' . trim($page_path, '/');
|
||||
$leaf_path = sanitize_title(basename($page_paths));
|
||||
$page_paths = explode('/', $page_paths);
|
||||
$full_path = '';
|
||||
foreach( (array) $page_paths as $pathdir)
|
||||
$full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
|
||||
|
||||
|
@ -686,7 +686,7 @@ class WP_Query {
|
||||
if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
|
||||
$this->is_tax = false;
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $t ) {
|
||||
if ( isset($t->query_var) && '' != $qv[$t->query_var] ) {
|
||||
if ( isset($t->query_var) && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
|
||||
$this->is_tax = true;
|
||||
break;
|
||||
}
|
||||
|
@ -297,11 +297,15 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
|
||||
function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
|
||||
global $wpdb;
|
||||
|
||||
if ( empty($term) )
|
||||
return null;
|
||||
if ( empty($term) ) {
|
||||
$error = new WP_Error('invalid_term', __('Empty Term'));
|
||||
return $error;
|
||||
}
|
||||
|
||||
if ( ! is_taxonomy($taxonomy) )
|
||||
return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
|
||||
if ( ! is_taxonomy($taxonomy) ) {
|
||||
$error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
|
||||
return $error;
|
||||
}
|
||||
|
||||
if ( is_object($term) ) {
|
||||
wp_cache_add($term->term_id, $term, $taxonomy);
|
||||
|
Loading…
Reference in New Issue
Block a user