Skip to content

Commit

Permalink
Module/Admin: Smarty 5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightprince committed Apr 26, 2024
1 parent 237caa9 commit f03d4bb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions application/modules/admin/views/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
{foreach from=$config item=option key=label}
<div class="form-group row">
{if $label != "source"}
{if is_array($option) && ctype_digit(implode('', array_keys($option)))}
{if $option|is_array && ctype_digit(implode('', array_keys($option)))}
<label class="col-sm-2 col-form-label" for="{$label}">{ucfirst(preg_replace("/_/", " ", $label))}</label>
<div class="col-sm-10">
<input class="form-control nui-focus border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-monospace transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 px-2 h-10 py-2 text-sm leading-5 px-3 rounded" type="text" value="{foreach from=$option item=value}{$value}{if !$value@last},{/if}{/foreach}" id="{$label}" name="{$label}" />
</div>
{elseif is_array($option)}
{elseif $option|is_array}
<label class="col-sm-2 col-form-label" for="{$label}"><b>{ucfirst(preg_replace("/_/", " ", $label))}</b></label>
{foreach from=$option item=sub_option key=sub_label}
{if is_array($sub_option) && ctype_digit(implode('', array_keys($sub_option)))}
{if $sub_option|is_array && ctype_digit(implode('', array_keys($sub_option)))}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}">{ucfirst(preg_replace("/_/", " ", $sub_label))}</label>
<div class="col-sm-10">
<input class="form-control nui-focus border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-monospace transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 px-2 h-10 py-2 text-sm leading-5 px-3 rounded" type="text" value="{foreach from=$sub_option item=value}{$value}{if !$value@last},{/if}{/foreach}" id="{$label}-{$sub_label}" name="{$label}-{$sub_label}" />
</div>
{elseif is_array($sub_option)}
{elseif $sub_option|is_array}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}"><b>{ucfirst(preg_replace("/_/", " ", $sub_label))}</b></label>
{elseif $sub_option === true}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}">{ucfirst(preg_replace("/_/", " ", $sub_label))}</label>
Expand Down
8 changes: 4 additions & 4 deletions application/modules/admin/views/config_theme.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
{foreach from=$config item=option key=label}
<div class="form-group row">
{if $label != "source"}
{if is_array($option) && ctype_digit(implode('', array_keys($option)))}
{if $option|is_array && ctype_digit(implode('', array_keys($option)))}
<label class="col-sm-2 col-form-label" for="{$label}">{ucfirst(preg_replace("/_/", " ", $label))}</label>
<div class="col-sm-10">
<input class="form-control nui-focus border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-monospace transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 px-2 h-10 py-2 text-sm leading-5 px-3 rounded" type="text" value="{foreach from=$option item=value}{$value}{if !$value@last},{/if}{/foreach}" id="{$label}" name="{$label}" />
</div>
{elseif is_array($option)}
{elseif $option|is_array}
<label class="col-sm-2 col-form-label" for="{$label}"><b>{ucfirst(preg_replace("/_/", " ", $label))}</b></label>
{foreach from=$option item=sub_option key=sub_label}
{if is_array($sub_option) && ctype_digit(implode('', array_keys($sub_option)))}
{if $sub_option|is_array && ctype_digit(implode('', array_keys($sub_option)))}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}">{ucfirst(preg_replace("/_/", " ", $sub_label))}</label>
<div class="col-sm-10">
<input class="form-control nui-focus border-muted-300 text-muted-600 placeholder:text-muted-300 dark:border-muted-700 dark:bg-muted-900/75 dark:text-muted-200 dark:placeholder:text-muted-500 dark:focus:border-muted-700 peer w-full border bg-white font-monospace transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-75 px-2 h-10 py-2 text-sm leading-5 px-3 rounded" type="text" value="{foreach from=$sub_option item=value}{$value}{if !$value@last},{/if}{/foreach}" id="{$label}-{$sub_label}" name="{$label}-{$sub_label}" />
</div>
{elseif is_array($sub_option)}
{elseif $sub_option|is_array}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}"><b>{ucfirst(preg_replace("/_/", " ", $sub_label))}</b></label>
{elseif $sub_option === true}
<label class="col-sm-2 col-form-label" for="{$label}-{$sub_label}">{ucfirst(preg_replace("/_/", " ", $sub_label))}</label>
Expand Down
2 changes: 1 addition & 1 deletion application/modules/admin/views/sidebox/add_sidebox.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>

