X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FLegacyModule.php;h=17853015e611500c1b5b2cbe7204b172fc03c90d;hb=39c2282c1292af173f854e2a4338c601f9ba58f6;hp=5f0cc3103cc4f0a7f02ec5ed04ba40b237a52801;hpb=587953582273326dfa1ff744827897e1bf1208c9;p=friendica.git diff --git a/src/LegacyModule.php b/src/LegacyModule.php index 5f0cc3103c..17853015e6 100644 --- a/src/LegacyModule.php +++ b/src/LegacyModule.php @@ -21,6 +21,11 @@ namespace Friendica; +use Friendica\Core\L10n; +use Friendica\Module\Response; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; + /** * This mock module enable class encapsulation of legacy global function modules. * After having provided the module file name, all the methods will behave like a normal Module class. @@ -37,11 +42,13 @@ class LegacyModule extends BaseModule */ private $moduleName = ''; - public function __construct(string $file_path = '', array $parameters = []) + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, string $file_path = '', array $parameters = []) { - parent::__construct($parameters); + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); $this->setModuleFile($file_path); + + $this->runModuleFunction('init'); } /** @@ -61,24 +68,16 @@ class LegacyModule extends BaseModule require_once $file_path; } - public function init() - { - $this->runModuleFunction('init'); - } - - public function content(): string + protected function content(array $request = []): string { return $this->runModuleFunction('content'); } - public function post() + protected function post(array $request = []) { - $this->runModuleFunction('post'); - } + parent::post($request); - public function afterpost() - { - $this->runModuleFunction('afterpost'); + $this->runModuleFunction('post'); } /** @@ -94,9 +93,9 @@ class LegacyModule extends BaseModule if (\function_exists($function_name)) { $a = DI::app(); - return $function_name($a); - } else { - return parent::{$function_suffix}($this->parameters); + return $function_name($a) ?? ''; } + + return ''; } }