Completed
Push — master ( 6a4fed...14d2cb )
by judicael
03:36
created
bundles/src/Batch/app/Controller/Generator.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -61,26 +61,26 @@  discard block
 block discarded – undo
61 61
 
62 62
 		$sActualDirectory = str_replace(DIRECTORY_SEPARATOR, '/', __DIR__);
63 63
 		$sPrivatePath = str_replace('/Batch/app/Controller', DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app', $sActualDirectory).DIRECTORY_SEPARATOR;
64
-        $sPublicPath = str_replace('/Batch/app/Controller', DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'public', $sActualDirectory).DIRECTORY_SEPARATOR;
64
+		$sPublicPath = str_replace('/Batch/app/Controller', DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'public', $sActualDirectory).DIRECTORY_SEPARATOR;
65 65
 
66
-        if (!is_writable($sActualDirectory.'/../../../')) {
66
+		if (!is_writable($sActualDirectory.'/../../../')) {
67 67
 
68
-            echo 'The batch can`t create public folders for '.$sPortal.'! Please check the rights.';
69
-            throw new \Exception('The batch can`t create public folders for '.$sPortal.'! Please check the rights.');
70
-        }
71
-        else {
68
+			echo 'The batch can`t create public folders for '.$sPortal.'! Please check the rights.';
69
+			throw new \Exception('The batch can`t create public folders for '.$sPortal.'! Please check the rights.');
70
+		}
71
+		else {
72 72
 
73
-            if (!file_exists($sPrivatePath.'Controller')) {
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);
78
-            }
79
-            else {
75
+				mkdir($sPublicPath . 'css', 0777, true);
76
+				mkdir($sPublicPath . 'js', 0777, true);
77
+				mkdir($sPublicPath . 'img', 0777, true);
78
+			}
79
+			else {
80 80
 
81
-                echo 'The Project (public part) ' . $sPrivatePath . " exists\n";
82
-            }
83
-        }
81
+				echo 'The Project (public part) ' . $sPrivatePath . " exists\n";
82
+			}
83
+		}
84 84
 
85 85
 		if (!is_writable($sActualDirectory.'/../../../')) {
86 86
 
@@ -98,19 +98,19 @@  discard block
 block discarded – undo
98 98
 				mkdir($sPrivatePath . 'conf', 0777, true);
99 99
 				mkdir($sPrivatePath . 'common', 0777, true);
100 100
 
101
-                $sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Controller.php');
102
-                $sContent = str_replace('Batch', $sPortal, $sContent);
103
-                file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Controller.php', $sContent);
101
+				$sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Controller.php');
102
+				$sContent = str_replace('Batch', $sPortal, $sContent);
103
+				file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Controller.php', $sContent);
104 104
 
105
-                $sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Model.php');
106
-                $sContent = str_replace('Batch', $sPortal, $sContent);
107
-                file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Model.php', $sContent);
105
+				$sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Model.php');
106
+				$sContent = str_replace('Batch', $sPortal, $sContent);
107
+				file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Model.php', $sContent);
108 108
 
109
-                $sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Entity.php');
110
-                $sContent = str_replace('Batch', $sPortal, $sContent);
111
-                file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Entity.php', $sContent);
109
+				$sContent = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'Entity.php');
110
+				$sContent = str_replace('Batch', $sPortal, $sContent);
111
+				file_put_contents($sPrivatePath.'common'.DIRECTORY_SEPARATOR.'Entity.php', $sContent);
112 112
 
113
-                $content = "<?php
113
+				$content = "<?php
114 114
 
115 115
 namespace Venus\\src\\".$sPortal."\\Controller;
116 116
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 }
130 130
 ";
131 131
 
132
-                file_put_contents($sPrivatePath.'Controller'.DIRECTORY_SEPARATOR.$sPortal.'.php', $content);
132
+				file_put_contents($sPrivatePath.'Controller'.DIRECTORY_SEPARATOR.$sPortal.'.php', $content);
133 133
 			}
134 134
 			else {
135 135
 
Please login to merge, or discard this patch.
bundles/conf/AutoLoad.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,44 +17,44 @@  discard block
 block discarded – undo
17 17
 spl_autoload_register(function (string $sClassName)
18 18
 {
19 19
 
20
-    $sClassName = ltrim($sClassName, '\\');
21
-    $sFileName  = '';
22
-    $iLastNsPos = strrpos($sClassName, '\\');
20
+	$sClassName = ltrim($sClassName, '\\');
21
+	$sFileName  = '';
22
+	$iLastNsPos = strrpos($sClassName, '\\');
23 23
 
24
-    if ($iLastNsPos) {
24
+	if ($iLastNsPos) {
25 25
 
26
-        $sNamespace = substr($sClassName, 0, $iLastNsPos);
27
-        $sClassName = substr($sClassName, $iLastNsPos + 1);
26
+		$sNamespace = substr($sClassName, 0, $iLastNsPos);
27
+		$sClassName = substr($sClassName, $iLastNsPos + 1);
28 28
 		$sFileName  = str_replace('\\', DIRECTORY_SEPARATOR, $sNamespace).DIRECTORY_SEPARATOR;
29
-    }
29
+	}
30 30
 
31
-    $sFileName = str_replace('/', '\\', $sFileName);
31
+	$sFileName = str_replace('/', '\\', $sFileName);
32 32
     
33
-    $sFileName .= $sClassName.'.php';
33
+	$sFileName .= $sClassName.'.php';
34 34
 
35
-    if (defined('PORTAL')) {
35
+	if (defined('PORTAL')) {
36 36
 
37
-        $sFileClassName = str_replace(PORTAL, PORTAL.DIRECTORY_SEPARATOR.'app', str_replace(['\\', '/'], DIRECTORY_SEPARATOR, str_replace('conf', DIRECTORY_SEPARATOR, __DIR__).str_replace('Venus\\', '', $sFileName)));
38
-        $sFileClassName = preg_replace('/(tests\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName);
39
-        $sFileClassName = preg_replace('/(src\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName);
40
-        $sFileClassName = str_replace('\\\\', '\\', $sFileClassName);
41
-        $sFileClassName = preg_replace('#bundles//tests/([^/]+)#', 'bundles/tests/$1/app', $sFileClassName);
42
-        $sFileClassName = preg_replace('#bundles//src/([^/]+)#', 'bundles/src/$1/app', $sFileClassName);
43
-        $sFileClassName = str_replace('app\\app', 'app', $sFileClassName);
44
-        $sFileClassName = str_replace('app/app', 'app', $sFileClassName);
37
+		$sFileClassName = str_replace(PORTAL, PORTAL.DIRECTORY_SEPARATOR.'app', str_replace(['\\', '/'], DIRECTORY_SEPARATOR, str_replace('conf', DIRECTORY_SEPARATOR, __DIR__).str_replace('Venus\\', '', $sFileName)));
38
+		$sFileClassName = preg_replace('/(tests\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName);
39
+		$sFileClassName = preg_replace('/(src\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName);
40
+		$sFileClassName = str_replace('\\\\', '\\', $sFileClassName);
41
+		$sFileClassName = preg_replace('#bundles//tests/([^/]+)#', 'bundles/tests/$1/app', $sFileClassName);
42
+		$sFileClassName = preg_replace('#bundles//src/([^/]+)#', 'bundles/src/$1/app', $sFileClassName);
43
+		$sFileClassName = str_replace('app\\app', 'app', $sFileClassName);
44
+		$sFileClassName = str_replace('app/app', 'app', $sFileClassName);
45 45
 
46
-        if (strstr($sFileName, 'Venus\\') && file_exists($sFileClassName)) {
46
+		if (strstr($sFileName, 'Venus\\') && file_exists($sFileClassName)) {
47 47
 
48
-        	require $sFileClassName;
49
-        }
50
-    }
51
-    else {
48
+			require $sFileClassName;
49
+		}
50
+	}
51
+	else {
52 52
 
53
-        if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) {
53
+		if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) {
54 54
 
55
-            require preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName)));
56
-        }
57
-    }
55
+			require preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName)));
56
+		}
57
+	}
58 58
 });
59 59
 
60 60
 /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 if (file_exists(preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php')) {
65 65
 
66
-    include preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php';
66
+	include preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php';
67 67
 }
68 68
 
69 69
 /**
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 
75 75
 if (isset($oConfig) && isset($oConfig->autoload)) {
76 76
     
77
-    $oAutoloadConf = $oConfig->autoload;
77
+	$oAutoloadConf = $oConfig->autoload;
78 78
     
79
-    foreach ($oAutoloadConf as $sFile) {
79
+	foreach ($oAutoloadConf as $sFile) {
80 80
     
81
-        require __DIR__.'/../'.$sFile;
82
-    }
81
+		require __DIR__.'/../'.$sFile;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
bundles/core/Router.php 1 patch
Indentation   +536 added lines, -536 removed lines patch added patch discarded remove patch
@@ -42,749 +42,749 @@
 block discarded – undo
42 42
  */
43 43
 class Router implements LoggerAwareInterface
44 44
 {
45
-    /**
46
-     * The base Uri to construct the route
47
-     *
48
-     * @access private
49
-     * @var    string
50
-     */
51
-    private $_sBaseUri = '';
52
-
53
-    /**
54
-     * get the security of page
55
-     *
56
-     * @access private
57
-     * @var    \Venus\core\Security
58
-     */
59
-    private $_oSecurity = null;
60
-
61
-    /**
62
-     * The Routes of the actual host
63
-     *
64
-     * @access private
65
-     * @var    object
66
-     */
67
-    private $_oRoutes = null;
68
-
69
-    /**
70
-     * Logger
71
-     *
72
-     * @access private
73
-     * @var    object
74
-     */
75
-    private $_oLogger = null;
76
-
77
-    /**
78
-     * constructor
79
-     *
80
-     * @access public
81
-     */
82
-    public function __construct()
83
-    {
84
-        $oLogger = Debug::getInstance();
85
-        $this->setLogger($oLogger);
86
-    }
87
-
88
-    /**
89
-     * run the routeur
90
-     *
91
-     * @access public
92
-     * @return null|boolean
93
-     */
94
-    public function run()
95
-    {
96
-        date_default_timezone_set(Config::get('Const')->timezone);
97
-
98
-        $this->_create_constant();
99
-
100
-        if (Request::isHttpRequest()) {
45
+	/**
46
+	 * The base Uri to construct the route
47
+	 *
48
+	 * @access private
49
+	 * @var    string
50
+	 */
51
+	private $_sBaseUri = '';
52
+
53
+	/**
54
+	 * get the security of page
55
+	 *
56
+	 * @access private
57
+	 * @var    \Venus\core\Security
58
+	 */
59
+	private $_oSecurity = null;
60
+
61
+	/**
62
+	 * The Routes of the actual host
63
+	 *
64
+	 * @access private
65
+	 * @var    object
66
+	 */
67
+	private $_oRoutes = null;
68
+
69
+	/**
70
+	 * Logger
71
+	 *
72
+	 * @access private
73
+	 * @var    object
74
+	 */
75
+	private $_oLogger = null;
76
+
77
+	/**
78
+	 * constructor
79
+	 *
80
+	 * @access public
81
+	 */
82
+	public function __construct()
83
+	{
84
+		$oLogger = Debug::getInstance();
85
+		$this->setLogger($oLogger);
86
+	}
87
+
88
+	/**
89
+	 * run the routeur
90
+	 *
91
+	 * @access public
92
+	 * @return null|boolean
93
+	 */
94
+	public function run()
95
+	{
96
+		date_default_timezone_set(Config::get('Const')->timezone);
97
+
98
+		$this->_create_constant();
99
+
100
+		if (Request::isHttpRequest()) {
101 101
         
102
-            // Search if a Less file exists
103
-            if (defined('LESS_ACTIVE') && LESS_ACTIVE === true) {
102
+			// Search if a Less file exists
103
+			if (defined('LESS_ACTIVE') && LESS_ACTIVE === true) {
104 104
 
105
-                if (strstr($_SERVER['REQUEST_URI'], '.css')
106
-                    && file_exists(preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) {
105
+				if (strstr($_SERVER['REQUEST_URI'], '.css')
106
+					&& file_exists(preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) {
107 107
 
108
-                    Less::toCss($_SERVER['REQUEST_URI']);
109
-                    exit;
110
-                }
111
-            }
108
+					Less::toCss($_SERVER['REQUEST_URI']);
109
+					exit;
110
+				}
111
+			}
112 112
 
113
-            // Search if a typescript file exists
114
-            if (defined('TYPESCRIPT_ACTIVE') && TYPESCRIPT_ACTIVE === true) {
113
+			// Search if a typescript file exists
114
+			if (defined('TYPESCRIPT_ACTIVE') && TYPESCRIPT_ACTIVE === true) {
115 115
 
116
-                if (strstr($_SERVER['REQUEST_URI'], '.js')
117
-                && file_exists(preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) {
116
+				if (strstr($_SERVER['REQUEST_URI'], '.js')
117
+				&& file_exists(preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) {
118 118
 
119
-                    Typescript::toJs($_SERVER['REQUEST_URI']);
120
-                    exit;
121
-                }
122
-            }
119
+					Typescript::toJs($_SERVER['REQUEST_URI']);
120
+					exit;
121
+				}
122
+			}
123 123
 
124
-            // Search public files in all plugins
125
-            if ($_SERVER['REQUEST_URI'] !== '/') {
124
+			// Search public files in all plugins
125
+			if ($_SERVER['REQUEST_URI'] !== '/') {
126 126
 
127
-                foreach (Config::get('Plugins')->list as $iKey => $sPlugin) {
127
+				foreach (Config::get('Plugins')->list as $iKey => $sPlugin) {
128 128
 
129
-                    if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI'])) {
129
+					if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI'])) {
130 130
 
131
-                        echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']);
132
-                        exit;
133
-                    } else if (strstr($_SERVER['REQUEST_URI'], '.css')
134
-                        && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) {
131
+						echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']);
132
+						exit;
133
+					} else if (strstr($_SERVER['REQUEST_URI'], '.css')
134
+						&& file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) {
135 135
 
136
-                        Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']));
137
-                        exit;
138
-                    } else if (strstr($_SERVER['REQUEST_URI'], '.js')
139
-                        && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) {
136
+						Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']));
137
+						exit;
138
+					} else if (strstr($_SERVER['REQUEST_URI'], '.js')
139
+						&& file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) {
140 140
 
141
-                        Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']));
142
-                        exit;
143
-                    }
144
-                }
145
-            }
141
+						Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']));
142
+						exit;
143
+					}
144
+				}
145
+			}
146 146
 
147
-            foreach (Config::get('Route') as $sMultiHost => $oHost) {
147
+			foreach (Config::get('Route') as $sMultiHost => $oHost) {
148 148
 
149
-                foreach (explode(',', $sMultiHost) as $sHost) {
149
+				foreach (explode(',', $sMultiHost) as $sHost) {
150 150
 
151
-                    if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST']) || (strstr($sHost, '/')
152
-                        && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
151
+					if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST']) || (strstr($sHost, '/')
152
+						&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
153 153
     
154
-                        $this->_oRoutes = $oHost;
154
+						$this->_oRoutes = $oHost;
155 155
 
156
-                        if (strstr($sHost, '/')
157
-                            && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
156
+						if (strstr($sHost, '/')
157
+							&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
158 158
 
159
-                            $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
160
-                        }
159
+							$this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
160
+						}
161 161
     
162
-                        if (isset($oHost->location)) {
162
+						if (isset($oHost->location)) {
163 163
     
164
-                            header('Status: 301 Moved Permanently', false, 301);
165
-                            header('Location: '.$oHost->location);
166
-                            exit;
167
-                        } else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) {
164
+							header('Status: 301 Moved Permanently', false, 301);
165
+							header('Location: '.$oHost->location);
166
+							exit;
167
+						} else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) {
168 168
 
169
-                            foreach ($_GET as $sKey => $sValue) {
169
+							foreach ($_GET as $sKey => $sValue) {
170 170
 
171
-                                if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')) {
171
+								if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')) {
172 172
 
173
-                                    echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')."\n";
174
-                                }
175
-                            }
173
+									echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')."\n";
174
+								}
175
+							}
176 176
 
177
-                            exit;
178
-                        } else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) {
177
+							exit;
178
+						} else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) {
179 179
 
180
-                            foreach ($_GET as $sKey => $sValue) {
180
+							foreach ($_GET as $sKey => $sValue) {
181 181
 
182
-                                if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')) {
182
+								if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')) {
183 183
 
184
-                                    echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')."\n";
185
-                                }
186
-                            }
184
+									echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')."\n";
185
+								}
186
+							}
187 187
 
188
-                            exit;
189
-                        } else if (isset($oHost->routes)) {
188
+							exit;
189
+						} else if (isset($oHost->routes)) {
190 190
     
191
-                            foreach ($oHost->routes as $sKey => $oRoute) {
191
+							foreach ($oHost->routes as $sKey => $oRoute) {
192 192
 
193
-                                $mReturn = $this->_route($oRoute, $_SERVER['REQUEST_URI']);
193
+								$mReturn = $this->_route($oRoute, $_SERVER['REQUEST_URI']);
194 194
 
195
-                                if ($mReturn === 403) {
195
+								if ($mReturn === 403) {
196 196
     
197
-                                    $this->_getPage403();
198
-                                }
199
-                                else if ($mReturn === true) {
197
+									$this->_getPage403();
198
+								}
199
+								else if ($mReturn === true) {
200 200
     
201
-                                    if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); }
201
+									if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); }
202 202
     
203
-                                    return true;
204
-                                }
205
-                            }
203
+									return true;
204
+								}
205
+							}
206 206
     
207
-                            $this->_getPage404();
208
-                        }
209
-                    }
210
-                }
211
-            }
212
-        } else if (Request::isCliRequest()) {
207
+							$this->_getPage404();
208
+						}
209
+					}
210
+				}
211
+			}
212
+		} else if (Request::isCliRequest()) {
213 213
 
214
-            if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; }
215
-            else { $aArguments = []; }
214
+			if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; }
215
+			else { $aArguments = []; }
216 216
 
