@@ -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 | } |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | return '0 seconds'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $a = array( 365 * 24 * 60 * 60 => 'year', |
|
| 37 | + $a = array(365 * 24 * 60 * 60 => 'year', |
|
| 38 | 38 | 30 * 24 * 60 * 60 => 'month', |
| 39 | 39 | 24 * 60 * 60 => 'day', |
| 40 | 40 | 60 * 60 => 'hour', |
| 41 | 41 | 60 => 'minute', |
| 42 | 42 | 1 => 'second' |
| 43 | 43 | ); |
| 44 | - $a_plural = array( 'year' => 'years', |
|
| 44 | + $a_plural = array('year' => 'years', |
|
| 45 | 45 | 'month' => 'months', |
| 46 | 46 | 'day' => 'days', |
| 47 | 47 | 'hour' => 'hours', |
@@ -55,18 +55,18 @@ discard block |
||
| 55 | 55 | if ($d >= 1) |
| 56 | 56 | { |
| 57 | 57 | $r = round($d); |
| 58 | - return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago'; |
|
| 58 | + return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago'; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -function humanFileSize($size,$unit="") { |
|
| 64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
| 65 | - return number_format($size/(1<<30),2)."GB"; |
|
| 66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
| 67 | - return number_format($size/(1<<20),2)."MB"; |
|
| 68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
| 69 | - return number_format($size/(1<<10),2)."KB"; |
|
| 63 | +function humanFileSize($size, $unit = "") { |
|
| 64 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
| 65 | + return number_format($size / (1 << 30), 2)."GB"; |
|
| 66 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
| 67 | + return number_format($size / (1 << 20), 2)."MB"; |
|
| 68 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
| 69 | + return number_format($size / (1 << 10), 2)."KB"; |
|
| 70 | 70 | return number_format($size)." bytes"; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return mixed|string |
| 115 | 115 | */ |
| 116 | -function slugify($str, $replace=array(), $delimiter='-') { |
|
| 117 | - if( !empty($replace) ) { |
|
| 118 | - $str = str_replace((array)$replace, ' ', $str); |
|
| 116 | +function slugify($str, $replace = array(), $delimiter = '-') { |
|
| 117 | + if (!empty($replace)) { |
|
| 118 | + $str = str_replace((array) $replace, ' ', $str); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $debug_backtrace = current(debug_backtrace()); |
| 138 | 138 | if (PHP_SAPI == 'cli') { |
| 139 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
| 139 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
| 140 | 140 | foreach (func_get_args() as $data) { |
| 141 | 141 | var_dump($data); |
| 142 | 142 | } |
| 143 | 143 | } else { |
| 144 | 144 | ob_clean(); |
| 145 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
| 145 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
| 146 | 146 | echo '<pre>'; |
| 147 | 147 | foreach (func_get_args() as $data) { |
| 148 | 148 | echo "<code>"; |
@@ -61,12 +61,15 @@ |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | function humanFileSize($size,$unit="") { |
| 64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
| 65 | - return number_format($size/(1<<30),2)."GB"; |
|
| 66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
| 67 | - return number_format($size/(1<<20),2)."MB"; |
|
| 68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
| 69 | - return number_format($size/(1<<10),2)."KB"; |
|
| 64 | + if( (!$unit && $size >= 1<<30) || $unit == "GB") { |
|
| 65 | + return number_format($size/(1<<30),2)."GB"; |
|
| 66 | + } |
|
| 67 | + if( (!$unit && $size >= 1<<20) || $unit == "MB") { |
|
| 68 | + return number_format($size/(1<<20),2)."MB"; |
|
| 69 | + } |
|
| 70 | + if( (!$unit && $size >= 1<<10) || $unit == "KB") { |
|
| 71 | + return number_format($size/(1<<10),2)."KB"; |
|
| 72 | + } |
|
| 70 | 73 | return number_format($size)." bytes"; |
| 71 | 74 | } |
| 72 | 75 | |
@@ -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 | |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | } |
| 7 | 7 | ?> |
| 8 | 8 | <div class="rte"> |
| 9 | - <div id="summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
| 9 | + <div id="summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
| 10 | 10 | </div> |
| 11 | 11 | <textarea style="display:none;" id="summernote_<?=$field->slug?>_container_<?=$summernoteInstances?>" name="<?=$fieldPrefix?>[<?=$field->slug?>][]"></textarea> |
| 12 | 12 | <script> |
| 13 | 13 | $(document).ready(function () { |
| 14 | - $('#summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
| 14 | + $('#summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
| 15 | 15 | height: 300, |
| 16 | 16 | toolbar: [ |
| 17 | 17 | //[groupname, [button list]] |
@@ -29,4 +29,4 @@ discard block |
||
| 29 | 29 | if (!isset($GLOBALS['rteList'])) { |
| 30 | 30 | $GLOBALS['rteList'] = array(); |
| 31 | 31 | } |
| 32 | -$GLOBALS['rteList'][] = 'summernote_' . str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug . '_rte_' . $summernoteInstances ?> |
|
| 32 | +$GLOBALS['rteList'][] = 'summernote_'.str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug.'_rte_'.$summernoteInstances ?> |
|
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | private function config() |
| 67 | 67 | { |
| 68 | - $configPath = __DIR__ . '/../../config.json'; |
|
| 68 | + $configPath = __DIR__.'/../../config.json'; |
|
| 69 | 69 | if (realpath($configPath) !== false) { |
| 70 | 70 | $json = file_get_contents($configPath); |
| 71 | 71 | $this->config = json_decode($json); |
| 72 | 72 | } else { |
| 73 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
| 73 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | private function sitemapMatching($request) |
| 94 | 94 | { |
| 95 | 95 | $sitemap = $this->storage->getSitemap(); |
| 96 | - $relativeUri = '/' . $request::$relativeUri; |
|
| 96 | + $relativeUri = '/'.$request::$relativeUri; |
|
| 97 | 97 | |
| 98 | 98 | foreach ($sitemap as $sitemapItem) { |
| 99 | 99 | if ($sitemapItem->regex) { |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | * @return mixed |
| 157 | 157 | * @throws \Exception |
| 158 | 158 | */ |
| 159 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
|
| 159 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
|
| 160 | 160 | { |
| 161 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
| 162 | - $userComponentName = '\\components\\' . $class; |
|
| 161 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
| 162 | + $userComponentName = '\\components\\'.$class; |
|
| 163 | 163 | |
| 164 | 164 | if (\autoLoad($libraryComponentName, false)) { |
| 165 | 165 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 166 | 166 | } elseif (\autoLoad($userComponentName, false)) { |
| 167 | 167 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 168 | 168 | } else { |
| 169 | - throw new \Exception('Could not load component ' . $class); |
|
| 169 | + throw new \Exception('Could not load component '.$class); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (!$component instanceof Component) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | public function setCachingHeaders() |
| 226 | 226 | { |
| 227 | 227 | header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days |
| 228 | - header("Cache-Control: max-age=" . (60 * 60 * 24 * 2)); |
|
| 228 | + header("Cache-Control: max-age=".(60 * 60 * 24 * 2)); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |