Allow underscores in category and author names.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f6e35d2384
commit
c454490973
|
@ -275,7 +275,7 @@ if ('' != $category_name) {
|
|||
$category_name = $category_name[count($category_name)-2]; // there was a trailling slash
|
||||
}
|
||||
}
|
||||
$category_name = preg_replace('|[^a-z0-9-]|i', '', $category_name);
|
||||
$category_name = preg_replace('|[^a-z0-9-_]|i', '', $category_name);
|
||||
$tables = ", $tablepost2cat, $tablecategories";
|
||||
$join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) ";
|
||||
$whichcat = " AND (category_nicename = '$category_name'";
|
||||
|
@ -323,7 +323,7 @@ if ('' != $author_name) {
|
|||
$author_name = $author_name[count($author_name)-2];#there was a trailling slash
|
||||
}
|
||||
}
|
||||
$author_name = preg_replace('|[^a-z0-9-]|', '', strtolower($author_name));
|
||||
$author_name = preg_replace('|[^a-z0-9-_]|', '', strtolower($author_name));
|
||||
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_nicename='".$author_name."'");
|
||||
$whichauthor .= ' AND (post_author = '.intval($author).')';
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
add_action('sanitize_title', 'convert_spaces_to_dashes');
|
||||
|
||||
function wptexturize($text) {
|
||||
$output = '';
|
||||
// Capture tags and everything inside them
|
||||
|
@ -81,12 +83,16 @@ function sanitize_title($title) {
|
|||
$title = preg_replace('/&.+?;/', '', $title); // kill entities
|
||||
$title = preg_replace('/[^a-z0-9 -]/', '', $title);
|
||||
$title = preg_replace('/\s+/', ' ', $title);
|
||||
$title = do_action('sanitize_title', $title);
|
||||
$title = trim($title);
|
||||
$title = str_replace(' ', '-', $title);
|
||||
$title = preg_replace('|-+|', '-', $title);
|
||||
return $title;
|
||||
}
|
||||
|
||||
function convert_spaces_to_dashes($content) {
|
||||
$content = str_replace(' ', '-', $content);
|
||||
$content = preg_replace('|-+|', '-', $content);
|
||||
}
|
||||
|
||||
function convert_chars($content, $flag = 'obsolete') {
|
||||
global $wp_htmltranswinuni;
|
||||
|
||||
|
|
Loading…
Reference in New Issue