@@ -118,49 +118,49 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | if(!function_exists('assetThumbnail')) { |
121 | - function assetThumbnail($path) { |
|
122 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
123 | - return asset($path); |
|
124 | - } |
|
121 | + function assetThumbnail($path) { |
|
122 | + $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
123 | + return asset($path); |
|
124 | + } |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | if(!function_exists('assetResize')) { |
128 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
129 | - $basename = basename($path); |
|
130 | - $pathWithoutName = str_replace($basename, '', $path); |
|
131 | - $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
132 | - if(Storage::exists($newLocation)) { |
|
133 | - return asset($newLocation); |
|
134 | - }else{ |
|
135 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
136 | - $img->save(storage_path($newLocation),$quality); |
|
137 | - return asset($newLocation); |
|
138 | - } |
|
139 | - } |
|
128 | + function assetResize($path,$width,$height=null,$quality=70) { |
|
129 | + $basename = basename($path); |
|
130 | + $pathWithoutName = str_replace($basename, '', $path); |
|
131 | + $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
132 | + if(Storage::exists($newLocation)) { |
|
133 | + return asset($newLocation); |
|
134 | + }else{ |
|
135 | + $img = Image::make(storage_path($path))->fit($width,$height); |
|
136 | + $img->save(storage_path($newLocation),$quality); |
|
137 | + return asset($newLocation); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if(!function_exists('extract_unit')) { |
143 | - /* |
|
143 | + /* |
|
144 | 144 | Credits: Bit Repository |
145 | 145 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
146 | 146 | */ |
147 | - function extract_unit($string, $start, $end) |
|
148 | - { |
|
149 | - $pos = stripos($string, $start); |
|
150 | - $str = substr($string, $pos); |
|
151 | - $str_two = substr($str, strlen($start)); |
|
152 | - $second_pos = stripos($str_two, $end); |
|
153 | - $str_three = substr($str_two, 0, $second_pos); |
|
154 | - $unit = trim($str_three); // remove whitespaces |
|
155 | - return $unit; |
|
156 | - } |
|
147 | + function extract_unit($string, $start, $end) |
|
148 | + { |
|
149 | + $pos = stripos($string, $start); |
|
150 | + $str = substr($string, $pos); |
|
151 | + $str_two = substr($str, strlen($start)); |
|
152 | + $second_pos = stripos($str_two, $end); |
|
153 | + $str_three = substr($str_two, 0, $second_pos); |
|
154 | + $unit = trim($str_three); // remove whitespaces |
|
155 | + return $unit; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
160 | 160 | if(!function_exists('now')) { |
161 | - function now() { |
|
162 | - return date('Y-m-d H:i:s'); |
|
163 | - } |
|
161 | + function now() { |
|
162 | + return date('Y-m-d H:i:s'); |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /* |
@@ -324,22 +324,22 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | if(!function_exists('rrmdir')) { |
327 | - /* |
|
327 | + /* |
|
328 | 328 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
329 | 329 | */ |
330 | - function rrmdir($dir) { |
|
331 | - if (is_dir($dir)) { |
|
332 | - $objects = scandir($dir); |
|
333 | - foreach ($objects as $object) { |
|
334 | - if ($object != "." && $object != "..") { |
|
335 | - if (is_dir($dir."/".$object)) |
|
336 | - rrmdir($dir."/".$object); |
|
337 | - else |
|
338 | - unlink($dir."/".$object); |
|
339 | - } |
|
340 | - } |
|
341 | - rmdir($dir); |
|
342 | - } |
|
343 | - } |
|
330 | + function rrmdir($dir) { |
|
331 | + if (is_dir($dir)) { |
|
332 | + $objects = scandir($dir); |
|
333 | + foreach ($objects as $object) { |
|
334 | + if ($object != "." && $object != "..") { |
|
335 | + if (is_dir($dir."/".$object)) |
|
336 | + rrmdir($dir."/".$object); |
|
337 | + else |
|
338 | + unlink($dir."/".$object); |
|
339 | + } |
|
340 | + } |
|
341 | + rmdir($dir); |
|
342 | + } |
|
343 | + } |
|
344 | 344 | } |
345 | 345 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | interface CBHook { |
5 | 5 | |
6 | 6 | public function hookGetLogin(); |
7 | - public function hookPostLogin(); |
|
8 | - public function beforeBackendMiddleware($request); |
|
7 | + public function hookPostLogin(); |
|
8 | + public function beforeBackendMiddleware($request); |
|
9 | 9 | public function afterBackendMiddleware($request, $response); |
10 | 10 | } |
11 | 11 | \ No newline at end of file |