@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
| 169 | 169 | * The other dimension (height or width) will be calculated autamaticaly |
| 170 | 170 | * @param integer $bigger_size |
| 171 | - * @return array */ |
|
| 171 | + * @return integer[] */ |
|
| 172 | 172 | |
| 173 | 173 | public function get_prop_size($bigger_size) {
|
| 174 | 174 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * no samo po edno (x ili y) izmerenie |
| 256 | 256 | * @param integer $width |
| 257 | 257 | * @param integer $height |
| 258 | - * @return bool */ |
|
| 258 | + * @return gd */ |
|
| 259 | 259 | |
| 260 | 260 | public function resize_overflow($width, $height) {
|
| 261 | 261 | |
@@ -397,6 +397,12 @@ discard block |
||
| 397 | 397 | return false; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | + /** |
|
| 401 | + * @param integer $x1 |
|
| 402 | + * @param integer $y1 |
|
| 403 | + * @param integer $x2 |
|
| 404 | + * @param integer $y2 |
|
| 405 | + */ |
|
| 400 | 406 | public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) {
|
| 401 | 407 | $color = $this->gd_color($color); |
| 402 | 408 | if ($color === false) return false; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class gd {
|
|
| 15 | +class gd{
|
|
| 16 | 16 | |
| 17 | 17 | /** GD resource |
| 18 | 18 | * @var resource */ |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param mixed $image |
| 41 | 41 | * @return array */ |
| 42 | 42 | |
| 43 | - protected function build_image($image) {
|
|
| 43 | + protected function build_image($image){
|
|
| 44 | 44 | |
| 45 | 45 | if ($image instanceof gd) {
|
| 46 | 46 | $width = $image->get_width(); |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
|
| 60 | 60 | $image = |
| 61 | - ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 62 | - ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
|
| 63 | - ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
|
| 61 | + ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 62 | + ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
|
| 63 | + ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
|
| 64 | 64 | ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : ( |
| 65 | - ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 66 | - ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 65 | + ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 66 | + ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 67 | 67 | ))))); |
| 68 | 68 | |
| 69 | 69 | if ($type == IMAGETYPE_PNG) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param integer $bigger_size |
| 99 | 99 | * @return gd */ |
| 100 | 100 | |
| 101 | - public function __construct($image, $bigger_size=null) {
|
|
| 101 | + public function __construct($image, $bigger_size = null){
|
|
| 102 | 102 | $this->image = $this->width = $this->height = null; |
| 103 | 103 | |
| 104 | 104 | $image_details = $this->build_image($image); |
@@ -126,21 +126,21 @@ discard block |
||
| 126 | 126 | /** Returns the GD resource |
| 127 | 127 | * @return resource */ |
| 128 | 128 | |
| 129 | - public function get_image() {
|
|
| 129 | + public function get_image(){
|
|
| 130 | 130 | return $this->image; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** Returns the image width |
| 134 | 134 | * @return integer */ |
| 135 | 135 | |
| 136 | - public function get_width() {
|
|
| 136 | + public function get_width(){
|
|
| 137 | 137 | return $this->width; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** Returns the image height |
| 141 | 141 | * @return integer */ |
| 142 | 142 | |
| 143 | - public function get_height() {
|
|
| 143 | + public function get_height(){
|
|
| 144 | 144 | return $this->height; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param integer $resized_height |
| 149 | 149 | * @return integer */ |
| 150 | 150 | |
| 151 | - public function get_prop_width($resized_height) {
|
|
| 151 | + public function get_prop_width($resized_height){
|
|
| 152 | 152 | $width = intval(($this->width * $resized_height) / $this->height); |
| 153 | 153 | if (!$width) $width = 1; |
| 154 | 154 | return $width; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param integer $resized_width |
| 159 | 159 | * @return integer */ |
| 160 | 160 | |
| 161 | - public function get_prop_height($resized_width) {
|
|
| 161 | + public function get_prop_height($resized_width){
|
|
| 162 | 162 | $height = intval(($this->height * $resized_width) / $this->width); |
| 163 | 163 | if (!$height) $height = 1; |
| 164 | 164 | return $height; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param integer $bigger_size |
| 171 | 171 | * @return array */ |
| 172 | 172 | |
| 173 | - public function get_prop_size($bigger_size) {
|
|
| 173 | + public function get_prop_size($bigger_size){
|
|
| 174 | 174 | |
| 175 | 175 | if ($this->width > $this->height) {
|
| 176 | 176 | $width = $bigger_size; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param integer $height |
| 192 | 192 | * @return bool */ |
| 193 | 193 | |
| 194 | - public function resize($width, $height) {
|
|
| 194 | + public function resize($width, $height){
|
|
| 195 | 195 | if (!$width) $width = 1; |
| 196 | 196 | if (!$height) $height = 1; |
| 197 | 197 | return ( |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @param mixed $src |
| 209 | 209 | * @return bool */ |
| 210 | 210 | |
| 211 | - public function resize_crop($src) {
|
|
| 211 | + public function resize_crop($src){
|
|
| 212 | 212 | $image_details = $this->build_image($src); |
| 213 | 213 | |
| 214 | 214 | if ($image_details !== false) {
|
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param integer $height |
| 239 | 239 | * @return bool */ |
| 240 | 240 | |
| 241 | - public function resize_fit($width, $height) {
|
|
| 241 | + public function resize_fit($width, $height){
|
|
| 242 | 242 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
| 243 | 243 | return true; |
| 244 | 244 | if (!$width || (($height / $width) < ($this->height / $this->width))) |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param integer $height |
| 258 | 258 | * @return bool */ |
| 259 | 259 | |
| 260 | - public function resize_overflow($width, $height) {
|
|
| 260 | + public function resize_overflow($width, $height){
|
|
| 261 | 261 | |
| 262 | 262 | $big = (($this->width / $this->height) > ($width / $height)) |
| 263 | 263 | ? ($this->width * $height) / $this->height |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return $return; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function gd_color() {
|
|
| 278 | + public function gd_color(){
|
|
| 279 | 279 | $args = func_get_args(); |
| 280 | 280 | |
| 281 | 281 | $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i';
|
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return imagecolorallocate($this->image, $r, $g, $b); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - public function fill_color($color) {
|
|
| 320 | + public function fill_color($color){
|
|
| 321 | 321 | return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | public function imagecopy( |
| 328 | 328 | $src, |
| 329 | - $dst_x=0, $dst_y=0, |
|
| 330 | - $src_x=0, $src_y=0, |
|
| 331 | - $dst_w=null, $dst_h=null, |
|
| 332 | - $src_w=null, $src_h=null |
|
| 333 | - ) {
|
|
| 329 | + $dst_x = 0, $dst_y = 0, |
|
| 330 | + $src_x = 0, $src_y = 0, |
|
| 331 | + $dst_w = null, $dst_h = null, |
|
| 332 | + $src_w = null, $src_h = null |
|
| 333 | + ){
|
|
| 334 | 334 | $image_details = $this->build_image($src); |
| 335 | 335 | |
| 336 | 336 | if ($image_details !== false) {
|
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | public function imagecopyresampled( |
| 350 | 350 | $src, |
| 351 | - $dst_x=0, $dst_y=0, |
|
| 352 | - $src_x=0, $src_y=0, |
|
| 353 | - $dst_w=null, $dst_h=null, |
|
| 354 | - $src_w=null, $src_h=null |
|
| 355 | - ) {
|
|
| 351 | + $dst_x = 0, $dst_y = 0, |
|
| 352 | + $src_x = 0, $src_y = 0, |
|
| 353 | + $dst_w = null, $dst_h = null, |
|
| 354 | + $src_w = null, $src_h = null |
|
| 355 | + ){
|
|
| 356 | 356 | $image_details = $this->build_image($src); |
| 357 | 357 | |
| 358 | 358 | if ($image_details !== false) {
|
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | if (is_null($src_w)) $src_w = $src_width - $src_x; |
| 364 | 364 | if (is_null($src_h)) $src_h = $src_height - $src_y; |
| 365 | 365 | imagealphablending($this->image, false); |
| 366 | - imagesavealpha($this->image,true); |
|
| 366 | + imagesavealpha($this->image, true); |
|
| 367 | 367 | |
| 368 | 368 | |
| 369 | 369 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | $transindex = imagecolortransparent($src); |
| 374 | 374 | $palletsize = imagecolorstotal($src); |
| 375 | - if($transindex >= 0 && $transindex < $palletsize) {
|
|
| 375 | + if ($transindex >= 0 && $transindex < $palletsize) {
|
|
| 376 | 376 | $transcol = imagecolorsforindex($src, $transindex); |
| 377 | 377 | |
| 378 | 378 | /*** end gif transparent fix ***/ |
@@ -381,9 +381,9 @@ discard block |
||
| 381 | 381 | imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
| 382 | 382 | imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
| 383 | 383 | imagecolortransparent($this->image, $transindex); |
| 384 | - for($y=0; $y<$dst_h; ++$y) |
|
| 385 | - for($x=0; $x<$dst_w; ++$x) |
|
| 386 | - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
| 384 | + for ($y = 0; $y < $dst_h; ++$y) |
|
| 385 | + for ($x = 0; $x < $dst_w; ++$x) |
|
| 386 | + if (((imagecolorat($this->image, $x, $y) >> 24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
| 387 | 387 | imagetruecolortopalette($this->image, true, 255); |
| 388 | 388 | } |
| 389 | 389 | else {
|
@@ -397,26 +397,26 @@ discard block |
||
| 397 | 397 | return false; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) {
|
|
| 400 | + public function imagefilledrectangle($x1, $y1, $x2, $y2, $color){
|
|
| 401 | 401 | $color = $this->gd_color($color); |
| 402 | 402 | if ($color === false) return false; |
| 403 | 403 | return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - public function imagepng($filename=null, $quality=null, $filters=null) {
|
|
| 406 | + public function imagepng($filename = null, $quality = null, $filters = null){
|
|
| 407 | 407 | if (is_null($filename) && !headers_sent()) |
| 408 | 408 | header("Content-Type: image/png");
|
| 409 | 409 | @imagesavealpha($this->image, true); |
| 410 | 410 | return imagepng($this->image, $filename, $quality, $filters); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - public function imagejpeg($filename=null, $quality=75) {
|
|
| 413 | + public function imagejpeg($filename = null, $quality = 75){
|
|
| 414 | 414 | if (is_null($filename) && !headers_sent()) |
| 415 | 415 | header("Content-Type: image/jpeg");
|
| 416 | 416 | return imagejpeg($this->image, $filename, $quality); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - public function imagegif($filename=null) {
|
|
| 419 | + public function imagegif($filename = null){
|
|
| 420 | 420 | if (is_null($filename) && !headers_sent()) |
| 421 | 421 | header("Content-Type: image/gif");
|
| 422 | 422 | @imagesavealpha($this->image, true); |
@@ -179,7 +179,6 @@ |
||
| 179 | 179 | |
| 180 | 180 | /** Resize and crop the image to fit in given resolution. Returns TRUE on |
| 181 | 181 | * success or FALSE on failure |
| 182 | - * @param mixed $src |
|
| 183 | 182 | * @param integer $offset |
| 184 | 183 | * @return bool */ |
| 185 | 184 | abstract public function resizeCrop($width, $height, $offset=false); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -abstract class image { |
|
| 15 | +abstract class image{ |
|
| 16 | 16 | const DEFAULT_JPEG_QUALITY = 75; |
| 17 | 17 | |
| 18 | 18 | /** Image resource or object |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param string $property |
| 42 | 42 | * @return mixed */ |
| 43 | 43 | |
| 44 | - final public function __get($property) { |
|
| 44 | + final public function __get($property){ |
|
| 45 | 45 | return property_exists($this, $property) ? $this->$property : null; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param mixed $image |
| 58 | 58 | * @param array $options */ |
| 59 | 59 | |
| 60 | - public function __construct($image, array $options=array()) { |
|
| 60 | + public function __construct($image, array $options = array()){ |
|
| 61 | 61 | $this->image = $this->width = $this->height = null; |
| 62 | 62 | $imageDetails = $this->buildImage($image); |
| 63 | 63 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param mixed $image |
| 76 | 76 | * @return object */ |
| 77 | 77 | |
| 78 | - final static function factory($driver, $image, array $options=array()) { |
|
| 78 | + final static function factory($driver, $image, array $options = array()){ |
|
| 79 | 79 | $class = "image_$driver"; |
| 80 | 80 | return new $class($image, $options); |
| 81 | 81 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param array $drivers |
| 87 | 87 | * @return string */ |
| 88 | 88 | |
| 89 | - final static function getDriver(array $drivers=array('gd')) { |
|
| 89 | + final static function getDriver(array $drivers = array('gd')){ |
|
| 90 | 90 | foreach ($drivers as $driver) { |
| 91 | 91 | if (!preg_match('/^[a-z0-9\_]+$/i', $driver)) |
| 92 | 92 | continue; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param mixed $image |
| 106 | 106 | * @return array */ |
| 107 | 107 | |
| 108 | - final protected function buildImage($image) { |
|
| 108 | + final protected function buildImage($image){ |
|
| 109 | 109 | $class = get_class($this); |
| 110 | 110 | if ($image instanceof $class) { |
| 111 | 111 | $width = $image->width; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param integer $resizedHeight |
| 130 | 130 | * @return integer */ |
| 131 | 131 | |
| 132 | - final public function getPropWidth($resizedHeight) { |
|
| 132 | + final public function getPropWidth($resizedHeight){ |
|
| 133 | 133 | $width = round(($this->width * $resizedHeight) / $this->height); |
| 134 | 134 | if (!$width) $width = 1; |
| 135 | 135 | return $width; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param integer $resizedWidth |
| 141 | 141 | * @return integer */ |
| 142 | 142 | |
| 143 | - final public function getPropHeight($resizedWidth) { |
|
| 143 | + final public function getPropHeight($resizedWidth){ |
|
| 144 | 144 | $height = round(($this->height * $resizedWidth) / $this->width); |
| 145 | 145 | if (!$height) $height = 1; |
| 146 | 146 | return $height; |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | * static method should be implemented into driver classes like abstract |
| 152 | 152 | * methods |
| 153 | 153 | * @return bool */ |
| 154 | - static function available() { return false; } |
|
| 154 | + static function available(){ return false; } |
|
| 155 | 155 | |
| 156 | 156 | /** Checks if file is an image. This static method should be implemented into |
| 157 | 157 | * driver classes like abstract methods |
| 158 | 158 | * @param string $file |
| 159 | 159 | * @return bool */ |
| 160 | - static function checkImage($file) { return false; } |
|
| 160 | + static function checkImage($file){ return false; } |
|
| 161 | 161 | |
| 162 | 162 | /** Resize image. Should return TRUE on success or FALSE on failure |
| 163 | 163 | * @param integer $width |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | * @param integer $height |
| 174 | 174 | * @param mixed $background |
| 175 | 175 | * @return bool */ |
| 176 | - abstract public function resizeFit($width, $height, $background=false); |
|
| 176 | + abstract public function resizeFit($width, $height, $background = false); |
|
| 177 | 177 | |
| 178 | 178 | /** Resize and crop the image to fit in given resolution. Returns TRUE on |
| 179 | 179 | * success or FALSE on failure |
| 180 | 180 | * @param mixed $src |
| 181 | 181 | * @param integer $offset |
| 182 | 182 | * @return bool */ |
| 183 | - abstract public function resizeCrop($width, $height, $offset=false); |
|
| 183 | + abstract public function resizeCrop($width, $height, $offset = false); |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | /** Rotate image |
| 187 | 187 | * @param integer $angle |
| 188 | 188 | * @param string $background |
| 189 | 189 | * @return bool */ |
| 190 | - abstract public function rotate($angle, $background="#000000"); |
|
| 190 | + abstract public function rotate($angle, $background = "#000000"); |
|
| 191 | 191 | |
| 192 | 192 | abstract public function flipHorizontal(); |
| 193 | 193 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param mixed $top |
| 204 | 204 | * @param mixed $left |
| 205 | 205 | * @return bool */ |
| 206 | - abstract public function watermark($file, $left=false, $top=false); |
|
| 206 | + abstract public function watermark($file, $left = false, $top = false); |
|
| 207 | 207 | |
| 208 | 208 | /** Should output the image. Second parameter is used to pass some options like |
| 209 | 209 | * 'file' - if is set, the output will be written to a file |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @param string $type |
| 213 | 213 | * @param array $options |
| 214 | 214 | * @return bool */ |
| 215 | - abstract public function output($type='jpeg', array $options=array()); |
|
| 215 | + abstract public function output($type = 'jpeg', array $options = array()); |
|
| 216 | 216 | |
| 217 | 217 | /** This method should create a blank image with selected size. Should returns |
| 218 | 218 | * resource or object related to the created image, which will be passed to |
@@ -327,6 +327,11 @@ |
||
| 327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | + /** |
|
| 331 | + * @param integer $x1 |
|
| 332 | + * @param integer $y1 |
|
| 333 | + * @param boolean $color |
|
| 334 | + */ |
|
| 330 | 335 | protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
| 331 | 336 | $color = $this->gdColor($color); |
| 332 | 337 | if ($color === false) return false; |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class image_gd extends image { |
|
| 15 | +class image_gd extends image{ |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | // ABSTRACT PUBLIC METHODS |
| 19 | 19 | |
| 20 | - public function resize($width, $height) { |
|
| 20 | + public function resize($width, $height){ |
|
| 21 | 21 | if (!$width) $width = 1; |
| 22 | 22 | if (!$height) $height = 1; |
| 23 | 23 | return ( |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function resizeFit($width, $height, $background=false) { |
|
| 32 | + public function resizeFit($width, $height, $background = false){ |
|
| 33 | 33 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
| 34 | 34 | return true; |
| 35 | 35 | if (!$width || (($height / $width) < ($this->height / $this->width))) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function resizeCrop($width, $height, $offset=false) { |
|
| 70 | + public function resizeCrop($width, $height, $offset = false){ |
|
| 71 | 71 | |
| 72 | 72 | if (($this->width / $this->height) > ($width / $height)) { |
| 73 | 73 | $h = $height; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return $return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function rotate($angle, $background="#000000") { |
|
| 120 | + public function rotate($angle, $background = "#000000"){ |
|
| 121 | 121 | $angle = -$angle; |
| 122 | 122 | $img = @imagerotate($this->image, $angle, $this->gdColor($background)); |
| 123 | 123 | if ($img === false) |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return true; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - public function flipHorizontal() { |
|
| 131 | + public function flipHorizontal(){ |
|
| 132 | 132 | $img = imagecreatetruecolor($this->width, $this->height); |
| 133 | 133 | imagealphablending($img, false); |
| 134 | 134 | imagesavealpha($img, true); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - public function flipVertical() { |
|
| 142 | + public function flipVertical(){ |
|
| 143 | 143 | $img = imagecreatetruecolor($this->width, $this->height); |
| 144 | 144 | imagealphablending($img, false); |
| 145 | 145 | imagesavealpha($img, true); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return true; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - public function watermark($file, $left=false, $top=false) { |
|
| 153 | + public function watermark($file, $left = false, $top = false){ |
|
| 154 | 154 | $info = getimagesize($file); |
| 155 | 155 | list($w, $h, $t) = $info; |
| 156 | 156 | if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF))) |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return true; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - public function output($type='jpeg', array $options=array()) { |
|
| 190 | + public function output($type = 'jpeg', array $options = array()){ |
|
| 191 | 191 | $method = "output_$type"; |
| 192 | 192 | if (!method_exists($this, $method)) |
| 193 | 193 | return false; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // ABSTRACT PROTECTED METHODS |
| 199 | 199 | |
| 200 | - protected function getBlankImage($width, $height) { |
|
| 200 | + protected function getBlankImage($width, $height){ |
|
| 201 | 201 | $img = @imagecreatetruecolor($width, $height); |
| 202 | 202 | // imagealphablending($img, false); |
| 203 | 203 | // imagesavealpha($img, true); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | return $img; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - protected function getImage($image, &$width, &$height) { |
|
| 210 | + protected function getImage($image, &$width, &$height){ |
|
| 211 | 211 | |
| 212 | 212 | if (is_resource($image) && (get_resource_type($image) == "gd")) { |
| 213 | 213 | $width = @imagesx($image); |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | (false !== (list($width, $height, $t) = @getimagesize($image))) |
| 219 | 219 | ) { |
| 220 | 220 | $image = |
| 221 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 221 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 222 | 222 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
| 223 | 223 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
| 224 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 225 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 224 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 225 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 226 | 226 | )))); |
| 227 | 227 | |
| 228 | 228 | return $image; |
@@ -234,22 +234,22 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
| 236 | 236 | |
| 237 | - static function available() { |
|
| 237 | + static function available(){ |
|
| 238 | 238 | return function_exists("imagecreatefromjpeg"); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - static function checkImage($file) { |
|
| 241 | + static function checkImage($file){ |
|
| 242 | 242 | if (!is_string($file) || |
| 243 | 243 | ((false === (list($width, $height, $t) = @getimagesize($file)))) |
| 244 | 244 | ) |
| 245 | 245 | return false; |
| 246 | 246 | |
| 247 | 247 | $img = |
| 248 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
| 248 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
| 249 | 249 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : ( |
| 250 | 250 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : ( |
| 251 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
| 252 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
| 251 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
| 252 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
| 253 | 253 | )))); |
| 254 | 254 | |
| 255 | 255 | return ($img !== false); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | // OWN METHODS |
| 260 | 260 | |
| 261 | - protected function output_png(array $options=array()) { |
|
| 261 | + protected function output_png(array $options = array()){ |
|
| 262 | 262 | $file = isset($options['file']) ? $options['file'] : null; |
| 263 | 263 | $quality = isset($options['quality']) ? $options['quality'] : null; |
| 264 | 264 | $filters = isset($options['filters']) ? $options['filters'] : null; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return imagepng($this->image, $file, $quality, $filters); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - protected function output_jpeg(array $options=array()) { |
|
| 271 | + protected function output_jpeg(array $options = array()){ |
|
| 272 | 272 | $file = isset($options['file']) ? $options['file'] : null; |
| 273 | 273 | $quality = isset($options['quality']) |
| 274 | 274 | ? $options['quality'] |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | return imagejpeg($this->image, $file, $quality); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - protected function output_gif(array $options=array()) { |
|
| 281 | + protected function output_gif(array $options = array()){ |
|
| 282 | 282 | $file = isset($options['file']) ? $options['file'] : null; |
| 283 | 283 | if (isset($options['file']) && !headers_sent()) |
| 284 | 284 | header("Content-Type: image/gif"); |
| 285 | 285 | return imagegif($this->image, $file); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - protected function gdColor() { |
|
| 288 | + protected function gdColor(){ |
|
| 289 | 289 | $args = func_get_args(); |
| 290 | 290 | |
| 291 | 291 | $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
|
| 330 | + protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){ |
|
| 331 | 331 | $color = $this->gdColor($color); |
| 332 | 332 | if ($color === false) return false; |
| 333 | 333 | return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | protected function imageCopyResampled( |
| 337 | - $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null |
|
| 338 | - ) { |
|
| 337 | + $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null |
|
| 338 | + ){ |
|
| 339 | 339 | $imageDetails = $this->buildImage($src); |
| 340 | 340 | |
| 341 | 341 | if ($imageDetails === false) |
@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | protected $root; |
| 19 | 19 | protected $ignored; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $folder |
|
| 23 | + */ |
|
| 21 | 24 | function __construct($file, $folder, $ignored=null) { |
| 22 | 25 | $this->zip = new ZipArchive(); |
| 23 | 26 | |
@@ -39,6 +42,9 @@ discard block |
||
| 39 | 42 | $this->zip->close(); |
| 40 | 43 | } |
| 41 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $folder |
|
| 47 | + */ |
|
| 42 | 48 | function zip($folder, $parent=null) { |
| 43 | 49 | $full_path = "{$this->root}$parent$folder"; |
| 44 | 50 | $zip_path = "$parent$folder"; |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | * @link http://kcfinder.sunhater.com |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -class zipFolder { |
|
| 16 | +class zipFolder{ |
|
| 17 | 17 | protected $zip; |
| 18 | 18 | protected $root; |
| 19 | 19 | protected $ignored; |
| 20 | 20 | |
| 21 | - function __construct($file, $folder, $ignored=null) { |
|
| 21 | + function __construct($file, $folder, $ignored = null){ |
|
| 22 | 22 | $this->zip = new ZipArchive(); |
| 23 | 23 | |
| 24 | 24 | $this->ignored = is_array($ignored) |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->zip->close(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - function zip($folder, $parent=null) { |
|
| 42 | + function zip($folder, $parent = null){ |
|
| 43 | 43 | $full_path = "{$this->root}$parent$folder"; |
| 44 | 44 | $zip_path = "$parent$folder"; |
| 45 | 45 | $this->zip->addEmptyDir($zip_path); |
@@ -102,7 +102,6 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | /** Checks if the given file is really writable. The standard PHP function |
| 104 | 104 | * is_writable() does not work properly on Windows servers. |
| 105 | - * @param string $dir |
|
| 106 | 105 | * @return bool */ |
| 107 | 106 | |
| 108 | 107 | static function isWritable($filename) { |
@@ -114,7 +113,6 @@ discard block |
||
| 114 | 113 | } |
| 115 | 114 | |
| 116 | 115 | /** Get the extension from filename |
| 117 | - * @param string $file |
|
| 118 | 116 | * @param bool $toLower |
| 119 | 117 | * @return string */ |
| 120 | 118 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class file { |
|
| 15 | +class file{ |
|
| 16 | 16 | |
| 17 | 17 | static $MIME = array( |
| 18 | 18 | 'ai' => 'application/postscript', |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param string $dir |
| 106 | 106 | * @return bool */ |
| 107 | 107 | |
| 108 | - static function isWritable($filename) { |
|
| 108 | + static function isWritable($filename){ |
|
| 109 | 109 | $filename = path::normalize($filename); |
| 110 | 110 | if (!is_file($filename) || (false === ($fp = @fopen($filename, 'a+')))) |
| 111 | 111 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param bool $toLower |
| 119 | 119 | * @return string */ |
| 120 | 120 | |
| 121 | - static function getExtension($filename, $toLower=true) { |
|
| 121 | + static function getExtension($filename, $toLower = true){ |
|
| 122 | 122 | return preg_match('/^.*\.([^\.]*)$/s', $filename, $patt) |
| 123 | 123 | ? ($toLower ? strtolower($patt[1]) : $patt[1]) : ""; |
| 124 | 124 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param string $magic |
| 135 | 135 | * @return string */ |
| 136 | 136 | |
| 137 | - static function getMimeType($filename, $magic=null) { |
|
| 137 | + static function getMimeType($filename, $magic = null){ |
|
| 138 | 138 | if (class_exists("finfo")) { |
| 139 | 139 | $finfo = ($magic === null) |
| 140 | 140 | ? new finfo(FILEINFO_MIME) |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param string $tpl |
| 171 | 171 | * @return string */ |
| 172 | 172 | |
| 173 | - static function getInexistantFilename($filename, $dir=null, $tpl=null) { |
|
| 173 | + static function getInexistantFilename($filename, $dir = null, $tpl = null){ |
|
| 174 | 174 | if ($tpl === null) $tpl = "{name}({sufix}){ext}"; |
| 175 | 175 | $fullPath = ($dir === null); |
| 176 | 176 | if ($fullPath) |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | $tpl = str_replace('{ext}', (strlen($ext) ? ".$ext" : ""), $tpl); |
| 189 | 189 | $i = 1; $file = "$dir/$filename"; |
| 190 | 190 | while (file_exists($file)) |
| 191 | - $file = "$dir/" . str_replace('{sufix}', $i++, $tpl); |
|
| 191 | + $file = "$dir/".str_replace('{sufix}', $i++, $tpl); |
|
| 192 | 192 | |
| 193 | 193 | return $fullPath |
| 194 | 194 | ? $file |
| 195 | 195 | : (strlen($fdir) |
| 196 | - ? "$fdir/" . basename($file) |
|
| 196 | + ? "$fdir/".basename($file) |
|
| 197 | 197 | : basename($file)); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_img { |
|
| 15 | +class type_img{ |
|
| 16 | 16 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 17 | + public function checkFile($file, array $config){ |
|
| 18 | 18 | |
| 19 | 19 | $driver = isset($config['imageDriversPriority']) |
| 20 | 20 | ? image::getDriver(explode(" ", $config['imageDriversPriority'])) : "gd"; |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class type_mime { |
|
| 15 | +class type_mime{ |
|
| 16 | 16 | |
| 17 | - public function checkFile($file, array $config) { |
|
| 17 | + public function checkFile($file, array $config){ |
|
| 18 | 18 | if (!class_exists("finfo")) |
| 19 | 19 | return "Fileinfo PECL extension is missing."; |
| 20 | 20 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $mimes = $config['params']; |
| 34 | 34 | if (substr($mimes, 0, 1) == "!") { |
| 35 | 35 | $mimes = trim(substr($mimes, 1)); |
| 36 | - return in_array($type , explode(" ", $mimes)) |
|
| 36 | + return in_array($type, explode(" ", $mimes)) |
|
| 37 | 37 | ? "You can't upload such files." |
| 38 | 38 | : true; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return !in_array($type , explode(" ", $mimes)) |
|
| 41 | + return !in_array($type, explode(" ", $mimes)) |
|
| 42 | 42 | ? "You can't upload such files." |
| 43 | 43 | : true; |
| 44 | 44 | } |
@@ -1,2 +1,2 @@ |
||
| 1 | -<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "" ) ?>" rel="stylesheet" type="text/css" /> |
|
| 1 | +<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "") ?>" rel="stylesheet" type="text/css" /> |
|
| 2 | 2 | <link href="themes/<?php echo $this->config['theme'] ?>/style.css" rel="stylesheet" type="text/css" /> |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | |
| 10 | 10 | $lang = array( |
| 11 | 11 | |
| 12 | - '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
| 13 | - '_charset' => "utf-8", // Browser charset |
|
| 12 | + '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
| 13 | + '_charset' => "utf-8", // Browser charset |
|
| 14 | 14 | |
| 15 | 15 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
| 16 | 16 | '_dateTimeFull' => "%A, %e %B, %Y %H:%M", |