Notice fixes from nbachiyski. fixes #5961

git-svn-id: http://svn.automattic.com/wordpress/trunk@6983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-02-22 17:43:56 +00:00
parent 54f091eebf
commit dce0978cee
14 changed files with 70 additions and 37 deletions

View File

@@ -170,7 +170,15 @@ function wp_dashboard_sidebars_widgets() { // hackery
function wp_dashboard_dynamic_sidebar_params( $params ) {
global $wp_registered_widgets, $wp_registered_widget_controls;
$sidebar_defaults = array('widget_id' => 0, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
extract( $sidebar_defaults, EXTR_PREFIX_ALL, 'sidebar' );
extract( $params[0], EXTR_PREFIX_ALL, 'sidebar' );
if ( !isset($wp_registered_widgets[$sidebar_widget_id]) || !is_array($wp_registered_widgets[$sidebar_widget_id]) ) {
return $params;
}
$widget_defaults = array('id' => '', 'width' => '', 'height' => '', 'class' => '', 'feed_link' => '', 'all_link' => '', 'notice' => false, 'error' => false);
extract( $widget_defaults, EXTR_PREFIX_ALL, 'widget' );
extract( $wp_registered_widgets[$sidebar_widget_id], EXTR_PREFIX_ALL, 'widget' );
$the_classes = array();

View File

@@ -28,7 +28,7 @@ function edit_post() {
$_POST['ID'] = (int) $_POST['post_ID'];
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
$_POST['to_ping'] = $_POST['trackback_url'];
if (!empty ( $_POST['post_author_override'] ) ) {
@@ -52,13 +52,13 @@ function edit_post() {
}
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'] )
if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
if ('' != $_POST['saveasprivate'] )
if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
if ( ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'] )
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
@@ -91,12 +91,12 @@ function edit_post() {
}
// Meta Stuff
if ( $_POST['meta'] ) {
if ( isset($_POST['meta']) && $_POST['meta'] ) {
foreach ( $_POST['meta'] as $key => $value )
update_meta( $key, $value['key'], $value['value'] );
}
if ( $_POST['deletemeta'] ) {
if ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
foreach ( $_POST['deletemeta'] as $key => $value )
delete_meta( $key );
}
@@ -128,6 +128,7 @@ function get_default_post_to_edit() {
$post_title = '';
}
$post_content = '';
if ( !empty( $_REQUEST['content'] ) )
$post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
else if ( !empty( $post_title ) ) {
@@ -142,8 +143,14 @@ function get_default_post_to_edit() {
else
$post_excerpt = '';
$post->ID = 0;
$post->post_name = '';
$post->post_author = '';
$post->post_date = '';
$post->post_status = 'draft';
$post->post_type = 'post';
$post->to_ping = '';
$post->pinged = '';
$post->comment_status = get_option( 'default_comment_status' );
$post->ping_status = get_option( 'default_ping_status' );
$post->post_pingback = get_option( 'default_pingback_flag' );
@@ -224,7 +231,7 @@ function wp_write_post() {
// Rename.
$_POST['post_content'] = $_POST['content'];
$_POST['post_excerpt'] = $_POST['excerpt'];
$_POST['post_parent'] = $_POST['parent_id'];
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
$_POST['to_ping'] = $_POST['trackback_url'];
if (!empty ( $_POST['post_author_override'] ) ) {
@@ -250,13 +257,13 @@ function wp_write_post() {
}
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft'] )
if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
$_POST['post_status'] = 'draft';
if ('' != $_POST['saveasprivate'] )
if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
$_POST['post_status'] = 'private';
if ( ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
$_POST['post_status'] = 'publish';
if ('' != $_POST['advanced'] )
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
$_POST['post_status'] = 'draft';
if ( 'page' == $_POST['post_type'] ) {
@@ -571,6 +578,9 @@ function postbox_classes( $id, $page ) {
function get_sample_permalink($id, $name = null) {
$post = &get_post($id);
if (!$post->ID) {
return array('', '');
}
$original_status = $post->post_status;
$original_date = $post->post_date;
$original_name = $post->post_name;

View File

@@ -51,6 +51,7 @@ function wp_delete_category($cat_ID) {
}
function wp_insert_category($catarr, $wp_error = false) {
$cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
extract($catarr, EXTR_SKIP);
if ( trim( $cat_name ) == '' )