Permalink
Browse files

Replace periods with dashes in Gdn_Format::Url().

  • Loading branch information...
1 parent dced1b0 commit 5710a2bea6f99924dd7e7a2095a5e24134a813d1 @tburry tburry committed Dec 2, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 library/core/class.format.php
@@ -1189,14 +1189,16 @@ public static function Timespan($timespan) {
* @return mixed
*/
public static function Url($Mixed) {
- if (!is_string($Mixed)) {
+ if (!is_string($Mixed))
return self::To($Mixed, 'Url');
- } elseif (preg_replace('`([^\PP])`u', '', 'Test') == '') {
+
+
+ if (preg_replace('`([^\PP])`u', '', 'Test') == '') {
// No Unicode PCRE support.
$Mixed = trim($Mixed);
$Mixed = strip_tags(html_entity_decode($Mixed, ENT_COMPAT, 'UTF-8'));
$Mixed = strtr($Mixed, self::$_UrlTranslations);
- $Mixed = preg_replace('/([^\w\d_:.])/', ' ', $Mixed); // get rid of punctuation and symbols
+ $Mixed = preg_replace('/([^\w\d_:])/', ' ', $Mixed); // get rid of punctuation and symbols
$Mixed = str_replace(' ', '-', trim($Mixed)); // get rid of spaces
$Mixed = preg_replace('/-+/', '-', $Mixed); // limit to 1 hyphen at a time
$Mixed = urlencode(strtolower($Mixed));
@@ -1208,7 +1210,7 @@ public static function Url($Mixed) {
$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\-/+]+`u', '-', $Mixed); // replace certain characters with dashes
+ $Mixed = preg_replace('`[\s\-/+.]+`u', '-', $Mixed); // replace certain characters with dashes
$Mixed = rawurlencode(strtolower($Mixed));
return $Mixed;
}

0 comments on commit 5710a2b

Please sign in to comment.