Factory for modules' moduleOperationInfo objects.

@param string $moduleName
@param bool $useTriggers*

@return eZModuleOperationInfo
979835
static function moduleOperationInfo( $moduleName, $useTriggers = true )
    {
        if ( !isset( $GLOBALS['eZGlobalModuleOperationList'] ) )
        {
            $GLOBALS['eZGlobalModuleOperationList'] = array();
        }
        if ( isset( $GLOBALS['eZGlobalModuleOperationList'][$moduleName] ) )
        {
            return $GLOBALS['eZGlobalModuleOperationList'][$moduleName];
        }
        $moduleOperationInfo = new eZModuleOperationInfo( $moduleName, $useTriggers );
        $moduleOperationInfo->loadDefinition();
        return $GLOBALS['eZGlobalModuleOperationList'][$moduleName] = $moduleOperationInfo;
    }
857688
private function applyModuleNameTranslateFunction($moduleStateMap)
    {
        return $this->applyModuleStateMapFilterFunction(
            $moduleStateMap,
            $this->moduleNameTranslateFunction,
            function ($moduleData, $translateFunction) {
                $moduleId = $moduleData[self::MODULE_ID_KEY];
                $moduleData[self::MODULE_NAME_KEY] = $translateFunction($moduleId);

                return $moduleData;
            }
        );
    }
31234
public function getModule(string $moduleName, string $type = 'modern', $config = null)
    {
        $settings = Twigpack::$plugin->getSettings();
        $config = $config ?? $settings->getAttributes();

        return ManifestHelper::getModule($config, $moduleName, $type);
    }
1138380
public function modulelist(string $roleName = ''): AnsibleGalaxyInterface
    {
        $this->addBaseoption('list');

        if ('' !== $roleName) {
            $this->addBaseoption($roleName);
        }

        return $this;
    }
761370
public static function getJsModuleTags(array $config, string $moduleName, bool $async)
    {
        $legacyModule = self::getModule($config, $moduleName, 'legacy', true);
        if ($legacyModule === null) {
            return '';
        }
        if ($async) {
            $modernModule = self::getModule($config, $moduleName, 'modern', true);
            if ($modernModule === null) {
                return '';
            }
        }
        $lines = [];
        if ($async) {
            $lines[] = "<script type=\"module\" src=\"{$modernModule}\"></script>";
            $lines[] = "<script nomodule src=\"{$legacyModule}\"></script>";
        } else {
            $lines[] = "<script src=\"{$legacyModule}\"></script>";
        }

        return implode("\r\n", $lines);
    }
488775
function getModule(name, loader) {
    var exports;
    var entry = loader.defined[name];

    if (!entry) {
      exports = loader.get(name);
      if (!exports)
        throw new Error('Unable to load dependency ' + name + '.');
    }

    else {
      if (entry.declarative)
        ensureEvaluated(name, entry, [], loader);
    
      else if (!entry.evaluated)
        linkDynamicModule(entry, loader);

      exports = entry.module.exports;
    }

    if ((!entry || entry.declarative) && exports && exports.__useDefault)
      return exports['default'];
    
    return exports;
  }
1149775
public function includeCssModule(string $moduleName, bool $async = false, $config = null): \Twig\Markup
    {
        return Template::raw(
            Twigpack::$plugin->manifest->getCssModuleTags($moduleName, $async, $config)
        );
    }
1341504
public static function get($name, &$args, &$options, &$called)
    {
        $moduleClass = 'Xiphe\HTML\modules\\'.ucfirst($name);

        if (!isset(self::$_loadedModules[$name])) {
            self::$_loadedModules[$name] = new $moduleClass();
            self::$_loadedModules[$name]->name = $name;
        }

        self::$_loadedModules[$name]->init($args, $options, $called);
        return self::$_loadedModules[$name];
    }
