@@ -6,124 +6,124 @@ |
||
| 6 | 6 | |
| 7 | 7 | class LanguageComponent implements Component |
| 8 | 8 | { |
| 9 | - protected $request; |
|
| 10 | - protected $parameters; |
|
| 11 | - |
|
| 12 | - protected $defaultLanguage = 'en'; |
|
| 13 | - protected $acceptedLanguages = null; |
|
| 14 | - protected $languageParameterName = 'language'; |
|
| 15 | - protected $forceRedirect = false; |
|
| 16 | - protected $sessionValues; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Component constructor. |
|
| 20 | - * |
|
| 21 | - * @param $template |
|
| 22 | - * @param Request $request |
|
| 23 | - * @param $parameters |
|
| 24 | - * @param $matchedSitemapItem |
|
| 25 | - */ |
|
| 26 | - public function __construct($template, Request $request, $parameters, $matchedSitemapItem) |
|
| 27 | - { |
|
| 28 | - $this->parameters = (array) $parameters; |
|
| 29 | - $this->checkParameters(); |
|
| 30 | - |
|
| 31 | - $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); |
|
| 32 | - $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; |
|
| 33 | - |
|
| 34 | - $this->checkLanguageSwitch($request); |
|
| 35 | - |
|
| 36 | - if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { |
|
| 37 | - $this->detectLanguage($lang, $request); |
|
| 38 | - } else { |
|
| 39 | - if ($this->forceRedirect === true) { |
|
| 40 | - $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Checks to see if any parameters are given from the configuration in the CMS |
|
| 49 | - */ |
|
| 50 | - private function checkParameters() |
|
| 51 | - { |
|
| 52 | - if (isset($this->parameters['defaultLanguage'])) { |
|
| 53 | - $this->defaultLanguage = $this->parameters['defaultLanguage']; |
|
| 54 | - unset($this->parameters['defaultLanguage']); |
|
| 55 | - } |
|
| 56 | - if (isset($this->parameters['acceptedLanguages'])) { |
|
| 57 | - $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); |
|
| 58 | - unset($this->parameters['acceptedLanguages']); |
|
| 59 | - } |
|
| 60 | - if (isset($this->parameters['languageParameterName'])) { |
|
| 61 | - $this->languageParameterName = $this->parameters['languageParameterName']; |
|
| 62 | - unset($this->parameters['languageParameterName']); |
|
| 63 | - } |
|
| 64 | - if (isset($this->parameters['forceRedirect'])) { |
|
| 65 | - $this->forceRedirect = (bool) $this->parameters['forceRedirect']; |
|
| 66 | - unset($this->parameters['forceRedirect']); |
|
| 67 | - } |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @return array |
|
| 72 | - */ |
|
| 73 | - public function getParameters() |
|
| 74 | - { |
|
| 75 | - return $this->parameters; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Check if the found language is allowed and |
|
| 81 | - * if an action is to be taken. |
|
| 82 | - * |
|
| 83 | - * @param $lang |
|
| 84 | - * @param $request |
|
| 85 | - */ |
|
| 86 | - private function detectLanguage($lang, $request) |
|
| 87 | - { |
|
| 88 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; |
|
| 89 | - |
|
| 90 | - if ($this->acceptedLanguages === null) { |
|
| 91 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
| 92 | - } else if (in_array($lang, $this->acceptedLanguages)) { |
|
| 93 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
| 94 | - } else { |
|
| 95 | - $lang = $this->defaultLanguage; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - $this->sessionValues = $_SESSION['LanguageComponent']; |
|
| 99 | - |
|
| 100 | - if ($this->forceRedirect === true) { |
|
| 101 | - if (substr($request::$relativeUri, 0, 2) !== $lang ) { |
|
| 102 | - if ($lang !== $this->defaultLanguage) { |
|
| 103 | - header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); |
|
| 104 | - exit; |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Detect if the language is switched manually |
|
| 112 | - * |
|
| 113 | - * @param $request |
|
| 114 | - */ |
|
| 115 | - private function checkLanguageSwitch($request) |
|
| 116 | - { |
|
| 117 | - if (isset($request::$get['langSwitch'])) { |
|
| 118 | - $this->forceRedirect = true; |
|
| 119 | - $this->detectLanguage($request::$get['langSwitch'], $request); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /* |
|
| 9 | + protected $request; |
|
| 10 | + protected $parameters; |
|
| 11 | + |
|
| 12 | + protected $defaultLanguage = 'en'; |
|
| 13 | + protected $acceptedLanguages = null; |
|
| 14 | + protected $languageParameterName = 'language'; |
|
| 15 | + protected $forceRedirect = false; |
|
| 16 | + protected $sessionValues; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Component constructor. |
|
| 20 | + * |
|
| 21 | + * @param $template |
|
| 22 | + * @param Request $request |
|
| 23 | + * @param $parameters |
|
| 24 | + * @param $matchedSitemapItem |
|
| 25 | + */ |
|
| 26 | + public function __construct($template, Request $request, $parameters, $matchedSitemapItem) |
|
| 27 | + { |
|
| 28 | + $this->parameters = (array) $parameters; |
|
| 29 | + $this->checkParameters(); |
|
| 30 | + |
|
| 31 | + $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); |
|
| 32 | + $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; |
|
| 33 | + |
|
| 34 | + $this->checkLanguageSwitch($request); |
|
| 35 | + |
|
| 36 | + if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { |
|
| 37 | + $this->detectLanguage($lang, $request); |
|
| 38 | + } else { |
|
| 39 | + if ($this->forceRedirect === true) { |
|
| 40 | + $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Checks to see if any parameters are given from the configuration in the CMS |
|
| 49 | + */ |
|
| 50 | + private function checkParameters() |
|
| 51 | + { |
|
| 52 | + if (isset($this->parameters['defaultLanguage'])) { |
|
| 53 | + $this->defaultLanguage = $this->parameters['defaultLanguage']; |
|
| 54 | + unset($this->parameters['defaultLanguage']); |
|
| 55 | + } |
|
| 56 | + if (isset($this->parameters['acceptedLanguages'])) { |
|
| 57 | + $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); |
|
| 58 | + unset($this->parameters['acceptedLanguages']); |
|
| 59 | + } |
|
| 60 | + if (isset($this->parameters['languageParameterName'])) { |
|
| 61 | + $this->languageParameterName = $this->parameters['languageParameterName']; |
|
| 62 | + unset($this->parameters['languageParameterName']); |
|
| 63 | + } |
|
| 64 | + if (isset($this->parameters['forceRedirect'])) { |
|
| 65 | + $this->forceRedirect = (bool) $this->parameters['forceRedirect']; |
|
| 66 | + unset($this->parameters['forceRedirect']); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @return array |
|
| 72 | + */ |
|
| 73 | + public function getParameters() |
|
| 74 | + { |
|
| 75 | + return $this->parameters; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Check if the found language is allowed and |
|
| 81 | + * if an action is to be taken. |
|
| 82 | + * |
|
| 83 | + * @param $lang |
|
| 84 | + * @param $request |
|
| 85 | + */ |
|
| 86 | + private function detectLanguage($lang, $request) |
|
| 87 | + { |
|
| 88 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; |
|
| 89 | + |
|
| 90 | + if ($this->acceptedLanguages === null) { |
|
| 91 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
| 92 | + } else if (in_array($lang, $this->acceptedLanguages)) { |
|
| 93 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
| 94 | + } else { |
|
| 95 | + $lang = $this->defaultLanguage; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + $this->sessionValues = $_SESSION['LanguageComponent']; |
|
| 99 | + |
|
| 100 | + if ($this->forceRedirect === true) { |
|
| 101 | + if (substr($request::$relativeUri, 0, 2) !== $lang ) { |
|
| 102 | + if ($lang !== $this->defaultLanguage) { |
|
| 103 | + header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); |
|
| 104 | + exit; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Detect if the language is switched manually |
|
| 112 | + * |
|
| 113 | + * @param $request |
|
| 114 | + */ |
|
| 115 | + private function checkLanguageSwitch($request) |
|
| 116 | + { |
|
| 117 | + if (isset($request::$get['langSwitch'])) { |
|
| 118 | + $this->forceRedirect = true; |
|
| 119 | + $this->detectLanguage($request::$get['langSwitch'], $request); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /* |
|
| 124 | 124 | * These functions are required by the interface, but not for the functionality |
| 125 | 125 | */ |
| 126 | - public function run(JsonStorage $storage) {} |
|
| 127 | - public function render() {} |
|
| 128 | - public function get() {} |
|
| 126 | + public function run(JsonStorage $storage) {} |
|
| 127 | + public function render() {} |
|
| 128 | + public function get() {} |
|
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class StopWordsFilter implements Filter |
| 13 | 13 | { |
| 14 | - protected $tokens; |
|
| 15 | - protected $stopWords = array(); |
|
| 14 | + protected $tokens; |
|
| 15 | + protected $stopWords = array(); |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * StopWordsFilter constructor. |
|
| 19 | - * @param array $tokens |
|
| 20 | - */ |
|
| 21 | - public function __construct($tokens) |
|
| 22 | - { |
|
| 23 | - $this->tokens = $tokens; |
|
| 24 | - } |
|
| 17 | + /** |
|
| 18 | + * StopWordsFilter constructor. |
|
| 19 | + * @param array $tokens |
|
| 20 | + */ |
|
| 21 | + public function __construct($tokens) |
|
| 22 | + { |
|
| 23 | + $this->tokens = $tokens; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @return array |
|
| 28 | - */ |
|
| 29 | - public function getFilterResults() |
|
| 30 | - { |
|
| 31 | - foreach ($this->stopWords as $stopWord) { |
|
| 32 | - foreach ($this->tokens as $field => $tokens) { |
|
| 33 | - if (isset($tokens[$stopWord])) { |
|
| 34 | - $tokens[$stopWord] = null; |
|
| 35 | - unset($tokens[$stopWord]); |
|
| 36 | - $tokens = array_filter($tokens); |
|
| 37 | - asort($tokens); |
|
| 38 | - } |
|
| 26 | + /** |
|
| 27 | + * @return array |
|
| 28 | + */ |
|
| 29 | + public function getFilterResults() |
|
| 30 | + { |
|
| 31 | + foreach ($this->stopWords as $stopWord) { |
|
| 32 | + foreach ($this->tokens as $field => $tokens) { |
|
| 33 | + if (isset($tokens[$stopWord])) { |
|
| 34 | + $tokens[$stopWord] = null; |
|
| 35 | + unset($tokens[$stopWord]); |
|
| 36 | + $tokens = array_filter($tokens); |
|
| 37 | + asort($tokens); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $this->tokens[$field] = $tokens; |
|
| 41 | - } |
|
| 42 | - } |
|
| 43 | - $this->tokens = array_filter($this->tokens); |
|
| 44 | - asort($this->tokens); |
|
| 45 | - return $this->tokens; |
|
| 46 | - } |
|
| 40 | + $this->tokens[$field] = $tokens; |
|
| 41 | + } |
|
| 42 | + } |
|
| 43 | + $this->tokens = array_filter($this->tokens); |
|
| 44 | + asort($this->tokens); |
|
| 45 | + return $this->tokens; |
|
| 46 | + } |
|
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public static function renderError($message = '', $file = '', $line = '', $code = 0, $trace = array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') |
| 23 | 23 | { |
| 24 | - if (ob_get_contents()) ob_end_clean(); |
|
| 24 | + if (ob_get_contents()) { |
|
| 25 | + ob_end_clean(); |
|
| 26 | + } |
|
| 25 | 27 | $line = intval($line); |
| 26 | 28 | |
| 27 | 29 | if (self::canShowError()) { |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | |
| 86 | 88 | private static function renderCliException($message, $file, $line, $trace, $lines) |
| 87 | 89 | { |
| 88 | - if (ob_get_contents()) ob_end_clean(); |
|
| 90 | + if (ob_get_contents()) { |
|
| 91 | + ob_end_clean(); |
|
| 92 | + } |
|
| 89 | 93 | include(__DIR__ . DIRECTORY_SEPARATOR . 'errortemplates/errorviewcli.php'); |
| 90 | 94 | exit; |
| 91 | 95 | } |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | function shutdownHandler () { |
| 34 | 34 | $error = error_get_last(); |
| 35 | - if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 35 | + if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 36 | 36 | \library\cc\ErrorHandlingUtil::renderError($error['message'],$error['file'],$error['line'], $error['type']); |
| 37 | - }elseif ($error['type'] == 1) { |
|
| 38 | - dump($error); |
|
| 39 | - } |
|
| 37 | + }elseif ($error['type'] == 1) { |
|
| 38 | + dump($error); |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $error = error_get_last(); |
| 35 | 35 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
| 36 | 36 | \library\cc\ErrorHandlingUtil::renderError($error['message'],$error['file'],$error['line'], $error['type']); |
| 37 | - }elseif ($error['type'] == 1) { |
|
| 37 | + } elseif ($error['type'] == 1) { |
|
| 38 | 38 | dump($error); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -13,26 +13,26 @@ |
||
| 13 | 13 | class ImagesRouting implements CmsRouting |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * ImagesRouting constructor. |
|
| 18 | - * @param \library\cc\Request $request |
|
| 19 | - * @param mixed|string $relativeCmsUri |
|
| 20 | - * @param CmsComponent $cmsComponent |
|
| 21 | - */ |
|
| 22 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 23 | - { |
|
| 24 | - if ($relativeCmsUri == '/images') { |
|
| 16 | + /** |
|
| 17 | + * ImagesRouting constructor. |
|
| 18 | + * @param \library\cc\Request $request |
|
| 19 | + * @param mixed|string $relativeCmsUri |
|
| 20 | + * @param CmsComponent $cmsComponent |
|
| 21 | + */ |
|
| 22 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 23 | + { |
|
| 24 | + if ($relativeCmsUri == '/images') { |
|
| 25 | 25 | $this->overviewRoute($cmsComponent); |
| 26 | - } elseif ($relativeCmsUri == '/images.json') { |
|
| 26 | + } elseif ($relativeCmsUri == '/images.json') { |
|
| 27 | 27 | $this->jsonRoute($cmsComponent); |
| 28 | - } elseif ($relativeCmsUri == '/images/new') { |
|
| 28 | + } elseif ($relativeCmsUri == '/images/new') { |
|
| 29 | 29 | $this->newRoute($request, $cmsComponent); |
| 30 | - } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 30 | + } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 31 | 31 | $this->deleteRoute($request, $cmsComponent); |
| 32 | - } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 32 | + } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 33 | 33 | $this->showRoute($request, $cmsComponent); |
| 34 | - } |
|
| 35 | - } |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param CmsComponent $cmsComponent |
@@ -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 | } |
@@ -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"> |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | <div class="documentActions grid-box-2"> |
| 22 | 22 | <? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?> |
| 23 | 23 | <?renderAction('Publish', |
| 24 | - 'publish', |
|
| 25 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
|
| 26 | - 'check');?> |
|
| 24 | + 'publish', |
|
| 25 | + \library\cc\Request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
|
| 26 | + 'check');?> |
|
| 27 | 27 | <? endif ?> |
| 28 | 28 | <? if ($document->state == 'published') : ?> |
| 29 | 29 | <?renderAction('Unpublish', |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'error', |
| 41 | 41 | \library\cc\Request::$subfolders . $cmsPrefix . '/documents/delete-document?slug=' . $slugPrefix . $document->slug, |
| 42 | 42 | 'trash', |
| 43 | - 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
| 43 | + 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
| 44 | 44 | <? endif ?> |
| 45 | 45 | </div> |
| 46 | 46 | <?}?> |
@@ -12,83 +12,83 @@ |
||
| 12 | 12 | |
| 13 | 13 | class ValuelistsStorage extends AbstractStorage |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Get all valuelists |
|
| 17 | - * |
|
| 18 | - * @return mixed |
|
| 19 | - */ |
|
| 20 | - public function getValuelists() |
|
| 21 | - { |
|
| 22 | - return $this->repository->valuelists; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * Get all valuelists |
|
| 17 | + * |
|
| 18 | + * @return mixed |
|
| 19 | + */ |
|
| 20 | + public function getValuelists() |
|
| 21 | + { |
|
| 22 | + return $this->repository->valuelists; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function addValuelist($postValues) |
|
| 26 | - { |
|
| 27 | - $valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
| 28 | - $valuelists = $this->repository->valuelists; |
|
| 29 | - $valuelists[] = $valueListObject; |
|
| 30 | - $this->repository->valuelists = $valuelists; |
|
| 31 | - $this->save(); |
|
| 32 | - } |
|
| 25 | + public function addValuelist($postValues) |
|
| 26 | + { |
|
| 27 | + $valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
| 28 | + $valuelists = $this->repository->valuelists; |
|
| 29 | + $valuelists[] = $valueListObject; |
|
| 30 | + $this->repository->valuelists = $valuelists; |
|
| 31 | + $this->save(); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Save changes to a valuelist |
|
| 36 | - * |
|
| 37 | - * @param $slug |
|
| 38 | - * @param $postValues |
|
| 39 | - * |
|
| 40 | - * @throws \Exception |
|
| 41 | - */ |
|
| 42 | - public function saveValuelist($slug, $postValues) |
|
| 43 | - { |
|
| 44 | - $valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
| 34 | + /** |
|
| 35 | + * Save changes to a valuelist |
|
| 36 | + * |
|
| 37 | + * @param $slug |
|
| 38 | + * @param $postValues |
|
| 39 | + * |
|
| 40 | + * @throws \Exception |
|
| 41 | + */ |
|
| 42 | + public function saveValuelist($slug, $postValues) |
|
| 43 | + { |
|
| 44 | + $valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
| 45 | 45 | |
| 46 | - $valuelists = $this->repository->valuelists; |
|
| 47 | - foreach ($valuelists as $key => $valuelist) { |
|
| 48 | - if ($valuelist->slug == $slug) { |
|
| 49 | - $valuelists[$key] = $valuelistObject; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - $this->repository->valuelists = $valuelists; |
|
| 53 | - $this->save(); |
|
| 54 | - } |
|
| 46 | + $valuelists = $this->repository->valuelists; |
|
| 47 | + foreach ($valuelists as $key => $valuelist) { |
|
| 48 | + if ($valuelist->slug == $slug) { |
|
| 49 | + $valuelists[$key] = $valuelistObject; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + $this->repository->valuelists = $valuelists; |
|
| 53 | + $this->save(); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get a valuelist by its slug |
|
| 58 | - * |
|
| 59 | - * @param $slug |
|
| 60 | - * |
|
| 61 | - * @return mixed |
|
| 62 | - */ |
|
| 63 | - public function getValuelistBySlug($slug) |
|
| 64 | - { |
|
| 65 | - $valuelists = $this->repository->valuelists; |
|
| 66 | - foreach ($valuelists as $valuelist) { |
|
| 67 | - if ($valuelist->slug == $slug) { |
|
| 68 | - return $valuelist; |
|
| 69 | - } |
|
| 70 | - } |
|
| 56 | + /** |
|
| 57 | + * Get a valuelist by its slug |
|
| 58 | + * |
|
| 59 | + * @param $slug |
|
| 60 | + * |
|
| 61 | + * @return mixed |
|
| 62 | + */ |
|
| 63 | + public function getValuelistBySlug($slug) |
|
| 64 | + { |
|
| 65 | + $valuelists = $this->repository->valuelists; |
|
| 66 | + foreach ($valuelists as $valuelist) { |
|
| 67 | + if ($valuelist->slug == $slug) { |
|
| 68 | + return $valuelist; |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return null; |
|
| 73 | - } |
|
| 72 | + return null; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Delete a sitemap item by its slug |
|
| 77 | - * |
|
| 78 | - * @param $slug |
|
| 79 | - * |
|
| 80 | - * @throws \Exception |
|
| 81 | - */ |
|
| 82 | - public function deleteValuelistBySlug($slug) |
|
| 83 | - { |
|
| 84 | - $valuelists = $this->repository->valuelists; |
|
| 85 | - foreach ($valuelists as $key => $valuelist) { |
|
| 86 | - if ($valuelist->slug == $slug) { |
|
| 87 | - unset($valuelists[$key]); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - $valuelists = array_values($valuelists); |
|
| 91 | - $this->repository->valuelists = $valuelists; |
|
| 92 | - $this->save(); |
|
| 93 | - } |
|
| 75 | + /** |
|
| 76 | + * Delete a sitemap item by its slug |
|
| 77 | + * |
|
| 78 | + * @param $slug |
|
| 79 | + * |
|
| 80 | + * @throws \Exception |
|
| 81 | + */ |
|
| 82 | + public function deleteValuelistBySlug($slug) |
|
| 83 | + { |
|
| 84 | + $valuelists = $this->repository->valuelists; |
|
| 85 | + foreach ($valuelists as $key => $valuelist) { |
|
| 86 | + if ($valuelist->slug == $slug) { |
|
| 87 | + unset($valuelists[$key]); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + $valuelists = array_values($valuelists); |
|
| 91 | + $this->repository->valuelists = $valuelists; |
|
| 92 | + $this->save(); |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | \ No newline at end of file |