PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / front / Params / article.php

article.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.0, at front/Params/article.php

78 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') || die('Restricted Access');
3
4 include_once __DIR__.DIRECTORY_SEPARATOR.'AcymJFormField.php';
5
6 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Joomla specific class naming with imposed prefix "JFormField".
7 class JFormFieldArticle extends AcymJFormField
8 {
9 public function __construct($form = null)
10 {
11 $this->type = 'article';
12 parent::__construct($form);
13 }
14
15 public function getInput()
16 {
17 $modalId = 'acym_article_'.$this->id;
18 $callback = 'jSelectArticle_'.$this->id;
19
20 $title = '';
21 $value = intval($this->value);
22 if (!empty($value)) {
23 $title = acym_CMSArticleTitle($value);
24 }
25
26 // Callback function from the modal to the main window
27 acym_addScript(
28 true,
29 "
30 function $callback(id, title, catid, object, url, language) {
31 window.processModalSelect('Article', '".$this->id."', id, title, catid, object, url, language);
32 toggle_$callback(id);
33 jQuery('#".$modalId."').modal('hide');
34 }
35
36 function toggle_$callback(selection) {
37 if (selection && selection > 0) {
38 jQuery('#button_$modalId').hide();
39 jQuery('#clear_$modalId').show();
40 } else {
41 jQuery('#".$this->id."_name').val('');
42 jQuery('#".$this->id."_id').val('');
43
44 jQuery('#button_$modalId').show();
45 jQuery('#clear_$modalId').hide();
46 }
47 }
48
49 jQuery(function($){
50 toggle_$callback($value);
51 });"
52 );
53
54 $html = '<span class="input-append">';
55 $html .= '<input class="input-medium" id="'.$this->id.'_name" type="text" value="'.esc_attr($title).'" disabled="disabled" size="35" />';
56 $urlSelect = acym_articleSelectionPage().'&function='.$callback;
57 $html .= acym_cmsModal(
58 true,
59 $urlSelect,
60 'ACYM_SELECT',
61 true,
62 acym_translation('ACYM_SELECT_AN_ARTICLE'),
63 $modalId
64 );
65 $html .= '<a id="clear_'.$modalId.'" class="btn hasTooltip" data-toggle="modal" role="button" onclick="toggle_'.$callback.'(0);">'.acym_translation('ACYM_CLEAR').'</a>';
66 $html .= '</span>';
67
68 $html .= '<input type="hidden" id="'.$this->id.'_id" name="'.$this->name.'" value="'.$value.'" />';
69
70 return $html;
71 }
72
73 public function getLabel()
74 {
75 return str_replace($this->id, $this->id.'_id', parent::getLabel());
76 }
77 }
78