@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | return $returnFileNames; |
| 47 | 47 | } else { |
| 48 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 48 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * @return string |
| 57 | 57 | * @throws \Exception |
| 58 | 58 | */ |
| 59 | - public function resize($imagePath='', $width='',$height='') |
|
| 59 | + public function resize($imagePath = '', $width = '', $height = '') |
|
| 60 | 60 | { |
| 61 | - $modifier = '-r' . $width . 'x' . $height; |
|
| 62 | - return $this->applyMethod('Resize', $imagePath, $width,$height, $modifier); |
|
| 61 | + $modifier = '-r'.$width.'x'.$height; |
|
| 62 | + return $this->applyMethod('Resize', $imagePath, $width, $height, $modifier); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @return string |
| 70 | 70 | * @throws \Exception |
| 71 | 71 | */ |
| 72 | - public function smartcrop($imagePath='', $width='',$height='') |
|
| 72 | + public function smartcrop($imagePath = '', $width = '', $height = '') |
|
| 73 | 73 | { |
| 74 | - $modifier = '-s' . $width . 'x' . $height; |
|
| 75 | - return $this->applyMethod('SmartCrop', $imagePath, $width,$height, $modifier); |
|
| 74 | + $modifier = '-s'.$width.'x'.$height; |
|
| 75 | + return $this->applyMethod('SmartCrop', $imagePath, $width, $height, $modifier); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @return string |
| 83 | 83 | * @throws \Exception |
| 84 | 84 | */ |
| 85 | - public function boxcrop($imagePath='', $width='',$height='') |
|
| 85 | + public function boxcrop($imagePath = '', $width = '', $height = '') |
|
| 86 | 86 | { |
| 87 | - $modifier = '-b' . $width . 'x' . $height; |
|
| 88 | - return $this->applyMethod('BoxCrop', $imagePath, $width,$height, $modifier); |
|
| 87 | + $modifier = '-b'.$width.'x'.$height; |
|
| 88 | + return $this->applyMethod('BoxCrop', $imagePath, $width, $height, $modifier); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - private function modifyName($imagePath, $modifier='') |
|
| 97 | + private function modifyName($imagePath, $modifier = '') |
|
| 98 | 98 | { |
| 99 | 99 | $filename = basename($imagePath); |
| 100 | 100 | $path = dirname($imagePath); |
@@ -104,30 +104,30 @@ discard block |
||
| 104 | 104 | array_pop($fileParts); |
| 105 | 105 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 106 | 106 | $fileNameWithoutExtension = StringUtil::slugify($fileNameWithoutExtension); |
| 107 | - $filename = $fileNameWithoutExtension . $modifier . '.' . $extension; |
|
| 107 | + $filename = $fileNameWithoutExtension.$modifier.'.'.$extension; |
|
| 108 | 108 | } else { |
| 109 | 109 | $filename = StringUtil::slugify($filename); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (file_exists($path . '/' . $filename)) { |
|
| 112 | + if (file_exists($path.'/'.$filename)) { |
|
| 113 | 113 | $fileParts = explode('.', $filename); |
| 114 | 114 | if (count($fileParts) > 1) { |
| 115 | 115 | $extension = end($fileParts); |
| 116 | 116 | array_pop($fileParts); |
| 117 | 117 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 118 | 118 | $fileNameWithoutExtension .= '-copy'; |
| 119 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 119 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 120 | 120 | } else { |
| 121 | 121 | $filename .= '-copy'; |
| 122 | 122 | } |
| 123 | - return $this->modifyName($path . '/' . $filename); |
|
| 123 | + return $this->modifyName($path.'/'.$filename); |
|
| 124 | 124 | } |
| 125 | - return $path . '/' . $filename; |
|
| 125 | + return $path.'/'.$filename; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | private function applyMethod($method, $imagePath, $width, $height, $modifier) |
| 129 | 129 | { |
| 130 | - $method = 'library\\images\\methods\\' . $method; |
|
| 130 | + $method = 'library\\images\\methods\\'.$method; |
|
| 131 | 131 | $destination = $this->modifyName($imagePath, $modifier); |
| 132 | 132 | if (file_exists($imagePath)) { |
| 133 | 133 | $image = new Image(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $resizedImage->saveImage($destination, $resizedImage->getImageMimeType($imagePath), 80); |
| 142 | 142 | return basename($destination); |
| 143 | 143 | } else { |
| 144 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 144 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 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); |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | public static function humanFileSize($size, $unit = "") |
| 80 | 80 | { |
| 81 | 81 | if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
| 82 | - return number_format($size / (1 << 30), 2) . "GB"; |
|
| 82 | + return number_format($size / (1 << 30), 2)."GB"; |
|
| 83 | 83 | if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
| 84 | - return number_format($size / (1 << 20), 2) . "MB"; |
|
| 84 | + return number_format($size / (1 << 20), 2)."MB"; |
|
| 85 | 85 | if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
| 86 | - return number_format($size / (1 << 10), 2) . "KB"; |
|
| 86 | + return number_format($size / (1 << 10), 2)."KB"; |
|
| 87 | 87 | |
| 88 | - return number_format($size) . " bytes"; |
|
| 88 | + return number_format($size)." bytes"; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if ($d >= 1) { |
| 122 | 122 | $r = round($d); |
| 123 | 123 | |
| 124 | - return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago'; |
|
| 124 | + return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -78,12 +78,15 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | public static function humanFileSize($size, $unit = "") |
| 80 | 80 | { |
| 81 | - if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
| 82 | - return number_format($size / (1 << 30), 2) . "GB"; |
|
| 83 | - if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
| 84 | - return number_format($size / (1 << 20), 2) . "MB"; |
|
| 85 | - if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
| 86 | - return number_format($size / (1 << 10), 2) . "KB"; |
|
| 81 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") { |
|
| 82 | + return number_format($size / (1 << 30), 2) . "GB"; |
|
| 83 | + } |
|
| 84 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") { |
|
| 85 | + return number_format($size / (1 << 20), 2) . "MB"; |
|
| 86 | + } |
|
| 87 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") { |
|
| 88 | + return number_format($size / (1 << 10), 2) . "KB"; |
|
| 89 | + } |
|
| 87 | 90 | |
| 88 | 91 | return number_format($size) . " bytes"; |
| 89 | 92 | } |
@@ -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)? \library\cc\StringUtil::humanFileSize($image->size) : '' ?> |
|
| 21 | + <?=isset($image) ? \library\cc\StringUtil::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 ?> |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | protected function applyFilters($tokens) |
| 47 | 47 | { |
| 48 | 48 | foreach ($this->filters as $filterName) { |
| 49 | - $filterClassName = '\library\search\filters\\' . $filterName; |
|
| 49 | + $filterClassName = '\library\search\filters\\'.$filterName; |
|
| 50 | 50 | $filter = new $filterClassName($tokens); |
| 51 | 51 | $tokens = $filter->getFilterResults(); |
| 52 | 52 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | foreach ($documentTermCount as $field => $countArray) { |
| 67 | 67 | $quotedField = $db->quote($field); |
| 68 | 68 | foreach ($countArray as $term => $count) { |
| 69 | - $values[] = $quotedDocumentPath . ', ' . $db->quote($term) . ', ' . $db->quote($count) . ', ' . $quotedField; |
|
| 69 | + $values[] = $quotedDocumentPath.', '.$db->quote($term).', '.$db->quote($count).', '.$quotedField; |
|
| 70 | 70 | $i += 1; |
| 71 | 71 | if ($i >= Indexer::SQLITE_MAX_COMPOUND_SELECT) { |
| 72 | 72 | $this->executeStoreDocumentTermCount($values, $sql, $db); |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function executeStoreDocumentTermCount($values, $sql, $db) |
| 92 | 92 | { |
| 93 | - $sql .= '(' . implode('),' . PHP_EOL . '(', $values) . ');'; |
|
| 93 | + $sql .= '('.implode('),'.PHP_EOL.'(', $values).');'; |
|
| 94 | 94 | |
| 95 | 95 | $stmt = $db->prepare($sql); |
| 96 | 96 | if ($stmt === false || !$stmt->execute()) { |
| 97 | 97 | $errorInfo = $db->errorInfo(); |
| 98 | 98 | $errorMsg = $errorInfo[2]; |
| 99 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
| 99 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -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"> |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#' . $formId : '' ?>"> |
|
| 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 | 4 | <? else : ?> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <input required="required" value="<?=isset($document) ? $document->title : '' ?>" type="text" id="title" name="title" placeholder="Title" /> |
| 18 | 18 | </div> |
| 19 | 19 | <? endif ?> |
| 20 | - <?$fieldPrefix='fields';?> |
|
| 20 | + <?$fieldPrefix = 'fields'; ?> |
|
| 21 | 21 | <? foreach ($documentType->fields as $field) : ?> |
| 22 | 22 | <div class="form-element"> |
| 23 | 23 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 42 | 42 | <div class="form-element"> |
| 43 | 43 | <? endif ?> |
| 44 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 44 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 45 | 45 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 46 | 46 | |
| 47 | 47 | </div> |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | <li class="grid-container"> |
| 64 | 64 | <div class="grid-box-10"> |
| 65 | 65 | <div class="grid-inner form-element"> |
| 66 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 66 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 67 | 67 | </div> |
| 68 | 68 | </div> |
| 69 | 69 | <div class="grid-box-2"> |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | </div> |
| 74 | 74 | </div> |
| 75 | 75 | </li> |
| 76 | - <?$value='';?> |
|
| 76 | + <?$value = ''; ?> |
|
| 77 | 77 | <? endforeach ?> |
| 78 | 78 | <? endif ?> |
| 79 | 79 | </ul> |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | <a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a> |
| 91 | 91 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 92 | 92 | <div class="form-element"> |
| 93 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 93 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 94 | 94 | </div> |
| 95 | 95 | </li> |
| 96 | - <?$value='';?> |
|
| 96 | + <?$value = ''; ?> |
|
| 97 | 97 | <? endforeach ?> |
| 98 | 98 | <? endif ?> |
| 99 | 99 | </div> |
@@ -102,17 +102,17 @@ discard block |
||
| 102 | 102 | <a class="btn js-addrtemultiple">+</a> |
| 103 | 103 | <? endif ?> |
| 104 | 104 | </div> |
| 105 | - <?$value='';?> |
|
| 105 | + <?$value = ''; ?> |
|
| 106 | 106 | <? endforeach ?> |
| 107 | 107 | <hr /> |
| 108 | - <? $static_brick_nr = 0;?> |
|
| 108 | + <? $static_brick_nr = 0; ?> |
|
| 109 | 109 | <? foreach ($documentType->bricks as $brick) : ?> |
| 110 | 110 | <div class="brick"> |
| 111 | 111 | <label><?=$brick->title?></label> |
| 112 | 112 | <? if ($brick->multiple == 'true') : ?> |
| 113 | 113 | <input type="hidden" value="<?=$brick->brickSlug?>"/> |
| 114 | 114 | <input type="hidden" value="<?=$brick->slug?>"/> |
| 115 | - <?$myBrickSlug=$brick->slug;?> |
|
| 115 | + <?$myBrickSlug = $brick->slug; ?> |
|
| 116 | 116 | <ul id="newBrickDropzone_<?=$static_brick_nr?>" class="dynamicBricks sortable"> |
| 117 | 117 | <? if (isset($document)) : ?> |
| 118 | 118 | <? foreach ($document->bricks as $currentBrickSlug => $brickArray) : ?> |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | <li class="brick form-element"> |
| 127 | 127 | |
| 128 | 128 | <?$static = true; ?> |
| 129 | - <?include(__DIR__ . '/brick.php')?> |
|
| 129 | + <?include(__DIR__.'/brick.php')?> |
|
| 130 | 130 | </li> |
| 131 | 131 | <? endif ?> |
| 132 | 132 | <? endforeach ?> |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
| 137 | 137 | <?$static_brick_nr += 1?> |
| 138 | 138 | <? else : ?> |
| 139 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
| 139 | + <?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?> |
|
| 140 | 140 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
| 141 | 141 | <? foreach ($brick->structure->fields as $field) : ?> |
| 142 | 142 | <div class="form-element"> |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 163 | 163 | <div class="form-element"> |
| 164 | 164 | <? endif ?> |
| 165 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 165 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 166 | 166 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 167 | 167 | |
| 168 | 168 | </div> |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | <li class="grid-container"> |
| 186 | 186 | <div class="grid-box-10"> |
| 187 | 187 | <div class="grid-inner form-element"> |
| 188 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 188 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 189 | 189 | </div> |
| 190 | 190 | </div> |
| 191 | 191 | <div class="grid-box-2"> |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | </div> |
| 196 | 196 | </div> |
| 197 | 197 | </li> |
| 198 | - <?$value='';?> |
|
| 198 | + <?$value = ''; ?> |
|
| 199 | 199 | <? endforeach ?> |
| 200 | 200 | <? endif ?> |
| 201 | 201 | </ul> |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | <a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a> |
| 214 | 214 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
| 215 | 215 | <div class="form-element"> |
| 216 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
| 216 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
| 217 | 217 | </div> |
| 218 | 218 | </li> |
| 219 | - <?$value='';?> |
|
| 219 | + <?$value = ''; ?> |
|
| 220 | 220 | <? endforeach ?> |
| 221 | 221 | <? endif ?> |
| 222 | 222 | </div> |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | <a class="btn js-addrtemultiple">+</a> |
| 226 | 226 | <? endif ?> |
| 227 | 227 | </div> |
| 228 | - <?$value='';?> |
|
| 228 | + <?$value = ''; ?> |
|
| 229 | 229 | <? endforeach ?> |
| 230 | 230 | <? endif ?> |
| 231 | 231 | </div> |
| 232 | 232 | <hr /> |
| 233 | - <? endforeach;?> |
|
| 233 | + <? endforeach; ?> |
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | <li class="brick form-element"> |
| 254 | 254 | <label><?=$brick->title?></label> |
| 255 | 255 | <?$static = false; ?> |
| 256 | - <?include(__DIR__ . '/brick.php')?> |
|
| 256 | + <?include(__DIR__.'/brick.php')?> |
|
| 257 | 257 | </li> |
| 258 | 258 | <? endforeach ?> |
| 259 | 259 | <? endif ?> |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function getDocuments($state = 'published') |
| 22 | 22 | { |
| 23 | 23 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
| 24 | - throw new \Exception('Unsupported document state: ' . $state); |
|
| 24 | + throw new \Exception('Unsupported document state: '.$state); |
|
| 25 | 25 | } |
| 26 | 26 | return $this->repository->getDocuments($state); |
| 27 | 27 | } |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | public function getDocumentBySlug($slug, $state = 'published') |
| 51 | 51 | { |
| 52 | 52 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
| 53 | - throw new \Exception('Unsupported document state: ' . $state); |
|
| 53 | + throw new \Exception('Unsupported document state: '.$state); |
|
| 54 | 54 | } |
| 55 | - $path = '/' . $slug; |
|
| 55 | + $path = '/'.$slug; |
|
| 56 | 56 | |
| 57 | 57 | return $this->repository->getDocumentByPath($path, $state); |
| 58 | 58 | } |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | public function saveDocument($postValues, $state = 'unpublished') |
| 67 | 67 | { |
| 68 | 68 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
| 69 | - throw new \Exception('Unsupported document state: ' . $state); |
|
| 69 | + throw new \Exception('Unsupported document state: '.$state); |
|
| 70 | 70 | } |
| 71 | - $oldPath = '/' . $postValues['path']; |
|
| 71 | + $oldPath = '/'.$postValues['path']; |
|
| 72 | 72 | |
| 73 | 73 | $container = $this->getDocumentContainerByPath($oldPath); |
| 74 | 74 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository)); |
| 75 | 75 | if ($container->path === '/') { |
| 76 | - $newPath = $container->path . $documentObject->slug; |
|
| 76 | + $newPath = $container->path.$documentObject->slug; |
|
| 77 | 77 | } else { |
| 78 | - $newPath = $container->path . '/' . $documentObject->slug; |
|
| 78 | + $newPath = $container->path.'/'.$documentObject->slug; |
|
| 79 | 79 | } |
| 80 | 80 | $documentObject->path = $newPath; |
| 81 | 81 | $this->repository->saveDocument($documentObject, $state); |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository)); |
| 91 | 91 | if ($postValues['path'] === '/') { |
| 92 | - $documentObject->path = $postValues['path'] . $documentObject->slug; |
|
| 92 | + $documentObject->path = $postValues['path'].$documentObject->slug; |
|
| 93 | 93 | } else { |
| 94 | - $documentObject->path = $postValues['path'] . '/' . $documentObject->slug; |
|
| 94 | + $documentObject->path = $postValues['path'].'/'.$documentObject->slug; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $this->repository->saveDocument($documentObject, $state); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function deleteDocumentBySlug($slug) |
| 104 | 104 | { |
| 105 | - $path = '/' . $slug; |
|
| 105 | + $path = '/'.$slug; |
|
| 106 | 106 | $this->repository->deleteDocumentByPath($path); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | private function config() |
| 84 | 84 | { |
| 85 | - $storagePath = __DIR__ . '/../../' . $this->storageDir; |
|
| 85 | + $storagePath = __DIR__.'/../../'.$this->storageDir; |
|
| 86 | 86 | if (realpath($storagePath) === false) { |
| 87 | 87 | initFramework(); |
| 88 | 88 | if (Repository::create($storagePath)) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $repository->init(); |
| 91 | 91 | $this->repository = $repository; |
| 92 | 92 | } else { |
| 93 | - throw new \Exception('Could not create repository directory: ' . $storagePath); |
|
| 93 | + throw new \Exception('Could not create repository directory: '.$storagePath); |
|
| 94 | 94 | } |
| 95 | 95 | } else { |
| 96 | 96 | $this->repository = new Repository($storagePath); |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues); |
| 135 | 135 | if ($postValues['path'] === '/') { |
| 136 | - $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug; |
|
| 136 | + $documentFolderObject->path = $postValues['path'].$documentFolderObject->slug; |
|
| 137 | 137 | } else { |
| 138 | - $documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug; |
|
| 138 | + $documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug; |
|
| 139 | 139 | } |
| 140 | 140 | $this->repository->saveDocument($documentFolderObject, 'published'); |
| 141 | 141 | $this->repository->saveDocument($documentFolderObject, 'unpublished'); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function deleteDocumentFolderBySlug($slug) |
| 152 | 152 | { |
| 153 | - $path = '/' . $slug; |
|
| 153 | + $path = '/'.$slug; |
|
| 154 | 154 | $this->repository->deleteDocumentByPath($path, 'published'); |
| 155 | 155 | $this->repository->deleteDocumentByPath($path, 'unpublished'); |
| 156 | 156 | $this->repository->cleanPublishedDeletedDocuments(); |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | public function publishDocumentBySlug($slug) |
| 160 | 160 | { |
| 161 | - $path = '/' . $slug; |
|
| 161 | + $path = '/'.$slug; |
|
| 162 | 162 | $this->repository->publishDocumentByPath($path); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function unpublishDocumentBySlug($slug) |
| 166 | 166 | { |
| 167 | - $path = '/' . $slug; |
|
| 167 | + $path = '/'.$slug; |
|
| 168 | 168 | $this->repository->unpublishDocumentByPath($path); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function getDocumentFolderBySlug($slug) |
| 180 | 180 | { |
| 181 | - $path = '/' . $slug; |
|
| 181 | + $path = '/'.$slug; |
|
| 182 | 182 | |
| 183 | 183 | return $this->repository->getDocumentByPath($path); |
| 184 | 184 | } |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace library\storage { |
| 3 | 3 | |
| 4 | - use library\storage\factories\DocumentFolderFactory; |
|
| 5 | - use library\storage\storage\ApplicationComponentsStorage; |
|
| 6 | - use library\storage\storage\BricksStorage; |
|
| 7 | - use library\storage\storage\DocumentStorage; |
|
| 8 | - use library\storage\storage\DocumentTypesStorage; |
|
| 9 | - use library\storage\storage\FilesStorage; |
|
| 10 | - use library\storage\storage\ImageSetStorage; |
|
| 11 | - use library\storage\storage\ImagesStorage; |
|
| 12 | - use library\storage\storage\RedirectsStorage; |
|
| 13 | - use library\storage\storage\SitemapStorage; |
|
| 14 | - use library\storage\storage\UsersStorage; |
|
| 15 | - use library\storage\storage\ValuelistsStorage; |
|
| 4 | + use library\storage\factories\DocumentFolderFactory; |
|
| 5 | + use library\storage\storage\ApplicationComponentsStorage; |
|
| 6 | + use library\storage\storage\BricksStorage; |
|
| 7 | + use library\storage\storage\DocumentStorage; |
|
| 8 | + use library\storage\storage\DocumentTypesStorage; |
|
| 9 | + use library\storage\storage\FilesStorage; |
|
| 10 | + use library\storage\storage\ImageSetStorage; |
|
| 11 | + use library\storage\storage\ImagesStorage; |
|
| 12 | + use library\storage\storage\RedirectsStorage; |
|
| 13 | + use library\storage\storage\SitemapStorage; |
|
| 14 | + use library\storage\storage\UsersStorage; |
|
| 15 | + use library\storage\storage\ValuelistsStorage; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Class JsonStorage |
| 19 | - * @package library\storage |
|
| 19 | + * @package library\storage |
|
| 20 | 20 | */ |
| 21 | 21 | class Storage |
| 22 | 22 | { |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | * @var DocumentStorage |
| 62 | 62 | */ |
| 63 | 63 | protected $documents; |
| 64 | - /** |
|
| 65 | - * @var RedirectsStorage |
|
| 66 | - */ |
|
| 67 | - protected $redirects; |
|
| 64 | + /** |
|
| 65 | + * @var RedirectsStorage |
|
| 66 | + */ |
|
| 67 | + protected $redirects; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @var String |
@@ -325,16 +325,16 @@ discard block |
||
| 325 | 325 | return $this->valuelists; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - /** |
|
| 329 | - * @return RedirectsStorage |
|
| 330 | - */ |
|
| 331 | - public function getRedirects() |
|
| 332 | - { |
|
| 333 | - if (!$this->redirects instanceof RedirectsStorage) { |
|
| 334 | - $this->redirects = new RedirectsStorage($this->repository); |
|
| 335 | - } |
|
| 336 | - return $this->redirects; |
|
| 337 | - } |
|
| 328 | + /** |
|
| 329 | + * @return RedirectsStorage |
|
| 330 | + */ |
|
| 331 | + public function getRedirects() |
|
| 332 | + { |
|
| 333 | + if (!$this->redirects instanceof RedirectsStorage) { |
|
| 334 | + $this->redirects = new RedirectsStorage($this->repository); |
|
| 335 | + } |
|
| 336 | + return $this->redirects; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | \ No newline at end of file |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->storage->getDocuments()->cleanPublishedDeletedDocuments(); |
| 61 | 61 | $this->addLog('Retrieving documents to be indexed.'); |
| 62 | 62 | $documents = $this->storage->getDocuments()->getPublishedDocumentsNoFolders(); |
| 63 | - $this->addLog('Start Document Term Count for ' . count($documents) . ' documents'); |
|
| 63 | + $this->addLog('Start Document Term Count for '.count($documents).' documents'); |
|
| 64 | 64 | $this->createDocumentTermCount($documents); |
| 65 | 65 | $this->addLog('Start Document Term Frequency.'); |
| 66 | 66 | $this->createDocumentTermFrequency(); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | private function addLog($string) |
| 162 | 162 | { |
| 163 | 163 | $currentTime = round(microtime(true) * 1000); |
| 164 | - $this->log .= date('d-m-Y H:i:s - ') . str_pad($string, 50, " ", STR_PAD_RIGHT) . "\t" . ($currentTime - $this->lastLog) . 'ms since last log. ' . "\t" . ($currentTime - $this->loggingStart) . 'ms since start.' . PHP_EOL; |
|
| 164 | + $this->log .= date('d-m-Y H:i:s - ').str_pad($string, 50, " ", STR_PAD_RIGHT)."\t".($currentTime - $this->lastLog).'ms since last log. '."\t".($currentTime - $this->loggingStart).'ms since start.'.PHP_EOL; |
|
| 165 | 165 | $this->lastLog = round(microtime(true) * 1000); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | protected function getSearchDbHandle() |
| 174 | 174 | { |
| 175 | 175 | if ($this->searchDbHandle === null) { |
| 176 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR; |
|
| 177 | - $this->searchDbHandle = new \PDO('sqlite:' . $path . self::SEARCH_TEMP_DB); |
|
| 176 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR; |
|
| 177 | + $this->searchDbHandle = new \PDO('sqlite:'.$path.self::SEARCH_TEMP_DB); |
|
| 178 | 178 | } |
| 179 | 179 | return $this->searchDbHandle; |
| 180 | 180 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function replaceOldIndex() |
| 186 | 186 | { |
| 187 | 187 | $this->searchDbHandle = null; |
| 188 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $this->storageDir . DIRECTORY_SEPARATOR; |
|
| 189 | - rename($path . self::SEARCH_TEMP_DB, $path . 'search.db'); |
|
| 188 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$this->storageDir.DIRECTORY_SEPARATOR; |
|
| 189 | + rename($path.self::SEARCH_TEMP_DB, $path.'search.db'); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | \ No newline at end of file |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | private function showJson($obj, $httpHeader = 'HTTP/1.0 200 OK') { |
| 75 | - header($_SERVER['SERVER_PROTOCOL'] . $httpHeader, true); |
|
| 75 | + header($_SERVER['SERVER_PROTOCOL'].$httpHeader, true); |
|
| 76 | 76 | header('Content-type: application/json'); |
| 77 | 77 | die(json_encode($obj)); |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | private function stepRouting($step, $cmsComponent, $indexer) |
| 86 | 86 | { |
| 87 | - switch($step) { |
|
| 87 | + switch ($step) { |
|
| 88 | 88 | case 'resetIndex': $indexer->resetIndex(); break; |
| 89 | 89 | case 'cleanPublishedDeletedDocuments': $cmsComponent->storage->getDocuments()->cleanPublishedDeletedDocuments(); break; |
| 90 | 90 | case 'createDocumentTermCount': |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | case 'createTermFieldLengthNorm': $indexer->createTermFieldLengthNorm(); break; |
| 96 | 96 | case 'createInverseDocumentFrequency': $indexer->createInverseDocumentFrequency(); break; |
| 97 | 97 | case 'replaceOldIndex': $indexer->replaceOldIndex(); break; |
| 98 | - default : $this->showJson('Invalid step: ' . $step . '.', 'HTTP/1.0 500 Internal Server Error'); break; |
|
| 98 | + default : $this->showJson('Invalid step: '.$step.'.', 'HTTP/1.0 500 Internal Server Error'); break; |
|
| 99 | 99 | } |
| 100 | 100 | $this->showJson('done'); |
| 101 | 101 | } |