@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * Loop through sitemap items and see if one matches the requestUri. |
| 89 | 89 | * If it does, add it tot the matchedSitemapItems array |
| 90 | 90 | * |
| 91 | - * @param $request |
|
| 91 | + * @param Request $request |
|
| 92 | 92 | */ |
| 93 | 93 | private function sitemapMatching($request) |
| 94 | 94 | { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param string $template |
| 151 | 151 | * @param array $parameters |
| 152 | 152 | * |
| 153 | - * @return mixed |
|
| 153 | + * @return Component |
|
| 154 | 154 | * @throws \Exception |
| 155 | 155 | */ |
| 156 | 156 | private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | private function config() |
| 67 | 67 | { |
| 68 | - $configPath = __DIR__ . '/../../config.json'; |
|
| 68 | + $configPath = __DIR__.'/../../config.json'; |
|
| 69 | 69 | if (realpath($configPath) !== false) { |
| 70 | 70 | $json = file_get_contents($configPath); |
| 71 | 71 | $this->config = json_decode($json); |
| 72 | 72 | } else { |
| 73 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
| 73 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | private function sitemapMatching($request) |
| 94 | 94 | { |
| 95 | 95 | $sitemap = $this->storage->getSitemap(); |
| 96 | - $relativeUri = '/' . $request::$relativeUri; |
|
| 96 | + $relativeUri = '/'.$request::$relativeUri; |
|
| 97 | 97 | |
| 98 | 98 | foreach ($sitemap as $sitemapItem) { |
| 99 | 99 | if ($sitemapItem->regex) { |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | * @return mixed |
| 157 | 157 | * @throws \Exception |
| 158 | 158 | */ |
| 159 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
|
| 159 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
|
| 160 | 160 | { |
| 161 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
| 162 | - $userComponentName = '\\components\\' . $class; |
|
| 161 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
| 162 | + $userComponentName = '\\components\\'.$class; |
|
| 163 | 163 | |
| 164 | 164 | if (\autoLoad($libraryComponentName, false)) { |
| 165 | 165 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 166 | 166 | } elseif (\autoLoad($userComponentName, false)) { |
| 167 | 167 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 168 | 168 | } else { |
| 169 | - throw new \Exception('Could not load component ' . $class); |
|
| 169 | + throw new \Exception('Could not load component '.$class); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (!$component instanceof Component) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | public function setCachingHeaders() |
| 226 | 226 | { |
| 227 | 227 | header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days |
| 228 | - header("Cache-Control: max-age=" . (60 * 60 * 24 * 2)); |
|
| 228 | + header("Cache-Control: max-age=".(60 * 60 * 24 * 2)); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param array $replace |
| 112 | 112 | * @param string $delimiter |
| 113 | 113 | * |
| 114 | - * @return mixed|string |
|
| 114 | + * @return string |
|
| 115 | 115 | */ |
| 116 | 116 | function slugify($str, $replace=array(), $delimiter='-') { |
| 117 | 117 | if( !empty($replace) ) { |
@@ -130,7 +130,6 @@ discard block |
||
| 130 | 130 | * Dumps a var_dump of the passed arguments with <pre> tags surrounding it. |
| 131 | 131 | * Dies afterwards |
| 132 | 132 | * |
| 133 | - * @param mixed $data The data to be displayed |
|
| 134 | 133 | */ |
| 135 | 134 | function dump() |
| 136 | 135 | { |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | return '0 seconds'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $a = array( 365 * 24 * 60 * 60 => 'year', |
|
| 37 | + $a = array(365 * 24 * 60 * 60 => 'year', |
|
| 38 | 38 | 30 * 24 * 60 * 60 => 'month', |
| 39 | 39 | 24 * 60 * 60 => 'day', |
| 40 | 40 | 60 * 60 => 'hour', |
| 41 | 41 | 60 => 'minute', |
| 42 | 42 | 1 => 'second' |
| 43 | 43 | ); |
| 44 | - $a_plural = array( 'year' => 'years', |
|
| 44 | + $a_plural = array('year' => 'years', |
|
| 45 | 45 | 'month' => 'months', |
| 46 | 46 | 'day' => 'days', |
| 47 | 47 | 'hour' => 'hours', |
@@ -55,18 +55,18 @@ discard block |
||
| 55 | 55 | if ($d >= 1) |
| 56 | 56 | { |
| 57 | 57 | $r = round($d); |
| 58 | - return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago'; |
|
| 58 | + return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago'; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -function humanFileSize($size,$unit="") { |
|
| 64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
| 65 | - return number_format($size/(1<<30),2)."GB"; |
|
| 66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
| 67 | - return number_format($size/(1<<20),2)."MB"; |
|
| 68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
| 69 | - return number_format($size/(1<<10),2)."KB"; |
|
| 63 | +function humanFileSize($size, $unit = "") { |
|
| 64 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
| 65 | + return number_format($size / (1 << 30), 2)."GB"; |
|
| 66 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
| 67 | + return number_format($size / (1 << 20), 2)."MB"; |
|
| 68 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
| 69 | + return number_format($size / (1 << 10), 2)."KB"; |
|
| 70 | 70 | return number_format($size)." bytes"; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return mixed|string |
| 115 | 115 | */ |
| 116 | -function slugify($str, $replace=array(), $delimiter='-') { |
|
| 117 | - if( !empty($replace) ) { |
|
| 118 | - $str = str_replace((array)$replace, ' ', $str); |
|
| 116 | +function slugify($str, $replace = array(), $delimiter = '-') { |
|
| 117 | + if (!empty($replace)) { |
|
| 118 | + $str = str_replace((array) $replace, ' ', $str); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $debug_backtrace = current(debug_backtrace()); |
| 138 | 138 | if (PHP_SAPI == 'cli') { |
| 139 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
| 139 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
| 140 | 140 | foreach (func_get_args() as $data) { |
| 141 | 141 | var_dump($data); |
| 142 | 142 | } |
| 143 | 143 | } else { |
| 144 | 144 | ob_clean(); |
| 145 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
| 145 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
| 146 | 146 | echo '<pre>'; |
| 147 | 147 | foreach (func_get_args() as $data) { |
| 148 | 148 | echo "<code>"; |
@@ -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); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getDocumentBySlug($slug) |
| 191 | 191 | { |
| 192 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
| 192 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
| 193 | 193 | $indices = $documentContainer['indices']; |
| 194 | 194 | |
| 195 | 195 | if ($indices === null) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // Check for duplicates |
| 235 | 235 | foreach ($this->repository->documents as $index => $document) { |
| 236 | 236 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
| 237 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 237 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | // Check for duplicates |
| 243 | 243 | foreach ($previousFolder->content as $index => $document) { |
| 244 | 244 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
| 245 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 245 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
| 248 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $this->save(); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | foreach ($this->repository->documents as $document) { |
| 260 | 260 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
| 261 | 261 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
| 262 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 262 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | $this->repository->documents[] = $documentFolderObject; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | foreach ($containerFolder->content as $document) { |
| 271 | 271 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
| 272 | 272 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
| 273 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 273 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | foreach ($this->repository->documents as $document) { |
| 386 | 386 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
| 387 | 387 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
| 388 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 388 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | $this->repository->documents[] = $documentFolderObject; |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | foreach ($containerFolder->content as $document) { |
| 407 | 407 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
| 408 | 408 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
| 409 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 409 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | $folder->content[] = $documentFolderObject; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | public function getDocumentFolderBySlug($slug) |
| 460 | 460 | { |
| 461 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
| 461 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
| 462 | 462 | $indices = $documentContainer['indices']; |
| 463 | 463 | |
| 464 | 464 | $folder = $this->repository->documents; |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | // Check for duplicates |
| 503 | 503 | foreach ($this->repository->documents as $index => $document) { |
| 504 | 504 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
| 505 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 505 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -510,10 +510,10 @@ discard block |
||
| 510 | 510 | // Check for duplicates |
| 511 | 511 | foreach ($previousFolder->content as $index => $document) { |
| 512 | 512 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
| 513 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
| 513 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
| 516 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | $this->save(); |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | 'previousDocument' => $previousDocument |
| 584 | 584 | ); |
| 585 | 585 | } else { |
| 586 | - throw new \Exception('Invalid path: ' . $path); |
|
| 586 | + throw new \Exception('Invalid path: '.$path); |
|
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | |
@@ -768,13 +768,13 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | public function addImage($postValues) |
| 770 | 770 | { |
| 771 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
| 771 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
| 772 | 772 | |
| 773 | 773 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
| 774 | - $destination = $destinationPath . '/' . $filename; |
|
| 774 | + $destination = $destinationPath.'/'.$filename; |
|
| 775 | 775 | |
| 776 | 776 | if ($postValues['error'] != '0') { |
| 777 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
| 777 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -796,14 +796,14 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | public function deleteImageByName($filename) |
| 798 | 798 | { |
| 799 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
| 799 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
| 800 | 800 | |
| 801 | 801 | $images = $this->getImages(); |
| 802 | 802 | |
| 803 | 803 | foreach ($images as $key => $image) { |
| 804 | 804 | if ($image->file == $filename) { |
| 805 | 805 | foreach ($image->set as $imageSetFilename) { |
| 806 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
| 806 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
| 807 | 807 | if (file_exists($destination)) { |
| 808 | 808 | unlink($destination); |
| 809 | 809 | } else { |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | */ |
| 846 | 846 | public function getFiles() |
| 847 | 847 | { |
| 848 | - $files = $this->repository->files; |
|
| 848 | + $files = $this->repository->files; |
|
| 849 | 849 | usort($files, array($this, 'compareFiles')); |
| 850 | 850 | return $files; |
| 851 | 851 | } |
@@ -857,13 +857,13 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | public function addFile($postValues) |
| 859 | 859 | { |
| 860 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
| 860 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
| 861 | 861 | |
| 862 | 862 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
| 863 | - $destination = $destinationPath . '/' . $filename; |
|
| 863 | + $destination = $destinationPath.'/'.$filename; |
|
| 864 | 864 | |
| 865 | 865 | if ($postValues['error'] != '0') { |
| 866 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
| 866 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -887,23 +887,23 @@ discard block |
||
| 887 | 887 | array_pop($fileParts); |
| 888 | 888 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 889 | 889 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
| 890 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 890 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 891 | 891 | } else { |
| 892 | 892 | $filename = slugify($filename); |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - if (file_exists($path . '/' . $filename)) { |
|
| 895 | + if (file_exists($path.'/'.$filename)) { |
|
| 896 | 896 | $fileParts = explode('.', $filename); |
| 897 | 897 | if (count($fileParts) > 1) { |
| 898 | 898 | $extension = end($fileParts); |
| 899 | 899 | array_pop($fileParts); |
| 900 | 900 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 901 | 901 | $fileNameWithoutExtension .= '-copy'; |
| 902 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 902 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 903 | 903 | } else { |
| 904 | 904 | $filename .= '-copy'; |
| 905 | 905 | } |
| 906 | - return $this->validateFilename($filename,$path); |
|
| 906 | + return $this->validateFilename($filename, $path); |
|
| 907 | 907 | } |
| 908 | 908 | return $filename; |
| 909 | 909 | } |
@@ -929,8 +929,8 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | public function deleteFileByName($filename) |
| 931 | 931 | { |
| 932 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
| 933 | - $destination = $destinationPath . '/' . $filename; |
|
| 932 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
| 933 | + $destination = $destinationPath.'/'.$filename; |
|
| 934 | 934 | |
| 935 | 935 | if (file_exists($destination)) { |
| 936 | 936 | $files = $this->getFiles(); |
@@ -1226,12 +1226,12 @@ discard block |
||
| 1226 | 1226 | * @throws \Exception |
| 1227 | 1227 | */ |
| 1228 | 1228 | private function save() { |
| 1229 | - $storagePath = __DIR__ . $this->storagePath; |
|
| 1229 | + $storagePath = __DIR__.$this->storagePath; |
|
| 1230 | 1230 | if (realpath($storagePath) !== false) { |
| 1231 | - copy($storagePath, $storagePath . '.bak'); |
|
| 1231 | + copy($storagePath, $storagePath.'.bak'); |
|
| 1232 | 1232 | file_put_contents($storagePath, json_encode($this->repository)); |
| 1233 | 1233 | } else { |
| 1234 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
| 1234 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | } |
| 1237 | 1237 | |
@@ -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 |