de632e9c5c
Universal: PR Check / Branch Policy (pull_request) Failing after 2s
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 20s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 10s
Universal: PR Check / Validate PR (pull_request) Failing after 11s
Universal: PR Check / Secret Scan (pull_request) Successful in 12s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 14s
Universal: Build & Release / Promote to RC (pull_request) Failing after 10s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 47s
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Joomla: Extension CI / Build RC Pre-Release (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
All placeholders changed from lowercase to UPPERCASE: [host] → [HOST], [site_name] → [SITE_NAME], [date] → [DATE], [datetime] → [DATETIME], [profile_id] → [PROFILE_ID], etc. [HOME] and [DEFAULT_DIR] were already uppercase — now consistent. SQL migration 01.39.01 updates existing profile data in the database. Resolution display prefixed with "EXAMPLE:" to clarify these are example values resolved at backup time. 13 files updated across engines, fields, forms, templates, and SQL.
79 lines
2.7 KiB
PHP
79 lines
2.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoSuiteBackup
|
|
* @subpackage com_mokosuitebackup
|
|
* @author Moko Consulting <hello@mokoconsulting.tech>
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*
|
|
* Text field with clickable placeholder pills that insert at cursor position.
|
|
* Used for backup directory and archive name format fields.
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoSuiteBackup\Administrator\Field;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Form\FormField;
|
|
|
|
class PlaceholderTextField extends FormField
|
|
{
|
|
protected $type = 'PlaceholderText';
|
|
|
|
protected function getInput(): string
|
|
{
|
|
$value = htmlspecialchars($this->value ?? $this->default ?? '', ENT_QUOTES, 'UTF-8');
|
|
$id = htmlspecialchars($this->id, ENT_QUOTES, 'UTF-8');
|
|
$name = htmlspecialchars($this->name, ENT_QUOTES, 'UTF-8');
|
|
$hint = htmlspecialchars($this->element['hint'] ?? '', ENT_QUOTES, 'UTF-8');
|
|
$max = (int) ($this->element['maxlength'] ?? 512);
|
|
|
|
$placeholderAttr = (string) ($this->element['placeholders'] ?? '');
|
|
$placeholders = array_filter(array_map('trim', explode(',', $placeholderAttr)));
|
|
|
|
if (empty($placeholders)) {
|
|
$placeholders = ['[HOST]', '[DATE]', '[DATETIME]', '[TIME]', '[YEAR]', '[MONTH]', '[DAY]',
|
|
'[HOUR]', '[MINUTE]', '[SECOND]', '[PROFILE_ID]', '[PROFILE_NAME]', '[SITE_NAME]', '[TYPE]', '[RANDOM]'];
|
|
}
|
|
|
|
$html = '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '"'
|
|
. ' class="form-control" maxlength="' . $max . '"'
|
|
. ($hint ? ' placeholder="' . $hint . '"' : '') . '>';
|
|
|
|
$html .= '<div class="mt-1" style="display:flex; flex-wrap:wrap; gap:4px;">';
|
|
$html .= '<span class="text-muted small me-1" style="line-height:24px;">Insert:</span>';
|
|
|
|
foreach ($placeholders as $ph) {
|
|
$html .= '<button type="button" class="btn btn-outline-secondary btn-sm py-0 px-1 moko-ph-insert"'
|
|
. ' data-field="' . $id . '" data-ph="' . htmlspecialchars($ph) . '">'
|
|
. htmlspecialchars($ph) . '</button>';
|
|
}
|
|
|
|
$html .= '</div>';
|
|
|
|
$html .= <<<JS
|
|
<script>
|
|
document.querySelectorAll('.moko-ph-insert[data-field="{$id}"]').forEach(function(btn) {
|
|
btn.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
var target = document.getElementById(this.getAttribute('data-field'));
|
|
var ph = this.getAttribute('data-ph');
|
|
if (!target) return;
|
|
var start = target.selectionStart || 0;
|
|
var end = target.selectionEnd || 0;
|
|
var val = target.value;
|
|
target.value = val.substring(0, start) + ph + val.substring(end);
|
|
var newPos = start + ph.length;
|
|
target.setSelectionRange(newPos, newPos);
|
|
target.focus();
|
|
target.dispatchEvent(new Event('input', { bubbles: true }));
|
|
});
|
|
});
|
|
</script>
|
|
JS;
|
|
|
|
return $html;
|
|
}
|
|
}
|