567529
private function injectModuleDependencies($moduleName, DependsOnModule $module)
    {
        $this->checkForMissingDependencies($moduleName, $module);

        if (!method_exists($module, '_inject')) {
            throw new ModuleException($module, 'Module requires method _inject to be defined to accept dependencies');
        }

        $dependencies = array_map(function ($dependency) {
            return $this->create($dependency, false);
        }, $this->getConfiguredDependencies($moduleName));

        call_user_func_array([$module, '_inject'], $dependencies);
    }
1210494
private function getModuleConfig(string $moduleConfigFile): DIConfigWrapper
    {
        if (!file_exists($moduleConfigFile)) {
            throw new NoServiceYamlException();
        }

        $moduleConfig = $this->dao->loadDIConfigFile($moduleConfigFile);
        if (! $moduleConfig->checkServiceClassesCanBeLoaded()) {
            $this->eventDispatcher->dispatch(
                ServicesYamlConfigurationErrorEvent::NAME,
                new ServicesYamlConfigurationErrorEvent($moduleConfigFile)
            );
            throw new ServicesYamlConfigurationError();
        }

        return $moduleConfig;
    }
1329141
protected function getConsoleUsage(ConsoleAdapterInterface $console, $scriptName, ModuleManagerInterface $moduleManager = null)
    {
        /*
         * Loop through all loaded modules and collect usage info
        */
        $usageInfo = array();

        if ($moduleManager !== null) {
            foreach ($moduleManager->getLoadedModules(false) as $name => $module) {
                // Strict-type on ConsoleUsageProviderInterface, or duck-type
                // on the method it defines
                if (!$module instanceof ConsoleUsageProviderInterface && !method_exists($module, 'getConsoleUsage')) {
                    continue; // this module does not provide usage info
                }

                $moduleName = (method_exists($module, 'getConsoleLabel'))? $module->getConsoleLabel() : $name;

                if ($moduleName) {
                    // We prepend the usage by the module name (printed in red), so that each module is
                    // clearly visible by the user
                    $moduleName = sprintf("%s\n%s\n%s\n",
                        str_repeat('-', $console->getWidth()),
                        $moduleName,
                        str_repeat('-', $console->getWidth())
                    );

                    $moduleName = $console->colorize($moduleName, ColorInterface::RED);
                }

                $usage = $module->getConsoleUsage($console);

                if (is_array($usage) && !empty($usage)) {
                    $usageInfo[$name] = $usage;
                } elseif (is_string($usage) && ($usage != '')) {
                    $usageInfo[$name] = array($usage);
                }

                if ($moduleName && isset($usageInfo[$name])) {
                    array_unshift($usageInfo[$name], $moduleName);
                }
            }
        }

        /*
         * Handle an application with no usage information
        */
        if (!count($usageInfo)) {
            return '';
        }

        /*
         * Transform arrays in usage info into columns, otherwise join everything together
        */
        $result    = '';
        $table     = false;
        $tableCols = 0;
        $tableType = 0;
        foreach ($usageInfo as $moduleName => $usage) {
            if (!is_string($usage) && !is_array($usage)) {
                throw new mvcexceptions\RuntimeException(sprintf('Cannot understand usage info for module "%s"', $moduleName));
            }

            if (is_string($usage)) {
                // It's a plain string - output as is
                $result .= $usage . "\n";
                continue;
            }

            // It's an array, analyze it
            foreach ($usage as $a => $b) {
                /*
                 * 'invocation method' => 'explanation'
                */
                if (is_string($a) && is_string($b)) {
                    if (($tableCols !== 2 || $tableType != 1) && $table !== false) {
                        // render last table
                        $result .= $this->renderTable($table, $tableCols, $console->getWidth());
                        $table   = false;

                        // add extra newline for clarity
                        $result .= "\n";
                    }

                    // Colorize the command
                    $a = $console->colorize($scriptName . ' ' . $a, ColorInterface::GREEN);

                    $tableCols = 2;
                    $tableType = 1;
                    $table[]   = array($a, $b);
                    continue;
                }

                /*
                 * array('--param', '--explanation')
                */
                if (is_array($b)) {
                    if ((count($b) != $tableCols || $tableType != 2) && $table !== false) {
                        // render last table
                        $result .= $this->renderTable($table, $tableCols, $console->getWidth());
                        $table   = false;

                        // add extra newline for clarity
                        $result .= "\n";
                    }

                    $tableCols = count($b);
                    $tableType = 2;
                    $table[]   = $b;
                    continue;
                }

                /*
                 * 'A single line of text'
                */
                if ($table !== false) {
                    // render last table
                    $result .= $this->renderTable($table, $tableCols, $console->getWidth());
                    $table   = false;

                    // add extra newline for clarity
                    $result .= "\n";
                }

                $tableType = 0;
                $result   .= $b . "\n";
            }
        }

        // Finish last table
        if ($table !== false) {
            $result .= $this->renderTable($table, $tableCols, $console->getWidth());
        }

        return $result;
    }