217
-            define('PORTAL', 'Batch');
218
-            set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
217
+			define('PORTAL', 'Batch');
218
+			set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
219 219
 
220
-            if (!isset($aArguments[1]) && strstr($aArguments[0], '/phpunit')) {
220
+			if (!isset($aArguments[1]) && strstr($aArguments[0], '/phpunit')) {
221 221
 
222
-                $sBatchName = "phpunit";
223
-                $aArguments[0] = "bin/console";
224
-                $aArguments[1] = "phpunit";
225
-            } else {
226
-                $sBatchName = $aArguments[1];
227
-            }
222
+				$sBatchName = "phpunit";
223
+				$aArguments[0] = "bin/console";
224
+				$aArguments[1] = "phpunit";
225
+			} else {
226
+				$sBatchName = $aArguments[1];
227
+			}
228 228
 
229
-            if (isset(Config::get('Route')->batch->script->{$sBatchName})) {
229
+			if (isset(Config::get('Route')->batch->script->{$sBatchName})) {
230 230
 
231
-                $oBatch = Config::get('Route')->batch->script->{$sBatchName};
232
-                array_shift($aArguments);
233
-                array_shift($aArguments);
231
+				$oBatch = Config::get('Route')->batch->script->{$sBatchName};
232
+				array_shift($aArguments);
233
+				array_shift($aArguments);
234 234
 
235
-                $aOptions = array();
235
+				$aOptions = array();
236 236
 
237
-                while (count($aArguments) > 0) {
237
+				while (count($aArguments) > 0) {
238 238
 
239
-                    if (preg_match('/^-[a-z]/', $aArguments[0])) {
239
+					if (preg_match('/^-[a-z]/', $aArguments[0])) {
240 240
 
241
-                        $sOptionName = str_replace('-', '', $aArguments[0]);
241
+						$sOptionName = str_replace('-', '', $aArguments[0]);
242 242
 
243
-                        if (isset($aArguments[1])) {
244
-                            $sOptionValue = $aArguments[1];
245
-                        } else {
246
-                            $sOptionValue = '';
247
-                        }
243
+						if (isset($aArguments[1])) {
244
+							$sOptionValue = $aArguments[1];
245
+						} else {
246
+							$sOptionValue = '';
247
+						}
248 248
 
249
-                        if (isset($oBatch->options->$sOptionName) && $oBatch->options->$sOptionName === false) {
249
+						if (isset($oBatch->options->$sOptionName) && $oBatch->options->$sOptionName === false) {
250 250
 
251
-                            $aOptions[$sOptionName] = true;
252
-                            array_shift($aArguments);
253
-                        } else if (isset($oBatch->options->$sOptionName) && ($oBatch->options->$sOptionName === 'string'
254
-                                || $oBatch->options->$sOptionName === 'int')
255
-                        ) {
251
+							$aOptions[$sOptionName] = true;
252
+							array_shift($aArguments);
253
+						} else if (isset($oBatch->options->$sOptionName) && ($oBatch->options->$sOptionName === 'string'
254
+								|| $oBatch->options->$sOptionName === 'int')
255
+						) {
256 256
 
257
-                            $aOptions[$sOptionName] = $sOptionValue;
258
-                            array_shift($aArguments);
259
-                            array_shift($aArguments);
260
-                        } else {
257
+							$aOptions[$sOptionName] = $sOptionValue;
258
+							array_shift($aArguments);
259
+							array_shift($aArguments);
260
+						} else {
261 261
 
262
-                            array_shift($aArguments);
263
-                        }
264
-                    } else {
262
+							array_shift($aArguments);
263
+						}
264
+					} else {
265 265
 
266
-                        array_shift($aArguments);
267
-                    }
268
-                }
269
-            }
266
+						array_shift($aArguments);
267
+					}
268
+				}
269
+			}
270 270
 
271
-            if (isset($oBatch->controller) && isset($oBatch->action)) {
271
+			if (isset($oBatch->controller) && isset($oBatch->action)) {
272 272
 
273
-                echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions));
274
-            } else {
273
+				echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions));
274
+			} else {
275 275
 
276
-                if (Request::isCliRequest()) {
276
+				if (Request::isCliRequest()) {
277 277
 
278
-                    echo "Error : The batch not exists - please verify your Route or the name passed in your command name.\n";
279
-                }
280
-            }
278
+					echo "Error : The batch not exists - please verify your Route or the name passed in your command name.\n";
279
+				}
280
+			}
281 281
 
282
-        }
283
-    }
282
+		}
283
+	}
284 284
 
285
-    /**
286
-     * run the routeur by the forwarsd metho (in the controller)
287
-     *
288
-     * @access public
289
-     * @param  string $sRoute route we wantload
290
-     * @param  array $aParams parameters to passe
291
-     * @return void
292
-     */
293
-    public function runByFoward(string $sRoute, array $aParams)
294
-    {
295
-        $this->_create_constant();
285
+	/**
286
+	 * run the routeur by the forwarsd metho (in the controller)
287
+	 *
288
+	 * @access public
289
+	 * @param  string $sRoute route we wantload
290
+	 * @param  array $aParams parameters to passe
291
+	 * @return void
292
+	 */
293
+	public function runByFoward(string $sRoute, array $aParams)
294
+	{
295
+		$this->_create_constant();
296 296
 
297
-        if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
297
+		if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
298 298
 
299
-            foreach (Config::get('Route') as $sHost => $oHost) {
299
+			foreach (Config::get('Route') as $sHost => $oHost) {
300 300
 
301
-                if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
302
-                    || (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
301
+				if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
302
+					|| (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
303 303
 
304
-                    $this->_oRoutes = $oHost;
304
+					$this->_oRoutes = $oHost;
305 305
 
306
-                    if (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
306
+					if (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
307 307
 
308
-                        $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
309
-                    }
308
+						$this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
309
+					}
310 310
 
311
-                    foreach ($oHost->routes as $sKey => $oRoute) {
311
+					foreach ($oHost->routes as $sKey => $oRoute) {
312 312
 
313
-                        $this->_route($oRoute, $sRoute);
314
-                    }
315
-                }
316
-            }
317
-        }
318
-        else if (defined('STDIN')) {
313
+						$this->_route($oRoute, $sRoute);
314
+					}
315
+				}
316
+			}
317
+		}
318
+		else if (defined('STDIN')) {
319 319
 
320
-            $oBatch = Config::get('Route')->batch->script->{$sRoute};
321
-            echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams);
322
-        }
323
-    }
320
+			$oBatch = Config::get('Route')->batch->script->{$sRoute};
321
+			echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams);
322
+		}
323
+	}
324 324
 
325
-    /**
326
-     * run the error http page
327
-     *
328
-     * @access public
329
-     * @param  int iError http error
330
-     * @return void
331
-     */
332
-    public function runHttpErrorPage(int $iError)
333
-    {
334
-        $this->_create_constant();
325
+	/**
326
+	 * run the error http page
327
+	 *
328
+	 * @access public
329
+	 * @param  int iError http error
330
+	 * @return void
331
+	 */
332
+	public function runHttpErrorPage(int $iError)
333
+	{
334
+		$this->_create_constant();
335 335
 
336
-        if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
336
+		if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
337 337
 
338
-            foreach (Config::get('Route') as $sHost => $oHost) {
338
+			foreach (Config::get('Route') as $sHost => $oHost) {
339 339
 
340
-                if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
341
-                    || (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
340
+				if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
341
+					|| (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
342 342
 
343
-                    $this->_oRoutes = $oHost->routes;
343
+					$this->_oRoutes = $oHost->routes;
344 344
 
345
-                    if (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
345
+					if (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
346 346
 
347
-                        $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
348
-                    }
347
+						$this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
348
+					}
349 349
 
350
-                    $sHttpErrorPageName = '_getPage'.iError;
351
-                    $this->$sHttpErrorPageName();
352
-                }
353
-            }
354
-        }
355
-    }
350
+					$sHttpErrorPageName = '_getPage'.iError;
351
+					$this->$sHttpErrorPageName();
352
+				}
353
+			}
354
+		}
355
+	}
356 356
 
