@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Less |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const LESS_WINDOWS = LESS_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const LESS_WINDOWS = LESS_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toCss(string $sFile) |
46 | 46 | { |
47 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
47 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
48 | 48 | |
49 | - $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | - $sContent = shell_exec($sCmd); |
|
51 | - } |
|
52 | - else { |
|
49 | + $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | + $sContent = shell_exec($sCmd); |
|
51 | + } |
|
52 | + else { |
|
53 | 53 | |
54 | - $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | - $sContent = shell_exec($sCmd); |
|
56 | - } |
|
54 | + $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | + $sContent = shell_exec($sCmd); |
|
56 | + } |
|
57 | 57 | |
58 | - header("content-type:text/css"); |
|
59 | - echo $sContent; |
|
58 | + header("content-type:text/css"); |
|
59 | + echo $sContent; |
|
60 | 60 | } |
61 | 61 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
53 | 53 | $sContent = shell_exec($sCmd); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | |
57 | 56 | $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
58 | 57 | $sContent = shell_exec($sCmd); |
@@ -39,29 +39,29 @@ |
||
39 | 39 | */ |
40 | 40 | public function replaceBy(array $aParams = array()) : string |
41 | 41 | { |
42 | - $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
42 | + $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
43 | 43 | |
44 | 44 | if (isset($aParams['template'])) { |
45 | 45 | |
46 | - $aTemplates = explode(';', $aParams['template']); |
|
47 | - $sGetUrl = 'getCss?'; |
|
46 | + $aTemplates = explode(';', $aParams['template']); |
|
47 | + $sGetUrl = 'getCss?'; |
|
48 | 48 | |
49 | - foreach ($aTemplates as $sTemplate) { |
|
49 | + foreach ($aTemplates as $sTemplate) { |
|
50 | 50 | |
51 | - if (strstr($sTemplate, 'css/')) { |
|
51 | + if (strstr($sTemplate, 'css/')) { |
|
52 | 52 | |
53 | - $sGetUrl .= $sTemplate.'&'; |
|
54 | - } |
|
55 | - else if (strstr($sTemplate, 'js/')) { |
|
53 | + $sGetUrl .= $sTemplate.'&'; |
|
54 | + } |
|
55 | + else if (strstr($sTemplate, 'js/')) { |
|
56 | 56 | |
57 | - $sGetUrl .= $sTemplate.'&'; |
|
58 | - } |
|
59 | - } |
|
57 | + $sGetUrl .= $sTemplate.'&'; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
61 | + if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
62 | 62 | |
63 | - $sGetUrl .= ASSET_VERSION; |
|
64 | - } |
|
63 | + $sGetUrl .= ASSET_VERSION; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | return $sGetUrl; |
67 | 67 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if (strstr($sTemplate, 'css/')) { |
52 | 52 | |
53 | 53 | $sGetUrl .= $sTemplate.'&'; |
54 | - } |
|
55 | - else if (strstr($sTemplate, 'js/')) { |
|
54 | + } else if (strstr($sTemplate, 'js/')) { |
|
56 | 55 | |
57 | 56 | $sGetUrl .= $sTemplate.'&'; |
58 | 57 | } |
@@ -28,30 +28,30 @@ |
||
28 | 28 | */ |
29 | 29 | class Geocoding |
30 | 30 | { |
31 | - /** |
|
32 | - * get the URL with the signature for the Pro account of Google Map |
|
33 | - * |
|
34 | - * @access public |
|
35 | - * @param unknown $sUrlToSign |
|
36 | - * @param unknown $sClientId |
|
37 | - * @param unknown $sPrivateKey |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | - { |
|
42 | - $aUrl = parse_url($sUrlToSign); |
|
43 | - $aUrl['query'] .= '&client=' .$sClientId; |
|
31 | + /** |
|
32 | + * get the URL with the signature for the Pro account of Google Map |
|
33 | + * |
|
34 | + * @access public |
|
35 | + * @param unknown $sUrlToSign |
|
36 | + * @param unknown $sClientId |
|
37 | + * @param unknown $sPrivateKey |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | + { |
|
42 | + $aUrl = parse_url($sUrlToSign); |
|
43 | + $aUrl['query'] .= '&client=' .$sClientId; |
|
44 | 44 | |
45 | - $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
45 | + $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
46 | 46 | |
47 | - $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
47 | + $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
48 | 48 | |
49 | - $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
49 | + $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
50 | 50 | |
51 | - $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
51 | + $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
52 | 52 | |
53 | - $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
53 | + $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
54 | 54 | |
55 | - return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | - } |
|
55 | + return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | + } |
|
57 | 57 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
41 | 41 | { |
42 | 42 | $aUrl = parse_url($sUrlToSign); |
43 | - $aUrl['query'] .= '&client=' .$sClientId; |
|
43 | + $aUrl['query'] .= '&client='.$sClientId; |
|
44 | 44 | |
45 | 45 | $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
46 | 46 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
52 | 52 | |
53 | - $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
53 | + $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path']."?".$aUrl['query']; |
|
54 | 54 | |
55 | - return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
55 | + return $sOriginalUrl.'&signature='.$sEncodedSignature; |
|
56 | 56 | } |
57 | 57 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Typescript |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toJs(string $sFile) : string |
46 | 46 | { |
47 | - $aFile = pathinfo($sFile); |
|
48 | - $sFolder = uniqid(); |
|
47 | + $aFile = pathinfo($sFile); |
|
48 | + $sFolder = uniqid(); |
|
49 | 49 | |
50 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
50 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
51 | 51 | |
52 | - $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | - $sContent = shell_exec($sCmd); |
|
54 | - } |
|
55 | - else { |
|
52 | + $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | + $sContent = shell_exec($sCmd); |
|
54 | + } |
|
55 | + else { |
|
56 | 56 | |
57 | - $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | - $sContent = shell_exec($sCmd); |
|
59 | - } |
|
57 | + $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | + $sContent = shell_exec($sCmd); |
|
59 | + } |
|
60 | 60 | |
61 | - header("content-type:text/javascript"); |
|
62 | - return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
61 | + header("content-type:text/javascript"); |
|
62 | + return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
63 | 63 | } |
64 | 64 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
53 | 53 | $sContent = shell_exec($sCmd); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | |
57 | 56 | $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
58 | 57 | $sContent = shell_exec($sCmd); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function set(string $name, string $value = null) : Headers |
35 | 35 | { |
36 | 36 | if ($value !== null) { |
37 | - header($name . ': ' . $value); |
|
37 | + header($name.': '.$value); |
|
38 | 38 | } |
39 | 39 | else { |
40 | 40 | header($name); |
@@ -9,37 +9,37 @@ |
||
9 | 9 | |
10 | 10 | class Headers implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
21 | - return apache_request_headers()[$name]; |
|
22 | - } |
|
23 | - else if ($default !== null) { |
|
24 | - return $default; |
|
25 | - } |
|
26 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
21 | + return apache_request_headers()[$name]; |
|
22 | + } |
|
23 | + else if ($default !== null) { |
|
24 | + return $default; |
|
25 | + } |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * set a new header |
|
30 | - * @param string $name |
|
31 | - * @param string $value |
|
32 | - * @return string|Headers |
|
33 | - */ |
|
34 | - public function set(string $name, string $value = null) : Headers |
|
35 | - { |
|
36 | - if ($value !== null) { |
|
37 | - header($name . ': ' . $value); |
|
38 | - } |
|
39 | - else { |
|
40 | - header($name); |
|
41 | - } |
|
28 | + /** |
|
29 | + * set a new header |
|
30 | + * @param string $name |
|
31 | + * @param string $value |
|
32 | + * @return string|Headers |
|
33 | + */ |
|
34 | + public function set(string $name, string $value = null) : Headers |
|
35 | + { |
|
36 | + if ($value !== null) { |
|
37 | + header($name . ': ' . $value); |
|
38 | + } |
|
39 | + else { |
|
40 | + header($name); |
|
41 | + } |
|
42 | 42 | |
43 | - return $this; |
|
44 | - } |
|
43 | + return $this; |
|
44 | + } |
|
45 | 45 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
21 | 21 | return apache_request_headers()[$name]; |
22 | - } |
|
23 | - else if ($default !== null) { |
|
22 | + } else if ($default !== null) { |
|
24 | 23 | return $default; |
25 | 24 | } |
26 | 25 | } |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | { |
36 | 35 | if ($value !== null) { |
37 | 36 | header($name . ': ' . $value); |
38 | - } |
|
39 | - else { |
|
37 | + } else { |
|
40 | 38 | header($name); |
41 | 39 | } |
42 | 40 |
@@ -118,8 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function redirect(string $sUrl, int $iHttpCode = 301) |
120 | 120 | { |
121 | - if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); } |
|
122 | - else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); } |
|
121 | + if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); } else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); } |
|
123 | 122 | |
124 | 123 | header('Location: '.$sUrl); |
125 | 124 | exit; |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | abstract class Controller extends Mother |
44 | 44 | { |
45 | 45 | |
46 | - /** |
|
47 | - * Cache to know if a model was initialize or not because we must initialize it just one time by script |
|
48 | - * |
|
49 | - * @access private |
|
50 | - * @var array |
|
51 | - */ |
|
52 | - private static $_aInitialize = array(); |
|
46 | + /** |
|
47 | + * Cache to know if a model was initialize or not because we must initialize it just one time by script |
|
48 | + * |
|
49 | + * @access private |
|
50 | + * @var array |
|
51 | + */ |
|
52 | + private static $_aInitialize = array(); |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Constructor |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | if (method_exists(get_called_class(), 'initialize')) { |
97 | 97 | |
98 | - if (!isset(self::$_aInitialize[get_called_class()])) { |
|
98 | + if (!isset(self::$_aInitialize[get_called_class()])) { |
|
99 | 99 | |
100 | - static::initialize(); |
|
101 | - self::$_aInitialize[get_called_class()] = true; |
|
102 | - } |
|
100 | + static::initialize(); |
|
101 | + self::$_aInitialize[get_called_class()] = true; |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function __get($mKey) |
171 | 171 | { |
172 | - if (isset($this->di) && property_exists($this, 'di')) { |
|
172 | + if (isset($this->di) && property_exists($this, 'di')) { |
|
173 | 173 | |
174 | - $mDi = $this->di->get($mKey); |
|
174 | + $mDi = $this->di->get($mKey); |
|
175 | 175 | |
176 | - if (isset($mDi) && $mDi !== false) { return $mDi; } |
|
177 | - } |
|
176 | + if (isset($mDi) && $mDi !== false) { return $mDi; } |
|
177 | + } |
|
178 | 178 | |
179 | 179 | return parent::__get($mKey); |
180 | 180 | } |
@@ -46,20 +46,20 @@ |
||
46 | 46 | |
47 | 47 | $this->installDb = function() |
48 | 48 | { |
49 | - $oDb = Config::get('Db'); |
|
50 | - $oTables = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.preg_replace('/^.*\\\\([a-zA-Z0-9]+)$/', '$1', get_called_class()).DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Db.conf')); |
|
49 | + $oDb = Config::get('Db'); |
|
50 | + $oTables = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.preg_replace('/^.*\\\\([a-zA-Z0-9]+)$/', '$1', get_called_class()).DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Db.conf')); |
|
51 | 51 | |
52 | - $oDb->configuration->tables = $oTables; |
|
52 | + $oDb->configuration->tables = $oTables; |
|
53 | 53 | |
54 | - $aOptions = [ |
|
55 | - "p" => CREATE_PORTAL, |
|
56 | - "c" => true, |
|
57 | - "e" => true, |
|
58 | - "b" => json_encode($oDb) |
|
59 | - ]; |
|
54 | + $aOptions = [ |
|
55 | + "p" => CREATE_PORTAL, |
|
56 | + "c" => true, |
|
57 | + "e" => true, |
|
58 | + "b" => json_encode($oDb) |
|
59 | + ]; |
|
60 | 60 | |
61 | - $oEntity = new Entity; |
|
62 | - $oEntity->runScaffolding($aOptions); |
|
61 | + $oEntity = new Entity; |
|
62 | + $oEntity->runScaffolding($aOptions); |
|
63 | 63 | }; |
64 | 64 | } |
65 | 65 | } |
@@ -60,8 +60,7 @@ |
||
60 | 60 | echo "\n\n"; |
61 | 61 | echo " > Check realized on ".$options['a']; |
62 | 62 | echo "\n\n"; |
63 | - } |
|
64 | - else { |
|
63 | + } else { |
|
65 | 64 | echo "\n\n"; |
66 | 65 | echo Bash::setBackground(" ", 'red'); |
67 | 66 | echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
@@ -7,68 +7,68 @@ |
||
7 | 7 | |
8 | 8 | class Server extends Controller |
9 | 9 | { |
10 | - /** |
|
11 | - * new method to launch a web server |
|
12 | - * @param array $options |
|
13 | - * @tutorial php bin/console server:run |
|
14 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | - */ |
|
16 | - public function run(array $options = array()) |
|
17 | - { |
|
18 | - ob_get_clean(); |
|
10 | + /** |
|
11 | + * new method to launch a web server |
|
12 | + * @param array $options |
|
13 | + * @tutorial php bin/console server:run |
|
14 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | + */ |
|
16 | + public function run(array $options = array()) |
|
17 | + { |
|
18 | + ob_get_clean(); |
|
19 | 19 | |
20 | - if (!isset($options['a'])) { |
|
21 | - $options['a'] = 'localhost:8000'; |
|
22 | - } |
|
20 | + if (!isset($options['a'])) { |
|
21 | + $options['a'] = 'localhost:8000'; |
|
22 | + } |
|
23 | 23 | |
24 | - echo "\n\n"; |
|
25 | - echo Bash::setBackground(" ", 'green'); |
|
26 | - echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | - echo Bash::setBackground(" ", 'green'); |
|
28 | - echo "\n\n"; |
|
29 | - echo " > Use ".$options['a']." in browser"; |
|
30 | - echo "\n\n"; |
|
31 | - echo " > Clic Ctrl+C to stop the web server"; |
|
32 | - echo "\n\n"; |
|
24 | + echo "\n\n"; |
|
25 | + echo Bash::setBackground(" ", 'green'); |
|
26 | + echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | + echo Bash::setBackground(" ", 'green'); |
|
28 | + echo "\n\n"; |
|
29 | + echo " > Use ".$options['a']." in browser"; |
|
30 | + echo "\n\n"; |
|
31 | + echo " > Clic Ctrl+C to stop the web server"; |
|
32 | + echo "\n\n"; |
|
33 | 33 | |
34 | - exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | - } |
|
34 | + exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * check if a server web is launched |
|
39 | - * @param array $options |
|
40 | - * @tutorial php bin/console server:status |
|
41 | - * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | - */ |
|
43 | - public function status(array $options = array()) |
|
44 | - { |
|
45 | - ob_get_clean(); |
|
37 | + /** |
|
38 | + * check if a server web is launched |
|
39 | + * @param array $options |
|
40 | + * @tutorial php bin/console server:status |
|
41 | + * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | + */ |
|
43 | + public function status(array $options = array()) |
|
44 | + { |
|
45 | + ob_get_clean(); |
|
46 | 46 | |
47 | - if (!isset($options['a'])) { |
|
48 | - $options['a'] = 'localhost:8000'; |
|
49 | - } |
|
47 | + if (!isset($options['a'])) { |
|
48 | + $options['a'] = 'localhost:8000'; |
|
49 | + } |
|
50 | 50 | |
51 | - list($hostname, $port) = explode(':', $options['a']); |
|
51 | + list($hostname, $port) = explode(':', $options['a']); |
|
52 | 52 | |
53 | - if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | - fclose($fp); |
|
53 | + if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | + fclose($fp); |
|
55 | 55 | |
56 | - echo "\n\n"; |
|
57 | - echo Bash::setBackground(" ", 'green'); |
|
58 | - echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | - echo Bash::setBackground(" ", 'green'); |
|
60 | - echo "\n\n"; |
|
61 | - echo " > Check realized on ".$options['a']; |
|
62 | - echo "\n\n"; |
|
63 | - } |
|
64 | - else { |
|
65 | - echo "\n\n"; |
|
66 | - echo Bash::setBackground(" ", 'red'); |
|
67 | - echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | - echo Bash::setBackground(" ", 'red'); |
|
69 | - echo "\n\n"; |
|
70 | - echo " > Check realized on ".$options['a']; |
|
71 | - echo "\n\n"; |
|
72 | - } |
|
73 | - } |
|
56 | + echo "\n\n"; |
|
57 | + echo Bash::setBackground(" ", 'green'); |
|
58 | + echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | + echo Bash::setBackground(" ", 'green'); |
|
60 | + echo "\n\n"; |
|
61 | + echo " > Check realized on ".$options['a']; |
|
62 | + echo "\n\n"; |
|
63 | + } |
|
64 | + else { |
|
65 | + echo "\n\n"; |
|
66 | + echo Bash::setBackground(" ", 'red'); |
|
67 | + echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | + echo Bash::setBackground(" ", 'red'); |
|
69 | + echo "\n\n"; |
|
70 | + echo " > Check realized on ".$options['a']; |
|
71 | + echo "\n\n"; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | |
73 | 73 | if (!file_exists($sPrivatePath.'Controller')) { |
74 | 74 | |
75 | - mkdir($sPublicPath . 'css', 0777, true); |
|
76 | - mkdir($sPublicPath . 'js', 0777, true); |
|
77 | - mkdir($sPublicPath . 'img', 0777, true); |
|
75 | + mkdir($sPublicPath.'css', 0777, true); |
|
76 | + mkdir($sPublicPath.'js', 0777, true); |
|
77 | + mkdir($sPublicPath.'img', 0777, true); |
|
78 | 78 | } |
79 | 79 | else { |
80 | 80 | |
81 | - echo 'The Project (public part) ' . $sPrivatePath . " exists\n"; |
|
81 | + echo 'The Project (public part) '.$sPrivatePath." exists\n"; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | |
92 | 92 | if (!file_exists($sPrivatePath.'Controller')) { |
93 | 93 | |
94 | - mkdir($sPrivatePath . 'Controller', 0777, true); |
|
95 | - mkdir($sPrivatePath . 'Entity', 0777, true); |
|
96 | - mkdir($sPrivatePath . 'Model', 0777, true); |
|
97 | - mkdir($sPrivatePath . 'View', 0777, true); |
|
98 | - mkdir($sPrivatePath . 'conf', 0777, true); |
|
99 | - mkdir($sPrivatePath . 'common', 0777, true); |
|
94 | + mkdir($sPrivatePath.'Controller', 0777, true); |
|
95 | + mkdir($sPrivatePath.'Entity', 0777, true); |
|
96 | + mkdir($sPrivatePath.'Model', 0777, true); |
|
97 | + mkdir($sPrivatePath.'View', 0777, true); |
|
98 | + mkdir($sPrivatePath.'conf', 0777, true); |
|
99 | + mkdir($sPrivatePath.'common', 0777, true); |
|
100 | 100 | } |
101 | 101 | else { |
102 | 102 | |
103 | - echo 'The Project (private part) ' . $sPrivatePath . " exists\n"; |
|
103 | + echo 'The Project (private part) '.$sPrivatePath." exists\n"; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Controller.php'); |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * option -p [portail] |
52 | 52 | */ |
53 | - if (isset($aOptions['p'])) { $sPortal = $aOptions['p']; } |
|
54 | - else { $sPortal = 'Batch'; } |
|
53 | + if (isset($aOptions['p'])) { $sPortal = $aOptions['p']; } else { $sPortal = 'Batch'; } |
|
55 | 54 | |
56 | 55 | if (!preg_match('/^[a-zA-Z0-9]+$/', $sPortal)) { |
57 | 56 | |
@@ -67,16 +66,14 @@ discard block |
||
67 | 66 | |
68 | 67 | echo 'The batch can`t create public folders for '.$sPortal.'! Please check the rights.'; |
69 | 68 | throw new \Exception('The batch can`t create public folders for '.$sPortal.'! Please check the rights.'); |
70 | - } |
|
71 | - else { |
|
69 | + } else { |
|
72 | 70 | |
73 | 71 | if (!file_exists($sPrivatePath.'Controller')) { |
74 | 72 | |
75 | 73 | mkdir($sPublicPath . 'css', 0777, true); |
76 | 74 | mkdir($sPublicPath . 'js', 0777, true); |
77 | 75 | mkdir($sPublicPath . 'img', 0777, true); |
78 | - } |
|
79 | - else { |
|
76 | + } else { |
|
80 | 77 | |
81 | 78 | echo 'The Project (public part) ' . $sPrivatePath . " exists\n"; |
82 | 79 | } |
@@ -86,8 +83,7 @@ discard block |
||
86 | 83 | |
87 | 84 | echo 'The batch can`t create private folders for '.$sPortal.'! Please check the rights.'; |
88 | 85 | throw new \Exception('The batch can`t create private folders for '.$sPortal.'! Please check the rights.'); |
89 | - } |
|
90 | - else { |
|
86 | + } else { |
|
91 | 87 | |
92 | 88 | if (!file_exists($sPrivatePath.'Controller')) { |
93 | 89 | |
@@ -97,8 +93,7 @@ discard block |
||
97 | 93 | mkdir($sPrivatePath . 'View', 0777, true); |
98 | 94 | mkdir($sPrivatePath . 'conf', 0777, true); |
99 | 95 | mkdir($sPrivatePath . 'common', 0777, true); |
100 | - } |
|
101 | - else { |
|
96 | + } else { |
|
102 | 97 | |
103 | 98 | echo 'The Project (private part) ' . $sPrivatePath . " exists\n"; |
104 | 99 | } |