Returns the url to ab ajax module whose content is rendered as is
@param ModuleBase $module The module
@param array $args The url parameters
@return string Returns the ajax url
484897
static function AjaxUrl(ModuleBase $module, array $args = array())
    {
        $allArgs = array('module'=> ClassFinder::ModuleType($module)) + $args;
        $guard = new UserGuard();
        $user = $guard->GetUser();
        if (!$user)
        {
            throw new \Exception('Security breach on ajax url: no backend user logged in');
        }
        $allArgs['__backendUser'] = $user->GetID();
        return 'ajax.php?' . http_build_query($allArgs);
    }
710778
public function getFullUrl(
        $module = self::DEFAULT_MODULE,
        $controller = self::DEFAULT_CONTROLLER,
        array $params = []
    ): string {
        $scheme = Request::getUri()->getScheme() . '://';
        $host = Request::getUri()->getHost();
        $port = Request::getUri()->getPort();
        if ($port && !\in_array($port, [80, 443], true)) {
            $host .= ':' . $port;
        }
        $url = $this->getUrl($module, $controller, $params);
        return $scheme . $host . $url;
    }
1325726
protected function _getAppBase()
    {
        $baseUrl = Configure::read('App.base');
        if (!$baseUrl) {
            $request = Router::getRequest(true);
            if (!$request) {
                $baseUrl = '';
            } else {
                $baseUrl = $request->base;
            }
        }
        return $baseUrl . '/';
    }
454071
public function render($module, $attribs = array())
	{
		static $chrome;

		if (null !== $this->profiler)
		{
			$this->profiler->mark('beforeRenderModule ' . $module->module . ' (' . $module->title . ')');
		}

		// Record the scope.
		$scope = $this->app->has('scope') ? $this->app->get('scope') : null;

		// Set scope to component name
		$this->app->set('scope', $module->module);

		// Get module parameters
		$params = new Registry($module->params);

		if (isset($attribs['params']))
		{
			$customparams = new Registry(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));

			$params->merge($customparams);

			$module->params = $params->toString();
		}

		// Get module path
		$module->module = $this->canonical($module->module);

		$path = $this->path($module->module);

		// Load the module
		// $module->user is a check for 1.0 custom modules and is deprecated refactoring
		if (file_exists($path))
		{
			$this->app['language']->load($module->module, PATH_APP . DS . 'bootstrap' . DS . $this->app['client']->name, null, false, true) ||
			$this->app['language']->load($module->module, dirname($path), null, false, true);

			$module->path = $path;

			$content = '';
			ob_start();
			include $path;
			$module->content = ob_get_contents() . $content;
			ob_end_clean();
		}

		// Load the module chrome functions
		if (!$chrome)
		{
			$chrome = array();
		}

		include_once PATH_CORE . DS . 'templates' . DS . 'system' . DS . 'html' . DS . 'modules.php';
		$chromePath = $this->app['template']->path . DS . 'html' . DS . 'modules.php';

		if (!isset($chrome[$chromePath]))
		{
			if (file_exists($chromePath))
			{
				include_once $chromePath;
			}

			$chrome[$chromePath] = true;
		}

		// Make sure a style is set
		if (!isset($attribs['style']))
		{
			$attribs['style'] = 'none';
		}

		// Dynamically add outline style
		if ($this->outline())
		{
			$attribs['style'] .= ' outline';
		}

		foreach (explode(' ', $attribs['style']) as $style)
		{
			$chromeMethod = 'modChrome_' . $style;

			// Apply chrome and render module
			if (function_exists($chromeMethod))
			{
				$module->style = $attribs['style'];

				ob_start();
				$chromeMethod($module, $params, $attribs);
				$module->content = ob_get_contents();
				ob_end_clean();
			}
		}

		// Revert the scope
		$this->app->forget('scope');
		$this->app->set('scope', $scope);

		if (null !== $this->profiler)
		{
			$this->profiler->mark('afterRenderModule ' . $module->module . ' (' . $module->title . ')');
		}

		return $module->content;
	}