357
-    /**
358
-     * load a route
359
-     *
360
-     * @access private
361
-     * @param  \stdClass $oRoute one route
362
-     * @param  string $RequestUri URI
363
-     * @return void
364
-     */
365
-    private function _route(\stdClass $oRoute, string $RequestUri)
366
-    {
367
-        $sCharset = 'UTF-8';
357
+	/**
358
+	 * load a route
359
+	 *
360
+	 * @access private
361
+	 * @param  \stdClass $oRoute one route
362
+	 * @param  string $RequestUri URI
363
+	 * @return void
364
+	 */
365
+	private function _route(\stdClass $oRoute, string $RequestUri)
366
+	{
367
+		$sCharset = 'UTF-8';
368 368
 
369
-        if (isset($oRoute->route)) {
369
+		if (isset($oRoute->route)) {
370 370
 
371
-            $sRoute = str_replace("*", ".*", $oRoute->route);
371
+			$sRoute = str_replace("*", ".*", $oRoute->route);
372 372
 
373
-            $sFinalRoute = preg_replace_callback(
374
-                '|\[/{0,1}:([a-zA-Z_]+)\]|',
375
-                function($aMatches) use ($oRoute) {
376
-                    return "/{0,1}(?P<".$aMatches[1].">".$oRoute->constraints->{$aMatches[1]}.")";
377
-                },
378
-                $sRoute
379
-            );
380
-        }
381
-        else {
373
+			$sFinalRoute = preg_replace_callback(
374
+				'|\[/{0,1}:([a-zA-Z_]+)\]|',
375
+				function($aMatches) use ($oRoute) {
376
+					return "/{0,1}(?P<".$aMatches[1].">".$oRoute->constraints->{$aMatches[1]}.")";
377
+				},
378
+				$sRoute
379
+			);
380
+		}
381
+		else {
382 382
 
383
-            $sFinalRoute = '.*';
384
-        }
383
+			$sFinalRoute = '.*';
384
+		}
385 385
 
386
-        $RequestUri = preg_replace('/^([^?]+)\?.*$/', '$1', $RequestUri);
387
-        $RequestUri = preg_replace('#^'.$this->_sBaseUri.'#', '', $RequestUri);
386
+		$RequestUri = preg_replace('/^([^?]+)\?.*$/', '$1', $RequestUri);
387
+		$RequestUri = preg_replace('#^'.$this->_sBaseUri.'#', '', $RequestUri);
388 388
 
389
-        if (preg_match('#^'.$sFinalRoute.'$#', $RequestUri, $aMatch)) {
389
+		if (preg_match('#^'.$sFinalRoute.'$#', $RequestUri, $aMatch)) {
390 390
 
391
-            if (isset($oRoute->location)) {
391
+			if (isset($oRoute->location)) {
392 392
 
393
-                $aParamEntries = array();
393
+				$aParamEntries = array();
394 394
 
395
-                foreach ($oRoute->constraints as $sName => $sType) {
395
+				foreach ($oRoute->constraints as $sName => $sType) {
396 396
 
397
-                    if (isset($aMatch[$sName])) {
397
+					if (isset($aMatch[$sName])) {
398 398
 
399
-                        $aParamEntries[$sName] = $aMatch[$sName];
400
-                    }
401
-                }
399
+						$aParamEntries[$sName] = $aMatch[$sName];
400
+					}
401
+				}
402 402
 
403
-                $oUrlManager = new UrlManager;
404
-                header('Status: 301 Moved Permanently', false, 301);
405
-                header('Location: '.$oUrlManager->getUrl($oRoute->location, $aParamEntries));
406
-                exit;
407
-            }
403
+				$oUrlManager = new UrlManager;
404
+				header('Status: 301 Moved Permanently', false, 301);
405
+				header('Location: '.$oUrlManager->getUrl($oRoute->location, $aParamEntries));
406
+				exit;
407
+			}
408 408
 
409
-            $this->_oSecurity = new Security;
409
+			$this->_oSecurity = new Security;
410 410
 
411
-            if (!$this->_oSecurity->checkSecurity() !== null) { return 403; }
411
+			if (!$this->_oSecurity->checkSecurity() !== null) { return 403; }
412 412
 
413
-            // create the $_GET by the URL
413
+			// create the $_GET by the URL
414 414
 
415
-            foreach ($aMatch as $mKey => $sResults) {
415
+			foreach ($aMatch as $mKey => $sResults) {
416 416
 
417
-                if (is_string($mKey)) {
417
+				if (is_string($mKey)) {
418 418
 
419
-                    $_GET[$mKey] = $sResults;
420
-                }
421
-            }
419
+					$_GET[$mKey] = $sResults;
420
+				}
421
+			}
422 422
 
423
-            if (isset($oRoute->methods) && $oRoute->methods != $_SERVER['REQUEST_METHOD']) { return false; }
423
+			if (isset($oRoute->methods) && $oRoute->methods != $_SERVER['REQUEST_METHOD']) { return false; }
424 424
 
425
-            if (isset($oRoute->schemes) && $oRoute->schemes == 'https' && !Request::isHttpsRequest()) { return false; }
425
+			if (isset($oRoute->schemes) && $oRoute->schemes == 'https' && !Request::isHttpsRequest()) { return false; }
426 426
 
427
-            if (isset($oRoute->cache) && isset($oRoute->cache->max_age) && !isset($_GET['flush'])) {
427
+			if (isset($oRoute->cache) && isset($oRoute->cache->max_age) && !isset($_GET['flush'])) {
428 428
 
429
-                $oMobileDetect = new \Mobile_Detect;
429
+				$oMobileDetect = new \Mobile_Detect;
430 430
 
431
-                if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
432
-                else { $sCacheExt = ''; }
431
+				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
432
+				else { $sCacheExt = ''; }
433 433
 
434
-                $mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age);
434
+				$mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age);
435 435
 
436
-                if ($mCacheReturn && count($_POST) < 1) {
436
+				if ($mCacheReturn && count($_POST) < 1) {
437 437
 
438
-                    echo $mCacheReturn;
439
-                    return true;
440
-                }
441
-            }
438
+					echo $mCacheReturn;
439
+					return true;
440
+				}
441
+			}
442 442
 
443
-            if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); }
443
+			if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); }
444 444
 
445
-            if (isset($oRoute->controller)) {
445
+			if (isset($oRoute->controller)) {
446 446
 
447
-                define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->controller));
448
-                set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
447
+				define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->controller));
448
+				set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
449 449
 
450
-                if (isset($oRoute->content_type)) {
450
+				if (isset($oRoute->content_type)) {
451 451
 
452
-                    if ($oRoute->content_type == 'json') {
452
+					if ($oRoute->content_type == 'json') {
453 453
 
454
-                        header('Content-type: application/json; charset='.$sCharset.'');
455
-                    } else if ($oRoute->content_type == 'html') {
454
+						header('Content-type: application/json; charset='.$sCharset.'');
455
+					} else if ($oRoute->content_type == 'html') {
456 456
 
457
-                        header('Content-type: text/html; charset='.$sCharset.'');
458
-                    } else if ($oRoute->content_type == 'jpeg') {
457
+						header('Content-type: text/html; charset='.$sCharset.'');
458
+					} else if ($oRoute->content_type == 'jpeg') {
459 459
 
460
-                        header('Content-type: image/jpeg');
461
-                    }
462
-                }
463
-                else {
460
+						header('Content-type: image/jpeg');
461
+					}
462
+				}
463
+				else {
464 464
 
465
-                    header('Content-type: text/html; charset='.$sCharset.'');
466
-                }
465
+					header('Content-type: text/html; charset='.$sCharset.'');
466
+				}
467 467
 
468
-                $sControllerName = $oRoute->controller;
469
-                $sActionName = $oRoute->action;
468
+				$sControllerName = $oRoute->controller;
469
+				$sActionName = $oRoute->action;
470 470
 
471
-                $oController = new $sControllerName;
471
+				$oController = new $sControllerName;
472 472
 
473
-                $aEntries = array();
473
+				$aEntries = array();
474 474
 
475
-                if (isset($oRoute->constraints) && is_object($oRoute->constraints)) {
475
+				if (isset($oRoute->constraints) && is_object($oRoute->constraints)) {
476 476
 
477
-                    $mReturn = null;
477
+					$mReturn = null;
478 478
 
479
-                    foreach ($oRoute->constraints as $sName => $sType) {
479
+					foreach ($oRoute->constraints as $sName => $sType) {
480 480
 
481
-                        if (isset($_GET[$sName]) && $_GET[$sName] != '') {
481
+						if (isset($_GET[$sName]) && $_GET[$sName] != '') {
482 482
 
483
-                            $aEntries[] = $_GET[$sName];
484
-                        } else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints)
485
-                            && isset($oRoute->defaults_constraints->{$sName})) {
483
+							$aEntries[] = $_GET[$sName];
484
+						} else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints)
485
+							&& isset($oRoute->defaults_constraints->{$sName})) {
486 486
 
487
-                            $aEntries[] = $oRoute->defaults_constraints->{$sName};
488
-                        } else if (isset($_GET[$sName])) {
487
+							$aEntries[] = $oRoute->defaults_constraints->{$sName};
488
+						} else if (isset($_GET[$sName])) {
489 489
 
490
-                            $aEntries[] = $_GET[$sName];
491
-                        } else if (preg_match('/'.$sType.'/', '')) {
490
+							$aEntries[] = $_GET[$sName];
491
+						} else if (preg_match('/'.$sType.'/', '')) {
492 492
 
493
-                            $aEntries[] = '';
494
-                        } else {
493
+							$aEntries[] = '';
494
+						} else {
495 495
 
496
-                            $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!');
497
-                            break;
498
-                        }
499
-                    }
496
+							$this->_oLogger->warning('Error: Parameter '.$sName.' not exists!');
497
+							break;
498
+						}
499
+					}
500 500
 
501
-                    if ($mReturn === null) {
501
+					if ($mReturn === null) {
502 502
 
503
-                        $mReturn = $this->_loadController($oController, $sActionName, $aEntries);
503
+						$mReturn = $this->_loadController($oController, $sActionName, $aEntries);
504 504
 
505
-                    }
506
-                }
507
-                else {
505
+					}
506
+				}
507
+				else {
508 508
 
509
-                    $mReturn = $this->_loadController($oController, $sActionName, $aEntries);
510
-                }
509
+					$mReturn = $this->_loadController($oController, $sActionName, $aEntries);
510
+				}
511 511
 
512
-                if (isset($oRoute->content_type)) {
512
+				if (isset($oRoute->content_type)) {
513 513
 
514
-                    if ($oRoute->content_type === 'json') {
514
+					if ($oRoute->content_type === 'json') {
515 515
 
516
-                        $mReturn = json_encode($mReturn, JSON_PRETTY_PRINT);
517
-                    }
518
-                }
519
-            }
520
-            else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) {
516
+						$mReturn = json_encode($mReturn, JSON_PRETTY_PRINT);
517
+					}
518
+				}
519
+			}
520
+			else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) {
521 521
 
522
-                define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
523
-                set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
522
+				define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
523
+				set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
524 524
 
525
-                $oLayout = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl');
525
+				$oLayout = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl');
526 526
 
527
-                if (isset($oRoute->vars)) {
527
+				if (isset($oRoute->vars)) {
528 528
 
529
-                    foreach ($oRoute->vars as $sKey => $mValue) {
529
+					foreach ($oRoute->vars as $sKey => $mValue) {
530 530
 
531
-                        $oLayout->assign($sKey, $mValue);
532
-                    }
533
-                }
531
+						$oLayout->assign($sKey, $mValue);
532
+					}
533
+				}
534 534
 
535
-                $mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl')
536
-                                   ->fetch();
537
-            }
538
-            else if (isset($oRoute->template)) {
535
+				$mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl')
536
+								   ->fetch();
537
+			}
538
+			else if (isset($oRoute->template)) {
539 539
 
540
-                define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
541
-                set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
540
+				define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
541
+				set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
542 542
 
543
-                $oTemplate = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl');
543
+				$oTemplate = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl');
544 544
 
545
-                if (isset($oRoute->vars)) {
545
+				if (isset($oRoute->vars)) {
546 546
 
547
-                    foreach ($oRoute->vars as $sKey => $mValue) {
547
+					foreach ($oRoute->vars as $sKey => $mValue) {
548 548
 
549
-                        $oTemplate->assign($sKey, $mValue);
550
-                    }
551
-                }
549
+						$oTemplate->assign($sKey, $mValue);
550
+					}
551
+				}
552 552
 
553
-                $mReturn = $oTemplate->fetch();
554
-            }
553
+				$mReturn = $oTemplate->fetch();
554
+			}
555 555
 
556
-            // management of return or cache of it
556
+			// management of return or cache of it
557 557
 
558
-            if (isset($oRoute->cache) && isset($oRoute->cache->max_age) && $mReturn) {
558
+			if (isset($oRoute->cache) && isset($oRoute->cache->max_age) && $mReturn) {
559 559
 
560
-                $oMobileDetect = new \Mobile_Detect;
560
+				$oMobileDetect = new \Mobile_Detect;
561 561
 
562
-                if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
563
-                else { $sCacheExt = ''; }
562
+				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
563
+				else { $sCacheExt = ''; }
564 564
 
565
-                if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
565
+				if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
566 566
 
567
-                    $mReturn = str_replace(array("\t", "\r", "  "), array("", "", " "), $mReturn);
568
-                }
567
+					$mReturn = str_replace(array("\t", "\r", "  "), array("", "", " "), $mReturn);
568
+				}
569 569
 
570
-                Cache::set($RequestUri.$sCacheExt, $mReturn, $oRoute->cache->max_age);
571
-            }
570
+				Cache::set($RequestUri.$sCacheExt, $mReturn, $oRoute->cache->max_age);
571
+			}
572 572
 
573
-            if ($mReturn) {
573
+			if ($mReturn) {
574 574
 
575
-                echo $mReturn;
576
-                return true;
577
-            }
578
-        }
579
-    }
575
+				echo $mReturn;
576
+				return true;
577
+			}
578
+		}
579
+	}
580 580
 
