'IP Address', self::TYPE_EMAIL => 'Email Address', self::TYPE_USERNAME => 'Username', ); /** * * blocked actions * * @var array */ public static $blockedActions = array( self::ACTION_REGISTER => 'Registering / Logging In', self::ACTION_PURCHASE => 'Purchasing', self::ACTION_MESSAGING => 'Messaging', ); /** * * get blocked actions as an array * or for display purposes * * @param bool|string $separator * * @return array */ public function getBlockedActions($separator = false) { $blockedActions = array_filter(\Ppb\Utility::unserialize($this->getData('blocked_actions'), array())); if ($separator !== false) { $output = array(); $translate = $this->getTranslate(); foreach ($blockedActions as $blockedAction) { $output[] = $translate->_(self::$blockedActions[$blockedAction]); } return implode($separator, $output); } return $blockedActions; } /** * * return the block message that the blocked user sees * * @return string */ public function blockMessage() { $translate = $this->getTranslate(); $blocker = $this->findParentRow('\Ppb\Db\Table\Users'); $type = $this->getData('type'); $value = $this->getData('value'); $blockReason = $this->getData('block_reason'); $showReason = $this->getData('show_reason'); $message = sprintf( $translate->_('Your %s (%s) has been blocked from %s by %s.'), self::$blockTypes[$type], $value, $this->getBlockedActions(', '), ($blocker) ? $blocker['username'] : $translate->_('the administrator')); if ($showReason && !empty($blockReason)) { $message .= '
' . sprintf($translate->_('Block Reason: %s'), $blockReason); } return $message; } }