]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/UserFlag/UserFlagPlugin.php
plugins onAutoload now only overloads if necessary (extlibs etc.)
[quix0rs-gnu-social.git] / plugins / UserFlag / UserFlagPlugin.php
index fc7698841ecf70e35568bbb4774ba615dfb7baa4..22955a2ebc0ee19ee1929f99fb0fed5093e003de 100644 (file)
@@ -60,17 +60,7 @@ 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;
     }
 
@@ -85,48 +75,19 @@ class UserFlagPlugin extends Plugin
     {
         $m->connect('main/flag/profile', array('action' => 'flagprofile'));
         $m->connect('main/flag/clear', array('action' => 'clearflag'));
-        $m->connect('admin/profile/flag', array('action' => 'adminprofileflag'));
+        $m->connect('panel/profile/flag', array('action' => 'adminprofileflag'));
         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
      *
-     * @param Action  &$action The action being called
+     * @param Action  $action The action being called
      * @param Profile $profile Profile being shown
      *
      * @return boolean hook result
      */
-    function onEndProfilePageActionsElements(&$action, $profile)
+    function onEndProfilePageActionsElements($action, $profile)
     {
         $this->showFlagButton($action, $profile,
                               array('action' => 'showstream',
@@ -180,21 +141,6 @@ class UserFlagPlugin extends Plugin
         }
     }
 
-    /**
-     * Initialize any flagging buttons on the page
-     *
-     * @param Action $action action being shown
-     *
-     * @return boolean hook result
-     */
-    function onEndShowScripts($action)
-    {
-        $action->inlineScript('if ($(".form_entity_flag").length > 0) { '.
-                              '$(".form_entity_flag").bind("click", function() {'.
-                              'SN.U.FormXHR($(this)); return false; }); }');
-        return true;
-    }
-
     /**
      * Check whether a user has one of our defined rights
      *