@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $cacheExists = $this->cache !== false; |
| 102 | 102 | $cacheExpired = false; |
| 103 | 103 | if ($cacheExists) { |
| 104 | - $cacheCreationStamp = (int)$this->cache->creationStamp; |
|
| 104 | + $cacheCreationStamp = (int) $this->cache->creationStamp; |
|
| 105 | 105 | $currentTime = time(); |
| 106 | 106 | $cacheAge = $currentTime - $cacheCreationStamp; |
| 107 | 107 | $maxAgeInterval = new \DateInterval($this->maxAge); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | private function setHeadersFromCache() |
| 129 | 129 | { |
| 130 | 130 | if (isset($this->cache->headers)) { |
| 131 | - $headers = (array)json_decode($this->cache->headers); |
|
| 131 | + $headers = (array) json_decode($this->cache->headers); |
|
| 132 | 132 | /** @var array $headers */ |
| 133 | 133 | foreach ($headers as $headerName => $headerContent) { |
| 134 | 134 | ResponseHeaders::add($headerName, $headerContent); |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | $g = hexdec($bitmapBodyModel->body[$iPos + 2] . $bitmapBodyModel->body[$iPos + 3]); |
| 109 | 109 | $b = hexdec($bitmapBodyModel->body[$iPos] . $bitmapBodyModel->body[$iPos + 1]); |
| 110 | 110 | // Calculate and draw the pixel |
| 111 | - $color = imagecolorallocate($bitmapBodyModel->image, (int)$r, (int)$g, (int)$b); |
|
| 111 | + $color = imagecolorallocate($bitmapBodyModel->image, (int) $r, (int) $g, (int) $b); |
|
| 112 | 112 | imagesetpixel($bitmapBodyModel->image, $bitmapBodyModel->x, $bitmapBodyModel->height - $bitmapBodyModel->y, $color); |
| 113 | 113 | // Raise the horizontal position |
| 114 | 114 | $bitmapBodyModel->x++; |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
| 112 | - return imagepng($imageResource, $path, ((int)($quality / 10) - 1)); |
|
| 112 | + return imagepng($imageResource, $path, ((int) ($quality / 10) - 1)); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | throw new \RuntimeException('Not a valid mimetypeconstant given see function documentation'); |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | if (!isset($_GET['unsanitized'])) { |
| 67 | 67 | $search = array( |
| 68 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
| 69 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
| 70 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
| 68 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
| 69 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
| 70 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
| 71 | 71 | '/<!--(.|\s)*?-->/' // Remove HTML comments |
| 72 | 72 | ); |
| 73 | 73 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public static function utf8Convert($array) |
| 96 | 96 | { |
| 97 | - array_walk_recursive($array, function (&$item) { |
|
| 97 | + array_walk_recursive($array, function(&$item) { |
|
| 98 | 98 | if (!mb_detect_encoding($item, 'utf-8', true)) { |
| 99 | 99 | $item = utf8_encode($item); |
| 100 | 100 | } |
@@ -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); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $errorMsg = $errorInfo[2]; |
| 90 | 90 | throw new \RuntimeException('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
| 91 | 91 | } |
| 92 | - return (int)$result; |
|
| 92 | + return (int) $result; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $resultObj = new SearchResult(); |
| 189 | 189 | $resultObj->documentPath = $result->documentPath; |
| 190 | 190 | $resultObj->matchingTokens = array($token); |
| 191 | - $resultObj->score = (float)$result->score; |
|
| 191 | + $resultObj->score = (float) $result->score; |
|
| 192 | 192 | $resultObj->setStorage($this->storage); |
| 193 | 193 | $finalResults[$result->documentPath] = $resultObj; |
| 194 | 194 | } |
@@ -46,11 +46,11 @@ |
||
| 46 | 46 | <?php renderDocumentBreadcrumb($path) ?> |
| 47 | 47 | </tr> |
| 48 | 48 | <?php |
| 49 | - $parentPath = substr($path, 0, strrpos( $path, '/')); |
|
| 50 | - if ($path !== '/' && substr_count($path, '/') === 1) { |
|
| 51 | - $parentPath = '/'; |
|
| 52 | - } |
|
| 53 | - if (!empty($parentPath)) : ?> |
|
| 49 | + $parentPath = substr($path, 0, strrpos( $path, '/')); |
|
| 50 | + if ($path !== '/' && substr_count($path, '/') === 1) { |
|
| 51 | + $parentPath = '/'; |
|
| 52 | + } |
|
| 53 | + if (!empty($parentPath)) : ?> |
|
| 54 | 54 | <tr> |
| 55 | 55 | <td class="icon" title="folder"> |
| 56 | 56 | <i class="fa fa-folder-o"></i> |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | <?php renderDocumentBreadcrumb($path) ?> |
| 47 | 47 | </tr> |
| 48 | 48 | <?php |
| 49 | - $parentPath = substr($path, 0, strrpos( $path, '/')); |
|
| 49 | + $parentPath = substr($path, 0, strrpos($path, '/')); |
|
| 50 | 50 | if ($path !== '/' && substr_count($path, '/') === 1) { |
| 51 | 51 | $parentPath = '/'; |
| 52 | 52 | } |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | Search index is no longer in sync with documents. |
| 21 | 21 | <a href="<?= $request::$subfolders ?><?= $cmsPrefix ?>/search/update-index?returnUrl=<?= urlencode($request::$subfolders . $cmsPrefix . '/documents') ?>" title="Update Index">Update Index</a> |
| 22 | 22 | </div> |
| 23 | - <?php else : ?> |
|
| 23 | + <?php else { |
|
| 24 | + : ?> |
|
| 24 | 25 | <div class="message valid"> |
| 25 | 26 | <i class="fa fa-check"></i> |
| 26 | 27 | Search index is in sync with documents. |
@@ -47,6 +48,7 @@ discard block |
||
| 47 | 48 | </tr> |
| 48 | 49 | <?php |
| 49 | 50 | $parentPath = substr($path, 0, strrpos( $path, '/')); |
| 51 | +} |
|
| 50 | 52 | if ($path !== '/' && substr_count($path, '/') === 1) { |
| 51 | 53 | $parentPath = '/'; |
| 52 | 54 | } |
@@ -35,17 +35,17 @@ |
||
| 35 | 35 | <tr> |
| 36 | 36 | <th>Created</th> |
| 37 | 37 | <td title="<?= date('d-m-Y H:i:s', |
| 38 | - $document->creationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->creationDate) ?></td> |
|
| 38 | + $document->creationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->creationDate) ?></td> |
|
| 39 | 39 | <th>Last Modified</th> |
| 40 | 40 | <td title="<?= date('d-m-Y H:i:s', |
| 41 | - $document->lastModificationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->lastModificationDate) ?></td> |
|
| 41 | + $document->lastModificationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->lastModificationDate) ?></td> |
|
| 42 | 42 | </tr> |
| 43 | 43 | <tr> |
| 44 | 44 | <td colspan="2"> </td> |
| 45 | 45 | <th>Published</th> |
| 46 | 46 | <?php if ($document->state === 'published') : ?> |
| 47 | 47 | <td title="<?= date('d-m-Y H:i:s', |
| 48 | - $document->publicationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->publicationDate) ?></td> |
|
| 48 | + $document->publicationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->publicationDate) ?></td> |
|
| 49 | 49 | <?php else : ?> |
| 50 | 50 | <td>Not yet</td> |
| 51 | 51 | <?php endif ?> |
@@ -41,7 +41,8 @@ discard block |
||
| 41 | 41 | <?php if ($document->state === 'published') : ?> |
| 42 | 42 | <td title="<?= date('d-m-Y H:i:s', |
| 43 | 43 | $document->publicationDate) ?>"><?= \CloudControl\Cms\util\StringUtil::timeElapsedString($document->publicationDate) ?></td> |
| 44 | - <?php else : ?> |
|
| 44 | + <?php else { |
|
| 45 | + : ?> |
|
| 45 | 46 | <td>Not yet</td> |
| 46 | 47 | <?php endif ?> |
| 47 | 48 | </tr> |
@@ -96,6 +97,7 @@ discard block |
||
| 96 | 97 | function getDocumentSlug($path, $document) { |
| 97 | 98 | return substr($path, 1) . ($path === '/' ? '' : '/') . $document->slug; |
| 98 | 99 | } |
| 100 | +} |
|
| 99 | 101 | |
| 100 | 102 | function getEditDocumentLink($request, $cmsPrefix, $path, $document) { |
| 101 | 103 | return $request::$subfolders . $cmsPrefix . '/documents/edit-document?slug=' . getDocumentSlug($path, $document); |