]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
use common_local_url() in tagging, add canonicalization function
[quix0rs-gnu-social.git] / lib / util.php
index 0b71cfe4f596e321e9dceaa2fe524f952ccff320..51dcbe9394d86e28d8e3f01d2db656c4c52936eb 100644 (file)
@@ -699,11 +699,13 @@ function common_render_content($text, $notice) {
 }
 
 function common_tag_link($tag) {
-       if(common_config('site', 'fancy')) {
-               return '<a href="' . htmlspecialchars(common_path('tag/' . strtolower(str_replace(array('-', '_', '.'), '', $tag)))) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
-       } else {
-               return '<a href="' . htmlspecialchars(common_path('index.php?action=tag&tag=' . strtolower(str_replace(array('-', '_', '.'), '', $tag)))) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
-       }
+       $canonical = common_canonical_tag($tag);
+       $url = common_local_url('tag', array('tag' => $canonical));
+       return '<a href="' . htmlspecialchars($url) . '" rel="tag" class="hashlink">' . htmlspecialchars($tag) . '</a>';
+}
+
+function common_canonical_tag($tag) {  
+       return strtolower(str_replace(array('-', '_', '.'), '', $tag));
 }
 
 function common_at_link($sender_id, $nickname) {