722170
protected function callModulesMethod($methodName)
    {
        $modules = Yii::$app->getModules();
        $returns = [];

        foreach ($modules as $moduleName => $module)
        {
            if (is_array($module)) {
                $module = Yii::$app->getModule($moduleName);
            }

            if (method_exists($module, $methodName)) {
                $returns[] = $module->$methodName();
            }
        }

        return $returns;
    }
903903
public function getModule($moduleName) {
        $moduleName = strtolower($moduleName);
        if (isset(self::$_modules[$moduleName])) {
            return self::$_modules[$moduleName];
        } else {
            try {
                return $this->loadModule($moduleName);
            }
            catch (\Exception $e) {
                throw new ModuleException("Cannot find requested module: $moduleName");
            }
        }
    }
1081714
protected function runModule(string $moduleName)
    {
        $app = \BFW\Application::getInstance();
        
        $app->getSubjectList()
            ->getSubjectByName('ApplicationTasks')
            ->sendNotify('BfwApp_run_module_'.$moduleName);
        
        $this->moduleList
            ->getModuleByName($moduleName)
            ->runModule();
    }
114622
public function bindModuleUrl($modulename, $xsl="", $lang="")
	{
		$queryStart = strpos($modulename, "?");
		$queryString = "";

		if ($queryStart!==false)
		{
			$queryString = "&" . substr($modulename, $queryStart+1);
			$modulename = substr($modulename, 0, $queryStart);
		}

		if (strpos($modulename, "module:") !== false)
		{
			$modulename = substr($modulename, 7);
		}

		if(empty($xsl))
		{
			if ($this->getXsl()=="index")
			{
				$xsl = 	$this->get("xmlnuke.DEFAULTPAGE");

			}
			else
			{
				$xsl = $this->getXsl();
			}
		}

		if(empty($lang))
			$lang = strtolower($this->Language()->getName());


		$fullLink = $this->get("xmlnuke.USEFULLPARAMETER");
		if (!$fullLink)
		{
			if ($xsl == $this->get("xmlnuke.DEFAULTPAGE"))
			{
				$xsl = "";
			}
			$array = array_keys($this->LanguagesAvailable());
			if ($lang == $array[0])
			{
				$lang = "";
			}
		}

		$url = $this->UrlModule()."?module=".$modulename;
		$url .= $queryString;
		if ($xsl != "")
		{
			$url .= "&xsl=".$xsl;
		}
		if ($lang != "")
		{
			$url .= "&lang=".$lang;
		}

		return $url;
	}
1101212
public function executeOnlyFor(array $module_names) {
	    $result = array();
	    if(HookProvider::getInstance()->isModuleOperational()){
	       $params = func_get_args();
	       array_shift($params);
    	    foreach ($module_names as $module_name) {
    	        if($module = Module::getModuleByName($module_name)) {
    	            $result[] = call_user_func_array(array($module, $this->hook_function), $params);
    	        }
    	    }
	    }
	    return $result;
	}
392386
public function getTriggers($sTrigger = null)
	{
		if (empty($this->aTriggersStack)) {
			return null;
		}

		if (null === $sTrigger) {
			return $this->aTriggersStack;
		}

		if ($this->hasTrigger($sTrigger)) {
			return $this->aTriggersStack[$sTrigger];
		}

		return null;
	}