Completed
Push — 2.2 ( 3fc3e6...761ff3 )
by Pierre
11s
created

install.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
use Mouf\MoufUtils;
3
4
require_once __DIR__."/../../autoload.php";
5
6
use Mouf\Actions\InstallUtils;
7
use Mouf\MoufManager;
8
9
// Let's init Mouf
10
InstallUtils::init(InstallUtils::$INIT_APP);
11
12
// Let's create the instances
13
$moufManager = MoufManager::getMoufManager();
14
if (!$moufManager->instanceExists("defaultWebLibraryRenderer")) {
15
	$moufManager->declareComponent("defaultWebLibraryRenderer", "Mouf\\Html\\Utils\\WebLibraryManager\\DefaultWebLibraryRenderer");
16
}
17
if (!$moufManager->instanceExists("defaultWebLibraryManager")) {
18
	$defaultWebLibraryManager = $moufManager->createInstance("Mouf\\Html\\Utils\\WebLibraryManager\\WebLibraryManager");
19
	$defaultWebLibraryManager->setName("defaultWebLibraryManager");
20
	
21
	if (!$moufManager->instanceExists("rootUrlInlineWebLibrary")) {
22
		if (!$moufManager->instanceExists("rootUrlJsFile")) {
23
			$rootUrlJsFile = $moufManager->createInstance("Mouf\\Html\\HtmlElement\\HtmlFromFile");
24
			$rootUrlJsFile->setName("rootUrlJsFile");
25
			//$rootUrlJsFile->getProperty("fileName")->setValue(MoufUtils::getUrlPathFromFilePath(__DIR__."/javascript/rootUrl.php"), true);
26
			$rootUrlJsFile->getProperty("fileName")->setValue("vendor/mouf/html.utils.weblibrarymanager/javascript/rootUrl.php");
27
		} else {
28
			$rootUrlJsFile = $moufManager->getInstanceDescriptor("rootUrlJsFile");
29
		}
30
	
31
		$rootUrl = $moufManager->createInstance("Mouf\\Html\\Utils\\WebLibraryManager\\InlineWebLibrary");
32
		$rootUrl->setName("rootUrlInlineWebLibrary");
33
		$rootUrl->getProperty("jsElement")->setValue($rootUrlJsFile);
34
	
35
		$defaultWebLibraryManager->getProperty("webLibraries")->setValue(array($rootUrl));
36
	}
37
}
38
39
// Let's rewrite the MoufComponents.php file to save the component
40
$moufManager->rewriteMouf();
41
42
// Finally, let's continue the install
43
InstallUtils::continueInstall();
44
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...