449600
function getModule(moduleName) {
                    try {
                        return ngModuleFct(moduleName);
                    } catch (e) {
                        // this error message really suxx
                        if (/No module/.test(e) || e.message.indexOf('$injector:nomod') > -1) {
                            e.message = 'The module "' + stringify(moduleName) + '" that you are trying to load does not exist. ' + e.message;
                        }
                        throw e;
                    }
                }
98437
public static function loadScriptingModule($module)
    {
        $fullScriptPath = false;

        //  Remove any quotes from this passed in module
        $module = trim(str_replace(["'", '"'], null, $module), ' /');

        //  Check the configured script paths
        if (null === ($script = array_get(static::$libraries, $module))) {
            $script = $module;
        }

        foreach (static::$libraryPaths as $key => $path) {
            $checkScriptPath = $path . DIRECTORY_SEPARATOR . $script;

            if (is_file($checkScriptPath) && is_readable($checkScriptPath)) {
                $fullScriptPath = $checkScriptPath;
                break;
            }
        }

        if (!$script || !$fullScriptPath) {
            throw new InternalServerErrorException(
                'The module "' . $module . '" could not be found in any known locations.'
            );
        }

        return file_get_contents($fullScriptPath);
    }
1321806
public function handleEnable(Args $args)
    {
        $bindingToEnable = $this->getBindingByUuidPrefix($args->getArgument('uuid'));

        if ($bindingToEnable->getContainingModule() instanceof RootModule) {
            throw new RuntimeException(sprintf(
                'Cannot enable bindings in the module "%s".',
                $bindingToEnable->getContainingModule()->getName()
            ));
        }

        $this->discoveryManager->enableBindingDescriptor($bindingToEnable->getUuid());

        return 0;
    }
1094671
protected function getUri($module, $method, $responseFormat, array $requestParameters = array())
    {
        if (!$this->hasMethod($method)) {
            throw new \InvalidArgumentException(sprintf('The method %s is not registered', $method));
        }

        if (!$this->hasResponseFormat($responseFormat)) {
            throw new \InvalidArgumentException(sprintf('The response format %s is not registered', $responseFormat));
        }

        if (!isset($requestParameters['scope'])) {
            $requestParameters['scope'] = self::API_DEFAULT_SCOPE;
        }

        if (!isset($requestParameters['version'])) {
            $requestParameters['version'] = self::API_DEFAULT_VERSION;
        }

        $uri = sprintf(
            self::API_BASE_URL,
            $responseFormat,
            $module,
            $method,
            $this->getAuthToken()
        );

        return $uri . $this->generateQueryStringByRequestParams($requestParameters);
    }
489615
public function get(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::GET, $module, $controller);
    }
77111
public function getExportUrl($scope = 1, $args = null)
    {
        $input = array_merge(Input::all(), Exporter::formatExportQuery($scope, $args));

        if ($constraints = $this->model()->getConstraints()) {
            $input = array_merge($input, $constraints);
        }

        return $this->resource().'?'.http_build_query($input);
    }
1017016
public function url($uri = '', $module = null)
    {
        if ($module != null) {
            $appNames = Container::get('config')->get('app_name');
            if (is_array($appNames)) {
                foreach ($appNames as &$appName) {
                    $appName = str_replace('./', '', $appName);
                }

                $appNames = array_flip($appNames);
                $baseUrl = $appNames[$module];
                $baseUrl = '//' . $baseUrl . '/';
            }
        } else {
            $baseUrl = Container::get('request')->getBaseUrl();
        }

        $uri = is_array($uri) ? implode('/', $uri) : trim($uri, '/');
        $prefix = $baseUrl . 'index.php?_i=';

        switch (strtolower(Container::get('config')->get('url_mode'))) {
            case 'path_info':
                return $uri == '' ? rtrim($baseUrl, '/') : $baseUrl . $uri;
            case 'query_string':
                return $uri == '' ? rtrim($baseUrl, '/') : $prefix . $uri;
            default:
                throw new ConfigException('`url_mode` Config ERROR');
        }
    }
172239
public function getModuleCustomTable($module)
    {
        $sugarBean = $this->getBean($module);
        $customTable = $sugarBean->get_custom_table_name();
        $data = $this->db->query("SHOW TABLES LIKE '$customTable'");
        if (empty($data)) {
            return '';
        }

        return $customTable;
    }
