]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/UserFlag/UserFlagPlugin.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / UserFlag / UserFlagPlugin.php
index 42a8948dffdf4a9ee55634784143ebf6dbac1406..986dd901a0f0a86ef828d001f7b16553fd3edac1 100644 (file)
@@ -60,28 +60,18 @@ class UserFlagPlugin extends Plugin
         $schema = Schema::get();
 
         // For storing user-submitted flags on profiles
-
-        $schema->ensureTable('user_flag_profile',
-                             array(new ColumnDef('profile_id', 'integer', null,
-                                                 false, 'PRI'),
-                                   new ColumnDef('user_id', 'integer', null,
-                                                 false, 'PRI'),
-                                   new ColumnDef('created', 'datetime', null,
-                                                 false, 'MUL'),
-                                   new ColumnDef('cleared', 'datetime', null,
-                                                 true, 'MUL')));
-
+        $schema->ensureTable('user_flag_profile', User_flag_profile::schemaDef());
         return true;
     }
 
     /**
      * Add our actions to the URL router
      *
-     * @param Net_URL_Mapper $m URL mapper for this hit
+     * @param URLMapper $m URL mapper for this hit
      *
      * @return boolean hook return
      */
-    function onRouterInitialized($m)
+    public function onRouterInitialized(URLMapper $m)
     {
         $m->connect('main/flag/profile', array('action' => 'flagprofile'));
         $m->connect('main/flag/clear', array('action' => 'clearflag'));
@@ -89,35 +79,6 @@ class UserFlagPlugin extends Plugin
         return true;
     }
 
-    /**
-     * Auto-load our classes if called
-     *
-     * @param string $cls Class to load
-     *
-     * @return boolean hook return
-     */
-    function onAutoload($cls)
-    {
-        switch (strtolower($cls))
-        {
-        case 'flagprofileaction':
-        case 'adminprofileflagaction':
-        case 'clearflagaction':
-            include_once INSTALLDIR.'/plugins/UserFlag/' .
-              strtolower(mb_substr($cls, 0, -6)) . '.php';
-            return false;
-        case 'flagprofileform':
-        case 'clearflagform':
-            include_once INSTALLDIR.'/plugins/UserFlag/' . strtolower($cls . '.php');
-            return false;
-        case 'user_flag_profile':
-            include_once INSTALLDIR.'/plugins/UserFlag/'.ucfirst(strtolower($cls)).'.php';
-            return false;
-        default:
-            return true;
-        }
-    }
-
     /**
      * Add a 'flag' button to profile page
      *
@@ -191,6 +152,8 @@ class UserFlagPlugin extends Plugin
      * @param boolean &$result out, result of the check
      *
      * @return boolean hook result
+     * @TODO Other implementing classes expect Profile here!!!
+     * @WARNING
      */
     function onUserRightsCheck($user, $right, &$result)
     {
@@ -214,7 +177,7 @@ class UserFlagPlugin extends Plugin
      *
      * @return boolean hook result
      */
-    function onEndBlockProfile($user, $profile)
+    function onEndBlockProfile(User $user, Profile $profile)
     {
         if ($this->flagOnBlock && !User_flag_profile::exists($profile->id,
                                                              $user->id)) {
@@ -235,9 +198,9 @@ class UserFlagPlugin extends Plugin
      *
      * @return boolean hook result
      */
-    function onProfileDeleteRelated($profile, &$related)
+    public function onProfileDeleteRelated(Profile $profile, array &$related)
     {
-        $related[] = 'user_flag_profile';
+        $related[] = 'User_flag_profile';
         return true;
     }
 
@@ -266,12 +229,12 @@ class UserFlagPlugin extends Plugin
      *
      * @return boolean hook value
      */
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $url = 'http://status.net/wiki/Plugin:UserFlag';
 
         $versions[] = array('name' => 'UserFlag',
-            'version' => STATUSNET_VERSION,
+            'version' => GNUSOCIAL_VERSION,
             'author' => 'Evan Prodromou',
             'homepage' => $url,
             'rawdescription' =>