@@ -14,43 +14,43 @@ |
||
| 14 | 14 | |
| 15 | 15 | class FlashMessages |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Reset the messages |
|
| 19 | - */ |
|
| 20 | - public static function reset() |
|
| 21 | - { |
|
| 22 | - $_SESSION['erdiko_flash_message'] = array(); |
|
| 23 | - } |
|
| 17 | + /** |
|
| 18 | + * Reset the messages |
|
| 19 | + */ |
|
| 20 | + public static function reset() |
|
| 21 | + { |
|
| 22 | + $_SESSION['erdiko_flash_message'] = array(); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Set flash message |
|
| 27 | - * Add a message to the array |
|
| 28 | - * @note: Should we restrict/limit types to only the 4 listed in the header? |
|
| 29 | - * @param string $message |
|
| 30 | - * @param string $type |
|
| 31 | - */ |
|
| 32 | - public static function set($message, $type = 'danger') |
|
| 33 | - { |
|
| 34 | - $_SESSION['erdiko_flash_message'][] = array( |
|
| 35 | - 'text' => $message, |
|
| 36 | - 'type' => $type |
|
| 37 | - ); |
|
| 25 | + /** |
|
| 26 | + * Set flash message |
|
| 27 | + * Add a message to the array |
|
| 28 | + * @note: Should we restrict/limit types to only the 4 listed in the header? |
|
| 29 | + * @param string $message |
|
| 30 | + * @param string $type |
|
| 31 | + */ |
|
| 32 | + public static function set($message, $type = 'danger') |
|
| 33 | + { |
|
| 34 | + $_SESSION['erdiko_flash_message'][] = array( |
|
| 35 | + 'text' => $message, |
|
| 36 | + 'type' => $type |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - $_SESSION['erdiko_flash_message']; |
|
| 40 | - } |
|
| 39 | + $_SESSION['erdiko_flash_message']; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Get flash messages |
|
| 44 | - * @return array $messages |
|
| 45 | - */ |
|
| 46 | - public static function get() |
|
| 47 | - { |
|
| 48 | - $messages = array(); |
|
| 49 | - if(isset($_SESSION['erdiko_flash_message'])) |
|
| 50 | - $messages = $_SESSION['erdiko_flash_message']; |
|
| 51 | - self::reset(); |
|
| 42 | + /** |
|
| 43 | + * Get flash messages |
|
| 44 | + * @return array $messages |
|
| 45 | + */ |
|
| 46 | + public static function get() |
|
| 47 | + { |
|
| 48 | + $messages = array(); |
|
| 49 | + if(isset($_SESSION['erdiko_flash_message'])) |
|
| 50 | + $messages = $_SESSION['erdiko_flash_message']; |
|
| 51 | + self::reset(); |
|
| 52 | 52 | |
| 53 | - return $messages; |
|
| 54 | - } |
|
| 53 | + return $messages; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | public static function get() |
| 47 | 47 | { |
| 48 | 48 | $messages = array(); |
| 49 | - if(isset($_SESSION['erdiko_flash_message'])) |
|
| 49 | + if (isset($_SESSION['erdiko_flash_message'])) |
|
| 50 | 50 | $messages = $_SESSION['erdiko_flash_message']; |
| 51 | 51 | self::reset(); |
| 52 | 52 | |
@@ -46,8 +46,9 @@ |
||
| 46 | 46 | public static function get() |
| 47 | 47 | { |
| 48 | 48 | $messages = array(); |
| 49 | - if(isset($_SESSION['erdiko_flash_message'])) |
|
| 50 | - $messages = $_SESSION['erdiko_flash_message']; |
|
| 49 | + if(isset($_SESSION['erdiko_flash_message'])) { |
|
| 50 | + $messages = $_SESSION['erdiko_flash_message']; |
|
| 51 | + } |
|
| 51 | 52 | self::reset(); |
| 52 | 53 | |
| 53 | 54 | return $messages; |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | class AjaxController extends Controller |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Contructor |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * Contructor |
|
| 25 | + */ |
|
| 26 | 26 | public function __construct() |
| 27 | 27 | { |
| 28 | 28 | $this->_webroot = ERDIKO_ROOT; |
@@ -20,4 +20,4 @@ |
||
| 20 | 20 | |
| 21 | 21 | // Set a default context if none specified |
| 22 | 22 | if(empty(getenv('ERDIKO_CONTEXT'))) |
| 23 | - putenv("ERDIKO_CONTEXT=default"); |
|
| 24 | 23 | \ No newline at end of file |
| 24 | + putenv("ERDIKO_CONTEXT=default"); |
|
| 25 | 25 | \ No newline at end of file |
@@ -19,5 +19,5 @@ |
||
| 19 | 19 | putenv("ERDIKO_DEBUG=".$debug); |
| 20 | 20 | |
| 21 | 21 | // Set a default context if none specified |
| 22 | -if(empty(getenv('ERDIKO_CONTEXT'))) |
|
| 22 | +if (empty(getenv('ERDIKO_CONTEXT'))) |
|
| 23 | 23 | putenv("ERDIKO_CONTEXT=default"); |
| 24 | 24 | \ No newline at end of file |
@@ -19,5 +19,6 @@ |
||
| 19 | 19 | putenv("ERDIKO_DEBUG=".$debug); |
| 20 | 20 | |
| 21 | 21 | // Set a default context if none specified |
| 22 | -if(empty(getenv('ERDIKO_CONTEXT'))) |
|
| 23 | - putenv("ERDIKO_CONTEXT=default"); |
|
| 24 | 22 | \ No newline at end of file |
| 23 | +if(empty(getenv('ERDIKO_CONTEXT'))) { |
|
| 24 | + putenv("ERDIKO_CONTEXT=default"); |
|
| 25 | +} |
|
@@ -162,17 +162,17 @@ |
||
| 162 | 162 | */ |
| 163 | 163 | public function removeLogFile($key) |
| 164 | 164 | { |
| 165 | - $arrayKey=strtolower($key); |
|
| 166 | - unset($this->_logFiles[$arrayKey]); |
|
| 167 | - return true; |
|
| 165 | + $arrayKey=strtolower($key); |
|
| 166 | + unset($this->_logFiles[$arrayKey]); |
|
| 167 | + return true; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * Clear Log |
|
| 172 | - * |
|
| 173 | - * @param string $logKey |
|
| 174 | - * @return bool |
|
| 175 | - */ |
|
| 170 | + /** |
|
| 171 | + * Clear Log |
|
| 172 | + * |
|
| 173 | + * @param string $logKey |
|
| 174 | + * @return bool |
|
| 175 | + */ |
|
| 176 | 176 | public function clearLog($logKey = null) |
| 177 | 177 | { |
| 178 | 178 | $ret=true; |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | public function addRecord($level, $message, array $context = array()) |
| 109 | 109 | { |
| 110 | 110 | $message = (string) $message; |
| 111 | - $logString=date('Y-m-d H:i:s')." ".$level.": ".$this->interpolate($message, $context).PHP_EOL; |
|
| 112 | - $logFileName=$this->_logFiles["default"]; // If log key is null use the default log file |
|
| 111 | + $logString = date('Y-m-d H:i:s')." ".$level.": ".$this->interpolate($message, $context).PHP_EOL; |
|
| 112 | + $logFileName = $this->_logFiles["default"]; // If log key is null use the default log file |
|
| 113 | 113 | |
| 114 | 114 | return $this->write($logString, $logFileName, null, "a"); |
| 115 | 115 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | $replace = array(); |
| 131 | 131 | foreach ($context as $key => $val) { |
| 132 | 132 | if ($key == "exception" && $val instanceof \Exception) { |
| 133 | - $replace['{' . $key . '}'] = $val->getMessage(); |
|
| 133 | + $replace['{'.$key.'}'] = $val->getMessage(); |
|
| 134 | 134 | } else { |
| 135 | - $replace['{' . $key . '}'] = $val; |
|
| 135 | + $replace['{'.$key.'}'] = $val; |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function addLogFile($key, $logFileName) |
| 152 | 152 | { |
| 153 | - $arrayKey=strtolower($key); |
|
| 153 | + $arrayKey = strtolower($key); |
|
| 154 | 154 | return $this->_logFiles[$arrayKey] = $logFileName; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function removeLogFile($key) |
| 164 | 164 | { |
| 165 | - $arrayKey=strtolower($key); |
|
| 165 | + $arrayKey = strtolower($key); |
|
| 166 | 166 | unset($this->_logFiles[$arrayKey]); |
| 167 | 167 | return true; |
| 168 | 168 | } |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function clearLog($logKey = null) |
| 177 | 177 | { |
| 178 | - $ret=true; |
|
| 179 | - if ($logKey==null) { |
|
| 178 | + $ret = true; |
|
| 179 | + if ($logKey == null) { |
|
| 180 | 180 | foreach ($this->_logFiles as $key => $logFile) { |
| 181 | 181 | $ret = $ret && $this->write("", $logFile); |
| 182 | 182 | } |
| 183 | 183 | return $ret; |
| 184 | 184 | } else { |
| 185 | - $arrayKey=strtolower($logKey); |
|
| 185 | + $arrayKey = strtolower($logKey); |
|
| 186 | 186 | if (isset($this->_logFiles[$arrayKey])) { |
| 187 | 187 | return $this->write("", $this->_logFiles[$arrayKey]); |
| 188 | 188 | } else { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $level |
| 57 | 57 | * @param string or an object with a __toString() method$ message |
| 58 | 58 | * @param array $context |
| 59 | - * @return bool |
|
| 59 | + * @return integer|null |
|
| 60 | 60 | */ |
| 61 | 61 | public function log($level, $message, array $context = array()) |
| 62 | 62 | { |
@@ -100,7 +100,8 @@ discard block |
||
| 100 | 100 | * @param string $level |
| 101 | 101 | * @param string or an object with a __toString() method$ message |
| 102 | 102 | * @param array $context |
| 103 | - * @return bool |
|
| 103 | + * @param string $message |
|
| 104 | + * @return integer |
|
| 104 | 105 | */ |
| 105 | 106 | public function addRecord($level, $message, array $context = array()) |
| 106 | 107 | { |
@@ -118,7 +119,7 @@ discard block |
||
| 118 | 119 | * |
| 119 | 120 | * @param string $message or an object with a __toString() method |
| 120 | 121 | * @param array $context replacement values for placeholders |
| 121 | - * @return bool |
|
| 122 | + * @return string |
|
| 122 | 123 | */ |
| 123 | 124 | function interpolate($message, array $context = array()) |
| 124 | 125 | { |
@@ -142,7 +143,7 @@ discard block |
||
| 142 | 143 | * |
| 143 | 144 | * @param mixed $key |
| 144 | 145 | * @param string $logFileName |
| 145 | - * @return bool |
|
| 146 | + * @return string |
|
| 146 | 147 | */ |
| 147 | 148 | public function addLogFile($key, $logFileName) |
| 148 | 149 | { |
@@ -198,7 +199,7 @@ discard block |
||
| 198 | 199 | * @param string $message |
| 199 | 200 | * @param array $context |
| 200 | 201 | * |
| 201 | - * @return null |
|
| 202 | + * @return integer |
|
| 202 | 203 | */ |
| 203 | 204 | public function emergency($message, array $context = array()) |
| 204 | 205 | { |
@@ -215,7 +216,7 @@ discard block |
||
| 215 | 216 | * @param string $message |
| 216 | 217 | * @param array $context |
| 217 | 218 | * |
| 218 | - * @return null |
|
| 219 | + * @return integer |
|
| 219 | 220 | */ |
| 220 | 221 | public function alert($message, array $context = array()) |
| 221 | 222 | { |
@@ -231,7 +232,7 @@ discard block |
||
| 231 | 232 | * @param string $message |
| 232 | 233 | * @param array $context |
| 233 | 234 | * |
| 234 | - * @return null |
|
| 235 | + * @return integer |
|
| 235 | 236 | */ |
| 236 | 237 | public function critical($message, array $context = array()) |
| 237 | 238 | { |
@@ -246,7 +247,7 @@ discard block |
||
| 246 | 247 | * @param string $message |
| 247 | 248 | * @param array $context |
| 248 | 249 | * |
| 249 | - * @return null |
|
| 250 | + * @return integer |
|
| 250 | 251 | */ |
| 251 | 252 | public function error($message, array $context = array()) |
| 252 | 253 | { |
@@ -263,7 +264,7 @@ discard block |
||
| 263 | 264 | * @param string $message |
| 264 | 265 | * @param array $context |
| 265 | 266 | * |
| 266 | - * @return null |
|
| 267 | + * @return integer |
|
| 267 | 268 | */ |
| 268 | 269 | public function warning($message, array $context = array()) |
| 269 | 270 | { |
@@ -277,7 +278,7 @@ discard block |
||
| 277 | 278 | * @param string $message |
| 278 | 279 | * @param array $context |
| 279 | 280 | * |
| 280 | - * @return null |
|
| 281 | + * @return integer |
|
| 281 | 282 | */ |
| 282 | 283 | public function notice($message, array $context = array()) |
| 283 | 284 | { |
@@ -293,7 +294,7 @@ discard block |
||
| 293 | 294 | * @param string $message |
| 294 | 295 | * @param array $context |
| 295 | 296 | * |
| 296 | - * @return null |
|
| 297 | + * @return integer |
|
| 297 | 298 | */ |
| 298 | 299 | public function info($message, array $context = array()) |
| 299 | 300 | { |
@@ -307,7 +308,7 @@ discard block |
||
| 307 | 308 | * @param string $message |
| 308 | 309 | * @param array $context |
| 309 | 310 | * |
| 310 | - * @return null |
|
| 311 | + * @return integer |
|
| 311 | 312 | */ |
| 312 | 313 | public function debug($message, array $context = array()) |
| 313 | 314 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | // Search through routes and find first match |
| 42 | 42 | foreach ($routes as $pattern => $handler_name) { |
| 43 | 43 | $patternRep = strtr($pattern, $tokens); |
| 44 | - if (preg_match('#^/?' . $patternRep . '/?$#', $path_info, $matches)) { |
|
| 44 | + if (preg_match('#^/?'.$patternRep.'/?$#', $path_info, $matches)) { |
|
| 45 | 45 | $discovered_handler = $handler_name; |
| 46 | 46 | $regex_matches = $matches; |
| 47 | 47 | $params = isset($regex_matches[1]) ? explode("/", $regex_matches[1]) : array(); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if ($handler_instance) { |
| 87 | - if (self::is_xhr_request() && method_exists($handler_instance, $action . '_xhr')) { |
|
| 87 | + if (self::is_xhr_request() && method_exists($handler_instance, $action.'_xhr')) { |
|
| 88 | 88 | header('Content-type: application/json'); // @todo support xml |
| 89 | 89 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 90 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 90 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 91 | 91 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
| 92 | 92 | header('Cache-Control: post-check=0, pre-check=0', false); |
| 93 | 93 | header("Access-Control-Allow-Origin: *"); // @todo make this a parameter? |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function addCss($name, $cssFile, $order = 10, $active = 1) |
| 212 | 212 | { |
| 213 | - $this->_data['css'][$name] = array( |
|
| 213 | + $this->_data['css'][$name] = array( |
|
| 214 | 214 | 'file' => $cssFile, |
| 215 | 215 | 'order' => $order, |
| 216 | 216 | 'active' => $active |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | ); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Get Theme Root Folder |
|
| 252 | - * |
|
| 253 | - * @param string $folder |
|
| 254 | - */ |
|
| 250 | + /** |
|
| 251 | + * Get Theme Root Folder |
|
| 252 | + * |
|
| 253 | + * @param string $folder |
|
| 254 | + */ |
|
| 255 | 255 | public function getThemeRootFolder() |
| 256 | 256 | { |
| 257 | 257 | return $this->_themeRootFolder; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function getThemeConfig() |
| 77 | 77 | { |
| 78 | 78 | if (empty($this->_themeConfig)) { |
| 79 | - $file = $this->getThemeFolder() . 'theme.json'; |
|
| 79 | + $file = $this->getThemeFolder().'theme.json'; |
|
| 80 | 80 | $this->_themeConfig = Helper::getConfigFile($file); |
| 81 | 81 | } |
| 82 | 82 | return $this->_themeConfig; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function getMeta() |
| 91 | 91 | { |
| 92 | 92 | if (isset($this->_contextConfig['site']['meta'])) { |
| 93 | - return array_merge($this->_contextConfig['site']['meta'],$this->_data['meta']); |
|
| 93 | + return array_merge($this->_contextConfig['site']['meta'], $this->_data['meta']); |
|
| 94 | 94 | } else { |
| 95 | 95 | return $this->_data['meta']; |
| 96 | 96 | } |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | foreach ($this->getMeta() as $name => $content) |
| 129 | 129 | { |
| 130 | - if(is_array($content)) { |
|
| 131 | - foreach($content as $cont) |
|
| 130 | + if (is_array($content)) { |
|
| 131 | + foreach ($content as $cont) |
|
| 132 | 132 | $html .= "<meta name=\"{$name}\" content=\"{$cont}\">\n"; |
| 133 | 133 | } else { |
| 134 | 134 | $html .= "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
@@ -62,8 +62,9 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getContextConfig() |
| 64 | 64 | { |
| 65 | - if (empty($this->_contextConfig)) |
|
| 66 | - $this->_contextConfig = Helper::getConfig('application', $this->_context); |
|
| 65 | + if (empty($this->_contextConfig)) { |
|
| 66 | + $this->_contextConfig = Helper::getConfig('application', $this->_context); |
|
| 67 | + } |
|
| 67 | 68 | |
| 68 | 69 | return $this->_contextConfig; |
| 69 | 70 | } |
@@ -128,8 +129,9 @@ discard block |
||
| 128 | 129 | foreach ($this->getMeta() as $name => $content) |
| 129 | 130 | { |
| 130 | 131 | if(is_array($content)) { |
| 131 | - foreach($content as $cont) |
|
| 132 | - $html .= "<meta name=\"{$name}\" content=\"{$cont}\">\n"; |
|
| 132 | + foreach($content as $cont) { |
|
| 133 | + $html .= "<meta name=\"{$name}\" content=\"{$cont}\">\n"; |
|
| 134 | + } |
|
| 133 | 135 | } else { |
| 134 | 136 | $html .= "<meta name=\"{$name}\" content=\"{$content}\">\n"; |
| 135 | 137 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param string $name |
| 207 | 207 | * @param string $cssFile URL of injected css file |
| 208 | 208 | * @param int $order |
| 209 | - * @param boolean $active defaults to 1 |
|
| 209 | + * @param integer $active defaults to 1 |
|
| 210 | 210 | * @todo need to resolve order of merging and/or eliminate/refactor this function |
| 211 | 211 | */ |
| 212 | 212 | public function addCss($name, $cssFile, $order = 10, $active = 1) |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @param string $name |
| 240 | 240 | * @param string $jsFile URL of js file |
| 241 | 241 | * @param int $order |
| 242 | - * @param boolean $active defaults to 1 |
|
| 242 | + * @param integer $active defaults to 1 |
|
| 243 | 243 | * @todo same issue as addCss |
| 244 | 244 | */ |
| 245 | 245 | public function addJs($name, $jsFile, $order = 10, $active = 1) |
@@ -254,7 +254,6 @@ discard block |
||
| 254 | 254 | /** |
| 255 | 255 | * Get Theme Root Folder |
| 256 | 256 | * |
| 257 | - * @param string $folder |
|
| 258 | 257 | */ |
| 259 | 258 | public function getThemeRootFolder() |
| 260 | 259 | { |
@@ -295,7 +294,7 @@ discard block |
||
| 295 | 294 | /** |
| 296 | 295 | * Set content |
| 297 | 296 | * |
| 298 | - * @param string|Container $content any string or object that implements __toString() |
|
| 297 | + * @param string $content any string or object that implements __toString() |
|
| 299 | 298 | */ |
| 300 | 299 | public function setContent($content) |
| 301 | 300 | { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Log Object |
| 19 | 19 | */ |
| 20 | - protected static $_logObject=null; // @todo get rid of this |
|
| 20 | + protected static $_logObject = null; // @todo get rid of this |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Load a view from the current theme with the given data |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function getConfig($name = 'application', $context = null) |
| 66 | 66 | { |
| 67 | - if($context == null) |
|
| 67 | + if ($context == null) |
|
| 68 | 68 | $context = getenv('ERDIKO_CONTEXT'); |
| 69 | 69 | |
| 70 | 70 | $filename = ERDIKO_APP."/config/{$context}/{$name}.json"; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function getRoutes($context = null) |
| 80 | 80 | { |
| 81 | - if($context == null) |
|
| 81 | + if ($context == null) |
|
| 82 | 82 | $context = getenv('ERDIKO_CONTEXT'); |
| 83 | 83 | $file = ERDIKO_APP."/config/{$context}/routes.json"; |
| 84 | 84 | $applicationConfig = self::getConfigFile($file); |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function sendEmail($toEmail, $subject, $body, $fromEmail) |
| 94 | 94 | { |
| 95 | - $headers = "From: $fromEmail\r\n" . |
|
| 96 | - "Reply-To: $fromEmail\r\n" . |
|
| 97 | - "X-Mailer: PHP/" . phpversion(); |
|
| 95 | + $headers = "From: $fromEmail\r\n". |
|
| 96 | + "Reply-To: $fromEmail\r\n". |
|
| 97 | + "X-Mailer: PHP/".phpversion(); |
|
| 98 | 98 | |
| 99 | 99 | return mail($toEmail, $subject, $body, $headers); |
| 100 | 100 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public static function log($level, $message, array $context = array()) |
| 114 | 114 | { |
| 115 | - if(self::$_logObject==null) |
|
| 115 | + if (self::$_logObject == null) |
|
| 116 | 116 | { |
| 117 | 117 | $erdikoContext = getenv('ERDIKO_CONTEXT'); |
| 118 | 118 | $config = self::getConfig("application", $erdikoContext); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | self::$_logObject = new \erdiko\core\Logger($logFiles, $logDir); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if(empty($level)) |
|
| 125 | + if (empty($level)) |
|
| 126 | 126 | $level = \Psr\Log\LogLevel::DEBUG; // Default to debug for convenience |
| 127 | 127 | |
| 128 | 128 | return self::$_logObject->log($level, $message, $context); |
@@ -64,8 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function getConfig($name = 'application', $context = null) |
| 66 | 66 | { |
| 67 | - if($context == null) |
|
| 68 | - $context = getenv('ERDIKO_CONTEXT'); |
|
| 67 | + if($context == null) { |
|
| 68 | + $context = getenv('ERDIKO_CONTEXT'); |
|
| 69 | + } |
|
| 69 | 70 | |
| 70 | 71 | $filename = ERDIKO_APP."/config/{$context}/{$name}.json"; |
| 71 | 72 | return self::getConfigFile($filename); |
@@ -78,8 +79,9 @@ discard block |
||
| 78 | 79 | */ |
| 79 | 80 | public static function getRoutes($context = null) |
| 80 | 81 | { |
| 81 | - if($context == null) |
|
| 82 | - $context = getenv('ERDIKO_CONTEXT'); |
|
| 82 | + if($context == null) { |
|
| 83 | + $context = getenv('ERDIKO_CONTEXT'); |
|
| 84 | + } |
|
| 83 | 85 | $file = ERDIKO_APP."/config/{$context}/routes.json"; |
| 84 | 86 | $applicationConfig = self::getConfigFile($file); |
| 85 | 87 | |
@@ -122,8 +124,10 @@ discard block |
||
| 122 | 124 | self::$_logObject = new \erdiko\core\Logger($logFiles, $logDir); |
| 123 | 125 | } |
| 124 | 126 | |
| 125 | - if(empty($level)) |
|
| 126 | - $level = \Psr\Log\LogLevel::DEBUG; // Default to debug for convenience |
|
| 127 | + if(empty($level)) { |
|
| 128 | + $level = \Psr\Log\LogLevel::DEBUG; |
|
| 129 | + } |
|
| 130 | + // Default to debug for convenience |
|
| 127 | 131 | |
| 128 | 132 | return self::$_logObject->log($level, $message, $context); |
| 129 | 133 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Read JSON config file and return array |
| 39 | 39 | * |
| 40 | - * @param string $file |
|
| 40 | + * @param string $filename |
|
| 41 | 41 | * @return array $config |
| 42 | 42 | */ |
| 43 | 43 | public static function getConfigFile($filename) |
@@ -60,6 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Get configuration |
| 63 | + * @param string $context |
|
| 63 | 64 | */ |
| 64 | 65 | public static function getConfig($name = 'application', $context = null) |
| 65 | 66 | { |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Theme |
| 20 | 20 | */ |
| 21 | - protected $_theme; |
|
| 21 | + protected $_theme; |
|
| 22 | 22 | /** |
| 23 | 23 | * Content |
| 24 | 24 | */ |
| 25 | - protected $_content = null; |
|
| 25 | + protected $_content = null; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Ajax render function |