74397
public function module(Module $module)
    {
        $vars = $this->model::generate_page($module, 'setting');
        
        return $this->makeResponse('module', $vars);
    }
505616
public function getModuleMarkup($module, $args)
    {
        $templatePath = $module->template();

        // Get template for legacy modules
        if (!$templatePath) {
            $templatePath = \Modularity\Helper\Wp::getTemplate($module->post_type, 'module', false);
        }

        if (!$templatePath) {
            return false;
        }

        $moduleMarkup = '';
        if (preg_match('/.blade.php$/i', $templatePath)) {
            $moduleMarkup = $this->loadBladeTemplate($templatePath, $module, $args);
        } else {
            $moduleMarkup = $this->loadTemplate($templatePath, $module, $args);
        }

        if (empty($moduleMarkup)) {
            return;
        }

        $classes = array(
            'modularity-' . $module->post_type,
            'modularity-' . $module->post_type . '-' . $module->ID
        );

        //Hide module if preview
        if (is_preview() && $module->hidden) {
            $classes[] = 'modularity-preview-hidden';
        }

        //Add selected scope class
        if (isset($module->data['meta']) && isset($module->data['meta']['module_css_scope']) && is_array($module->data['meta']['module_css_scope'])) {
            if (!empty($module->data['meta']['module_css_scope'][0])) {
                $classes[] = $module->data['meta']['module_css_scope'][0];
            }
        }

        $beforeModule = '';
        $moduleEdit = '';
        if (!(isset($args['edit_module']) && $args['edit_module'] === false) && current_user_can('edit_module', $module->ID)) {
            $moduleEdit = '<div class="modularity-edit-module"><a href="' . admin_url('post.php?post=' . $module->ID . '&action=edit&is_thickbox=true&is_inline=true') . '">' . __('Edit module', 'modularity') . ': ' . $module->data['post_type_name'] .  '</a></div>';
        }

        if (isset($module->columnWidth) && !empty($module->columnWidth)) {
            $beforeWidget = $module->columnWidth;

            $classes[] = $beforeWidget;

            $beforeModule = apply_filters('Modularity/Display/BeforeModule', '<div class="' . implode(' ', $classes) . '">', $args, $module->post_type, $module->ID);
        } elseif (isset($args['before_widget'])) {
            $beforeWidget = str_replace('%1$s', $module->post_type . '-' . $module->ID, $args['before_widget']);
            $beforeWidget = str_replace('%2$s', implode(' ', $classes), $beforeWidget);
            $beforeModule = apply_filters('Modularity/Display/BeforeModule', $beforeWidget, $args, $module->post_type, $module->ID);
        }

        $moduleMarkup = $beforeModule . $moduleEdit . $moduleMarkup;
        return $moduleMarkup;
    }
428462
function(route, args, base) {
            base = base || "";
            args = args || {};
            var url = route;
            url = url.replace("#!/","#").replace("#!", "#").replace("#", "");
            _.map(args, function(value, attr) {
                url = url.replace("\:"+attr, value);
            });
            return base+"#/"+url;
        }
1108179
final public function url($module, $controller = null, $action = null, array $params = array(), $hash = null) {
        $module = ucfirst(Util::hyphenToCamel($module));
        $moduleOptions = engineGet('config', 'modules', $module, false);
        $module = (isset($moduleOptions['alias'])) ? $moduleOptions['alias'] : $module;

        $return = Util::camelToHyphen($module);
        if ($controller)
            $return .= '/' . Util::camelToHyphen($controller);
        if ($action)
            $return .= '/' . Util::camelToHyphen($action);
        if (!empty($params))
            $return .= str_replace('//', '/' . urlencode(' ') . '/', '/' . join('/', $this->encodeParams($params)));
        if ($hash)
            $return .= '#' . $hash;

        return engineGet('serverPath') . $return;
    }
1229855
public function generateModuleUrl($actionName, array $parameters = array(), $absolute = false)
    {
        return $this->module->generateModuleUrl($actionName, $parameters, $absolute);
    }