-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.php
155 lines (134 loc) · 7.47 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
// Das Plugin öffnet in den Einstellungen vier Slots zur Eingabe von Affiliate oder
// CTA-Links. Sie können Titel, Beschreibung, Bild, Link und einen Button-Text
// vergeben. Stellen Sie zudem den Zufallsgenerator auf korrekte Werte, zum Beispiel
// 1...4 ein, damit dieser vier zufällige Banner beim Hook pageBegin() anzeigt.
class pluginAffiliate extends Plugin {
public function init()
{
$this->dbFields = array(
'start' => '',
'end' => '',
'cta-title-1' => '',
'cta-description-1' => '',
'cta-picture-1' => '',
'cta-link-1' => '',
'cta-button-1' => '',
'cta-title-2' => '',
'cta-description-2' => '',
'cta-picture-2' => '',
'cta-link-2' => '',
'cta-button-2' => '',
'cta-title-3' => '',
'cta-description-3' => '',
'cta-picture-3' => '',
'cta-link-3' => '',
'cta-button-3' => '',
'cta-title-4' => '',
'cta-description-4' => '',
'cta-picture-4' => '',
'cta-link-4' => '',
'cta-button-4' => '',
'btncolor' => ''
);
}
public function form()
{
global $L;
$html = '<div class="alert alert-primary" role="alert">';
$html .= $this->description();
$html .= '</div>';
$html .= '<p class="lead mt-4">CTA, Affiliate 1</p>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-titel').'" name="cta-title-1" id="jscta-title-1" value="'.$this->getValue('cta-title-1').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<textarea placeholder="'.$L->get('placeholder-beschreibung').'" name="cta-description-1" id="jscta-description-1" rows="3">'.$this->getValue('cta-description-1').'</textarea>';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-bild').'" name="cta-picture-1" id="jscta-picture-1" value="'.$this->getValue('cta-picture-1').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-link').'" name="cta-link-1" id="jscta-link-1" value="'.$this->getValue('cta-link-1').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-button').'" name="cta-button-1" id="jscta-button-1" value="'.$this->getValue('cta-button-1').'" class="w-100">';
$html .= '</div>';
$html .= '<p class="lead mt-4">CTA, Affiliate 2</p>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-titel').'" name="cta-title-2" id="jscta-title-2" value="'.$this->getValue('cta-title-2').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<textarea placeholder="'.$L->get('placeholder-beschreibung').'" name="cta-description-2" id="jscta-description-2" rows="3">'.$this->getValue('cta-description-2').'</textarea>';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-bild').'" name="cta-picture-2" id="jscta-picture-2" value="'.$this->getValue('cta-picture-2').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-link').'" name="cta-link-2" id="jscta-link-2" value="'.$this->getValue('cta-link-2').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-button').'" name="cta-button-2" id="jscta-button-2" value="'.$this->getValue('cta-button-2').'" class="w-100">';
$html .= '</div>';
$html .= '<p class="lead mt-4">CTA, Affiliate 3</p>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-titel').'" name="cta-title-3" id="jscta-title-3" value="'.$this->getValue('cta-title-3').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<textarea placeholder="'.$L->get('placeholder-beschreibung').'" name="cta-description-3" id="jscta-description-3" rows="3">'.$this->getValue('cta-description-3').'</textarea>';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-bild').'" name="cta-picture-3" id="jscta-picture-3" value="'.$this->getValue('cta-picture-3').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-link').'" name="cta-link-3" id="jscta-link-3" value="'.$this->getValue('cta-link-3').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-button').'" name="cta-button-3" id="jscta-button-3" value="'.$this->getValue('cta-button-3').'" class="w-100">';
$html .= '</div>';
$html .= '<p class="lead mt-4">CTA, Affiliate 4</p>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-titel').'" name="cta-title-4" id="jscta-title-4" value="'.$this->getValue('cta-title-4').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<textarea placeholder="'.$L->get('placeholder-beschreibung').'" name="cta-description-4" id="jscta-description-4" rows="3">'.$this->getValue('cta-description-4').'</textarea>';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-bild').'" name="cta-picture-4" id="jscta-picture-4" value="'.$this->getValue('cta-picture-4').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-link').'" name="cta-link-4" id="jscta-link-4" value="'.$this->getValue('cta-link-4').'" class="w-100">';
$html .= '</div>';
$html .= '<div class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-button').'" name="cta-button-4" id="jscta-button-4" value="'.$this->getValue('cta-button-4').'" class="w-100">';
$html .= '</div>';
$html .= '<p class="lead mt-4">Start und Endpunkt des Zufallsgenerators</p>';
$html .= '<div>';
$html .= '<input placeholder="'.$L->get('placeholder-start').'" size="1" name="start" id="jsstart" value="'.$this->getValue('start').'" class="m-1">';
$html .= '<input placeholder="'.$L->get('placeholder-end').'" size="1" name="end" id="jsend" value="'.$this->getValue('end').'" class="m-1">';
$html .= '<span class="tip">'.$L->get('tipp-range').'</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label class="lead">Color</label>';
$html .= '<input name="btncolor" id="jsbtncolor" value="'.$this->getValue('btncolor').'">';
$html .= '<span class="tip">'.$L->get('tipp').'</span>';
$html .= '</div><br><br>';
return $html;
}
public function pageBegin()
{
global $L;
//$rnd = rand($L->get('start'), $L->get('end'));
$rnd = rand($this->getValue('start'), $this->getValue('end'));
$html .= '<div class="row">';
$html .= '<div class="col-sm-2 mb-3">';
$html .= '<img src="'.$this->getValue('cta-picture-'.$rnd).'" class="img-fluid blurin" alt="'.$this->getValue('cta-title-'.$rnd).'" title="'.$this->getValue('cta-title-'.$rnd).'" />';
$html .= '</div>';
$html .= '<div class="col-sm">';
$html .= '<p><strong>'.$this->getValue('cta-title-'.$rnd).'</strong> - '.html_entity_decode($this->getValue('cta-description-'.$rnd)).'</p>';
$html .= '<a href="'.$this->getValue('cta-link-'.$rnd).'" class="move btn text-light '.$this->getValue('btncolor').'" title="'.$this->getValue('cta-title-'.$rnd).'">'.$this->getValue('cta-button-'.$rnd).'</a>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}