diff options
author | Garret Buell <terragb@gmail.com> | 2008-08-31 22:59:32 -0400 |
---|---|---|
committer | Garret Buell <terragb@gmail.com> | 2008-08-31 22:59:32 -0400 |
commit | 51caab6e5e9f27765cb94e5b5cf0cf51f97850cc (patch) | |
tree | d916fa0c5900bea3f36b0067a824c3b32d30aa79 /classes/Notice.php | |
parent | cca78b26f71aaa5792e147b8a96c5e26a369bd82 (diff) |
Elide_Tags
Make "#sanfrancisco", "#SanFrancisco", "#san_francisco", "#San.Francisco", and "#SAN-FRANCISCO" all link to http://identi.ca/tag/sanfrancisco but preserve appearance
darcs-hash:20080901025932-e3c0d-c0a939eaf7e242d88cbcb0d651c9d53718c60a9d.gz
Diffstat (limited to 'classes/Notice.php')
-rw-r--r-- | classes/Notice.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 5e1f83a52..06750b436 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -54,10 +54,13 @@ class Notice extends DB_DataObject function saveTags() { /* extract all #hastags */ - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9]{1,64})/', strtolower($this->content), $match); + $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match); if (!$count) { return true; } + + /* elide characters we don't want in the tag */ + $match[1] = str_replace(array('-', '_', '.'), '', $match[1]); /* Add them to the database */ foreach(array_unique($match[1]) as $hashtag) { |