]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/UserLimit/UserLimitPlugin.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / UserLimit / UserLimitPlugin.php
index ad2c6e363e2de44b149264926e48a87aca1b5df6..ed4ff9df497267bda79f09ac6c5290a1e0467a47 100644 (file)
@@ -45,18 +45,27 @@ if (!defined('STATUSNET')) {
  *
  * @seeAlso  Location
  */
-
 class UserLimitPlugin extends Plugin
 {
     public $maxUsers = null;
 
-    function onStartUserRegister(&$user, &$profile)
+    public function onStartUserRegister(Profile $profile)
     {
         $this->_checkMaxUsers();
         return true;
     }
 
-    function onStartRegistrationTry($action)
+    /**
+     * Called when someone tries to register.
+     *
+     * We check the IP here to determine if it goes over any of our
+     * configured limits.
+     *
+     * @param Action $action Action that is being executed
+     *
+     * @return boolean hook value
+     */
+    function onStartRegistrationTry(Action $action)
     {
         $this->_checkMaxUsers();
         return true;
@@ -65,14 +74,16 @@ class UserLimitPlugin extends Plugin
     function _checkMaxUsers()
     {
         if (!is_null($this->maxUsers)) {
-
             $cls = new User();
 
             $cnt = $cls->count();
 
             if ($cnt >= $this->maxUsers) {
-                // @todo FIXME: i18n issue. Needs plural.
-                $msg = sprintf(_m('Cannot register; maximum number of users (%d) reached.'),
+                // TRANS: Error message given if creating a new user is not possible because a limit has been reached.
+                // TRANS: %d is the user limit (also available for plural).
+                $msg = sprintf(_m('Cannot register because the maximum number of users (%d) for this site was reached.',
+                                  'Cannot register because the maximum number of users (%d) for this site was reached.',
+                                  $this->maxUsers),
                                $this->maxUsers);
 
                 throw new ClientException($msg);
@@ -80,13 +91,14 @@ class UserLimitPlugin extends Plugin
         }
     }
 
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'UserLimit',
-                            'version' => STATUSNET_VERSION,
+                            'version' => GNUSOCIAL_VERSION,
                             'author' => 'Evan Prodromou',
                             'homepage' => 'http://status.net/wiki/Plugin:UserLimit',
                             'description' =>
+                            // TRANS: Plugin description.
                             _m('Limit the number of users who can register.'));
         return true;
     }