namespace Friendica;
+use Friendica\Core\L10n;
+
/**
* 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.
*/
private $moduleName = '';
- public function __construct(string $file_path = '', array $parameters = [])
+ public function __construct(L10n $l10n, string $file_path = '', array $parameters = [])
{
- parent::__construct($parameters);
+ parent::__construct($l10n, $parameters);
$this->setModuleFile($file_path);
+
+ $this->runModuleFunction('init');
}
/**
require_once $file_path;
}
- public function init()
- {
- $this->runModuleFunction('init');
- }
-
public function content(): string
{
return $this->runModuleFunction('content');
$this->runModuleFunction('post');
}
- public function afterpost()
- {
- $this->runModuleFunction('afterpost');
- }
-
/**
* Runs the module function designated by the provided suffix if it exists, the BaseModule method otherwise
*
if (\function_exists($function_name)) {
$a = DI::app();
return $function_name($a);
- } else {
- return parent::{$function_suffix}($this->parameters);
}
+
+ return '';
}
}