581
-    /**
582
-     * create the constants
583
-     *
584
-     * @access private
585
-     * @return void
586
-     */
587
-    private function _create_constant()
588
-    {
589
-        foreach (Config::get('Const') as $sKey => $mValue) {
581
+	/**
582
+	 * create the constants
583
+	 *
584
+	 * @access private
585
+	 * @return void
586
+	 */
587
+	private function _create_constant()
588
+	{
589
+		foreach (Config::get('Const') as $sKey => $mValue) {
590 590
 
591
-            if (is_string($mValue) || is_int($mValue) || is_float($mValue) || is_bool($mValue)) {
591
+			if (is_string($mValue) || is_int($mValue) || is_float($mValue) || is_bool($mValue)) {
592 592
 
593
-                define(strtoupper($sKey), $mValue);
594
-            }
595
-        }
596
-    }
593
+				define(strtoupper($sKey), $mValue);
594
+			}
595
+		}
596
+	}
597 597
 
598
-    /**
599
-     * load the controller
600
-     *
601
-     * @access private
602
-     * @param  object $oControllerName controller name
603
-     * @param  string $sActionName method name
604
-     * @param  array $aParams parameters
605
-     * @return mixed
606
-     */
607
-    private function _loadController($oControllerName, string $sActionName, array $aParams = array())
608
-    {
609
-        $aPhpDoc = PhpDoc::getPhpDocOfMethod($oControllerName, $sActionName);
598
+	/**
599
+	 * load the controller
600
+	 *
601
+	 * @access private
602
+	 * @param  object $oControllerName controller name
603
+	 * @param  string $sActionName method name
604
+	 * @param  array $aParams parameters
605
+	 * @return mixed
606
+	 */
607
+	private function _loadController($oControllerName, string $sActionName, array $aParams = array())
608
+	{
609
+		$aPhpDoc = PhpDoc::getPhpDocOfMethod($oControllerName, $sActionName);
610 610
 
611
-        if (isset($aPhpDoc['Cache'])) {
611
+		if (isset($aPhpDoc['Cache'])) {
612 612
 
613
-            if (!isset($aPhpDoc['Cache']['maxage'])) { $aPhpDoc['Cache']['maxage'] = 0; }
613
+			if (!isset($aPhpDoc['Cache']['maxage'])) { $aPhpDoc['Cache']['maxage'] = 0; }
614 614
 
615
-            $oMobileDetect = new \Mobile_Detect;
615
+			$oMobileDetect = new \Mobile_Detect;
616 616
 
617
-            if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
618
-            else { $sCacheExt = ''; }
617
+			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
618
+			else { $sCacheExt = ''; }
619 619
 
620
-            $mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']);
620
+			$mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']);
621 621
 
622
-            if ($mCacheReturn !== false) { return $mCacheReturn; }
623
-        }
622
+			if ($mCacheReturn !== false) { return $mCacheReturn; }
623
+		}
624 624
 
625
-        if (isset($aPhpDoc['Secure'])) {
625
+		if (isset($aPhpDoc['Secure'])) {
626 626
 
627
-            if (isset($aPhpDoc['Secure']['roles']) && $this->_oSecurity->getUserRole() != $aPhpDoc['Secure']['roles']) {
627
+			if (isset($aPhpDoc['Secure']['roles']) && $this->_oSecurity->getUserRole() != $aPhpDoc['Secure']['roles']) {
628 628
 
629
-                $this->_getPage403();
630
-            }
631
-        }
629
+				$this->_getPage403();
630
+			}
631
+		}
632 632
 
633
-        $oController = new $oControllerName;
633
+		$oController = new $oControllerName;
634 634
 
635
-        ob_start();
635
+		ob_start();
636 636
 
637
-        if (!defined('PORTAL')) { define('PORTAL', 'Batch'); }
637
+		if (!defined('PORTAL')) { define('PORTAL', 'Batch'); }
638 638
 
639
-        if (method_exists($oController, 'beforeExecuteRoute')) {
639
+		if (method_exists($oController, 'beforeExecuteRoute')) {
640 640
 
641
-            call_user_func_array(array($oController, 'beforeExecuteRoute'), array());
642
-        }
641
+			call_user_func_array(array($oController, 'beforeExecuteRoute'), array());
642
+		}
643 643
 
644
-        $mReturnController = call_user_func_array(array($oController, $sActionName), $aParams);
644
+		$mReturnController = call_user_func_array(array($oController, $sActionName), $aParams);
645 645
 
646
-        if (method_exists($oController, 'afterExecuteRoute')) {
646
+		if (method_exists($oController, 'afterExecuteRoute')) {
647 647
 
648
-            call_user_func_array(array($oController, 'afterExecuteRoute'), array());
649
-        }
648
+			call_user_func_array(array($oController, 'afterExecuteRoute'), array());
649
+		}
650 650
 
651
-        $mReturn = ob_get_clean();
651
+		$mReturn = ob_get_clean();
652 652
 
653
-        if ($mReturn == '') { $mReturn = $mReturnController; }
653
+		if ($mReturn == '') { $mReturn = $mReturnController; }
654 654
 
655
-        if (isset($aPhpDoc['Cache'])) {
655
+		if (isset($aPhpDoc['Cache'])) {
656 656
 
657
-            $oMobileDetect = new \Mobile_Detect;
657
+			$oMobileDetect = new \Mobile_Detect;
658 658
 
659
-            if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
660
-            else { $sCacheExt = ''; }
659
+			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
660
+			else { $sCacheExt = ''; }
661 661
 
662
-            if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
662
+			if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
663 663
 
664
-                $mReturn = str_replace(array("\t", "\r", "  "), array("", "", "", " "), $mReturn);
665
-            }
664
+				$mReturn = str_replace(array("\t", "\r", "  "), array("", "", "", " "), $mReturn);
665
+			}
666 666
 
667
-            Cache::set($sActionName.$sCacheExt, $mReturn, $aPhpDoc['Cache']['maxage']);
668
-        }
667
+			Cache::set($sActionName.$sCacheExt, $mReturn, $aPhpDoc['Cache']['maxage']);
668
+		}
669 669
 
670
-        return $mReturn;
671
-    }
670
+		return $mReturn;
671
+	}
672 672
 
673
-    /**
674
-     * get the page 403
675
-     *
676
-     * @access private
677
-     * @return void
678
-     */
679
-    private function _getPage403()
680
-    {
681
-        header("HTTP/1.0 403 Forbidden");
673
+	/**
674
+	 * get the page 403
675
+	 *
676
+	 * @access private
677
+	 * @return void
678
+	 */
679
+	private function _getPage403()
680
+	{
681
+		header("HTTP/1.0 403 Forbidden");
682 682
 
683
-        if (isset($this->_oRoutes->e403)) {
683
+		if (isset($this->_oRoutes->e403)) {
684 684
 
685
-            $this->_oRoutes->e403->route = '/';
686
-            $_SERVER['REQUEST_URI'] = '/';
687
-            $this->_route($this->_oRoutes->e403, $_SERVER['REQUEST_URI']);
688
-        }
685
+			$this->_oRoutes->e403->route = '/';
686
+			$_SERVER['REQUEST_URI'] = '/';
687
+			$this->_route($this->_oRoutes->e403, $_SERVER['REQUEST_URI']);
688
+		}
689 689
 
690
-        exit;
691
-    }
690
+		exit;
691
+	}
692 692
 
693
-    /**
694
-     * get the page 404
695
-     *
696
-     * @access private
697
-     * @return void
698
-     */
699
-    private function _getPage404()
700
-    {
701
-        header("HTTP/1.0 404 Not Found");
693
+	/**
694
+	 * get the page 404
695
+	 *
696
+	 * @access private
697
+	 * @return void
698
+	 */
699
+	private function _getPage404()
700
+	{
701
+		header("HTTP/1.0 404 Not Found");
702 702
 
703
-        if (isset($this->_oRoutes->e404)) {
703
+		if (isset($this->_oRoutes->e404)) {
704 704
 
705
-            $this->_oRoutes->e404->route = '/';
706
-            $_SERVER['REQUEST_URI'] = '/';
707
-            $this->_route($this->_oRoutes->e404, $_SERVER['REQUEST_URI']);
708
-        }
705
+			$this->_oRoutes->e404->route = '/';
706
+			$_SERVER['REQUEST_URI'] = '/';
707
+			$this->_route($this->_oRoutes->e404, $_SERVER['REQUEST_URI']);
708
+		}
709 709
 
710
-        exit;
711
-    }
710
+		exit;
711
+	}
712 712
 
713
-    /**
714
-     * check the cache - just if it's not yet defined
715
-     *
716
-     * @access private
717
-     * @param  \stdClass $oCache object of cache configuration
718
-     * @return void
719
-     */
720
-    private function _checkCache(\stdClass $oCache)
721
-    {
722
-        /**
723
-         * cache-control http
724
-         */
713
+	/**
714
+	 * check the cache - just if it's not yet defined
715
+	 *
716
+	 * @access private
717
+	 * @param  \stdClass $oCache object of cache configuration
718
+	 * @return void
719
+	 */
720
+	private function _checkCache(\stdClass $oCache)
721
+	{
722
+		/**
723
+		 * cache-control http
724
+		 */
725 725
 
726
-        $sHearderValidity = false;
727
-        $sHeader = "Cache-Control:";
726
+		$sHearderValidity = false;
727
+		$sHeader = "Cache-Control:";
728 728
 
729
-        if (isset($oCache->visibility) && ($oCache->visibility = 'public' || $oCache->visibility = 'private')) {
729
+		if (isset($oCache->visibility) && ($oCache->visibility = 'public' || $oCache->visibility = 'private')) {
730 730
 
731
-            $sHearderValidity = true;
732
-            $sHeader .= " ".$oCache->visibility.",";
733
-        }
731
+			$sHearderValidity = true;
732
+			$sHeader .= " ".$oCache->visibility.",";
733
+		}
734 734
 
735
-        if (isset($oCache->max_age)) {
735
+		if (isset($oCache->max_age)) {
736 736
 
737
-            $sHearderValidity = true;
738
-            $sHeader .= " maxage=".$oCache->max_age.",";
739
-        }
737
+			$sHearderValidity = true;
738
+			$sHeader .= " maxage=".$oCache->max_age.",";
739
+		}
740 740
 
741
-        if (isset($oCache->must_revalidate) && $oCache->must_revalidate === true) {
741
+		if (isset($oCache->must_revalidate) && $oCache->must_revalidate === true) {
742 742
 
743
-            $sHearderValidity = true;
744
-            $sHeader .= " must-revalidate,";
745
-        }
743
+			$sHearderValidity = true;
744
+			$sHeader .= " must-revalidate,";
745
+		}
746 746
 
747
-        if ($sHearderValidity === true) {
747
+		if ($sHearderValidity === true) {
748 748
 
749
-            $sHeader = substr($sHeader, 0, -1);
749
+			$sHeader = substr($sHeader, 0, -1);
750 750
 
751
-            if (!headers_sent()) { header($sHeader); }
752
-        }
751
+			if (!headers_sent()) { header($sHeader); }
752
+		}
753 753
 
754
-        /**
755
-         * ETag http
756
-         */
754
+		/**
755
+		 * ETag http
756
+		 */
757 757
 
758
-        if (isset($oCache->ETag)) { header("ETag: \"".$oCache->ETag."\""); }
758
+		if (isset($oCache->ETag)) { header("ETag: \"".$oCache->ETag."\""); }
759 759
 
760
-        /**
761
-         * expire
762
-         */
760
+		/**
761
+		 * expire
762
+		 */
763 763
 
764
-        if (isset($oCache->max_age)) { if (!headers_sent()) { header('Expires: '.gmdate('D, d M Y H:i:s', time() + $oCache->max_age).' GMT'); } }
764
+		if (isset($oCache->max_age)) { if (!headers_sent()) { header('Expires: '.gmdate('D, d M Y H:i:s', time() + $oCache->max_age).' GMT'); } }
765 765
 
766
-        /**
767
-         * Last-Modified http
768
-         */
766
+		/**
767
+		 * Last-Modified http
768
+		 */
769 769
 
770
-        if (isset($oCache->last_modified)) { if (!headers_sent()) { header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + $oCache->last_modified).' GMT'); } }
770
+		if (isset($oCache->last_modified)) { if (!headers_sent()) { header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + $oCache->last_modified).' GMT'); } }
771 771
 
772
-        /**
773
-         * vary http
774
-         */
772
+		/**
773
+		 * vary http
774
+		 */
775 775
 
776
-        if (isset($oCache->vary)) { header('Vary: '.$oCache->vary); }
777
-    }
776
+		if (isset($oCache->vary)) { header('Vary: '.$oCache->vary); }
777
+	}
778 778
 
779
-    /**
780
-     * Sets a logger instance on the object
781
-     *
782
-     * @access private
783
-     * @param  LoggerInterface $logger
784
-     * @return null
785
-     */
786
-    public function setLogger(LoggerInterface $logger) {
779
+	/**
780
+	 * Sets a logger instance on the object
781
+	 *
782
+	 * @access private
783
+	 * @param  LoggerInterface $logger
784
+	 * @return null
785
+	 */
786
+	public function setLogger(LoggerInterface $logger) {
787 787
 
788
-        $this->_oLogger = $logger;
789
-    }
788
+		$this->_oLogger = $logger;
789
+	}
790 790
 }
Please login to merge, or discard this patch.
bundles/core/Config.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public static function get(string $sName, string $sPortal = null, bool $bNoDoRedirect = false)
51 51
 	{
52
-        $aDirectories = [];
53
-        $sJsonFile='';
52
+		$aDirectories = [];
53
+		$sJsonFile='';
54 54
 
55
-        if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } else { $sNameCache = $sName; }
55
+		if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } else { $sNameCache = $sName; }
56 56
 	    
