@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class text { |
|
15 | +class text{ |
|
16 | 16 | |
17 | 17 | /** Replace repeated white spaces to single space |
18 | 18 | * @param string $string |
19 | 19 | * @return string */ |
20 | 20 | |
21 | - static function clearWhitespaces($string) { |
|
21 | + static function clearWhitespaces($string){ |
|
22 | 22 | return trim(preg_replace('/\s+/s', " ", $string)); |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $string |
27 | 27 | * @return string */ |
28 | 28 | |
29 | - static function htmlValue($string) { |
|
29 | + static function htmlValue($string){ |
|
30 | 30 | return |
31 | 31 | str_replace('"', """, |
32 | 32 | str_replace("'", ''', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $string |
40 | 40 | * @return string */ |
41 | 41 | |
42 | - static function jsValue($string) { |
|
42 | + static function jsValue($string){ |
|
43 | 43 | return |
44 | 44 | preg_replace('/\r?\n/', "\\n", |
45 | 45 | str_replace('"', "\\\"", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $string |
53 | 53 | * @param bool $cdata */ |
54 | 54 | |
55 | - static function xmlData($string, $cdata=false) { |
|
55 | + static function xmlData($string, $cdata = false){ |
|
56 | 56 | $string = str_replace("]]>", "]]]]><![CDATA[>", $string); |
57 | 57 | if (!$cdata) |
58 | 58 | $string = "<![CDATA[$string]]>"; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string $code |
64 | 64 | * @return string */ |
65 | 65 | |
66 | - static function compressCSS($code) { |
|
66 | + static function compressCSS($code){ |
|
67 | 67 | $code = self::clearWhitespaces($code); |
68 | 68 | $code = preg_replace('/ ?\{ ?/', "{", $code); |
69 | 69 | $code = preg_replace('/ ?\} ?/', "}", $code); |
@@ -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); |
@@ -14,14 +14,14 @@ |
||
14 | 14 | |
15 | 15 | require "core/autoload.php"; // Init MODX |
16 | 16 | |
17 | -function returnNoPermissionsMessage($role) { |
|
17 | +function returnNoPermissionsMessage($role){ |
|
18 | 18 | global $_lang; |
19 | 19 | echo sprintf($_lang['files_management_no_permission'], $role); |
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
23 | -if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
24 | -if( $_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
23 | +if ($_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
24 | +if ($_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
25 | 25 | |
26 | 26 | $browser = new browser($modx); |
27 | 27 | $browser->action(); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | header("Content-Type: text/javascript"); |
19 | 19 | die; |
20 | 20 | } |
21 | -$file = "lang/" . $input->get['lng'] . ".php"; |
|
21 | +$file = "lang/".$input->get['lng'].".php"; |
|
22 | 22 | $files = dir::content("lang", array( |
23 | 23 | 'types' => "file", |
24 | 24 | 'pattern' => '/^.*\.php$/' |
@@ -33,4 +33,4 @@ discard block |
||
33 | 33 | header("Content-Type: text/javascript; charset={$lang['_charset']}"); |
34 | 34 | foreach ($lang as $english => $native) |
35 | 35 | if (substr($english, 0, 1) != "_") |
36 | - echo "browser.labels['" . text::jsValue($english) . "']=\"" . text::jsValue($native) . "\";"; |
|
36 | + echo "browser.labels['".text::jsValue($english)."']=\"".text::jsValue($native)."\";"; |
@@ -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); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_imagick extends image { |
|
15 | +class image_imagick extends image{ |
|
16 | 16 | |
17 | 17 | static $MIMES = array( |
18 | 18 | //'tif' => "image/tiff" |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // ABSTRACT PUBLIC METHODS |
23 | 23 | |
24 | - public function resize($width, $height) {// |
|
24 | + public function resize($width, $height){// |
|
25 | 25 | if (!$width) $width = 1; |
26 | 26 | if (!$height) $height = 1; |
27 | 27 | try { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | - public function resizeFit($width, $height, $background=false) {// |
|
37 | + public function resizeFit($width, $height, $background = false){// |
|
38 | 38 | if (!$width) $width = 1; |
39 | 39 | if (!$height) $height = 1; |
40 | 40 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - public function resizeCrop($width, $height, $offset=false) { |
|
68 | + public function resizeCrop($width, $height, $offset = false){ |
|
69 | 69 | if (!$width) $width = 1; |
70 | 70 | if (!$height) $height = 1; |
71 | 71 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return true; |
116 | 116 | } |
117 | 117 | |
118 | - public function rotate($angle, $background="#000000") { |
|
118 | + public function rotate($angle, $background = "#000000"){ |
|
119 | 119 | try { |
120 | 120 | $this->image->rotateImage(new ImagickPixel($background), $angle); |
121 | 121 | $size = $this->image->getImageGeometry(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | return true; |
128 | 128 | } |
129 | 129 | |
130 | - public function flipHorizontal() { |
|
130 | + public function flipHorizontal(){ |
|
131 | 131 | try { |
132 | 132 | $this->image->flopImage(); |
133 | 133 | } catch (Exception $e) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
139 | - public function flipVertical() { |
|
139 | + public function flipVertical(){ |
|
140 | 140 | try { |
141 | 141 | $this->image->flipImage(); |
142 | 142 | } catch (Exception $e) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | return true; |
146 | 146 | } |
147 | 147 | |
148 | - public function watermark($file, $left=false, $top=false) { |
|
148 | + public function watermark($file, $left = false, $top = false){ |
|
149 | 149 | try { |
150 | 150 | $wm = new Imagick($file); |
151 | 151 | $size = $wm->getImageGeometry(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | // ABSTRACT PROTECTED METHODS |
183 | 183 | |
184 | - protected function getBlankImage($width, $height) { |
|
184 | + protected function getBlankImage($width, $height){ |
|
185 | 185 | try { |
186 | 186 | $img = new Imagick(); |
187 | 187 | $img->newImage($width, $height, "none"); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return $img; |
193 | 193 | } |
194 | 194 | |
195 | - protected function getImage($image, &$width, &$height) { |
|
195 | + protected function getImage($image, &$width, &$height){ |
|
196 | 196 | |
197 | 197 | if (is_object($image) && ($image instanceof image_imagick)) { |
198 | 198 | try { |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | |
235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
236 | 236 | |
237 | - static function available() { |
|
237 | + static function available(){ |
|
238 | 238 | return class_exists("Imagick"); |
239 | 239 | } |
240 | 240 | |
241 | - static function checkImage($file) { |
|
241 | + static function checkImage($file){ |
|
242 | 242 | try { |
243 | 243 | new Imagick($file); |
244 | 244 | } catch (Exception $e) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | // INHERIT METHODS |
252 | 252 | |
253 | - public function output($type="jpeg", array $options=array()) { |
|
253 | + public function output($type = "jpeg", array $options = array()){ |
|
254 | 254 | $type = strtolower($type); |
255 | 255 | try { |
256 | 256 | $this->image->setImageFormat($type); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | echo $this->image; |
270 | 270 | |
271 | 271 | } else { |
272 | - $file = $options['file'] . ".$type"; |
|
272 | + $file = $options['file'].".$type"; |
|
273 | 273 | try { |
274 | 274 | $this->image->writeImage($file); |
275 | 275 | } catch (Exception $e) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | // OWN METHODS |
291 | 291 | |
292 | - protected function optimize_jpeg(array $options=array()) { |
|
292 | + protected function optimize_jpeg(array $options = array()){ |
|
293 | 293 | $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY; |
294 | 294 | try { |
295 | 295 | $this->image->setImageCompression(Imagick::COMPRESSION_JPEG); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gmagick extends image { |
|
15 | +class image_gmagick extends image{ |
|
16 | 16 | |
17 | 17 | static $MIMES = array( |
18 | 18 | //'tif' => "image/tiff" |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // ABSTRACT PUBLIC METHODS |
23 | 23 | |
24 | - public function resize($width, $height) {// |
|
24 | + public function resize($width, $height){// |
|
25 | 25 | if (!$width) $width = 1; |
26 | 26 | if (!$height) $height = 1; |
27 | 27 | try { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | - public function resizeFit($width, $height, $background=false) {// |
|
37 | + public function resizeFit($width, $height, $background = false){// |
|
38 | 38 | if (!$width) $width = 1; |
39 | 39 | if (!$height) $height = 1; |
40 | 40 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - public function resizeCrop($width, $height, $offset=false) { |
|
72 | + public function resizeCrop($width, $height, $offset = false){ |
|
73 | 73 | if (!$width) $width = 1; |
74 | 74 | if (!$height) $height = 1; |
75 | 75 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return true; |
120 | 120 | } |
121 | 121 | |
122 | - public function rotate($angle, $background="#000000") { |
|
122 | + public function rotate($angle, $background = "#000000"){ |
|
123 | 123 | try { |
124 | 124 | $this->image->rotateImage($background, $angle); |
125 | 125 | $w = $this->image->getImageWidth(); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | |
135 | - public function flipHorizontal() { |
|
135 | + public function flipHorizontal(){ |
|
136 | 136 | try { |
137 | 137 | $this->image->flopImage(); |
138 | 138 | } catch (Exception $e) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | |
144 | - public function flipVertical() { |
|
144 | + public function flipVertical(){ |
|
145 | 145 | try { |
146 | 146 | $this->image->flipImage(); |
147 | 147 | } catch (Exception $e) { |
@@ -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 | try { |
155 | 155 | $wm = new Gmagick($file); |
156 | 156 | $w = $wm->getImageWidth(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | // ABSTRACT PROTECTED METHODS |
187 | 187 | |
188 | - protected function getBlankImage($width, $height) { |
|
188 | + protected function getBlankImage($width, $height){ |
|
189 | 189 | try { |
190 | 190 | $img = new Gmagick(); |
191 | 191 | $img->newImage($width, $height, "none"); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return $img; |
196 | 196 | } |
197 | 197 | |
198 | - protected function getImage($image, &$width, &$height) { |
|
198 | + protected function getImage($image, &$width, &$height){ |
|
199 | 199 | |
200 | 200 | if (is_object($image) && ($image instanceof image_gmagick)) { |
201 | 201 | $width = $image->width; |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | |
233 | 233 | // PSEUDO-ABSTRACT STATIC METHODS |
234 | 234 | |
235 | - static function available() { |
|
235 | + static function available(){ |
|
236 | 236 | return class_exists("Gmagick"); |
237 | 237 | } |
238 | 238 | |
239 | - static function checkImage($file) { |
|
239 | + static function checkImage($file){ |
|
240 | 240 | try { |
241 | 241 | new Gmagick($file); |
242 | 242 | } catch (Exception $e) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | // INHERIT METHODS |
250 | 250 | |
251 | - public function output($type="jpeg", array $options=array()) { |
|
251 | + public function output($type = "jpeg", array $options = array()){ |
|
252 | 252 | $type = strtolower($type); |
253 | 253 | try { |
254 | 254 | $this->image->setImageFormat($type); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | echo $this->image; |
268 | 268 | |
269 | 269 | } else { |
270 | - $file = $options['file'] . ".$type"; |
|
270 | + $file = $options['file'].".$type"; |
|
271 | 271 | try { |
272 | 272 | $this->image->writeImage($file); |
273 | 273 | } catch (Exception $e) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | // OWN METHODS |
289 | 289 | |
290 | - protected function optimize_jpeg(array $options=array()) { |
|
290 | + protected function optimize_jpeg(array $options = array()){ |
|
291 | 291 | $quality = isset($options['quality']) ? $options['quality'] : self::DEFAULT_JPEG_QUALITY; |
292 | 292 | try { |
293 | 293 | $this->image->setCompressionQuality($quality); |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Ajax Requests |
4 | 4 | */ |
5 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
5 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) |
|
9 | +if (isset($_REQUEST[$cm->get('request_key')]['ajax'])) |
|
10 | 10 | { |
11 | 11 | $_data = $_REQUEST[$cm->get('request_key')]; |
12 | 12 | $output = ''; |
13 | 13 | $task = $_data['task']; |
14 | - switch( $task ) |
|
14 | + switch ($task) |
|
15 | 15 | { |
16 | 16 | /** |
17 | 17 | * get categories |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | case 'categorize_load_elements': |
20 | 20 | $elements = $_data['elements']; |
21 | 21 | |
22 | - if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
|
22 | + if ($uncategorized_elements = $cm->getAssignedElements(0, $_data['elements'])) |
|
23 | 23 | { |
24 | 24 | $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $cm->getCategories() as $category ) |
|
27 | + foreach ($cm->getCategories() as $category) |
|
28 | 28 | { |
29 | - $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] ); |
|
29 | + $category['elements'] = $cm->getAssignedElements($category['id'], $_data['elements']); |
|
30 | 30 | $output .= $cm->renderView('chunks/categorize/category', $category); |
31 | 31 | } |
32 | 32 | break; |
33 | 33 | } |
34 | - exit( $output ); |
|
34 | + exit($output); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Categorize elements |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 |
42 | 42 | * |
43 | 43 | */ |
44 | -if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) |
|
44 | +if (isset($_POST[$cm->get('request_key')]['categorize']['submit'])) |
|
45 | 45 | { |
46 | 46 | $_data = $_POST[$cm->get('request_key')]['categorize']; |
47 | 47 | $_changes = 0; |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | 'categorize' |
55 | 55 | ); |
56 | 56 | |
57 | - if( !isset( $_data['elements'] ) ) |
|
57 | + if (!isset($_data['elements'])) |
|
58 | 58 | { |
59 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' ); |
|
59 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'categorize'); |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | - foreach( $_data['elements'] as $element_id => $data ) |
|
63 | + foreach ($_data['elements'] as $element_id => $data) |
|
64 | 64 | { |
65 | - if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) |
|
65 | + if ($cm->updateElement($_data['elementsgroup'], $element_id, $data['category_id'])) |
|
66 | 66 | { |
67 | 67 | $cm->addMessage( |
68 | 68 | sprintf( |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if( $_changes === 0 ) |
|
81 | + if ($_changes === 0) |
|
82 | 82 | { |
83 | - $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' ); |
|
83 | + $cm->addMessage($cm->txt('cm_no_categorization'), 'categorize'); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | else |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Add a new category |
100 | 100 | */ |
101 | -if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) |
|
101 | +if (isset($_POST[$cm->get('request_key')]['add']['submit'])) |
|
102 | 102 | { |
103 | 103 | $_data = $_POST[$cm->get('request_key')]['add']['data']; |
104 | - $category = trim( html_entity_decode($_data['name']) ); |
|
104 | + $category = trim(html_entity_decode($_data['name'])); |
|
105 | 105 | $rank = (int) $_data['rank']; |
106 | 106 | |
107 | - if( empty( $category ) ) |
|
107 | + if (empty($category)) |
|
108 | 108 | { |
109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
109 | + $cm->addMessage($cm->txt('cm_enter_name_for_category'), 'add'); |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | - if( $cm->isCategoryExists( $category ) ) |
|
113 | + if ($cm->isCategoryExists($category)) |
|
114 | 114 | { |
115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
115 | + $cm->addMessage(sprintf($cm->txt('cm_category_x_exists'), $category), 'add'); |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | - if( $cm->addCategory( $category, $rank ) !== 0 ) |
|
119 | + if ($cm->addCategory($category, $rank) !== 0) |
|
120 | 120 | { |
121 | 121 | $cm->addMessage( |
122 | 122 | sprintf( |
123 | - $cm->txt( 'cm_category_x_saved_at_position_y' ), |
|
123 | + $cm->txt('cm_category_x_saved_at_position_y'), |
|
124 | 124 | $category, |
125 | 125 | $rank |
126 | 126 | ), |
@@ -129,26 +129,26 @@ discard block |
||
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
132 | - $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' ); |
|
132 | + $cm->addMessage($cm->txt('cm_unknown_error'), 'add'); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Sort categories |
138 | 138 | */ |
139 | -if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) |
|
139 | +if (isset($_POST[$cm->get('request_key')]['sort']['submit'])) |
|
140 | 140 | { |
141 | 141 | $categories = $_POST[$cm->get('request_key')]['sort']['data']; |
142 | 142 | $_changes = 0; |
143 | 143 | |
144 | - foreach( $categories as $category_id => $_data ) |
|
144 | + foreach ($categories as $category_id => $_data) |
|
145 | 145 | { |
146 | 146 | $data = array( |
147 | - 'category' => urldecode( $_data['category'] ), |
|
147 | + 'category' => urldecode($_data['category']), |
|
148 | 148 | 'rank' => $_data['rank'] |
149 | 149 | ); |
150 | 150 | |
151 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
151 | + if ($cm->updateCategory($category_id, $data)) |
|
152 | 152 | { |
153 | 153 | $cm->addMessage( |
154 | 154 | sprintf( |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if( $_changes === 0 ) |
|
165 | + if ($_changes === 0) |
|
166 | 166 | { |
167 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort'); |
|
167 | + $cm->addMessage($cm->txt('cm_no_changes'), 'sort'); |
|
168 | 168 | } |
169 | 169 | else |
170 | 170 | { |
@@ -181,21 +181,21 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * Edit categories |
183 | 183 | */ |
184 | -if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) |
|
184 | +if (isset($_POST[$cm->get('request_key')]['edit']['submit'])) |
|
185 | 185 | { |
186 | 186 | $categories = $_POST[$cm->get('request_key')]['edit']['data']; |
187 | 187 | $_changes = 0; |
188 | 188 | |
189 | - foreach( $categories as $category_id => $_data ) |
|
189 | + foreach ($categories as $category_id => $_data) |
|
190 | 190 | { |
191 | - if( isset( $_data['delete'] ) ) |
|
191 | + if (isset($_data['delete'])) |
|
192 | 192 | { |
193 | - if( $cm->deleteCategory( $category_id ) ) |
|
193 | + if ($cm->deleteCategory($category_id)) |
|
194 | 194 | { |
195 | 195 | $cm->addMessage( |
196 | 196 | sprintf( |
197 | 197 | $cm->txt('cm_category_x_deleted'), |
198 | - urldecode( $_data['origin'] ) |
|
198 | + urldecode($_data['origin']) |
|
199 | 199 | ), |
200 | 200 | 'edit' |
201 | 201 | ); |
@@ -205,16 +205,16 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | $data = array( |
208 | - 'category' => trim( html_entity_decode( $_data['category'] ) ), |
|
208 | + 'category' => trim(html_entity_decode($_data['category'])), |
|
209 | 209 | 'rank' => $_data['rank'] |
210 | 210 | ); |
211 | 211 | |
212 | - if( $cm->updateCategory( $category_id, $data ) ) |
|
212 | + if ($cm->updateCategory($category_id, $data)) |
|
213 | 213 | { |
214 | 214 | $cm->addMessage( |
215 | 215 | sprintf( |
216 | 216 | $cm->txt('cm_category_x_renamed_to_y'), |
217 | - urldecode( $_data['origin'] ), |
|
217 | + urldecode($_data['origin']), |
|
218 | 218 | $data['category'] |
219 | 219 | ), |
220 | 220 | 'edit' |
@@ -223,26 +223,26 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - if( $_changes === 0 ) |
|
226 | + if ($_changes === 0) |
|
227 | 227 | { |
228 | - $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit'); |
|
228 | + $cm->addMessage($cm->txt('cm_no_changes'), 'edit'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Delete singel category by $_GET |
234 | 234 | */ |
235 | -if( isset( $_GET[$cm->get('request_key')]['delete'] ) |
|
236 | - && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) |
|
235 | +if (isset($_GET[$cm->get('request_key')]['delete']) |
|
236 | + && !empty($_GET[$cm->get('request_key')]['delete'])) |
|
237 | 237 | { |
238 | - $category_id = (int)$_GET[$cm->get('request_key')]['delete']; |
|
238 | + $category_id = (int) $_GET[$cm->get('request_key')]['delete']; |
|
239 | 239 | |
240 | - if( $cm->deleteCategory( $category_id ) ) |
|
240 | + if ($cm->deleteCategory($category_id)) |
|
241 | 241 | { |
242 | 242 | $cm->addMessage( |
243 | 243 | sprintf( |
244 | 244 | $cm->txt('cm_category_x_deleted'), |
245 | - urldecode( $_GET[$cm->get('request_key')]['category'] ) |
|
245 | + urldecode($_GET[$cm->get('request_key')]['category']) |
|
246 | 246 | ), |
247 | 247 | 'edit' |
248 | 248 | ); |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * Translate phrases |
253 | 253 | */ |
254 | -if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) |
|
254 | +if (isset($_POST[$cm->get('request_key')]['translate']['submit'])) |
|
255 | 255 | { |
256 | 256 | $translations = $_POST[$cm->get('request_key')]['translate']['data']; |
257 | 257 | |
258 | - foreach( $translations as $native_phrase => $translation ) |
|
258 | + foreach ($translations as $native_phrase => $translation) |
|
259 | 259 | { |
260 | - $native_phrase = urldecode( $native_phrase ); |
|
260 | + $native_phrase = urldecode($native_phrase); |
|
261 | 261 | |
262 | - if( empty( $translation ) ) |
|
262 | + if (empty($translation)) |
|
263 | 263 | { |
264 | 264 | $translation = $native_phrase; |
265 | 265 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ); |
273 | 273 | } |
274 | 274 | |
275 | - $cm->c('Translator')->addTranslation( $native_phrase, $translation, 'phrase' ); |
|
275 | + $cm->c('Translator')->addTranslation($native_phrase, $translation, 'phrase'); |
|
276 | 276 | |
277 | 277 | $cm->addMessage( |
278 | 278 | sprintf( |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Message Quit Template |
4 | 4 | * |
5 | 5 | */ |
6 | -if(( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE!="true") { |
|
6 | +if ((!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE != "true") { |
|
7 | 7 | die("<b>INCLUDE ACCESS ERROR</b><br /><br />Direct access to this file prohibited."); |
8 | 8 | } |
9 | 9 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | </script> |
21 | 21 | </head><body> |
22 | 22 | "; |
23 | -if($is_error) { |
|
23 | +if ($is_error) { |
|
24 | 24 | $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
25 | 25 | <table border='0' cellpadding='1' cellspacing='0'> |
26 | 26 | <tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr> |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | <tr><td colspan='3'><b style='color:#003399;'>« $msg »</b></td></tr>"; |
33 | 33 | } |
34 | 34 | |
35 | -if(!empty($query)) { |
|
35 | +if (!empty($query)) { |
|
36 | 36 | $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
37 | 37 | <a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>"; |
38 | 38 | } |
39 | 39 | |
40 | -if($text!='') { |
|
40 | +if ($text != '') { |
|
41 | 41 | |
42 | - $errortype = array ( |
|
42 | + $errortype = array( |
|
43 | 43 | E_ERROR => "Error", |
44 | 44 | E_WARNING => "Warning", |
45 | 45 | E_PARSE => "Parsing Error", |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $parsedMessageString .= "<tr><td> Line: </td>"; |
71 | 71 | $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
72 | 72 | $parsedMessageString .= "</tr>"; |
73 | - if($source!='') { |
|
73 | + if ($source != '') { |
|
74 | 74 | $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
75 | 75 | $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
76 | 76 | $parsedMessageString .= "</tr>"; |