Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Discussion title part in url keeps leading and trailing spaces as hyphen

yu_tangyu_tang New
edited May 2011 in Vanilla 2.0 - 2.8
Like this. (see address bar of your browser)
-discussion-title-part-in-url-keeps-leading-and-trailing-spaces-as-hyphen-
They are trimming in title div section.
<div class="SubTab">Discussion title part in url keeps leading and trailing spaces as hyphen</div>
And only leading spaces are trimming in title tag (trailing spaces are kept).
<title>Discussion title part in url keeps leading and trailing spaces as hyphen  - Vanilla Forums</title>
Other examples.

http://vanillaforums.org/discussion/16068/error-during-install-process-cant-create-table-
http://vanillaforums.org/discussion/16050/qna-is-missing-the-following-requirements-vanilla-2.0.18a1.-
http://vanillaforums.org/discussion/15984/php-fatal-error-class-mediamodel-not-found-
http://vanillaforums.org/discussion/15492/manual-integration-on-2.0.17.-
http://vanillaforums.org/discussion/15905/-recaptcha

It's not a big issue but feel bit strange when you copy & paste url.
So I think Url function is better like this.
// Better Unicode support
$Mixed = strip_tags(html_entity_decode($Mixed, ENT_COMPAT, 'UTF-8'));
$Mixed = strtr($Mixed, self::$_UrlTranslations);
$Mixed = preg_replace('`([^\PP.\-_])`u', '', $Mixed); // get rid of punctuation
$Mixed = preg_replace('`([^\PS+])`u', '', $Mixed); // get rid of symbols
$Mixed = preg_replace('`^\s+|\s+$`u', '', $Mixed); // remove leading and trailing spaces
$Mixed = preg_replace('`[\s\-/+]+`u', '-', $Mixed); // replace certain characters with dashes
$Mixed = rawurlencode(strtolower($Mixed));
return $Mixed;
Tagged:
Sign In or Register to comment.