| @@ -13,6 +13,10 @@ | ||
| 13 | 13 |  { | 
| 14 | 14 | protected $imagesDir; | 
| 15 | 15 | |
| 16 | + /** | |
| 17 | + * @param \CloudControl\Cms\storage\Repository $repository | |
| 18 | + * @param string $imagesDir | |
| 19 | + */ | |
| 16 | 20 | public function __construct($repository, $imagesDir) | 
| 17 | 21 |      { | 
| 18 | 22 | parent::__construct($repository); | 
| @@ -83,6 +83,9 @@ discard block | ||
| 83 | 83 | $this->storage = new Storage($this->config->rootDir . DIRECTORY_SEPARATOR . $this->config->storageDir, $this->config->imagesDir, $this->config->filesDir); | 
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | + /** | |
| 87 | + * @param Request $request | |
| 88 | + */ | |
| 86 | 89 | private function redirectMatching($request) | 
| 87 | 90 |          { | 
| 88 | 91 | $redirects = $this->storage->getRedirects()->getRedirects(); | 
| @@ -112,7 +115,7 @@ discard block | ||
| 112 | 115 | * Loop through sitemap items and see if one matches the requestUri. | 
| 113 | 116 | * If it does, add it tot the matchedSitemapItems array | 
| 114 | 117 | * | 
| 115 | - * @param $request | |
| 118 | + * @param Request $request | |
| 116 | 119 | */ | 
| 117 | 120 | private function sitemapMatching($request) | 
| 118 | 121 |          { | 
| @@ -177,7 +180,7 @@ discard block | ||
| 177 | 180 | * @param array $parameters | 
| 178 | 181 | * @param \stdClass|null $matchedSitemapItem | 
| 179 | 182 | * | 
| 180 | - * @return mixed | |
| 183 | + * @return Component | |
| 181 | 184 | * @throws \Exception | 
| 182 | 185 | */ | 
| 183 | 186 | private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) | 
| @@ -14,8 +14,10 @@ | ||
| 14 | 14 | <? if (isset($dynamicBrick)) : | 
| 15 | 15 | $fieldSlug = $field->slug; | 
| 16 | 16 | $value = isset($dynamicBrick->fields->$fieldSlug) ? current($dynamicBrick->fields->$fieldSlug) : ''; | 
| 17 | - else : | |
| 17 | +				else { | |
| 18 | + : | |
| 18 | 19 | $value = ''; | 
| 20 | + } | |
| 19 | 21 | endif ?> | 
| 20 | 22 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> | 
| 21 | 23 | <ul class="grid-wrapper sortable"> | 
| @@ -1,7 +1,8 @@ discard block | ||
| 1 | 1 | <form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?= isset($formId) ? '#' . $formId : '' ?>"> | 
| 2 | 2 | <? if (!isset($hideTitleAndState)) : ?> | 
| 3 | 3 | <input type="hidden" name="path" value="<?= $request::$get['path'] ?>"/> | 
| 4 | - <? else : ?> | |
| 4 | +    <? else { | |
| 5 | + : ?> | |
| 5 | 6 | <input type="hidden" name="formId" value="<?= $formId ?>"/> | 
| 6 | 7 | <a name="<?= $formId ?>"></a> | 
| 7 | 8 | <? endif ?> | 
| @@ -17,15 +18,19 @@ discard block | ||
| 17 | 18 | <input required="required" value="<?=isset($document) ? $document->title : '' ?>" type="text" id="title" name="title" placeholder="Title" /> | 
| 18 | 19 | </div> | 
| 19 | 20 | <? endif ?> | 
| 20 | - <?$fieldPrefix='fields';?> | |
| 21 | + <?$fieldPrefix='fields'; | |
| 22 | +} | |
| 23 | +?> | |
| 21 | 24 | <? foreach ($documentType->fields as $field) : ?> | 
| 22 | 25 | <div class="form-element"> | 
| 23 | 26 | <label for="<?=$field->slug?>"><?=$field->title?></label> | 
| 24 | 27 | <? if (isset($document)) : | 
| 25 | 28 | $fieldSlug = $field->slug; | 
| 26 | 29 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; | 
| 27 | - else : | |
| 30 | +					else { | |
| 31 | + : | |
| 28 | 32 | $value = ''; | 
| 33 | + } | |
| 29 | 34 | endif ?> | 
| 30 | 35 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> | 
| 31 | 36 | <ul class="grid-wrapper sortable"> | 
| @@ -135,8 +140,11 @@ discard block | ||
| 135 | 140 | </ul> | 
| 136 | 141 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> | 
| 137 | 142 | <?$static_brick_nr += 1?> | 
| 138 | - <? else : ?> | |
| 139 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> | |
| 143 | +				<? else { | |
| 144 | + : ?> | |
| 145 | + <?$fieldPrefix='bricks[' . $brick->slug . '][fields]'; | |
| 146 | +} | |
| 147 | +?> | |
| 140 | 148 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> | 
| 141 | 149 | <? foreach ($brick->structure->fields as $field) : ?> | 
| 142 | 150 | <div class="form-element"> | 
| @@ -145,8 +153,10 @@ discard block | ||
| 145 | 153 | $brickSlug = $brick->slug; | 
| 146 | 154 | $fieldSlug = $field->slug; | 
| 147 | 155 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; | 
| 148 | - else : | |
| 156 | +						else { | |
| 157 | + : | |
| 149 | 158 | $value = ''; | 
| 159 | + } | |
| 150 | 160 | endif ?> | 
| 151 | 161 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> | 
| 152 | 162 | <ul class="grid-wrapper sortable"> | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | } | 
| 69 | 69 | |
| 70 | 70 | /** | 
| 71 | - * @param $request | |
| 71 | + * @param Request $request | |
| 72 | 72 | * @param CmsComponent $cmsComponent | 
| 73 | 73 | */ | 
| 74 | 74 | private function newRoute($request, $cmsComponent) | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| 86 | - * @param $request | |
| 86 | + * @param Request $request | |
| 87 | 87 | * @param CmsComponent $cmsComponent | 
| 88 | 88 | */ | 
| 89 | 89 | private function deleteRoute($request, $cmsComponent) | 
| @@ -76,7 +76,7 @@ discard block | ||
| 76 | 76 | * @param string $imagePath | 
| 77 | 77 | * @param bool $getExtension | 
| 78 | 78 | * | 
| 79 | - * @return bool|int|string | |
| 79 | + * @return integer | |
| 80 | 80 | */ | 
| 81 | 81 | public function getImageMimeType($imagePath, $getExtension = false) | 
| 82 | 82 |          { | 
| @@ -149,7 +149,7 @@ discard block | ||
| 149 | 149 | } | 
| 150 | 150 | |
| 151 | 151 | /** | 
| 152 | - * @param $pathToBitmapFile | |
| 152 | + * @param string $pathToBitmapFile | |
| 153 | 153 | * | 
| 154 | 154 | * @return string | 
| 155 | 155 | */ | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | } | 
| 166 | 166 | |
| 167 | 167 | /** | 
| 168 | - * @param $header | |
| 168 | + * @param string $header | |
| 169 | 169 | * | 
| 170 | 170 | * @return array | 
| 171 | 171 | */ | 
| @@ -195,14 +195,14 @@ discard block | ||
| 195 | 195 | * Loop through the data in the body of the bitmap | 
| 196 | 196 | * file and calculate each individual pixel based on the | 
| 197 | 197 | * bytes | 
| 198 | - * @param $bodySize | |
| 199 | - * @param $x | |
| 198 | + * @param integer $bodySize | |
| 199 | + * @param integer $x | |
| 200 | 200 | * @param $width | 
| 201 | - * @param $usePadding | |
| 202 | - * @param $y | |
| 201 | + * @param boolean $usePadding | |
| 202 | + * @param integer $y | |
| 203 | 203 | * @param $height | 
| 204 | - * @param $body | |
| 205 | - * @param $image | |
| 204 | + * @param string $body | |
| 205 | + * @param resource $image | |
| 206 | 206 | */ | 
| 207 | 207 | private function loopThroughBodyAndCalculatePixels($bodySize, $x, $width, $usePadding, $y, $height, $body, $image) | 
| 208 | 208 |          { | 
| @@ -10,6 +10,10 @@ discard block | ||
| 10 | 10 |  { | 
| 11 | 11 | protected $filesDir; | 
| 12 | 12 | |
| 13 | + /** | |
| 14 | + * @param \CloudControl\Cms\storage\Repository $repository | |
| 15 | + * @param string $filesDir | |
| 16 | + */ | |
| 13 | 17 | public function __construct($repository, $filesDir) | 
| 14 | 18 |      { | 
| 15 | 19 | parent::__construct($repository); | 
| @@ -102,7 +106,7 @@ discard block | ||
| 102 | 106 | } | 
| 103 | 107 | |
| 104 | 108 | /** | 
| 105 | - * @return mixed | |
| 109 | + * @return string | |
| 106 | 110 | */ | 
| 107 | 111 | public function getFilesDir() | 
| 108 | 112 |      { | 
| @@ -27,7 +27,9 @@ | ||
| 27 | 27 | |
| 28 | 28 | // Define which ratio will be used, depending on which is the smallest side | 
| 29 | 29 | $ratio = min($hRatio, $wRatio); | 
| 30 | - if ($ratio > 1) $ratio = 1; | |
| 30 | +            if ($ratio > 1) { | |
| 31 | + $ratio = 1; | |
| 32 | + } | |
| 31 | 33 | |
| 32 | 34 | // Define sizes | 
| 33 | 35 | $this->_destWidth = floor($originalWidth * $ratio); | 
| @@ -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; |