* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class SubscriptionThrottlePlugin extends Plugin
{
public $subLimits = array(86400 => 100,
*
* @return boolean hook value
*/
-
function onStartSubscribe($user, $other)
{
foreach ($this->subLimits as $seconds => $limit) {
$subtime = strtotime($sub->created);
$now = time();
if ($now - $subtime < $seconds) {
- throw new Exception(_m("Too many subscriptions. Take a break and try again later."));
+ // TRANS: Exception thrown when subscribing too quickly.
+ throw new Exception(_m('Too many subscriptions. Take a break and try again later.'));
}
}
}
*
* @return boolean hook value
*/
-
function onStartJoinGroup($group, $user)
{
foreach ($this->groupLimits as $seconds => $limit) {
$jointime = strtotime($mem->created);
$now = time();
if ($now - $jointime < $seconds) {
- throw new Exception(_m("Too many memberships. Take a break and try again later."));
+ // TRANS: Exception thrown when joing groups too quickly.
+ throw new Exception(_m('Too many memberships. Take a break and try again later.'));
}
}
}
*
* @return Subscription a subscription or null
*/
-
private function _getNthSub($user, $n)
{
$sub = new Subscription();
*
* @return Group_member a membership or null
*/
-
private function _getNthMem($user, $n)
{
$mem = new Group_member();
*
* @return boolean hook value
*/
-
function onPluginVersion(&$versions)
{
$versions[] = array('name' => 'SubscriptionThrottle',
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:SubscriptionThrottle',
'rawdescription' =>
+ // TRANS: Plugin description.
_m('Configurable limits for subscriptions and group memberships.'));
return true;
}
}
-