{* Pages.Start *}
{if isset($pages) && is_array($pages) && count($pages)}
{if isset($pages) && $pages|is_array && count($pages)}
<div class="form-group row mb-3">
<label class="col-sm-2 col-form-label">Pages</label>
<div class="col-sm-10">
Expand Down
6 changes: 3 additions & 3 deletions application/modules/admin/views/sidebox/edit_sidebox.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
</div>

{* Pages.Start *}
{if isset($pages) && is_array($pages) && count($pages)}
{if isset($pages) && $pages|is_array && count($pages)}
<div class="form-group row mb-3">
<label class="col-sm-2 col-form-label">Pages</label>
<div class="col-sm-10">
<div class="row row-cols-2 row-cols-md-6">
{foreach from=$pages item=item}
<div class="col">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" name="pages[]" id="page_{$item}" value="{$item}" {if is_array($sidebox.pages) && in_array($item, $sidebox.pages)}checked{/if} {if is_array($sidebox.pages) && in_array('*', $sidebox.pages)}disabled{/if} />
<input class="form-check-input" type="checkbox" name="pages[]" id="page_{$item}" value="{$item}" {if $sidebox.pages|is_array && in_array($item, $sidebox.pages)}checked{/if} {if $sidebox.pages|is_array && in_array('*', $sidebox.pages)}disabled{/if} />
<label class="form-check-label" for="page_{$item}">{$item}</label>
</div>
</div>
Expand All @@ -73,7 +73,7 @@

<div class="col">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" name="pages[]" id="page_*" value="*" onclick="[...document.querySelectorAll('input[name=\'pages[]\']')].map(el => { if(el.value === '*') { return; } if(this.checked) { el.disabled = true; } else { el.disabled = false; } })" {if is_array($sidebox.pages) && in_array('*', $sidebox.pages)}checked{/if} />
<input class="form-check-input" type="checkbox" name="pages[]" id="page_*" value="*" onclick="[...document.querySelectorAll('input[name=\'pages[]\']')].map(el => { if(el.value === '*') { return; } if(this.checked) { el.disabled = true; } else { el.disabled = false; } })" {if $sidebox.pages|is_array && in_array('*', $sidebox.pages)}checked{/if} />
<label class="form-check-label" for="page_*">Visible in all pages</label>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions application/modules/admin/views/updater.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
</div>

<div class="space-y-6">
{if $logs && is_array($logs)}
{if $logs && $logs|is_array}
{$first = true}

<ul id="logs-tab" class="nav nav-pills" role="tablist">
Expand Down Expand Up @@ -191,7 +191,7 @@
<div class="flex flex-column gap-3">
<div><h4 class="font-heading text-sm font-light leading-tight text-muted-800 dark:text-white"><span>Modules:</span></h4></div>
<div class="overflow-x-hidden overflow-y-auto" style="height: 206px;">
{if $server_modules && is_array($server_modules)}
{if $server_modules && $server_modules|is_array}
{foreach from=$server_modules key=key item=item}
<span class="text-muted-500 dark:text-muted-400 bg-muted-200 dark:bg-muted-700/40 inline-flex h-6 items-center justify-center rounded-full px-3 font-sans text-xs font-medium m-1">{$item}</span>
{/foreach}
Expand All @@ -218,7 +218,7 @@
<div class="flex flex-column gap-3">
<div><h4 class="font-heading text-sm font-light leading-tight text-muted-800 dark:text-white"><span>Extensions:</span></h4></div>
<div class="overflow-x-hidden overflow-y-auto" style="height: 206px;">
{if $php_extensions && is_array($php_extensions)}
{if $php_extensions && $php_extensions|is_array}
{foreach from=$php_extensions key=key item=item}
<span class="text-muted-500 dark:text-muted-400 bg-muted-200 dark:bg-muted-700/40 inline-flex h-6 items-center justify-center rounded-full px-3 font-sans text-xs font-medium m-1">{$item}</span>
{/foreach}
Expand Down

0 comments on commit f03d4bb

Please sign in to comment.