57 57
 		if ($sPortal === null || !is_string($sPortal)) {
58 58
 		    
59
-		    if (defined('PORTAL')) {
59
+			if (defined('PORTAL')) {
60 60
 
61 61
 				$sPortal = PORTAL;
62 62
 				$aDirectories = array($sPortal);
@@ -71,97 +71,97 @@  discard block
 block discarded – undo
71 71
 
72 72
 			$base = new \stdClass;
73 73
 
74
-            if (count($aDirectories) < 1) { $aDirectories = [$sPortal]; }
74
+			if (count($aDirectories) < 1) { $aDirectories = [$sPortal]; }
75 75
 
76 76
 			foreach ($aDirectories as $sPortal) {
77 77
 			
78
-			    if ($sPortal != '..' && $sPortal != '.') {
78
+				if ($sPortal != '..' && $sPortal != '.') {
79 79
 
80
-        			if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
80
+					if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
81 81
         
82
-        				$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
83
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
84
-        			}
82
+						$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
83
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
84
+					}
85 85
 
86
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
86
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
87 87
         				
88
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
89
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
90
-        			}
88
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
89
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
90
+					}
91 91
 
92
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) {
92
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) {
93 93
         
94
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev';
95
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
96
-        			}
94
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev';
95
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
96
+					}
97 97
 
98
-        			if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) {
98
+					if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) {
99 99
         
100
-        				$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev';
101
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
102
-        			}
100
+						$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev';
101
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
102
+					}
103 103
 
104
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) {
104
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) {
105 105
         
106
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod';
107
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
108
-        			}
106
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod';
107
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
108
+					}
109 109
 
110
-        			if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) {
110
+					if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) {
111 111
         
112
-        				$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod';
113
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
114
-        			}
112
+						$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod';
113
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
114
+					}
115 115
 
116
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) {
116
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) {
117 117
         
118
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod';
119
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
120
-        			}
118
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod';
119
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
120
+					}
121 121
 
122
-        			if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) {
122
+					if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) {
123 123
         
124
-        				$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod';
125
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
126
-        			}
124
+						$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod';
125
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
126
+					}
127 127
 
128
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) {
128
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) {
129 129
         
130
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec';
131
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
132
-        			}
130
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec';
131
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
132
+					}
133 133
 
134
-        			if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) {
134
+					if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) {
135 135
         
136
-        				$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec';
137
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
138
-        			}
136
+						$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec';
137
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
138
+					}
139 139
 
140
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
140
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) {
141 141
         
142
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
143
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
144
-        			}
142
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local';
143
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
144
+					}
145 145
 
146
-        			if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf')) {
146
+					if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf')) {
147 147
         
148
-        				$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf';
149
-        				$base = self::_mergeAndGetConf($sJsonFile, $base);
150
-        			}
148
+						$sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf';
149
+						$base = self::_mergeAndGetConf($sJsonFile, $base);
150
+					}
151 151
 
152
-        			$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf';
153
-        			$base = self::_mergeAndGetConf($sJsonFile, $base);
154
-			    }
155
-		    }
152
+					$sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf';
153
+					$base = self::_mergeAndGetConf($sJsonFile, $base);
154
+				}
155
+			}
156 156
 
157
-            if ($base === '') {
157
+			if ($base === '') {
158 158
 				
159 159
 				trigger_error("Error in your Json format in this file : ".$sJsonFile, E_USER_NOTICE);
160 160
 			}
161 161
 
162 162
 			if (isset($base->redirect) && $bNoDoRedirect === false) {
163 163
 			
164
-                $base = self::get($sName, $base->redirect);
164
+				$base = self::get($sName, $base->redirect);
165 165
 			}
166 166
 			
167 167
 			self::$_aConfCache[$sNameCache] = $base;
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public static function getBundleLocationName(string $sName): string
187 187
 	{
188
-	    $oConfig = self::get($sName, null, true);
188
+		$oConfig = self::get($sName, null, true);
189 189
 
190
-	    if (isset($oConfig->redirect)) { return $oConfig->redirect; } else { return PORTAL; }
190
+		if (isset($oConfig->redirect)) { return $oConfig->redirect; } else { return PORTAL; }
191 191
 	}
192 192
 
193 193
 	/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			echo "The Json ".$sFileToMerge." has an error! Please verify!\n";
212 212
 			$oDebug = Debug::getInstance();
213 213
 			$oDebug->error("The Json ".$sFileToMerge." has an error! Please verify!\n");
214
-            new \Exception("The Json ".$sFileToMerge." has an error! Please verify!\n");
214
+			new \Exception("The Json ".$sFileToMerge." has an error! Please verify!\n");
215 215
 		}
216 216
 	}
217 217
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			} else if (is_array($oConfFiles) && is_array($base) && !isset($base[$sKey])) {
234 234
 
235 235
 				$base[$sKey] = $oConfFiles[$sKey];
236
-            } else if (!isset($base->$sKey) && is_array($mOne)) {
236
+			} else if (!isset($base->$sKey) && is_array($mOne)) {
237 237
 
238 238
 				$base->$sKey = new \StdClass;
239 239
 				list($oConfFiles, $base) = self::_recursiveGet($mOne, $base->$sKey);
Please login to merge, or discard this patch.
bundles/lib/Asset.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -40,28 +40,28 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function javascripts() : array {
42 42
 	    
43
-	    $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?';
44
-	    $aJavascript = func_get_args();
45
-	    $aReturns = array();
43
+		$sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?';
44
+		$aJavascript = func_get_args();
45
+		$aReturns = array();
46 46
 	    
47
-	    foreach($aJavascript as $aJsCombination) {
47
+		foreach($aJavascript as $aJsCombination) {
48 48
 	        
49
-	        $sJsPath = $sDefaultPath;
49
+			$sJsPath = $sDefaultPath;
50 50
 	        
51
-	        foreach ($aJsCombination as $sJsToAdd) {
51
+			foreach ($aJsCombination as $sJsToAdd) {
52 52
 	            
53
-	            $sJsPath = $sJsToAdd.'&';
54
-	        }
53
+				$sJsPath = $sJsToAdd.'&';
54
+			}
55 55
 	    
56
-    	    if (defined('ASSET_VERSION') && ASSET_VERSION) {
56
+			if (defined('ASSET_VERSION') && ASSET_VERSION) {
57 57
     	        
58
-    	        $sJsPath = ASSET_VERSION;
59
-    	    }
58
+				$sJsPath = ASSET_VERSION;
59
+			}
60 60
 	        
61
-	        $aReturns[] = $sJsPath;
62
-	    }
61
+			$aReturns[] = $sJsPath;
62
+		}
63 63
 	    
64
-	    return $aReturns;
64
+		return $aReturns;
65 65
 	}
66 66
 	
67 67
 	/**
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function stylesheets() : array {
77 77
 	    
78
-	    $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?';
79
-	    $aCss = func_get_args();
80
-	    $aReturns = array();
78
+		$sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?';
79
+		$aCss = func_get_args();
80
+		$aReturns = array();
81 81
 	    
82
-	    foreach($aCss as $aCssCombination) {
82
+		foreach($aCss as $aCssCombination) {
83 83
 	        
84
-	        $sCssPath = $sDefaultPath;
84
+			$sCssPath = $sDefaultPath;
85 85
 	        
86
-	        foreach ($aCssCombination as $sCssToAdd) {
86
+			foreach ($aCssCombination as $sCssToAdd) {
87 87
 	            
88
-	            $sCssPath = $sCssToAdd.'&';
89
-	        }
88
+				$sCssPath = $sCssToAdd.'&';
89
+			}
90 90
 	    
91
-    	    if (defined('ASSET_VERSION') && ASSET_VERSION) {
91
+			if (defined('ASSET_VERSION') && ASSET_VERSION) {
92 92
 
93
-                $sCssPath = ASSET_VERSION;
94
-    	    }
93
+				$sCssPath = ASSET_VERSION;
94
+			}
95 95
 	        
96
-	        $aReturns[] = $sCssPath;
97
-	    }
96
+			$aReturns[] = $sCssPath;
97
+		}
98 98
 	    
99
-	    return $aReturns;
99
+		return $aReturns;
100 100
 	}
101 101
 }
Please login to merge, or discard this patch.
bundles/lib/Benchmark.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public static function setPointInLog(string $sName = 'default')
83 83
 	{
84
-	    $oLogger = Debug::getInstance();
84
+		$oLogger = Debug::getInstance();
85 85
 		$oLogger->info('BENCHMARK: Time at this point '.(microtime(true) - self::$_fStart).' - '.$sName);
86 86
 	}
87 87
 	
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setLogger(LoggerInterface $logger)
96 96
 	{
97
-	    if ($this->_oLogger === null) { $this->_oLogger = $logger; }
97
+		if ($this->_oLogger === null) { $this->_oLogger = $logger; }
98 98
 	}
99 99
 
100 100
 	/**
Please login to merge, or discard this patch.
bundles/lib/Form.php 1 patch
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -60,408 +60,408 @@
 block discarded – undo
60 60
  */
61 61
 class Form
62 62
 {
63
-    /**
64
-     * Elements of the form
65
-     *
66
-     *  @access private
67
-     *  @var    array
68
-     */
69
-    private $_aElement = array();
70
-
71
-    /**
72
-     * Increment for form
73
-     *
74
-     *  @access private
75
-     *  @var    int
76
-     */
77
-    private static $_iFormIncrement = 0;
78
-
79
-    /**
80
-     * number of form
81
-     *
82
-     *  @access private
83
-     *  @var    int
84
-     */
85
-    private $_iFormNumber = 0;
86
-
87
-    /**
88
-     * Separator between fields of form
89
-     *
90
-     *  @access private
91
-     *  @var    string
92
-     */
93
-    private $_sSeparator = '<br/>';
94
-
95
-    /**
96
-     * The entity to save with the formular
97
-     *
98
-     *  @access private
99
-     *  @var    string
100
-     */
101
-    private $_sSynchronizeEntity = null;
102
-
103
-    /**
104
-     * The id of entity
105
-     *
106
-     *  @access private
107
-     *  @var    int
108
-     */
109
-    private $_iIdEntity = null;
110
-
111
-    /**
112
-     * The entity to save with the formular
113
-     *
114
-     *  @access private
115
-     *  @var    int
116
-     */
117
-    private $_iIdEntityCreated = null;
118
-
119
-    /**
120
-     * constructor that it increment (static) for all use
121
-     *
122
-     * @access public
123
-     */
124
-    public function __construct()
125
-    {
126
-        self::$_iFormIncrement++;
127
-        $this->_iFormNumber = self::$_iFormIncrement;
128
-    }
129
-
130
-    /**
131
-     * add an element in the form
132
-     *
133
-     * @access public
134
-     * @param  string $sName name
135
-     * @param  string|\Venus\lib\Form $mType type of field
136
-     * @param  string $sLabel label of field
137
-     * @param  mixed $mValue value of field
138
-     * @parma  mixed $mOptions options (for select)
139
-     * @return \Venus\lib\Form
140
-     */
141
-    public function add($sName, $mType, $sLabel = null, $mValue = null, $mOptions = null)
142
-    {
143
-        if ($mType instanceof Container) {
144
-
145
-            $this->_aElement[$sName] = $mType;
146
-        } else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel'
147
-            || $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time'
148
-            || $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range'
149
-            || $mType === 'color') {
150
-
151
-            $this->_aElement[$sName] = new Input($sName, $mType, $sLabel, $mValue);
152
-        } elseif ($mType === 'textarea') {
153
-
154
-            $this->_aElement[$sName] = new Textarea($sName, $sLabel, $mValue);
155
-        } else  if ($mType === 'select') {
156
-
157
-            $this->_aElement[$sName] = new Select($sName, $mOptions, $sLabel, $mValue);
158
-        } else  if ($mType === 'label') {
159
-
160
-            $this->_aElement[$sName] = new Label($sName);
161
-        } else  if ($mType === 'list_checkbox') {
162
-
163
-            $i = 0;
164
-
165
-            $this->_aElement[$sName.'_'.$i++] = new Label($sLabel);
166
-
167
-            foreach ($mValue as $mKey => $sValue) {
168
-
169
-                $this->_aElement[$sName.'_'.$i++] = new Checkbox($sName, $sValue, $mKey, $mOptions);
170
-            }
171
-        } else  if ($mType === 'checkbox') {
172
-
173
-            $this->_aElement[$sName] = new Checkbox($sName, $sLabel, $mValue, $mOptions);
174
-        } else  if ($mType === 'radio') {
175
-
176
-            $this->_aElement[$sName.rand(100000, 999999)] = new Radio($sName, $sLabel, $mValue, $mOptions);
177
-        } else  if ($mType === 'date') {
178
-
179
-            $aDay = array();
180
-
181
-            for ($i = 1; $i <= 31; $i++) {
182
-
183
-                if ($i < 10) { $aDay['0'.$i] = '0'.$i; }
184
-                else { $aDay[$i] = $i; }
185
-            }
186
-
187
-            $this->_aElement[$sName.'_day'] = new Select($sName, $aDay);
188
-
189
-            $aMonth = array(
190
-                '01' => 'Jan',
191
-                '02' => 'Feb',
192
-                '03' => 'Mar',
193
-                '04' => 'Apr',
194
-                '05' => 'May',
195
-                '06' => 'Jun',
196
-                '07' => 'Jui',
197
-                '08' => 'Aug',
198
-                '09' => 'Sep',
199
-                '10' => 'Oct',
200
-                '11' => 'Nov',
201
-                '12' => 'Dec',
202
-            );
203
-
204
-            $this->_aElement[$sName.'_month'] = new Select($sName, $aMonth);
205
-
206
-            $aYear = array();
207
-
208
-            for ($i = 1900; $i <= 2013; $i++) {
209
-
210
-                $aYear[$i] = $i;
211
-            }
212
-
213
-            $this->_aElement[$sName.'_year'] = new Select($sName, $aMonth);
214
-        }
215
-
216
-        return $this;
217
-    }
218
-
219
-    /**
220
-     * get id entity created by the formular
221
-     *
222
-     * @access public
223
-     * @return int
224
-     */
225
-    public function getIdEntityCreated() : int
226
-    {
227
-        return $this->_iIdEntityCreated;
228
-    }
229
-
230
-    /**
231
-     * set id entity created by the formular
232
-     *
233
-     * @access public
234
-     * @param  int $iIdEntityCreated
235
-     * @return Form
236
-     */
237
-    public function setIdEntityCreated(int $iIdEntityCreated) : Form
238
-    {
239
-        $this->_iIdEntityCreated = $iIdEntityCreated;
240
-        return $this;
241
-    }
242
-
243
-    /**
244
-     * get form number
245
-     *
246
-     * @access public
247
-     * @return int
248
-     */
249
-    public function getFormNumber() : int
250
-    {
251
-        return $this->_iFormNumber;
252
-    }
63
+	/**
64
+	 * Elements of the form
65
+	 *
66
+	 *  @access private
67
+	 *  @var    array
68
+	 */
69
+	private $_aElement = array();
70
+
71
+	/**
72
+	 * Increment for form
73
+	 *
74
+	 *  @access private
75
+	 *  @var    int
76
+	 */
77
+	private static $_iFormIncrement = 0;
78
+
79
+	/**
80
+	 * number of form
81
+	 *
82
+	 *  @access private
83
+	 *  @var    int
84
+	 */
85
+	private $_iFormNumber = 0;
86
+
87
+	/**
88
+	 * Separator between fields of form
89
+	 *
90
+	 *  @access private
91
+	 *  @var    string
92
+	 */
93
+	private $_sSeparator = '<br/>';
94
+
95
+	/**
96
+	 * The entity to save with the formular
97
+	 *
98
+	 *  @access private
99
+	 *  @var    string
100
+	 */
101
+	private $_sSynchronizeEntity = null;
102
+
103
+	/**
104
+	 * The id of entity
105
+	 *
106
+	 *  @access private
107
+	 *  @var    int
108
+	 */
109
+	private $_iIdEntity = null;
110
+
111
+	/**
112
+	 * The entity to save with the formular
113
+	 *
114
+	 *  @access private
115
+	 *  @var    int
116
+	 */
117
+	private $_iIdEntityCreated = null;
118
+
119
+	/**
120
+	 * constructor that it increment (static) for all use
121
+	 *
122
+	 * @access public
123
+	 */
124
+	public function __construct()
125
+	{
126
+		self::$_iFormIncrement++;
127
+		$this->_iFormNumber = self::$_iFormIncrement;
128
+	}
129
+
130
+	/**
131
+	 * add an element in the form
132
+	 *
133
+	 * @access public
134
+	 * @param  string $sName name
135
+	 * @param  string|\Venus\lib\Form $mType type of field
136
+	 * @param  string $sLabel label of field
137
+	 * @param  mixed $mValue value of field
138
+	 * @parma  mixed $mOptions options (for select)
139
+	 * @return \Venus\lib\Form
140
+	 */
141
+	public function add($sName, $mType, $sLabel = null, $mValue = null, $mOptions = null)
142
+	{
143
+		if ($mType instanceof Container) {
144
+
145
+			$this->_aElement[$sName] = $mType;
146
+		} else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel'
147
+			|| $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time'
148
+			|| $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range'
149
+			|| $mType === 'color') {
150
+
151
+			$this->_aElement[$sName] = new Input($sName, $mType, $sLabel, $mValue);
152
+		} elseif ($mType === 'textarea') {
153
+
154
+			$this->_aElement[$sName] = new Textarea($sName, $sLabel, $mValue);
155
+		} else  if ($mType === 'select') {
156
+
157
+			$this->_aElement[$sName] = new Select($sName, $mOptions, $sLabel, $mValue);
158
+		} else  if ($mType === 'label') {
159
+
160
+			$this->_aElement[$sName] = new Label($sName);
161
+		} else  if ($mType === 'list_checkbox') {
162
+
163
+			$i = 0;
164
+
165
+			$this->_aElement[$sName.'_'.$i++] = new Label($sLabel);
166
+
167
+			foreach ($mValue as $mKey => $sValue) {
168
+
169
+				$this->_aElement[$sName.'_'.$i++] = new Checkbox($sName, $sValue, $mKey, $mOptions);
170
+			}
171
+		} else  if ($mType === 'checkbox') {
172
+
173
+			$this->_aElement[$sName] = new Checkbox($sName, $sLabel, $mValue, $mOptions);
174
+		} else  if ($mType === 'radio') {
175
+
176
+			$this->_aElement[$sName.rand(100000, 999999)] = new Radio($sName, $sLabel, $mValue, $mOptions);
177
+		} else  if ($mType === 'date') {
178
+
179
+			$aDay = array();
180
+
181
+			for ($i = 1; $i <= 31; $i++) {
182
+
183
+				if ($i < 10) { $aDay['0'.$i] = '0'.$i; }
184
+				else { $aDay[$i] = $i; }
185
+			}
186
+
187
+			$this->_aElement[$sName.'_day'] = new Select($sName, $aDay);
188
+
189
+			$aMonth = array(
190
+				'01' => 'Jan',
191
+				'02' => 'Feb',
192
+				'03' => 'Mar',
193
+				'04' => 'Apr',
194
+				'05' => 'May',
195
+				'06' => 'Jun',
196
+				'07' => 'Jui',
197
+				'08' => 'Aug',
198
+				'09' => 'Sep',
199
+				'10' => 'Oct',
200
+				'11' => 'Nov',
201
+				'12' => 'Dec',
202
+			);
203
+
204
+			$this->_aElement[$sName.'_month'] = new Select($sName, $aMonth);
205
+
206
+			$aYear = array();
207
+
208
+			for ($i = 1900; $i <= 2013; $i++) {
209
+
210
+				$aYear[$i] = $i;
211
+			}
212
+
213
+			$this->_aElement[$sName.'_year'] = new Select($sName, $aMonth);
214
+		}
215
+
216
+		return $this;
217
+	}
218
+
219
+	/**
220
+	 * get id entity created by the formular
221
+	 *
222
+	 * @access public
223
+	 * @return int
224
+	 */
225
+	public function getIdEntityCreated() : int
226
+	{
227
+		return $this->_iIdEntityCreated;
228
+	}
229
+
230
+	/**
231
+	 * set id entity created by the formular
232
+	 *
233
+	 * @access public
234
+	 * @param  int $iIdEntityCreated
235
+	 * @return Form
236
+	 */
237
+	public function setIdEntityCreated(int $iIdEntityCreated) : Form
238
+	{
239
+		$this->_iIdEntityCreated = $iIdEntityCreated;
240
+		return $this;
241
+	}
242
+
243
+	/**
244
+	 * get form number
245
+	 *
246
+	 * @access public
247
+	 * @return int
248
+	 */
249
+	public function getFormNumber() : int
250
+	{
251
+		return $this->_iFormNumber;
252
+	}
253 253
 
