@@ -26,14 +26,14 @@ |
||
| 26 | 26 | |
| 27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
| 28 | 28 | $ratio = min($hRatio, $wRatio); |
| 29 | - if($ratio > 1) $ratio = 1; |
|
| 29 | + if ($ratio > 1) $ratio = 1; |
|
| 30 | 30 | |
| 31 | 31 | // Define sizes |
| 32 | 32 | $this->_destWidth = floor($originalWidth * $ratio); |
| 33 | 33 | $this->_destHeight = floor($originalHeight * $ratio); |
| 34 | 34 | |
| 35 | 35 | // Define margins |
| 36 | - $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
| 36 | + $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
| 37 | 37 | $this->_destY = floor(($this->_height - $this->_destHeight) / 2); |
| 38 | 38 | |
| 39 | 39 | // Execute the Crop method with the given parameters |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
| 28 | 28 | $ratio = min($hRatio, $wRatio); |
| 29 | - if($ratio > 1) $ratio = 1; |
|
| 29 | + if($ratio > 1) { |
|
| 30 | + $ratio = 1; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | // Define sizes |
| 32 | 34 | $this->_destWidth = floor($originalWidth * $ratio); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * @param resource $imageResource |
| 19 | 19 | * @return resource |
| 20 | - */ |
|
| 20 | + */ |
|
| 21 | 21 | public function Execute($imageResource) |
| 22 | 22 | { |
| 23 | 23 | // Define the origial width and height |
@@ -62,8 +62,8 @@ |
||
| 62 | 62 | |
| 63 | 63 | // Preserve transparency |
| 64 | 64 | imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); |
| 65 | - imagealphablending($new, false); |
|
| 66 | - imagesavealpha($new, true); |
|
| 65 | + imagealphablending($new, false); |
|
| 66 | + imagesavealpha($new, true); |
|
| 67 | 67 | |
| 68 | 68 | imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight); |
| 69 | 69 | |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | // Define which ratio will be used, depending on which is the biggest side |
| 42 | 42 | $ratio = $wRatio < $hRatio ? $wRatio : $hRatio; |
| 43 | - if ($ratio < 1) $ratio = 1; |
|
| 43 | + if ($ratio < 1) { |
|
| 44 | + $ratio = 1; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | // Calculate the destination width, height, x and y |
| 46 | 48 | $this->_destWidth = $originalWidth / $ratio; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $output = ''; |
| 50 | 50 | for ($i = 0; $i < $count; $i += 16) { |
| 51 | 51 | $random_state = |
| 52 | - md5(microtime() . $random_state); |
|
| 52 | + md5(microtime().$random_state); |
|
| 53 | 53 | $output .= |
| 54 | 54 | pack('H*', md5($random_state)); |
| 55 | 55 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | spl_autoload_extensions('.php'); |
| 3 | 3 | spl_autoload_register("autoloader"); |
| 4 | 4 | |
| 5 | -$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)) . '/../../') . '/'); |
|
| 5 | +$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)).'/../../').'/'); |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * The function to be registered as the default autoload functino |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | global $rootPath; |
| 35 | - $file = $rootPath . str_replace('\\', '/', $class) . ".php"; |
|
| 35 | + $file = $rootPath.str_replace('\\', '/', $class).".php"; |
|
| 36 | 36 | $debug_backtrace = debug_backtrace(); |
| 37 | 37 | |
| 38 | 38 | if (file_exists($file)) { |
| 39 | 39 | require_once($file); |
| 40 | 40 | if ($throwException) { |
| 41 | 41 | if (class_exists($class, false) == false && interface_exists($class, false) == false) { |
| 42 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file); |
|
| 42 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file); |
|
| 43 | 43 | } else { |
| 44 | 44 | return true; |
| 45 | 45 | } |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | } else { |
| 49 | 49 | if (isset($debug_backtrace[2]) && isset($debug_backtrace[2]['file']) && isset($debug_backtrace[2]['line'])) { |
| 50 | 50 | if ($throwException) { |
| 51 | - errorHandler(0, 'Could not load class \'' . $class . '\' in file ' . $rootPath . $file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
| 51 | + errorHandler(0, 'Could not load class \''.$class.'\' in file '.$rootPath.$file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
| 52 | 52 | } else { |
| 53 | 53 | return false; |
| 54 | 54 | } |
| 55 | 55 | } else { |
| 56 | 56 | if ($throwException) { |
| 57 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file . "\n" . 'Called from unknown origin.'); |
|
| 57 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file."\n".'Called from unknown origin.'); |
|
| 58 | 58 | } else { |
| 59 | 59 | return false; |
| 60 | 60 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function shutdownHandler () { |
| 33 | 33 | $error = error_get_last(); |
| 34 | - if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 35 | - errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
| 36 | - }elseif ($error['type'] == 1) { |
|
| 37 | - dump($error); |
|
| 38 | - } |
|
| 34 | + if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 35 | + errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
| 36 | + }elseif ($error['type'] == 1) { |
|
| 37 | + dump($error); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -49,28 +49,28 @@ discard block |
||
| 49 | 49 | $jsonErrorNr = json_last_error(); |
| 50 | 50 | $errstr = ''; |
| 51 | 51 | switch ($jsonErrorNr) { |
| 52 | - case JSON_ERROR_NONE: |
|
| 53 | - $errstr .= ' - No errors' . PHP_EOL; |
|
| 54 | - break; |
|
| 55 | - case JSON_ERROR_DEPTH: |
|
| 56 | - $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
| 57 | - break; |
|
| 58 | - case JSON_ERROR_STATE_MISMATCH: |
|
| 59 | - $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
| 60 | - break; |
|
| 61 | - case JSON_ERROR_CTRL_CHAR: |
|
| 62 | - $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
| 63 | - break; |
|
| 64 | - case JSON_ERROR_SYNTAX: |
|
| 65 | - $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
| 66 | - break; |
|
| 67 | - case JSON_ERROR_UTF8: |
|
| 68 | - $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
| 69 | - break; |
|
| 70 | - default: |
|
| 71 | - $errstr = ' - Unknown error' . PHP_EOL; |
|
| 72 | - break; |
|
| 73 | - } |
|
| 52 | + case JSON_ERROR_NONE: |
|
| 53 | + $errstr .= ' - No errors' . PHP_EOL; |
|
| 54 | + break; |
|
| 55 | + case JSON_ERROR_DEPTH: |
|
| 56 | + $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
| 57 | + break; |
|
| 58 | + case JSON_ERROR_STATE_MISMATCH: |
|
| 59 | + $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
| 60 | + break; |
|
| 61 | + case JSON_ERROR_CTRL_CHAR: |
|
| 62 | + $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
| 63 | + break; |
|
| 64 | + case JSON_ERROR_SYNTAX: |
|
| 65 | + $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
| 66 | + break; |
|
| 67 | + case JSON_ERROR_UTF8: |
|
| 68 | + $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
| 69 | + break; |
|
| 70 | + default: |
|
| 71 | + $errstr = ' - Unknown error' . PHP_EOL; |
|
| 72 | + break; |
|
| 73 | + } |
|
| 74 | 74 | errorHandler ($jsonErrorNr, $errstr, $file, $line); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
| 88 | 88 | $file_lines = file_exists($file) ? file($file) : array(); |
| 89 | - $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
| 90 | - $lines = array(); |
|
| 89 | + $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
| 90 | + $lines = array(); |
|
| 91 | 91 | |
| 92 | - foreach ($range as $line_number) { |
|
| 93 | - if(isset($file_lines[$line_number-1])) { |
|
| 94 | - $lines[$line_number] = $file_lines[$line_number-1]; |
|
| 95 | - } |
|
| 96 | - } |
|
| 92 | + foreach ($range as $line_number) { |
|
| 93 | + if(isset($file_lines[$line_number-1])) { |
|
| 94 | + $lines[$line_number] = $file_lines[$line_number-1]; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | if (ob_get_contents()) ob_end_clean(); |
| 98 | 98 | $error = array( |
| 99 | 99 | 'message' => $message, |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @param $e |
| 11 | 11 | */ |
| 12 | -function exceptionHandler ($e) { |
|
| 13 | - renderError($e->getMessage(),$e->getFile(),$e->getLine(),$e->getCode(),$e->getTrace()); |
|
| 12 | +function exceptionHandler($e) { |
|
| 13 | + renderError($e->getMessage(), $e->getFile(), $e->getLine(), $e->getCode(), $e->getTrace()); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | * @param $errfile |
| 22 | 22 | * @param $errline |
| 23 | 23 | */ |
| 24 | -function errorHandler ($errno, $errstr, $errfile, $errline) { |
|
| 25 | - renderError($errstr,$errfile,$errline,$errno,debug_backtrace()); |
|
| 24 | +function errorHandler($errno, $errstr, $errfile, $errline) { |
|
| 25 | + renderError($errstr, $errfile, $errline, $errno, debug_backtrace()); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * When an error occurs that kills the process, still try |
| 30 | 30 | * to show it using a shutdownHandler. |
| 31 | 31 | */ |
| 32 | -function shutdownHandler () { |
|
| 32 | +function shutdownHandler() { |
|
| 33 | 33 | $error = error_get_last(); |
| 34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
| 35 | - errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
| 35 | + errorHandler($error['type'], $error['message'], $error['file'], $error['line']); |
|
| 36 | 36 | }elseif ($error['type'] == 1) { |
| 37 | 37 | dump($error); |
| 38 | 38 | } |
@@ -50,28 +50,28 @@ discard block |
||
| 50 | 50 | $errstr = ''; |
| 51 | 51 | switch ($jsonErrorNr) { |
| 52 | 52 | case JSON_ERROR_NONE: |
| 53 | - $errstr .= ' - No errors' . PHP_EOL; |
|
| 53 | + $errstr .= ' - No errors'.PHP_EOL; |
|
| 54 | 54 | break; |
| 55 | 55 | case JSON_ERROR_DEPTH: |
| 56 | - $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
| 56 | + $errstr .= ' - Maximum stack depth exceeded'.PHP_EOL; |
|
| 57 | 57 | break; |
| 58 | 58 | case JSON_ERROR_STATE_MISMATCH: |
| 59 | - $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
| 59 | + $errstr .= ' - Underflow or the modes mismatch'.PHP_EOL; |
|
| 60 | 60 | break; |
| 61 | 61 | case JSON_ERROR_CTRL_CHAR: |
| 62 | - $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
| 62 | + $errstr .= ' - Unexpected control character found'.PHP_EOL; |
|
| 63 | 63 | break; |
| 64 | 64 | case JSON_ERROR_SYNTAX: |
| 65 | - $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
| 65 | + $errstr .= ' - Syntax error, malformed JSON'.PHP_EOL; |
|
| 66 | 66 | break; |
| 67 | 67 | case JSON_ERROR_UTF8: |
| 68 | - $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
| 68 | + $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded'.PHP_EOL; |
|
| 69 | 69 | break; |
| 70 | 70 | default: |
| 71 | - $errstr = ' - Unknown error' . PHP_EOL; |
|
| 71 | + $errstr = ' - Unknown error'.PHP_EOL; |
|
| 72 | 72 | break; |
| 73 | 73 | } |
| 74 | - errorHandler ($jsonErrorNr, $errstr, $file, $line); |
|
| 74 | + errorHandler($jsonErrorNr, $errstr, $file, $line); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | * @param array $trace |
| 85 | 85 | * @param string $httpHeader |
| 86 | 86 | */ |
| 87 | -function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
|
| 87 | +function renderError($message = '', $file = '', $line = '', $code = 0, $trace = array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
|
| 88 | 88 | $file_lines = file_exists($file) ? file($file) : array(); |
| 89 | 89 | $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
| 90 | 90 | $lines = array(); |
| 91 | 91 | |
| 92 | 92 | foreach ($range as $line_number) { |
| 93 | - if(isset($file_lines[$line_number-1])) { |
|
| 94 | - $lines[$line_number] = $file_lines[$line_number-1]; |
|
| 93 | + if (isset($file_lines[$line_number - 1])) { |
|
| 94 | + $lines[$line_number] = $file_lines[$line_number - 1]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | if (ob_get_contents()) ob_end_clean(); |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | 'trace' => $trace, |
| 105 | 105 | 'httpHeader' => $httpHeader, |
| 106 | 106 | ); |
| 107 | - if (file_exists(realpath(__DIR__) . '/errorview.php')) { |
|
| 108 | - include(realpath(__DIR__) . '/errorview.php'); |
|
| 107 | + if (file_exists(realpath(__DIR__).'/errorview.php')) { |
|
| 108 | + include(realpath(__DIR__).'/errorview.php'); |
|
| 109 | 109 | } else { |
| 110 | 110 | header('Content-type: application/json'); |
| 111 | 111 | die(json_encode($error)); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $error = error_get_last(); |
| 34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
| 35 | 35 | errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
| 36 | - }elseif ($error['type'] == 1) { |
|
| 36 | + } elseif ($error['type'] == 1) { |
|
| 37 | 37 | dump($error); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -94,7 +94,9 @@ discard block |
||
| 94 | 94 | $lines[$line_number] = $file_lines[$line_number-1]; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - if (ob_get_contents()) ob_end_clean(); |
|
| 97 | + if (ob_get_contents()) { |
|
| 98 | + ob_end_clean(); |
|
| 99 | + } |
|
| 98 | 100 | $error = array( |
| 99 | 101 | 'message' => $message, |
| 100 | 102 | 'file' => $file, |
@@ -47,10 +47,10 @@ |
||
| 47 | 47 | { |
| 48 | 48 | global $rootPath; |
| 49 | 49 | |
| 50 | - self::$subfolders = '/' . str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath)); |
|
| 50 | + self::$subfolders = '/'.str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath)); |
|
| 51 | 51 | self::$requestUri = $_SERVER['REQUEST_URI']; |
| 52 | 52 | self::$queryString = $_SERVER['QUERY_STRING']; |
| 53 | - self::$relativeUri = str_replace('?' . self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
| 53 | + self::$relativeUri = str_replace('?'.self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
| 54 | 54 | self::$requestParameters = explode('/', self::$relativeUri); |
| 55 | 55 | |
| 56 | 56 | self::$get = $_GET; |
@@ -62,8 +62,8 @@ |
||
| 62 | 62 | |
| 63 | 63 | // Preserve transparency |
| 64 | 64 | imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); |
| 65 | - imagealphablending($new, false); |
|
| 66 | - imagesavealpha($new, true); |
|
| 65 | + imagealphablending($new, false); |
|
| 66 | + imagesavealpha($new, true); |
|
| 67 | 67 | |
| 68 | 68 | imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight); |
| 69 | 69 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | return $returnFileNames; |
| 49 | 49 | } else { |
| 50 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 50 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @return string |
| 59 | 59 | * @throws \Exception |
| 60 | 60 | */ |
| 61 | - public function resize($imagePath='', $width='',$height='') |
|
| 61 | + public function resize($imagePath = '', $width = '', $height = '') |
|
| 62 | 62 | { |
| 63 | - $modifier = '-r' . $width . 'x' . $height; |
|
| 63 | + $modifier = '-r'.$width.'x'.$height; |
|
| 64 | 64 | $destination = $this->modifyName($imagePath, $modifier); |
| 65 | 65 | if (file_exists($imagePath)) { |
| 66 | 66 | $image = new Image(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 75 | 75 | return basename($destination); |
| 76 | 76 | } else { |
| 77 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 77 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @return string |
| 86 | 86 | * @throws \Exception |
| 87 | 87 | */ |
| 88 | - public function smartcrop($imagePath='', $width='',$height='') |
|
| 88 | + public function smartcrop($imagePath = '', $width = '', $height = '') |
|
| 89 | 89 | { |
| 90 | - $modifier = '-s' . $width . 'x' . $height; |
|
| 90 | + $modifier = '-s'.$width.'x'.$height; |
|
| 91 | 91 | $destination = $this->modifyName($imagePath, $modifier); |
| 92 | 92 | if (file_exists($imagePath)) { |
| 93 | 93 | $image = new Image(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 102 | 102 | return basename($destination); |
| 103 | 103 | } else { |
| 104 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 104 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | * @return string |
| 113 | 113 | * @throws \Exception |
| 114 | 114 | */ |
| 115 | - public function boxcrop($imagePath='', $width='',$height='') |
|
| 115 | + public function boxcrop($imagePath = '', $width = '', $height = '') |
|
| 116 | 116 | { |
| 117 | - $modifier = '-b' . $width . 'x' . $height; |
|
| 117 | + $modifier = '-b'.$width.'x'.$height; |
|
| 118 | 118 | $destination = $this->modifyName($imagePath, $modifier); |
| 119 | 119 | if (file_exists($imagePath)) { |
| 120 | 120 | $image = new Image(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 129 | 129 | return basename($destination); |
| 130 | 130 | } else { |
| 131 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 131 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | - private function modifyName($imagePath, $modifier='') |
|
| 141 | + private function modifyName($imagePath, $modifier = '') |
|
| 142 | 142 | { |
| 143 | 143 | $filename = basename($imagePath); |
| 144 | 144 | $path = dirname($imagePath); |
@@ -148,25 +148,25 @@ discard block |
||
| 148 | 148 | array_pop($fileParts); |
| 149 | 149 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 150 | 150 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
| 151 | - $filename = $fileNameWithoutExtension . $modifier . '.' . $extension; |
|
| 151 | + $filename = $fileNameWithoutExtension.$modifier.'.'.$extension; |
|
| 152 | 152 | } else { |
| 153 | 153 | $filename = slugify($filename); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (file_exists($path . '/' . $filename)) { |
|
| 156 | + if (file_exists($path.'/'.$filename)) { |
|
| 157 | 157 | $fileParts = explode('.', $filename); |
| 158 | 158 | if (count($fileParts) > 1) { |
| 159 | 159 | $extension = end($fileParts); |
| 160 | 160 | array_pop($fileParts); |
| 161 | 161 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 162 | 162 | $fileNameWithoutExtension .= '-copy'; |
| 163 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 163 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 164 | 164 | } else { |
| 165 | 165 | $filename .= '-copy'; |
| 166 | 166 | } |
| 167 | - return $this->modifyName($path . '/' . $filename); |
|
| 167 | + return $this->modifyName($path.'/'.$filename); |
|
| 168 | 168 | } |
| 169 | - return $path . '/' . $filename; |
|
| 169 | + return $path.'/'.$filename; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |
@@ -45,8 +45,10 @@ discard block |
||
| 45 | 45 | <? if (isset($document)) : |
| 46 | 46 | $fieldSlug = $field->slug; |
| 47 | 47 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
| 48 | - else : |
|
| 48 | + else { |
|
| 49 | + : |
|
| 49 | 50 | $value = ''; |
| 51 | + } |
|
| 50 | 52 | endif ?> |
| 51 | 53 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 52 | 54 | <ul class="grid-wrapper sortable"> |
@@ -152,8 +154,11 @@ discard block |
||
| 152 | 154 | <? endif ?> |
| 153 | 155 | </ul> |
| 154 | 156 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone');">+</a> |
| 155 | - <? else : ?> |
|
| 156 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
| 157 | + <? else { |
|
| 158 | + : ?> |
|
| 159 | + <?$fieldPrefix='bricks[' . $brick->slug . '][fields]'; |
|
| 160 | +} |
|
| 161 | +?> |
|
| 157 | 162 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
| 158 | 163 | <? foreach ($brick->structure->fields as $field) : ?> |
| 159 | 164 | <div class="form-element"> |
@@ -162,8 +167,10 @@ discard block |
||
| 162 | 167 | $brickSlug = $brick->slug; |
| 163 | 168 | $fieldSlug = $field->slug; |
| 164 | 169 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
| 165 | - else : |
|
| 170 | + else { |
|
| 171 | + : |
|
| 166 | 172 | $value = ''; |
| 173 | + } |
|
| 167 | 174 | endif ?> |
| 168 | 175 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 169 | 176 | <ul class="grid-wrapper sortable"> |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script> |
| 4 | 4 | <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"> |
| 5 | 5 | <script>var smallestImage = '<?=$smallestImage?>';</script> |
| 6 | -<?$copyable=''?> |
|
| 6 | +<?$copyable = ''?> |
|
| 7 | 7 | <section class="documents"> |
| 8 | 8 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
| 9 | 9 | <nav class="actions"> |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | <label for="state">Published</label> |
| 39 | 39 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
| 40 | 40 | </div> |
| 41 | - <?$fieldPrefix='fields';?> |
|
| 41 | + <?$fieldPrefix = 'fields'; ?> |
|
| 42 | 42 | <? foreach ($documentType->fields as $field) : ?> |
| 43 | 43 | <div class="form-element"> |
| 44 | 44 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 63 | 63 | <div class="form-element"> |
| 64 | 64 | <? endif ?> |
| 65 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 65 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 66 | 66 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 67 | 67 | |
| 68 | 68 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | <li class="grid-container"> |
| 85 | 85 | <div class="grid-box-10"> |
| 86 | 86 | <div class="grid-inner form-element"> |
| 87 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 87 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 88 | 88 | </div> |
| 89 | 89 | </div> |
| 90 | 90 | <div class="grid-box-2"> |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | </div> |
| 95 | 95 | </div> |
| 96 | 96 | </li> |
| 97 | - <?$value='';?> |
|
| 97 | + <?$value = ''; ?> |
|
| 98 | 98 | <? endforeach ?> |
| 99 | 99 | <? endif ?> |
| 100 | 100 | </ul> |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
| 112 | 112 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 113 | 113 | <div class="form-element"> |
| 114 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 114 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 115 | 115 | </div> |
| 116 | 116 | </li> |
| 117 | - <?$value='';?> |
|
| 117 | + <?$value = ''; ?> |
|
| 118 | 118 | <? endforeach ?> |
| 119 | 119 | <? endif ?> |
| 120 | 120 | </div> |
@@ -123,17 +123,17 @@ discard block |
||
| 123 | 123 | <a class="btn js-addrtemultiple">+</a> |
| 124 | 124 | <? endif ?> |
| 125 | 125 | </div> |
| 126 | - <?$value='';?> |
|
| 126 | + <?$value = ''; ?> |
|
| 127 | 127 | <? endforeach ?> |
| 128 | 128 | <hr /> |
| 129 | - <? $static_brick_nr = 0;?> |
|
| 129 | + <? $static_brick_nr = 0; ?> |
|
| 130 | 130 | <? foreach ($documentType->bricks as $brick) : ?> |
| 131 | 131 | <div class="brick"> |
| 132 | 132 | <label><?=$brick->title?></label> |
| 133 | 133 | <? if ($brick->multiple == 'true') : ?> |
| 134 | 134 | <input type="hidden" value="<?=$brick->brickSlug?>"/> |
| 135 | 135 | <input type="hidden" value="<?=$brick->slug?>"/> |
| 136 | - <?$myBrickSlug=$brick->slug;?> |
|
| 136 | + <?$myBrickSlug = $brick->slug; ?> |
|
| 137 | 137 | <ul id="newBrickDropzone_<?=$static_brick_nr?>" class="dynamicBricks sortable"> |
| 138 | 138 | <? if (isset($document)) : ?> |
| 139 | 139 | <? foreach ($document->bricks as $currentBrickSlug => $brickArray) : ?> |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | <li class="brick form-element"> |
| 148 | 148 | <label><?=$brick->title?></label> |
| 149 | 149 | <?$static = true; ?> |
| 150 | - <?include(__DIR__ . '/brick.php')?> |
|
| 150 | + <?include(__DIR__.'/brick.php')?> |
|
| 151 | 151 | </li> |
| 152 | 152 | <? endif ?> |
| 153 | 153 | <? endforeach ?> |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
| 158 | 158 | <?$static_brick_nr += 1?> |
| 159 | 159 | <? else : ?> |
| 160 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
| 160 | + <?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?> |
|
| 161 | 161 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
| 162 | 162 | <? foreach ($brick->structure->fields as $field) : ?> |
| 163 | 163 | <div class="form-element"> |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 184 | 184 | <div class="form-element"> |
| 185 | 185 | <? endif ?> |
| 186 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 186 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 187 | 187 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 188 | 188 | |
| 189 | 189 | </div> |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | <li class="grid-container"> |
| 207 | 207 | <div class="grid-box-10"> |
| 208 | 208 | <div class="grid-inner form-element"> |
| 209 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 209 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 210 | 210 | </div> |
| 211 | 211 | </div> |
| 212 | 212 | <div class="grid-box-2"> |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | </div> |
| 217 | 217 | </div> |
| 218 | 218 | </li> |
| 219 | - <?$value='';?> |
|
| 219 | + <?$value = ''; ?> |
|
| 220 | 220 | <? endforeach ?> |
| 221 | 221 | <? endif ?> |
| 222 | 222 | </ul> |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
| 235 | 235 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 236 | 236 | <div class="form-element"> |
| 237 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 237 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 238 | 238 | </div> |
| 239 | 239 | </li> |
| 240 | - <?$value='';?> |
|
| 240 | + <?$value = ''; ?> |
|
| 241 | 241 | <? endforeach ?> |
| 242 | 242 | <? endif ?> |
| 243 | 243 | </div> |
@@ -246,12 +246,12 @@ discard block |
||
| 246 | 246 | <a class="btn js-addrtemultiple">+</a> |
| 247 | 247 | <? endif ?> |
| 248 | 248 | </div> |
| 249 | - <?$value='';?> |
|
| 249 | + <?$value = ''; ?> |
|
| 250 | 250 | <? endforeach ?> |
| 251 | 251 | <? endif ?> |
| 252 | 252 | </div> |
| 253 | 253 | <hr /> |
| 254 | - <? endforeach;?> |
|
| 254 | + <? endforeach; ?> |
|
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | <li class="brick form-element"> |
| 275 | 275 | <label><?=$brick->title?></label> |
| 276 | 276 | <?$static = false; ?> |
| 277 | - <?include(__DIR__ . '/brick.php')?> |
|
| 277 | + <?include(__DIR__.'/brick.php')?> |
|
| 278 | 278 | </li> |
| 279 | 279 | <? endforeach ?> |
| 280 | 280 | <? endif ?> |