Skip to content

Commit

Permalink
Merge pull request #62 from 64j/3.1.x
Browse files Browse the repository at this point in the history
Build 3.1.14
  • Loading branch information
64j authored Nov 1, 2024
2 parents 946db49 + 8189a3d commit 70efb6e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 51 deletions.
29 changes: 16 additions & 13 deletions assets/plugins/templatesedit/class/templatesedit.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,19 @@ protected function setDefaults(): void
$this->doc['contentType'] = 'text/html';
}

if ($this->evo->getManagerApi()->action == 85 || (isset($_REQUEST['isfolder']) && $_REQUEST['isfolder'] == 1)) {
if ($this->evo->getManagerApi()->action == 85 || ($_REQUEST['isfolder'] ?? null) == 1) {
$this->doc['isfolder'] = 1;
}

if ($this->evo->getManagerApi()->action == 85 || $this->evo->getManagerApi()->action == 4) {
if (in_array($this->evo->getManagerApi()->action, [85, 4])) {
$this->doc['type'] = 'document';
}

if ($this->evo->getManagerApi()->action == 72) {
$this->doc['type'] = 'reference';
}

if ((isset($this->doc['published']) && $this->doc['published'] == 1) ||
if (($this->doc['published'] ?? null) == 1 ||
(!isset($this->doc['published']) && $this->evo->getConfig('publish_default') == 1)
) {
$this->doc['published'] = 1;
Expand All @@ -249,19 +249,19 @@ protected function setDefaults(): void
$this->doc['alias_visible'] = 1;
}

if ((isset($this->doc['searchable']) && $this->doc['searchable'] == 1) ||
if (($this->doc['searchable'] ?? null) == 1 ||
(!isset($this->doc['searchable']) && $this->evo->getConfig('search_default') == 1)
) {
$this->doc['searchable'] = 1;
}

if ((isset($this->doc['cacheable']) && $this->doc['cacheable'] == 1) ||
if (($this->doc['cacheable'] ?? null) == 1 ||
(!isset($this->doc['cacheable']) && $this->evo->getConfig('cache_default') == 1)
) {
$this->doc['cacheable'] = 1;
}

if (isset($this->doc['richtext']) && $this->doc['richtext'] == 0 && $this->evo->getManagerApi()->action == 27) {
if (($this->doc['richtext'] ?? null) == 0 && $this->evo->getManagerApi()->action == 27) {
$this->doc['richtext'] = 0;
} else {
$this->doc['richtext'] = 1;
Expand Down Expand Up @@ -411,15 +411,15 @@ public function getTemplateVariables(): ?array
foreach ($tab as $colId => $col) {
if (is_array($col)) {
foreach ($col as $fieldsId => $fields) {
if (substr($fieldsId, 0, 7) == 'fields:') {
if (substr((string) $fieldsId, 0, 7) == 'fields:') {
foreach ($fields as $key => $field) {
if (isset($this->tvars[$key])) {
unset($categories[$this->tvars[$key]['category']][$key]);
unset($this->categories[$this->tvars[$key]['category']][$key]);
}
}
}
if (substr($fieldsId, 0, 9) == 'category:') {
if (substr((string) $fieldsId, 0, 9) == 'category:') {
[, $categoryId] = explode(':', $fieldsId);
unset($categories[$categoryId]);
if (empty($this->categories[$categoryId])) {
Expand Down Expand Up @@ -993,7 +993,7 @@ protected function renderField(string $key, array $data, array $settings = []):

if ($data['title'] == '') {
$data['title'] = $data['caption'];
if (substr($data['value'], 0, 8) == '@INHERIT') {
if (substr((string) $data['value'], 0, 8) == '@INHERIT') {
$data['description'] .= '<div class="comment inherited">(' . $_lang['tmplvars_inherited'] .
')</div>';
}
Expand Down Expand Up @@ -1049,7 +1049,8 @@ protected function renderField(string $key, array $data, array $settings = []):
if ($field) {
$title = '';
$data['size'] = !empty($data['size'])
? ' input-group-' . $data['size'] : (!empty($settings['size']) ? ' input-group-' . $settings['size']
? ' input-group-' . $data['size']
: (!empty($settings['size']) ? ' input-group-' . $settings['size']
: '');
$data['position'] = !empty($data['position'])
? $data['position'] : (!empty($settings['position']) ? $settings['position'] : '');
Expand Down Expand Up @@ -1290,7 +1291,7 @@ protected function view(string $tpl, array $data = []): string
/**
* @param int $id
* @param string $value
* @param string $separator
* @param string|bool $separator
*
* @return string
*/
Expand All @@ -1300,13 +1301,15 @@ protected function showChoices(int $id, string $value = '', $separator = ', '):
$separator = is_bool($separator) ? ', ' : htmlspecialchars($separator, ENT_COMPAT);

$rs = $this->evo->getDatabase()
->query('
->query(
'
SELECT value
FROM ' . $this->evo->getFullTableName('site_tmplvar_contentvalues') . '
WHERE tmplvarid=' . $id . '
GROUP BY value
ORDER BY value ASC
');
'
);

$rs = $this->evo->getDatabase()->makeArray($rs);

Expand Down
Loading

0 comments on commit 70efb6e

Please sign in to comment.