@@ -37,7 +37,9 @@ |
||
37 | 37 | |
38 | 38 | // Define which ratio will be used, depending on which is the biggest side |
39 | 39 | $ratio = $wRatio < $hRatio ? $wRatio : $hRatio; |
40 | - if ($ratio < 1) $ratio = 1; |
|
40 | + if ($ratio < 1) { |
|
41 | + $ratio = 1; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | // Calculate the destination width, height, x and y |
43 | 45 | $this->_destWidth = $originalWidth / $ratio; |
@@ -63,7 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function calculateX($imageResource) |
65 | 65 | { |
66 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
66 | + if (intval($this->_x) === $this->_x) { |
|
67 | + return $this->_x; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | $x = strtolower($this->_x); |
69 | 71 | |
@@ -88,7 +90,9 @@ discard block |
||
88 | 90 | */ |
89 | 91 | public function calculateY($imageResource) |
90 | 92 | { |
91 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
93 | + if (intval($this->_y) === $this->_y) { |
|
94 | + return $this->_y; |
|
95 | + } |
|
92 | 96 | |
93 | 97 | $y = strtolower($this->_y); |
94 | 98 | |
@@ -125,7 +129,9 @@ discard block |
||
125 | 129 | */ |
126 | 130 | public function GetWatermark() |
127 | 131 | { |
128 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark'); |
|
132 | + if ($this->_watermark == null) { |
|
133 | + throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark'); |
|
134 | + } |
|
129 | 135 | return $this->_watermark; |
130 | 136 | } |
131 | 137 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function SetPreserveAspectRatio($bool) |
53 | 53 | { |
54 | - $this->_preserveAspectRatio = (bool)$bool; |
|
54 | + $this->_preserveAspectRatio = (bool) $bool; |
|
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public static function slugify($str, $replace = array(), $delimiter = '-') |
21 | 21 | { |
22 | 22 | if (!empty($replace)) { |
23 | - $str = str_replace((array)$replace, ' ', $str); |
|
23 | + $str = str_replace((array) $replace, ' ', $str); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -78,12 +78,15 @@ |
||
78 | 78 | */ |
79 | 79 | public static function humanFileSize($size, $unit = "") |
80 | 80 | { |
81 | - if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
82 | - return number_format($size / (1 << 30), 2) . "GB"; |
|
83 | - if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
84 | - return number_format($size / (1 << 20), 2) . "MB"; |
|
85 | - if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
86 | - return number_format($size / (1 << 10), 2) . "KB"; |
|
81 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") { |
|
82 | + return number_format($size / (1 << 30), 2) . "GB"; |
|
83 | + } |
|
84 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") { |
|
85 | + return number_format($size / (1 << 20), 2) . "MB"; |
|
86 | + } |
|
87 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") { |
|
88 | + return number_format($size / (1 << 10), 2) . "KB"; |
|
89 | + } |
|
87 | 90 | |
88 | 91 | return number_format($size) . " bytes"; |
89 | 92 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | } |
35 | 35 | $object_vars = get_object_vars($valuelistObject->pairs); |
36 | 36 | ksort($object_vars); |
37 | - $valuelistObject->pairs = (object)$object_vars; |
|
37 | + $valuelistObject->pairs = (object) $object_vars; |
|
38 | 38 | |
39 | 39 | return $valuelistObject; |
40 | 40 | } else { |
@@ -151,7 +151,7 @@ |
||
151 | 151 | public function save() |
152 | 152 | { |
153 | 153 | $host = $this; |
154 | - array_map(function ($value) use ($host) { |
|
154 | + array_map(function($value) use ($host) { |
|
155 | 155 | $host->saveSubset($value); |
156 | 156 | }, $this->fileBasedSubsets); |
157 | 157 | } |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | if (!isset($_GET['unsanitized'])) { |
57 | 57 | $search = array( |
58 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
59 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
60 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
58 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
59 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
60 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
61 | 61 | '/<!--(.|\s)*?-->/' // Remove HTML comments |
62 | 62 | ); |
63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function utf8Convert($array) |
87 | 87 | { |
88 | - array_walk_recursive($array, function (&$item) { |
|
88 | + array_walk_recursive($array, function(&$item) { |
|
89 | 89 | if (!mb_detect_encoding($item, 'utf-8', true)) { |
90 | 90 | $item = utf8_encode($item); |
91 | 91 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | - * @param $request |
|
48 | + * @param Request $request |
|
49 | 49 | * @param CmsComponent $cmsComponent |
50 | 50 | */ |
51 | 51 | private function newRoute($request, $cmsComponent) |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @param $request |
|
63 | + * @param Request $request |
|
64 | 64 | * @param CmsComponent $cmsComponent |
65 | 65 | */ |
66 | 66 | private function editRoute($request, $cmsComponent) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * @param $request |
|
81 | + * @param Request $request |
|
82 | 82 | * @param CmsComponent $cmsComponent |
83 | 83 | */ |
84 | 84 | private function deleteRoute($request, $cmsComponent) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * @param $request |
|
49 | + * @param Request $request |
|
50 | 50 | * @param CmsComponent $cmsComponent |
51 | 51 | */ |
52 | 52 | private function editRoute($request, $cmsComponent) |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @param $request |
|
66 | + * @param Request $request |
|
67 | 67 | * @param CmsComponent $cmsComponent |
68 | 68 | */ |
69 | 69 | private function newRoute($request, $cmsComponent) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * @param $request |
|
81 | + * @param Request $request |
|
82 | 82 | * @param CmsComponent $cmsComponent |
83 | 83 | */ |
84 | 84 | private function deleteRoute($request, $cmsComponent) |