]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
DirectoryPlugin - Hijack router mapping for normal groups page to substitute a direct...
[quix0rs-gnu-social.git] / lib / util.php
index 819dcc5058a5bffb9b1e886bc65af0d0a5b2c123..13966b2dd6533cd05440aa452cc80155684a866c 100644 (file)
@@ -638,7 +638,7 @@ function common_linkify_mention($mention)
 
         $xs->elementStart('span', 'vcard');
         $xs->elementStart('a', $attrs);
-        $xs->element('span', 'fn nickname profile', $mention['text']);
+        $xs->element('span', 'fn nickname mention', $mention['text']);
         $xs->elementEnd('a');
         $xs->elementEnd('span');
 
@@ -754,17 +754,19 @@ function common_find_mentions($text, $notice)
         foreach ($hmatches[1] as $hmatch) {
 
             $tag = common_canonical_tag($hmatch[0]);
-
-            $tagged = Profile_tag::getTagged($sender->id, $tag);
-
-            $url = common_local_url('subscriptions',
-                                    array('nickname' => $sender->nickname,
-                                          'tag' => $tag));
-
-            $mentions[] = array('mentioned' => $tagged,
-                                'text' => $hmatch[0],
-                                'position' => $hmatch[1],
-                                'url' => $url);
+            $plist = Profile_list::getByTaggerAndTag($sender->id, $tag);
+            if (!empty($plist) && !$plist->private) {
+                $tagged = $sender->getTaggedSubscribers($tag);
+
+                $url = common_local_url('showprofiletag',
+                                        array('tagger' => $sender->nickname,
+                                              'tag' => $tag));
+
+                $mentions[] = array('mentioned' => $tagged,
+                                    'text' => $hmatch[0],
+                                    'position' => $hmatch[1],
+                                    'url' => $url);
+            }
         }
 
         Event::handle('EndFindMentions', array($sender, $text, &$mentions));
@@ -1219,19 +1221,22 @@ function common_relative_profile($sender, $nickname, $dt=null)
 
 function common_local_url($action, $args=null, $params=null, $fragment=null, $addSession=true)
 {
-    $r = Router::get();
-    $path = $r->build($action, $args, $params, $fragment);
+    if (Event::handle('StartLocalURL', array(&$action, &$params, &$fragment, &$addSession, &$url))) {
+        $r = Router::get();
+        $path = $r->build($action, $args, $params, $fragment);
 
-    $ssl = common_is_sensitive($action);
+        $ssl = common_is_sensitive($action);
 
-    if (common_config('site','fancy')) {
-        $url = common_path(mb_substr($path, 1), $ssl, $addSession);
-    } else {
-        if (mb_strpos($path, '/index.php') === 0) {
+        if (common_config('site','fancy')) {
             $url = common_path(mb_substr($path, 1), $ssl, $addSession);
         } else {
-            $url = common_path('index.php'.$path, $ssl, $addSession);
+            if (mb_strpos($path, '/index.php') === 0) {
+                $url = common_path(mb_substr($path, 1), $ssl, $addSession);
+            } else {
+                $url = common_path('index.php'.$path, $ssl, $addSession);
+            }
         }
+        Event::handle('EndLocalURL', array(&$action, &$params, &$fragment, &$addSession, &$url));
     }
     return $url;
 }