@@ -7,11 +7,11 @@ |
||
7 | 7 | */ |
8 | 8 | interface LoggerAwareInterface |
9 | 9 | { |
10 | - /** |
|
11 | - * Sets a logger instance on the object |
|
12 | - * |
|
13 | - * @param LoggerInterface $logger |
|
14 | - * @return null |
|
15 | - */ |
|
16 | - public function setLogger(LoggerInterface $logger); |
|
10 | + /** |
|
11 | + * Sets a logger instance on the object |
|
12 | + * |
|
13 | + * @param LoggerInterface $logger |
|
14 | + * @return null |
|
15 | + */ |
|
16 | + public function setLogger(LoggerInterface $logger); |
|
17 | 17 | } |
@@ -35,31 +35,31 @@ |
||
35 | 35 | abstract class AbstractLogger implements LoggerInterface |
36 | 36 | { |
37 | 37 | /** |
38 | - * Logs with an arbitrary level. |
|
39 | - * |
|
40 | - * @param mixed $level |
|
41 | - * @param string $message |
|
42 | - * @param array $context |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function log($level, $message, array $context = array()) |
|
46 | - { |
|
47 | - if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | - if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | - if ($level === null) { $level = LogLevel::INFO; } |
|
38 | + * Logs with an arbitrary level. |
|
39 | + * |
|
40 | + * @param mixed $level |
|
41 | + * @param string $message |
|
42 | + * @param array $context |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function log($level, $message, array $context = array()) |
|
46 | + { |
|
47 | + if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | + if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | + if ($level === null) { $level = LogLevel::INFO; } |
|
50 | 50 | |
51 | - if (Debug::isDebug() === true) { |
|
51 | + if (Debug::isDebug() === true) { |
|
52 | 52 | |
53 | - if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
53 | + if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
54 | 54 | |
55 | - error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | - } |
|
57 | - if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
55 | + error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | + } |
|
57 | + if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
58 | 58 | |
59 | - echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | - echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | - echo '</td></tr></table>'; |
|
62 | - } |
|
63 | - } |
|
59 | + echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | + echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | + echo '</td></tr></table>'; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | } |
@@ -19,96 +19,96 @@ |
||
19 | 19 | */ |
20 | 20 | interface LoggerInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * System is unusable. |
|
24 | - * |
|
25 | - * @param string $message |
|
26 | - * @param array $context |
|
27 | - * @return null |
|
28 | - */ |
|
29 | - public function emergency($message, array $context = array()); |
|
22 | + /** |
|
23 | + * System is unusable. |
|
24 | + * |
|
25 | + * @param string $message |
|
26 | + * @param array $context |
|
27 | + * @return null |
|
28 | + */ |
|
29 | + public function emergency($message, array $context = array()); |
|
30 | 30 | |
31 | - /** |
|
32 | - * Action must be taken immediately. |
|
33 | - * |
|
34 | - * Example: Entire website down, database unavailable, etc. This should |
|
35 | - * trigger the SMS alerts and wake you up. |
|
36 | - * |
|
37 | - * @param string $message |
|
38 | - * @param array $context |
|
39 | - * @return null |
|
40 | - */ |
|
41 | - public function alert($message, array $context = array()); |
|
31 | + /** |
|
32 | + * Action must be taken immediately. |
|
33 | + * |
|
34 | + * Example: Entire website down, database unavailable, etc. This should |
|
35 | + * trigger the SMS alerts and wake you up. |
|
36 | + * |
|
37 | + * @param string $message |
|
38 | + * @param array $context |
|
39 | + * @return null |
|
40 | + */ |
|
41 | + public function alert($message, array $context = array()); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Critical conditions. |
|
45 | - * |
|
46 | - * Example: Application component unavailable, unexpected exception. |
|
47 | - * |
|
48 | - * @param string $message |
|
49 | - * @param array $context |
|
50 | - * @return null |
|
51 | - */ |
|
52 | - public function critical($message, array $context = array()); |
|
43 | + /** |
|
44 | + * Critical conditions. |
|
45 | + * |
|
46 | + * Example: Application component unavailable, unexpected exception. |
|
47 | + * |
|
48 | + * @param string $message |
|
49 | + * @param array $context |
|
50 | + * @return null |
|
51 | + */ |
|
52 | + public function critical($message, array $context = array()); |
|
53 | 53 | |
54 | - /** |
|
55 | - * Runtime errors that do not require immediate action but should typically |
|
56 | - * be logged and monitored. |
|
57 | - * |
|
58 | - * @param string $message |
|
59 | - * @param array $context |
|
60 | - * @return null |
|
61 | - */ |
|
62 | - public function error($message, array $context = array()); |
|
54 | + /** |
|
55 | + * Runtime errors that do not require immediate action but should typically |
|
56 | + * be logged and monitored. |
|
57 | + * |
|
58 | + * @param string $message |
|
59 | + * @param array $context |
|
60 | + * @return null |
|
61 | + */ |
|
62 | + public function error($message, array $context = array()); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Exceptional occurrences that are not errors. |
|
66 | - * |
|
67 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
68 | - * that are not necessarily wrong. |
|
69 | - * |
|
70 | - * @param string $message |
|
71 | - * @param array $context |
|
72 | - * @return null |
|
73 | - */ |
|
74 | - public function warning($message, array $context = array()); |
|
64 | + /** |
|
65 | + * Exceptional occurrences that are not errors. |
|
66 | + * |
|
67 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
68 | + * that are not necessarily wrong. |
|
69 | + * |
|
70 | + * @param string $message |
|
71 | + * @param array $context |
|
72 | + * @return null |
|
73 | + */ |
|
74 | + public function warning($message, array $context = array()); |
|
75 | 75 | |
76 | - /** |
|
77 | - * Normal but significant events. |
|
78 | - * |
|
79 | - * @param string $message |
|
80 | - * @param array $context |
|
81 | - * @return null |
|
82 | - */ |
|
83 | - public function notice($message, array $context = array()); |
|
76 | + /** |
|
77 | + * Normal but significant events. |
|
78 | + * |
|
79 | + * @param string $message |
|
80 | + * @param array $context |
|
81 | + * @return null |
|
82 | + */ |
|
83 | + public function notice($message, array $context = array()); |
|
84 | 84 | |
85 | - /** |
|
86 | - * Interesting events. |
|
87 | - * |
|
88 | - * Example: User logs in, SQL logs. |
|
89 | - * |
|
90 | - * @param string $message |
|
91 | - * @param array $context |
|
92 | - * @return null |
|
93 | - */ |
|
94 | - public function info($message, array $context = array()); |
|
85 | + /** |
|
86 | + * Interesting events. |
|
87 | + * |
|
88 | + * Example: User logs in, SQL logs. |
|
89 | + * |
|
90 | + * @param string $message |
|
91 | + * @param array $context |
|
92 | + * @return null |
|
93 | + */ |
|
94 | + public function info($message, array $context = array()); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Detailed debug information. |
|
98 | - * |
|
99 | - * @param string $message |
|
100 | - * @param array $context |
|
101 | - * @return null |
|
102 | - */ |
|
103 | - public function debug($message, array $context = array()); |
|
96 | + /** |
|
97 | + * Detailed debug information. |
|
98 | + * |
|
99 | + * @param string $message |
|
100 | + * @param array $context |
|
101 | + * @return null |
|
102 | + */ |
|
103 | + public function debug($message, array $context = array()); |
|
104 | 104 | |
105 | - /** |
|
106 | - * Logs with an arbitrary level. |
|
107 | - * |
|
108 | - * @param mixed $level |
|
109 | - * @param string $message |
|
110 | - * @param array $context |
|
111 | - * @return null |
|
112 | - */ |
|
113 | - public function log($level, $message, array $context = array()); |
|
105 | + /** |
|
106 | + * Logs with an arbitrary level. |
|
107 | + * |
|
108 | + * @param mixed $level |
|
109 | + * @param string $message |
|
110 | + * @param array $context |
|
111 | + * @return null |
|
112 | + */ |
|
113 | + public function log($level, $message, array $context = array()); |
|
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
7 | 7 | */ |
8 | 8 | class LogLevel |
9 | 9 | { |
10 | - const EMERGENCY = 'emergency'; |
|
11 | - const ALERT = 'alert'; |
|
12 | - const CRITICAL = 'critical'; |
|
13 | - const ERROR = 'error'; |
|
14 | - const WARNING = 'warning'; |
|
15 | - const NOTICE = 'notice'; |
|
16 | - const INFO = 'info'; |
|
17 | - const DEBUG = 'debug'; |
|
10 | + const EMERGENCY = 'emergency'; |
|
11 | + const ALERT = 'alert'; |
|
12 | + const CRITICAL = 'critical'; |
|
13 | + const ERROR = 'error'; |
|
14 | + const WARNING = 'warning'; |
|
15 | + const NOTICE = 'notice'; |
|
16 | + const INFO = 'info'; |
|
17 | + const DEBUG = 'debug'; |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -118,10 +118,10 @@ |
||
118 | 118 | $aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']); |
119 | 119 | |
120 | 120 | $fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight); |
121 | - $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | - $iWidth = $aImageSizes[0] / $fRatio; |
|
123 | - $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
124 | - $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
121 | + $iHeight = $aImageSizes[1] / $fRatio; |
|
122 | + $iWidth = $aImageSizes[0] / $fRatio; |
|
123 | + $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
124 | + $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
125 | 125 | |
126 | 126 | $rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']); |
127 | 127 |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Less |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const LESS_WINDOWS = LESS_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const LESS_WINDOWS = LESS_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toCss(string $sFile) |
46 | 46 | { |
47 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
47 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
48 | 48 | |
49 | - $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | - $sContent = shell_exec($sCmd); |
|
51 | - } |
|
52 | - else { |
|
49 | + $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | + $sContent = shell_exec($sCmd); |
|
51 | + } |
|
52 | + else { |
|
53 | 53 | |
54 | - $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | - $sContent = shell_exec($sCmd); |
|
56 | - } |
|
54 | + $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | + $sContent = shell_exec($sCmd); |
|
56 | + } |
|
57 | 57 | |
58 | - header("content-type:text/css"); |
|
59 | - echo $sContent; |
|
58 | + header("content-type:text/css"); |
|
59 | + echo $sContent; |
|
60 | 60 | } |
61 | 61 | } |
@@ -39,29 +39,29 @@ |
||
39 | 39 | */ |
40 | 40 | public function replaceBy(array $aParams = array()) : string |
41 | 41 | { |
42 | - $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
42 | + $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
43 | 43 | |
44 | 44 | if (isset($aParams['template'])) { |
45 | 45 | |
46 | - $aTemplates = explode(';', $aParams['template']); |
|
47 | - $sGetUrl = 'getCss?'; |
|
46 | + $aTemplates = explode(';', $aParams['template']); |
|
47 | + $sGetUrl = 'getCss?'; |
|
48 | 48 | |
49 | - foreach ($aTemplates as $sTemplate) { |
|
49 | + foreach ($aTemplates as $sTemplate) { |
|
50 | 50 | |
51 | - if (strstr($sTemplate, 'css/')) { |
|
51 | + if (strstr($sTemplate, 'css/')) { |
|
52 | 52 | |
53 | - $sGetUrl .= $sTemplate.'&'; |
|
54 | - } |
|
55 | - else if (strstr($sTemplate, 'js/')) { |
|
53 | + $sGetUrl .= $sTemplate.'&'; |
|
54 | + } |
|
55 | + else if (strstr($sTemplate, 'js/')) { |
|
56 | 56 | |
57 | - $sGetUrl .= $sTemplate.'&'; |
|
58 | - } |
|
59 | - } |
|
57 | + $sGetUrl .= $sTemplate.'&'; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
61 | + if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
62 | 62 | |
63 | - $sGetUrl .= ASSET_VERSION; |
|
64 | - } |
|
63 | + $sGetUrl .= ASSET_VERSION; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | return $sGetUrl; |
67 | 67 | } |
@@ -28,30 +28,30 @@ |
||
28 | 28 | */ |
29 | 29 | class Geocoding |
30 | 30 | { |
31 | - /** |
|
32 | - * get the URL with the signature for the Pro account of Google Map |
|
33 | - * |
|
34 | - * @access public |
|
35 | - * @param unknown $sUrlToSign |
|
36 | - * @param unknown $sClientId |
|
37 | - * @param unknown $sPrivateKey |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | - { |
|
42 | - $aUrl = parse_url($sUrlToSign); |
|
43 | - $aUrl['query'] .= '&client=' .$sClientId; |
|
31 | + /** |
|
32 | + * get the URL with the signature for the Pro account of Google Map |
|
33 | + * |
|
34 | + * @access public |
|
35 | + * @param unknown $sUrlToSign |
|
36 | + * @param unknown $sClientId |
|
37 | + * @param unknown $sPrivateKey |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | + { |
|
42 | + $aUrl = parse_url($sUrlToSign); |
|
43 | + $aUrl['query'] .= '&client=' .$sClientId; |
|
44 | 44 | |
45 | - $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
45 | + $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
46 | 46 | |
47 | - $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
47 | + $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
48 | 48 | |
49 | - $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
49 | + $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
50 | 50 | |
51 | - $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
51 | + $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
52 | 52 | |
53 | - $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
53 | + $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
54 | 54 | |
55 | - return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | - } |
|
55 | + return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | + } |
|
57 | 57 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Typescript |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toJs(string $sFile) : string |
46 | 46 | { |
47 | - $aFile = pathinfo($sFile); |
|
48 | - $sFolder = uniqid(); |
|
47 | + $aFile = pathinfo($sFile); |
|
48 | + $sFolder = uniqid(); |
|
49 | 49 | |
50 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
50 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
51 | 51 | |
52 | - $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | - $sContent = shell_exec($sCmd); |
|
54 | - } |
|
55 | - else { |
|
52 | + $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | + $sContent = shell_exec($sCmd); |
|
54 | + } |
|
55 | + else { |
|
56 | 56 | |
57 | - $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | - $sContent = shell_exec($sCmd); |
|
59 | - } |
|
57 | + $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | + $sContent = shell_exec($sCmd); |
|
59 | + } |
|
60 | 60 | |
61 | - header("content-type:text/javascript"); |
|
62 | - return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
61 | + header("content-type:text/javascript"); |
|
62 | + return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
63 | 63 | } |
64 | 64 | } |