]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
silently skip email for subs from sandboxed user
[quix0rs-gnu-social.git] / lib / util.php
index 7aca4af8d622910ca9bd90d97c39e630de5fb725..68f3520db5c366086ce2c3e0af4c9a2501d47b63 100644 (file)
@@ -1423,25 +1423,18 @@ function common_shorten_url($long_url)
     if (empty($user)) {
         // common current user does not find a user when called from the XMPP daemon
         // therefore we'll set one here fix, so that XMPP given URLs may be shortened
-        $svc = 'ur1.ca';
+        $shortenerName = 'ur1.ca';
     } else {
-        $svc = $user->urlshorteningservice;
+        $shortenerName = $user->urlshorteningservice;
     }
-    global $_shorteners;
-    if (!isset($_shorteners[$svc])) {
-        //the user selected service doesn't exist, so default to ur1.ca
-        $svc = 'ur1.ca';
-    }
-    if (!isset($_shorteners[$svc])) {
-       // no shortener plugins installed.
-       return $long_url;
-    }
-
-    $reflectionObj = new ReflectionClass($_shorteners[$svc]['callInfo'][0]);
-    $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]);
-    $short_url = $short_url_service->shorten($long_url);
 
-    return $short_url;
+    if(Event::handle('StartShortenUrl', array($long_url,$shortenerName,&$shortenedUrl))){
+        //URL wasn't shortened, so return the long url
+        return $long_url;
+    }else{
+        //URL was shortened, so return the result
+        return $shortenedUrl;
+    }
 }
 
 function common_client_ip()