254
-    /**
255
-     * set id entity created by the formular
256
-     *
257
-     * @access public
258
-     * @param  int $iFormNumber
259
-     * @return Form
260
-     */
261
-    public function setFormNumber(int $iFormNumber) : Form
262
-    {
263
-        $this->_iFormNumber = $iFormNumber;
264
-        return $this;
265
-    }
266
-
267
-    /**
268
-     * get global form
269
-     *
270
-     * @access public
271
-     * @return \Venus\lib\Form\Container
272
-     */
273
-    public function getForm()
274
-    {
275
-        $oForm = $this->getFormInObject();
276
-
277
-        $sFormContent = $oForm->start;
278
-
279
-        foreach ($oForm->form as $sValue) {
280
-
281
-            $sFormContent .= $sValue.$this->_sSeparator;
282
-        }
283
-
284
-        $sFormContent .= $oForm->end;
285
-
286
-        $oContainer = new Container;
287
-        $oContainer->setView($sFormContent)
288
-                   ->setForm($this);
289
-
290
-        return $oContainer;
291
-    }
292
-
293
-
294
-    /**
295
-     * get global object form
296
-     *
297
-     * @access public
298
-     * @return \stdClass
299
-     */
300
-    public function getFormInObject()
301
-    {
302
-        $sExKey = null;
303
-
304
-        if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) {
305
-
306
-            $sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity);
307
-            $oModel = new $sModelName;
308
-
309
-            $oEntity = new $this->_sSynchronizeEntity;
310
-            $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
311
-            $sMethodName = 'findOneBy'.$sPrimaryKey;
312
-            $oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity));
313
-
314
-            if (is_object($oCompleteEntity)) {
315
-
316
-                foreach ($this->_aElement as $sKey => $sValue) {
317
-
318
-                    if ($sValue instanceof \Venus\lib\Form\Radio) {
319
-
320
-                        $sExKey = $sKey;
321
-                        $sKey = substr($sKey, 0, -6);
322
-                    }
323
-
324
-                    if ($sValue instanceof Form) {
325
-
326
-                        ;
327
-                    } else {
328
-
329
-                        $sMethodNameInEntity = 'get_'.$sKey;
330
-                        $mValue = $oCompleteEntity->$sMethodNameInEntity();
331
-
332
-                        if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) {
333
-
334
-                            $this->_aElement[$sExKey]->setValueChecked($mValue);
335
-                        } else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) {
336
-
337
-                            $this->_aElement[$sKey]->setValue($mValue);
338
-                        }
339
-                    }
340
-                }
341
-            }
342
-        }
343
-
344
-        $oForm = new \StdClass();
345
-        $oForm->start = '<form name="form'.$this->_iFormNumber.'" method="post"><input type="hidden" value="1" name="validform'.$this->_iFormNumber.'">';
346
-        $oForm->form = array();
347
-
348
-        foreach ($this->_aElement as $sKey => $sValue) {
349
-
350
-            if ($sValue instanceof Container) {
351
-
352
-                $oForm->form[$sKey] = $sValue;
353
-            } else {
354
-
355
-                $oForm->form[$sKey] = $sValue->fetch();
356
-            }
357
-        }
358
-
359
-        $oForm->end = '</form>';
360
-
361
-        return $oForm;
362
-    }
363
-
364
-    /**
365
-     * get an element of formular
366
-     *
367
-     * @access public
368
-     * @param  string $sName name
369
-     * @return object
370
-     */
371
-    public function get($sName)
372
-    {
373
-        return $this->_aElement[$sName];
374
-    }
375
-
376
-    /**
377
-     * get the form separator
378
-     *
379
-     * @access public
380
-     * @return string
381
-     */
382
-    public function getSeparator()
383
-    {
384
-        return $this->_sSeparator;
385
-    }
386
-
387
-    /**
388
-     * set the form separator
389
-     *
390
-     * @access public
391
-     * @param  string $sSeparator separator between the fields
392
-     * @return \Venus\lib\Form
393
-     */
394
-    public function setSeparator($sSeparator)
395
-    {
396
-        $this->_sSeparator = $sSeparator;
397
-        return $this;
398
-    }
399
-
400
-    /**
401
-     * set the entity to synchronize with the formular
402
-     *
403
-     * @access public
404
-     * @param $sSynchronizeEntity
405
-     * @param  int $iId id of the primary key
406
-     * @return Form
407
-     * @internal param string $sSeparator separator between the fields
408
-     */
409
-    public function synchronizeEntity($sSynchronizeEntity, $iId = null)
410
-    {
411
-        if ($iId !== null) { $this->_iIdEntity = $iId; }
412
-
413
-        $this->_sSynchronizeEntity = $sSynchronizeEntity;
414
-        return $this;
415
-    }
416
-
417
-    /**
418
-     * add constraint
419
-     *
420
-     * @access public
421
-     * @param  string $sName field name
422
-     * @param  object $oConstraint constraint on the field
423
-     * @return \Venus\lib\Form
424
-     */
425
-    public function addConstraint($sName, $oConstraint)
426
-    {
427
-        if ($this->_aElement[$sName] instanceof Input || $this->_aElement[$sName] instanceof Textarea) {
428
-
429
-            $this->_aElement[$sName]->setConstraint($oConstraint);
430
-        }
431
-
432
-        return $this;
433
-    }
434
-
435
-    /**
436
-     * get all elements
437
-     *
438
-     * @access public
439
-     * @return  array
440
-     */
441
-    public function getElement() {
442
-
443
-        return $this->_aElement;
444
-    }
445
-
446
-    /**
447
-     * get all elements
448
-     *
449
-     * @access public
450
-     * @return int
451
-     */
452
-    public function getIdEntity() {
453
-
454
-        return $this->_iIdEntity;
455
-    }
456
-
457
-    /**
458
-     * get all elements
459
-     *
460
-     * @access public
461
-     * @return string
462
-     */
463
-    public function getSynchronizeEntity() {
464
-
465
-        return $this->_sSynchronizeEntity;
466
-    }
254
+	/**
255
+	 * set id entity created by the formular
256
+	 *
257
+	 * @access public
258
+	 * @param  int $iFormNumber
259
+	 * @return Form
260
+	 */
261
+	public function setFormNumber(int $iFormNumber) : Form
262
+	{
263
+		$this->_iFormNumber = $iFormNumber;
264
+		return $this;
265
+	}
266
+
267
+	/**
268
+	 * get global form
269
+	 *
270
+	 * @access public
271
+	 * @return \Venus\lib\Form\Container
272
+	 */
273
+	public function getForm()
274
+	{
275
+		$oForm = $this->getFormInObject();
276
+
277
+		$sFormContent = $oForm->start;
278
+
279
+		foreach ($oForm->form as $sValue) {
280
+
281
+			$sFormContent .= $sValue.$this->_sSeparator;
282
+		}
283
+
284
+		$sFormContent .= $oForm->end;
285
+
286
+		$oContainer = new Container;
287
+		$oContainer->setView($sFormContent)
288
+				   ->setForm($this);
289
+
290
+		return $oContainer;
291
+	}
292
+
293
+
294
+	/**
295
+	 * get global object form
296
+	 *
297
+	 * @access public
298
+	 * @return \stdClass
299
+	 */
300
+	public function getFormInObject()
301
+	{
302
+		$sExKey = null;
303
+
304
+		if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) {
305
+
306
+			$sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity);
307
+			$oModel = new $sModelName;
308
+
309
+			$oEntity = new $this->_sSynchronizeEntity;
310
+			$sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity);
311
+			$sMethodName = 'findOneBy'.$sPrimaryKey;
312
+			$oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity));
313
+
314
+			if (is_object($oCompleteEntity)) {
315
+
316
+				foreach ($this->_aElement as $sKey => $sValue) {
317
+
318
+					if ($sValue instanceof \Venus\lib\Form\Radio) {
319
+
320
+						$sExKey = $sKey;
321
+						$sKey = substr($sKey, 0, -6);
322
+					}
323
+
324
+					if ($sValue instanceof Form) {
325
+
326
+						;
327
+					} else {
328
+
329
+						$sMethodNameInEntity = 'get_'.$sKey;
330
+						$mValue = $oCompleteEntity->$sMethodNameInEntity();
331
+
332
+						if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) {
333
+
334
+							$this->_aElement[$sExKey]->setValueChecked($mValue);
335
+						} else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) {
336
+
337
+							$this->_aElement[$sKey]->setValue($mValue);
338
+						}
339
+					}
340
+				}
341
+			}
342
+		}
343
+
344
+		$oForm = new \StdClass();
345
+		$oForm->start = '<form name="form'.$this->_iFormNumber.'" method="post"><input type="hidden" value="1" name="validform'.$this->_iFormNumber.'">';
346
+		$oForm->form = array();
347
+
348
+		foreach ($this->_aElement as $sKey => $sValue) {
349
+
350
+			if ($sValue instanceof Container) {
351
+
352
+				$oForm->form[$sKey] = $sValue;
353
+			} else {
354
+
355
+				$oForm->form[$sKey] = $sValue->fetch();
356
+			}
357
+		}
358
+
359
+		$oForm->end = '</form>';
360
+
361
+		return $oForm;
362
+	}
363
+
364
+	/**
365
+	 * get an element of formular
366
+	 *
367
+	 * @access public
368
+	 * @param  string $sName name
369
+	 * @return object
370
+	 */
371
+	public function get($sName)
372
+	{
373
+		return $this->_aElement[$sName];
374
+	}
375
+
376
+	/**
377
+	 * get the form separator
378
+	 *
379
+	 * @access public
380
+	 * @return string
381
+	 */
382
+	public function getSeparator()
383
+	{
384
+		return $this->_sSeparator;
385
+	}
386
+
387
+	/**
388
+	 * set the form separator
389
+	 *
390
+	 * @access public
391
+	 * @param  string $sSeparator separator between the fields
392
+	 * @return \Venus\lib\Form
393
+	 */
394
+	public function setSeparator($sSeparator)
395
+	{
396
+		$this->_sSeparator = $sSeparator;
397
+		return $this;
398
+	}
399
+
400
+	/**
401
+	 * set the entity to synchronize with the formular
402
+	 *
403
+	 * @access public
404
+	 * @param $sSynchronizeEntity
405
+	 * @param  int $iId id of the primary key
406
+	 * @return Form
407
+	 * @internal param string $sSeparator separator between the fields
408
+	 */
409
+	public function synchronizeEntity($sSynchronizeEntity, $iId = null)
410
+	{
411
+		if ($iId !== null) { $this->_iIdEntity = $iId; }
412
+
413
+		$this->_sSynchronizeEntity = $sSynchronizeEntity;
414
+		return $this;
415
+	}
416
+
417
+	/**
418
+	 * add constraint
419
+	 *
420
+	 * @access public
421
+	 * @param  string $sName field name
422
+	 * @param  object $oConstraint constraint on the field
423
+	 * @return \Venus\lib\Form
424
+	 */
425
+	public function addConstraint($sName, $oConstraint)
426
+	{
427
+		if ($this->_aElement[$sName] instanceof Input || $this->_aElement[$sName] instanceof Textarea) {
428
+
429
+			$this->_aElement[$sName]->setConstraint($oConstraint);
430
+		}
431
+
432
+		return $this;
433
+	}
434
+
435
+	/**
436
+	 * get all elements
437
+	 *
438
+	 * @access public
439
+	 * @return  array
440
+	 */
441
+	public function getElement() {
442
+
443
+		return $this->_aElement;
444
+	}
445
+
446
+	/**
447
+	 * get all elements
448
+	 *
449
+	 * @access public
450
+	 * @return int
451
+	 */
452
+	public function getIdEntity() {
453
+
454
+		return $this->_iIdEntity;
455
+	}
456
+
457
+	/**
458
+	 * get all elements
459
+	 *
460
+	 * @access public
461
+	 * @return string
462
+	 */
463
+	public function getSynchronizeEntity() {
464
+
465
+		return $this->_sSynchronizeEntity;
466
+	}
467 467
 }
