namespace Friendica;
use Friendica\Capabilities\ICanHandleRequests;
+use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Model\User;
abstract class BaseModule implements ICanHandleRequests
{
/** @var array */
- protected static $parameters = [];
+ protected $parameters = [];
- public function __construct(array $parameters = [])
+ /** @var L10n */
+ protected $l10n;
+
+ public function __construct(L10n $l10n, array $parameters = [])
{
- static::$parameters = $parameters;
+ $this->parameters = $parameters;
+ $this->l10n = $l10n;
}
/**
- * {@inheritDoc}
+ * Wraps the L10n::t() function for Modules
+ *
+ * @see L10n::t()
*/
- public static function init()
+ protected function t(string $s, ...$args): string
{
+ return $this->l10n->t($s, $args);
}
/**
- * {@inheritDoc}
+ * Wraps the L10n::tt() function for Modules
+ *
+ * @see L10n::tt()
*/
- public static function rawContent()
+ protected function tt(string $singular, string $plurarl, int $count): string
{
- // echo '';
- // exit;
+ return $this->l10n->tt($singular, $plurarl, $count);
}
/**
* {@inheritDoc}
*/
- public static function content()
+ public function rawContent()
{
- return '';
+ // echo '';
+ // exit;
}
/**
* {@inheritDoc}
*/
- public static function delete()
+ public function content(): string
{
+ return '';
}
/**
* {@inheritDoc}
*/
- public static function patch()
+ public function delete()
{
}
/**
* {@inheritDoc}
*/
- public static function post()
+ public function patch()
{
- // DI::baseurl()->redirect('module');
}
/**
* {@inheritDoc}
*/
- public static function afterpost()
+ public function post()
{
+ // DI::baseurl()->redirect('module');
}
/**
* {@inheritDoc}
*/
- public static function put()
+ public function put()
{
}
/** Gets the name of the current class */
- public static function getClassName(): string
+ public function getClassName(): string
{
return static::class;
}