From 0b7373e0cc97a7fe78f5e6c6d01ab192fea649c7 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 19 Jun 2005 02:51:48 +0000 Subject: [PATCH] Add get_post_to_edit() and get_default_post_to_edit(). More post.php cleanup. git-svn-id: http://svn.automattic.com/wordpress/trunk@2651 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 59 +++++++++++++++++++++------------ wp-admin/edit-form-advanced.php | 32 +++++++++--------- wp-admin/edit-form.php | 6 ++-- wp-admin/edit-page-form.php | 22 ++++++------ wp-admin/post.php | 51 +++++----------------------- wp-includes/functions-post.php | 25 ++++++++++++++ 6 files changed, 102 insertions(+), 93 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 8e55f4b29..137937cee 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1,6 +1,6 @@ post_content = format_to_edit($post->post_content); + $post->post_content = apply_filters('content_edit_pre', $post->post_content); + + $post->post_excerpt = format_to_edit($post->post_excerpt); + $post->post_excerpt = apply_filters('excerpt_edit_pre', $post->post_excerpt); + + $post->post_title = format_to_edit($post->post_title); + $post->post_title = apply_filters('title_edit_pre', $post->post_title); + + if ($post->post_status == 'static') + $post->page_template = get_post_meta($id, '_wp_page_template', true); + + return $post; +} + +// Default post information to use when populating the "Write Post" form. +function get_default_post_to_edit() { + global $content, $excerpt, $edited_post_title; + + $post->post_status = 'draft'; + $post->comment_status = get_settings('default_comment_status'); + $post->ping_status = get_settings('default_ping_status'); + $post->post_pingback = get_settings('default_pingback_flag'); + $post->post_category = get_settings('default_category'); + $content = wp_specialchars($content); + $post->post_content = apply_filters('default_content', $content); + $post->post_title = apply_filters('default_title', $edited_post_title); + $post->post_excerpt = apply_filters('default_excerpt', $excerpt); + + return $post; +} + function url_shorten ($url) { $short_url = str_replace('http://', '', stripslashes($url)); $short_url = str_replace('www.', '', $short_url); @@ -672,26 +709,6 @@ function save_mod_rewrite_rules() { insert_with_markers($home_path.'.htaccess', 'WordPress', $rules); } -function generate_page_rewrite_rules() { - global $wpdb; - $posts = $wpdb->get_results("SELECT ID, post_name FROM $wpdb->posts WHERE post_status = 'static' ORDER BY post_parent DESC"); - - $page_rewrite_rules = array(); - - if ($posts) { - foreach ($posts as $post) { - // URI => page name - $uri = get_page_uri($post->ID); - - $page_rewrite_rules[$uri] = $post->post_name; - } - - update_option('page_uris', $page_rewrite_rules); - - save_mod_rewrite_rules(); - } -} - function the_quicktags () { // Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP if ( !strstr($_SERVER['HTTP_USER_AGENT'], 'Safari') ) : diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index a4145cc24..a7970a635 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -22,9 +22,9 @@ if (0 == $post_ID) { $form_pingback = ''; -$form_prevstatus = ''; +$form_prevstatus = ''; -$form_trackback = ''; +$form_trackback = 'to_ping) .'" />'; if ('' != $pinged) { $pings .= '

'. __('Already pinged:') . '