Version Description
- Fixed issue with reset stats
- Fixed security issue
- Fixed issue with automatically reset stats
- Fixed issue with custom loading image
- Fixed display issues
- Updated Get Code with more options
Download this release
Release Info
Developer | yourownprogrammer |
Plugin | YOP Poll |
Version | 5.7.8 |
Comparing to | |
See all releases |
Code changes from version 5.7.7 to 5.7.8
- css/custombox.css +872 -0
- css/reveal.css +45 -61
- css/yop-poll-donate.css +19 -9
- css/yop-poll-optin2.css +49 -47
- css/yop-poll-wizard.css +1 -1
- inc/admin.php +308 -111
- inc/config.php +1 -1
- inc/logs_admin.php +2 -2
- inc/maintenance.php +5 -1
- inc/poll_admin.php +46 -390
- inc/pro_admin.php +2 -2
- inc/public-admin.php +23 -34
- js/custombox.js +772 -0
- js/legacy.js +874 -0
- js/polls/yop-poll-add-edit.js +24 -10
- js/yop-poll-admin.js +1 -6
- js/yop-poll-modal-functions.js +32 -43
- models/abstract_model.php +7 -31
- models/poll_model.php +7 -4
- models/yop_poll_model.php +19 -2
- readme.txt +9 -1
- templates/polls_add_edit.html +0 -1
- templates/polls_add_edit_beginner.html +2 -21
- templates/polls_question_template.html +21 -17
- templates/polls_results_votes.html +22 -28
- templates/polls_view.html +294 -419
- tinymce/yop-poll-editor-functions.js +35 -24
- tinymce/yop-poll-editor.js +33 -33
- yop_poll.php +69 -79
css/custombox.css
ADDED
@@ -0,0 +1,872 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
----------------------------
|
3 |
+
Actions
|
4 |
+
----------------------------
|
5 |
+
*/
|
6 |
+
.custombox-open,
|
7 |
+
.custombox-open body {
|
8 |
+
overflow: hidden;
|
9 |
+
}
|
10 |
+
.custombox-perspective,
|
11 |
+
.custombox-perspective body {
|
12 |
+
perspective: 600px;
|
13 |
+
height: 100%;
|
14 |
+
}
|
15 |
+
.custombox-overlay-open {
|
16 |
+
visibility: visible;
|
17 |
+
opacity: 1;
|
18 |
+
}
|
19 |
+
|
20 |
+
/*
|
21 |
+
----------------------------
|
22 |
+
Defaults
|
23 |
+
----------------------------
|
24 |
+
*/
|
25 |
+
.custombox-overlay {
|
26 |
+
top: 0;
|
27 |
+
right: 0;
|
28 |
+
bottom: 0;
|
29 |
+
left: 0;
|
30 |
+
position: fixed;
|
31 |
+
transition-delay: 0s;
|
32 |
+
}
|
33 |
+
.custombox-overlay-default {
|
34 |
+
transition-timing-function: linear;
|
35 |
+
transition-property: opacity;
|
36 |
+
opacity: 0;
|
37 |
+
}
|
38 |
+
.custombox-modal-wrapper {
|
39 |
+
right: 0;
|
40 |
+
top: 0;
|
41 |
+
bottom: 0;
|
42 |
+
left: 0;
|
43 |
+
outline: 0 none;
|
44 |
+
overflow: auto;
|
45 |
+
position: fixed;
|
46 |
+
text-align: center;
|
47 |
+
}
|
48 |
+
.custombox-modal-container {
|
49 |
+
margin: 0 auto;
|
50 |
+
position: relative;
|
51 |
+
}
|
52 |
+
.custombox-modal img {
|
53 |
+
max-width: 100%;
|
54 |
+
height: auto;
|
55 |
+
}
|
56 |
+
.custombox-scrollbar {
|
57 |
+
position: absolute;
|
58 |
+
top: -9999px;
|
59 |
+
width: 50px;
|
60 |
+
height: 50px;
|
61 |
+
overflow: scroll;
|
62 |
+
}
|
63 |
+
.custombox-loading {
|
64 |
+
position: fixed;
|
65 |
+
transform: translateY(-50%) translateX(-50%);
|
66 |
+
top: 50%;
|
67 |
+
left: 50%;
|
68 |
+
}
|
69 |
+
|
70 |
+
/*
|
71 |
+
----------------------------
|
72 |
+
Overlay: Letmein
|
73 |
+
----------------------------
|
74 |
+
*/
|
75 |
+
.custombox-overlay-letmein {
|
76 |
+
transition-property: all;
|
77 |
+
transition-timing-function: ease;
|
78 |
+
visibility: hidden;
|
79 |
+
}
|
80 |
+
.custombox-overlay-open.custombox-overlay-letmein {
|
81 |
+
transform: rotateX(-2deg);
|
82 |
+
transform-origin: 50% 0;
|
83 |
+
transform-style: preserve-3d;
|
84 |
+
visibility: visible;
|
85 |
+
opacity: 1;
|
86 |
+
}
|
87 |
+
|
88 |
+
/*
|
89 |
+
----------------------------
|
90 |
+
Overlay: Slide together
|
91 |
+
----------------------------
|
92 |
+
*/
|
93 |
+
.custombox-overlay-slidetogether {
|
94 |
+
transform: translateY(-100%);
|
95 |
+
transition-property: transform ease-in-out;
|
96 |
+
}
|
97 |
+
|
98 |
+
.custombox-overlay-open.custombox-overlay-slidetogether {
|
99 |
+
transform: translateY(0);
|
100 |
+
transition-property: transform ease-in-out;
|
101 |
+
}
|
102 |
+
|
103 |
+
/*
|
104 |
+
----------------------------
|
105 |
+
Overlay: Corner
|
106 |
+
----------------------------
|
107 |
+
*/
|
108 |
+
.custombox-overlay-corner {
|
109 |
+
transform: translateY(150px) translateX(150px);
|
110 |
+
transition-property: opacity, transform, visibility;
|
111 |
+
}
|
112 |
+
.custombox-overlay-open.custombox-overlay-corner {
|
113 |
+
transform: translateY(0);
|
114 |
+
transition-property: opacity, transform;
|
115 |
+
}
|
116 |
+
|
117 |
+
/*
|
118 |
+
----------------------------
|
119 |
+
Overlay: Scale
|
120 |
+
----------------------------
|
121 |
+
*/
|
122 |
+
.custombox-overlay-scale {
|
123 |
+
transform: scale(0.9);
|
124 |
+
transition-property: transform;
|
125 |
+
}
|
126 |
+
.custombox-overlay-open.custombox-overlay-scale {
|
127 |
+
transform: scale(1);
|
128 |
+
transition-property: transform;
|
129 |
+
}
|
130 |
+
|
131 |
+
/*
|
132 |
+
----------------------------
|
133 |
+
Overlay: Door
|
134 |
+
----------------------------
|
135 |
+
*/
|
136 |
+
.custombox-overlay-door {
|
137 |
+
visibility: hidden;
|
138 |
+
width: 0;
|
139 |
+
left: 50%;
|
140 |
+
transform: translateX(-50%);
|
141 |
+
transition-property: width ease-in-out;
|
142 |
+
}
|
143 |
+
.custombox-overlay-open.custombox-overlay-door {
|
144 |
+
visibility: visible;
|
145 |
+
width: 100%;
|
146 |
+
transition-property: width ease-in-out;
|
147 |
+
}
|
148 |
+
|
149 |
+
/*
|
150 |
+
----------------------------
|
151 |
+
Overlay: Push
|
152 |
+
----------------------------
|
153 |
+
*/
|
154 |
+
.custombox-container-push {
|
155 |
+
overflow-x: hidden;
|
156 |
+
transition-property: transform;
|
157 |
+
}
|
158 |
+
.custombox-container-open.custombox-container-push {
|
159 |
+
transform: translateX(100%);
|
160 |
+
}
|
161 |
+
.custombox-overlay-push {
|
162 |
+
backface-visibility: hidden;
|
163 |
+
transform: translateX(-100%);
|
164 |
+
transition-property: transform ease-in-out;
|
165 |
+
}
|
166 |
+
.custombox-overlay-open.custombox-overlay-push {
|
167 |
+
transform: translateX(0);
|
168 |
+
transition-property: transform ease-in-out;
|
169 |
+
}
|
170 |
+
|
171 |
+
/*
|
172 |
+
----------------------------
|
173 |
+
Overlay: Content Scale
|
174 |
+
----------------------------
|
175 |
+
*/
|
176 |
+
.custombox-open-contentscale body {
|
177 |
+
background-color: #DDD;
|
178 |
+
}
|
179 |
+
.custombox-container-contentscale {
|
180 |
+
transition: transform 0.5s;
|
181 |
+
overflow: hidden;
|
182 |
+
height: 100%;
|
183 |
+
}
|
184 |
+
.custombox-container-open.custombox-container-contentscale {
|
185 |
+
transform: scale(0.8);
|
186 |
+
}
|
187 |
+
.custombox-overlay-contentscale {
|
188 |
+
transform: translateY(100%);
|
189 |
+
transition-property: transform ease-in-out;
|
190 |
+
}
|
191 |
+
.custombox-overlay-open.custombox-overlay-contentscale {
|
192 |
+
transform: translateY(0);
|
193 |
+
transition-property: transform ease-in-out;
|
194 |
+
}
|
195 |
+
|
196 |
+
/*
|
197 |
+
----------------------------
|
198 |
+
Overlay: Makeway
|
199 |
+
----------------------------
|
200 |
+
*/
|
201 |
+
.custombox-container-open.custombox-container-makeway {
|
202 |
+
height: 100%;
|
203 |
+
overflow: hidden;
|
204 |
+
}
|
205 |
+
.custombox-overlay-open.custombox-overlay-makeway {
|
206 |
+
transition-property: all;
|
207 |
+
}
|
208 |
+
.custombox-overlay-open.custombox-overlay-makeway,
|
209 |
+
.custombox-container-open.custombox-container-makeway {
|
210 |
+
transform-style: preserve-3d;
|
211 |
+
transform-origin: 0 50%;
|
212 |
+
animation: rotateRightSideFirst 0.5s forwards ease-in;
|
213 |
+
}
|
214 |
+
@keyframes rotateRightSideFirst {
|
215 |
+
50% {
|
216 |
+
transform: translateZ(-50px) rotateY(5deg);
|
217 |
+
animation-timing-function: ease-out;
|
218 |
+
}
|
219 |
+
100% {
|
220 |
+
transform: translateZ(-200px);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
/*
|
225 |
+
----------------------------
|
226 |
+
Overlay: Slip
|
227 |
+
----------------------------
|
228 |
+
*/
|
229 |
+
.custombox-overlay-open.custombox-overlay-slip {
|
230 |
+
transition-property: all;
|
231 |
+
}
|
232 |
+
.custombox-overlay-open.custombox-overlay-slip,
|
233 |
+
.custombox-container-open.custombox-container-slip {
|
234 |
+
transform-style: preserve-3d;
|
235 |
+
transform-origin: 50% 100%;
|
236 |
+
animation: OpenTop 0.5s forwards ease-in-out;
|
237 |
+
}
|
238 |
+
@keyframes OpenTop {
|
239 |
+
50% {
|
240 |
+
transform: rotateX(10deg);
|
241 |
+
animation-timing-function: ease-out;
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
/*
|
246 |
+
----------------------------
|
247 |
+
Modal: Fadein
|
248 |
+
----------------------------
|
249 |
+
*/
|
250 |
+
.custombox-modal-fadein {
|
251 |
+
transform: scale(0.7);
|
252 |
+
transition-property: all;
|
253 |
+
opacity: 0;
|
254 |
+
visibility: hidden;
|
255 |
+
}
|
256 |
+
.custombox-modal-open .custombox-modal-fadein {
|
257 |
+
transform: scale(1);
|
258 |
+
opacity: 1;
|
259 |
+
visibility: visible;
|
260 |
+
}
|
261 |
+
|
262 |
+
/*
|
263 |
+
----------------------------
|
264 |
+
Modal: Slide
|
265 |
+
----------------------------
|
266 |
+
*/
|
267 |
+
.custombox-modal-container-slide > div,
|
268 |
+
.custombox-modal-container-slidetogether > div {
|
269 |
+
opacity: 0;
|
270 |
+
float: left;
|
271 |
+
}
|
272 |
+
.custombox-modal-open > .custombox-modal-container-slide > div,
|
273 |
+
.custombox-modal-open > .custombox-modal-container-slidetogether > div {
|
274 |
+
opacity: 1;
|
275 |
+
}
|
276 |
+
|
277 |
+
/*
|
278 |
+
----------------------------
|
279 |
+
Modal: Slide from top
|
280 |
+
----------------------------
|
281 |
+
*/
|
282 |
+
.custombox-modal-slide-top {
|
283 |
+
transform: translateY(-300%);
|
284 |
+
}
|
285 |
+
.custombox-modal-open .custombox-modal-slide-top {
|
286 |
+
transform: translateY(0);
|
287 |
+
}
|
288 |
+
|
289 |
+
/*
|
290 |
+
----------------------------
|
291 |
+
Modal: Slide from left
|
292 |
+
----------------------------
|
293 |
+
*/
|
294 |
+
.custombox-modal-slide-left {
|
295 |
+
transform: translateX(-300%);
|
296 |
+
}
|
297 |
+
.custombox-modal-open .custombox-modal-slide-left {
|
298 |
+
transform: translateX(0);
|
299 |
+
}
|
300 |
+
|
301 |
+
/*
|
302 |
+
----------------------------
|
303 |
+
Modal: Slide from right
|
304 |
+
----------------------------
|
305 |
+
*/
|
306 |
+
.custombox-modal-slide-right {
|
307 |
+
transform: translateX(300%);
|
308 |
+
}
|
309 |
+
.custombox-modal-open .custombox-modal-slide-right {
|
310 |
+
transform: translateX(0);
|
311 |
+
}
|
312 |
+
|
313 |
+
/*
|
314 |
+
----------------------------
|
315 |
+
Modal: Slide from bottom
|
316 |
+
----------------------------
|
317 |
+
*/
|
318 |
+
.custombox-modal-slide-bottom {
|
319 |
+
transform: translateY(300%);
|
320 |
+
}
|
321 |
+
.custombox-modal-open .custombox-modal-slide-bottom {
|
322 |
+
transform: translateY(0);
|
323 |
+
}
|
324 |
+
|
325 |
+
/*
|
326 |
+
----------------------------
|
327 |
+
Modal: Newspaper
|
328 |
+
----------------------------
|
329 |
+
*/
|
330 |
+
.custombox-modal-newspaper {
|
331 |
+
transform: scale(0) rotate(720deg);
|
332 |
+
opacity: 0;
|
333 |
+
transition-property: all;
|
334 |
+
position: absolute;
|
335 |
+
}
|
336 |
+
.custombox-overlay-newspaper {
|
337 |
+
transition-property: all;
|
338 |
+
}
|
339 |
+
.custombox-modal-open .custombox-modal-newspaper {
|
340 |
+
transform: scale(1) rotate(0deg);
|
341 |
+
opacity: 1;
|
342 |
+
}
|
343 |
+
|
344 |
+
/*
|
345 |
+
----------------------------
|
346 |
+
Modal: Fall
|
347 |
+
----------------------------
|
348 |
+
*/
|
349 |
+
.custombox-modal-container-fall {
|
350 |
+
perspective: 1300px;
|
351 |
+
}
|
352 |
+
.custombox-modal-fall {
|
353 |
+
transform-style: preserve-3d;
|
354 |
+
transform: translateZ(600px) rotateX(20deg);
|
355 |
+
opacity: 0;
|
356 |
+
}
|
357 |
+
.custombox-modal-open .custombox-modal-fall {
|
358 |
+
transition-timing-function: ease-in;
|
359 |
+
transition-property: all;
|
360 |
+
transform: translateZ(0) rotateX(0deg);
|
361 |
+
opacity: 1;
|
362 |
+
}
|
363 |
+
|
364 |
+
/*
|
365 |
+
----------------------------
|
366 |
+
Modal: Sideball
|
367 |
+
----------------------------
|
368 |
+
*/
|
369 |
+
.custombox-modal-container-sidefall {
|
370 |
+
perspective: 1300px;
|
371 |
+
}
|
372 |
+
.custombox-modal-wrapper-sidefall {
|
373 |
+
overflow-x: hidden;
|
374 |
+
}
|
375 |
+
.custombox-modal-sidefall {
|
376 |
+
transform-style: preserve-3d;
|
377 |
+
transform: translate(30%) translateZ(600px) rotate(10deg);
|
378 |
+
opacity: 0;
|
379 |
+
}
|
380 |
+
.custombox-modal-open .custombox-modal-sidefall {
|
381 |
+
transition-timing-function: ease-in;
|
382 |
+
transition-property: all;
|
383 |
+
transform: translate(0) translateZ(0) rotate(0deg);
|
384 |
+
opacity: 1;
|
385 |
+
}
|
386 |
+
|
387 |
+
/*
|
388 |
+
----------------------------
|
389 |
+
Modal: Blur
|
390 |
+
----------------------------
|
391 |
+
*/
|
392 |
+
.custombox-open-blur .custombox-container-blur {
|
393 |
+
filter: blur(3px);
|
394 |
+
}
|
395 |
+
@media all and (-ms-high-contrast: none) {
|
396 |
+
.custombox-open-blur .custombox-container-blur {
|
397 |
+
text-shadow: 0 0 8px #000;
|
398 |
+
color: rgba(255,255,255,0);
|
399 |
+
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3');
|
400 |
+
zoom: 1;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
.custombox-modal-blur {
|
404 |
+
transform: translateY(-5%);
|
405 |
+
opacity: 0;
|
406 |
+
position: absolute;
|
407 |
+
}
|
408 |
+
.custombox-overlay-blur,
|
409 |
+
.custombox-modal-container-blur {
|
410 |
+
transition-property: all;
|
411 |
+
}
|
412 |
+
.custombox-modal-open .custombox-modal-blur {
|
413 |
+
transform: translateY(0);
|
414 |
+
opacity: 1;
|
415 |
+
}
|
416 |
+
|
417 |
+
/*
|
418 |
+
----------------------------
|
419 |
+
Modal: 3D Flip generic
|
420 |
+
----------------------------
|
421 |
+
*/
|
422 |
+
.custombox-modal-container-flip {
|
423 |
+
perspective: 1300px;
|
424 |
+
}
|
425 |
+
|
426 |
+
/*
|
427 |
+
----------------------------
|
428 |
+
Modal: 3D Flip horizontal
|
429 |
+
----------------------------
|
430 |
+
*/
|
431 |
+
.custombox-modal-flip-horizontal {
|
432 |
+
position: absolute;
|
433 |
+
transform-style: preserve-3d;
|
434 |
+
transform: rotateY(-70deg);
|
435 |
+
transition-property: all;
|
436 |
+
opacity: 0;
|
437 |
+
}
|
438 |
+
.custombox-modal-open .custombox-modal-flip-horizontal {
|
439 |
+
transform: rotateY(0deg);
|
440 |
+
opacity: 1;
|
441 |
+
}
|
442 |
+
|
443 |
+
/*
|
444 |
+
----------------------------
|
445 |
+
Modal: 3D Flip vertical
|
446 |
+
----------------------------
|
447 |
+
*/
|
448 |
+
.custombox-modal-flip-vertical {
|
449 |
+
position: absolute;
|
450 |
+
transform-style: preserve-3d;
|
451 |
+
transform: rotateX(-70deg);
|
452 |
+
transition-property: all;
|
453 |
+
opacity: 0;
|
454 |
+
}
|
455 |
+
.custombox-modal-open .custombox-modal-flip-vertical {
|
456 |
+
transform: rotateX(0deg);
|
457 |
+
opacity: 1;
|
458 |
+
}
|
459 |
+
|
460 |
+
/*
|
461 |
+
----------------------------
|
462 |
+
Modal: 3D Sign
|
463 |
+
----------------------------
|
464 |
+
*/
|
465 |
+
.custombox-modal-container-sign {
|
466 |
+
perspective: 1300px;
|
467 |
+
}
|
468 |
+
.custombox-modal-sign {
|
469 |
+
transform-style: preserve-3d;
|
470 |
+
transform: rotateX(-60deg);
|
471 |
+
transform-origin: 50% 0;
|
472 |
+
opacity: 0;
|
473 |
+
transition-property: all;
|
474 |
+
}
|
475 |
+
.custombox-modal-open .custombox-modal-sign {
|
476 |
+
transform: rotateX(0deg);
|
477 |
+
opacity: 1;
|
478 |
+
}
|
479 |
+
|
480 |
+
/*
|
481 |
+
----------------------------
|
482 |
+
Modal: Superscaled
|
483 |
+
----------------------------
|
484 |
+
*/
|
485 |
+
.custombox-modal-superscaled {
|
486 |
+
transform: scale(2);
|
487 |
+
opacity: 0;
|
488 |
+
transition-property: all;
|
489 |
+
position: absolute;
|
490 |
+
}
|
491 |
+
.custombox-modal-open .custombox-modal-superscaled {
|
492 |
+
transform: scale(1);
|
493 |
+
opacity: 1;
|
494 |
+
}
|
495 |
+
|
496 |
+
/*
|
497 |
+
----------------------------
|
498 |
+
Modal: 3D Slit
|
499 |
+
----------------------------
|
500 |
+
*/
|
501 |
+
.custombox-modal-container-slit {
|
502 |
+
perspective: 1300px;
|
503 |
+
}
|
504 |
+
.custombox-modal-slit {
|
505 |
+
transform-style: preserve-3d;
|
506 |
+
transform: translateZ(-3000px) rotateY(90deg);
|
507 |
+
opacity: 0;
|
508 |
+
}
|
509 |
+
.custombox-modal-open .custombox-modal-slit {
|
510 |
+
animation: slit .7s forwards ease-out;
|
511 |
+
}
|
512 |
+
@keyframes slit {
|
513 |
+
50% {
|
514 |
+
transform: translateZ(-250px) rotateY(89deg);
|
515 |
+
opacity: 1;
|
516 |
+
animation-timing-function: ease-out;
|
517 |
+
}
|
518 |
+
100% {
|
519 |
+
transform: translateZ(0) rotateY(0deg);
|
520 |
+
opacity: 1;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
/*
|
525 |
+
----------------------------
|
526 |
+
Modal: 3D Rotate generic
|
527 |
+
----------------------------
|
528 |
+
*/
|
529 |
+
.custombox-modal-container-rotate {
|
530 |
+
perspective: 1300px;
|
531 |
+
}
|
532 |
+
|
533 |
+
/*
|
534 |
+
----------------------------
|
535 |
+
Modal: 3D Rotate from bottom
|
536 |
+
----------------------------
|
537 |
+
*/
|
538 |
+
.custombox-modal-rotate-bottom {
|
539 |
+
transform-style: preserve-3d;
|
540 |
+
transform: translateY(100%) rotateX(90deg);
|
541 |
+
transform-origin: 0 100%;
|
542 |
+
opacity: 0;
|
543 |
+
transition-timing-function: ease-out;
|
544 |
+
transition-property: all;
|
545 |
+
position: absolute;
|
546 |
+
}
|
547 |
+
.custombox-modal-open .custombox-modal-rotate-bottom {
|
548 |
+
transform: translateY(0) rotateX(0deg);
|
549 |
+
opacity: 1;
|
550 |
+
}
|
551 |
+
|
552 |
+
/*
|
553 |
+
----------------------------
|
554 |
+
Modal: 3D Rotate from left
|
555 |
+
----------------------------
|
556 |
+
*/
|
557 |
+
.custombox-modal-rotate-left {
|
558 |
+
transform-style: preserve-3d;
|
559 |
+
transform: translateZ(100px) translateX(-30%) rotateY(90deg);
|
560 |
+
transform-origin: 0 100%;
|
561 |
+
opacity: 0;
|
562 |
+
transition-property: all;
|
563 |
+
position: absolute;
|
564 |
+
}
|
565 |
+
.custombox-modal-open .custombox-modal-rotate-left {
|
566 |
+
transform: translateZ(0) translateX(0) rotateY(0deg);
|
567 |
+
opacity: 1;
|
568 |
+
}
|
569 |
+
|
570 |
+
/*
|
571 |
+
----------------------------
|
572 |
+
Modal: Letmein
|
573 |
+
----------------------------
|
574 |
+
*/
|
575 |
+
.custombox-modal-container-letmein {
|
576 |
+
transition-property: transform;
|
577 |
+
transform: rotateX(-2deg);
|
578 |
+
transform-origin: 50% 0;
|
579 |
+
transform-style: preserve-3d;
|
580 |
+
opacity: 1;
|
581 |
+
}
|
582 |
+
.custombox-modal-letmein {
|
583 |
+
opacity: 0;
|
584 |
+
transform: translateY(300%);
|
585 |
+
float: left;
|
586 |
+
}
|
587 |
+
.custombox-modal-open .custombox-modal-letmein {
|
588 |
+
transform: translateY(0);
|
589 |
+
opacity: 1;
|
590 |
+
transition-property: all;
|
591 |
+
}
|
592 |
+
|
593 |
+
/*
|
594 |
+
----------------------------
|
595 |
+
Modal: Makeway
|
596 |
+
----------------------------
|
597 |
+
*/
|
598 |
+
.custombox-modal-makeway {
|
599 |
+
transform: translateX(200%);
|
600 |
+
opacity: 0;
|
601 |
+
float: left;
|
602 |
+
}
|
603 |
+
.custombox-modal-open .custombox-modal-makeway {
|
604 |
+
transform: translateX(0);
|
605 |
+
opacity: 1;
|
606 |
+
}
|
607 |
+
.custombox-modal-wrapper-makeway {
|
608 |
+
overflow: hidden;
|
609 |
+
}
|
610 |
+
|
611 |
+
/*
|
612 |
+
----------------------------
|
613 |
+
Modal: Slip
|
614 |
+
----------------------------
|
615 |
+
*/
|
616 |
+
.custombox-modal-slip {
|
617 |
+
transform: translateY(-350%);
|
618 |
+
}
|
619 |
+
.custombox-modal-open .custombox-modal-slip {
|
620 |
+
transform: translateY(0);
|
621 |
+
transition-property: all;
|
622 |
+
}
|
623 |
+
|
624 |
+
/*
|
625 |
+
----------------------------
|
626 |
+
Modal: Corner
|
627 |
+
----------------------------
|
628 |
+
*/
|
629 |
+
.custombox-modal-corner {
|
630 |
+
opacity: 0;
|
631 |
+
transform: translateY(150px) translateX(150px);
|
632 |
+
transition-property: opacity, transform, visibility;
|
633 |
+
}
|
634 |
+
.custombox-modal-open .custombox-modal-corner {
|
635 |
+
transform: translateY(0);
|
636 |
+
opacity: 1;
|
637 |
+
transition-property: opacity, transform;
|
638 |
+
}
|
639 |
+
|
640 |
+
/*
|
641 |
+
----------------------------
|
642 |
+
Modal: Slide together
|
643 |
+
----------------------------
|
644 |
+
*/
|
645 |
+
.custombox-modal-slidetogether {
|
646 |
+
transform: translateY(-600%);
|
647 |
+
|
648 |
+
}
|
649 |
+
.custombox-modal-open .custombox-modal-slidetogether {
|
650 |
+
transform: translateY(0);
|
651 |
+
}
|
652 |
+
|
653 |
+
/*
|
654 |
+
----------------------------
|
655 |
+
Modal: Scale
|
656 |
+
----------------------------
|
657 |
+
*/
|
658 |
+
.custombox-modal-scale {
|
659 |
+
transform: scale(0.9);
|
660 |
+
transition: transform;
|
661 |
+
opacity: 0;
|
662 |
+
}
|
663 |
+
.custombox-modal-open .custombox-modal-scale {
|
664 |
+
transform: scale(1);
|
665 |
+
transition: transform;
|
666 |
+
opacity: 1;
|
667 |
+
}
|
668 |
+
|
669 |
+
/*
|
670 |
+
----------------------------
|
671 |
+
Modal: Door
|
672 |
+
----------------------------
|
673 |
+
*/
|
674 |
+
.custombox-modal-door {
|
675 |
+
visibility: hidden;
|
676 |
+
opacity: 0;
|
677 |
+
}
|
678 |
+
.custombox-modal-open .custombox-modal-door {
|
679 |
+
opacity: 1;
|
680 |
+
visibility: visible;
|
681 |
+
}
|
682 |
+
|
683 |
+
/*
|
684 |
+
----------------------------
|
685 |
+
Modal: Push
|
686 |
+
----------------------------
|
687 |
+
*/
|
688 |
+
.custombox-modal-push {
|
689 |
+
transform: translateX(-300%);
|
690 |
+
}
|
691 |
+
.custombox-modal-open .custombox-modal-push {
|
692 |
+
transform: translateX(0);
|
693 |
+
}
|
694 |
+
|
695 |
+
/*
|
696 |
+
----------------------------
|
697 |
+
Modal: Content Scale
|
698 |
+
----------------------------
|
699 |
+
*/
|
700 |
+
.custombox-modal-contentscale {
|
701 |
+
transform: translateY(600%);
|
702 |
+
transition-property: transform ease-in-out;
|
703 |
+
position: absolute;
|
704 |
+
}
|
705 |
+
.custombox-modal-open .custombox-modal-contentscale {
|
706 |
+
transform: translateY(0);
|
707 |
+
}
|
708 |
+
|
709 |
+
/*
|
710 |
+
----------------------------
|
711 |
+
Modal: Val
|
712 |
+
----------------------------
|
713 |
+
*/
|
714 |
+
.custombox-modal-swell {
|
715 |
+
animation-duration: 0.5s;
|
716 |
+
animation-fill-mode: forwards;
|
717 |
+
animation-timing-function: ease-out;
|
718 |
+
animation-name: swell-close;
|
719 |
+
}
|
720 |
+
.custombox-modal-open .custombox-modal-swell {
|
721 |
+
animation-name: swell-open;
|
722 |
+
}
|
723 |
+
@keyframes swell-open {
|
724 |
+
0% {
|
725 |
+
opacity: 0;
|
726 |
+
transform: translate3d(calc(-100vw - 50%), 0, 0);
|
727 |
+
}
|
728 |
+
50% {
|
729 |
+
opacity: 1;
|
730 |
+
transform: translate3d(100px, 0, 0);
|
731 |
+
}
|
732 |
+
100% {
|
733 |
+
opacity: 1;
|
734 |
+
transform: translate3d(0, 0, 0);
|
735 |
+
}
|
736 |
+
}
|
737 |
+
@keyframes swell-close {
|
738 |
+
0% {
|
739 |
+
opacity: 1;
|
740 |
+
transform: translate3d(0, 0, 0);
|
741 |
+
}
|
742 |
+
50% {
|
743 |
+
opacity: 1;
|
744 |
+
transform: translate3d(-100px, 0, 0) scale3d(1.1, 1.1, 1);
|
745 |
+
}
|
746 |
+
100% {
|
747 |
+
opacity: 0;
|
748 |
+
transform: translate3d(calc(100vw + 50%), 0, 0)
|
749 |
+
}
|
750 |
+
}
|
751 |
+
|
752 |
+
/*
|
753 |
+
----------------------------
|
754 |
+
Modal: Rotate down
|
755 |
+
----------------------------
|
756 |
+
*/
|
757 |
+
.custombox-modal-rotatedown {
|
758 |
+
animation-duration: 0.4s;
|
759 |
+
animation-timing-function: cubic-bezier(0.7,0,0.3,1);
|
760 |
+
animation-fill-mode: forwards;
|
761 |
+
transform-origin: -150% 50%;
|
762 |
+
animation-name: rotatedown-close;
|
763 |
+
overflow: hidden;
|
764 |
+
}
|
765 |
+
.custombox-modal-open .custombox-modal-rotatedown {
|
766 |
+
animation-name: rotatedown-open;
|
767 |
+
}
|
768 |
+
.custombox-modal-open .custombox-modal-rotatedown div > * {
|
769 |
+
animation: rotatedown-elem 0.4s both;
|
770 |
+
transform-origin: -50% 50%;
|
771 |
+
animation-timing-function: cubic-bezier(0.7,0,0.3,1);
|
772 |
+
animation-delay: 0.15s;
|
773 |
+
}
|
774 |
+
@keyframes rotatedown-open {
|
775 |
+
0% {
|
776 |
+
opacity: 0;
|
777 |
+
transform: rotate3d(0, 0, 1, -45deg);
|
778 |
+
}
|
779 |
+
100% {
|
780 |
+
opacity: 1;
|
781 |
+
transform: rotate3d(0, 0, 1, 0deg);
|
782 |
+
}
|
783 |
+
}
|
784 |
+
@keyframes rotatedown-close {
|
785 |
+
0% {
|
786 |
+
opacity: 1;
|
787 |
+
}
|
788 |
+
100% {
|
789 |
+
opacity: 0;
|
790 |
+
transform: rotate3d(0, 0, 1, 45deg);
|
791 |
+
}
|
792 |
+
}
|
793 |
+
@keyframes rotatedown-elem {
|
794 |
+
0% {
|
795 |
+
opacity: 0;
|
796 |
+
transform: translate3d(0, -150px, 0) rotate3d(0, 0, 1, -20deg);
|
797 |
+
}
|
798 |
+
100% { opacity: 1;
|
799 |
+
transform: translate3d(0, 0, 0) rotate3d(0, 0, 1, 0deg);
|
800 |
+
}
|
801 |
+
}
|
802 |
+
|
803 |
+
/*
|
804 |
+
----------------------------
|
805 |
+
Modal: Flash
|
806 |
+
----------------------------
|
807 |
+
*/
|
808 |
+
.custombox-modal-flash {
|
809 |
+
animation-duration: 0.4s;
|
810 |
+
animation-fill-mode: forwards;
|
811 |
+
animation-timing-function: cubic-bezier(0.7,0,0.3,1);
|
812 |
+
animation-name: flash-close;
|
813 |
+
overflow: hidden;
|
814 |
+
}
|
815 |
+
.custombox-modal-open .custombox-modal-flash {
|
816 |
+
animation-name: flash-open;
|
817 |
+
}
|
818 |
+
.custombox-modal-open .custombox-modal-flash div > * {
|
819 |
+
animation: flash-elem-open 0.4s cubic-bezier(0.7,0,0.3,1) both;
|
820 |
+
}
|
821 |
+
.custombox-modal-flash div > * {
|
822 |
+
animation: flash-elem-close 0.4s cubic-bezier(0.7,0,0.3,1) both;
|
823 |
+
}
|
824 |
+
@keyframes flash-open {
|
825 |
+
0% {
|
826 |
+
opacity: 0;
|
827 |
+
transform: translate3d(-400px, 0, 0)
|
828 |
+
scale3d(1.4, 0, 1);
|
829 |
+
}
|
830 |
+
100% {
|
831 |
+
opacity: 1;
|
832 |
+
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
833 |
+
}
|
834 |
+
}
|
835 |
+
@keyframes flash-close {
|
836 |
+
0% {
|
837 |
+
opacity: 1;
|
838 |
+
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
839 |
+
}
|
840 |
+
20% {
|
841 |
+
opacity: 1;
|
842 |
+
transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
|
843 |
+
}
|
844 |
+
100% {
|
845 |
+
opacity: 0;
|
846 |
+
transform: translate3d(-400px, 0, 0) scale3d(1.4, 0, 1);
|
847 |
+
}
|
848 |
+
}
|
849 |
+
@keyframes flash-elem-open {
|
850 |
+
0% {
|
851 |
+
opacity: 0;
|
852 |
+
transform: translate3d(-100px, 0, 0);
|
853 |
+
}
|
854 |
+
20% {
|
855 |
+
opacity: 0;
|
856 |
+
transform: translate3d(-100px, 0, 0);
|
857 |
+
}
|
858 |
+
100% {
|
859 |
+
opacity: 1;
|
860 |
+
transform: translate3d(0, 0, 0);
|
861 |
+
}
|
862 |
+
}
|
863 |
+
@keyframes flash-elem-close {
|
864 |
+
0% {
|
865 |
+
opacity: 1;
|
866 |
+
transform: translate3d(0, 0, 0);
|
867 |
+
}
|
868 |
+
100% {
|
869 |
+
opacity: 0;
|
870 |
+
transform: translate3d(-100px, 0, 0);
|
871 |
+
}
|
872 |
+
}
|
css/reveal.css
CHANGED
@@ -2,65 +2,49 @@
|
|
2 |
Reveal Modals
|
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 |
-
.reveal-modal.small { width: 200px; margin-left: -140px;}
|
36 |
-
.reveal-modal.medium { width: 400px; margin-left: -240px;}
|
37 |
-
.reveal-modal.large { width: 600px; margin-left: -340px;}
|
38 |
-
.reveal-modal.xlarge { width: 800px; margin-left: -440px;}
|
39 |
-
|
40 |
-
.reveal-modal .close-reveal-modal {
|
41 |
-
font-size: 22px;
|
42 |
-
line-height: .5;
|
43 |
-
position: absolute;
|
44 |
-
top: 8px;
|
45 |
-
right: 11px;
|
46 |
-
color: #aaa;
|
47 |
-
text-shadow: 0 -1px 1px rbga(0,0,0,.6);
|
48 |
-
font-weight: bold;
|
49 |
-
cursor: pointer;
|
50 |
-
}
|
51 |
-
/*
|
52 |
-
|
53 |
-
NOTES
|
54 |
-
|
55 |
-
Close button entity is ×
|
56 |
-
|
57 |
-
Example markup
|
58 |
-
|
59 |
-
<div id="myModal" class="reveal-modal">
|
60 |
-
<h2>Awesome. I have it.</h2>
|
61 |
-
<p class="lead">Your couch. I it's mine.</p>
|
62 |
-
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam. </p>
|
63 |
-
<a class="close-reveal-modal">×</a>
|
64 |
-
</div>
|
65 |
-
|
66 |
-
*/
|
2 |
Reveal Modals
|
3 |
-------------------------------------------------- */
|
4 |
|
5 |
+
.reveal-modal-bg {
|
6 |
+
position: fixed;
|
7 |
+
height: 100%;
|
8 |
+
width: 100%;
|
9 |
+
background: #000;
|
10 |
+
background: rgba(0,0,0,.8);
|
11 |
+
z-index: 100;
|
12 |
+
display: none;
|
13 |
+
top: 0;
|
14 |
+
left: 0;
|
15 |
+
}
|
16 |
+
|
17 |
+
.reveal-modal {
|
18 |
+
visibility: hidden;
|
19 |
+
top: 100px;
|
20 |
+
left: 50%;
|
21 |
+
margin-left: -570px;
|
22 |
+
width: 1050px;
|
23 |
+
background: #eee url(modal-gloss.png) no-repeat -200px -80px;
|
24 |
+
position: absolute;
|
25 |
+
z-index: 101;
|
26 |
+
padding: 30px 40px 34px;
|
27 |
+
-moz-border-radius: 5px;
|
28 |
+
-webkit-border-radius: 5px;
|
29 |
+
border-radius: 5px;
|
30 |
+
-moz-box-shadow: 0 0 10px rgba(0,0,0,.4);
|
31 |
+
-webkit-box-shadow: 0 0 10px rgba(0,0,0,.4);
|
32 |
+
-box-shadow: 0 0 10px rgba(0,0,0,.4);
|
33 |
+
}
|
34 |
|
35 |
+
.reveal-modal.small { width: 200px; margin-left: -140px;}
|
36 |
+
.reveal-modal.medium { width: 400px; margin-left: -240px;}
|
37 |
+
.reveal-modal.large { width: 600px; margin-left: -340px;}
|
38 |
+
.reveal-modal.xlarge { width: 800px; margin-left: -440px;}
|
39 |
+
|
40 |
+
.reveal-modal .close-reveal-modal {
|
41 |
+
font-size: 22px;
|
42 |
+
line-height: .5;
|
43 |
+
position: absolute;
|
44 |
+
top: 8px;
|
45 |
+
right: 11px;
|
46 |
+
color: #aaa;
|
47 |
+
text-shadow: 0 -1px 1px rbga(0,0,0,.6);
|
48 |
+
font-weight: bold;
|
49 |
+
cursor: pointer;
|
50 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/yop-poll-donate.css
CHANGED
@@ -10,7 +10,17 @@
|
|
10 |
padding: 5px 15px 0px 15px;
|
11 |
color:#FFFFFF;
|
12 |
}
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
#donate #toggle #toggle_title{
|
15 |
width: 12em;
|
16 |
display: inline-block;
|
@@ -21,16 +31,16 @@
|
|
21 |
}
|
22 |
|
23 |
#donate .inside {
|
24 |
-
background: #
|
25 |
-
background: -moz-linear-gradient(45deg, #
|
26 |
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
|
27 |
-
background: -webkit-linear-gradient(45deg, #
|
28 |
-
background: -o-linear-gradient(45deg, #
|
29 |
-
background: -ms-linear-gradient(45deg, #
|
30 |
-
background: linear-gradient(45deg, #
|
31 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#
|
32 |
border: 1px solid #cfcccc;
|
33 |
-
color: #
|
34 |
padding: 5px 5px 20px 10px;
|
35 |
margin: 0 !important;
|
36 |
}
|
10 |
padding: 5px 15px 0px 15px;
|
11 |
color:#FFFFFF;
|
12 |
}
|
13 |
+
#donate .header {
|
14 |
+
text-align: center;
|
15 |
+
font-size: 1.25em;
|
16 |
+
font-weight: bold;
|
17 |
+
}
|
18 |
+
#donate .subheader {
|
19 |
+
text-align: left;
|
20 |
+
font-size: 1em;
|
21 |
+
font-weight: bold;
|
22 |
+
margin-left: 0.5em;
|
23 |
+
}
|
24 |
#donate #toggle #toggle_title{
|
25 |
width: 12em;
|
26 |
display: inline-block;
|
31 |
}
|
32 |
|
33 |
#donate .inside {
|
34 |
+
background: #fff; /* Old browsers */
|
35 |
+
background: -moz-linear-gradient(45deg, #fff 0%, #ffffff 100%); /* FF3.6+ */
|
36 |
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
|
37 |
+
background: -webkit-linear-gradient(45deg, #fff 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
|
38 |
+
background: -o-linear-gradient(45deg, #fff 0%,#ffffff 100%); /* Opera 11.10+ */
|
39 |
+
background: -ms-linear-gradient(45deg, #fff 0%,#ffffff 100%); /* IE10+ */
|
40 |
+
background: linear-gradient(45deg, #fff 0%,#ffffff 100%); /* W3C */
|
41 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
|
42 |
border: 1px solid #cfcccc;
|
43 |
+
color: #000;
|
44 |
padding: 5px 5px 20px 10px;
|
45 |
margin: 0 !important;
|
46 |
}
|
css/yop-poll-optin2.css
CHANGED
@@ -1,35 +1,15 @@
|
|
1 |
-
#WFItem394041 {
|
2 |
-
background: #0097e5; /* Old browsers */
|
3 |
-
background: -moz-linear-gradient(45deg, #0097e5 0%, #20b3ff 100%); /* FF3.6+ */
|
4 |
-
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#0097e5), color-stop(100%,#20b3ff)); /* Chrome,Safari4+ */
|
5 |
-
background: -webkit-linear-gradient(45deg, #0097e5 0%,#20b3ff 100%); /* Chrome10+,Safari5.1+ */
|
6 |
-
background: -o-linear-gradient(45deg, #0097e5 0%,#20b3ff 100%); /* Opera 11.10+ */
|
7 |
-
background: -ms-linear-gradient(45deg, #0097e5 0%,#20b3ff 100%); /* IE10+ */
|
8 |
-
background: linear-gradient(45deg, #0097e5 0%,#20b3ff 100%); /* W3C */
|
9 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0097e5', endColorstr='#20b3ff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
|
10 |
-
border: 1px solid #cfcccc;
|
11 |
-
color: #fff;
|
12 |
-
margin-top: 20px;
|
13 |
-
height: 190px;
|
14 |
-
position: relative;
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
@font-face {
|
19 |
font-family: Lato-Reg;
|
20 |
src: url(fonts/Lato-Reg.ttf);
|
21 |
}
|
22 |
-
|
23 |
@font-face {
|
24 |
font-family: Lato-Lig;
|
25 |
src: url(fonts/Lato-Lig.ttf);
|
26 |
}
|
27 |
-
|
28 |
@font-face {
|
29 |
font-family: Lato-Bla;
|
30 |
src: url(fonts/Lato-Bla.ttf);
|
31 |
}
|
32 |
-
|
33 |
@font-face {
|
34 |
font-family: 'FontomasCustomRegular';
|
35 |
src: url('fonts/fontomas-webfont.eot');
|
@@ -37,7 +17,6 @@
|
|
37 |
font-weight: normal;
|
38 |
font-style: normal;
|
39 |
}
|
40 |
-
|
41 |
/* Optin */
|
42 |
#WFItem394041 {
|
43 |
background: #f7f7f7; /* Old browsers */
|
@@ -54,6 +33,7 @@
|
|
54 |
box-shadow: 0px 0px 9px #dadada;
|
55 |
color: #95abb7;
|
56 |
text-align: center;
|
|
|
57 |
height: auto;
|
58 |
}
|
59 |
#WFItem394041 h1 {
|
@@ -63,11 +43,10 @@
|
|
63 |
font-family: Lato-Bla, Arial, Helvetica, sans-serif;
|
64 |
line-height: 1em;
|
65 |
}
|
66 |
-
|
67 |
#WFItem394041 label {
|
68 |
position: relative;
|
|
|
69 |
}
|
70 |
-
|
71 |
#WFItem394041 h2 {
|
72 |
font-size: 3em;
|
73 |
margin-top: 0.5em;
|
@@ -82,11 +61,12 @@
|
|
82 |
font-weight: bold;
|
83 |
color: #95abb7;
|
84 |
display: inline;
|
|
|
85 |
}
|
86 |
|
87 |
#WFItem394041 #circle {
|
88 |
border-radius: 50%;
|
89 |
-
background: #
|
90 |
position: relative;
|
91 |
margin: 0 auto;
|
92 |
width: 7.75em;
|
@@ -95,11 +75,12 @@
|
|
95 |
|
96 |
#WFItem394041 #email {
|
97 |
border-style: none;
|
98 |
-
border: 1px solid #
|
|
|
99 |
background: #fff;
|
100 |
margin-top: 0.5em;
|
101 |
padding-left: 2em;
|
102 |
-
font-size: 1.
|
103 |
font-family: Calibri, Arial, Helvetica, sans-serif;
|
104 |
color: #aeaaaa;
|
105 |
-webkit-transition: all 0.3s linear;
|
@@ -107,36 +88,20 @@
|
|
107 |
-o-transition: all 0.3s linear;
|
108 |
transition: all 0.3s linear;
|
109 |
width: 75%;
|
110 |
-
height:
|
111 |
}
|
112 |
|
113 |
#WFItem394041 #email:focus {
|
114 |
background: #f9f9f9;
|
115 |
}
|
116 |
|
117 |
-
#WFItem394041 .wf-button {
|
118 |
-
margin-top: 10px;
|
119 |
-
font-size: 1.4em;
|
120 |
-
height: 1.7em;
|
121 |
-
margin-bottom: 0.5em;
|
122 |
-
border: none;
|
123 |
-
background: #00a8ff;
|
124 |
-
color: white;
|
125 |
-
cursor: pointer;
|
126 |
-
width: 81%;
|
127 |
-
}
|
128 |
-
|
129 |
-
#WFItem394041 .wf-button:active {
|
130 |
-
background: #0098e6;
|
131 |
-
}
|
132 |
-
|
133 |
#yop-poll-close-modal-box {
|
134 |
text-decoration: none;
|
135 |
position: absolute;
|
136 |
-
color: #
|
137 |
cursor: pointer;
|
138 |
float: right;
|
139 |
-
font-size: 1.
|
140 |
height: 1em;
|
141 |
width: 1em;
|
142 |
top: 5px;
|
@@ -147,14 +112,51 @@
|
|
147 |
left: 2px;
|
148 |
content: attr(data-icon);
|
149 |
font-family: 'FontomasCustomRegular';
|
150 |
-
color: #
|
151 |
position: absolute;
|
152 |
left: 5px;
|
153 |
top: 4px;
|
154 |
width: 20px;
|
|
|
155 |
}
|
156 |
|
157 |
#poststuff h2 {
|
158 |
-
|
159 |
margin-bottom: -15px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
@font-face {
|
2 |
font-family: Lato-Reg;
|
3 |
src: url(fonts/Lato-Reg.ttf);
|
4 |
}
|
|
|
5 |
@font-face {
|
6 |
font-family: Lato-Lig;
|
7 |
src: url(fonts/Lato-Lig.ttf);
|
8 |
}
|
|
|
9 |
@font-face {
|
10 |
font-family: Lato-Bla;
|
11 |
src: url(fonts/Lato-Bla.ttf);
|
12 |
}
|
|
|
13 |
@font-face {
|
14 |
font-family: 'FontomasCustomRegular';
|
15 |
src: url('fonts/fontomas-webfont.eot');
|
17 |
font-weight: normal;
|
18 |
font-style: normal;
|
19 |
}
|
|
|
20 |
/* Optin */
|
21 |
#WFItem394041 {
|
22 |
background: #f7f7f7; /* Old browsers */
|
33 |
box-shadow: 0px 0px 9px #dadada;
|
34 |
color: #95abb7;
|
35 |
text-align: center;
|
36 |
+
max-width: 400px;
|
37 |
height: auto;
|
38 |
}
|
39 |
#WFItem394041 h1 {
|
43 |
font-family: Lato-Bla, Arial, Helvetica, sans-serif;
|
44 |
line-height: 1em;
|
45 |
}
|
|
|
46 |
#WFItem394041 label {
|
47 |
position: relative;
|
48 |
+
font-size: 1.1em;
|
49 |
}
|
|
|
50 |
#WFItem394041 h2 {
|
51 |
font-size: 3em;
|
52 |
margin-top: 0.5em;
|
61 |
font-weight: bold;
|
62 |
color: #95abb7;
|
63 |
display: inline;
|
64 |
+
line-height: 120%;
|
65 |
}
|
66 |
|
67 |
#WFItem394041 #circle {
|
68 |
border-radius: 50%;
|
69 |
+
background: #0092d5;
|
70 |
position: relative;
|
71 |
margin: 0 auto;
|
72 |
width: 7.75em;
|
75 |
|
76 |
#WFItem394041 #email {
|
77 |
border-style: none;
|
78 |
+
border: 1px solid #0092d5;
|
79 |
+
border-radius: 5px;
|
80 |
background: #fff;
|
81 |
margin-top: 0.5em;
|
82 |
padding-left: 2em;
|
83 |
+
font-size: 1.2em;
|
84 |
font-family: Calibri, Arial, Helvetica, sans-serif;
|
85 |
color: #aeaaaa;
|
86 |
-webkit-transition: all 0.3s linear;
|
88 |
-o-transition: all 0.3s linear;
|
89 |
transition: all 0.3s linear;
|
90 |
width: 75%;
|
91 |
+
height: 3em;
|
92 |
}
|
93 |
|
94 |
#WFItem394041 #email:focus {
|
95 |
background: #f9f9f9;
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
#yop-poll-close-modal-box {
|
99 |
text-decoration: none;
|
100 |
position: absolute;
|
101 |
+
color: #000;
|
102 |
cursor: pointer;
|
103 |
float: right;
|
104 |
+
font-size: 1.4em;
|
105 |
height: 1em;
|
106 |
width: 1em;
|
107 |
top: 5px;
|
112 |
left: 2px;
|
113 |
content: attr(data-icon);
|
114 |
font-family: 'FontomasCustomRegular';
|
115 |
+
color: #0092d5;
|
116 |
position: absolute;
|
117 |
left: 5px;
|
118 |
top: 4px;
|
119 |
width: 20px;
|
120 |
+
height: 2em;
|
121 |
}
|
122 |
|
123 |
#poststuff h2 {
|
|
|
124 |
margin-bottom: -15px !important;
|
125 |
+
}
|
126 |
+
.elButton {
|
127 |
+
color: #fff;
|
128 |
+
display: inline-block;
|
129 |
+
font-weight: bold;
|
130 |
+
margin-left: auto;
|
131 |
+
margin-right: auto;
|
132 |
+
text-align: center !important;
|
133 |
+
text-decoration: none !important;
|
134 |
+
}
|
135 |
+
.elButton:hover {
|
136 |
+
color: inherit;
|
137 |
+
text-decoration: none;
|
138 |
+
}
|
139 |
+
.elButton:visited, .elButton:active, .elButton:hover {
|
140 |
+
text-decoration: none !important;
|
141 |
+
}
|
142 |
+
.elButtonColor1 {
|
143 |
+
background-color: #0092d5;
|
144 |
+
}
|
145 |
+
.elButtonColor1:hover {
|
146 |
+
background-color: #0c69a8;
|
147 |
+
}
|
148 |
+
.elButtonSize2 {
|
149 |
+
border-radius: 5px;
|
150 |
+
font-size: 21px;
|
151 |
+
padding: 15px 35px;
|
152 |
+
}
|
153 |
+
.elButtonBottomBorder {
|
154 |
+
border-bottom: 3px solid rgba(0, 0, 0, 0.2);
|
155 |
+
border-left: medium none !important;
|
156 |
+
border-right: medium none !important;
|
157 |
+
}
|
158 |
+
.elButtonSub, .elButtonSub1, .elButtonSub2 {
|
159 |
+
display: block;
|
160 |
+
font-weight: normal;
|
161 |
+
opacity: 0.7;
|
162 |
}
|
css/yop-poll-wizard.css
CHANGED
@@ -268,7 +268,7 @@ http://tech-laboratory.blogspot.com
|
|
268 |
border: 1px solid #FFD700;
|
269 |
font: bold 13px Verdana, Arial, Helvetica, sans-serif;
|
270 |
color:#5A5655;
|
271 |
-
background: #FFF url(../images/
|
272 |
-moz-border-radius : 5px;
|
273 |
-webkit-border-radius: 5px;
|
274 |
z-index:998;
|
268 |
border: 1px solid #FFD700;
|
269 |
font: bold 13px Verdana, Arial, Helvetica, sans-serif;
|
270 |
color:#5A5655;
|
271 |
+
background: #FFF url(../images/loading100x1001.gif) no-repeat 5px;
|
272 |
-moz-border-radius : 5px;
|
273 |
-webkit-border-radius: 5px;
|
274 |
z-index:998;
|
inc/admin.php
CHANGED
@@ -230,9 +230,9 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
230 |
public function ajax_modal_option_signup() {
|
231 |
$optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
|
232 |
$optin_box_modal_options ['modal_had_submit'] = 'yes';
|
233 |
-
$optin_box_modal_options['modal_email']=isset($
|
234 |
-
update_option( '
|
235 |
-
die
|
236 |
}
|
237 |
public function ajax_show_optin_box_modal() {
|
238 |
$this->yop_poll_optin_form1();
|
@@ -443,12 +443,11 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
443 |
<?php
|
444 |
}
|
445 |
public function ajax_sidebar_option_signup() {
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
|
452 |
die ();
|
453 |
}
|
454 |
|
@@ -916,15 +915,15 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
916 |
<script type="text/javascript">
|
917 |
function close_window() {
|
918 |
var yop_poll_various_config = new Object();
|
919 |
-
yop_poll_various_config.poll_id = '<?php echo yop_poll_base64_decode( $_GET['poll_id'] )
|
920 |
-
yop_poll_various_config.unique_id = '<?php echo yop_poll_base64_decode( $_GET['unique_id'] )
|
921 |
-
yop_poll_various_config.poll_location = '<?php echo yop_poll_base64_decode( $_GET['poll_location'] )
|
922 |
-
yop_poll_various_config.is_modal = <?php echo ( yop_poll_base64_decode( $_GET['is_modal'] ) == 'true' ) ? 'true' : 'false' ?>;
|
923 |
-
yop_poll_various_config.vote_loading_image_target = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_target'] )
|
924 |
-
yop_poll_various_config.vote_loading_image_id = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_id'] )
|
925 |
-
yop_poll_various_config.vote_type = '<?php echo yop_poll_base64_decode( $_GET['vote_type'] )
|
926 |
-
yop_poll_various_config.facebook_user_details = '<?php echo
|
927 |
-
yop_poll_various_config.facebook_error = '<?php echo
|
928 |
yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
|
929 |
window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
|
930 |
yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
|
@@ -982,7 +981,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
982 |
yop_poll_various_config.vote_loading_image_id = '<?php echo xss_clean(yop_poll_base64_decode( $_GET['vote_loading_image_id'] )) ?>';
|
983 |
yop_poll_various_config.vote_type = '<?php echo xss_clean(yop_poll_base64_decode ( $_GET['vote_type'] ) ) ?>';
|
984 |
yop_poll_various_config.facebook_user_details = '<?php echo $facebook_user_details; ?>';
|
985 |
-
yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? $_GET['facebook_error'] : '' ?>';
|
986 |
yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
|
987 |
window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
|
988 |
yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
|
@@ -1024,30 +1023,17 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1024 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
1025 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
1026 |
<head>
|
1027 |
-
<style>
|
1028 |
-
.label-design{
|
1029 |
-
display: inline-block;
|
1030 |
-
width: 140px;
|
1031 |
-
}
|
1032 |
-
.input-design{
|
1033 |
-
background: #2ea2cc; font-size: 14px;
|
1034 |
-
background: -webkit-gradient(linear, left top, left bottom, from(#2ea2cc), to(#1e8cbe));
|
1035 |
-
background: -webkit-linear-gradient(top, #2ea2cc 0%,#1e8cbe 100%);
|
1036 |
-
background: linear-gradient(top, #2ea2cc 0%,#1e8cbe 100%);
|
1037 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#1e8cbe',GradientType=0 );
|
1038 |
-
border-color: #0074a2;
|
1039 |
-
-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
|
1040 |
-
box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
|
1041 |
-
color: #fff;
|
1042 |
-
text-decoration: none;
|
1043 |
-
text-shadow: 0 1px 0 rgba(0,86,132,0.7);
|
1044 |
-
cursor: pointer;
|
1045 |
-
}
|
1046 |
-
</style>
|
1047 |
<title><?php _e( "Insert Poll", 'yop_poll' ); ?></title>
|
1048 |
<script type="text/javascript"
|
1049 |
src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
1050 |
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
function insertYopPollTinyMce(poll_id, tr_id,show_results) {
|
1052 |
tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
|
1053 |
show_results = typeof show_results !== 'undefined' ? show_results : '';
|
@@ -1057,18 +1043,22 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1057 |
}
|
1058 |
else {
|
1059 |
if( poll_id != null && poll_id != '' ) {
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
|
|
|
|
|
|
|
|
1072 |
}
|
1073 |
else {
|
1074 |
tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll]' );
|
@@ -1077,56 +1067,133 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1077 |
}
|
1078 |
}
|
1079 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1080 |
</head>
|
1081 |
<body>
|
1082 |
-
<
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
|
|
|
|
|
|
1124 |
value="<?php _e( "Insert Poll", 'yop_poll' ); ?>"
|
1125 |
-
onclick=" insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
</p>
|
1130 |
</body>
|
1131 |
</html>
|
1132 |
<?php
|
@@ -1142,8 +1209,145 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1142 |
require_once( YOP_POLL_MODELS . 'yop_poll_model.php' );
|
1143 |
$yop_polls = Yop_Poll_Model::get_polls_for_view();
|
1144 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1145 |
<p style="text-align: center;">
|
1146 |
-
<label for="yop-poll-id-html-dialog"> <span><?php _e( '
|
1147 |
<select class="widefat" name="yop_poll_id" id="yop-poll-id-html-dialog">
|
1148 |
<option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
|
1149 |
<option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
|
@@ -1152,7 +1356,9 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1152 |
if( count( $yop_polls ) > 0 ) {
|
1153 |
foreach( $yop_polls as $yop_poll ) {
|
1154 |
?>
|
1155 |
-
<option value="<?php echo $yop_poll['ID']; ?>"
|
|
|
|
|
1156 |
<?php
|
1157 |
}
|
1158 |
}
|
@@ -1185,12 +1391,9 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1185 |
class=""
|
1186 |
value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
|
1187 |
onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value ,document.getElementById('yop-poll-tr-results-html-dialog'));"/>
|
1188 |
-
<br/>
|
1189 |
-
class=""
|
1190 |
-
value="<?php _e( 'Close', 'yop_poll' ); ?>"
|
1191 |
-
onclick="tb_remove();"/>
|
1192 |
</p>
|
1193 |
-
|
1194 |
<?php
|
1195 |
}
|
1196 |
die ();
|
@@ -1267,14 +1470,8 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
|
|
1267 |
wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
|
1268 |
|
1269 |
}
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
|
1274 |
-
|
1275 |
-
|
1276 |
$pollAdminObj->add_votes();
|
1277 |
-
|
1278 |
}
|
1279 |
|
1280 |
die();
|
230 |
public function ajax_modal_option_signup() {
|
231 |
$optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
|
232 |
$optin_box_modal_options ['modal_had_submit'] = 'yes';
|
233 |
+
$optin_box_modal_options['modal_email']=isset($_GET['email'])?$_GET['email']:"johndoe@email.com";
|
234 |
+
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
|
235 |
+
die();
|
236 |
}
|
237 |
public function ajax_show_optin_box_modal() {
|
238 |
$this->yop_poll_optin_form1();
|
443 |
<?php
|
444 |
}
|
445 |
public function ajax_sidebar_option_signup() {
|
446 |
+
$optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
|
447 |
+
$optin_box_modal_options ['sidebar_had_submit'] = 'yes';
|
448 |
+
$optin_box_modal_options ['modal_had_submit'] = 'yes';
|
449 |
+
$optin_box_modal_options['modal_email']=isset($_POST['email'])?$_POST['email']:"johndoe@email.com";
|
450 |
+
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
|
|
|
451 |
die ();
|
452 |
}
|
453 |
|
915 |
<script type="text/javascript">
|
916 |
function close_window() {
|
917 |
var yop_poll_various_config = new Object();
|
918 |
+
yop_poll_various_config.poll_id = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['poll_id'] ) ) ?>';
|
919 |
+
yop_poll_various_config.unique_id = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['unique_id'] ) ) ?>';
|
920 |
+
yop_poll_various_config.poll_location = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['poll_location'] ) ) ?>';
|
921 |
+
yop_poll_various_config.is_modal = <?php echo ( xss_clean( yop_poll_base64_decode( $_GET['is_modal'] ) ) == 'true' ) ? 'true' : 'false' ?>;
|
922 |
+
yop_poll_various_config.vote_loading_image_target = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['vote_loading_image_target'] ) ) ?>';
|
923 |
+
yop_poll_various_config.vote_loading_image_id = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['vote_loading_image_id'] ) ) ?>';
|
924 |
+
yop_poll_various_config.vote_type = '<?php echo xss_clean( yop_poll_base64_decode( $_GET['vote_type'] ) ) ?>';
|
925 |
+
yop_poll_various_config.facebook_user_details = '<?php echo $facebook_user_details; ?>';
|
926 |
+
yop_poll_various_config.facebook_error = '<?php echo $error ?>';
|
927 |
yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
|
928 |
window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
|
929 |
yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
|
981 |
yop_poll_various_config.vote_loading_image_id = '<?php echo xss_clean(yop_poll_base64_decode( $_GET['vote_loading_image_id'] )) ?>';
|
982 |
yop_poll_various_config.vote_type = '<?php echo xss_clean(yop_poll_base64_decode ( $_GET['vote_type'] ) ) ?>';
|
983 |
yop_poll_various_config.facebook_user_details = '<?php echo $facebook_user_details; ?>';
|
984 |
+
yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? xss_clean($_GET['facebook_error']) : '' ?>';
|
985 |
yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
|
986 |
window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
|
987 |
yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
|
1023 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
1024 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
1025 |
<head>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1026 |
<title><?php _e( "Insert Poll", 'yop_poll' ); ?></title>
|
1027 |
<script type="text/javascript"
|
1028 |
src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
1029 |
<script type="text/javascript">
|
1030 |
+
var yop_display_results = "-1";
|
1031 |
+
function getYOPDisplayResults(){
|
1032 |
+
var yop_results_radio = document.getElementsByName( "show_results" );
|
1033 |
+
if( yop_results_radio[1].checked ) {
|
1034 |
+
yop_display_results = "1";
|
1035 |
+
}
|
1036 |
+
}
|
1037 |
function insertYopPollTinyMce(poll_id, tr_id,show_results) {
|
1038 |
tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
|
1039 |
show_results = typeof show_results !== 'undefined' ? show_results : '';
|
1043 |
}
|
1044 |
else {
|
1045 |
if( poll_id != null && poll_id != '' ) {
|
1046 |
+
if( show_results == "-1") {
|
1047 |
+
if( tr_id != '' ) {
|
1048 |
+
tinyMCEPopup.editor.execCommand( 'mceInsertContent', false,
|
1049 |
+
'[yop_poll id="' + poll_id + '" tr_id="' +
|
1050 |
+
tr_id + '"]' );
|
1051 |
+
}
|
1052 |
+
else {
|
1053 |
+
tinyMCEPopup.editor.execCommand( 'mceInsertContent', false,
|
1054 |
+
'[yop_poll id="' + poll_id + '"]' );
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
else {
|
1058 |
+
tinyMCEPopup.editor.execCommand( 'mceInsertContent', false,
|
1059 |
+
'[yop_poll id="' + poll_id + '" show_results="' +
|
1060 |
+
show_results + '"]' );
|
1061 |
+
}
|
1062 |
}
|
1063 |
else {
|
1064 |
tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll]' );
|
1067 |
}
|
1068 |
}
|
1069 |
</script>
|
1070 |
+
<style>
|
1071 |
+
body {
|
1072 |
+
background: #ffffff 50% 50% repeat-x;
|
1073 |
+
}
|
1074 |
+
select {
|
1075 |
+
background-color: #fff;
|
1076 |
+
outline: 0;
|
1077 |
+
transition: .05s border-color ease-in-out;
|
1078 |
+
margin: 1px;
|
1079 |
+
padding: 3px 5px;
|
1080 |
+
font-size: 13px;
|
1081 |
+
line-height: 26px;
|
1082 |
+
height: 28px;
|
1083 |
+
}
|
1084 |
+
input[type="text"] {
|
1085 |
+
background-color: #fff;
|
1086 |
+
outline: 0;
|
1087 |
+
transition: .05s border-color ease-in-out;
|
1088 |
+
margin: 1px;
|
1089 |
+
padding: 3px 5px;
|
1090 |
+
font-size: 13px;
|
1091 |
+
line-height: 26px;
|
1092 |
+
height: 28px;
|
1093 |
+
}
|
1094 |
+
input[type="radio"] {
|
1095 |
+
background-color: #fff;
|
1096 |
+
outline: 0;
|
1097 |
+
transition: .05s border-color ease-in-out;
|
1098 |
+
margin: 1px;
|
1099 |
+
padding: 3px 5px;
|
1100 |
+
font-size: 13px;
|
1101 |
+
line-height: 26px;
|
1102 |
+
}
|
1103 |
+
input[type="button"] {
|
1104 |
+
color: #555;
|
1105 |
+
border-color: #ccc;
|
1106 |
+
background: #f7f7f7;
|
1107 |
+
-webkit-box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
|
1108 |
+
box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
|
1109 |
+
vertical-align: top;
|
1110 |
+
display: inline-block;
|
1111 |
+
text-decoration: none;
|
1112 |
+
font-size: 13px;
|
1113 |
+
line-height: 26px;
|
1114 |
+
height: 28px;
|
1115 |
+
margin: 0;
|
1116 |
+
padding: 0 10px 1px;
|
1117 |
+
cursor: pointer;
|
1118 |
+
border-width: 1px;
|
1119 |
+
border-style: solid;
|
1120 |
+
-webkit-appearance: none;
|
1121 |
+
-webkit-border-radius: 3px;
|
1122 |
+
border-radius: 3px;
|
1123 |
+
white-space: nowrap;
|
1124 |
+
-webkit-box-sizing: border-box;
|
1125 |
+
}
|
1126 |
+
table {
|
1127 |
+
width: 95%;
|
1128 |
+
height: 95%;
|
1129 |
+
margin: auto;
|
1130 |
+
border: 1px solid #e5e5e5;
|
1131 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
1132 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
1133 |
+
border-spacing: 0;
|
1134 |
+
width: 100%;
|
1135 |
+
clear: both;
|
1136 |
+
margin: 0;
|
1137 |
+
}
|
1138 |
+
tr {
|
1139 |
+
line-height: 40px;
|
1140 |
+
}
|
1141 |
+
td {
|
1142 |
+
padding-left: 10px;
|
1143 |
+
}
|
1144 |
+
</style>
|
1145 |
</head>
|
1146 |
<body>
|
1147 |
+
<table>
|
1148 |
+
<tr>
|
1149 |
+
<td>
|
1150 |
+
<?php _e("Poll to Display", 'yop_poll' ); ?>:
|
1151 |
+
</td>
|
1152 |
+
<td>
|
1153 |
+
<select class="widefat" name="yop_poll_id" id="yop-poll-id-dialog">
|
1154 |
+
<option value="-3"><?php _e( "Display Random Poll", 'yop_poll' ); ?></option>
|
1155 |
+
<option value="-2"><?php _e( "Display Latest Poll", 'yop_poll' ); ?></option>
|
1156 |
+
<option value="-1"><?php _e( "Display Current Active Poll", 'yop_poll' ); ?></option>
|
1157 |
+
<?php
|
1158 |
+
if( count( $yop_polls ) > 0 ) {
|
1159 |
+
foreach( $yop_polls as $yop_poll ) {
|
1160 |
+
?>
|
1161 |
+
<option value="<?php echo $yop_poll['ID']; ?>">
|
1162 |
+
<?php echo esc_html( stripslashes( $yop_poll['poll_title'] ) ); ?>
|
1163 |
+
</option>
|
1164 |
+
<?php
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
+
?>
|
1168 |
+
</select>
|
1169 |
+
</td>
|
1170 |
+
</tr>
|
1171 |
+
<tr>
|
1172 |
+
<td>
|
1173 |
+
<?php _e( "Tracking ID", 'yop_poll' ); ?>:
|
1174 |
+
</td>
|
1175 |
+
<td>
|
1176 |
+
<input type="text" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog" size="35" placeholder="Leave empty if none" />
|
1177 |
+
</td>
|
1178 |
+
</tr>
|
1179 |
+
<tr>
|
1180 |
+
<td>
|
1181 |
+
<? _e( "Display Results Only", 'yop-poll' ); ?>:
|
1182 |
+
</td>
|
1183 |
+
<td>
|
1184 |
+
<input type="radio" name="show_results" value="-1" checked="checked">No
|
1185 |
+
<input type="radio" name="show_results" value="1">Yes
|
1186 |
+
</td>
|
1187 |
+
</tr>
|
1188 |
+
<tr>
|
1189 |
+
<td colspan="2" style="text-align:center;">
|
1190 |
+
<input type="button"
|
1191 |
+
class="button button-primary input-design"
|
1192 |
value="<?php _e( "Insert Poll", 'yop_poll' ); ?>"
|
1193 |
+
onclick="getYOPDisplayResults(); insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value, yop_display_results);"/>
|
1194 |
+
</td>
|
1195 |
+
</tr>
|
1196 |
+
</table>
|
|
|
1197 |
</body>
|
1198 |
</html>
|
1199 |
<?php
|
1209 |
require_once( YOP_POLL_MODELS . 'yop_poll_model.php' );
|
1210 |
$yop_polls = Yop_Poll_Model::get_polls_for_view();
|
1211 |
?>
|
1212 |
+
<title><?php _e( "Insert Poll", 'yop_poll' ); ?></title>
|
1213 |
+
<style>
|
1214 |
+
body {
|
1215 |
+
background: #ffffff 50% 50% repeat-x;
|
1216 |
+
}
|
1217 |
+
select {
|
1218 |
+
background-color: #fff;
|
1219 |
+
outline: 0;
|
1220 |
+
transition: .05s border-color ease-in-out;
|
1221 |
+
margin: 1px;
|
1222 |
+
padding: 3px 5px;
|
1223 |
+
font-size: 13px;
|
1224 |
+
line-height: 26px;
|
1225 |
+
height: 28px;
|
1226 |
+
}
|
1227 |
+
input[type="text"] {
|
1228 |
+
background-color: #fff;
|
1229 |
+
outline: 0;
|
1230 |
+
transition: .05s border-color ease-in-out;
|
1231 |
+
margin: 1px;
|
1232 |
+
padding: 3px 5px;
|
1233 |
+
font-size: 13px;
|
1234 |
+
line-height: 26px;
|
1235 |
+
height: 28px;
|
1236 |
+
}
|
1237 |
+
input[type="radio"] {
|
1238 |
+
background-color: #fff;
|
1239 |
+
outline: 0;
|
1240 |
+
transition: .05s border-color ease-in-out;
|
1241 |
+
margin: 1px;
|
1242 |
+
padding: 3px 5px;
|
1243 |
+
font-size: 13px;
|
1244 |
+
line-height: 26px;
|
1245 |
+
}
|
1246 |
+
input[type="button"] {
|
1247 |
+
color: #555;
|
1248 |
+
border-color: #ccc;
|
1249 |
+
background: #f7f7f7;
|
1250 |
+
-webkit-box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
|
1251 |
+
box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
|
1252 |
+
vertical-align: top;
|
1253 |
+
display: inline-block;
|
1254 |
+
text-decoration: none;
|
1255 |
+
font-size: 13px;
|
1256 |
+
line-height: 26px;
|
1257 |
+
height: 28px;
|
1258 |
+
margin: 0;
|
1259 |
+
padding: 0 10px 1px;
|
1260 |
+
cursor: pointer;
|
1261 |
+
border-width: 1px;
|
1262 |
+
border-style: solid;
|
1263 |
+
-webkit-appearance: none;
|
1264 |
+
-webkit-border-radius: 3px;
|
1265 |
+
border-radius: 3px;
|
1266 |
+
white-space: nowrap;
|
1267 |
+
-webkit-box-sizing: border-box;
|
1268 |
+
}
|
1269 |
+
table {
|
1270 |
+
width: 95%;
|
1271 |
+
height: 95%;
|
1272 |
+
margin: auto;
|
1273 |
+
border: 1px solid #e5e5e5;
|
1274 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
1275 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
1276 |
+
border-spacing: 0;
|
1277 |
+
width: 100%;
|
1278 |
+
clear: both;
|
1279 |
+
margin: 0;
|
1280 |
+
}
|
1281 |
+
tr {
|
1282 |
+
line-height: 40px;
|
1283 |
+
}
|
1284 |
+
td {
|
1285 |
+
padding-left: 10px;
|
1286 |
+
}
|
1287 |
+
</style>
|
1288 |
+
<script>
|
1289 |
+
var yop_display_results = "-1";
|
1290 |
+
function getYOPDisplayResults(){
|
1291 |
+
var yop_results_radio = document.getElementsByName( "show_results" );
|
1292 |
+
if( yop_results_radio[1].checked ) {
|
1293 |
+
yop_display_results = "1";
|
1294 |
+
}
|
1295 |
+
}
|
1296 |
+
</script>
|
1297 |
+
<table>
|
1298 |
+
<tr>
|
1299 |
+
<td>
|
1300 |
+
<?php _e("Poll to Display", 'yop_poll' ); ?>:
|
1301 |
+
</td>
|
1302 |
+
<td>
|
1303 |
+
<select class="widefat" name="yop_poll_id" id="yop-poll-id-dialog">
|
1304 |
+
<option value="-3"><?php _e( "Display Random Poll", 'yop_poll' ); ?></option>
|
1305 |
+
<option value="-2"><?php _e( "Display Latest Poll", 'yop_poll' ); ?></option>
|
1306 |
+
<option value="-1"><?php _e( "Display Current Active Poll", 'yop_poll' ); ?></option>
|
1307 |
+
<?php
|
1308 |
+
if( count( $yop_polls ) > 0 ) {
|
1309 |
+
foreach( $yop_polls as $yop_poll ) {
|
1310 |
+
?>
|
1311 |
+
<option value="<?php echo $yop_poll['ID']; ?>">
|
1312 |
+
<?php echo esc_html( stripslashes( $yop_poll['poll_title'] ) ); ?>
|
1313 |
+
</option>
|
1314 |
+
<?php
|
1315 |
+
}
|
1316 |
+
}
|
1317 |
+
?>
|
1318 |
+
</select>
|
1319 |
+
</td>
|
1320 |
+
</tr>
|
1321 |
+
<tr>
|
1322 |
+
<td>
|
1323 |
+
<?php _e( "Tracking ID", 'yop_poll' ); ?>:
|
1324 |
+
</td>
|
1325 |
+
<td>
|
1326 |
+
<input type="text" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog" size="35" placeholder="Leave empty if none" />
|
1327 |
+
</td>
|
1328 |
+
</tr>
|
1329 |
+
<tr>
|
1330 |
+
<td>
|
1331 |
+
<? _e( "Display Results Only", 'yop-poll' ); ?>:
|
1332 |
+
</td>
|
1333 |
+
<td>
|
1334 |
+
<input type="radio" name="show_results" value="-1" checked="checked">No
|
1335 |
+
<input type="radio" name="show_results" value="1">Yes
|
1336 |
+
</td>
|
1337 |
+
</tr>
|
1338 |
+
<tr>
|
1339 |
+
<td colspan="2" style="text-align:center;">
|
1340 |
+
<input type="button"
|
1341 |
+
class="button"
|
1342 |
+
value="<?php _e( "Insert Poll", 'yop_poll' ); ?>"
|
1343 |
+
onclick="getYOPDisplayResults(); insertYopPoll( edCanvas, document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value, yop_display_results);" />
|
1344 |
+
</td>
|
1345 |
+
</tr>
|
1346 |
+
</table>
|
1347 |
+
|
1348 |
+
<!--
|
1349 |
<p style="text-align: center;">
|
1350 |
+
<label for="yop-poll-id-html-dialog"> <span><?php _e( 'Pollsss to Display', 'yop_poll' ); ?>:</span>
|
1351 |
<select class="widefat" name="yop_poll_id" id="yop-poll-id-html-dialog">
|
1352 |
<option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
|
1353 |
<option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
|
1356 |
if( count( $yop_polls ) > 0 ) {
|
1357 |
foreach( $yop_polls as $yop_poll ) {
|
1358 |
?>
|
1359 |
+
<option value="<?php echo $yop_poll['ID']; ?>">
|
1360 |
+
<?php echo esc_html( stripslashes( $yop_poll['poll_title'] ) ); ?>
|
1361 |
+
</option>
|
1362 |
<?php
|
1363 |
}
|
1364 |
}
|
1391 |
class=""
|
1392 |
value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
|
1393 |
onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value ,document.getElementById('yop-poll-tr-results-html-dialog'));"/>
|
1394 |
+
<br/>
|
|
|
|
|
|
|
1395 |
</p>
|
1396 |
+
-->
|
1397 |
<?php
|
1398 |
}
|
1399 |
die ();
|
1470 |
wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
|
1471 |
|
1472 |
}
|
|
|
|
|
|
|
1473 |
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
|
|
|
|
|
1474 |
$pollAdminObj->add_votes();
|
|
|
1475 |
}
|
1476 |
|
1477 |
die();
|
inc/config.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php
|
2 |
class Yop_Poll_Config {
|
3 |
protected $config;
|
4 |
public function __construct( array $config ) {
|
5 |
$this->config = $config;
|
6 |
}
|
7 |
public function __get( $name ) {
|
8 |
$value = false;
|
9 |
if ( array_key_exists( $name, $this->config ) ) {
|
10 |
$value = $this->config[ $name ];
|
11 |
}
|
12 |
return $value;
|
13 |
}
|
14 |
public function __set( $name, $value ) {
|
15 |
$this->config[ $name ] = $value;
|
16 |
}
|
17 |
}
|
|
|
|
1 |
class Yop_Poll_Config {
|
2 |
protected $config;
|
3 |
public function __construct( array $config ) {
|
4 |
$this->config = $config;
|
5 |
}
|
6 |
public function __get( $name ) {
|
7 |
$value = false;
|
8 |
if ( array_key_exists( $name, $this->config ) ) {
|
9 |
$value = $this->config[ $name ];
|
10 |
}
|
11 |
return $value;
|
12 |
}
|
13 |
public function __set( $name, $value ) {
|
14 |
$this->config[ $name ] = $value;
|
15 |
}
|
16 |
}
|
17 |
+
<?php
|
inc/logs_admin.php
CHANGED
@@ -232,7 +232,7 @@ class YOP_POLL_Logs_Admin extends YOP_POLL_Abstract_Admin{
|
|
232 |
|
233 |
if(isset($data['poll_id']))
|
234 |
$filters[0]['value']=$_REQUEST['poll_id'];
|
235 |
-
if($_REQUEST['s']!=""
|
236 |
|
237 |
$args = array(
|
238 |
'search' => array( 'fields' => array( 'poll_id' ), 'value' => isset ( $poll_id ) ? $poll_id : '' ), 'orderby' => $orderby, 'order' => $order );
|
@@ -240,7 +240,7 @@ class YOP_POLL_Logs_Admin extends YOP_POLL_Abstract_Admin{
|
|
240 |
}
|
241 |
else
|
242 |
$args = array(
|
243 |
-
'filters' => $filters,'orderby' => $
|
244 |
$total_logs=self::get_polls_logs_filter_search($args);
|
245 |
$data['total_logs']= count($total_logs);
|
246 |
$data['total_logs_pages'] = ceil( $data['total_logs'] / $data['per_page'] );
|
232 |
|
233 |
if(isset($data['poll_id']))
|
234 |
$filters[0]['value']=$_REQUEST['poll_id'];
|
235 |
+
if( ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] !="" ) || $data['log_sdate'] !="" || $data['log_edate']!="" ){
|
236 |
|
237 |
$args = array(
|
238 |
'search' => array( 'fields' => array( 'poll_id' ), 'value' => isset ( $poll_id ) ? $poll_id : '' ), 'orderby' => $orderby, 'order' => $order );
|
240 |
}
|
241 |
else
|
242 |
$args = array(
|
243 |
+
'filters' => $filters, 'orderby' => $orderby, 'order' => $order);
|
244 |
$total_logs=self::get_polls_logs_filter_search($args);
|
245 |
$data['total_logs']= count($total_logs);
|
246 |
$data['total_logs_pages'] = ceil( $data['total_logs'] / $data['per_page'] );
|
inc/maintenance.php
CHANGED
@@ -154,7 +154,7 @@ class YOP_POLL_Maintenance
|
|
154 |
function propagate_activation($networkwide)
|
155 |
{
|
156 |
if (version_compare(phpversion(), '5.3', '<')) {
|
157 |
-
wp_die("Php version
|
158 |
}
|
159 |
|
160 |
$this->network_propagate('activate', $networkwide);
|
@@ -761,6 +761,10 @@ NOWDOC;
|
|
761 |
global $wpdb;
|
762 |
update_option("yop_poll_version", '5.7.7');
|
763 |
}
|
|
|
|
|
|
|
|
|
764 |
}
|
765 |
|
766 |
private static function update_poll_template_in_database2($template)
|
154 |
function propagate_activation($networkwide)
|
155 |
{
|
156 |
if (version_compare(phpversion(), '5.3', '<')) {
|
157 |
+
wp_die("Your server is running php lower than 5.3. Please update your Php version and try again!");
|
158 |
}
|
159 |
|
160 |
$this->network_propagate('activate', $networkwide);
|
761 |
global $wpdb;
|
762 |
update_option("yop_poll_version", '5.7.7');
|
763 |
}
|
764 |
+
if (version_compare($installed_version, '5.7.7', '<=')) {
|
765 |
+
global $wpdb;
|
766 |
+
update_option("yop_poll_version", '5.7.8');
|
767 |
+
}
|
768 |
}
|
769 |
|
770 |
private static function update_poll_template_in_database2($template)
|
inc/poll_admin.php
CHANGED
@@ -73,7 +73,6 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
73 |
break;
|
74 |
|
75 |
default:
|
76 |
-
|
77 |
$this->manage_add_new();
|
78 |
break;
|
79 |
}
|
@@ -122,8 +121,6 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
122 |
}
|
123 |
|
124 |
private function manage_add_new() {
|
125 |
-
|
126 |
-
|
127 |
$this->view_add_edit( 'add' );
|
128 |
}
|
129 |
|
@@ -186,8 +183,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
186 |
$date_format="m-d-Y";
|
187 |
}
|
188 |
$data['date_format']=$date_format.' '.$time_format;
|
189 |
-
|
190 |
-
// wp_enqueue_style( 'yop-poll-admin-css', YOP_POLL_URL . 'css/yop-poll-admin.css', array(), YOP_POLL_VERSION );
|
191 |
|
192 |
wp_enqueue_style( 'yop-poll-slider-css', YOP_POLL_URL . 'css/yop-poll-slider.css', array(), YOP_POLL_VERSION );
|
193 |
|
@@ -207,9 +203,13 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
207 |
'jquery',
|
208 |
'jquery-ui-dialog'
|
209 |
), YOP_POLL_VERSION, true );
|
|
|
210 |
if ( $optin_box_modal_options['show'] == 'yes' ){
|
211 |
-
wp_enqueue_script( 'yop-poll-modal-box-js', YOP_POLL_URL."
|
212 |
-
wp_enqueue_script( 'yop-poll-modal-
|
|
|
|
|
|
|
213 |
$yop_poll_modal_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_modal_option_signup' ) );
|
214 |
wp_localize_script( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
|
215 |
$data['optin_box_modal_query'] = admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) );
|
@@ -217,43 +217,27 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
217 |
$data['optin_box_modal_query'] = add_query_arg( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
|
218 |
wp_enqueue_script( 'link' );
|
219 |
wp_enqueue_script( 'xfn' );
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
else{
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
wp_enqueue_style( 'yop-poll-view-poll-css', YOP_POLL_URL . 'css/polls/view-poll.css', array(), YOP_POLL_VERSION );
|
230 |
-
wp_enqueue_style( 'yop-poll-donate-css', YOP_POLL_URL . 'css/yop-poll-donate.css', array(), YOP_POLL_VERSION );
|
231 |
-
// wp_enqueue_style( 'yop-poll-optin2-css', YOP_POLL_URL . 'css/yop-poll-optin2.css', array(), YOP_POLL_VERSION );
|
232 |
-
wp_enqueue_script( 'link' );
|
233 |
-
wp_enqueue_script( 'xfn' );
|
234 |
-
wp_enqueue_script( 'yop-poll-optin-form', "http://app.getresponse.com/view_webform.js?wid=394041&mg_param1=1", NULL, $this->_config->version, true );
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
/* $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
|
239 |
-
if ( $optin_box_modal_options == 'no' ){
|
240 |
-
update_option( "yop_poll_optin_box_modal_options", 'no' );
|
241 |
-
|
242 |
-
wp_enqueue_script( 'yop-poll-modal-functions', YOP_POLL_URL."js/yop-poll-modal-functions.js", array( 'jquery', 'jquery-ui-dialog' ), $this->_config->version, true );
|
243 |
-
}
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
wp_enqueue_script( 'yop-poll-modal-functions', YOP_POLL_URL."js/yop-poll-modal-functions.js", array( 'jquery', 'yop-poll-modal-box-js' ), $this->_config->version, true );
|
253 |
-
$yop_poll_modal_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_modal_option_signup' ) );
|
254 |
-
wp_localize_script( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
|
255 |
-
wp_enqueue_style( 'yop-poll-modal-box-css', YOP_POLL_URL."css/jquery.modalbox-basic.css", array(), $this->_config->version );
|
256 |
-
wp_enqueue_style( 'yop-poll-modal-box-css', YOP_POLL_URL."css/jquery.modalbox-skin-precious-white.css", array(), $this->_config->version );*/
|
257 |
|
258 |
$per_page = ( isset( $_REQUEST ['per_page'] ) && intval( $_REQUEST ['per_page'] ) > 0 ) ? intval( $_REQUEST ['per_page'] ) : 100;
|
259 |
$page_no = ( isset( $_REQUEST ['page_no'] ) && intval( $_REQUEST ['page_no'] ) > 0 ) ? intval( $_REQUEST ['page_no'] ) : 1;
|
@@ -476,6 +460,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
476 |
$data['message']['error'] = $message['error'];
|
477 |
foreach( $data['results'] as &$result ) {
|
478 |
$result['votes_details'] = json_decode( $result['result_details'], true );
|
|
|
479 |
foreach( $result['votes_details'] as $question ) {
|
480 |
$vote_answer = $question['question'] . ": ";
|
481 |
foreach( $question['answers'] as $answer ) {
|
@@ -610,7 +595,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
610 |
}
|
611 |
|
612 |
|
613 |
-
$question_detail[] = array( 'other_answer' => $question->other_answers_label, 'name' => $question->question, 'answers' => $question->answers, 'custom_fields' => self::get_poll_customfields( $data['poll_id'], $question->ID ), 'custom_fields_logs_details' => $custom_fields_logs_details, 'q_id' => $question->ID, 'total_custom_fields_logs' => $data['total_custom_fields_logs'], 'cf_pagination' => $data['cf_pagination'] );
|
614 |
$data['questions_details'] = $question_detail;
|
615 |
|
616 |
unset( $custom_fields_logs_details );
|
@@ -1171,7 +1156,6 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1171 |
ORDER BY " . esc_attr( $orderby ) . " " . esc_attr( $order ) . "
|
1172 |
LIMIT %d, %d
|
1173 |
", $poll_id, $quest_id, $offset, $per_page ), ARRAY_A );
|
1174 |
-
|
1175 |
return $result;
|
1176 |
}
|
1177 |
|
@@ -1183,337 +1167,14 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1183 |
return $wpdb->get_results( $wpdb->prepare( "
|
1184 |
", $start_date, $end_date . '%' ) );
|
1185 |
}
|
1186 |
-
|
1187 |
-
/*private function view_results_votes() {
|
1188 |
-
global $message;
|
1189 |
-
|
1190 |
-
wp_enqueue_style( 'yop-poll-slider-css', YOP_POLL_URL . 'css/yop-poll-slider.css', array(), YOP_POLL_VERSION );
|
1191 |
-
|
1192 |
-
wp_enqueue_script( 'yop-poll-add-edit-js', YOP_POLL_URL . 'js/polls/yop-poll-add-edit.js', array(
|
1193 |
-
'jquery',
|
1194 |
-
'jquery-ui-sortable',
|
1195 |
-
'jquery-ui-dialog',
|
1196 |
-
), YOP_POLL_VERSION, true );
|
1197 |
-
|
1198 |
-
wp_enqueue_script( 'yop-poll-slider-js', YOP_POLL_URL . 'js/yop-poll-slider.js', array(
|
1199 |
-
'jquery',
|
1200 |
-
'jquery-ui-dialog'
|
1201 |
-
), YOP_POLL_VERSION, true );
|
1202 |
-
|
1203 |
-
wp_enqueue_script( 'yop-poll-results-votes-js', YOP_POLL_URL . '/js/polls/yop-poll-results-votes.js', array(
|
1204 |
-
'jquery',
|
1205 |
-
'jquery-ui-dialog'
|
1206 |
-
), YOP_POLL_VERSION, true );
|
1207 |
-
wp_enqueue_script( 'yop-poll-results-votes-js', YOP_POLL_URL . '/js/polls/yop-poll-results-votes.js', array(
|
1208 |
-
'jquery',
|
1209 |
-
'jquery-ui-resizable'
|
1210 |
-
), YOP_POLL_VERSION, true );
|
1211 |
-
wp_enqueue_style( 'yop-poll-add-edit-css', YOP_POLL_URL . 'css/polls/add-edit.css', array(), YOP_POLL_VERSION );
|
1212 |
-
|
1213 |
-
$data = array();
|
1214 |
-
$data['poll_url']= YOP_POLL_URL;
|
1215 |
-
$data['poll_id'] = $_REQUEST['id'];
|
1216 |
-
$current_poll = new YOP_POLL_Poll_Model( $data['poll_id'] );
|
1217 |
-
$data['poll_title'] = $current_poll->poll_name;
|
1218 |
-
$data['per_page'] = ( isset( $_REQUEST ['per_page'] ) && intval( $_REQUEST ['per_page'] ) > 0 ) ? intval( $_REQUEST ['per_page'] ) : 100;
|
1219 |
-
$data['page_no'] = ( isset( $_REQUEST ['page_no'] ) && intval( $_REQUEST ['page_no'] ) > 0 ) ? intval( $_REQUEST ['page_no'] ) : 1;
|
1220 |
-
$orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'ip' : $GLOBALS['orderby'];
|
1221 |
-
$order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
|
1222 |
-
$data['request']['s_ip'] = ( isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : '' );
|
1223 |
-
$order_fields = array(
|
1224 |
-
'vote_date',
|
1225 |
-
'user_type',
|
1226 |
-
'ip'
|
1227 |
-
);
|
1228 |
-
|
1229 |
-
$args = array(
|
1230 |
-
'poll_id' => $_REQUEST['id'],
|
1231 |
-
'return_fields' => 'COUNT(*) as total_results',
|
1232 |
-
'search' => array(
|
1233 |
-
'fields' => array( 'ip' ),
|
1234 |
-
'value' => isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : ''
|
1235 |
-
),
|
1236 |
-
'orderby' => $orderby,
|
1237 |
-
'order' => $order
|
1238 |
-
);
|
1239 |
-
$total_results = self::get_polls_results_filter_search( $args );
|
1240 |
-
if( ! isset( $total_results[0]['total_results'] ) ) {
|
1241 |
-
$total_results[0]['total_results'] = 0;
|
1242 |
-
}
|
1243 |
-
$data['total_results'] = $total_results[0]['total_results'];
|
1244 |
-
$total_results_pages = ceil( $total_results[0]['total_results'] / $data['per_page'] );
|
1245 |
-
if( intval( $data['page_no'] ) > intval( $total_results_pages ) ) {
|
1246 |
-
$data['page_no'] = 1;
|
1247 |
-
}
|
1248 |
-
$args['limit'] = ( $data['page_no'] - 1 ) * $data['per_page'] . ', ' . $data['per_page'];
|
1249 |
-
$args['return_fields'] = "*";
|
1250 |
-
$data['REQUEST'] = $_REQUEST;
|
1251 |
-
$data['orderby'] = $orderby;
|
1252 |
-
$data['order'] = $order;
|
1253 |
-
$data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
|
1254 |
-
$data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
|
1255 |
-
$data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
|
1256 |
-
$data['results'] = self::get_polls_results_for_view( $args );
|
1257 |
-
$data['total_items'] = $total_results[0]['total_results'];
|
1258 |
-
$data['current_user'] = $GLOBALS['current_user'];
|
1259 |
-
$data['message']['success'] = $message['success'];
|
1260 |
-
$data['message']['error'] = $message['error'];
|
1261 |
-
$data['poll_details'] = array(
|
1262 |
-
'name' => $current_poll->poll_title,
|
1263 |
-
'question' => $current_poll->questions
|
1264 |
-
);
|
1265 |
-
foreach( $data['results'] as &$result ) {
|
1266 |
-
$result['votes_details'] = json_decode( $result['result_details'], true );
|
1267 |
-
foreach( $result['votes_details'] as $question ) {
|
1268 |
-
$vote_answer = $question['question'] . ": ";
|
1269 |
-
foreach( $question['answers'] as $answer ) {
|
1270 |
-
$vote_answer .= $answer . ", ";
|
1271 |
-
}
|
1272 |
-
$result['vote_answers'] .= $vote_answer . ".\n";
|
1273 |
-
$result['vote_answers']=str_replace(", .",".",$result['vote_answers']);
|
1274 |
-
if( isset( $question['cf'] ) ) {
|
1275 |
-
$custom_fields_details = "";
|
1276 |
-
foreach( $question['cf'] as $cf_id ) {
|
1277 |
-
$custom_field_log = self::get_custom_field_log_by_id( $cf_id );
|
1278 |
-
$custom_field = self::get_custom_field_by_id( $custom_field_log[0]['custom_field_id'] );
|
1279 |
-
if($custom_field_log[0]['custom_field_value'])
|
1280 |
-
$custom_fields_details .= $custom_field[0]['custom_field'] . ": " . $custom_field_log[0]['custom_field_value'] . ".\n";
|
1281 |
-
|
1282 |
-
}
|
1283 |
-
$result['custom_fields'] = $custom_fields_details;
|
1284 |
-
}
|
1285 |
-
}
|
1286 |
-
}
|
1287 |
-
if( 'yes' == $data['soav'] ) {
|
1288 |
-
$data['display_other_answers_values'] = true;
|
1289 |
-
}
|
1290 |
-
else {
|
1291 |
-
$data['display_other_answers_values'] = false;
|
1292 |
-
}
|
1293 |
-
$percentages = array();
|
1294 |
-
$total_votes = array();
|
1295 |
-
$i = 0;
|
1296 |
-
foreach( $current_poll->questions as $question ) {
|
1297 |
-
$total_votes[$i] = 0;
|
1298 |
-
foreach( $question->answers as $answer ) {
|
1299 |
-
$total_votes[$i] += floatval( $answer->votes );
|
1300 |
-
}
|
1301 |
-
$i ++;
|
1302 |
-
}
|
1303 |
-
$i = 0;
|
1304 |
-
|
1305 |
-
foreach( $current_poll->questions as $question ) {
|
1306 |
-
foreach( $question->answers as $answer ) {
|
1307 |
-
if( $answer->votes > 0 ) {
|
1308 |
-
$answer->status = round( ( $answer->votes * 100 ) / $total_votes[$i], 1 );
|
1309 |
-
}
|
1310 |
-
else {
|
1311 |
-
$percentages[$i][] = 0;
|
1312 |
-
$answer->status = 0;
|
1313 |
-
|
1314 |
-
}
|
1315 |
-
}
|
1316 |
-
$i ++;
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
$data['cf_sdate'] = ( isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '' );
|
1322 |
-
$data['cf_edate'] = ( isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '' );
|
1323 |
-
$data['title'] = "Results";
|
1324 |
-
$data['custom_fields'] = array();
|
1325 |
-
|
1326 |
-
foreach( $current_poll->questions as $question ) {
|
1327 |
-
$data['cf_per_page'] = ( isset ( $_REQUEST ['cf_per_page'] ) ? intval( $_REQUEST ['cf_per_page'] ) : 100 );
|
1328 |
-
$data['cf_page_no'] = ( isset ( $_REQUEST ['cf_page_no'] ) ? ( int )$_REQUEST ['cf_page_no'] : 1 );
|
1329 |
-
|
1330 |
-
$poll_custom_fields = self::get_poll_customfields( $data['poll_id'], $question->ID );
|
1331 |
-
$custom_fields_logs = self::get_poll_customfields_logs( $data['poll_id'], $question->ID, 'vote_id', 'asc', ( $data['cf_page_no'] - 1 ) * $data['cf_per_page'], $data['cf_per_page'], $data['cf_sdate'], $data['cf_edate'] );
|
1332 |
-
unset( $column_custom_fields_ids );
|
1333 |
-
foreach( $poll_custom_fields as $custom_field ) {
|
1334 |
-
$column_custom_fields_ids [] = $custom_field ['ID'];
|
1335 |
-
|
1336 |
-
}
|
1337 |
-
if( count( $custom_fields_logs ) > 0 ) {
|
1338 |
-
foreach( $custom_fields_logs as &$logs ) {
|
1339 |
-
foreach( $column_custom_fields_ids as $custom_field_id ) {
|
1340 |
-
$vote_log_values = array();
|
1341 |
-
$vote_logs = explode( '<#!,>', $logs ['vote_log'] );
|
1342 |
-
if( count( $vote_logs ) > 0 ) {
|
1343 |
-
foreach( $vote_logs as $vote_log ) {
|
1344 |
-
$temp = explode( '<#!->', $vote_log );
|
1345 |
-
$vote_log_values [$temp [1]] = stripslashes( $temp [0] );
|
1346 |
-
}
|
1347 |
-
}
|
1348 |
-
}
|
1349 |
-
$custom_fields_logs_details[] = array(
|
1350 |
-
'vote_id' => $logs['vote_id'],
|
1351 |
-
"tr_id" => $logs['tr_id'],
|
1352 |
-
"vote_date" => $logs['vote_date'],
|
1353 |
-
"custom_fields_value" => $vote_log_values,
|
1354 |
-
'column_custom_fields_ids' => $column_custom_fields_ids,
|
1355 |
-
);
|
1356 |
-
}
|
1357 |
-
|
1358 |
-
}
|
1359 |
-
$data['total_custom_fields_logs'] = self::get_poll_total_customfields_logs( $data['poll_id'], $question->ID, $data['cf_sdate'], $data['cf_edate'] );
|
1360 |
-
$data['total_custom_fields_logs_pages'] = ceil( $data['total_custom_fields_logs'] / $data['cf_per_page'] );
|
1361 |
-
$data['column_custom_fields_ids'] = array();
|
1362 |
-
|
1363 |
-
if( intval( $data['cf_page_no'] ) > intval( $data['total_custom_fields_logs_pages'] ) ) {
|
1364 |
-
$data['cf_page_no'] = 1;
|
1365 |
-
}
|
1366 |
-
$data['cf_args'] = array(
|
1367 |
-
'base' => remove_query_arg( 'cf_page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
|
1368 |
-
'format' => '&cf_page_no=%#%',
|
1369 |
-
'total' => $data['total_custom_fields_logs_pages'],
|
1370 |
-
'current' => max( 1, $data['cf_page_no'] ),
|
1371 |
-
'prev_next' => true,
|
1372 |
-
'prev_text' => __yop_poll( '« Previous' ),
|
1373 |
-
'next_text' => __yop_poll( 'Next »' )
|
1374 |
-
);
|
1375 |
-
$data['cf_pagination'] = paginate_links( $data['cf_args'] );
|
1376 |
-
$chart_answer[$index][0][] = "Answer";
|
1377 |
-
$i = 1;
|
1378 |
-
$chart_answer[$index][0][] = "Votes";
|
1379 |
-
foreach( $question->answers as $answer ) {
|
1380 |
-
if( ( $answer->type == "other" && $data['display_other_answers_values'] == 1 ) || $answer->type != "other" ) {
|
1381 |
-
if($answer->description=="")
|
1382 |
-
$chart_answer[$index][$i][0] = $answer->answer;
|
1383 |
-
else
|
1384 |
-
$chart_answer[$index][$i][0] = $answer->description;
|
1385 |
-
$chart_answer[$index][$i][1] = (int)$answer->votes;
|
1386 |
-
$i ++;
|
1387 |
-
}
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
|
1391 |
-
$question_detail[] = array(
|
1392 |
-
'other_answer' => $question->other_answers_label,
|
1393 |
-
'name' => $question->question,
|
1394 |
-
'answers' => $question->answers,
|
1395 |
-
'custom_fields' => self::get_poll_customfields( $data['poll_id'], $question->ID ),
|
1396 |
-
'custom_fields_logs_details' => $custom_fields_logs_details,
|
1397 |
-
'q_id' => $question->ID,
|
1398 |
-
'total_custom_fields_logs' => $data['total_custom_fields_logs'],
|
1399 |
-
'cf_pagination' => $data['cf_pagination']
|
1400 |
-
);
|
1401 |
-
|
1402 |
-
$data['questions_details'] = $question_detail;
|
1403 |
-
//yop_poll_dump($data['questions_details'] = $question_detail);
|
1404 |
-
unset( $custom_fields_logs_details );
|
1405 |
-
unset( $column_custom_fields_ids );
|
1406 |
-
$index ++;
|
1407 |
-
}
|
1408 |
-
wp_localize_script( 'yop-poll-results-votes-js', 'charts_answer', $chart_answer );
|
1409 |
-
|
1410 |
-
$data['total_logs_other_answers'] = 0;
|
1411 |
-
foreach( $current_poll->questions as $question ) {
|
1412 |
-
foreach( $question->answers as $other_answer ) {
|
1413 |
-
if( $other_answer->type == 'other' ) {
|
1414 |
-
$data['total_logs_other_answers'] ++;
|
1415 |
-
}
|
1416 |
-
}
|
1417 |
-
}
|
1418 |
-
$paginate_args = array(
|
1419 |
-
'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
|
1420 |
-
'format' => '&page_no=%#%',
|
1421 |
-
'total' => $total_results_pages,
|
1422 |
-
'current' => max( 1, $data['page_no'] ),
|
1423 |
-
'prev_next' => true,
|
1424 |
-
'prev_text' => __yop_poll( '« Previous' ),
|
1425 |
-
'next_text' => __yop_poll( 'Next »' )
|
1426 |
-
);
|
1427 |
-
$_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
|
1428 |
-
$data['pagination'] = paginate_links( $paginate_args );
|
1429 |
-
$data['poll'] = new YOP_POLL_Poll_Model( $data['poll_id'] );
|
1430 |
-
$data['title'] = "Votes";
|
1431 |
-
//yop_poll_dump($data);
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
$data['poll_id'] = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
|
1439 |
-
$data['soav'] = ( isset ( $_GET ['soav'] ) ? $_GET ['soav'] : 'no' );
|
1440 |
-
$data['a'] = ( isset ( $_GET ['a'] ) ? $_GET ['a'] : 'no' );
|
1441 |
-
$current_poll = new YOP_POLL_Poll_Model( $data['poll_id'], $is_view_results = "no", $question_sort = "poll_order", $question_sort_rule = "ASC", $answer_sort = $data['results_order_by'], $answer_sort_rule = $data['results_order'] );
|
1442 |
-
$data['poll_details'] = array(
|
1443 |
-
'name' => $current_poll->poll_title,
|
1444 |
-
'question' => $current_poll->questions
|
1445 |
-
);
|
1446 |
-
|
1447 |
-
$data['q_id'] = $question->ID;
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
$poll_custom_fields = self::get_poll_customfields( $data['poll_id'], $data['q_id'] );
|
1455 |
-
|
1456 |
-
//yop_poll_dump($poll_custom_fields);
|
1457 |
-
$custom_fields_logs = self::get_poll_customfields_logs( $data['poll_id'], $data['q_id'], 'vote_id', 'asc' );
|
1458 |
-
$data['custom_fields_number'] = count( $poll_custom_fields );
|
1459 |
-
|
1460 |
-
global $wpdb;
|
1461 |
-
|
1462 |
-
foreach( $poll_custom_fields as $custom_field ) {
|
1463 |
-
$column_custom_fields_ids [] = $custom_field ['ID'];
|
1464 |
-
|
1465 |
-
$csv_header_array [] = ucfirst( $custom_field ['custom_field'] );
|
1466 |
-
}
|
1467 |
-
|
1468 |
-
$n = 0;
|
1469 |
-
if( count( $custom_fields_logs ) > 0 ) {
|
1470 |
-
$index = 1;
|
1471 |
-
foreach( $custom_fields_logs as $logs ) {
|
1472 |
-
$column_custom_fields_values = array( $index );
|
1473 |
-
foreach( $column_custom_fields_ids as $custom_field_id ) {
|
1474 |
-
$vote_log_values = array();
|
1475 |
-
$vote_logs = explode( '<#!,>', $logs ['vote_log'] );
|
1476 |
-
if( count( $vote_logs ) > 0 ) {
|
1477 |
-
foreach( $vote_logs as $vote_log ) {
|
1478 |
-
$temp = explode( '<#!->', $vote_log );
|
1479 |
-
$vote_log_values [$temp [1]] = stripslashes( $temp [0] );
|
1480 |
-
}
|
1481 |
-
}
|
1482 |
-
$column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
|
1483 |
-
}
|
1484 |
-
$column_custom_fields_values [] = stripslashes( $logs ['vote_date'] );
|
1485 |
-
$index ++;
|
1486 |
-
}
|
1487 |
-
}
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
$this->display( 'results_votes.html', $data );
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
}
|
1509 |
-
*/
|
1510 |
-
|
1511 |
private function view_results_votes() {
|
1512 |
global $message;
|
1513 |
$time_format="H:i:s";
|
1514 |
-
$options
|
1515 |
-
if($options['date_format']=="UE")
|
1516 |
-
$date_format="d-m-Y";
|
|
|
1517 |
$date_format="m-d-Y";
|
1518 |
}
|
1519 |
$data['date_format']=$date_format.' '.$time_format;
|
@@ -1543,7 +1204,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1543 |
$data['poll_title'] = $current_poll->poll_name;
|
1544 |
$data['per_page'] = ( isset( $_REQUEST ['per_page'] ) && intval( $_REQUEST ['per_page'] ) > 0 ) ? intval( $_REQUEST ['per_page'] ) : 100;
|
1545 |
$data['page_no'] = ( isset( $_REQUEST ['page_no'] ) && intval( $_REQUEST ['page_no'] ) > 0 ) ? intval( $_REQUEST ['page_no'] ) : 1;
|
1546 |
-
$orderby = ( empty ( $GLOBALS['orderby'] ) ) ? '
|
1547 |
$order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
|
1548 |
$data['request']['s_ip'] = ( isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : '' );
|
1549 |
$order_fields = array(
|
@@ -1555,7 +1216,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1555 |
'poll_id' => $_REQUEST['id'],
|
1556 |
'return_fields' => 'COUNT(*) as total_results',
|
1557 |
'search' => array(
|
1558 |
-
'fields' => array( $_REQUEST['searchbox']
|
1559 |
'value' => isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : ''
|
1560 |
),
|
1561 |
'orderby' => $orderby,
|
@@ -1583,8 +1244,10 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1583 |
$data['current_user'] = $GLOBALS['current_user'];
|
1584 |
$data['message']['success'] = $message['success'];
|
1585 |
$data['message']['error'] = $message['error'];
|
|
|
1586 |
foreach( $data['results'] as &$result ) {
|
1587 |
$result['votes_details'] = json_decode( $result['result_details'], true );
|
|
|
1588 |
foreach( $result['votes_details'] as $question ) {
|
1589 |
$vote_answer = $question['question'] . ": ";
|
1590 |
foreach( $question['answers'] as $answer ) {
|
@@ -1620,14 +1283,9 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1620 |
$data['title'] = "Votes";
|
1621 |
|
1622 |
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
wp_enqueue_script( 'yop-poll-results-votes-js', YOP_POLL_URL . '/js/polls/yop-poll-results-votes.js', array( 'jquery' ), YOP_POLL_VERSION, true );
|
1630 |
-
$index=1
|
|
|
1631 |
$data['poll_id'] = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
|
1632 |
$data['results_order_by'] = ( isset ( $_GET ['results_order_by'] ) ? $_GET ['results_order_by'] : 'id' );
|
1633 |
$data['results_order'] = ( isset ( $_GET ['results_order'] ) ? $_GET ['results_order'] : 'ASC' );
|
@@ -1719,9 +1377,11 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1719 |
}
|
1720 |
|
1721 |
|
1722 |
-
$question_detail[]
|
1723 |
$data['questions_details'] = $question_detail;
|
1724 |
-
|
|
|
|
|
1725 |
unset( $column_custom_fields_ids );
|
1726 |
$index++;
|
1727 |
}
|
@@ -1735,8 +1395,6 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
1735 |
}
|
1736 |
}
|
1737 |
}
|
1738 |
-
|
1739 |
-
|
1740 |
$this->display( 'results_votes.html', $data );
|
1741 |
|
1742 |
}
|
@@ -2068,8 +1726,8 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
2068 |
$return_fields = '*';
|
2069 |
$filters = null;
|
2070 |
$search = null;
|
2071 |
-
$orderby = '
|
2072 |
-
$order = '
|
2073 |
$limit = null;
|
2074 |
|
2075 |
if( isset( $args['return_fields'] ) ) {
|
@@ -2106,7 +1764,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
2106 |
}
|
2107 |
|
2108 |
$sql_search = '';
|
2109 |
-
if( count( $search['fields'] ) > 0 ) {
|
2110 |
foreach( $search['fields'] as $field ) {
|
2111 |
if(!isset($field) || $field=='all'){
|
2112 |
$sql_search .= $GLOBALS['wpdb']->prepare( ' `' . esc_attr( 'ip' ) . '` like \'%%%s%%\' OR', $search['value'] );
|
@@ -2122,13 +1780,11 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
2122 |
}
|
2123 |
$sql_search = ' AND ( ' . trim( $sql_search, 'OR' ) . ' ) ';
|
2124 |
}
|
2125 |
-
|
2126 |
$sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
|
2127 |
$sql_limit = '';
|
2128 |
if( $limit ) {
|
2129 |
$sql_limit = ' LIMIT ' . $limit . ' ';
|
2130 |
}
|
2131 |
-
|
2132 |
return $GLOBALS['wpdb']->get_results( $sql . $sql_filter . $sql_search . $sql_order_by . $sql_limit, ARRAY_A );
|
2133 |
}
|
2134 |
|
@@ -2175,7 +1831,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
|
|
2175 |
}
|
2176 |
|
2177 |
$sql_search = '';
|
2178 |
-
if( count( $search['fields'] ) > 0 ) {
|
2179 |
foreach( $search['fields'] as $field ) {
|
2180 |
if(!isset($field) || $field=='all'){
|
2181 |
$sql_search .= $GLOBALS['wpdb']->prepare( ' `' . esc_attr( 'ip' ) . '` like \'%%%s%%\' OR', $search['value'] );
|
73 |
break;
|
74 |
|
75 |
default:
|
|
|
76 |
$this->manage_add_new();
|
77 |
break;
|
78 |
}
|
121 |
}
|
122 |
|
123 |
private function manage_add_new() {
|
|
|
|
|
124 |
$this->view_add_edit( 'add' );
|
125 |
}
|
126 |
|
183 |
$date_format="m-d-Y";
|
184 |
}
|
185 |
$data['date_format']=$date_format.' '.$time_format;
|
186 |
+
|
|
|
187 |
|
188 |
wp_enqueue_style( 'yop-poll-slider-css', YOP_POLL_URL . 'css/yop-poll-slider.css', array(), YOP_POLL_VERSION );
|
189 |
|
203 |
'jquery',
|
204 |
'jquery-ui-dialog'
|
205 |
), YOP_POLL_VERSION, true );
|
206 |
+
|
207 |
if ( $optin_box_modal_options['show'] == 'yes' ){
|
208 |
+
wp_enqueue_script( 'yop-poll-modal-box-js', YOP_POLL_URL."js/custombox.js", array( 'jquery' ), YOP_POLL_VERSION, true );
|
209 |
+
wp_enqueue_script( 'yop-poll-modal-box-js-leg', YOP_POLL_URL."js/legacy.js", array( 'jquery' ), YOP_POLL_VERSION, true );
|
210 |
+
wp_enqueue_style( 'yop-poll-view-poll-css', YOP_POLL_URL . 'css/custombox.css', array(), YOP_POLL_VERSION );
|
211 |
+
|
212 |
+
wp_enqueue_script( 'yop-poll-modal-functions',YOP_POLL_URL."js/yop-poll-modal-functions.js", array( 'jquery', 'yop-poll-modal-box-js' ), YOP_POLL_VERSION, true );
|
213 |
$yop_poll_modal_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_modal_option_signup' ) );
|
214 |
wp_localize_script( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
|
215 |
$data['optin_box_modal_query'] = admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) );
|
217 |
$data['optin_box_modal_query'] = add_query_arg( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
|
218 |
wp_enqueue_script( 'link' );
|
219 |
wp_enqueue_script( 'xfn' );
|
220 |
+
|
221 |
+
$optin_box_modal_options ['show'] = 'no'; //restore to no
|
222 |
+
$optin_box_modal_options ['sidebar_had_submit'] = 'no';
|
223 |
+
$optin_box_modal_options ['modal_had_submit'] = 'no';
|
224 |
+
$optin_box_modal_options['modal_email']="";
|
225 |
+
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
|
226 |
}
|
227 |
else{
|
228 |
+
if($optin_box_modal_options['sidebar_had_submit'] == 'no'){
|
229 |
+
$data['ok']=1;
|
230 |
+
wp_enqueue_script( 'yop-poll-sidebar-option-functions', YOP_POLL_URL."js/yop-poll-sidebar-optin-functions.js", array( 'jquery' ), YOP_POLL_VERSION, true );
|
231 |
+
$yop_poll_sidebar_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_sidebar_option_signup' ) );
|
232 |
+
wp_localize_script( 'yop-poll-sidebar-option-functions', 'yop_poll_sidebar_functions_config', $yop_poll_sidebar_functions_config );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
+
wp_enqueue_style( 'yop-poll-view-poll-css', YOP_POLL_URL . 'css/polls/view-poll.css', array(), YOP_POLL_VERSION );
|
235 |
+
wp_enqueue_style( 'yop-poll-donate-css', YOP_POLL_URL . 'css/yop-poll-donate.css', array(), YOP_POLL_VERSION );
|
236 |
+
wp_enqueue_script( 'link' );
|
237 |
+
wp_enqueue_script( 'xfn' );
|
238 |
+
//wp_enqueue_script( 'yop-poll-optin-form', "http://app.getresponse.com/view_webform.js?wid=394041&mg_param1=1", NULL, YOP_POLL_VERSION, true );
|
239 |
+
}
|
240 |
+
}
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
$per_page = ( isset( $_REQUEST ['per_page'] ) && intval( $_REQUEST ['per_page'] ) > 0 ) ? intval( $_REQUEST ['per_page'] ) : 100;
|
243 |
$page_no = ( isset( $_REQUEST ['page_no'] ) && intval( $_REQUEST ['page_no'] ) > 0 ) ? intval( $_REQUEST ['page_no'] ) : 1;
|
460 |
$data['message']['error'] = $message['error'];
|
461 |
foreach( $data['results'] as &$result ) {
|
462 |
$result['votes_details'] = json_decode( $result['result_details'], true );
|
463 |
+
$result['vote_answers'] = '';
|
464 |
foreach( $result['votes_details'] as $question ) {
|
465 |
$vote_answer = $question['question'] . ": ";
|
466 |
foreach( $question['answers'] as $answer ) {
|
595 |
}
|
596 |
|
597 |
|
598 |
+
$question_detail[] = array( 'other_answer' => $question->other_answers_label, 'name' => $question->question, 'answers' => $question->answers, 'custom_fields' => self::get_poll_customfields( $data['poll_id'], $question->ID ), 'custom_fields_logs_details' => isset($custom_fields_logs_details)?$custom_fields_logs_details:'', 'q_id' => $question->ID, 'total_custom_fields_logs' => $data['total_custom_fields_logs'], 'cf_pagination' => $data['cf_pagination'] );
|
599 |
$data['questions_details'] = $question_detail;
|
600 |
|
601 |
unset( $custom_fields_logs_details );
|
1156 |
ORDER BY " . esc_attr( $orderby ) . " " . esc_attr( $order ) . "
|
1157 |
LIMIT %d, %d
|
1158 |
", $poll_id, $quest_id, $offset, $per_page ), ARRAY_A );
|
|
|
1159 |
return $result;
|
1160 |
}
|
1161 |
|
1167 |
return $wpdb->get_results( $wpdb->prepare( "
|
1168 |
", $start_date, $end_date . '%' ) );
|
1169 |
}
|
1170 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
private function view_results_votes() {
|
1172 |
global $message;
|
1173 |
$time_format="H:i:s";
|
1174 |
+
$options = get_option('yop_poll_options' );
|
1175 |
+
if( $options['date_format'] == "UE" )
|
1176 |
+
$date_format="d-m-Y";
|
1177 |
+
else{
|
1178 |
$date_format="m-d-Y";
|
1179 |
}
|
1180 |
$data['date_format']=$date_format.' '.$time_format;
|
1204 |
$data['poll_title'] = $current_poll->poll_name;
|
1205 |
$data['per_page'] = ( isset( $_REQUEST ['per_page'] ) && intval( $_REQUEST ['per_page'] ) > 0 ) ? intval( $_REQUEST ['per_page'] ) : 100;
|
1206 |
$data['page_no'] = ( isset( $_REQUEST ['page_no'] ) && intval( $_REQUEST ['page_no'] ) > 0 ) ? intval( $_REQUEST ['page_no'] ) : 1;
|
1207 |
+
$orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'vote_date' : $GLOBALS['orderby'];
|
1208 |
$order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
|
1209 |
$data['request']['s_ip'] = ( isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : '' );
|
1210 |
$order_fields = array(
|
1216 |
'poll_id' => $_REQUEST['id'],
|
1217 |
'return_fields' => 'COUNT(*) as total_results',
|
1218 |
'search' => array(
|
1219 |
+
'fields' => array( isset( $_REQUEST['searchbox'] ) ? $_REQUEST['searchbox']: '' ),
|
1220 |
'value' => isset ( $_REQUEST ['s_ip'] ) ? $_REQUEST ['s_ip'] : ''
|
1221 |
),
|
1222 |
'orderby' => $orderby,
|
1244 |
$data['current_user'] = $GLOBALS['current_user'];
|
1245 |
$data['message']['success'] = $message['success'];
|
1246 |
$data['message']['error'] = $message['error'];
|
1247 |
+
$data['vote_answers'] = '';
|
1248 |
foreach( $data['results'] as &$result ) {
|
1249 |
$result['votes_details'] = json_decode( $result['result_details'], true );
|
1250 |
+
$result['vote_answers'] = '';
|
1251 |
foreach( $result['votes_details'] as $question ) {
|
1252 |
$vote_answer = $question['question'] . ": ";
|
1253 |
foreach( $question['answers'] as $answer ) {
|
1283 |
$data['title'] = "Votes";
|
1284 |
|
1285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1286 |
wp_enqueue_script( 'yop-poll-results-votes-js', YOP_POLL_URL . '/js/polls/yop-poll-results-votes.js', array( 'jquery' ), YOP_POLL_VERSION, true );
|
1287 |
+
$index=1;
|
1288 |
+
$data['title'] = __( "Results" );
|
1289 |
$data['poll_id'] = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
|
1290 |
$data['results_order_by'] = ( isset ( $_GET ['results_order_by'] ) ? $_GET ['results_order_by'] : 'id' );
|
1291 |
$data['results_order'] = ( isset ( $_GET ['results_order'] ) ? $_GET ['results_order'] : 'ASC' );
|
1377 |
}
|
1378 |
|
1379 |
|
1380 |
+
$question_detail[] = array( 'other_answer' => $question->other_answers_label, 'name' => $question->question, 'answers' => $question->answers, 'custom_fields' => self::get_poll_customfields( $data['poll_id'], $question->ID ), 'custom_fields_logs_details' => isset($custom_fields_logs_details)?$custom_fields_logs_details:'', 'q_id' => $question->ID, 'total_custom_fields_logs' => $data['total_custom_fields_logs'], 'cf_pagination' => $data['cf_pagination'] );
|
1381 |
$data['questions_details'] = $question_detail;
|
1382 |
+
if( isset( $custom_fields_logs_details ) ){
|
1383 |
+
unset( $custom_fields_logs_details );
|
1384 |
+
}
|
1385 |
unset( $column_custom_fields_ids );
|
1386 |
$index++;
|
1387 |
}
|
1395 |
}
|
1396 |
}
|
1397 |
}
|
|
|
|
|
1398 |
$this->display( 'results_votes.html', $data );
|
1399 |
|
1400 |
}
|
1726 |
$return_fields = '*';
|
1727 |
$filters = null;
|
1728 |
$search = null;
|
1729 |
+
$orderby = 'vote_date';
|
1730 |
+
$order = 'DESC';
|
1731 |
$limit = null;
|
1732 |
|
1733 |
if( isset( $args['return_fields'] ) ) {
|
1764 |
}
|
1765 |
|
1766 |
$sql_search = '';
|
1767 |
+
if( ( count( $search['fields'] ) ) > 0 && ( $search['fields'][0] != "" ) ) {
|
1768 |
foreach( $search['fields'] as $field ) {
|
1769 |
if(!isset($field) || $field=='all'){
|
1770 |
$sql_search .= $GLOBALS['wpdb']->prepare( ' `' . esc_attr( 'ip' ) . '` like \'%%%s%%\' OR', $search['value'] );
|
1780 |
}
|
1781 |
$sql_search = ' AND ( ' . trim( $sql_search, 'OR' ) . ' ) ';
|
1782 |
}
|
|
|
1783 |
$sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
|
1784 |
$sql_limit = '';
|
1785 |
if( $limit ) {
|
1786 |
$sql_limit = ' LIMIT ' . $limit . ' ';
|
1787 |
}
|
|
|
1788 |
return $GLOBALS['wpdb']->get_results( $sql . $sql_filter . $sql_search . $sql_order_by . $sql_limit, ARRAY_A );
|
1789 |
}
|
1790 |
|
1831 |
}
|
1832 |
|
1833 |
$sql_search = '';
|
1834 |
+
if( ( count( $search['fields'] ) > 0 ) && ( $search['fields'][0] != "" ) ) {
|
1835 |
foreach( $search['fields'] as $field ) {
|
1836 |
if(!isset($field) || $field=='all'){
|
1837 |
$sql_search .= $GLOBALS['wpdb']->prepare( ' `' . esc_attr( 'ip' ) . '` like \'%%%s%%\' OR', $search['value'] );
|
inc/pro_admin.php
CHANGED
@@ -186,7 +186,7 @@ class YOP_POLL_Pro_Admin extends YOP_POLL_Abstract_Admin {
|
|
186 |
"action" => 'after-buy'
|
187 |
), admin_url( 'admin.php' ) ) )
|
188 |
);
|
189 |
-
$paypalUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=
|
190 |
"$redirect_url&rm=2&custom=" .
|
191 |
urlencode( $domain . ";" .
|
192 |
$rand_number. ";" .$email
|
@@ -194,7 +194,7 @@ class YOP_POLL_Pro_Admin extends YOP_POLL_Abstract_Admin {
|
|
194 |
;
|
195 |
|
196 |
echo "<p>" . __yop_poll( "
|
197 |
-
Please wait while you are being redirected to PayPal<br>If you are not redirected within 10 seconds, please click " ) .
|
198 |
"<a href='$paypalUrl'>" . __yop_poll( "here" ) . "</a></p>";
|
199 |
echo "<script>window.location = '$paypalUrl';</script>";
|
200 |
}
|
186 |
"action" => 'after-buy'
|
187 |
), admin_url( 'admin.php' ) ) )
|
188 |
);
|
189 |
+
$paypalUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVNRVF7HWHR4Q&return=" .
|
190 |
"$redirect_url&rm=2&custom=" .
|
191 |
urlencode( $domain . ";" .
|
192 |
$rand_number. ";" .$email
|
194 |
;
|
195 |
|
196 |
echo "<p>" . __yop_poll( "
|
197 |
+
Please wait while you are being redirected to PayPal<br>If you are not redirected within 10 seconds, please click " ) .
|
198 |
"<a href='$paypalUrl'>" . __yop_poll( "here" ) . "</a></p>";
|
199 |
echo "<script>window.location = '$paypalUrl';</script>";
|
200 |
}
|
inc/public-admin.php
CHANGED
@@ -34,7 +34,9 @@
|
|
34 |
$yop_poll_options = Yop_Poll_Model::get_poll_options_by_id( $yop_poll_id['ID'] );
|
35 |
|
36 |
if( 'yes' == $yop_poll_options['schedule_reset_poll_stats'] ) {
|
37 |
-
|
|
|
|
|
38 |
$unit_multiplier = 0;
|
39 |
|
40 |
switch( strtolower( trim( $yop_poll_options['schedule_reset_poll_recurring_unit'] ) ) ) {
|
@@ -191,6 +193,7 @@
|
|
191 |
public function return_yop_poll( $id, $results, $tr_id = '',$show_results="", $offset = 0 ) {
|
192 |
//$pro_options = get_option( 'yop_poll_pro_options' );
|
193 |
$options = get_option( 'yop_poll_options' );
|
|
|
194 |
require_once( YOP_POLL_MODELS . "poll_model.php" );
|
195 |
|
196 |
$poll_unique_id = uniqid( '_yp' );
|
@@ -221,40 +224,26 @@
|
|
221 |
'vote_with_wordpress_login_url' => wp_login_url( admin_url( 'admin-ajax.php?action=yop_poll_set_wordpress_vote', ( is_ssl() ? 'https' : 'http' ) ) ),
|
222 |
'vote_with_facebook_ajax_url' => admin_url( 'admin-ajax.php?action=yop_poll_set_facebook_vote', ( is_ssl() ? 'https' : 'http' ) ),
|
223 |
);
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
$vote_permisions_types += 2;
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
} else
|
244 |
-
if( in_array( 'guest', $yop_poll_model->vote_permisions ) ) {
|
245 |
-
if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)) {
|
246 |
-
|
247 |
-
$vote_permisions_types += 2;
|
248 |
-
|
249 |
-
}
|
250 |
}
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
$loading_image_src = $yop_poll_model->loading_image_url;
|
258 |
}
|
259 |
|
260 |
if( $results ) {
|
34 |
$yop_poll_options = Yop_Poll_Model::get_poll_options_by_id( $yop_poll_id['ID'] );
|
35 |
|
36 |
if( 'yes' == $yop_poll_options['schedule_reset_poll_stats'] ) {
|
37 |
+
$reset_time = new DateTime( $yop_poll_options['schedule_reset_poll_date'] );
|
38 |
+
$now_date = new DateTime(date("Y-m-d H:i:s", current_time( 'timestamp' )));
|
39 |
+
if( $reset_time -> format("Y-m-d H") == $now_date -> format("Y-m-d H") ){
|
40 |
$unit_multiplier = 0;
|
41 |
|
42 |
switch( strtolower( trim( $yop_poll_options['schedule_reset_poll_recurring_unit'] ) ) ) {
|
193 |
public function return_yop_poll( $id, $results, $tr_id = '',$show_results="", $offset = 0 ) {
|
194 |
//$pro_options = get_option( 'yop_poll_pro_options' );
|
195 |
$options = get_option( 'yop_poll_options' );
|
196 |
+
|
197 |
require_once( YOP_POLL_MODELS . "poll_model.php" );
|
198 |
|
199 |
$poll_unique_id = uniqid( '_yp' );
|
224 |
'vote_with_wordpress_login_url' => wp_login_url( admin_url( 'admin-ajax.php?action=yop_poll_set_wordpress_vote', ( is_ssl() ? 'https' : 'http' ) ) ),
|
225 |
'vote_with_facebook_ajax_url' => admin_url( 'admin-ajax.php?action=yop_poll_set_facebook_vote', ( is_ssl() ? 'https' : 'http' ) ),
|
226 |
);
|
227 |
+
$vote_permisions_types = 0;
|
228 |
+
if( in_array( 'registered', $yop_poll_model->vote_permisions ) ) {
|
229 |
+
if( 'yes' == $yop_poll_model->vote_permisions_wordpress ) {
|
230 |
+
$vote_permisions_types += 1;
|
231 |
+
}
|
232 |
+
if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)|| 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'registered', $yop_poll_model->vote_permisions)) {
|
233 |
+
$vote_permisions_types += 2;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
else
|
237 |
+
if( in_array( 'guest', $yop_poll_model->vote_permisions ) ) {
|
238 |
+
if( 'yes' == $yop_poll_model->vote_permisions_anonymous &&in_array( 'guest', $yop_poll_model->vote_permisions)) {
|
239 |
+
$vote_permisions_types += 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
+
}
|
242 |
+
if( 'yes' == $options["use_default_loading_image"] ) {
|
243 |
+
$loading_image_src = YOP_POLL_URL . 'images/loading36x36.gif';
|
244 |
+
}
|
245 |
+
else {
|
246 |
+
$loading_image_src = $options["loading_image_url"];
|
|
|
247 |
}
|
248 |
|
249 |
if( $results ) {
|
js/custombox.js
ADDED
@@ -0,0 +1,772 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( global, factory ) {
|
2 |
+
if ( typeof exports === 'object' && typeof module !== 'undefined' ) {
|
3 |
+
module.exports = factory();
|
4 |
+
} else if ( typeof define === 'function' && define.amd ) {
|
5 |
+
define(factory);
|
6 |
+
} else {
|
7 |
+
global.Custombox = factory();
|
8 |
+
}
|
9 |
+
}(this, function() {
|
10 |
+
'use strict';
|
11 |
+
/*
|
12 |
+
----------------------------
|
13 |
+
Settings
|
14 |
+
----------------------------
|
15 |
+
*/
|
16 |
+
var _defaults = {
|
17 |
+
target: null, // Set the URL, ID or Class.
|
18 |
+
cache: false, // If set to false, it will force requested pages not to be cached by the browser only when send by AJAX.
|
19 |
+
escKey: true, // Allows the user to close the modal by pressing 'ESC'.
|
20 |
+
zIndex: 9999, // Overlay z-index: Auto or number.
|
21 |
+
overlay: true, // Show the overlay.
|
22 |
+
overlayColor: '#000', // Overlay color.
|
23 |
+
overlayOpacity: 0.8, // The overlay opacity level. Range: 0 to 1.
|
24 |
+
overlayClose: true, // Allows the user to close the modal by clicking the overlay.
|
25 |
+
overlaySpeed: 300, // Sets the speed of the overlay, in milliseconds.
|
26 |
+
overlayEffect: 'auto', // Combine any of the effects.
|
27 |
+
width: null, // Set a fixed total width or 'full'.
|
28 |
+
effect: 'fadein', // fadein | slide | newspaper | fall | sidefall | blur | flip | sign | superscaled | slit | rotate | letmein | makeway | slip | corner | slidetogether | scale | door | push | contentscale | swell | rotatedown | flash.
|
29 |
+
position: ['center', 'center'], // Set position of modal. First position 'x': left, center and right. Second position 'y': top, center, bottom.
|
30 |
+
animation: null, // Only with effects: slide, flip and rotate (top, right, bottom, left and center) | (vertical or horizontal) and output position. Example: ['top', 'bottom'].
|
31 |
+
speed: 500, // Sets the speed of the transitions, in milliseconds.
|
32 |
+
loading: false, // Show loading.
|
33 |
+
open: null, // Callback that fires right before begins to open.
|
34 |
+
complete: null, // Callback that fires right after loaded content is displayed.
|
35 |
+
close: null // Callback that fires once is closed.
|
36 |
+
},
|
37 |
+
/*
|
38 |
+
----------------------------
|
39 |
+
Config
|
40 |
+
----------------------------
|
41 |
+
*/
|
42 |
+
_config = {
|
43 |
+
oldIE: navigator.appVersion.indexOf('MSIE 8.') > -1 || navigator.appVersion.indexOf('MSIE 9.') > -1, // Check if is a old IE.
|
44 |
+
oldMobile: /(iPhone|iPad|iPod)\sOS\s6/.test(navigator.userAgent), // Check if is a old browser mobile.
|
45 |
+
overlay: {
|
46 |
+
perspective: ['letmein', 'makeway', 'slip'], // Custom effects overlay.
|
47 |
+
together: ['corner', 'slidetogether', 'scale', 'door', 'push', 'contentscale', 'simplegenie', 'slit', 'slip'] // Animation together (overlay and modal).
|
48 |
+
},
|
49 |
+
modal: {
|
50 |
+
position: ['slide', 'flip', 'rotate'], // Custom animation of the modal.
|
51 |
+
animationend: ['swell', 'rotatedown', 'flash'] // Type of animation.
|
52 |
+
}
|
53 |
+
},
|
54 |
+
/*
|
55 |
+
----------------------------
|
56 |
+
Private methods
|
57 |
+
----------------------------
|
58 |
+
*/
|
59 |
+
_private = {
|
60 |
+
set: function( val ) {
|
61 |
+
if ( !this.cb || !this.cb.length ) {
|
62 |
+
this.cb = [];
|
63 |
+
this.item = -1;
|
64 |
+
}
|
65 |
+
|
66 |
+
this.item++;
|
67 |
+
|
68 |
+
if ( val && val.zIndex === 'auto' ) {
|
69 |
+
for ( var zIndex = 0, x = 0, elements = document.getElementsByTagName('*'), xLen = elements.length; x < xLen; x += 1 ) {
|
70 |
+
var value = window.getComputedStyle(elements[x]).getPropertyValue('z-index');
|
71 |
+
if ( value ) {
|
72 |
+
value =+ value;
|
73 |
+
if ( value > zIndex ) {
|
74 |
+
zIndex = value;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
val.zIndex = zIndex;
|
79 |
+
}
|
80 |
+
|
81 |
+
this.cb.push({
|
82 |
+
settings: _config.oldIE && typeof cbExtendObjects !== 'undefined' ? cbExtendObjects( {}, _defaults, val ) : Object.assign( {}, _defaults, val )
|
83 |
+
});
|
84 |
+
|
85 |
+
if ( this.cb[this.item].settings.overlayEffect === 'auto' ) {
|
86 |
+
this.cb[this.item].settings.overlayEffect = this.cb[this.item].settings.effect;
|
87 |
+
}
|
88 |
+
},
|
89 |
+
get: function() {
|
90 |
+
return this.cb[this.cb.length - 1] || null;
|
91 |
+
},
|
92 |
+
init: function() {
|
93 |
+
// Add class open.
|
94 |
+
document.documentElement.classList.add('custombox-open');
|
95 |
+
document.documentElement.classList.add('custombox-open-' + this.cb[this.item].settings.overlayEffect);
|
96 |
+
|
97 |
+
// Add class perspective.
|
98 |
+
if ( _config.overlay.perspective.indexOf( this.cb[this.item].settings.overlayEffect ) > -1 ) {
|
99 |
+
this.cb[this.item].scroll = document.documentElement && document.documentElement.scrollTop || document.body && document.body.scrollTop || 0;
|
100 |
+
document.documentElement.classList.add('custombox-perspective');
|
101 |
+
window.scrollTo(0, 0);
|
102 |
+
}
|
103 |
+
|
104 |
+
// Create main.
|
105 |
+
if ( !this.main ) {
|
106 |
+
this.built('container');
|
107 |
+
}
|
108 |
+
|
109 |
+
// Create loading.
|
110 |
+
if ( this.cb[this.item].settings.loading && this.cb[this.item].settings.loading.parent ) {
|
111 |
+
this.built('loading');
|
112 |
+
}
|
113 |
+
|
114 |
+
// Create overlay.
|
115 |
+
if ( this.cb[this.item].settings.overlay ) {
|
116 |
+
this.built('overlay').built('modal').open();
|
117 |
+
} else {
|
118 |
+
this.built('modal').open();
|
119 |
+
}
|
120 |
+
|
121 |
+
// Listeners.
|
122 |
+
this.binds();
|
123 |
+
},
|
124 |
+
built: function( item ) {
|
125 |
+
var cb;
|
126 |
+
if ( typeof this.item !== 'undefined' ) {
|
127 |
+
cb = this.cb[this.item];
|
128 |
+
}
|
129 |
+
|
130 |
+
// Container.
|
131 |
+
switch ( item ) {
|
132 |
+
case 'container':
|
133 |
+
this.main = document.createElement('div');
|
134 |
+
while ( document.body.firstChild ) {
|
135 |
+
this.main.appendChild(document.body.firstChild);
|
136 |
+
}
|
137 |
+
document.body.appendChild(this.main);
|
138 |
+
break;
|
139 |
+
case 'overlay':
|
140 |
+
if ( !cb.overlay ) {
|
141 |
+
cb.overlay = {};
|
142 |
+
}
|
143 |
+
cb.overlay = document.createElement('div');
|
144 |
+
cb.overlay.classList.add('custombox-overlay');
|
145 |
+
cb.overlay.classList.add('custombox-overlay-' + cb.settings.overlayEffect);
|
146 |
+
cb.overlay.style.zIndex = cb.settings.zIndex + 2;
|
147 |
+
cb.overlay.style.backgroundColor = cb.settings.overlayColor;
|
148 |
+
|
149 |
+
// Add class perspective.
|
150 |
+
if ( _config.overlay.perspective.indexOf( cb.settings.overlayEffect ) > -1 || _config.overlay.together.indexOf( cb.settings.overlayEffect ) > -1 ) {
|
151 |
+
cb.overlay.style.opacity = cb.settings.overlayOpacity;
|
152 |
+
} else {
|
153 |
+
cb.overlay.classList.add('custombox-overlay-default');
|
154 |
+
}
|
155 |
+
|
156 |
+
if ( _config.overlay.together.indexOf( cb.settings.overlayEffect ) > -1 ) {
|
157 |
+
cb.overlay.style.transitionDuration = cb.settings.speed + 'ms';
|
158 |
+
} else {
|
159 |
+
cb.overlay.style.transitionDuration = cb.settings.overlaySpeed + 'ms';
|
160 |
+
}
|
161 |
+
|
162 |
+
// Append overlay in to the DOM.
|
163 |
+
document.body.insertBefore(cb.overlay, document.body.lastChild.nextSibling);
|
164 |
+
break;
|
165 |
+
case 'modal':
|
166 |
+
if ( cb.settings.overlayEffect === 'push' ) {
|
167 |
+
this.main.style.transitionDuration = cb.settings.speed + 'ms';
|
168 |
+
}
|
169 |
+
|
170 |
+
this.main.classList.add('custombox-container');
|
171 |
+
this.main.classList.add('custombox-container-' + cb.settings.overlayEffect);
|
172 |
+
|
173 |
+
cb.wrapper = document.createElement('div');
|
174 |
+
cb.wrapper.classList.add('custombox-modal-wrapper');
|
175 |
+
cb.wrapper.classList.add('custombox-modal-wrapper-' + cb.settings.effect);
|
176 |
+
cb.wrapper.style.zIndex = cb.settings.zIndex + 3;
|
177 |
+
document.body.insertBefore(cb.wrapper, document.body.lastChild.nextSibling);
|
178 |
+
|
179 |
+
cb.container = document.createElement('div');
|
180 |
+
cb.container.classList.add('custombox-modal-container');
|
181 |
+
cb.container.classList.add('custombox-modal-container-' + cb.settings.effect);
|
182 |
+
cb.container.style.zIndex = cb.settings.zIndex + 4;
|
183 |
+
|
184 |
+
if ( _config.modal.position.indexOf(cb.settings.effect) > -1 && cb.settings.animation === null ) {
|
185 |
+
// Defaults.
|
186 |
+
if ( cb.settings.effect === 'slide' ) {
|
187 |
+
cb.settings.animation = ['top'];
|
188 |
+
} else if ( cb.settings.effect === 'flip' ) {
|
189 |
+
cb.settings.animation = ['horizontal'];
|
190 |
+
} else {
|
191 |
+
cb.settings.animation = ['bottom'];
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
cb.modal = document.createElement('div');
|
196 |
+
cb.modal.classList.add('custombox-modal');
|
197 |
+
cb.modal.classList.add(
|
198 |
+
'custombox-modal-' + cb.settings.effect + ( _config.modal.position.indexOf( cb.settings.effect ) > -1 ? '-' + cb.settings.animation[0].trim() : '' )
|
199 |
+
);
|
200 |
+
cb.modal.style.transitionDuration = cb.settings.speed + 'ms';
|
201 |
+
cb.modal.style.zIndex = cb.settings.zIndex + 4;
|
202 |
+
cb.wrapper.appendChild(cb.container).appendChild(cb.modal);
|
203 |
+
break;
|
204 |
+
case 'loading':
|
205 |
+
this.loading = document.createElement('div');
|
206 |
+
this.loading.classList.add('custombox-loading');
|
207 |
+
|
208 |
+
var wrapper = document.createElement('div');
|
209 |
+
for ( var i = 0, t = this.cb[this.item].settings.loading.parent.length; i < t; i++ ) {
|
210 |
+
wrapper.classList.add(this.cb[this.item].settings.loading.parent[i]);
|
211 |
+
}
|
212 |
+
|
213 |
+
this.loading.appendChild(wrapper);
|
214 |
+
this.loading.style.zIndex = cb.settings.zIndex + 3;
|
215 |
+
|
216 |
+
if ( this.cb[this.item].settings.loading.childrens ) {
|
217 |
+
for ( var e = 0, te = this.cb[this.item].settings.loading.childrens.length; e < te; e++ ) {
|
218 |
+
var tmp = document.createElement('div');
|
219 |
+
for ( var r = 0, tr = this.cb[this.item].settings.loading.childrens[e].length; r < tr; r++ ) {
|
220 |
+
tmp.classList.add(this.cb[this.item].settings.loading.childrens[e][r]);
|
221 |
+
}
|
222 |
+
wrapper.appendChild(tmp);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
document.body.appendChild(this.loading);
|
227 |
+
break;
|
228 |
+
}
|
229 |
+
|
230 |
+
return this;
|
231 |
+
},
|
232 |
+
load: function() {
|
233 |
+
var cb = this.cb[this.item];
|
234 |
+
|
235 |
+
// Check if callback 'open'.
|
236 |
+
if ( typeof cb.settings.open === 'function' ) {
|
237 |
+
cb.settings.open.call();
|
238 |
+
}
|
239 |
+
|
240 |
+
// Trigger open.
|
241 |
+
if ( document.createEvent ) {
|
242 |
+
var topen = document.createEvent('Event');
|
243 |
+
topen.initEvent('custombox.open', true, true);
|
244 |
+
document.dispatchEvent(topen);
|
245 |
+
}
|
246 |
+
|
247 |
+
// Convert the string to array.
|
248 |
+
if ( cb.settings.target !== null && Array.isArray(cb.settings.position) ) {
|
249 |
+
if ( cb.settings.target.charAt(0) === '#' || ( cb.settings.target.charAt(0) === '.' && cb.settings.target.charAt(1) !== '/' ) ) {
|
250 |
+
if ( document.querySelector(cb.settings.target) ) {
|
251 |
+
cb.inline = document.createElement('div');
|
252 |
+
cb.content = document.querySelector(cb.settings.target);
|
253 |
+
cb.display = cb.content.style.display === 'none';
|
254 |
+
cb.content.style.display = 'block';
|
255 |
+
cb.content.parentNode.insertBefore(cb.inline, cb.content);
|
256 |
+
this.size();
|
257 |
+
} else {
|
258 |
+
this.error();
|
259 |
+
}
|
260 |
+
} else {
|
261 |
+
this.ajax();
|
262 |
+
}
|
263 |
+
} else {
|
264 |
+
this.error();
|
265 |
+
}
|
266 |
+
return this;
|
267 |
+
},
|
268 |
+
size: function() {
|
269 |
+
var cb = this.cb[this.item],
|
270 |
+
customw = cb.content.offsetWidth;
|
271 |
+
|
272 |
+
if ( _config.oldIE ) {
|
273 |
+
window.innerHeight = document.documentElement.clientHeight;
|
274 |
+
}
|
275 |
+
|
276 |
+
if ( !cb.inline ) {
|
277 |
+
if ( _config.oldIE ) {
|
278 |
+
cb.content.style.styleFloat = 'none';
|
279 |
+
} else {
|
280 |
+
cb.content.style.cssFloat = 'none';
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
// Check width.
|
285 |
+
if ( cb.settings.width !== null ) {
|
286 |
+
if ( !isNaN( cb.settings.width ) ) {
|
287 |
+
customw = parseInt( cb.settings.width, 0);
|
288 |
+
} else {
|
289 |
+
customw = window.innerWidth;
|
290 |
+
cb.content.style.height = window.innerHeight + 'px';
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
// Storage.
|
295 |
+
cb.size = customw;
|
296 |
+
|
297 |
+
// Width.
|
298 |
+
if ( cb.size + 60 >= window.innerWidth ) {
|
299 |
+
cb.container.style.width = 'auto';
|
300 |
+
if ( cb.settings.width !== 'full' ) {
|
301 |
+
cb.container.style.margin = '5%';
|
302 |
+
}
|
303 |
+
cb.wrapper.style.width = window.innerWidth + 'px';
|
304 |
+
for ( var i = 0, elements = cb.content.querySelectorAll(':scope > *'), t = elements.length; i < t; i++ ) {
|
305 |
+
if ( elements[i].offsetWidth > window.innerWidth ) {
|
306 |
+
elements[i].style.width = 'auto';
|
307 |
+
}
|
308 |
+
}
|
309 |
+
} else {
|
310 |
+
switch ( cb.settings.position[0].trim() ) {
|
311 |
+
case 'left':
|
312 |
+
cb.container.style.marginLeft = 0;
|
313 |
+
break;
|
314 |
+
case 'right':
|
315 |
+
cb.container.style.marginRight = 0;
|
316 |
+
break;
|
317 |
+
}
|
318 |
+
cb.container.style.width = cb.size + 'px';
|
319 |
+
}
|
320 |
+
|
321 |
+
cb.content.style.width = 'auto';
|
322 |
+
cb.modal.appendChild(cb.content);
|
323 |
+
|
324 |
+
// Top.
|
325 |
+
if ( cb.content.offsetHeight >= window.innerHeight && cb.settings.width !== 'full' ) {
|
326 |
+
cb.container.style.marginTop = '5%';
|
327 |
+
cb.container.style.marginBottom = '5%';
|
328 |
+
} else {
|
329 |
+
var result;
|
330 |
+
switch ( cb.settings.position[1].trim() ) {
|
331 |
+
case 'top':
|
332 |
+
result = 0;
|
333 |
+
break;
|
334 |
+
case 'bottom':
|
335 |
+
result = window.innerHeight - cb.content.offsetHeight + 'px';
|
336 |
+
break;
|
337 |
+
default:
|
338 |
+
result = window.innerHeight / 2 - cb.content.offsetHeight / 2 + 'px';
|
339 |
+
break;
|
340 |
+
}
|
341 |
+
cb.container.style.marginTop = result;
|
342 |
+
}
|
343 |
+
|
344 |
+
if ( this.loading ) {
|
345 |
+
document.body.removeChild(this.loading);
|
346 |
+
delete this.loading;
|
347 |
+
}
|
348 |
+
cb.wrapper.classList.add('custombox-modal-open');
|
349 |
+
},
|
350 |
+
ajax: function() {
|
351 |
+
var _this = this,
|
352 |
+
cb = _this.cb[_this.item],
|
353 |
+
xhr = new XMLHttpRequest(),
|
354 |
+
modal = document.createElement('div');
|
355 |
+
|
356 |
+
xhr.onreadystatechange = function() {
|
357 |
+
if ( xhr.readyState === 4 ) {
|
358 |
+
if( xhr.status === 200 ) {
|
359 |
+
modal.innerHTML = xhr.responseText;
|
360 |
+
cb.content = modal;
|
361 |
+
cb.content.style.display = 'block';
|
362 |
+
if ( _config.oldIE ) {
|
363 |
+
cb.content.style.styleFloat = 'left';
|
364 |
+
} else {
|
365 |
+
cb.content.style.cssFloat = 'left';
|
366 |
+
}
|
367 |
+
cb.container.appendChild(cb.content);
|
368 |
+
_this.size();
|
369 |
+
} else {
|
370 |
+
_this.error();
|
371 |
+
}
|
372 |
+
}
|
373 |
+
};
|
374 |
+
xhr.open('GET', cb.settings.target + ( cb.settings.cache ? '' : ( /[?].+=/.test(cb.settings.target) ? '&_=' : '?_=' ) + Date.now() ), true);
|
375 |
+
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
376 |
+
xhr.send(null);
|
377 |
+
},
|
378 |
+
scrollbar: function() {
|
379 |
+
var scrollDiv = document.createElement('div');
|
380 |
+
scrollDiv.classList.add('custombox-scrollbar');
|
381 |
+
document.body.appendChild(scrollDiv);
|
382 |
+
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
383 |
+
document.body.removeChild(scrollDiv);
|
384 |
+
return scrollbarWidth;
|
385 |
+
},
|
386 |
+
open: function() {
|
387 |
+
var _this = this,
|
388 |
+
delay = 0,
|
389 |
+
cb = _this.cb[_this.item],
|
390 |
+
scrollbar = _this.scrollbar();
|
391 |
+
|
392 |
+
if ( scrollbar ) {
|
393 |
+
document.body.style.paddingRight = scrollbar + 'px';
|
394 |
+
}
|
395 |
+
|
396 |
+
_this.main.classList.add('custombox-container-open');
|
397 |
+
|
398 |
+
// Loading delay.
|
399 |
+
if ( _this.cb[_this.item].settings.loading ) {
|
400 |
+
if ( _this.cb[_this.item].settings.loading.delay && !isNaN( _this.cb[_this.item].settings.loading.delay * 1 ) ) {
|
401 |
+
delay = _this.cb[_this.item].settings.loading.delay * 1;
|
402 |
+
} else {
|
403 |
+
delay = 1000;
|
404 |
+
}
|
405 |
+
}
|
406 |
+
|
407 |
+
var open = function(listener) {
|
408 |
+
if ( listener ) {
|
409 |
+
cb.overlay.removeEventListener('transitionend', open);
|
410 |
+
}
|
411 |
+
|
412 |
+
// Load target.
|
413 |
+
_this.load();
|
414 |
+
|
415 |
+
if ( cb.inline) {
|
416 |
+
cb.wrapper.classList.add('custombox-modal-open');
|
417 |
+
}
|
418 |
+
};
|
419 |
+
|
420 |
+
if ( cb.settings.overlay ) {
|
421 |
+
if ( _config.overlay.perspective.indexOf(cb.settings.overlayEffect) > -1 || _config.overlay.together.indexOf( cb.settings.overlayEffect ) > -1 ) {
|
422 |
+
// Add class perspective.
|
423 |
+
cb.overlay.classList.add('custombox-overlay-open');
|
424 |
+
} else {
|
425 |
+
cb.overlay.style.opacity = cb.settings.overlayOpacity;
|
426 |
+
}
|
427 |
+
|
428 |
+
if ( _this.cb[_this.item].settings.loading ) {
|
429 |
+
setTimeout(open, delay);
|
430 |
+
} else {
|
431 |
+
if ( _config.overlay.together.indexOf( cb.settings.overlayEffect ) > -1 || _config.oldIE ) {
|
432 |
+
open(false);
|
433 |
+
} else {
|
434 |
+
cb.overlay.addEventListener('transitionend', open, false);
|
435 |
+
}
|
436 |
+
}
|
437 |
+
} else {
|
438 |
+
if ( _this.cb[_this.item].settings.loading ) {
|
439 |
+
setTimeout(open, delay);
|
440 |
+
} else {
|
441 |
+
open(false);
|
442 |
+
}
|
443 |
+
}
|
444 |
+
return _this;
|
445 |
+
},
|
446 |
+
clean: function( item ) {
|
447 |
+
var _this = this,
|
448 |
+
cb = this.cb[item];
|
449 |
+
|
450 |
+
document.documentElement.classList.remove('custombox-open-' + cb.settings.overlayEffect);
|
451 |
+
|
452 |
+
if ( cb.settings.overlay ) {
|
453 |
+
if ( cb.overlay.style.opacity ) {
|
454 |
+
cb.overlay.style.opacity = 0;
|
455 |
+
}
|
456 |
+
|
457 |
+
cb.overlay.classList.remove('custombox-overlay-open');
|
458 |
+
_this.main.classList.remove('custombox-container-open');
|
459 |
+
}
|
460 |
+
|
461 |
+
// Listener overlay.
|
462 |
+
if ( _config.oldIE || _config.oldMobile || !cb.overlay ) {
|
463 |
+
_this.remove(item);
|
464 |
+
} else {
|
465 |
+
var overlay = function() {
|
466 |
+
cb.overlay.removeEventListener('transitionend', overlay);
|
467 |
+
_this.remove(item);
|
468 |
+
};
|
469 |
+
cb.overlay.addEventListener('transitionend', overlay, false);
|
470 |
+
}
|
471 |
+
},
|
472 |
+
remove: function( item ) {
|
473 |
+
var _this = this,
|
474 |
+
cb = this.cb[item];
|
475 |
+
|
476 |
+
if ( !cb ) {
|
477 |
+
return;
|
478 |
+
}
|
479 |
+
|
480 |
+
// Remove classes from html tag.
|
481 |
+
if ( _this.cb.length === 1 ) {
|
482 |
+
document.documentElement.classList.remove('custombox-open', 'custombox-perspective');
|
483 |
+
if ( _this.scrollbar() ) {
|
484 |
+
document.body.style.paddingRight = 0;
|
485 |
+
}
|
486 |
+
|
487 |
+
if ( typeof cb.scroll !== 'undefined' ) {
|
488 |
+
window.scrollTo(0, cb.scroll);
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
if ( cb.inline ) {
|
493 |
+
// Remove property width and display.
|
494 |
+
if ( _config.oldIE ) {
|
495 |
+
cb.content.style.removeAttribute('width');
|
496 |
+
cb.content.style.removeAttribute('height');
|
497 |
+
cb.content.style.removeAttribute('display');
|
498 |
+
} else {
|
499 |
+
cb.content.style.removeProperty('width');
|
500 |
+
cb.content.style.removeProperty('height');
|
501 |
+
cb.content.style.removeProperty('display');
|
502 |
+
}
|
503 |
+
|
504 |
+
if ( cb.display ) {
|
505 |
+
cb.content.style.display = 'none';
|
506 |
+
}
|
507 |
+
|
508 |
+
// Insert restore div.
|
509 |
+
cb.inline.parentNode.replaceChild(cb.content, cb.inline);
|
510 |
+
}
|
511 |
+
|
512 |
+
_this.main.classList.remove('custombox-container-' + cb.settings.overlayEffect);
|
513 |
+
|
514 |
+
// Remove modal.
|
515 |
+
cb.wrapper.parentNode.removeChild(cb.wrapper);
|
516 |
+
|
517 |
+
// Remove overlay.
|
518 |
+
if ( cb.settings.overlay ) {
|
519 |
+
cb.overlay.parentNode.removeChild(cb.overlay);
|
520 |
+
}
|
521 |
+
|
522 |
+
// Trigger close.
|
523 |
+
if ( document.createEvent ) {
|
524 |
+
var tclose = document.createEvent('Event');
|
525 |
+
tclose.initEvent('custombox.close', true, true);
|
526 |
+
document.dispatchEvent(tclose);
|
527 |
+
}
|
528 |
+
|
529 |
+
// Unwrap.
|
530 |
+
if ( _this.cb.length === 1 ) {
|
531 |
+
for ( var contents = document.querySelectorAll('.custombox-container > *'), i = 0, t = contents.length; i < t; i++ ) {
|
532 |
+
document.body.insertBefore(contents[i], _this.main);
|
533 |
+
}
|
534 |
+
if ( _this.main.parentNode ) {
|
535 |
+
_this.main.parentNode.removeChild(_this.main);
|
536 |
+
}
|
537 |
+
delete _this.main;
|
538 |
+
}
|
539 |
+
|
540 |
+
// Remove items.
|
541 |
+
_this.cb.splice(item, 1);
|
542 |
+
|
543 |
+
// Callback close.
|
544 |
+
if ( typeof cb.settings.close === 'function' ) {
|
545 |
+
cb.settings.close.call();
|
546 |
+
}
|
547 |
+
},
|
548 |
+
close: function( target, callback ) {
|
549 |
+
var _this = this,
|
550 |
+
item;
|
551 |
+
|
552 |
+
if ( target ) {
|
553 |
+
for ( var i = 0, t = this.cb.length; i < t; i++ ) {
|
554 |
+
if ( this.cb[i].settings.target === target ) {
|
555 |
+
item = i;
|
556 |
+
break;
|
557 |
+
}
|
558 |
+
}
|
559 |
+
} else {
|
560 |
+
item = _this.cb.length - 1;
|
561 |
+
}
|
562 |
+
|
563 |
+
var cb = _this.cb[item];
|
564 |
+
|
565 |
+
if ( typeof callback === 'function' ) {
|
566 |
+
cb.settings.close = callback;
|
567 |
+
}
|
568 |
+
|
569 |
+
// Modal
|
570 |
+
if ( _config.modal.position.indexOf( cb.settings.effect ) > -1 && cb.settings.animation.length > 1 ) {
|
571 |
+
cb.modal.classList.remove('custombox-modal-' + cb.settings.effect + '-' + cb.settings.animation[0]);
|
572 |
+
cb.modal.classList.add('custombox-modal-' + cb.settings.effect + '-' + cb.settings.animation[1].trim());
|
573 |
+
}
|
574 |
+
|
575 |
+
// Remove classes.
|
576 |
+
cb.wrapper.classList.remove('custombox-modal-open');
|
577 |
+
|
578 |
+
if ( _config.oldIE || _config.oldMobile || _config.overlay.together.indexOf( cb.settings.overlayEffect ) > -1 ) {
|
579 |
+
_this.clean(item);
|
580 |
+
} else {
|
581 |
+
// Listener wrapper.
|
582 |
+
var wrapper = function() {
|
583 |
+
cb.wrapper.removeEventListener('transitionend', wrapper);
|
584 |
+
_this.clean(item);
|
585 |
+
};
|
586 |
+
|
587 |
+
if ( _config.modal.animationend.indexOf(cb.settings.effect) > -1 ) {
|
588 |
+
cb.wrapper.addEventListener('animationend', wrapper, false);
|
589 |
+
} else {
|
590 |
+
cb.wrapper.addEventListener('transitionend', wrapper, false);
|
591 |
+
}
|
592 |
+
}
|
593 |
+
},
|
594 |
+
responsive: function() {
|
595 |
+
if ( _config.oldIE ) {
|
596 |
+
window.innerHeight = document.documentElement.clientHeight;
|
597 |
+
}
|
598 |
+
|
599 |
+
for ( var i = 0, t = this.cb.length, result; i < t; i++ ) {
|
600 |
+
// Width.
|
601 |
+
if ( this.cb[i].size + 60 >= window.innerWidth ) {
|
602 |
+
if ( this.cb[i].settings.width !== 'full' ) {
|
603 |
+
this.cb[i].container.style.marginLeft = '5%';
|
604 |
+
this.cb[i].container.style.marginRight = '5%';
|
605 |
+
} else if ( this.cb[i].content.offsetWidth <= window.innerWidth ) {
|
606 |
+
this.cb[i].content.style.width = 'auto';
|
607 |
+
}
|
608 |
+
this.cb[i].container.style.width = 'auto';
|
609 |
+
this.cb[i].wrapper.style.width = window.innerWidth + 'px';
|
610 |
+
} else {
|
611 |
+
switch ( this.cb[i].settings.position[0].trim() ) {
|
612 |
+
case 'left':
|
613 |
+
this.cb[i].container.style.marginLeft = 0;
|
614 |
+
break;
|
615 |
+
case 'right':
|
616 |
+
this.cb[i].container.style.marginRight = 0;
|
617 |
+
break;
|
618 |
+
default:
|
619 |
+
this.cb[i].container.style.marginLeft = 'auto';
|
620 |
+
this.cb[i].container.style.marginRight = 'auto';
|
621 |
+
break;
|
622 |
+
}
|
623 |
+
this.cb[i].container.style.width = this.cb[i].size + 'px';
|
624 |
+
this.cb[i].wrapper.style.width = 'auto';
|
625 |
+
}
|
626 |
+
|
627 |
+
// Top.
|
628 |
+
if ( this.cb[i].content.offsetHeight >= window.innerHeight && this.cb[i].settings.width !== 'full' ) {
|
629 |
+
this.cb[i].container.style.marginTop = '5%';
|
630 |
+
this.cb[i].container.style.marginBottom = '5%';
|
631 |
+
} else {
|
632 |
+
if ( this.cb[i].settings.width === 'full' ) {
|
633 |
+
this.cb[i].settings.position[1] = 'top';
|
634 |
+
if ( this.cb[i].content.offsetHeight <= window.innerHeight ) {
|
635 |
+
this.cb[i].content.style.height = window.innerHeight + 'px';
|
636 |
+
}
|
637 |
+
}
|
638 |
+
switch ( this.cb[i].settings.position[1].trim() ) {
|
639 |
+
case 'top':
|
640 |
+
result = 0;
|
641 |
+
break;
|
642 |
+
case 'bottom':
|
643 |
+
result = window.innerHeight - this.cb[i].content.offsetHeight + 'px';
|
644 |
+
break;
|
645 |
+
default:
|
646 |
+
result = window.innerHeight / 2 - this.cb[i].content.offsetHeight / 2 + 'px';
|
647 |
+
break;
|
648 |
+
}
|
649 |
+
this.cb[i].container.style.marginTop = result;
|
650 |
+
}
|
651 |
+
}
|
652 |
+
},
|
653 |
+
binds: function() {
|
654 |
+
var _this = this,
|
655 |
+
cb = _this.cb[_this.item],
|
656 |
+
stop = false;
|
657 |
+
|
658 |
+
// Esc.
|
659 |
+
if ( _this.cb.length === 1 ) {
|
660 |
+
_this.esc = function( event ) {
|
661 |
+
if ( _this.cb.length === 1 ) {
|
662 |
+
document.removeEventListener('keydown', _this.esc);
|
663 |
+
}
|
664 |
+
event = event || window.event;
|
665 |
+
if ( !stop && event.keyCode === 27 && _this.get() && _this.get().settings.escKey ) {
|
666 |
+
stop = true;
|
667 |
+
_this.close();
|
668 |
+
}
|
669 |
+
};
|
670 |
+
document.addEventListener('keydown', _this.esc, false);
|
671 |
+
|
672 |
+
// Listener responsive.
|
673 |
+
window.addEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', function() {
|
674 |
+
_this.responsive();
|
675 |
+
}, false);
|
676 |
+
}
|
677 |
+
|
678 |
+
// Overlay close.
|
679 |
+
cb.wrapper.event = function ( event ) {
|
680 |
+
if ( _this.cb.length === 1 ) {
|
681 |
+
document.removeEventListener('keydown', cb.wrapper.event);
|
682 |
+
}
|
683 |
+
if ( !stop && event.target === cb.wrapper && _this.get() && _this.get().settings.overlayClose ) {
|
684 |
+
stop = true;
|
685 |
+
_this.close();
|
686 |
+
}
|
687 |
+
};
|
688 |
+
cb.wrapper.addEventListener('click', cb.wrapper.event, false);
|
689 |
+
|
690 |
+
document.addEventListener('custombox.close', function() {
|
691 |
+
stop = false;
|
692 |
+
});
|
693 |
+
|
694 |
+
var callback = function() {
|
695 |
+
// Execute the scripts.
|
696 |
+
if ( !cb.inline ) {
|
697 |
+
for ( var i = 0, script = cb.modal.getElementsByTagName('script'), t = script.length; i < t; i++ ) {
|
698 |
+
new Function( script[i].text )();
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
if ( cb.settings && typeof cb.settings.complete === 'function' ) {
|
703 |
+
cb.settings.complete.call();
|
704 |
+
}
|
705 |
+
|
706 |
+
// Trigger complete.
|
707 |
+
if ( document.createEvent ) {
|
708 |
+
var tcomplete = document.createEvent('Event');
|
709 |
+
tcomplete.initEvent('custombox.complete', true, true);
|
710 |
+
document.dispatchEvent(tcomplete);
|
711 |
+
}
|
712 |
+
};
|
713 |
+
|
714 |
+
// Callback complete.
|
715 |
+
var complete = function() {
|
716 |
+
callback();
|
717 |
+
cb.modal.removeEventListener('transitionend', complete);
|
718 |
+
};
|
719 |
+
|
720 |
+
if ( _config.oldIE || _config.oldMobile ) {
|
721 |
+
setTimeout(function() {
|
722 |
+
callback();
|
723 |
+
}, cb.settings.overlaySpeed);
|
724 |
+
} else {
|
725 |
+
if ( cb.settings.effect !== 'slit' ) {
|
726 |
+
cb.modal.addEventListener('transitionend', complete, false);
|
727 |
+
} else {
|
728 |
+
cb.modal.addEventListener('animationend', complete, false);
|
729 |
+
}
|
730 |
+
}
|
731 |
+
},
|
732 |
+
error: function() {
|
733 |
+
var _this = this,
|
734 |
+
item = _this.cb.length - 1;
|
735 |
+
|
736 |
+
alert('Error to load this target: ' + _this.cb[item].settings.target);
|
737 |
+
_this.remove(item);
|
738 |
+
}
|
739 |
+
};
|
740 |
+
|
741 |
+
return {
|
742 |
+
/**
|
743 |
+
* @desc Set options defaults.
|
744 |
+
* @param {object} options - Auto built.
|
745 |
+
*/
|
746 |
+
set: function( options ) {
|
747 |
+
if ( options.autobuild ) {
|
748 |
+
_private.built('container');
|
749 |
+
}
|
750 |
+
},
|
751 |
+
/**
|
752 |
+
* @desc Open Custombox.
|
753 |
+
* @param {object} options - Options for the custombox.
|
754 |
+
*/
|
755 |
+
open: function( options ) {
|
756 |
+
_private.set( options );
|
757 |
+
_private.init();
|
758 |
+
},
|
759 |
+
/**
|
760 |
+
* @desc Close Custombox.
|
761 |
+
* @param {string} options - Target.
|
762 |
+
* @param {function} callback.
|
763 |
+
*/
|
764 |
+
close: function( target, callback ) {
|
765 |
+
if ( typeof target === 'function' ) {
|
766 |
+
callback = target;
|
767 |
+
target = false;
|
768 |
+
}
|
769 |
+
_private.close( target, callback );
|
770 |
+
}
|
771 |
+
};
|
772 |
+
}));
|
js/legacy.js
ADDED
@@ -0,0 +1,874 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Add getComputedStyle support to elements
|
3 |
+
*/
|
4 |
+
(function ( w ) {
|
5 |
+
if ( !w.getComputedStyle ) {
|
6 |
+
w.getComputedStyle = function( el ) {
|
7 |
+
this.el = el;
|
8 |
+
this.getPropertyValue = function( prop ) {
|
9 |
+
var re = /(\-([a-z]){1})/g;
|
10 |
+
if ( prop == 'float' ) prop = 'styleFloat';
|
11 |
+
if ( re.test(prop) ) {
|
12 |
+
prop = prop.replace(re, function () {
|
13 |
+
return arguments[2].toUpperCase();
|
14 |
+
});
|
15 |
+
}
|
16 |
+
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
|
17 |
+
};
|
18 |
+
return this;
|
19 |
+
};
|
20 |
+
}
|
21 |
+
})(window);
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add dataset support to elements
|
25 |
+
* No globals, no overriding prototype with non-standard methods,
|
26 |
+
* handles CamelCase properly, attempts to use standard
|
27 |
+
* Object.defineProperty() (and Function bind()) methods,
|
28 |
+
* falls back to native implementation when existing
|
29 |
+
* Inspired by http://code.eligrey.com/html5/dataset/
|
30 |
+
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js )
|
31 |
+
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (shims below)
|
32 |
+
* Licensed under the X11/MIT License
|
33 |
+
*/
|
34 |
+
|
35 |
+
// Inspired by https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind#Compatibility
|
36 |
+
if (!Function.prototype.bind) {
|
37 |
+
Function.prototype.bind = function (oThis) {
|
38 |
+
'use strict';
|
39 |
+
if (typeof this !== "function") {
|
40 |
+
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
41 |
+
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
42 |
+
}
|
43 |
+
|
44 |
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
45 |
+
fToBind = this,
|
46 |
+
FNOP = function () {},
|
47 |
+
fBound = function () {
|
48 |
+
return fToBind.apply(
|
49 |
+
this instanceof FNOP && oThis ? this : oThis,
|
50 |
+
aArgs.concat(Array.prototype.slice.call(arguments))
|
51 |
+
);
|
52 |
+
};
|
53 |
+
|
54 |
+
FNOP.prototype = this.prototype;
|
55 |
+
fBound.prototype = new FNOP();
|
56 |
+
|
57 |
+
return fBound;
|
58 |
+
};
|
59 |
+
}
|
60 |
+
|
61 |
+
/*
|
62 |
+
* Xccessors Standard: Cross-browser ECMAScript 5 accessors
|
63 |
+
* http://purl.eligrey.com/github/Xccessors
|
64 |
+
*
|
65 |
+
* 2010-06-21
|
66 |
+
*
|
67 |
+
* By Eli Grey, http://eligrey.com
|
68 |
+
*
|
69 |
+
* A shim that partially implements Object.defineProperty,
|
70 |
+
* Object.getOwnPropertyDescriptor, and Object.defineProperties in browsers that have
|
71 |
+
* legacy __(define|lookup)[GS]etter__ support.
|
72 |
+
*
|
73 |
+
* Licensed under the X11/MIT License
|
74 |
+
* See LICENSE.md
|
75 |
+
*/
|
76 |
+
|
77 |
+
// Removed a few JSLint options as Notepad++ JSLint validator complaining and
|
78 |
+
// made comply with JSLint; also moved 'use strict' inside function
|
79 |
+
/*jslint white: true, undef: true, plusplus: true,
|
80 |
+
bitwise: true, regexp: true, newcap: true, maxlen: 90 */
|
81 |
+
|
82 |
+
/*! @source http://purl.eligrey.com/github/Xccessors/blob/master/xccessors-standard.js*/
|
83 |
+
|
84 |
+
(function () {
|
85 |
+
'use strict';
|
86 |
+
var ObjectProto = Object.prototype,
|
87 |
+
defineGetter = ObjectProto.__defineGetter__,
|
88 |
+
defineSetter = ObjectProto.__defineSetter__,
|
89 |
+
lookupGetter = ObjectProto.__lookupGetter__,
|
90 |
+
lookupSetter = ObjectProto.__lookupSetter__,
|
91 |
+
hasOwnProp = ObjectProto.hasOwnProperty;
|
92 |
+
|
93 |
+
if (defineGetter && defineSetter && lookupGetter && lookupSetter) {
|
94 |
+
|
95 |
+
if (!Object.defineProperty) {
|
96 |
+
Object.defineProperty = function (obj, prop, descriptor) {
|
97 |
+
if (arguments.length < 3) { // all arguments required
|
98 |
+
throw new TypeError("Arguments not optional");
|
99 |
+
}
|
100 |
+
|
101 |
+
prop += ""; // convert prop to string
|
102 |
+
|
103 |
+
if (hasOwnProp.call(descriptor, "value")) {
|
104 |
+
if (!lookupGetter.call(obj, prop) && !lookupSetter.call(obj, prop)) {
|
105 |
+
// data property defined and no pre-existing accessors
|
106 |
+
obj[prop] = descriptor.value;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ((hasOwnProp.call(descriptor, "get") ||
|
110 |
+
hasOwnProp.call(descriptor, "set")))
|
111 |
+
{
|
112 |
+
// descriptor has a value prop but accessor already exists
|
113 |
+
throw new TypeError("Cannot specify an accessor and a value");
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
// can't switch off these features in ECMAScript 3
|
118 |
+
// so throw a TypeError if any are false
|
119 |
+
if (!(descriptor.writable && descriptor.enumerable &&
|
120 |
+
descriptor.configurable))
|
121 |
+
{
|
122 |
+
throw new TypeError(
|
123 |
+
"This implementation of Object.defineProperty does not support" +
|
124 |
+
" false for configurable, enumerable, or writable."
|
125 |
+
);
|
126 |
+
}
|
127 |
+
|
128 |
+
if (descriptor.get) {
|
129 |
+
defineGetter.call(obj, prop, descriptor.get);
|
130 |
+
}
|
131 |
+
if (descriptor.set) {
|
132 |
+
defineSetter.call(obj, prop, descriptor.set);
|
133 |
+
}
|
134 |
+
|
135 |
+
return obj;
|
136 |
+
};
|
137 |
+
}
|
138 |
+
|
139 |
+
if (!Object.getOwnPropertyDescriptor) {
|
140 |
+
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
141 |
+
if (arguments.length < 2) { // all arguments required
|
142 |
+
throw new TypeError("Arguments not optional.");
|
143 |
+
}
|
144 |
+
|
145 |
+
prop += ""; // convert prop to string
|
146 |
+
|
147 |
+
var descriptor = {
|
148 |
+
configurable: true,
|
149 |
+
enumerable : true,
|
150 |
+
writable : true
|
151 |
+
},
|
152 |
+
getter = lookupGetter.call(obj, prop),
|
153 |
+
setter = lookupSetter.call(obj, prop);
|
154 |
+
|
155 |
+
if (!hasOwnProp.call(obj, prop)) {
|
156 |
+
// property doesn't exist or is inherited
|
157 |
+
return descriptor;
|
158 |
+
}
|
159 |
+
if (!getter && !setter) { // not an accessor so return prop
|
160 |
+
descriptor.value = obj[prop];
|
161 |
+
return descriptor;
|
162 |
+
}
|
163 |
+
|
164 |
+
// there is an accessor, remove descriptor.writable;
|
165 |
+
// populate descriptor.get and descriptor.set (IE's behavior)
|
166 |
+
delete descriptor.writable;
|
167 |
+
descriptor.get = descriptor.set = undefined;
|
168 |
+
|
169 |
+
if (getter) {
|
170 |
+
descriptor.get = getter;
|
171 |
+
}
|
172 |
+
if (setter) {
|
173 |
+
descriptor.set = setter;
|
174 |
+
}
|
175 |
+
|
176 |
+
return descriptor;
|
177 |
+
};
|
178 |
+
}
|
179 |
+
|
180 |
+
if (!Object.defineProperties) {
|
181 |
+
Object.defineProperties = function (obj, props) {
|
182 |
+
var prop;
|
183 |
+
for (prop in props) {
|
184 |
+
if (hasOwnProp.call(props, prop)) {
|
185 |
+
Object.defineProperty(obj, prop, props[prop]);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
};
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}());
|
192 |
+
|
193 |
+
// Begin dataset code
|
194 |
+
|
195 |
+
if (!document.documentElement.dataset &&
|
196 |
+
// FF is empty while IE gives empty object
|
197 |
+
(!Object.getOwnPropertyDescriptor(Element.prototype, 'dataset') ||
|
198 |
+
!Object.getOwnPropertyDescriptor(Element.prototype, 'dataset').get)
|
199 |
+
) {
|
200 |
+
var propDescriptor = {
|
201 |
+
enumerable: true,
|
202 |
+
get: function () {
|
203 |
+
'use strict';
|
204 |
+
var i,
|
205 |
+
that = this,
|
206 |
+
HTML5_DOMStringMap,
|
207 |
+
attrVal, attrName, propName,
|
208 |
+
attribute,
|
209 |
+
attributes = this.attributes,
|
210 |
+
attsLength = attributes.length,
|
211 |
+
toUpperCase = function (n0) {
|
212 |
+
return n0.charAt(1).toUpperCase();
|
213 |
+
},
|
214 |
+
getter = function () {
|
215 |
+
return this;
|
216 |
+
},
|
217 |
+
setter = function (attrName, value) {
|
218 |
+
return (typeof value !== 'undefined') ?
|
219 |
+
this.setAttribute(attrName, value) :
|
220 |
+
this.removeAttribute(attrName);
|
221 |
+
};
|
222 |
+
try { // Simulate DOMStringMap w/accessor support
|
223 |
+
// Test setting accessor on normal object
|
224 |
+
({}).__defineGetter__('test', function () {});
|
225 |
+
HTML5_DOMStringMap = {};
|
226 |
+
}
|
227 |
+
catch (e1) { // Use a DOM object for IE8
|
228 |
+
HTML5_DOMStringMap = document.createElement('div');
|
229 |
+
}
|
230 |
+
for (i = 0; i < attsLength; i++) {
|
231 |
+
attribute = attributes[i];
|
232 |
+
// Fix: This test really should allow any XML Name without
|
233 |
+
// colons (and non-uppercase for XHTML)
|
234 |
+
if (attribute && attribute.name &&
|
235 |
+
(/^data-\w[\w\-]*$/).test(attribute.name)) {
|
236 |
+
attrVal = attribute.value;
|
237 |
+
attrName = attribute.name;
|
238 |
+
// Change to CamelCase
|
239 |
+
propName = attrName.substr(5).replace(/-./g, toUpperCase);
|
240 |
+
try {
|
241 |
+
Object.defineProperty(HTML5_DOMStringMap, propName, {
|
242 |
+
enumerable: this.enumerable,
|
243 |
+
get: getter.bind(attrVal || ''),
|
244 |
+
set: setter.bind(that, attrName)
|
245 |
+
});
|
246 |
+
}
|
247 |
+
catch (e2) { // if accessors are not working
|
248 |
+
HTML5_DOMStringMap[propName] = attrVal;
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
return HTML5_DOMStringMap;
|
253 |
+
}
|
254 |
+
};
|
255 |
+
try {
|
256 |
+
// FF enumerates over element's dataset, but not
|
257 |
+
// Element.prototype.dataset; IE9 iterates over both
|
258 |
+
Object.defineProperty(Element.prototype, 'dataset', propDescriptor);
|
259 |
+
} catch (e) {
|
260 |
+
propDescriptor.enumerable = false; // IE8 does not allow setting to true
|
261 |
+
Object.defineProperty(Element.prototype, 'dataset', propDescriptor);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/*
|
266 |
+
* classList.js: Cross-browser full element.classList implementation.
|
267 |
+
* 2014-12-13
|
268 |
+
*
|
269 |
+
* By Eli Grey, http://eligrey.com
|
270 |
+
* Public Domain.
|
271 |
+
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
272 |
+
*/
|
273 |
+
|
274 |
+
/*global self, document, DOMException */
|
275 |
+
|
276 |
+
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
|
277 |
+
|
278 |
+
if ("document" in self) {
|
279 |
+
|
280 |
+
// Full polyfill for browsers with no classList support
|
281 |
+
if (!("classList" in document.createElement("_"))) {
|
282 |
+
|
283 |
+
(function (view) {
|
284 |
+
|
285 |
+
"use strict";
|
286 |
+
|
287 |
+
if (!('Element' in view)) return;
|
288 |
+
|
289 |
+
var
|
290 |
+
classListProp = "classList"
|
291 |
+
, protoProp = "prototype"
|
292 |
+
, elemCtrProto = view.Element[protoProp]
|
293 |
+
, objCtr = Object
|
294 |
+
, strTrim = String[protoProp].trim || function () {
|
295 |
+
return this.replace(/^\s+|\s+$/g, "");
|
296 |
+
}
|
297 |
+
, arrIndexOf = Array[protoProp].indexOf || function (item) {
|
298 |
+
var
|
299 |
+
i = 0
|
300 |
+
, len = this.length
|
301 |
+
;
|
302 |
+
for (; i < len; i++) {
|
303 |
+
if (i in this && this[i] === item) {
|
304 |
+
return i;
|
305 |
+
}
|
306 |
+
}
|
307 |
+
return -1;
|
308 |
+
}
|
309 |
+
// Vendors: please allow content code to instantiate DOMExceptions
|
310 |
+
, DOMEx = function (type, message) {
|
311 |
+
this.name = type;
|
312 |
+
this.code = DOMException[type];
|
313 |
+
this.message = message;
|
314 |
+
}
|
315 |
+
, checkTokenAndGetIndex = function (classList, token) {
|
316 |
+
if (token === "") {
|
317 |
+
throw new DOMEx(
|
318 |
+
"SYNTAX_ERR"
|
319 |
+
, "An invalid or illegal string was specified"
|
320 |
+
);
|
321 |
+
}
|
322 |
+
if (/\s/.test(token)) {
|
323 |
+
throw new DOMEx(
|
324 |
+
"INVALID_CHARACTER_ERR"
|
325 |
+
, "String contains an invalid character"
|
326 |
+
);
|
327 |
+
}
|
328 |
+
return arrIndexOf.call(classList, token);
|
329 |
+
}
|
330 |
+
, ClassList = function (elem) {
|
331 |
+
var
|
332 |
+
trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
|
333 |
+
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
|
334 |
+
, i = 0
|
335 |
+
, len = classes.length
|
336 |
+
;
|
337 |
+
for (; i < len; i++) {
|
338 |
+
this.push(classes[i]);
|
339 |
+
}
|
340 |
+
this._updateClassName = function () {
|
341 |
+
elem.setAttribute("class", this.toString());
|
342 |
+
};
|
343 |
+
}
|
344 |
+
, classListProto = ClassList[protoProp] = []
|
345 |
+
, classListGetter = function () {
|
346 |
+
return new ClassList(this);
|
347 |
+
}
|
348 |
+
;
|
349 |
+
// Most DOMException implementations don't allow calling DOMException's toString()
|
350 |
+
// on non-DOMExceptions. Error's toString() is sufficient here.
|
351 |
+
DOMEx[protoProp] = Error[protoProp];
|
352 |
+
classListProto.item = function (i) {
|
353 |
+
return this[i] || null;
|
354 |
+
};
|
355 |
+
classListProto.contains = function (token) {
|
356 |
+
token += "";
|
357 |
+
return checkTokenAndGetIndex(this, token) !== -1;
|
358 |
+
};
|
359 |
+
classListProto.add = function () {
|
360 |
+
var
|
361 |
+
tokens = arguments
|
362 |
+
, i = 0
|
363 |
+
, l = tokens.length
|
364 |
+
, token
|
365 |
+
, updated = false
|
366 |
+
;
|
367 |
+
do {
|
368 |
+
token = tokens[i] + "";
|
369 |
+
if (checkTokenAndGetIndex(this, token) === -1) {
|
370 |
+
this.push(token);
|
371 |
+
updated = true;
|
372 |
+
}
|
373 |
+
}
|
374 |
+
while (++i < l);
|
375 |
+
|
376 |
+
if (updated) {
|
377 |
+
this._updateClassName();
|
378 |
+
}
|
379 |
+
};
|
380 |
+
classListProto.remove = function () {
|
381 |
+
var
|
382 |
+
tokens = arguments
|
383 |
+
, i = 0
|
384 |
+
, l = tokens.length
|
385 |
+
, token
|
386 |
+
, updated = false
|
387 |
+
, index
|
388 |
+
;
|
389 |
+
do {
|
390 |
+
token = tokens[i] + "";
|
391 |
+
index = checkTokenAndGetIndex(this, token);
|
392 |
+
while (index !== -1) {
|
393 |
+
this.splice(index, 1);
|
394 |
+
updated = true;
|
395 |
+
index = checkTokenAndGetIndex(this, token);
|
396 |
+
}
|
397 |
+
}
|
398 |
+
while (++i < l);
|
399 |
+
|
400 |
+
if (updated) {
|
401 |
+
this._updateClassName();
|
402 |
+
}
|
403 |
+
};
|
404 |
+
classListProto.toggle = function (token, force) {
|
405 |
+
token += "";
|
406 |
+
|
407 |
+
var
|
408 |
+
result = this.contains(token)
|
409 |
+
, method = result ?
|
410 |
+
force !== true && "remove"
|
411 |
+
:
|
412 |
+
force !== false && "add"
|
413 |
+
;
|
414 |
+
|
415 |
+
if (method) {
|
416 |
+
this[method](token);
|
417 |
+
}
|
418 |
+
|
419 |
+
if (force === true || force === false) {
|
420 |
+
return force;
|
421 |
+
} else {
|
422 |
+
return !result;
|
423 |
+
}
|
424 |
+
};
|
425 |
+
classListProto.toString = function () {
|
426 |
+
return this.join(" ");
|
427 |
+
};
|
428 |
+
|
429 |
+
if (objCtr.defineProperty) {
|
430 |
+
var classListPropDesc = {
|
431 |
+
get: classListGetter
|
432 |
+
, enumerable: true
|
433 |
+
, configurable: true
|
434 |
+
};
|
435 |
+
try {
|
436 |
+
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
437 |
+
} catch (ex) { // IE 8 doesn't support enumerable:true
|
438 |
+
if (ex.number === -0x7FF5EC54) {
|
439 |
+
classListPropDesc.enumerable = false;
|
440 |
+
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
|
441 |
+
}
|
442 |
+
}
|
443 |
+
} else if (objCtr[protoProp].__defineGetter__) {
|
444 |
+
elemCtrProto.__defineGetter__(classListProp, classListGetter);
|
445 |
+
}
|
446 |
+
|
447 |
+
}(self));
|
448 |
+
|
449 |
+
} else {
|
450 |
+
// There is full or partial native classList support, so just check if we need
|
451 |
+
// to normalize the add/remove and toggle APIs.
|
452 |
+
|
453 |
+
(function () {
|
454 |
+
"use strict";
|
455 |
+
|
456 |
+
var testElement = document.createElement("_");
|
457 |
+
|
458 |
+
testElement.classList.add("c1", "c2");
|
459 |
+
|
460 |
+
// Polyfill for IE 10/11 and Firefox <26, where classList.add and
|
461 |
+
// classList.remove exist but support only one argument at a time.
|
462 |
+
if (!testElement.classList.contains("c2")) {
|
463 |
+
var createMethod = function(method) {
|
464 |
+
var original = DOMTokenList.prototype[method];
|
465 |
+
|
466 |
+
DOMTokenList.prototype[method] = function(token) {
|
467 |
+
var i, len = arguments.length;
|
468 |
+
|
469 |
+
for (i = 0; i < len; i++) {
|
470 |
+
token = arguments[i];
|
471 |
+
original.call(this, token);
|
472 |
+
}
|
473 |
+
};
|
474 |
+
};
|
475 |
+
createMethod('add');
|
476 |
+
createMethod('remove');
|
477 |
+
}
|
478 |
+
|
479 |
+
testElement.classList.toggle("c3", false);
|
480 |
+
|
481 |
+
// Polyfill for IE 10 and Firefox <24, where classList.toggle does not
|
482 |
+
// support the second argument.
|
483 |
+
if (testElement.classList.contains("c3")) {
|
484 |
+
var _toggle = DOMTokenList.prototype.toggle;
|
485 |
+
|
486 |
+
DOMTokenList.prototype.toggle = function(token, force) {
|
487 |
+
if (1 in arguments && !this.contains(token) === !force) {
|
488 |
+
return force;
|
489 |
+
} else {
|
490 |
+
return _toggle.call(this, token);
|
491 |
+
}
|
492 |
+
};
|
493 |
+
|
494 |
+
}
|
495 |
+
|
496 |
+
testElement = null;
|
497 |
+
}());
|
498 |
+
|
499 |
+
}
|
500 |
+
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Running the following code before any other code will create trim() if it's not natively available.
|
505 |
+
*/
|
506 |
+
if (!String.prototype.trim) {
|
507 |
+
(function() {
|
508 |
+
// Make sure we trim BOM and NBSP
|
509 |
+
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
510 |
+
String.prototype.trim = function() {
|
511 |
+
return this.replace(rtrim, '');
|
512 |
+
};
|
513 |
+
})();
|
514 |
+
}
|
515 |
+
|
516 |
+
/**
|
517 |
+
* The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
|
518 |
+
*/
|
519 |
+
// Production steps of ECMA-262, Edition 5, 15.4.4.14
|
520 |
+
// Reference: http://es5.github.io/#x15.4.4.14
|
521 |
+
if (!Array.prototype.indexOf) {
|
522 |
+
Array.prototype.indexOf = function(searchElement, fromIndex) {
|
523 |
+
|
524 |
+
var k;
|
525 |
+
|
526 |
+
// 1. Let O be the result of calling ToObject passing
|
527 |
+
// the this value as the argument.
|
528 |
+
if (this == null) {
|
529 |
+
throw new TypeError('"this" is null or not defined');
|
530 |
+
}
|
531 |
+
|
532 |
+
var O = Object(this);
|
533 |
+
|
534 |
+
// 2. Let lenValue be the result of calling the Get
|
535 |
+
// internal method of O with the argument "length".
|
536 |
+
// 3. Let len be ToUint32(lenValue).
|
537 |
+
var len = O.length >>> 0;
|
538 |
+
|
539 |
+
// 4. If len is 0, return -1.
|
540 |
+
if (len === 0) {
|
541 |
+
return -1;
|
542 |
+
}
|
543 |
+
|
544 |
+
// 5. If argument fromIndex was passed let n be
|
545 |
+
// ToInteger(fromIndex); else let n be 0.
|
546 |
+
var n = +fromIndex || 0;
|
547 |
+
|
548 |
+
if (Math.abs(n) === Infinity) {
|
549 |
+
n = 0;
|
550 |
+
}
|
551 |
+
|
552 |
+
// 6. If n >= len, return -1.
|
553 |
+
if (n >= len) {
|
554 |
+
return -1;
|
555 |
+
}
|
556 |
+
|
557 |
+
// 7. If n >= 0, then Let k be n.
|
558 |
+
// 8. Else, n<0, Let k be len - abs(n).
|
559 |
+
// If k is less than 0, then let k be 0.
|
560 |
+
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
|
561 |
+
|
562 |
+
// 9. Repeat, while k < len
|
563 |
+
while (k < len) {
|
564 |
+
// a. Let Pk be ToString(k).
|
565 |
+
// This is implicit for LHS operands of the in operator
|
566 |
+
// b. Let kPresent be the result of calling the
|
567 |
+
// HasProperty internal method of O with argument Pk.
|
568 |
+
// This step can be combined with c
|
569 |
+
// c. If kPresent is true, then
|
570 |
+
// i. Let elementK be the result of calling the Get
|
571 |
+
// internal method of O with the argument ToString(k).
|
572 |
+
// ii. Let same be the result of applying the
|
573 |
+
// Strict Equality Comparison Algorithm to
|
574 |
+
// searchElement and elementK.
|
575 |
+
// iii. If same is true, return k.
|
576 |
+
if (k in O && O[k] === searchElement) {
|
577 |
+
return k;
|
578 |
+
}
|
579 |
+
k++;
|
580 |
+
}
|
581 |
+
return -1;
|
582 |
+
};
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* EventListener | CC0 | github.com/jonathantneal/EventListener
|
587 |
+
* https://github.com/jonathantneal/EventListener
|
588 |
+
*/
|
589 |
+
this.Element && Element.prototype.attachEvent && !Element.prototype.addEventListener && (function () {
|
590 |
+
function addToPrototype(name, method) {
|
591 |
+
Window.prototype[name] = HTMLDocument.prototype[name] = Element.prototype[name] = method;
|
592 |
+
}
|
593 |
+
|
594 |
+
// add
|
595 |
+
addToPrototype("addEventListener", function (type, listener) {
|
596 |
+
var
|
597 |
+
target = this,
|
598 |
+
listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
|
599 |
+
typeListeners = listeners[type] = listeners[type] || [];
|
600 |
+
|
601 |
+
// if no events exist, attach the listener
|
602 |
+
if (!typeListeners.length) {
|
603 |
+
target.attachEvent("on" + type, typeListeners.event = function (event) {
|
604 |
+
var documentElement = target.document && target.document.documentElement || target.documentElement || { scrollLeft: 0, scrollTop: 0 };
|
605 |
+
|
606 |
+
// polyfill w3c properties and methods
|
607 |
+
event.currentTarget = target;
|
608 |
+
event.pageX = event.clientX + documentElement.scrollLeft;
|
609 |
+
event.pageY = event.clientY + documentElement.scrollTop;
|
610 |
+
event.preventDefault = function () { event.returnValue = false };
|
611 |
+
event.relatedTarget = event.fromElement || null;
|
612 |
+
event.stopImmediatePropagation = function () { immediatePropagation = false; event.cancelBubble = true };
|
613 |
+
event.stopPropagation = function () { event.cancelBubble = true };
|
614 |
+
event.target = event.srcElement || target;
|
615 |
+
event.timeStamp = +new Date;
|
616 |
+
|
617 |
+
// create an cached list of the master events list (to protect this loop from breaking when an event is removed)
|
618 |
+
for (var i = 0, typeListenersCache = [].concat(typeListeners), typeListenerCache, immediatePropagation = true; immediatePropagation && (typeListenerCache = typeListenersCache[i]); ++i) {
|
619 |
+
// check to see if the cached event still exists in the master events list
|
620 |
+
for (var ii = 0, typeListener; typeListener = typeListeners[ii]; ++ii) {
|
621 |
+
if (typeListener == typeListenerCache) {
|
622 |
+
typeListener.call(target, event);
|
623 |
+
|
624 |
+
break;
|
625 |
+
}
|
626 |
+
}
|
627 |
+
}
|
628 |
+
});
|
629 |
+
}
|
630 |
+
|
631 |
+
// add the event to the master event list
|
632 |
+
typeListeners.push(listener);
|
633 |
+
});
|
634 |
+
|
635 |
+
// remove
|
636 |
+
addToPrototype("removeEventListener", function (type, listener) {
|
637 |
+
var
|
638 |
+
target = this,
|
639 |
+
listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
|
640 |
+
typeListeners = listeners[type] = listeners[type] || [];
|
641 |
+
|
642 |
+
// remove the newest matching event from the master event list
|
643 |
+
for (var i = typeListeners.length - 1, typeListener; typeListener = typeListeners[i]; --i) {
|
644 |
+
if (typeListener == listener) {
|
645 |
+
typeListeners.splice(i, 1);
|
646 |
+
|
647 |
+
break;
|
648 |
+
}
|
649 |
+
}
|
650 |
+
|
651 |
+
// if no events exist, detach the listener
|
652 |
+
if (!typeListeners.length && typeListeners.event) {
|
653 |
+
target.detachEvent("on" + type, typeListeners.event);
|
654 |
+
}
|
655 |
+
});
|
656 |
+
|
657 |
+
// dispatch
|
658 |
+
addToPrototype("dispatchEvent", function (eventObject) {
|
659 |
+
var
|
660 |
+
target = this,
|
661 |
+
type = eventObject.type,
|
662 |
+
listeners = target.addEventListener.listeners = target.addEventListener.listeners || {},
|
663 |
+
typeListeners = listeners[type] = listeners[type] || [];
|
664 |
+
|
665 |
+
try {
|
666 |
+
return target.fireEvent("on" + type, eventObject);
|
667 |
+
} catch (error) {
|
668 |
+
if (typeListeners.event) {
|
669 |
+
typeListeners.event(eventObject);
|
670 |
+
}
|
671 |
+
|
672 |
+
return;
|
673 |
+
}
|
674 |
+
});
|
675 |
+
|
676 |
+
// CustomEvent
|
677 |
+
Object.defineProperty(Window.prototype, "CustomEvent", {
|
678 |
+
get: function () {
|
679 |
+
var self = this;
|
680 |
+
|
681 |
+
return function CustomEvent(type, eventInitDict) {
|
682 |
+
var event = self.document.createEventObject(), key;
|
683 |
+
|
684 |
+
event.type = type;
|
685 |
+
for (key in eventInitDict) {
|
686 |
+
if (key == 'cancelable'){
|
687 |
+
event.returnValue = !eventInitDict.cancelable;
|
688 |
+
} else if (key == 'bubbles'){
|
689 |
+
event.cancelBubble = !eventInitDict.bubbles;
|
690 |
+
} else if (key == 'detail'){
|
691 |
+
event.detail = eventInitDict.detail;
|
692 |
+
}
|
693 |
+
}
|
694 |
+
return event;
|
695 |
+
};
|
696 |
+
}
|
697 |
+
});
|
698 |
+
|
699 |
+
// ready
|
700 |
+
function ready(event) {
|
701 |
+
if (ready.interval && document.body) {
|
702 |
+
ready.interval = clearInterval(ready.interval);
|
703 |
+
|
704 |
+
document.dispatchEvent(new CustomEvent("DOMContentLoaded"));
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
ready.interval = setInterval(ready, 1);
|
709 |
+
|
710 |
+
window.addEventListener("load", ready);
|
711 |
+
})();
|
712 |
+
|
713 |
+
(!this.CustomEvent || typeof this.CustomEvent === "object") && (function() {
|
714 |
+
// CustomEvent for browsers which don't natively support the Constructor method
|
715 |
+
this.CustomEvent = function CustomEvent(type, eventInitDict) {
|
716 |
+
var event;
|
717 |
+
eventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: undefined};
|
718 |
+
|
719 |
+
try {
|
720 |
+
event = document.createEvent('CustomEvent');
|
721 |
+
event.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail);
|
722 |
+
} catch (error) {
|
723 |
+
// for browsers which don't support CustomEvent at all, we use a regular event instead
|
724 |
+
event = document.createEvent('Event');
|
725 |
+
event.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable);
|
726 |
+
event.detail = eventInitDict.detail;
|
727 |
+
}
|
728 |
+
|
729 |
+
return event;
|
730 |
+
};
|
731 |
+
})();
|
732 |
+
|
733 |
+
// Production steps of ECMA-262, Edition 5, 15.4.4.18
|
734 |
+
// Reference: http://es5.github.com/#x15.4.4.18
|
735 |
+
if (!Array.prototype.forEach) {
|
736 |
+
|
737 |
+
Array.prototype.forEach = function forEach(callback, thisArg) {
|
738 |
+
'use strict';
|
739 |
+
var T, k;
|
740 |
+
|
741 |
+
if (this == null) {
|
742 |
+
throw new TypeError("this is null or not defined");
|
743 |
+
}
|
744 |
+
|
745 |
+
var kValue,
|
746 |
+
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
|
747 |
+
O = Object(this),
|
748 |
+
|
749 |
+
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
|
750 |
+
// 3. Let len be ToUint32(lenValue).
|
751 |
+
len = O.length >>> 0; // Hack to convert O.length to a UInt32
|
752 |
+
|
753 |
+
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
754 |
+
// See: http://es5.github.com/#x9.11
|
755 |
+
if ({}.toString.call(callback) !== "[object Function]") {
|
756 |
+
throw new TypeError(callback + " is not a function");
|
757 |
+
}
|
758 |
+
|
759 |
+
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
760 |
+
if (arguments.length >= 2) {
|
761 |
+
T = thisArg;
|
762 |
+
}
|
763 |
+
|
764 |
+
// 6. Let k be 0
|
765 |
+
k = 0;
|
766 |
+
|
767 |
+
// 7. Repeat, while k < len
|
768 |
+
while (k < len) {
|
769 |
+
|
770 |
+
// a. Let Pk be ToString(k).
|
771 |
+
// This is implicit for LHS operands of the in operator
|
772 |
+
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
|
773 |
+
// This step can be combined with c
|
774 |
+
// c. If kPresent is true, then
|
775 |
+
if (k in O) {
|
776 |
+
|
777 |
+
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
|
778 |
+
kValue = O[k];
|
779 |
+
|
780 |
+
// ii. Call the Call internal method of callback with T as the this value and
|
781 |
+
// argument list containing kValue, k, and O.
|
782 |
+
callback.call(T, kValue, k, O);
|
783 |
+
}
|
784 |
+
// d. Increase k by 1.
|
785 |
+
k++;
|
786 |
+
}
|
787 |
+
// 8. return undefined
|
788 |
+
};
|
789 |
+
}
|
790 |
+
|
791 |
+
/**
|
792 |
+
* :scope polyfill
|
793 |
+
* http://stackoverflow.com/questions/6481612/queryselector-search-immediate-children
|
794 |
+
*/
|
795 |
+
(function(doc, proto) {
|
796 |
+
try { // check if browser supports :scope natively
|
797 |
+
doc.querySelector(':scope body');
|
798 |
+
} catch (err) { // polyfill native methods if it doesn't
|
799 |
+
['querySelector', 'querySelectorAll'].forEach(function(method) {
|
800 |
+
var native = proto[method];
|
801 |
+
proto[method] = function(selectors) {
|
802 |
+
if (/(^|,)\s*:scope/.test(selectors)) { // only if selectors contains :scope
|
803 |
+
var id = this.id; // remember current element id
|
804 |
+
this.id = 'ID_' + Date.now(); // assign new unique id
|
805 |
+
selectors = selectors.replace(/((^|,)\s*):scope/g, '$1#' + this.id); // replace :scope with #ID
|
806 |
+
var result = doc[method](selectors);
|
807 |
+
this.id = id; // restore previous id
|
808 |
+
return result;
|
809 |
+
} else {
|
810 |
+
return native.call(this, selectors); // use native code for other selectors
|
811 |
+
}
|
812 |
+
}
|
813 |
+
});
|
814 |
+
}
|
815 |
+
})(window.document, Element.prototype);
|
816 |
+
|
817 |
+
if (navigator.appVersion.indexOf('MSIE 8.') === -1 && navigator.appVersion.indexOf('MSIE 9.') === -1) {
|
818 |
+
/**
|
819 |
+
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object.
|
820 |
+
* https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Object/assign
|
821 |
+
*/
|
822 |
+
if (!Object.assign) {
|
823 |
+
Object.defineProperty(Object, 'assign', {
|
824 |
+
enumerable: false,
|
825 |
+
configurable: true,
|
826 |
+
writable: true,
|
827 |
+
value: function(target, firstSource) {
|
828 |
+
'use strict';
|
829 |
+
if (target === undefined || target === null) {
|
830 |
+
throw new TypeError('Cannot convert first argument to object');
|
831 |
+
}
|
832 |
+
|
833 |
+
var to = Object(target);
|
834 |
+
for (var i = 1; i < arguments.length; i++) {
|
835 |
+
var nextSource = arguments[i];
|
836 |
+
if (nextSource === undefined || nextSource === null) {
|
837 |
+
continue;
|
838 |
+
}
|
839 |
+
|
840 |
+
var keysArray = Object.keys(Object(nextSource));
|
841 |
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
842 |
+
var nextKey = keysArray[nextIndex];
|
843 |
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
844 |
+
if (desc !== undefined && desc.enumerable) {
|
845 |
+
to[nextKey] = nextSource[nextKey];
|
846 |
+
}
|
847 |
+
}
|
848 |
+
}
|
849 |
+
return to;
|
850 |
+
}
|
851 |
+
});
|
852 |
+
}
|
853 |
+
}
|
854 |
+
|
855 |
+
/*
|
856 |
+
* The Array.isArray() method returns true if an object is an array, false if it is not.
|
857 |
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
858 |
+
*/
|
859 |
+
if (!Array.isArray) {
|
860 |
+
Array.isArray = function(arg) {
|
861 |
+
return Object.prototype.toString.call(arg) === '[object Array]';
|
862 |
+
};
|
863 |
+
}
|
864 |
+
|
865 |
+
function cbExtendObjects () {
|
866 |
+
for ( var i = 1, arg = arguments.length; i < arg; i++ ) {
|
867 |
+
for ( var key in arguments[i] ) {
|
868 |
+
if( arguments[i].hasOwnProperty(key) ) {
|
869 |
+
arguments[0][key] = arguments[i][key];
|
870 |
+
}
|
871 |
+
}
|
872 |
+
}
|
873 |
+
return arguments[0];
|
874 |
+
}
|
js/polls/yop-poll-add-edit.js
CHANGED
@@ -12,7 +12,7 @@ else if (ie4)
|
|
12 |
function init()
|
13 |
{
|
14 |
if(ns4)
|
15 |
-
|
16 |
else
|
17 |
if (ns6||ie4)
|
18 |
ld.display="none";
|
@@ -97,7 +97,26 @@ jQuery( document ).ready( function( jQuery ) {
|
|
97 |
yop_poll_answers_sortable();
|
98 |
yop_poll_questions_sortable()
|
99 |
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
//<editor-fold desc="View Results Checkboxes">
|
102 |
jQuery( '#yop-poll-view-results-custom' ).change( function() {
|
103 |
if( jQuery( this ).attr( 'checked' ) == "checked" ) {
|
@@ -877,17 +896,12 @@ function yop_poll_check_tabulate(answers_display,tabulated_cols) {
|
|
877 |
}
|
878 |
function yop_poll_show_poll_shortcode(poll_id){
|
879 |
jQuery("#yop_poll_shortcode_input" ).val( "[yop_poll id="+'"'+poll_id+'"'+"]");
|
|
|
880 |
jQuery("#yop_poll_show_shortcode").dialog({
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
width: '320',
|
885 |
-
|
886 |
-
|
887 |
modal: true
|
888 |
-
|
889 |
});
|
890 |
-
|
891 |
}
|
892 |
|
893 |
|
12 |
function init()
|
13 |
{
|
14 |
if(ns4)
|
15 |
+
{ld.visibility="hidden";}
|
16 |
else
|
17 |
if (ns6||ie4)
|
18 |
ld.display="none";
|
97 |
yop_poll_answers_sortable();
|
98 |
yop_poll_questions_sortable()
|
99 |
|
100 |
+
//generate code button
|
101 |
+
jQuery( '.generate-code-button' ).click(function(){
|
102 |
+
var poll_id = jQuery( '#yop_poll_shortcode_input' ).data( 'id' );
|
103 |
+
var tracking_id = jQuery( '#poll_tracking_id' ).val();
|
104 |
+
var show_results = jQuery("input:radio[name=poll_display_results]:checked").val();
|
105 |
+
var code = "[yop_poll id=\"" + poll_id + "\"";
|
106 |
+
if( show_results == "-1") {
|
107 |
+
if( tracking_id != "" ) {
|
108 |
+
code += " tracking_id=\"" + tracking_id + "\"]";
|
109 |
+
}
|
110 |
+
else {
|
111 |
+
code += "]";
|
112 |
+
}
|
113 |
+
}
|
114 |
+
else {
|
115 |
+
code += " show_results=\"" + show_results + "\"]";
|
116 |
+
}
|
117 |
+
jQuery( '#yop_poll_shortcode_input' ).val( code );
|
118 |
+
});
|
119 |
+
//end generate code button
|
120 |
//<editor-fold desc="View Results Checkboxes">
|
121 |
jQuery( '#yop-poll-view-results-custom' ).change( function() {
|
122 |
if( jQuery( this ).attr( 'checked' ) == "checked" ) {
|
896 |
}
|
897 |
function yop_poll_show_poll_shortcode(poll_id){
|
898 |
jQuery("#yop_poll_shortcode_input" ).val( "[yop_poll id="+'"'+poll_id+'"'+"]");
|
899 |
+
jQuery("#yop_poll_shortcode_input" ).data( "id", poll_id );
|
900 |
jQuery("#yop_poll_show_shortcode").dialog({
|
901 |
+
height: '350',
|
902 |
+
width: '550',
|
|
|
|
|
|
|
|
|
903 |
modal: true
|
|
|
904 |
});
|
|
|
905 |
}
|
906 |
|
907 |
|
js/yop-poll-admin.js
CHANGED
@@ -105,8 +105,6 @@ function cslw( msg ) {
|
|
105 |
|
106 |
jQuery( document ).ready( function ( jQuery ) {
|
107 |
|
108 |
-
|
109 |
-
|
110 |
var top = jQuery( '#postbox-container-1' ).position();
|
111 |
if( top !== undefined ) {
|
112 |
var pos = "-" + top.top + "px";
|
@@ -283,10 +281,7 @@ jQuery(window).load(function() {
|
|
283 |
pause: 7000
|
284 |
|
285 |
});
|
286 |
-
jQuery(".yop-poll-slider").css("opacity","1")
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
});
|
291 |
|
292 |
|
105 |
|
106 |
jQuery( document ).ready( function ( jQuery ) {
|
107 |
|
|
|
|
|
108 |
var top = jQuery( '#postbox-container-1' ).position();
|
109 |
if( top !== undefined ) {
|
110 |
var pos = "-" + top.top + "px";
|
281 |
pause: 7000
|
282 |
|
283 |
});
|
284 |
+
jQuery(".yop-poll-slider").css("opacity","1");
|
|
|
|
|
|
|
285 |
});
|
286 |
|
287 |
|
js/yop-poll-modal-functions.js
CHANGED
@@ -1,49 +1,38 @@
|
|
1 |
function yop_poll_show_modal_box( element ) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
selectorCloseModalBox: "#yop-poll-close-modal-box span",
|
9 |
-
selectorModalboxBodyContainer: "#WFItem3940411"
|
10 |
-
});
|
11 |
-
jQuery('.closeModalBox').hide();
|
12 |
-
return false;
|
13 |
}
|
14 |
-
|
15 |
jQuery(document).ready(function(jQuery) {
|
16 |
yop_poll_show_modal_box( '#yop-poll-show-modal-box' );
|
17 |
-
jQuery(
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
});
|
27 |
});
|
28 |
-
|
29 |
-
(function ($) {
|
30 |
-
jQuery.fn.waitUntilExists = function (handler, shouldRunHandlerOnce, isChild) {
|
31 |
-
var found = 'found';
|
32 |
-
var $this = jQuery(this.selector);
|
33 |
-
var $elements = $this.not(function () { return jQuery(this).data(found); }).each(handler).data(found, true);
|
34 |
-
|
35 |
-
if (!isChild)
|
36 |
-
{
|
37 |
-
(window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] =
|
38 |
-
window.setInterval(function () { $this.waitUntilExists(handler, shouldRunHandlerOnce, true); }, 500)
|
39 |
-
;
|
40 |
-
}
|
41 |
-
else if (shouldRunHandlerOnce && $elements.length)
|
42 |
-
{
|
43 |
-
window.clearInterval(window.waitUntilExists_Intervals[this.selector]);
|
44 |
-
}
|
45 |
-
|
46 |
-
return $this;
|
47 |
-
}
|
48 |
-
}(jQuery));
|
49 |
-
|
1 |
function yop_poll_show_modal_box( element ) {
|
2 |
+
Custombox.open({
|
3 |
+
target: '#WFItem394041',
|
4 |
+
effect: 'fadein',
|
5 |
+
escKey: false,
|
6 |
+
overlayClose: false
|
7 |
+
});
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
|
|
9 |
jQuery(document).ready(function(jQuery) {
|
10 |
yop_poll_show_modal_box( '#yop-poll-show-modal-box' );
|
11 |
+
jQuery(".elButton").click(function(){
|
12 |
+
var api_url = 'http://yop-poll.com/api/';
|
13 |
+
jQuery(".elButton").text("Please wait ....");
|
14 |
+
jQuery.ajax({
|
15 |
+
url : api_url,
|
16 |
+
data : 'email=' + jQuery("#email").val(),
|
17 |
+
type : 'POST',
|
18 |
+
crossDomain : true,
|
19 |
+
async : false,
|
20 |
+
success : function(response)
|
21 |
+
{
|
22 |
+
if( response ) {
|
23 |
+
jQuery.ajax({
|
24 |
+
type: 'GET',
|
25 |
+
url: yop_poll_modal_functions_config.ajax.url,
|
26 |
+
data: 'action=' + yop_poll_modal_functions_config.ajax.action + '&email=' + jQuery("#email").val(),
|
27 |
+
success: function(response){
|
28 |
+
Custombox.close();
|
29 |
+
}
|
30 |
+
});
|
31 |
+
}
|
32 |
+
else{
|
33 |
+
jQuery(".elButton").text("Send me the FREE guide!");
|
34 |
+
}
|
35 |
+
},
|
36 |
+
});
|
37 |
});
|
38 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/abstract_model.php
CHANGED
@@ -1994,64 +1994,40 @@ abstract class YOP_POLL_Abstract_Model
|
|
1994 |
|
1995 |
public static function reset_poll_stats_from_database($poll_id)
|
1996 |
{
|
1997 |
-
|
1998 |
global $message;
|
1999 |
-
|
2000 |
$current_poll = new YOP_POLL_Poll_Model($poll_id);
|
2001 |
-
|
2002 |
$message = self::delete_result_from_db_by_poll_id($poll_id);
|
2003 |
-
|
2004 |
$current_poll->poll_total_votes = 0;
|
2005 |
-
|
2006 |
foreach ($current_poll->questions as &$question) {
|
2007 |
-
|
2008 |
foreach ($question->answers as &$answer) {
|
2009 |
-
|
2010 |
$answer->votes = 0;
|
2011 |
-
|
2012 |
}
|
2013 |
-
|
2014 |
}
|
2015 |
-
|
2016 |
$current_poll->update_no_votes();
|
2017 |
-
|
2018 |
$current_poll->save();
|
2019 |
-
|
2020 |
}
|
2021 |
|
2022 |
|
2023 |
private static function delete_result_from_db_by_poll_id($poll_id)
|
2024 |
{
|
2025 |
-
|
2026 |
global $wpdb;
|
2027 |
-
|
2028 |
$response['success'] = "";
|
2029 |
-
|
2030 |
$response['error'] = "";
|
2031 |
-
|
2032 |
-
|
2033 |
$sql = $wpdb->query($wpdb->prepare("
|
2034 |
-
|
2035 |
DELETE FROM $wpdb->yop_poll_results
|
2036 |
-
|
2037 |
WHERE poll_id = %d
|
2038 |
-
|
2039 |
", $poll_id));
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
|
|
|
|
2043 |
$response['success'] = __yop_poll('Result deleted');
|
2044 |
-
|
2045 |
-
|
2046 |
-
} else {
|
2047 |
-
|
2048 |
$response['error'] = __yop_poll('Could not delete result from database! Please try again!');
|
2049 |
-
|
2050 |
}
|
2051 |
-
|
2052 |
-
|
2053 |
return $response;
|
2054 |
-
|
2055 |
}
|
2056 |
|
2057 |
}
|
1994 |
|
1995 |
public static function reset_poll_stats_from_database($poll_id)
|
1996 |
{
|
|
|
1997 |
global $message;
|
|
|
1998 |
$current_poll = new YOP_POLL_Poll_Model($poll_id);
|
|
|
1999 |
$message = self::delete_result_from_db_by_poll_id($poll_id);
|
|
|
2000 |
$current_poll->poll_total_votes = 0;
|
|
|
2001 |
foreach ($current_poll->questions as &$question) {
|
|
|
2002 |
foreach ($question->answers as &$answer) {
|
|
|
2003 |
$answer->votes = 0;
|
|
|
2004 |
}
|
|
|
2005 |
}
|
|
|
2006 |
$current_poll->update_no_votes();
|
|
|
2007 |
$current_poll->save();
|
|
|
2008 |
}
|
2009 |
|
2010 |
|
2011 |
private static function delete_result_from_db_by_poll_id($poll_id)
|
2012 |
{
|
|
|
2013 |
global $wpdb;
|
|
|
2014 |
$response['success'] = "";
|
|
|
2015 |
$response['error'] = "";
|
|
|
|
|
2016 |
$sql = $wpdb->query($wpdb->prepare("
|
|
|
2017 |
DELETE FROM $wpdb->yop_poll_results
|
|
|
2018 |
WHERE poll_id = %d
|
|
|
2019 |
", $poll_id));
|
2020 |
+
$sqls = $wpdb->query($wpdb->prepare("
|
2021 |
+
DELETE FROM $wpdb->yop_poll_votes_custom_fields
|
2022 |
+
WHERE poll_id = %d
|
2023 |
+
", $poll_id));
|
2024 |
+
if ( $sql && $sqls ) {
|
2025 |
$response['success'] = __yop_poll('Result deleted');
|
2026 |
+
}
|
2027 |
+
else {
|
|
|
|
|
2028 |
$response['error'] = __yop_poll('Could not delete result from database! Please try again!');
|
|
|
2029 |
}
|
|
|
|
|
2030 |
return $response;
|
|
|
2031 |
}
|
2032 |
|
2033 |
}
|
models/poll_model.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
|
4 |
{
|
@@ -17,10 +17,11 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
|
|
17 |
|
18 |
if ('' == $template_id) {
|
19 |
return "";
|
20 |
-
}
|
|
|
21 |
$uID = uniqid('t');
|
22 |
$poll = new YOP_POLL_Poll_Model();
|
23 |
-
$template_details = self::get_poll_template_from_database(intval($template_id));
|
24 |
$template = $template_details['before_vote_template'];
|
25 |
$template = stripslashes_deep($template);
|
26 |
|
@@ -46,6 +47,7 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
|
|
46 |
$t = $template;
|
47 |
$pattern = '\[(\[?)(QUESTION_CONTAINER)\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
|
48 |
preg_match("/$pattern/s", $t, $m);
|
|
|
49 |
$m = $m[5];
|
50 |
|
51 |
$m = str_ireplace("%POLL-QUESTION%", $question->question, $m);
|
@@ -278,7 +280,8 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
|
|
278 |
if ($ans_no > 0) {
|
279 |
$results_tabulated_cols = $ans_no;
|
280 |
}
|
281 |
-
}
|
|
|
282 |
$results_tabulated_cols = $question->display_results_tabulated_cols;
|
283 |
}
|
284 |
|
1 |
+
<?php
|
2 |
|
3 |
Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
|
4 |
{
|
17 |
|
18 |
if ('' == $template_id) {
|
19 |
return "";
|
20 |
+
}
|
21 |
+
else {
|
22 |
$uID = uniqid('t');
|
23 |
$poll = new YOP_POLL_Poll_Model();
|
24 |
+
$template_details = self::get_poll_template_from_database(intval($template_id));
|
25 |
$template = $template_details['before_vote_template'];
|
26 |
$template = stripslashes_deep($template);
|
27 |
|
47 |
$t = $template;
|
48 |
$pattern = '\[(\[?)(QUESTION_CONTAINER)\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
|
49 |
preg_match("/$pattern/s", $t, $m);
|
50 |
+
//print_r($m);
|
51 |
$m = $m[5];
|
52 |
|
53 |
$m = str_ireplace("%POLL-QUESTION%", $question->question, $m);
|
280 |
if ($ans_no > 0) {
|
281 |
$results_tabulated_cols = $ans_no;
|
282 |
}
|
283 |
+
}
|
284 |
+
else if ('tabulated' == $question->display_results) {
|
285 |
$results_tabulated_cols = $question->display_results_tabulated_cols;
|
286 |
}
|
287 |
|
models/yop_poll_model.php
CHANGED
@@ -17,7 +17,8 @@
|
|
17 |
$orderby = 'ID';
|
18 |
$order = 'ASC';
|
19 |
$limit = null;
|
20 |
-
|
|
|
21 |
if( isset( $args['return_fields'] ) ) {
|
22 |
$return_fields = trim( $args['return_fields'], ',' );
|
23 |
}
|
@@ -424,7 +425,23 @@
|
|
424 |
), $type = null, $poll_id = null, $offset = 0, $per_page = 99999999
|
425 |
) {
|
426 |
global $wpdb;
|
427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
if( 'id' == $orderby ) {
|
429 |
$orderby = $wpdb->yop_poll_bans . ".id";
|
430 |
}
|
17 |
$orderby = 'ID';
|
18 |
$order = 'ASC';
|
19 |
$limit = null;
|
20 |
+
|
21 |
+
|
22 |
if( isset( $args['return_fields'] ) ) {
|
23 |
$return_fields = trim( $args['return_fields'], ',' );
|
24 |
}
|
425 |
), $type = null, $poll_id = null, $offset = 0, $per_page = 99999999
|
426 |
) {
|
427 |
global $wpdb;
|
428 |
+
$allowed_order = array (
|
429 |
+
0 => "id",
|
430 |
+
1 => "name",
|
431 |
+
2 => "type",
|
432 |
+
3 => "value",
|
433 |
+
4 => "period",
|
434 |
+
5 => "unit"
|
435 |
+
);
|
436 |
+
|
437 |
+
if( !in_array( $orderby, $allowed_order ) ) {
|
438 |
+
$orderby = "id";
|
439 |
+
}
|
440 |
+
|
441 |
+
if( $order != "desc" && $order != "asc") {
|
442 |
+
$order = "desc";
|
443 |
+
}
|
444 |
+
|
445 |
if( 'id' == $orderby ) {
|
446 |
$orderby = $wpdb->yop_poll_bans . ".id";
|
447 |
}
|
readme.txt
CHANGED
@@ -142,6 +142,14 @@ You can have only one question per poll. If you want to ask more than one questi
|
|
142 |
|
143 |
== Changelog ==
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
= 5.7.7 =
|
146 |
* Fixed issue with translations
|
147 |
|
@@ -339,4 +347,4 @@ You can have only one question per poll. If you want to ask more than one questi
|
|
339 |
* Fixed do_shortcode() with missing argument bug
|
340 |
|
341 |
= 1.1 =
|
342 |
-
* Fixed call_user_func_array() bug
|
142 |
|
143 |
== Changelog ==
|
144 |
|
145 |
+
= 5.7.8 =
|
146 |
+
* Fixed issue with reset stats
|
147 |
+
* Fixed security issue
|
148 |
+
* Fixed issue with automatically reset stats
|
149 |
+
* Fixed issue with custom loading image
|
150 |
+
* Fixed display issues
|
151 |
+
* Updated Get Code with more options
|
152 |
+
|
153 |
= 5.7.7 =
|
154 |
* Fixed issue with translations
|
155 |
|
347 |
* Fixed do_shortcode() with missing argument bug
|
348 |
|
349 |
= 1.1 =
|
350 |
+
* Fixed call_user_func_array() bug
|
templates/polls_add_edit.html
CHANGED
@@ -22,7 +22,6 @@
|
|
22 |
</div><!-- titlediv -->
|
23 |
<hr class="yop-poll-sections-delimiter"/>
|
24 |
</div><!-- post-body-content -->
|
25 |
-
|
26 |
<div class="postbox-container" id="postbox-container-1">
|
27 |
<div class="postbox stuffbox">
|
28 |
<div title='{{ __("Click to toggle") }}' class="handlediv">
|
22 |
</div><!-- titlediv -->
|
23 |
<hr class="yop-poll-sections-delimiter"/>
|
24 |
</div><!-- post-body-content -->
|
|
|
25 |
<div class="postbox-container" id="postbox-container-1">
|
26 |
<div class="postbox stuffbox">
|
27 |
<div title='{{ __("Click to toggle") }}' class="handlediv">
|
templates/polls_add_edit_beginner.html
CHANGED
@@ -30,11 +30,8 @@
|
|
30 |
|
31 |
|
32 |
<div id="poststuff">
|
33 |
-
|
34 |
<div id="post-body" class="metabox-holder columns-2">
|
35 |
-
|
36 |
<div class="meta-box-sortables ui-sortable" id="normal-sortables">
|
37 |
-
|
38 |
<div id="post-body-content">
|
39 |
|
40 |
<div class="yop-poll-titlediv">
|
@@ -54,42 +51,24 @@
|
|
54 |
<hr class="yop-poll-sections-delimiter"/>
|
55 |
|
56 |
</div><!-- post-body-content -->
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
<div class="postbox-container" id="postbox-container-1">
|
61 |
-
|
62 |
<div id="submitdiv" class="postbox stuffbox">
|
63 |
-
|
64 |
<div title="Click to toggle" class="handlediv"><br></div>
|
65 |
-
|
66 |
<h3 class="hndle">
|
67 |
-
|
68 |
<span>Tools </span>
|
69 |
-
|
70 |
</h3>
|
71 |
-
|
72 |
<div class="inside">
|
73 |
-
|
74 |
<div id="submitpost" class="submitbox">
|
75 |
-
|
76 |
<div id="minor-publishing">
|
77 |
-
|
78 |
<div id="misc-publishing-actions">
|
79 |
-
|
80 |
<div class="misc-pub-section">
|
81 |
-
|
82 |
<label for="yop-poll-preview-button-1" class="button-primary">{{__("Preview")}}</label>
|
83 |
<input tabindex="200" type="button" class="button-primary" value="Preview" id="yop-poll-preview-button-1" style="display: none"
|
84 |
|
85 |
onclick="yop_poll_preview_add_edit()">
|
86 |
-
|
87 |
<div id="yop-poll-spinner" class="spinner"
|
88 |
-
|
89 |
style="display: none; float: left;"></div>
|
90 |
-
|
91 |
</div>
|
92 |
-
|
93 |
<div class="misc-pub-section">
|
94 |
|
95 |
<input type="hidden" value="{{ current_poll.ID }}" name="poll_id"/>
|
@@ -118,6 +97,8 @@
|
|
118 |
|
119 |
</div><!-- postbox-container-1 -->
|
120 |
|
|
|
|
|
121 |
<!-- Start Wizard Panel -->
|
122 |
|
123 |
<div id="yop-poll-wizard" class="swMain">
|
30 |
|
31 |
|
32 |
<div id="poststuff">
|
|
|
33 |
<div id="post-body" class="metabox-holder columns-2">
|
|
|
34 |
<div class="meta-box-sortables ui-sortable" id="normal-sortables">
|
|
|
35 |
<div id="post-body-content">
|
36 |
|
37 |
<div class="yop-poll-titlediv">
|
51 |
<hr class="yop-poll-sections-delimiter"/>
|
52 |
|
53 |
</div><!-- post-body-content -->
|
|
|
|
|
|
|
54 |
<div class="postbox-container" id="postbox-container-1">
|
|
|
55 |
<div id="submitdiv" class="postbox stuffbox">
|
|
|
56 |
<div title="Click to toggle" class="handlediv"><br></div>
|
|
|
57 |
<h3 class="hndle">
|
|
|
58 |
<span>Tools </span>
|
|
|
59 |
</h3>
|
|
|
60 |
<div class="inside">
|
|
|
61 |
<div id="submitpost" class="submitbox">
|
|
|
62 |
<div id="minor-publishing">
|
|
|
63 |
<div id="misc-publishing-actions">
|
|
|
64 |
<div class="misc-pub-section">
|
|
|
65 |
<label for="yop-poll-preview-button-1" class="button-primary">{{__("Preview")}}</label>
|
66 |
<input tabindex="200" type="button" class="button-primary" value="Preview" id="yop-poll-preview-button-1" style="display: none"
|
67 |
|
68 |
onclick="yop_poll_preview_add_edit()">
|
|
|
69 |
<div id="yop-poll-spinner" class="spinner"
|
|
|
70 |
style="display: none; float: left;"></div>
|
|
|
71 |
</div>
|
|
|
72 |
<div class="misc-pub-section">
|
73 |
|
74 |
<input type="hidden" value="{{ current_poll.ID }}" name="poll_id"/>
|
97 |
|
98 |
</div><!-- postbox-container-1 -->
|
99 |
|
100 |
+
|
101 |
+
|
102 |
<!-- Start Wizard Panel -->
|
103 |
|
104 |
<div id="yop-poll-wizard" class="swMain">
|
templates/polls_question_template.html
CHANGED
@@ -73,11 +73,9 @@
|
|
73 |
|
74 |
</div><!-- yop-poll-subsection -->
|
75 |
<div id="publishing-action">
|
76 |
-
|
77 |
<span class="spinner"></span>
|
78 |
<label for="yop-poll-edit-add-new-question-{{ question.ID }}-answer" class="button-primary">{{ __("Add New Answer") }}</label>
|
79 |
<input type="button" class="button-primary" value='{{ __("Add New Answer") }}' onclick="yop_poll_add_new_answer( '{{ question.ID }}', '', this,'text' )" style="display: none" id="yop-poll-edit-add-new-question-{{ question.ID }}-answer"/>
|
80 |
-
|
81 |
</div>
|
82 |
<!-- End Answers section -->
|
83 |
|
@@ -86,8 +84,11 @@
|
|
86 |
<hr class="yop-poll-sections-delimiter"/>
|
87 |
<!-- Start Question Options section -->
|
88 |
<div class="yop-poll-subsection postbox closed" style="">
|
89 |
-
|
90 |
-
<
|
|
|
|
|
|
|
91 |
|
92 |
<h4 class="yop-poll-subsection-title hndle" style="padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{ __( "Question Options" ) }}:</h4>
|
93 |
|
@@ -189,7 +190,10 @@
|
|
189 |
|
190 |
<!-- Start Custom Fields section -->
|
191 |
<div class="yop-poll-subsection postbox closed" id="yop-poll-customfieldsdiv">
|
192 |
-
<
|
|
|
|
|
|
|
193 |
<h4 class="yop-poll-subsection-title hndle" style="padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{__( "Custom Fields" ) }}:</h4>
|
194 |
<div class="inside" style="border-top: 1px solid #AAAAAA;; padding-top: 5px;">
|
195 |
<table cellspacing="0" class="links-table"
|
@@ -237,18 +241,18 @@
|
|
237 |
</table>
|
238 |
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
|
253 |
</div>
|
254 |
</div>
|
73 |
|
74 |
</div><!-- yop-poll-subsection -->
|
75 |
<div id="publishing-action">
|
|
|
76 |
<span class="spinner"></span>
|
77 |
<label for="yop-poll-edit-add-new-question-{{ question.ID }}-answer" class="button-primary">{{ __("Add New Answer") }}</label>
|
78 |
<input type="button" class="button-primary" value='{{ __("Add New Answer") }}' onclick="yop_poll_add_new_answer( '{{ question.ID }}', '', this,'text' )" style="display: none" id="yop-poll-edit-add-new-question-{{ question.ID }}-answer"/>
|
|
|
79 |
</div>
|
80 |
<!-- End Answers section -->
|
81 |
|
84 |
<hr class="yop-poll-sections-delimiter"/>
|
85 |
<!-- Start Question Options section -->
|
86 |
<div class="yop-poll-subsection postbox closed" style="">
|
87 |
+
|
88 |
+
<button type="button" class="handlediv button-link" aria-expanded="true">
|
89 |
+
<span class="screen-reader-text">Toggle panel: Question Options</span>
|
90 |
+
<span class="toggle-indicator" aria-hidden="true"></span>
|
91 |
+
</button>
|
92 |
|
93 |
<h4 class="yop-poll-subsection-title hndle" style="padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{ __( "Question Options" ) }}:</h4>
|
94 |
|
190 |
|
191 |
<!-- Start Custom Fields section -->
|
192 |
<div class="yop-poll-subsection postbox closed" id="yop-poll-customfieldsdiv">
|
193 |
+
<button type="button" class="handlediv button-link" aria-expanded="true">
|
194 |
+
<span class="screen-reader-text">{{__( "Toggle panel: Custom Fields" ) }}</span>
|
195 |
+
<span class="toggle-indicator" aria-hidden="true"></span>
|
196 |
+
</button>
|
197 |
<h4 class="yop-poll-subsection-title hndle" style="padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{__( "Custom Fields" ) }}:</h4>
|
198 |
<div class="inside" style="border-top: 1px solid #AAAAAA;; padding-top: 5px;">
|
199 |
<table cellspacing="0" class="links-table"
|
241 |
</table>
|
242 |
|
243 |
|
244 |
+
<div id="yop-poll-add-customfield-holder" style="float:right;">
|
245 |
+
<input type="hidden" id="yop-poll-question-{{question.ID}}-custom-fields-no" value="{{ i+1 }}">
|
246 |
+
<label for="yop-poll-add-customfield-button" class="button-primary">{{ __( "Add New Custom Field" ) }}</label>
|
247 |
+
<input
|
248 |
+
type="button"
|
249 |
+
style="display: none"
|
250 |
+
id="yop-poll-add-customfield-button"
|
251 |
+
class="button-primary"
|
252 |
+
value='{{ __( "Add New Custom Field" ) }}'
|
253 |
+
onclick="yop_poll_add_table_customfield( '#yop-poll-customfields-table-{{question.ID}}' , '{{ question.ID }}' )">
|
254 |
+
</div>
|
255 |
+
<br> <br>
|
256 |
|
257 |
</div>
|
258 |
</div>
|
templates/polls_results_votes.html
CHANGED
@@ -142,14 +142,11 @@
|
|
142 |
<!-- Close button -->
|
143 |
|
144 |
<p style="text-align:center; font-weight: bold; font-size: 16px">
|
145 |
-
|
146 |
<input type = "hidden" name = "action" value = "do-buy">
|
147 |
<label for="yop-poll-buy-pro-version" class="upgrade_button">{{__("Upgrade to Pro for only $17")}}</label>
|
148 |
<input id="yop-poll-buy-pro-version" style="display: none" type = "submit" name = "do_buy" class = "button-primary" value = 'Upgrade to Pro for only $17'>
|
149 |
</p>
|
150 |
|
151 |
-
|
152 |
-
|
153 |
</div>
|
154 |
|
155 |
</div>
|
@@ -157,7 +154,7 @@
|
|
157 |
|
158 |
<form style="display: none;text-align:center;font-size: 20px;font-weight: bold;" class="yop_poll_buy_pro" method="post" action="">
|
159 |
<div >
|
160 |
-
<p>{{ __("Please
|
161 |
<input type = "hidden" name = "action" value = "do-buy">
|
162 |
|
163 |
{{ wp_nonce_field('yop-poll-before-buy')|raw }}
|
@@ -252,21 +249,17 @@
|
|
252 |
|
253 |
|
254 |
<tr class="form-field form-required">
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
name="ban_value" value=""></textarea></td>
|
265 |
-
|
266 |
</tr>
|
267 |
-
|
268 |
</tbody>
|
269 |
-
|
270 |
</table>
|
271 |
|
272 |
<p class="submit">
|
@@ -363,11 +356,7 @@
|
|
363 |
|
364 |
|
365 |
<form method="post" action="?page=yop-polls&action=print_votes&id={{poll.ID}}" style="display: none" id="yop_poll_print_votes" target="_blank">
|
366 |
-
|
367 |
-
|
368 |
<div >
|
369 |
-
|
370 |
-
|
371 |
<table style="margin-left: auto; margin-right: auto;">
|
372 |
<tbody>
|
373 |
<tr>
|
@@ -599,7 +588,7 @@
|
|
599 |
{%for id in custom_field_detail.column_custom_fields_ids%}
|
600 |
{%set value=custom_field_detail.custom_fields_value%}
|
601 |
|
602 |
-
<td>{{
|
603 |
|
604 |
{%endfor%}
|
605 |
<td>{{custom_field_detail.vote_id}}</td>
|
@@ -777,7 +766,9 @@
|
|
777 |
|
778 |
|
779 |
|
780 |
-
</th>
|
|
|
|
|
781 |
|
782 |
style="width: 12%" scope="col">
|
783 |
|
@@ -788,7 +779,7 @@
|
|
788 |
|
789 |
|
790 |
</a></th>
|
791 |
-
|
792 |
|
793 |
|
794 |
|
@@ -873,17 +864,20 @@
|
|
873 |
|
874 |
|
875 |
|
876 |
-
</th>
|
|
|
|
|
877 |
|
878 |
style="width: 15%" scope="col">
|
879 |
|
880 |
|
881 |
|
882 |
-
<span>{{__( "
|
883 |
|
884 |
|
885 |
|
886 |
</a></th>
|
|
|
887 |
|
888 |
|
889 |
|
@@ -981,7 +975,7 @@
|
|
981 |
name="yoppollresultscheck[]">
|
982 |
|
983 |
</th>
|
984 |
-
|
985 |
<td><strong>{{result.vote_id}}</strong><br>
|
986 |
|
987 |
<br>
|
@@ -1007,7 +1001,7 @@
|
|
1007 |
|
1008 |
|
1009 |
</div></td>
|
1010 |
-
|
1011 |
<td style="display: none"><input id="yop-poll-results-ip_{{index}}" value="{{esc_html( stripslashes( result.ip ))}}"><input></td>
|
1012 |
|
1013 |
<td style="display: none"><input id="yop-poll-results-userid_{{index}}" value="{{esc_html( stripslashes( result.user_id ))}}"><input></td>
|
142 |
<!-- Close button -->
|
143 |
|
144 |
<p style="text-align:center; font-weight: bold; font-size: 16px">
|
|
|
145 |
<input type = "hidden" name = "action" value = "do-buy">
|
146 |
<label for="yop-poll-buy-pro-version" class="upgrade_button">{{__("Upgrade to Pro for only $17")}}</label>
|
147 |
<input id="yop-poll-buy-pro-version" style="display: none" type = "submit" name = "do_buy" class = "button-primary" value = 'Upgrade to Pro for only $17'>
|
148 |
</p>
|
149 |
|
|
|
|
|
150 |
</div>
|
151 |
|
152 |
</div>
|
154 |
|
155 |
<form style="display: none;text-align:center;font-size: 20px;font-weight: bold;" class="yop_poll_buy_pro" method="post" action="">
|
156 |
<div >
|
157 |
+
<p>{{ __("Please upgrade to pro to enable this feature!")}}</p>
|
158 |
<input type = "hidden" name = "action" value = "do-buy">
|
159 |
|
160 |
{{ wp_nonce_field('yop-poll-before-buy')|raw }}
|
249 |
|
250 |
|
251 |
<tr class="form-field form-required">
|
252 |
+
<th scope="row">
|
253 |
+
<label for="yop-poll-ban-value">{{__( "Value" )}}
|
254 |
+
<span class="description">{{__( "(required)" )}}</span>
|
255 |
+
<br>
|
256 |
+
<small><i>{{__( "One Value Per Line" ) }}</i></small></label>
|
257 |
+
</th>
|
258 |
+
<td>
|
259 |
+
<textarea rows="5" cols="30" id="yop-poll-ban-value" name="ban_value" value=""></textarea>
|
260 |
+
</td>
|
|
|
|
|
261 |
</tr>
|
|
|
262 |
</tbody>
|
|
|
263 |
</table>
|
264 |
|
265 |
<p class="submit">
|
356 |
|
357 |
|
358 |
<form method="post" action="?page=yop-polls&action=print_votes&id={{poll.ID}}" style="display: none" id="yop_poll_print_votes" target="_blank">
|
|
|
|
|
359 |
<div >
|
|
|
|
|
360 |
<table style="margin-left: auto; margin-right: auto;">
|
361 |
<tbody>
|
362 |
<tr>
|
588 |
{%for id in custom_field_detail.column_custom_fields_ids%}
|
589 |
{%set value=custom_field_detail.custom_fields_value%}
|
590 |
|
591 |
+
<td>{{custom_field_detail.custom_fields_value[id]}}</td>
|
592 |
|
593 |
{%endfor%}
|
594 |
<td>{{custom_field_detail.vote_id}}</td>
|
766 |
|
767 |
|
768 |
|
769 |
+
</th>
|
770 |
+
<!--
|
771 |
+
<th id="period"
|
772 |
|
773 |
style="width: 12%" scope="col">
|
774 |
|
779 |
|
780 |
|
781 |
</a></th>
|
782 |
+
-->
|
783 |
|
784 |
|
785 |
|
864 |
|
865 |
|
866 |
|
867 |
+
</th>
|
868 |
+
<!--
|
869 |
+
<th id="period"
|
870 |
|
871 |
style="width: 15%" scope="col">
|
872 |
|
873 |
|
874 |
|
875 |
+
<span>{{__( "Vote ID")}}</span>
|
876 |
|
877 |
|
878 |
|
879 |
</a></th>
|
880 |
+
-->
|
881 |
|
882 |
|
883 |
|
975 |
name="yoppollresultscheck[]">
|
976 |
|
977 |
</th>
|
978 |
+
<!--
|
979 |
<td><strong>{{result.vote_id}}</strong><br>
|
980 |
|
981 |
<br>
|
1001 |
|
1002 |
|
1003 |
</div></td>
|
1004 |
+
-->
|
1005 |
<td style="display: none"><input id="yop-poll-results-ip_{{index}}" value="{{esc_html( stripslashes( result.ip ))}}"><input></td>
|
1006 |
|
1007 |
<td style="display: none"><input id="yop-poll-results-userid_{{index}}" value="{{esc_html( stripslashes( result.user_id ))}}"><input></td>
|
templates/polls_view.html
CHANGED
@@ -1,441 +1,316 @@
|
|
1 |
{% extends "polls_base.html" %}
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
{% block content %}
|
7 |
|
8 |
|
9 |
-
<a id="yop-poll-show-modal-box"
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
</
|
23 |
-
|
24 |
-
<
|
25 |
-
|
26 |
-
|
27 |
-
<div
|
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 |
-
<div class="wf-contbox">
|
53 |
-
<div class="wf-inputpos">
|
54 |
-
<label for="send-me-fre-guide" class="wf-button"> {{__( "Send me the FREE guide!")}}</label>
|
55 |
-
<input style="display: none" id="send-me-fre-guide" type="submit" value='{{__( "Send me the FREE guide!")}}' class="wf-button" name="submit"></input>
|
56 |
-
</div>
|
57 |
-
<em class="clearfix clearer"></em>
|
58 |
-
</div>
|
59 |
-
</li>
|
60 |
-
<li class="wf-captcha" rel="undefined"
|
61 |
-
style="display: none !important;">
|
62 |
-
<div wf-captchaerror=" Incorrect please try again"
|
63 |
-
wf-captchasound="Enter the numbers you hear:"
|
64 |
-
wf-captchaword="Enter the words above:', 'yop_poll"
|
65 |
-
class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
|
66 |
-
</li>
|
67 |
-
</ul>
|
68 |
-
</div>
|
69 |
-
<div id="WFIfooter" class="wf-footer el">
|
70 |
-
<div class="actTinyMceElBodyContent"></div>
|
71 |
-
<em class="clearfix clearer"></em>
|
72 |
-
</div>
|
73 |
-
</div>
|
74 |
-
<input type="hidden" name="webform_id" value="394041"/>
|
75 |
-
<div style="margin-bottom:15px">
|
76 |
-
<p style="margin: 0px"> {{__(" Have you found this plugin useful?")}} </p>
|
77 |
-
<a href="http://wordpress.org/support/view/plugin-reviews/yop-poll?filter=5" target="_blank"> {{__(" Rate YOP POLL 5★'s on WordPress.org")}} </a>
|
78 |
-
</div>
|
79 |
-
</form>
|
80 |
-
</div>
|
81 |
</div>
|
82 |
-
{%endif%}
|
83 |
-
|
84 |
-
<div id="post-body-content">
|
85 |
-
<form action="" method="get" style="{%if ok==0%}width:135% {%endif%}">
|
86 |
-
|
87 |
-
{{ wp_nonce_field( 'yop-poll-view-action', 'yop-poll-view-name', false, false ) | raw }}
|
88 |
-
|
89 |
-
<input type="hidden" name="order" value="{{ order }}"/>
|
90 |
-
|
91 |
-
<input type="hidden" name="orderby" value="{{ orderby }}"/>
|
92 |
-
|
93 |
-
<input type="hidden" name="page" value="yop-polls"/>
|
94 |
-
|
95 |
-
<p class="search-box" style="margin: 0 12px 2px 0 !important;">
|
96 |
-
|
97 |
-
<label class="screen-reader-text" for="yop-poll-search-input">{{ __( "Search Polls" ) }}</label>
|
98 |
-
|
99 |
-
<input id="yop-poll-search-input" class="align-with-item-per-page" type="search" value="{% if REQUEST.s %}{{ REQUEST.s }}{% endif %}" name="s"/>
|
100 |
-
|
101 |
-
<input id="search-submit" class="button" type="submit" value='{{ __( "Search Polls" ) }}'/>
|
102 |
-
|
103 |
-
</p>
|
104 |
-
|
105 |
-
<div class="tablenav top">
|
106 |
-
|
107 |
-
<div class="alignleft actions">
|
108 |
-
|
109 |
-
<select name="action">
|
110 |
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
<option value="delete_logs">{{ __("Delete Logs") }}</option>
|
122 |
-
|
123 |
-
</select>
|
124 |
-
<label style="display: none" for="doaction" class="button-secondary action">{{ __("Apply") }}</label>
|
125 |
-
<input type="submit" value='{{ __("Apply") }}' class="button-secondary action" id="doaction" name="">
|
126 |
-
|
127 |
</div>
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
</div>
|
|
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
</
|
166 |
-
|
167 |
-
<
|
168 |
-
|
169 |
-
<
|
170 |
-
|
171 |
-
<
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
</
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
{% endif %}
|
256 |
-
|
257 |
-
{{ poll.poll_title }}
|
258 |
-
|
259 |
-
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
260 |
-
|
261 |
-
</a>
|
262 |
-
|
263 |
-
{% endif %}
|
264 |
-
|
265 |
-
</strong><br>
|
266 |
-
|
267 |
-
<div class="row-actions">
|
268 |
-
<i>
|
269 |
-
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
270 |
-
<span class="edit">
|
271 |
-
<a style="cursor: pointer" onclick="yop_poll_show_poll_shortcode({{poll.ID}})">{{ __( "Get Code" ) }}</a> |
|
272 |
-
</span>
|
273 |
-
{%endif%}
|
274 |
-
|
275 |
-
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
276 |
-
<span class="edit">
|
277 |
-
<a href="{{ esc_url( add_query_arg( {'action' : 'edit', 'id' : poll.ID } ) ) | raw }}">{{ __( "Edit" ) }}</a> |
|
278 |
-
</span>
|
279 |
-
{% endif %}
|
280 |
-
|
281 |
-
{% if ( current_user_can( 'clone_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'clone_yop_polls' ) ) %}
|
282 |
-
<span class="clone">
|
283 |
-
<a onclick="return confirm( '{{ __( " You are about to clone this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to clone" ) }}' )"
|
284 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'clone', 'id' : poll.ID } ),'yop-poll-view-action', 'yop-poll-view-name' ) | raw }}"
|
285 |
class="submitclone">{{ __( "Clone" ) }}</a> |
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
<span class="delete">
|
292 |
-
<a onclick="return confirm( '{{ __( " You are about to delete this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to delete" ) }}' )"
|
293 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'delete', 'id' : poll.ID } ), 'yop-poll-delete' ) | raw }}"
|
294 |
-
class="submitdelete">{{ __("Delete" ) }}</a>
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
{% if ( current_user_can( 'reset_own_yop_polls_stats') and poll.poll_author == current_user.ID ) or ( current_user_can( 'reset_yop_polls_stats' ) ) %}
|
311 |
-
<span class="delete">
|
312 |
-
<a onclick="return confirm( '{{ __( " You are about to reset votes for this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to reset votes" ) }}' )"
|
313 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'reset_votes', 'id' : poll.ID } ), 'yop-poll-view-action', 'yop-poll-view-name' ) | raw }}"
|
314 |
class="submitresetvotes">{{ __( 'Reset Stats') }}</a>
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
<
|
354 |
-
|
355 |
-
<
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
</
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
{
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
style="" scope="col"><input type="checkbox"></th>
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
<th id="name" class="manage-column {{ order_sortable.poll_title }} {{ order_direction_reverse.poll_title }}" style="" scope="col">
|
380 |
-
|
381 |
-
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_title', 'order' : order_direction.poll_title } ) ) | raw }}">
|
382 |
-
|
383 |
-
<span>{{ __("Title" ) }}</span>
|
384 |
-
|
385 |
-
<span class="sorting-indicator"></span>
|
386 |
-
|
387 |
-
</a>
|
388 |
-
|
389 |
-
</th>
|
390 |
-
|
391 |
-
<th id="total_votes" class="manage-column {{ order_sortable.poll_total_votes }} {{ order_direction_reverse.poll_total_votes }}" style="" scope="col">
|
392 |
-
|
393 |
-
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_total_votes', 'order' : order_direction.poll_total_votes } ) ) | raw }}">
|
394 |
-
|
395 |
-
<span>{{ __("Total Votes" ) }}</span>
|
396 |
-
|
397 |
-
<span class="sorting-indicator"></span>
|
398 |
-
|
399 |
-
</a>
|
400 |
-
|
401 |
-
</th>
|
402 |
-
|
403 |
-
<th id="poll_author" class="manage-column" style="width: 5%" scope="col"><span>{{ __('Author') }}</span></th>
|
404 |
-
|
405 |
-
<th id="start-date" class="manage-column {{ order_sortable.poll_start_date }} {{ order_direction_reverse.poll_start_date }}" style="" scope="col">
|
406 |
-
|
407 |
-
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_start_date', 'order' : order_direction.poll_start_date } ) ) | raw }}">
|
408 |
-
|
409 |
-
<span>{{ __("Start Date") }}</span>
|
410 |
-
|
411 |
-
<span class="sorting-indicator"></span>
|
412 |
-
|
413 |
-
</a>
|
414 |
-
|
415 |
-
</th>
|
416 |
-
|
417 |
-
<th id="end-date" class="manage-column {{ order_sortable.poll_end_date }} {{ order_direction_reverse.poll_end_date }}" style="" scope="col">
|
418 |
-
|
419 |
-
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_end_date', 'order' : order_direction.poll_end_date } ) ) | raw }}">
|
420 |
-
|
421 |
-
<span>{{ __("End Date") }}</span>
|
422 |
-
|
423 |
-
<span class="sorting-indicator"></span>
|
424 |
-
|
425 |
-
</a>
|
426 |
-
|
427 |
-
</th>
|
428 |
-
|
429 |
-
</tr>
|
430 |
-
|
431 |
-
</tfoot>
|
432 |
-
|
433 |
-
</table>
|
434 |
-
|
435 |
</form>
|
436 |
<br class="clear">
|
437 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
</div>
|
439 |
-
</div>
|
440 |
-
|
441 |
{% endblock content %}
|
1 |
{% extends "polls_base.html" %}
|
2 |
|
3 |
+
{% block addnew %}
|
4 |
+
<a class="add-new-h2" href="{{ esc_url( add_query_arg( { 'page' : 'yop-polls-add-new', 'id' : false, 'deleted' : false, 'cloned' : false } ) ) | raw }}">{{ __("Add New") }}</a>
|
5 |
+
{% endblock addnew %}
|
6 |
|
7 |
{% block content %}
|
8 |
|
9 |
|
10 |
+
<a id="yop-poll-show-modal-box" href="{{optin_box_modal_query}}" style="display:none"></a>
|
11 |
+
<div id="WFItem394041" class="wf-formTpl" style="display: none;">
|
12 |
+
<a href="javascript:Custombox.close()" id="yop-poll-close-modal-box">
|
13 |
+
<span>x</span>
|
14 |
+
</a>
|
15 |
+
<form accept-charset="utf-8" target="_top">
|
16 |
+
<div class="box">
|
17 |
+
<div id="WFIcenter" class="wf-body">
|
18 |
+
<ul class="wf-sortable" id="wf-sort-id">
|
19 |
+
<li>
|
20 |
+
<div id="circle"><h1>?</h1></div>
|
21 |
+
<p><h2>Need Help?</h2>
|
22 |
+
<br>
|
23 |
+
<h3>Download<br /> YOP Poll User Guide</h3></p>
|
24 |
+
</li>
|
25 |
+
<li class="wf-email" rel="undefined"
|
26 |
+
style="display: block !important;">
|
27 |
+
<div class="wf-contbox">
|
28 |
+
<div class="wf-inputpos">
|
29 |
+
<label for="email" data-icon="e"/>
|
30 |
+
<input id="email" type="text" class="wf-input"
|
31 |
+
name="email" placeholder="Email Address"></input>
|
32 |
+
</div>
|
33 |
+
<em class="clearfix clearer"></em>
|
34 |
+
</div>
|
35 |
+
</li>
|
36 |
+
<li>
|
37 |
+
<br />
|
38 |
+
</li>
|
39 |
+
<li class="wf-submit" rel="undefined" style="display: block !important;">
|
40 |
+
<a style="color: rgb(255, 255, 255); background-color: rgb(14, 141, 199);" class="elButton elButtonColor1 elButtonSize2 elButtonBottomBorder" href="#">
|
41 |
+
<span class="">Send me the FREE guide!</span>
|
42 |
+
<span class="elButtonSub"></span>
|
43 |
+
</a>
|
44 |
+
</li>
|
45 |
+
</ul>
|
46 |
+
</div>
|
47 |
+
<div id="WFIfooter" class="wf-footer el">
|
48 |
+
<div class="actTinyMceElBodyContent"></div>
|
49 |
+
<em class="clearfix clearer"></em>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
+
<form style="display: none; width: auto; min-height: 0px;" id="yop_poll_show_shortcode">
|
57 |
+
<div style="text-align: center">
|
58 |
+
{{ __("Place the shortcode below on your pages or posts to display the poll:")}}
|
59 |
+
<br /><br />
|
60 |
+
</div>
|
61 |
+
<div style="text-align: center">
|
62 |
+
<input type="text" size="60" id="yop_poll_shortcode_input" readonly>
|
63 |
+
<br /><br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
</div>
|
65 |
+
<div style="text-align: center">
|
66 |
+
{{ __("If you want to customize it, you can do that below")}}
|
67 |
+
<br /><br />
|
68 |
+
</div>
|
69 |
+
<div>
|
70 |
+
<table class="wp-list-table widefat pages">
|
71 |
+
<tr>
|
72 |
+
<td style="text-align: left">
|
73 |
+
Tracking Id:
|
74 |
+
</td>
|
75 |
+
<td>
|
76 |
+
<input type="text" placeholder="Leave empty if none" id="poll_tracking_id" size="35">
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
<tr>
|
80 |
+
<td style="text-align: left">
|
81 |
+
Display Results Only:
|
82 |
+
</td>
|
83 |
+
<td style="text-align: left">
|
84 |
+
<input type="radio" name="poll_display_results" value="-1" checked="checked">No
|
85 |
+
<input type="radio" name="poll_display_results" value="1">Yes
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td colspan="2" style="text-align: center">
|
90 |
+
<input type="button" value="Generate Code" class="button generate-code-button">
|
91 |
+
</td>
|
92 |
+
</tr>
|
93 |
+
</table>
|
94 |
</div>
|
95 |
+
</form>
|
96 |
|
97 |
+
<div id="poststuff">
|
98 |
+
<div id="post-body" class="metabox-holder columns-2">
|
99 |
+
<div id="post-body-content">
|
100 |
+
<form action="" method="get">
|
101 |
+
{{ wp_nonce_field( 'yop-poll-view-action', 'yop-poll-view-name', false, false ) | raw }}
|
102 |
+
<input type="hidden" name="order" value="{{ order }}"/>
|
103 |
+
<input type="hidden" name="orderby" value="{{ orderby }}"/>
|
104 |
+
<input type="hidden" name="page" value="yop-polls"/>
|
105 |
+
<div class="tablenav top">
|
106 |
+
<div class="alignleft actions">
|
107 |
+
<select name="action">
|
108 |
+
<option selected="selected" value="-1">{{ __("Bulk Actions") }}</option>
|
109 |
+
<option value="delete">{{ __("Delete") }}</option>
|
110 |
+
<option value="clone">{{ __("Clone") }}</option>
|
111 |
+
<option value="reset_votes">{{ __("Reset Votes") }}</option>
|
112 |
+
<option value="delete_logs">{{ __("Delete Logs") }}</option>
|
113 |
+
</select>
|
114 |
+
<label style="display: none" for="doaction" class="button-secondary action">{{ __("Apply") }}</label>
|
115 |
+
<input type="submit" value='{{ __("Apply") }}' class="button-secondary action" id="doaction" name="">
|
116 |
+
</div>
|
117 |
+
<div class="alignleft actions">
|
118 |
+
<select name="filters">
|
119 |
+
<option value="0">{{ __("View All Polls") }}</option>
|
120 |
+
<option {{ selected( REQUEST.filters, 'never_expire', false )| raw }} value="never_expire">{{ __("No end date") }}</option>
|
121 |
+
<option {{ selected( REQUEST.filters, 'expired', false )| raw }} value="expired">{{ __("Expired") }}</option>
|
122 |
+
<option {{ selected( REQUEST.filters, 'started', false )| raw }} value="started">{{ __("Started") }}</option>
|
123 |
+
<option {{ selected( REQUEST.filters, 'not_started', false )| raw }} value="not_started">{{ __("Not Started") }}</option>
|
124 |
+
</select>
|
125 |
+
<label for="post-query-submit" class="button-secondary">{{__( "Filter" ) }}</label>
|
126 |
+
<input type="submit" value='{{ __("Filter") }}' class="button-secondary" id="post-query-submit" name="" style="display: none">
|
127 |
+
</div>
|
128 |
+
<div class="tablenav-pages one-page ">
|
129 |
+
<label class="screen-reader-text" for="yop-poll-search-input">{{ __( "Search Polls" ) }}</label>
|
130 |
+
<input id="yop-poll-search-input" class="align-with-item-per-page" type="search" value="{% if REQUEST.s %}{{ REQUEST.s }}{% endif %}" name="s"/>
|
131 |
+
<input id="search-submit" class="button" type="submit" value='{{ __( "Search Polls" ) }}'/>
|
132 |
+
</div>
|
133 |
+
<br class="clear">
|
134 |
+
</div>
|
135 |
+
<table class="wp-list-table widefat pages">
|
136 |
+
<thead>
|
137 |
+
<tr valign="middle">
|
138 |
+
<td scope="col" id="cb" class="manage-column column-cb check-column">
|
139 |
+
<label class="screen-reader-text" for="cb-select-all-1">Select All</label>
|
140 |
+
<input id="cb-select-all-1" type="checkbox" />
|
141 |
+
</td>
|
142 |
+
<th scope="col" id="name" class="manage-column column-title column-primary {{ order_sortable.poll_title }} {{ order_direction_reverse.poll_title }}">
|
143 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_title', 'order' : order_direction.poll_title } ) ) | raw }}">
|
144 |
+
<span>{{ __("Title" ) }}</span><span class="sorting-indicator"></span>
|
145 |
+
</a>
|
146 |
+
</th>
|
147 |
+
<th id="total_votes" class="manage-column {{ order_sortable.poll_total_votes }} {{ order_direction_reverse.poll_total_votes }}" style="" scope="col">
|
148 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_total_votes', 'order' : order_direction.poll_total_votes } ) ) | raw }}">
|
149 |
+
<span>{{ __("Total Votes" ) }}</span>
|
150 |
+
<span class="sorting-indicator"></span>
|
151 |
+
</a>
|
152 |
+
</th>
|
153 |
+
<th id="poll_author" class="manage-column" scope="col"><span>{{ __("Author") }}</span></th>
|
154 |
+
<th id="start-date" class="manage-column {{ order_sortable.poll_start_date }} {{ order_direction_reverse.poll_start_date }}" style="" scope="col">
|
155 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_start_date', 'order' : order_direction.poll_start_date } ) ) | raw }}">
|
156 |
+
<span>{{ __("Start Date") }}</span>
|
157 |
+
<span class="sorting-indicator"></span>
|
158 |
+
</a>
|
159 |
+
</th>
|
160 |
+
<th id="end-date" class="manage-column {{ order_sortable.poll_end_date }} {{ order_direction_reverse.poll_end_date }}" style="" scope="col">
|
161 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_end_date', 'order' : order_direction.poll_end_date } ) ) | raw }}">
|
162 |
+
<span>{{ __("End Date") }}</span>
|
163 |
+
<span class="sorting-indicator"></span>
|
164 |
+
</a>
|
165 |
+
</th>
|
166 |
+
</tr>
|
167 |
+
</thead>
|
168 |
+
{% for poll in polls %}
|
169 |
+
<tbody id="the-list">
|
170 |
+
<tr valign="middle" class="alternate" id="yop-poll-{{ poll.ID }}">
|
171 |
+
<th class="check-column" scope="row">
|
172 |
+
{% if ( current_user_can( 'delete_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'delete_yop_polls' ) ) %}
|
173 |
+
<input type="checkbox" value="{{ poll.ID }}" name="yoppollcheck[]">
|
174 |
+
{% endif %}
|
175 |
+
</th>
|
176 |
+
<td>
|
177 |
+
<strong>
|
178 |
+
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
179 |
+
<a title="{{ poll.poll_title }}" href="{{ esc_url( add_query_arg( {'action' : 'edit', 'id' : poll.ID } ) ) | raw }}" class="row-title">
|
180 |
+
{% endif %}
|
181 |
+
{{ poll.poll_title }}
|
182 |
+
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
183 |
+
</a>
|
184 |
+
{% endif %}
|
185 |
+
</strong>
|
186 |
+
<br>
|
187 |
+
<div class="row-actions">
|
188 |
+
<i>
|
189 |
+
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
190 |
+
<span class="edit">
|
191 |
+
<a style="cursor: pointer" onclick="yop_poll_show_poll_shortcode({{poll.ID}})">{{ __( "Get Code" ) }}</a> |
|
192 |
+
</span>
|
193 |
+
{%endif%}
|
194 |
+
{% if ( current_user_can( 'edit_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'edit_yop_polls' ) ) %}
|
195 |
+
<span class="edit">
|
196 |
+
<a href="{{ esc_url( add_query_arg( {'action' : 'edit', 'id' : poll.ID } ) ) | raw }}">{{ __( "Edit" ) }}</a> |
|
197 |
+
</span>
|
198 |
+
{% endif %}
|
199 |
+
{% if ( current_user_can( 'clone_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'clone_yop_polls' ) ) %}
|
200 |
+
<span class="clone">
|
201 |
+
<a onclick="return confirm( '{{ __( " You are about to clone this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to clone" ) }}' )"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'clone', 'id' : poll.ID } ),'yop-poll-view-action', 'yop-poll-view-name' ) | raw }}"
|
203 |
class="submitclone">{{ __( "Clone" ) }}</a> |
|
204 |
+
</span>
|
205 |
+
{% endif %}
|
206 |
+
{% if ( current_user_can( 'delete_own_yop_polls') and poll.poll_author == current_user.ID ) or ( current_user_can( 'delete_yop_polls' ) ) %}
|
207 |
+
<span class="delete">
|
208 |
+
<a onclick="return confirm( '{{ __( " You are about to delete this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to delete" ) }}' )"
|
|
|
|
|
209 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'delete', 'id' : poll.ID } ), 'yop-poll-delete' ) | raw }}"
|
210 |
+
class="submitdelete">{{ __("Delete" ) }}</a> |
|
211 |
+
</span>
|
212 |
+
{% endif %}
|
213 |
+
{% if ( current_user_can( 'view_own_yop_polls_results') and poll.poll_author == current_user.ID ) or ( current_user_can( 'view_yop_polls_results' ) ) %}
|
214 |
+
<span class="results" >
|
215 |
+
<a id="yop-poll-for-slider-page-7" href="/" onclick="return false" class="yop_poll_tooltip-buy_pro yop_poll_slider">{{ __( "Results" ) }}</a> |
|
216 |
+
</span>
|
217 |
+
{% endif %}
|
218 |
+
<span class="results">
|
219 |
+
<a href="{{ add_query_arg( {'action' : 'resultvotes', 'id' : poll.ID } ) }}" class="submitvotes">{{ __("View votes" ) }}</a> |
|
220 |
+
</span>
|
221 |
+
{% if ( current_user_can( 'reset_own_yop_polls_stats') and poll.poll_author == current_user.ID ) or ( current_user_can( 'reset_yop_polls_stats' ) ) %}
|
222 |
+
<span class="delete">
|
223 |
+
<a onclick="return confirm( '{{ __( " You are about to reset votes for this poll" ) }}: {{ poll.poll_title }} \n{{ __( "Cancel" ) }} {{ __( "to stop" ) }}, {{ __( "OK" ) }} {{ __( "to reset votes" ) }}' )"
|
|
|
|
|
|
|
|
|
|
|
224 |
href="{{ wp_nonce_url( add_query_arg( {'action' : 'reset_votes', 'id' : poll.ID } ), 'yop-poll-view-action', 'yop-poll-view-name' ) | raw }}"
|
225 |
class="submitresetvotes">{{ __( 'Reset Stats') }}</a>
|
226 |
+
</span>
|
227 |
+
{% endif %}
|
228 |
+
</i>
|
229 |
+
</div>
|
230 |
+
</td>
|
231 |
+
<td>
|
232 |
+
{{ poll.poll_total_votes }}
|
233 |
+
</td>
|
234 |
+
<td>
|
235 |
+
{{ poll.poll_author }}
|
236 |
+
</td>
|
237 |
+
<td>
|
238 |
+
{{convert_date( poll.poll_start_date,date_format)}}
|
239 |
+
</td>
|
240 |
+
<td>
|
241 |
+
{% if convert_date( poll.poll_end_date, 'd-m-Y H:i:s') == convert_date( "01-01-2038 23:59:59", 'd-m-Y H:i:s') %} No end date {% else %} {{ convert_date( poll.poll_end_date, date_format) }} {% endif %}
|
242 |
+
</td>
|
243 |
+
</tr>
|
244 |
+
</tbody>
|
245 |
+
{% else %}
|
246 |
+
<tbody id="the-list">
|
247 |
+
<tr valign="middle" class="alternate" id="no-yop-poll">
|
248 |
+
<th colspan="7">
|
249 |
+
{{ __("No polls found!") }}
|
250 |
+
</th>
|
251 |
+
</tr>
|
252 |
+
</tbody>
|
253 |
+
{% endfor %}
|
254 |
+
<tfoot>
|
255 |
+
<tr>
|
256 |
+
<td id="cb" class="manage-column column-cb check-column" style="" scope="col"><input type="checkbox"></td>
|
257 |
+
<th id="name" class="manage-column {{ order_sortable.poll_title }} {{ order_direction_reverse.poll_title }}" style="" scope="col">
|
258 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_title', 'order' : order_direction.poll_title } ) ) | raw }}">
|
259 |
+
<span>{{ __("Title" ) }}</span>
|
260 |
+
<span class="sorting-indicator"></span>
|
261 |
+
</a>
|
262 |
+
</th>
|
263 |
+
<th id="total_votes" class="manage-column {{ order_sortable.poll_total_votes }} {{ order_direction_reverse.poll_total_votes }}" style="" scope="col">
|
264 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_total_votes', 'order' : order_direction.poll_total_votes } ) ) | raw }}">
|
265 |
+
<span>{{ __("Total Votes" ) }}</span>
|
266 |
+
<span class="sorting-indicator"></span>
|
267 |
+
</a>
|
268 |
+
</th>
|
269 |
+
<th id="poll_author" class="manage-column" style="width: 5%" scope="col"><span>{{ __('Author') }}</span></th>
|
270 |
+
<th id="start-date" class="manage-column {{ order_sortable.poll_start_date }} {{ order_direction_reverse.poll_start_date }}" style="" scope="col">
|
271 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_start_date', 'order' : order_direction.poll_start_date } ) ) | raw }}">
|
272 |
+
<span>{{ __("Start Date") }}</span>
|
273 |
+
<span class="sorting-indicator"></span>
|
274 |
+
</a>
|
275 |
+
</th>
|
276 |
+
<th id="end-date" class="manage-column {{ order_sortable.poll_end_date }} {{ order_direction_reverse.poll_end_date }}" style="" scope="col">
|
277 |
+
<a href="{{ esc_url( add_query_arg( { 'orderby' : 'poll_end_date', 'order' : order_direction.poll_end_date } ) ) | raw }}">
|
278 |
+
<span>{{ __("End Date") }}</span>
|
279 |
+
<span class="sorting-indicator"></span>
|
280 |
+
</a>
|
281 |
+
</th>
|
282 |
+
</tr>
|
283 |
+
</tfoot>
|
284 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
</form>
|
286 |
<br class="clear">
|
287 |
</div>
|
288 |
+
<div id="postbox-container-1" class="postbox-container">
|
289 |
+
<div id="side-sortables" class="meta-box-sortables">
|
290 |
+
<div id="submitdiv" class="postbox " >
|
291 |
+
<button type="button" class="handlediv button-link" aria-expanded="true">
|
292 |
+
<span class="screen-reader-text">{{__( "Toggle panel: Support This Plugin" ) }}</span>
|
293 |
+
<span class="toggle-indicator" aria-hidden="true"></span>
|
294 |
+
</button>
|
295 |
+
<h3 class='hndle'><span>{{ __( 'Support This Plugin')}}</span></h3>
|
296 |
+
<div id="donate" class="inside">
|
297 |
+
<p class="header" style="text-align: center;">
|
298 |
+
{{ __( 'Have you found this plugin useful?')}}
|
299 |
+
</p>
|
300 |
+
<p class="subheader">
|
301 |
+
{{ __("Please help support it's continued development with a review")}}
|
302 |
+
</p>
|
303 |
+
<p style="text-align: center;">
|
304 |
+
<a href="http://wordpress.org/support/view/plugin-reviews/yop-poll?filter=5" target="_blank">
|
305 |
+
<div class="subheader" style="text-align: center;">
|
306 |
+
<span>{{ __( 'Rate YOP Poll 5' )}} ★ {{__( 'on WordPress.org ' )}}</span>
|
307 |
+
</div>
|
308 |
+
</a>
|
309 |
+
</p>
|
310 |
+
</div>
|
311 |
+
</div>
|
312 |
+
</div>
|
313 |
+
</div>
|
314 |
+
</div>
|
315 |
</div>
|
|
|
|
|
316 |
{% endblock content %}
|
tinymce/yop-poll-editor-functions.js
CHANGED
@@ -1,14 +1,26 @@
|
|
1 |
-
function insertYopPoll( destination, poll_id, tr_id ) {
|
2 |
tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
|
3 |
if ( isNaN( poll_id ) ) {
|
4 |
edInsertContent( destination, '[yop_poll]' );
|
5 |
}
|
6 |
else {
|
7 |
if ( poll_id != null && poll_id != '' ) {
|
8 |
-
if
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
else {
|
14 |
edInsertContent( destination, '[yop_poll]' );
|
@@ -18,32 +30,31 @@ function insertYopPoll( destination, poll_id, tr_id ) {
|
|
18 |
}
|
19 |
|
20 |
function show_tb() {
|
21 |
-
var openURL = yop_poll_editor_config.dialog_html_url + '&height=
|
22 |
tb_show( yop_poll_editor_config.title, openURL, '' );
|
23 |
jQuery(function($) {
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
};
|
35 |
};
|
|
|
36 |
|
37 |
-
|
38 |
});
|
39 |
}
|
40 |
|
41 |
jQuery(document).ready(function($){
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
jQuery(
|
46 |
-
|
47 |
-
|
48 |
-
}
|
49 |
});
|
1 |
+
function insertYopPoll( destination, poll_id, tr_id, show_results ) {
|
2 |
tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
|
3 |
if ( isNaN( poll_id ) ) {
|
4 |
edInsertContent( destination, '[yop_poll]' );
|
5 |
}
|
6 |
else {
|
7 |
if ( poll_id != null && poll_id != '' ) {
|
8 |
+
if( show_results == "-1") {
|
9 |
+
if( tr_id != '' ) {
|
10 |
+
edInsertContent( destination,
|
11 |
+
'[yop_poll id="' + poll_id + '" tr_id="' +
|
12 |
+
tr_id + '"]' );
|
13 |
+
}
|
14 |
+
else {
|
15 |
+
edInsertContent( destination,
|
16 |
+
'[yop_poll id="' + poll_id + '"]' );
|
17 |
+
}
|
18 |
+
}
|
19 |
+
else {
|
20 |
+
edInsertContent( destination,
|
21 |
+
'[yop_poll id="' + poll_id + '" show_results="' +
|
22 |
+
show_results + '"]' );
|
23 |
+
}
|
24 |
}
|
25 |
else {
|
26 |
edInsertContent( destination, '[yop_poll]' );
|
30 |
}
|
31 |
|
32 |
function show_tb() {
|
33 |
+
var openURL = yop_poll_editor_config.dialog_html_url + '&height=190&width=500&inlineId=yop_poll_html_dialog';
|
34 |
tb_show( yop_poll_editor_config.title, openURL, '' );
|
35 |
jQuery(function($) {
|
36 |
+
tb_position = function() {
|
37 |
+
var tbWindow = $('#TB_window');
|
38 |
+
var H = tbWindow.height();
|
39 |
+
var W = tbWindow.width();
|
40 |
|
41 |
+
if ( tbWindow.size() ) {
|
42 |
+
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
|
43 |
+
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
|
44 |
+
if ( typeof document.body.style.maxWidth != 'undefined' )
|
45 |
+
tbWindow.css({'top':( ( $(window).height() / 2) - 100 ) + 'px'});
|
|
|
46 |
};
|
47 |
+
};
|
48 |
|
49 |
+
$(window).resize( function() { tb_position() } );
|
50 |
});
|
51 |
}
|
52 |
|
53 |
jQuery(document).ready(function($){
|
54 |
+
if(document.getElementById("ed_toolbar")){
|
55 |
+
edButtons[edButtons.length] = new edButton("ed_yop_poll", yop_poll_editor_config.name, "", "", "");
|
56 |
+
jQuery(document).ready(function($){
|
57 |
+
jQuery('#qt_content_ed_yop_poll').replaceWith('<input onclick="show_tb();" type="button" id="qt_content_ed_yop_poll" accesskey="" class="ed_button button button-small" value="' + yop_poll_editor_config.name + '" title="' + yop_poll_editor_config.title + '" />');
|
58 |
+
});
|
59 |
+
}
|
|
|
60 |
});
|
tinymce/yop-poll-editor.js
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
(function() {
|
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 |
})();
|
1 |
(function() {
|
2 |
+
tinymce.create('tinymce.plugins.YopPollPlugin', {
|
3 |
+
init : function(ed, url) {
|
4 |
+
ed.addCommand('mceYopPollInsert', function() {
|
5 |
+
ed.windowManager.open({
|
6 |
+
file : yop_poll_editor_config.dialog_url,
|
7 |
+
width : 500 + 'px',
|
8 |
+
height : 190 + 'px',
|
9 |
+
inline : 1
|
10 |
+
});
|
11 |
|
12 |
+
});
|
13 |
+
ed.addButton('yoppoll', {
|
14 |
+
title : yop_poll_editor_config.title,
|
15 |
+
cmd : 'mceYopPollInsert',
|
16 |
+
image : url + '/yop-poll-admin-menu-icon16.png'
|
17 |
+
});
|
18 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
19 |
+
cm.setActive('yoppoll', n.nodeName == 'IMG');
|
20 |
+
});
|
21 |
+
},
|
22 |
+
createControl : function(n, cm) {
|
23 |
+
return null;
|
24 |
+
},
|
25 |
+
getInfo : function() {
|
26 |
+
return {
|
27 |
+
longname : "Yop Poll",
|
28 |
+
author : 'YourOwnProgrammer',
|
29 |
+
authorurl : 'http://www.yop-poll.com',
|
30 |
+
infourl : 'http://www.yop-poll.com',
|
31 |
+
version : "5.7.8"
|
32 |
+
};
|
33 |
+
}
|
34 |
+
});
|
35 |
+
tinymce.PluginManager.add('yoppoll', tinymce.plugins.YopPollPlugin);
|
36 |
})();
|
yop_poll.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
if (!(version_compare(phpversion(), '5.3', '<'))) {
|
14 |
|
15 |
define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
|
16 |
define ( 'YOP_POLL_WP_VERSION', '3.3' );
|
17 |
-
define ( 'YOP_POLL_VERSION', '5.7.
|
18 |
define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
|
19 |
define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
|
20 |
define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
|
@@ -64,9 +65,6 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
|
|
64 |
'version' => YOP_POLL_VERSION
|
65 |
);
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
$maintenance = new YOP_POLL_Maintenance();
|
71 |
register_activation_hook( YOP_POLL_PLUGIN_FILE, array(
|
72 |
$maintenance,
|
@@ -88,83 +86,75 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
|
|
88 |
error_reporting( E_ALL ^ E_NOTICE );
|
89 |
}
|
90 |
else {
|
91 |
-
|
|
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
//add_action( 'widgets_init', create_function( '', 'return register_widget("YopPoll\Yop_Poll_Widget");' ) );
|
100 |
-
add_filter( 'widget_text', 'do_shortcode' );
|
101 |
}
|
102 |
else {
|
103 |
//load public manager
|
104 |
require_once( YOP_POLL_INC . 'public-admin.php' );
|
105 |
$yop_poll = new Yop_Poll_Public_Admin( new Yop_Poll_Config ( $yop_poll_config_data ) );
|
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 |
-
$capObj->uninstall_capabilities();
|
156 |
-
$poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
|
157 |
-
if ( $poll_archive_page ){
|
158 |
-
$poll_archive_page_id = $poll_archive_page ['ID'];
|
159 |
-
wp_delete_post( $poll_archive_page_id, true );
|
160 |
-
}
|
161 |
-
}
|
162 |
-
} else{
|
163 |
function my_admin_notice() {
|
164 |
?>
|
165 |
<div class="error">
|
166 |
<p><?php _e( 'YOP POLL!', 'my-text-domain' ); ?></p>
|
167 |
-
|
|
|
|
|
168 |
</div>
|
169 |
<?php
|
170 |
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
1 |
<?php
|
2 |
|
3 |
+
/*
|
4 |
+
* Plugin Name: YOP Poll
|
5 |
+
* Plugin URI: http://yop-poll.com
|
6 |
+
* Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use poll plugin for your WordPress website.
|
7 |
+
* Version: 5.7.8
|
8 |
+
* Author: yourownprogrammer
|
9 |
+
* Author URI: http://yop-poll.com
|
10 |
+
* License: GPLv2 or later
|
11 |
+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
+
*/
|
13 |
|
14 |
if (!(version_compare(phpversion(), '5.3', '<'))) {
|
15 |
|
16 |
define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
|
17 |
define ( 'YOP_POLL_WP_VERSION', '3.3' );
|
18 |
+
define ( 'YOP_POLL_VERSION', '5.7.8' );
|
19 |
define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
|
20 |
define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
|
21 |
define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
|
65 |
'version' => YOP_POLL_VERSION
|
66 |
);
|
67 |
|
|
|
|
|
|
|
68 |
$maintenance = new YOP_POLL_Maintenance();
|
69 |
register_activation_hook( YOP_POLL_PLUGIN_FILE, array(
|
70 |
$maintenance,
|
86 |
error_reporting( E_ALL ^ E_NOTICE );
|
87 |
}
|
88 |
else {
|
89 |
+
error_reporting( E_ALL );
|
90 |
+
//error_reporting( 0 );
|
91 |
}
|
92 |
+
//load admin manager
|
93 |
+
require_once( YOP_POLL_INC . 'admin.php' );
|
94 |
+
$yop_poll = new Yop_Poll_Admin ( new Yop_Poll_Config ( $yop_poll_config_data ) );
|
95 |
+
widgets_init();
|
96 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
|
|
|
|
|
|
97 |
}
|
98 |
else {
|
99 |
//load public manager
|
100 |
require_once( YOP_POLL_INC . 'public-admin.php' );
|
101 |
$yop_poll = new Yop_Poll_Public_Admin( new Yop_Poll_Config ( $yop_poll_config_data ) );
|
102 |
}
|
103 |
+
function yop_poll_uninstall() {
|
104 |
+
global $wpdb;
|
105 |
+
if ( function_exists( 'is_multisite' ) && is_multisite() ){
|
106 |
+
$old_blog = $wpdb->blogid;
|
107 |
+
$blogids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
108 |
+
foreach ( $blogids as $blog_id ) {
|
109 |
+
switch_to_blog( $blog_id );
|
110 |
+
delete_option( 'yop_poll_version' );
|
111 |
+
delete_option( 'yop_poll_options' );
|
112 |
+
delete_option( 'yop_poll_first_install_date' );
|
113 |
+
delete_option( 'yop_poll_admin_notices_donate' );
|
114 |
+
delete_option( 'yop_poll_optin_box_modal_options' );
|
115 |
+
delete_option( 'yop_poll_pro_options' );
|
116 |
+
delete_option( 'yop_poll_pro' );
|
117 |
+
delete_option( 'yop_poll_optin_box_modal_options_yop' );
|
118 |
+
require_once( YOP_POLL_INC . 'db_schema.php' );
|
119 |
+
Yop_Poll_DbSchema::delete_database_tables_2();
|
120 |
+
$capObj = YOP_POLL_Capabilities::get_instance();
|
121 |
+
$capObj->uninstall_capabilities();
|
122 |
+
$poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
|
123 |
+
if ( $poll_archive_page ){
|
124 |
+
$poll_archive_page_id = $poll_archive_page ['ID'];
|
125 |
+
wp_delete_post( $poll_archive_page_id, true );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
switch_to_blog( $old_blog );
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
delete_option( 'yop_poll_version' );
|
132 |
+
delete_option( 'yop_poll_options' );
|
133 |
+
delete_option( 'yop_poll_first_install_date' );
|
134 |
+
delete_option( 'yop_poll_admin_notices_donate' );
|
135 |
+
delete_option( 'yop_poll_optin_box_modal_options' );
|
136 |
+
delete_option( 'yop_poll_pro_options' );
|
137 |
+
delete_option( 'yop_poll_pro' );
|
138 |
+
delete_option( 'yop_poll_optin_box_modal_options_yop' );
|
139 |
+
require_once( YOP_POLL_INC . 'db_schema.php' );
|
140 |
+
Yop_Poll_DbSchema::delete_database_tables_2();
|
141 |
+
$capObj = YOP_POLL_Capabilities::get_instance();
|
142 |
+
$capObj->uninstall_capabilities();
|
143 |
+
$poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
|
144 |
+
if ( $poll_archive_page ){
|
145 |
+
$poll_archive_page_id = $poll_archive_page ['ID'];
|
146 |
+
wp_delete_post( $poll_archive_page_id, true );
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
function my_admin_notice() {
|
152 |
?>
|
153 |
<div class="error">
|
154 |
<p><?php _e( 'YOP POLL!', 'my-text-domain' ); ?></p>
|
155 |
+
<p>
|
156 |
+
<?php _e("Your server is running php lower than 5.3. Please update your Php version and try again!")?>
|
157 |
+
</p>
|
158 |
</div>
|
159 |
<?php
|
160 |
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|