| @@ -1,11 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | +defined('ABSPATH') || die('Restricted Access'); | |
| 2 | 3 | |
| 3 | 4 | include_once __DIR__.DIRECTORY_SEPARATOR.'AcymJFormField.php'; |
| 4 | 5 | |
| 6 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Joomla specific class naming with imposed prefix "JFormField". | |
| 5 | 7 | class JFormFieldArticle extends AcymJFormField |
| 6 | 8 | { |
| 7 | - var $type = 'article'; | |
| 9 | + public function __construct($form = null) | |
| 10 | + { | |
| 11 | + $this->type = 'article'; | |
| 12 | + parent::__construct($form); | |
| 13 | + } | |
| 8 | 14 | |
| 9 | 15 | public function getInput() |
| 10 | 16 | { |
| 11 | 17 | $modalId = 'acym_article_'.$this->id; |
| @@ -16,8 +22,9 @@ | ||
| 16 | 22 | if (!empty($value)) { |
| 17 | 23 | $title = acym_CMSArticleTitle($value); |
| 18 | 24 | } |
| 19 | 25 | |
| 26 | + // Callback function from the modal to the main window | |
| 20 | 27 | acym_addScript( |
| 21 | 28 | true, |
| 22 | 29 | " |
| 23 | 30 | function $callback(id, title, catid, object, url, language) { |
| @@ -44,11 +51,18 @@ | ||
| 44 | 51 | });" |
| 45 | 52 | ); |
| 46 | 53 | |
| 47 | 54 | $html = '<span class="input-append">'; |
| 48 | - $html .= '<input class="input-medium" id="'.$this->id.'_name" type="text" value="'.acym_escape($title).'" disabled="disabled" size="35" />'; | |
| 55 | + $html .= '<input class="input-medium" id="'.$this->id.'_name" type="text" value="'.esc_attr($title).'" disabled="disabled" size="35" />'; | |
| 49 | 56 | $urlSelect = acym_articleSelectionPage().'&function='.$callback; |
| 50 | - $html .= acym_cmsModal(true, $urlSelect, 'ACYM_SELECT', true, acym_translation('ACYM_SELECT_AN_ARTICLE'), $modalId); | |
| 57 | + $html .= acym_cmsModal( | |
| 58 | + true, | |
| 59 | + $urlSelect, | |
| 60 | + 'ACYM_SELECT', | |
| 61 | + true, | |
| 62 | + acym_translation('ACYM_SELECT_AN_ARTICLE'), | |
| 63 | + $modalId | |
| 64 | + ); | |
| 51 | 65 | $html .= '<a id="clear_'.$modalId.'" class="btn hasTooltip" data-toggle="modal" role="button" onclick="toggle_'.$callback.'(0);">'.acym_translation('ACYM_CLEAR').'</a>'; |
| 52 | 66 | $html .= '</span>'; |
| 53 | 67 | |
| 54 | 68 | $html .= '<input type="hidden" id="'.$this->id.'_id" name="'.$this->name.'" value="'.$value.'" />'; |