@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * JsonStorage constructor. |
19 | 19 | * |
20 | - * @param $storagePath |
|
20 | + * @param string $storagePath |
|
21 | 21 | */ |
22 | 22 | public function __construct($storagePath) |
23 | 23 | { |
@@ -837,6 +837,9 @@ discard block |
||
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
840 | + /** |
|
841 | + * @param string $path |
|
842 | + */ |
|
840 | 843 | private function validateFilename($filename, $path) |
841 | 844 | { |
842 | 845 | $fileParts = explode('.', $filename); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | private function config() |
35 | 35 | { |
36 | - $storagePath = __DIR__ . $this->storagePath; |
|
36 | + $storagePath = __DIR__.$this->storagePath; |
|
37 | 37 | if (realpath($storagePath) !== false) { |
38 | 38 | $jsonString = file_get_contents($storagePath); |
39 | 39 | $this->repository = json_decode($jsonString); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function getDocumentBySlug($slug) |
185 | 185 | { |
186 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
186 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
187 | 187 | $indices = $documentContainer['indices']; |
188 | 188 | |
189 | 189 | if ($indices === null) { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // Check for duplicates |
229 | 229 | foreach ($this->repository->documents as $index => $document) { |
230 | 230 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
231 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
231 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | // Check for duplicates |
237 | 237 | foreach ($previousFolder->content as $index => $document) { |
238 | 238 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
239 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
239 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
240 | 240 | } |
241 | 241 | } |
242 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
242 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | $this->save(); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | foreach ($this->repository->documents as $document) { |
254 | 254 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
255 | 255 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
256 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
256 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | $this->repository->documents[] = $documentFolderObject; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | foreach ($containerFolder->content as $document) { |
265 | 265 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
266 | 266 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
267 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
267 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | foreach ($this->repository->documents as $document) { |
381 | 381 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
382 | 382 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
383 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
383 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | $this->repository->documents[] = $documentFolderObject; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | foreach ($containerFolder->content as $document) { |
402 | 402 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
403 | 403 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
404 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
404 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | $folder->content[] = $documentFolderObject; |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | */ |
454 | 454 | public function getDocumentFolderBySlug($slug) |
455 | 455 | { |
456 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
456 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
457 | 457 | $indices = $documentContainer['indices']; |
458 | 458 | |
459 | 459 | $folder = $this->repository->documents; |
460 | 460 | if ($indices === null) { |
461 | - throw new \Exception('Can\'t find folder with slug `' . $slug . '`'); |
|
461 | + throw new \Exception('Can\'t find folder with slug `'.$slug.'`'); |
|
462 | 462 | } |
463 | 463 | foreach ($indices as $index) { |
464 | 464 | if ($folder === $this->repository->documents) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // Check for duplicates |
501 | 501 | foreach ($this->repository->documents as $index => $document) { |
502 | 502 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
503 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
503 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -508,10 +508,10 @@ discard block |
||
508 | 508 | // Check for duplicates |
509 | 509 | foreach ($previousFolder->content as $index => $document) { |
510 | 510 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
511 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
511 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
512 | 512 | } |
513 | 513 | } |
514 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
514 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $this->save(); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | 'previousDocument' => $previousDocument |
581 | 581 | ); |
582 | 582 | } else { |
583 | - throw new \Exception('Invalid path: ' . $path); |
|
583 | + throw new \Exception('Invalid path: '.$path); |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
@@ -765,13 +765,13 @@ discard block |
||
765 | 765 | |
766 | 766 | public function addImage($postValues) |
767 | 767 | { |
768 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
768 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
769 | 769 | |
770 | 770 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
771 | - $destination = $destinationPath . '/' . $filename; |
|
771 | + $destination = $destinationPath.'/'.$filename; |
|
772 | 772 | |
773 | 773 | if ($postValues['error'] != '0') { |
774 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
774 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -793,14 +793,14 @@ discard block |
||
793 | 793 | |
794 | 794 | public function deleteImageByName($filename) |
795 | 795 | { |
796 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
796 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
797 | 797 | |
798 | 798 | $images = $this->getImages(); |
799 | 799 | |
800 | 800 | foreach ($images as $key => $image) { |
801 | 801 | if ($image->file == $filename) { |
802 | 802 | foreach ($image->set as $imageSetFilename) { |
803 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
803 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
804 | 804 | if (file_exists($destination)) { |
805 | 805 | unlink($destination); |
806 | 806 | } else { |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | */ |
843 | 843 | public function getFiles() |
844 | 844 | { |
845 | - $files = $this->repository->files; |
|
845 | + $files = $this->repository->files; |
|
846 | 846 | usort($files, array($this, 'compareFiles')); |
847 | 847 | return $files; |
848 | 848 | } |
@@ -854,13 +854,13 @@ discard block |
||
854 | 854 | |
855 | 855 | public function addFile($postValues) |
856 | 856 | { |
857 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
857 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
858 | 858 | |
859 | 859 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
860 | - $destination = $destinationPath . '/' . $filename; |
|
860 | + $destination = $destinationPath.'/'.$filename; |
|
861 | 861 | |
862 | 862 | if ($postValues['error'] != '0') { |
863 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
863 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -884,23 +884,23 @@ discard block |
||
884 | 884 | array_pop($fileParts); |
885 | 885 | $fileNameWithoutExtension = implode('-', $fileParts); |
886 | 886 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
887 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
887 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
888 | 888 | } else { |
889 | 889 | $filename = slugify($filename); |
890 | 890 | } |
891 | 891 | |
892 | - if (file_exists($path . '/' . $filename)) { |
|
892 | + if (file_exists($path.'/'.$filename)) { |
|
893 | 893 | $fileParts = explode('.', $filename); |
894 | 894 | if (count($fileParts) > 1) { |
895 | 895 | $extension = end($fileParts); |
896 | 896 | array_pop($fileParts); |
897 | 897 | $fileNameWithoutExtension = implode('-', $fileParts); |
898 | 898 | $fileNameWithoutExtension .= '-copy'; |
899 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
899 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
900 | 900 | } else { |
901 | 901 | $filename .= '-copy'; |
902 | 902 | } |
903 | - return $this->validateFilename($filename,$path); |
|
903 | + return $this->validateFilename($filename, $path); |
|
904 | 904 | } |
905 | 905 | return $filename; |
906 | 906 | } |
@@ -926,8 +926,8 @@ discard block |
||
926 | 926 | */ |
927 | 927 | public function deleteFileByName($filename) |
928 | 928 | { |
929 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
930 | - $destination = $destinationPath . '/' . $filename; |
|
929 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
930 | + $destination = $destinationPath.'/'.$filename; |
|
931 | 931 | |
932 | 932 | if (file_exists($destination)) { |
933 | 933 | $files = $this->getFiles(); |
@@ -1223,12 +1223,12 @@ discard block |
||
1223 | 1223 | * @throws \Exception |
1224 | 1224 | */ |
1225 | 1225 | private function save() { |
1226 | - $storagePath = __DIR__ . $this->storagePath; |
|
1226 | + $storagePath = __DIR__.$this->storagePath; |
|
1227 | 1227 | if (realpath($storagePath) !== false) { |
1228 | - copy($storagePath, $storagePath . '.bak'); |
|
1228 | + copy($storagePath, $storagePath.'.bak'); |
|
1229 | 1229 | file_put_contents($storagePath, json_encode($this->repository)); |
1230 | 1230 | } else { |
1231 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
1231 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <div class="grid-container"> |
3 | 3 | <div class="grid-box-2"> |
4 | 4 | <div class="grid-inner"> |
5 | - <div<?=isset($value) ? ' style="background-image:url(\'' . $request::$subfolders . 'images/' . $value . '\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div> |
|
5 | + <div<?=isset($value) ? ' style="background-image:url(\''.$request::$subfolders.'images/'.$value.'\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div> |
|
6 | 6 | </div> |
7 | 7 | </div> |
8 | 8 | <div class="grid-box-10"> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | <div class="show-image"> |
11 | 11 | <label>File</label> |
12 | 12 | <div class="value"> |
13 | - <?=isset($image)? $image->file : '' ?> |
|
13 | + <?=isset($image) ? $image->file : '' ?> |
|
14 | 14 | </div> |
15 | 15 | <label>Type</label> |
16 | 16 | <div class="value"> |
17 | - <?=isset($image)? $image->type : '' ?> |
|
17 | + <?=isset($image) ? $image->type : '' ?> |
|
18 | 18 | </div> |
19 | 19 | <label>Size</label> |
20 | 20 | <div class="value"> |
21 | - <?=isset($image)? humanFileSize($image->size) : '' ?> |
|
21 | + <?=isset($image) ? humanFileSize($image->size) : '' ?> |
|
22 | 22 | </div> |
23 | 23 | <label>Set</label> |
24 | 24 | <? if (isset($image)) : ?> |
25 | 25 | <? foreach ($image->set as $key => $set) : ?> |
26 | 26 | <div class="sets"> |
27 | 27 | <label><?=$key?></label> |
28 | - <img src="<?=\library\cc\Request::$subfolders . 'images/' . $set?>" /> |
|
28 | + <img src="<?=\library\cc\Request::$subfolders.'images/'.$set?>" /> |
|
29 | 29 | </div> |
30 | 30 | <? endforeach ?> |
31 | 31 | <? endif ?> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/');};</script> |
|
1 | +<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/');};</script> |
|
2 | 2 | <section class="documents"> |
3 | 3 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
4 | 4 | <nav class="actions"> |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | <? foreach ($documents as $document) : ?> |
25 | 25 | <li class="grid-container"> |
26 | 26 | <? if ($document->type == 'document') : ?> |
27 | - <?renderDocument($document, $cmsPrefix);?> |
|
27 | + <?renderDocument($document, $cmsPrefix); ?> |
|
28 | 28 | <? elseif ($document->type == 'folder') : ?> |
29 | - <?renderFolder($document, $cmsPrefix, '', true);?> |
|
29 | + <?renderFolder($document, $cmsPrefix, '', true); ?> |
|
30 | 30 | <? endif ?> |
31 | 31 | </li> |
32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?> |
38 | 38 | <div class="grid-box-10"> |
39 | 39 | <h3> |
40 | - <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"> |
|
40 | + <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"> |
|
41 | 41 | <i class="fa fa-file-text-o"></i> <?=$document->title?> |
42 | 42 | </a> |
43 | 43 | <small class="small state <?=strtolower($document->state)?>"><?=ucfirst($document->state)?></small> |
@@ -53,29 +53,29 @@ discard block |
||
53 | 53 | </h3> |
54 | 54 | </div> |
55 | 55 | <div class="documentActions grid-box-2"> |
56 | - <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
57 | - <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
56 | + <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
57 | + <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
58 | 58 | </div> |
59 | 59 | <?}?> |
60 | -<? function renderFolder($document, $cmsPrefix, $slugPrefix ='', $root = false) {?> |
|
60 | +<? function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false) {?> |
|
61 | 61 | <div class="grid-box-8"> |
62 | 62 | <h3> |
63 | - <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix . $document->slug?>" title="Open"> |
|
63 | + <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix.$document->slug?>" title="Open"> |
|
64 | 64 | <i class="fa fa-folder-o "></i> <?=$document->title?> |
65 | 65 | </a> |
66 | 66 | </h3> |
67 | 67 | </div> |
68 | 68 | <div class="documentActions grid-box-4"> |
69 | - <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
70 | - <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
69 | + <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
70 | + <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
71 | 71 | </div> |
72 | 72 | <ul class="documents grid-wrapper nested<?=$root ? ' root' : '' ?>"> |
73 | 73 | <? foreach ($document->content as $subDocument) : ?> |
74 | 74 | <li class="grid-container"> |
75 | 75 | <? if ($subDocument->type == 'document') : ?> |
76 | - <?renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
76 | + <?renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
77 | 77 | <? elseif ($subDocument->type == 'folder') : ?> |
78 | - <?renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
78 | + <?renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
79 | 79 | <? endif ?> |
80 | 80 | </li> |
81 | 81 | <? endforeach ?> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | </li> |
63 | 63 | <? $nrOfMenuItems += 1 ?> |
64 | 64 | <? endif ?> |
65 | - <li class="grid-box-<?=6 + (5-$nrOfMenuItems)?> log-off-box"> |
|
65 | + <li class="grid-box-<?=6 + (5 - $nrOfMenuItems)?> log-off-box"> |
|
66 | 66 | <a class="btn log-off grid-inner" href="<?=$request::$subfolders?><?=$cmsPrefix?>/log-off"> |
67 | 67 | <i class="fa fa-power-off"></i> |
68 | 68 | <span>Log off</span> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </main> |
87 | 87 | <script> |
88 | 88 | var subfolders = '<?=$request::$subfolders?>', |
89 | - cmsSubfolders = '<?=$request::$subfolders . $cmsPrefix?>'; |
|
89 | + cmsSubfolders = '<?=$request::$subfolders.$cmsPrefix?>'; |
|
90 | 90 | </script> |
91 | 91 | <script src="<?=$request::$subfolders?>js/cms.js"></script> |
92 | 92 | </body> |
@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | // Define the ratio and adjust the width and height |
65 | 65 | if ($this->_preserveAspectRatio) { |
66 | - $ratio = min($this->_width/$originalWidth, $this->_height/$originalHeight); |
|
66 | + $ratio = min($this->_width / $originalWidth, $this->_height / $originalHeight); |
|
67 | 67 | $this->_width = $originalWidth * $ratio; |
68 | 68 | $this->_height = $originalHeight * $ratio; |
69 | 69 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | |
27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
28 | 28 | $ratio = min($hRatio, $wRatio); |
29 | - if($ratio > 1) $ratio = 1; |
|
29 | + if ($ratio > 1) $ratio = 1; |
|
30 | 30 | |
31 | 31 | // Define sizes |
32 | 32 | $this->_destWidth = floor($originalWidth * $ratio); |
33 | 33 | $this->_destHeight = floor($originalHeight * $ratio); |
34 | 34 | |
35 | 35 | // Define margins |
36 | - $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
36 | + $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
37 | 37 | $this->_destY = floor(($this->_height - $this->_destHeight) / 2); |
38 | 38 | |
39 | 39 | // Execute the Crop method with the given parameters |
@@ -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 | } |