Please login to merge, or discard this patch.
bundles/lib/Date.php 1 patch
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -30,210 +30,210 @@
 block discarded – undo
30 30
  */
31 31
 class Date
32 32
 {
33
-    /**
34
-     * set name of image
35
-     *
36
-     * @access public
37
-     * @param  int $iWeek number of week
38
-     * @param  int $iYear year
39
-     * @param string $sFormat
40
-     * @return Date
41
-     */
42
-    public static function getWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : Date
43
-    {
44
-        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
45
-
46
-        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; }
47
-
48
-        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; }
49
-
50
-        $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift;
51
-        $iTimestampLastDay = mktime(0, 0, 0, 1, 6, $iYear) + $iWeekInSeconds + $iShift + 604800;
52
-
53
-        return array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));
54
-    }
55
-
56
-    /**
57
-     * set name of image
58
-     *
59
-     * @access public
60
-     * @return \Venus\lib\Date
61
-     */
62
-    public static function getActualWeek() : Date
63
-    {
64
-        return self::getWeek(date('W'), date('Y'));
65
-    }
66
-
67
-    /**
68
-     * set name of image
69
-     *
70
-     * @access public
71
-     * @param  string $sMonth number of week
72
-     * @param  string $sLanguage language
73
-     * @return \Venus\lib\Date
74
-     */
75
-    public static function getMonthInWord(string $sMonth, string $sLanguage = 'fr') : Date
76
-    {
77
-        if ($sLanguage == 'fr') {
78
-
79
-            if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; }
80
-            else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; }
81
-            else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; }
82
-            else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; }
83
-            else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; }
84
-            else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; }
85
-            else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; }
86
-            else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; }
87
-            else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; }
88
-            else if ($sMonth == 10) { return 'Octobre'; }
89
-            else if ($sMonth == 11) { return 'Novembre'; }
90
-            else if ($sMonth == 12) { return 'Décembre'; }
91
-        }
92
-    }
93
-
94
-    /**
95
-     * set name of image
96
-     *
97
-     * @access public
98
-     * @param  mixed $sDay number of day
99
-     * @param  string $sLanguage language
100
-     * @return \Venus\lib\Date
101
-     */
102
-    public static function getDayInWord(string $sDay, string $sLanguage = 'fr') : Date
103
-    {
104
-        if ($sLanguage == 'fr') {
105
-
106
-            if ($sDay == 0) { return 'dimanche'; }
107
-            else if ($sDay == 1) { return 'lundi'; }
108
-            else if ($sDay == 2) { return 'mardi'; }
109
-            else if ($sDay == 3) { return 'mercredi'; }
110
-            else if ($sDay == 4) { return 'jeudi'; }
111
-            else if ($sDay == 5) { return 'vendredi'; }
112
-            else if ($sDay == 6) { return 'samedi'; }
113
-        }
114
-    }
115
-
116
-    /**
117
-     * get age by date
118
-     *
119
-     * @access public
120
-     * @param string $sBirthday
121
-     * @return int
122
-     */
123
-    public static function getAgeByDate(string $sBirthday) : int
124
-    {
125
-        list($iYear, $iMonth, $iDay) = preg_split('/[-.]/', $sBirthday);
126
-
127
-        $aToday = array();
128
-        $aToday['mois'] = date('n');
129
-        $aToday['jour'] = date('j');
130
-        $aToday['annee'] = date('Y');
131
-
132
-        $iYears = $aToday['annee'] - $iYear;
133
-
134
-        if ($aToday['mois'] <= $iMonth) {
135
-
136
-            if ($iMonth == $aToday['mois']) {
137
-
138
-                if ($iDay > $aToday['jour']) { $iYears--; }
139
-            }
140
-            else {
141
-
142
-                $iYears--;
143
-            }
144
-        }
145
-
146
-        return $iYears;
147
-    }
148
-
149
-    /**
150
-     * set name of image
151
-     *
152
-     * @access public
153
-     * @param  int $iWeek number of week
154
-     * @param  int $iYear year
155
-     * @param string $sFormat
156
-     * @return array|Date
157
-     */
158
-    public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array
159
-    {
160
-        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
161
-
162
-        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
163
-        else { $iShift = (8 - $iFirstDayInYear) * 86400; }
164
-
165
-        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
166
-        else { $iWeekInSeconds = 0; }
167
-
168
-        if (date('N') > 2) {
169
-
170
-            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800;
171
-            $iTimestampLastDay = $iTimestamp + 604800;
172
-        }
173
-        else {
174
-
175
-            $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000;
176
-            $iTimestampLastDay = $iTimestamp + 604800;
177
-        }
178
-
179
-        $aDates = array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));
180
-
181
-        if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) {
182
-
183
-            $aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]);
184
-            $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]);
185
-        }
186
-
187
-        return $aDates;
188
-    }
189
-
190
-    /**
191
-     * set name of image
192
-     *
193
-     * @access public
194
-     * @return array
195
-     */
196
-    public static function getActualMiddleWeek() : array
197
-    {
198
-        return self::getMiddleWeek(date('W'), date('Y'));
199
-    }
200
-
201
-    /**
202
-     * get time of kind "X hour ago"
203
-     *
204
-     * @access public
205
-     * @param  string $sDateTime datetime to convert
206
-     * @param  string $sLanguage language
207
-     * @return string
208
-     */
209
-    public static function getTimeAgoInString(string $sDateTime, string $sLanguage = 'fr') : string
210
-    {
211
-        if ($sLanguage == 'fr') {
212
-
213
-            $sStartReturn = 'Il y a';
214
-            $sEndReturn = '';
215
-            $sMinutes = 'minute(s) ';
216
-            $sHours = 'heure(s) ';
217
-            $sDays = 'jour(s) ';
218
-            $sMonths = 'mois ';
219
-            $sYears = 'années ';
220
-        } else {
221
-            $sStartReturn = 'Ago';
222
-            $sEndReturn = '';
223
-            $sMinutes = 'minute(s) ';
224
-            $sHours = 'hour(s) ';
225
-            $sDays = 'day(s) ';
226
-            $sMonths = 'month ';
227
-            $sYears = 'years ';
228
-        }
229
-
230
-        $oDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $sDateTime);
231
-        $iTimeStamp = time() - $oDateTime->getTimestamp();
232
-
233
-        if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; }
234
-        if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; }
235
-        if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; }
236
-        if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; }
237
-        else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; }
238
-    }
33
+	/**
34
+	 * set name of image
35
+	 *
36
+	 * @access public
37
+	 * @param  int $iWeek number of week
38
+	 * @param  int $iYear year
39
+	 * @param string $sFormat
40
+	 * @return Date
41
+	 */
42
+	public static function getWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : Date
43
+	{
44
+		$iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
45
+
46
+		if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; }
47
+
48
+		if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; }
49
+
50
+		$iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift;
51
+		$iTimestampLastDay = mktime(0, 0, 0, 1, 6, $iYear) + $iWeekInSeconds + $iShift + 604800;
52
+
53
+		return array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));
54
+	}
55
+
56
+	/**
57
+	 * set name of image
58
+	 *
59
+	 * @access public
60
+	 * @return \Venus\lib\Date
61
+	 */
62
+	public static function getActualWeek() : Date
63
+	{
64
+		return self::getWeek(date('W'), date('Y'));
65
+	}
66
+
67
+	/**
68
+	 * set name of image
69
+	 *
70
+	 * @access public
71
+	 * @param  string $sMonth number of week
72
+	 * @param  string $sLanguage language
73
+	 * @return \Venus\lib\Date
74
+	 */
75
+	public static function getMonthInWord(string $sMonth, string $sLanguage = 'fr') : Date
76
+	{
77
+		if ($sLanguage == 'fr') {
78
+
79
+			if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; }
80
+			else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; }
81
+			else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; }
82
+			else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; }
83
+			else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; }
84
+			else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; }
85
+			else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; }
86
+			else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; }
87
+			else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; }
88
+			else if ($sMonth == 10) { return 'Octobre'; }
89
+			else if ($sMonth == 11) { return 'Novembre'; }
90
+			else if ($sMonth == 12) { return 'Décembre'; }
91
+		}
92
+	}
93
+
94
+	/**
95
+	 * set name of image
96
+	 *
97
+	 * @access public
98
+	 * @param  mixed $sDay number of day
99
+	 * @param  string $sLanguage language
100
+	 * @return \Venus\lib\Date
101
+	 */
102
+	public static function getDayInWord(string $sDay, string $sLanguage = 'fr') : Date
103
+	{
104
+		if ($sLanguage == 'fr') {
105
+
106
+			if ($sDay == 0) { return 'dimanche'; }
107
+			else if ($sDay == 1) { return 'lundi'; }
108
+			else if ($sDay == 2) { return 'mardi'; }
109
+			else if ($sDay == 3) { return 'mercredi'; }
110
+			else if ($sDay == 4) { return 'jeudi'; }
111
+			else if ($sDay == 5) { return 'vendredi'; }
112
+			else if ($sDay == 6) { return 'samedi'; }
113
+		}
114
+	}
115
+
116
+	/**
117
+	 * get age by date
118
+	 *
119
+	 * @access public
120
+	 * @param string $sBirthday
121
+	 * @return int
122
+	 */
123
+	public static function getAgeByDate(string $sBirthday) : int
124
+	{
125
+		list($iYear, $iMonth, $iDay) = preg_split('/[-.]/', $sBirthday);
126
+
127
+		$aToday = array();
128
+		$aToday['mois'] = date('n');
129
+		$aToday['jour'] = date('j');
130
+		$aToday['annee'] = date('Y');
131
+
132
+		$iYears = $aToday['annee'] - $iYear;
133
+
134
+		if ($aToday['mois'] <= $iMonth) {
135
+
136
+			if ($iMonth == $aToday['mois']) {
137
+
138
+				if ($iDay > $aToday['jour']) { $iYears--; }
139
+			}
140
+			else {
141
+
142
+				$iYears--;
143
+			}
144
+		}
145
+
146
+		return $iYears;
147
+	}
148
+
149
+	/**
150
+	 * set name of image
151
+	 *
152
+	 * @access public
153
+	 * @param  int $iWeek number of week
154
+	 * @param  int $iYear year
155
+	 * @param string $sFormat
156
+	 * @return array|Date
157
+	 */
158
+	public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array
159
+	{
160
+		$iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
161
+
162
+		if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
163
+		else { $iShift = (8 - $iFirstDayInYear) * 86400; }
164
+
165
+		if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
166
+		else { $iWeekInSeconds = 0; }
167
+
168
+		if (date('N') > 2) {
169
+
170
+			$iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800;
171
+			$iTimestampLastDay = $iTimestamp + 604800;
172
+		}
173
+		else {
174
+
175
+			$iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000;
176
+			$iTimestampLastDay = $iTimestamp + 604800;
177
+		}
178
+
179
+		$aDates = array(date($sFormat, $iTimestamp), date($sFormat, $iTimestampLastDay));
180
+
181
+		if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) {
182
+
183
+			$aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]);
184
+			$aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]);
185
+		}
186
+
187
+		return $aDates;
188
+	}
189
+
190
+	/**
191
+	 * set name of image
192
+	 *
193
+	 * @access public
194
+	 * @return array
195
+	 */
196
+	public static function getActualMiddleWeek() : array
197
+	{
198
+		return self::getMiddleWeek(date('W'), date('Y'));
199
+	}
200
+
201
+	/**
202
+	 * get time of kind "X hour ago"
203
+	 *
204
+	 * @access public
205
+	 * @param  string $sDateTime datetime to convert
206
+	 * @param  string $sLanguage language
207
+	 * @return string
208
+	 */
209
+	public static function getTimeAgoInString(string $sDateTime, string $sLanguage = 'fr') : string
210
+	{
211
+		if ($sLanguage == 'fr') {
212
+
213
+			$sStartReturn = 'Il y a';
214
+			$sEndReturn = '';
215
+			$sMinutes = 'minute(s) ';
216
+			$sHours = 'heure(s) ';
217
+			$sDays = 'jour(s) ';
218
+			$sMonths = 'mois ';
219
+			$sYears = 'années ';
220
+		} else {
221
+			$sStartReturn = 'Ago';
222
+			$sEndReturn = '';
223
+			$sMinutes = 'minute(s) ';
224
+			$sHours = 'hour(s) ';
225
+			$sDays = 'day(s) ';
226
+			$sMonths = 'month ';
227
+			$sYears = 'years ';
228
+		}
229
+
230
+		$oDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $sDateTime);
231
+		$iTimeStamp = time() - $oDateTime->getTimestamp();
232
+
233
+		if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; }
234
+		if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; }
235
+		if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; }
236
+		if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; }
237
+		else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; }
238
+	}
239 239
 }
