mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
If the sanitized title is empty, fallback to the post ID for the nicename. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000116
git-svn-id: http://svn.automattic.com/wordpress/trunk@1481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2577287a67
commit
8633ffdba4
@ -45,6 +45,8 @@ case 'post':
|
||||
$standalone = 1;
|
||||
require_once('admin-header.php');
|
||||
|
||||
$post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1") + 1;
|
||||
|
||||
$post_pingback = intval($_POST['post_pingback']);
|
||||
$content = balanceTags($_POST['content']);
|
||||
$content = format_to_post($content);
|
||||
@ -71,9 +73,9 @@ case 'post':
|
||||
$post_password = $_POST['post_password'];
|
||||
|
||||
if (empty($post_name))
|
||||
$post_name = sanitize_title($post_title);
|
||||
$post_name = sanitize_title($post_title, $post_ID);
|
||||
else
|
||||
$post_name = sanitize_title($post_name);
|
||||
$post_name = sanitize_title($post_name, $post_ID);
|
||||
|
||||
$trackback = $_POST['trackback_url'];
|
||||
// Format trackbacks
|
||||
@ -123,8 +125,6 @@ case 'post':
|
||||
|
||||
$result = $wpdb->query($postquery);
|
||||
|
||||
$post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
|
||||
|
||||
if (!empty($_POST['mode'])) {
|
||||
switch($_POST['mode']) {
|
||||
case 'bookmarklet':
|
||||
@ -302,7 +302,7 @@ case 'editpost':
|
||||
if (empty($ping_status)) $ping_status = 'closed';
|
||||
//if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
|
||||
$post_password = $_POST['post_password'];
|
||||
$post_name = sanitize_title($_POST['post_name']);
|
||||
$post_name = sanitize_title($_POST['post_name'], $post_ID);
|
||||
if (empty($post_name)) $post_name = sanitize_title($post_title);
|
||||
$trackback = $_POST['trackback_url'];
|
||||
// Format trackbacks
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
add_action('sanitize_title', 'sanitize_title_with_dashes');
|
||||
add_filter('sanitize_title', 'sanitize_title_with_dashes');
|
||||
|
||||
function wptexturize($text) {
|
||||
$output = '';
|
||||
@ -119,8 +119,12 @@ function remove_accents($string) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function sanitize_title($title) {
|
||||
$title = do_action('sanitize_title', $title);
|
||||
function sanitize_title($title, $fallback_title = '') {
|
||||
$title = apply_filters('sanitize_title', $title);
|
||||
|
||||
if (empty($title)) {
|
||||
$title = $fallback_title;
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user