]> git.mxchange.org Git - friendica.git/blobdiff - src/LegacyModule.php
More functions moved
[friendica.git] / src / LegacyModule.php
index 5f0cc3103cc4f0a7f02ec5ed04ba40b237a52801..d307d84ac82995cd296f929e8707d496abcd2dbf 100644 (file)
@@ -21,6 +21,8 @@
 
 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.
@@ -37,11 +39,13 @@ class LegacyModule extends BaseModule
         */
        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');
        }
 
        /**
@@ -61,11 +65,6 @@ class LegacyModule extends BaseModule
                require_once $file_path;
        }
 
-       public function init()
-       {
-               $this->runModuleFunction('init');
-       }
-
        public function content(): string
        {
                return $this->runModuleFunction('content');
@@ -76,11 +75,6 @@ class LegacyModule extends BaseModule
                $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
         *
@@ -95,8 +89,8 @@ class LegacyModule extends BaseModule
                if (\function_exists($function_name)) {
                        $a = DI::app();
                        return $function_name($a);
-               } else {
-                       return parent::{$function_suffix}($this->parameters);
                }
+
+               return '';
        }
 }