Please login to merge, or discard this patch.
bundles/core/UrlManager.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -30,112 +30,112 @@
 block discarded – undo
30 30
  */
31 31
 class UrlManager
32 32
 {
33
-    /**
34
-     * The base Uri to construct the route
35
-     * @var string
36
-     */
37
-    private $_sBaseUri = '';
38
-
39
-    /**
40
-     * create an URL
41
-     *
42
-     * @access public
43
-     * @param  string $sCode code of the url between "routes" and "route" in Route.conf
44
-     * @param  array $aParams parameters to create the url
45
-     * @return string
46
-     *
47
-     * @tutorial	If I have this route I could make my URL:
48
-     *
49
-     * 				"menu_edit": {
50
-     *					"route": "[/:language]/menu[/:id]/edit/",
51
-     *					"controller": "\\src\\BackOffice\\Controller\\MenuManager",
52
-     *					"action": "edit",
53
-     *					"constraints": {
54
-     * 						"language": "[a-z]{0,2}",
55
-     * 						"id": "[0-9]+"
56
-     *					},
57
-     *					"content_type": "html"
58
-     *				},
59
-     *
60
-     *				I must write this:
61
-     *
62
-     *				$oUrlManager = new \Venus\core\UrlManager;
63
-     *				$sUrl = $oUrlManager->getUrl('menu_edit', array('language' => 'vn', 'id' => 125));
64
-     */
65
-    public function getUrl(string $sCode, array $aParams = array()) : string
66
-    {
67
-        if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
68
-
69
-            foreach (Config::get('Route') as $sHost => $oHost) {
70
-
71
-                if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
72
-                    || (strstr($sHost, '/')
73
-                    && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
74
-
75
-                    if (strstr($sHost, '/')
76
-                        && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
77
-
78
-                        $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
79
-                    }
80
-
81
-                    if (isset($oHost->routes)) {
82
-
83
-                        foreach($oHost->routes as $sKey => $oRoute) {
84
-
85
-                            if ($sKey === $sCode) {
86
-
87
-                                $sRoute = $this->_sBaseUri.$oRoute->route;
88
-
89
-                                if (isset($oRoute->constraints)) {
90
-
91
-                                    foreach ($oRoute->constraints as $sName => $sType) {
92
-
93
-                                        if (!isset($aParams[$sName])) { $aParams[$sName] = ''; }
94
-
95
-                                        if (preg_match('#'.$sType.'#', $aParams[$sName])) {
96
-
97
-                                            if ($aParams[$sName]) { $sRoute = str_replace('[/:'.$sName.']', '/'.$aParams[$sName], $sRoute); } else { $sRoute = str_replace('[/:'.$sName.']', '', $sRoute); }
98
-                                            $sRoute = str_replace('[:'.$sName.']', $aParams[$sName], $sRoute);
99
-                                            continue;
100
-                                        } else if (isset($oRoute->defaults_constraints)
101
-                                            && isset($oRoute->defaults_constraints->{$sName})
102
-                                            && preg_match('#'.$sType.'#', $oRoute->defaults_constraints->{$sName})) {
103
-
104
-                                            continue;
105
-                                        }
106
-
107
-                                        throw new \Exception('For the route '.$sCode.' the parameter '.$sName.' is not good!');
108
-                                    }
109
-                                }
110
-
111
-                                return $sRoute;
112
-                            }
113
-                        }
114
-                    }
115
-                }
116
-            }
117
-        }
118
-    }
119
-
120
-    /**
121
-     * encode text for the url
122
-     *
123
-     * @access public
124
-     * @param  string $sStringToEncode text
125
-     * @return string
126
-     */
127
-    public function encodeToUrl(string $sStringToEncode) : string
128
-    {
129
-        if (!is_string($sStringToEncode)) {
130
-
131
-            throw new \Exception();
132
-        }
133
-
134
-        $sStringToEncode = str_replace(['à','á','â','ã','ä','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','À','Á','Â','Ã','Ä','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ñ','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý'],
135
-            ['a','a','a','a','a','c','e','e','e','e','i','i','i','i','n','o','o','o','o','o','u','u','u','u','y','y','A','A','A','A','A','C','E','E','E','E','I','I','I','I','N','O','O','O','O','O','U','U','U','U','Y'],
136
-                $sStringToEncode);
137
-
138
-        $sStringToEncode = preg_replace('/[^a-zA-Z0-9_]+/', '_', preg_quote($sStringToEncode));
139
-        return strtolower($sStringToEncode);
140
-    }
33
+	/**
34
+	 * The base Uri to construct the route
35
+	 * @var string
36
+	 */
37
+	private $_sBaseUri = '';
38
+
39
+	/**
40
+	 * create an URL
41
+	 *
42
+	 * @access public
43
+	 * @param  string $sCode code of the url between "routes" and "route" in Route.conf
44
+	 * @param  array $aParams parameters to create the url
45
+	 * @return string
46
+	 *
47
+	 * @tutorial	If I have this route I could make my URL:
48
+	 *
49
+	 * 				"menu_edit": {
50
+	 *					"route": "[/:language]/menu[/:id]/edit/",
51
+	 *					"controller": "\\src\\BackOffice\\Controller\\MenuManager",
52
+	 *					"action": "edit",
53
+	 *					"constraints": {
54
+	 * 						"language": "[a-z]{0,2}",
55
+	 * 						"id": "[0-9]+"
56
+	 *					},
57
+	 *					"content_type": "html"
58
+	 *				},
59
+	 *
60
+	 *				I must write this:
61
+	 *
62
+	 *				$oUrlManager = new \Venus\core\UrlManager;
63
+	 *				$sUrl = $oUrlManager->getUrl('menu_edit', array('language' => 'vn', 'id' => 125));
64
+	 */
65
+	public function getUrl(string $sCode, array $aParams = array()) : string
66
+	{
67
+		if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
68
+
69
+			foreach (Config::get('Route') as $sHost => $oHost) {
70
+
71
+				if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
72
+					|| (strstr($sHost, '/')
73
+					&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
74
+
75
+					if (strstr($sHost, '/')
76
+						&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
77
+
78
+						$this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
79
+					}
80
+
81
+					if (isset($oHost->routes)) {
82
+
83
+						foreach($oHost->routes as $sKey => $oRoute) {
84
+
85
+							if ($sKey === $sCode) {
86
+
87
+								$sRoute = $this->_sBaseUri.$oRoute->route;
88
+
89
+								if (isset($oRoute->constraints)) {
90
+
91
+									foreach ($oRoute->constraints as $sName => $sType) {
92
+
93
+										if (!isset($aParams[$sName])) { $aParams[$sName] = ''; }
94
+
95
+										if (preg_match('#'.$sType.'#', $aParams[$sName])) {
96
+
97
+											if ($aParams[$sName]) { $sRoute = str_replace('[/:'.$sName.']', '/'.$aParams[$sName], $sRoute); } else { $sRoute = str_replace('[/:'.$sName.']', '', $sRoute); }
98
+											$sRoute = str_replace('[:'.$sName.']', $aParams[$sName], $sRoute);
99
+											continue;
100
+										} else if (isset($oRoute->defaults_constraints)
101
+											&& isset($oRoute->defaults_constraints->{$sName})
102
+											&& preg_match('#'.$sType.'#', $oRoute->defaults_constraints->{$sName})) {
103
+
104
+											continue;
105
+										}
106
+
107
+										throw new \Exception('For the route '.$sCode.' the parameter '.$sName.' is not good!');
108
+									}
109
+								}
110
+
111
+								return $sRoute;
112
+							}
113
+						}
114
+					}
115
+				}
116
+			}
117
+		}
118
+	}
119
+
120
+	/**
121
+	 * encode text for the url
122
+	 *
123
+	 * @access public
124
+	 * @param  string $sStringToEncode text
125
+	 * @return string
126
+	 */
127
+	public function encodeToUrl(string $sStringToEncode) : string
128
+	{
129
+		if (!is_string($sStringToEncode)) {
130
+
131
+			throw new \Exception();
132
+		}
133
+
134
+		$sStringToEncode = str_replace(['à','á','â','ã','ä','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','À','Á','Â','Ã','Ä','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ñ','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý'],
135
+			['a','a','a','a','a','c','e','e','e','e','i','i','i','i','n','o','o','o','o','o','u','u','u','u','y','y','A','A','A','A','A','C','E','E','E','E','I','I','I','I','N','O','O','O','O','O','U','U','U','U','Y'],
136
+				$sStringToEncode);
137
+
138
+		$sStringToEncode = preg_replace('/[^a-zA-Z0-9_]+/', '_', preg_quote($sStringToEncode));
139
+		return strtolower($sStringToEncode);
140
+	}
141 141
 }
Please login to merge, or discard this patch.