@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // check access for API response modes |
| 69 | 69 | $this->responseBuilder = JsonBuilder::class; |
| 70 | 70 | |
| 71 | - if (in_array($this->responseBuilder, [JsonBuilder::class,JsonpBuilder::class])) { |
|
| 71 | + if (in_array($this->responseBuilder, [JsonBuilder::class, JsonpBuilder::class])) { |
|
| 72 | 72 | if (!$this->checkAPIAccess()) { |
| 73 | 73 | return $this->throwAPIUnAuthorizedError(); |
| 74 | 74 | } |
@@ -81,8 +81,7 @@ discard block |
||
| 81 | 81 | public function handleRecordsRequest($action = false): ResponseInterface |
| 82 | 82 | { |
| 83 | 83 | switch ($action ? $action : $action = $this->shiftPath()) { |
| 84 | - case 'save': |
|
| 85 | - { |
|
| 84 | + case 'save' : { |
|
| 86 | 85 | return $this->handleMultiSaveRequest(); |
| 87 | 86 | } |
| 88 | 87 | |
@@ -223,9 +222,7 @@ discard block |
||
| 223 | 222 | } |
| 224 | 223 | |
| 225 | 224 | switch ($action ? $action : $action = $this->shiftPath()) { |
| 226 | - case '': |
|
| 227 | - case false: |
|
| 228 | - { |
|
| 225 | + case '' : case false : { |
|
| 229 | 226 | $className = static::$recordClass; |
| 230 | 227 | |
| 231 | 228 | return $this->respond($this->getTemplateName($className::$singularNoun), [ |
@@ -313,7 +310,7 @@ discard block |
||
| 313 | 310 | { |
| 314 | 311 | $className = static::$recordClass; |
| 315 | 312 | |
| 316 | - $this->prepareResponseModeJSON(['POST','PUT']); |
|
| 313 | + $this->prepareResponseModeJSON(['POST', 'PUT']); |
|
| 317 | 314 | |
| 318 | 315 | if ($className::fieldExists(key($_REQUEST['data']))) { |
| 319 | 316 | $_REQUEST['data'] = [$_REQUEST['data']]; |
@@ -385,7 +382,7 @@ discard block |
||
| 385 | 382 | { |
| 386 | 383 | $className = static::$recordClass; |
| 387 | 384 | |
| 388 | - $this->prepareResponseModeJSON(['POST','PUT','DELETE']); |
|
| 385 | + $this->prepareResponseModeJSON(['POST', 'PUT', 'DELETE']); |
|
| 389 | 386 | |
| 390 | 387 | if ($className::fieldExists(key($_REQUEST['data']))) { |
| 391 | 388 | $_REQUEST['data'] = [$_REQUEST['data']]; |
@@ -447,7 +444,7 @@ discard block |
||
| 447 | 444 | return $this->throwUnauthorizedError(); |
| 448 | 445 | } |
| 449 | 446 | |
| 450 | - if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) { |
|
| 447 | + if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) { |
|
| 451 | 448 | if ($this->responseBuilder === JsonBuilder::class) { |
| 452 | 449 | $_REQUEST = JSON::getRequestData(); |
| 453 | 450 | if (is_array($_REQUEST['data'])) { |
@@ -597,7 +594,7 @@ discard block |
||
| 597 | 594 | |
| 598 | 595 | public function getTemplateName($noun) |
| 599 | 596 | { |
| 600 | - return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) { |
|
| 597 | + return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) { |
|
| 601 | 598 | return strtoupper($matches[1]); |
| 602 | 599 | }, $noun); |
| 603 | 600 | } |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | |
| 44 | 44 | public function config($Label) |
| 45 | 45 | { |
| 46 | - $Config = $this->ApplicationPath . '/config/' . $Label . '.php'; |
|
| 46 | + $Config = $this->ApplicationPath.'/config/'.$Label.'.php'; |
|
| 47 | 47 | if (!file_exists($Config)) { |
| 48 | - throw new \Exception($Config . ' not found in '.static::class.'::config()'); |
|
| 48 | + throw new \Exception($Config.' not found in '.static::class.'::config()'); |
|
| 49 | 49 | } |
| 50 | 50 | return require $Config; |
| 51 | 51 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public static $searchConditions = [ |
| 82 | 82 | 'Caption' => [ |
| 83 | - 'qualifiers' => ['any','caption'], |
|
| 83 | + 'qualifiers' => ['any', 'caption'], |
|
| 84 | 84 | 'points' => 2, |
| 85 | 85 | 'sql' => 'Caption LIKE "%%%s%%"', |
| 86 | 86 | ], |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public static $defaultFilenameFormat = 'default.%s.jpg'; |
| 110 | 110 | public static $newDirectoryPermissions = 0775; |
| 111 | 111 | public static $newFilePermissions = 0664; |
| 112 | - public static $magicPath = null;//'/usr/share/misc/magic.mgc'; |
|
| 112 | + public static $magicPath = null; //'/usr/share/misc/magic.mgc'; |
|
| 113 | 113 | public static $useFaceDetection = true; |
| 114 | 114 | public static $faceDetectionTimeLimit = 10; |
| 115 | 115 | |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | public static function getBlankPath($contextClass) |
| 630 | 630 | { |
| 631 | - $path = ['site-root','img',sprintf(static::$defaultFilenameFormat, $contextClass)]; |
|
| 631 | + $path = ['site-root', 'img', sprintf(static::$defaultFilenameFormat, $contextClass)]; |
|
| 632 | 632 | |
| 633 | 633 | if ($node = Site::resolvePath($path)) { |
| 634 | 634 | return $node->RealPath; |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | $Session->setFields($sessionData); |
| 114 | 114 | if (function_exists('fastcgi_finish_request')) { |
| 115 | 115 | // @codeCoverageIgnoreStart |
| 116 | - register_shutdown_function(function ($Session) { |
|
| 116 | + register_shutdown_function(function($Session) { |
|
| 117 | 117 | $Session->save(); |
| 118 | 118 | }, $Session); |
| 119 | 119 | // @codeCoverageIgnoreEnd |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public $searchConditions = [ |
| 41 | 41 | 'Caption' => [ |
| 42 | - 'qualifiers' => ['any','caption'] |
|
| 42 | + 'qualifiers' => ['any', 'caption'] |
|
| 43 | 43 | ,'points' => 2 |
| 44 | 44 | ,'sql' => 'Caption LIKE "%%%s%%"', |
| 45 | 45 | ] |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
| 192 | 192 | $put = fopen(static::$inputStream, 'r'); // open input stream |
| 193 | 193 | |
| 194 | - $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
| 194 | + $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
| 195 | 195 | $fp = fopen($tmp, 'w'); // open write stream to temp file |
| 196 | 196 | |
| 197 | 197 | // write |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return $this->respond('uploadComplete', [ |
| 230 | - 'success' => (boolean)$Media |
|
| 230 | + 'success' => (boolean) $Media |
|
| 231 | 231 | ,'data' => $Media, |
| 232 | 232 | ]); |
| 233 | 233 | } |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // send caching headers |
| 280 | - $expires = 60*60*24*365; |
|
| 280 | + $expires = 60 * 60 * 24 * 365; |
|
| 281 | 281 | if (!headers_sent()) { |
| 282 | 282 | // @codeCoverageIgnoreStart |
| 283 | 283 | header("Cache-Control: public, max-age=$expires"); |
| 284 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
| 284 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
| 285 | 285 | header('Pragma: public'); |
| 286 | 286 | // @codeCoverageIgnoreEnd |
| 287 | 287 | } |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | // send caching headers |
| 525 | 525 | if (!headers_sent()) { |
| 526 | 526 | // @codeCoverageIgnoreStart |
| 527 | - $expires = 60*60*24*365; |
|
| 527 | + $expires = 60 * 60 * 24 * 365; |
|
| 528 | 528 | header("Cache-Control: public, max-age=$expires"); |
| 529 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
| 529 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
| 530 | 530 | header('Pragma: public'); |
| 531 | 531 | // @codeCoverageIgnoreEnd |
| 532 | 532 | } |