]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AnonymousFave/AnonymousFavePlugin.php
If the attachment is a photo, don't replace representation in oEmbed
[quix0rs-gnu-social.git] / plugins / AnonymousFave / AnonymousFavePlugin.php
index e0b2a17d1fef126cf88735c314405f5c9b313b25..ca4bdc832f2d4220a51ceefbe38ce227f43bcbcc 100644 (file)
@@ -100,31 +100,6 @@ class AnonymousFavePlugin extends Plugin
         $action->inlineScript('SN.U.NoticeFavor();');
     }
 
-    function onAutoload($cls)
-    {
-        $dir = dirname(__FILE__);
-
-        switch ($cls) {
-            case 'Fave_tally':
-                include_once $dir . '/' . $cls . '.php';
-                return false;
-            case 'AnonFavorAction':
-                include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
-                return false;
-            case 'AnonDisFavorAction':
-                include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
-                return false;
-            case 'AnonFavorForm':
-                include_once $dir . '/anonfavorform.php';
-                return false;
-            case 'AnonDisFavorForm':
-                include_once $dir . '/anondisfavorform.php';
-                return false;
-            default:
-                return true;
-        }
-    }
-
     function onStartInitializeRouter($m)
     {
         $m->connect('main/anonfavor', array('action' => 'AnonFavor'));
@@ -149,8 +124,8 @@ class AnonymousFavePlugin extends Plugin
         if (!common_logged_in() && $this->hasAnonFaving($item)) {
 
             $profile = AnonymousFavePlugin::getAnonProfile();
-            if (!empty($profile)) {
-                if ($profile->hasFave($item->notice)) {
+            if ($profile instanceof Profile) {
+                if (Fave::existsForProfile($item->notice, $profile)) {
                     $disfavor = new AnonDisFavorForm($item->out, $item->notice);
                     $disfavor->show();
                 } else {
@@ -212,7 +187,7 @@ class AnonymousFavePlugin extends Plugin
         list($proxy, $ip) = common_client_ip();
 
         // IP + time + random number should help to avoid collisions
-        $baseNickname = $ip . '-' . time() . '-' . common_good_rand(5);
+        $baseNickname = $ip . '-' . time() . '-' . common_random_hexstr(5);
 
         $profile = new Profile();
         $profile->nickname = $baseNickname;
@@ -296,9 +271,9 @@ class AnonymousFavePlugin extends Plugin
      *
      * @return boolean hook value
      */
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
-        $url = 'http://status.net/wiki/Plugin:AnonymousFave';
+        $url = 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/AnonymousFave';
 
         $versions[] = array('name' => 'AnonymousFave',
             'version' => ANONYMOUS_FAVE_PLUGIN_VERSION,