YOP Poll - Version 5.3

Version Description

  • Fixed issue with links color being overwritten
  • Fixed issue with start date and end date not displaying corectly
  • Fixed issue with widget
  • Added email notifications customization per poll
Download this release

Release Info

Developer yourownprogrammer
Plugin Icon 128x128 YOP Poll
Version 5.3
Comparing to
See all releases

Code changes from version 4.9.3 to 5.3

Files changed (87) hide show
  1. css/Fontsaddict.css +38 -0
  2. css/Fontsaddict.eot +0 -0
  3. css/Fontsaddict.svg +6 -0
  4. css/Fontsaddict.ttf +0 -0
  5. css/Fontsaddict.woff +0 -0
  6. css/colorpicker.css +227 -0
  7. {fonts → css/fonts}/Lato-Bla.ttf +0 -0
  8. {fonts → css/fonts}/Lato-BlaIta.ttf +0 -0
  9. {fonts → css/fonts}/Lato-Bol.ttf +0 -0
  10. {fonts → css/fonts}/Lato-BolIta.ttf +0 -0
  11. {fonts → css/fonts}/Lato-Hai.ttf +0 -0
  12. {fonts → css/fonts}/Lato-HaiIta.ttf +0 -0
  13. {fonts → css/fonts}/Lato-Lig.ttf +0 -0
  14. {fonts → css/fonts}/Lato-LigIta.ttf +0 -0
  15. {fonts → css/fonts}/Lato-Reg.ttf +0 -0
  16. {fonts → css/fonts}/Lato-RegIta.ttf +0 -0
  17. {fonts → css/fonts}/fontomas-webfont.eot +0 -0
  18. {fonts → css/fonts}/fontomas-webfont.svg +0 -0
  19. {fonts → css/fonts}/fontomas-webfont.ttf +0 -0
  20. {fonts → css/fonts}/fontomas-webfont.woff +0 -0
  21. css/jquery-ui.css +34 -36
  22. css/jquery.modalbox-basic.css +156 -0
  23. css/jquery.modalbox-skin-precious-white.css +125 -0
  24. css/polls/add-edit.css +199 -0
  25. css/polls/view-poll.css +535 -0
  26. css/yop-poll-add-edit.css +1 -0
  27. css/yop-poll-admin-add-new.css +0 -32
  28. css/yop-poll-admin-custom-fields.css +0 -8
  29. css/yop-poll-admin-options.css +0 -9
  30. css/yop-poll-admin-results.css +0 -8
  31. css/yop-poll-admin.css +267 -2
  32. css/yop-poll-donate.css +39 -39
  33. css/yop-poll-optin1.css +0 -116
  34. css/yop-poll-optin2.css +131 -118
  35. css/yop-poll-slider.css +587 -0
  36. css/yop-poll-wizard.css +312 -0
  37. images/Untitled-7.jpg +0 -0
  38. images/ajax-loader.gif +0 -0
  39. images/blue2.jpg +0 -0
  40. images/blue_pro.jpg +0 -0
  41. images/blue_v3_pro.jpg +0 -0
  42. images/check_radio_sheet.jpg +0 -0
  43. images/check_radio_sheet1.jpg +0 -0
  44. images/dark_pro.jpg +0 -0
  45. images/green_pro.jpg +0 -0
  46. images/green_pro_4.jpg +0 -0
  47. images/grey_pro.jpg +0 -0
  48. images/grey_pro_v1.jpg +0 -0
  49. images/grey_prov1.jpg +0 -0
  50. images/grey_prov2.jpg +0 -0
  51. images/image_five.jpg +0 -0
  52. images/image_four.jpg +0 -0
  53. images/image_one.jpg +0 -0
  54. images/image_seven.jpg +0 -0
  55. images/image_six.jpg +0 -0
  56. images/image_three.jpg +0 -0
  57. images/image_two.jpg +0 -0
  58. images/images2/image_five.jpg +0 -0
  59. images/images2/image_four.jpg +0 -0
  60. images/images2/image_one.jpg +0 -0
  61. images/images2/image_seven.jpg +0 -0
  62. images/images2/image_six.jpg +0 -0
  63. images/images2/image_three.jpg +0 -0
  64. images/images2/image_two.jpg +0 -0
  65. images/less-details-button.png +0 -0
  66. images/loading100x100.gif +0 -0
  67. images/loading100x1001.gif +0 -0
  68. images/loading36x36.gif +0 -0
  69. images/more-details-button.png +0 -0
  70. images/orange_pro.jpg +0 -0
  71. images/polar-bear.jpg +0 -0
  72. images/red_pro.jpg +0 -0
  73. images/white_pro.jpg +0 -0
  74. images/yop-poll-admin-question-section-icon32.png +0 -0
  75. images/yop-poll-arrow.png +0 -0
  76. images/yop-poll-close.png +0 -0
  77. images/yop-poll-movable-icon.png +0 -0
  78. inc/WavFile.php +1596 -1521
  79. inc/abstract_admin.php +79 -0
  80. inc/admin.php +1031 -9602
  81. inc/bans_admin.php +322 -0
  82. inc/capabilities.php +267 -0
  83. inc/config.php +1 -16
  84. inc/db_schema.php +3328 -637
  85. inc/facebook_connect_model.php +0 -78
  86. inc/import_admin.php +1017 -0
  87. inc/logs_admin.php +436 -0
css/Fontsaddict.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: "Fontsaddict";
3
+ src: url("Fontsaddict.eot");
4
+ src: url("Fontsaddict.eot#iefix") format("embedded-opentype"),
5
+ url("Fontsaddict.woff") format("woff"),
6
+ url("Fontsaddict.ttf") format("truetype"),
7
+ url("Fontsaddict.svg") format("svg");
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+ [class^="icon-"]:before, [class*=" icon-"]:before,
12
+ [class^="icon-"]:after, [class*=" icon-"]:after {
13
+ font-family: Fontsaddict;
14
+ font-size: 20px;
15
+ font-style: normal;
16
+ margin-left: 20px;
17
+ }
18
+ .icon-checkbox:before {
19
+ content: "\e801"
20
+ }
21
+ .icon-checkbox-1:before {
22
+ content: "\e802"
23
+ }
24
+ .icon-radio:before {
25
+ content: "\e800"
26
+ }
27
+ .icon-checked:before {
28
+ content: "\e803"
29
+ }
30
+ .icon-checked-1:before {
31
+ content: "\e804"
32
+ }
33
+ .icon-check:before {
34
+ content: "\e805"
35
+ }
36
+ .icon-radio-1:before {
37
+ content: "\e806"
38
+ }
css/Fontsaddict.eot ADDED
Binary file
css/Fontsaddict.svg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <defs>
5
+ <font id="Fontsaddict" horiz-adv-x="512">
6
+ <font-face font-family="Fontsaddict" units-per-em="512" ascent="448" descent="-64" x-height="240" cap-height="480"/><missing-glyph horiz-adv-x="512"/><glyph unicode="&#xE801;" glyph-name="checkbox" horiz-adv-x="512" d="M0 448v-512h512V448H0zM480 -32H32V416h448V-32zM384 336L224 176l-96 96l-64 -64l160 -160l224 224L384 336z"/><glyph unicode="&#xE802;" glyph-name="checkbox-1" horiz-adv-x="512" d="M0 448v-512h512V448H0zM480 -32H32V416h448V-32z"/><glyph unicode="&#xE800;" glyph-name="radio" horiz-adv-x="512" d="M256 448C114.615 448 0 333.385 0 192s114.615 -256 256 -256s256 114.615 256 256S397.385 448 256 448zM256 0 c-106.039 0 -192 85.961 -192 192S149.961 384 256 384s192 -85.961 192 -192S362.039 0 256 0z"/><glyph unicode="&#xE803;" glyph-name="checked" horiz-adv-x="512" d="M128 192C128 262.692448 185.307552 320 256 320C326.692448 320 384 262.692448 384 192C384 121.307552 326.692448 64 256 64C185.307552 64 128 121.307552 128 192ZM256 448c-141.376 0 -256 -114.624 -256 -256s114.624 -256 256 -256 256 114.624 256 256 -114.624 256 -256 256zm0 -448c-106.016 0 -192 85.984 -192 192s85.984 192 192 192 192 -85.984 192 -192 -85.984 -192 -192 -192z"/><glyph unicode="&#xE804;" glyph-name="checked-1" horiz-adv-x="512" d="M618.57555847569 406.95926412615l-16.399474375821 16.378449408673C586.32325886991 439.23258869908 565.10906701708 448 542.54927726675 448c-22.580814717477 0 -43.773981603154 -8.7674113009198 -59.668856767411 -24.683311432326L231.92641261498 172.38370565046L160.27332457293 243.99474375821 C144.42049934297 259.91064388962 123.20630749014 268.67805519054 100.64651773982 268.67805519054c-22.601839684625 0 -43.795006570302 -8.7884362680683 -59.68988173456 -24.725361366623l-16.27332457293 -16.27332457293c-32.883048620237 -32.904073587385 -32.883048620237 -86.412614980289 -0.042049934296978 -119.29566360053 l147.55321944809 -147.65834428384c15.915900131406 -15.936925098555 37.109067017083 -24.683311432326 59.668856767411 -24.683311432326c22.580814717477 0 43.773981603154 8.7674113009198 59.668856767411 24.704336399474L618.53350854139 287.70565045992 C651.35348226018 320.60972404731 651.35348226018 374.09724047306 618.57555847569 406.95926412615zM591.62155059133 314.65965834428L264.55716162943 -12.362680683311c-8.9986859395532 -8.9986859395532 -20.835742444152 -13.49802890933 -32.714848883049 -13.49802890933 c-11.837056504599 0 -23.716162943495 4.4993429697766 -32.714848883049 13.49802890933l-147.55321944809 147.65834428384c-17.955321944809 17.955321944809 -17.955321944809 47.411300919842 0 65.3876478318l16.336399474376 16.336399474376c8.9776609724047 8.9986859395532 20.856767411301 13.540078843627 32.714848883049 13.540078843627 s23.695137976347 -4.5413929040736 32.6938239159 -13.540078843627l98.586070959264 -98.565045992116L509.83442838371 396.40473061761c8.9986859395532 8.9776609724047 20.835742444152 13.49802890933 32.714848883049 13.49802890933c11.837056504599 0 23.695137976347 -4.5203679369251 32.6938239159 -13.519053876478 l16.378449408673 -16.336399474376C609.55584756899 362.09198423127 609.55584756899 332.63600525624 591.62155059133 314.65965834428z"/><glyph unicode="&#xE805;" glyph-name="check" horiz-adv-x="512" d="M100.376 131.816l117.968 -62.512c8.424 -6.624 18.92 -10.256 29.656 -10.256c2.52 0 5.056 0.2 7.504 0.592 c13.464 2.136 25.416 9.912 32.816 21.352l141.336 218.672c6.96 10.768 9.312 23.608 6.616 36.144s-10.112 23.272 -20.872 30.232 c-7.784 5.032 -16.784 7.688 -26.016 7.688c-16.384 0 -31.472 -8.2 -40.352 -21.944L235.512 176.16L160 207.04 c-8.376 6.464 -18.736 10 -29.312 10c-14.512 0 -28.096 -6.456 -37.24 -17.704C76.736 178.816 79.84 148.52 100.376 131.816zM105.848 189.248 c6.104 7.504 15.16 11.8 24.832 11.8c7.432 0 14.408 -2.488 20.184 -7.184l90.872 -37.536l120.712 186.768 c5.92 9.16 15.984 14.632 26.912 14.632c6.152 0 12.144 -1.776 17.328 -5.128c14.824 -9.576 19.088 -29.424 9.504 -44.248L274.872 89.672 c-4.928 -7.624 -12.904 -12.816 -21.888 -14.24c-9.008 -1.432 -18.216 1.12 -25.176 6.792l-117.904 62.48 C96.736 155.936 94.872 175.752 105.848 189.248z"/><glyph unicode="&#xE806;" glyph-name="radio-1" horiz-adv-x="512" d="M0 448v-512h512V448H0zM256 -3.5596190476191c-108.032 0 -195.584 87.552 -195.584 195.55961904762S147.968 387.584 256 387.584s195.55961904762 -87.552 195.55961904762 -195.584 S364.032 -3.5596190476191 256 -3.5596190476191zM170.66666666667 192C170.66666666667 244.5861607619 203.4138392381 277.33333333333 255.97561904762 277.33333333333C284.20520838095 277.33333333333 316.95238095238 244.5861607619 316.95238095238 192C316.95238095238 163.79479161905 284.20520838095 131.04761904762 255.97561904762 131.04761904762C203.4138392381 131.04761904762 170.66666666667 163.79479161905 170.66666666667 192Z"/></font></defs></svg>
css/Fontsaddict.ttf ADDED
Binary file
css/Fontsaddict.woff ADDED
Binary file
css/colorpicker.css ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ui-colorpicker,
2
+ .ui-dialog.ui-colorpicker {
3
+ width: auto;
4
+ white-space: nowrap;
5
+
6
+ -webkit-touch-callout: none;
7
+ -webkit-user-select: none;
8
+ -khtml-user-select: none;
9
+ -ms-user-select: none;
10
+ user-select: none;
11
+ }
12
+
13
+ .ui-colorpicker-inline {
14
+ position: static;
15
+ }
16
+
17
+ .ui-colorpicker-buttonset {
18
+ float: left;
19
+ margin-left: .4em;
20
+ }
21
+
22
+ .ui-colorpicker-buttonset .ui-button {
23
+ margin: .5em 0 .5em 0;
24
+ cursor: pointer;
25
+ }
26
+
27
+ .ui-colorpicker-buttonpane {
28
+ background-image: none;
29
+ margin: .7em 0 0 0;
30
+ padding: 0 .2em;
31
+ border-left: 0;
32
+ border-right: 0;
33
+ border-bottom: 0;
34
+ }
35
+
36
+ .ui-colorpicker-buttonpane button {
37
+ float: right;
38
+ margin: .5em .2em .4em;
39
+ cursor: pointer;
40
+ padding: .2em .6em .3em .6em;
41
+ width: auto;
42
+ overflow: visible;
43
+ }
44
+
45
+ .ui-colorpicker-buttonpane button.ui-colorpicker-current {
46
+ float: left;
47
+ }
48
+
49
+ .ui-colorpicker table {
50
+ width: 100%;
51
+ font-size: 100%; /* Reset browser table font-size */
52
+ margin: 0;
53
+ }
54
+
55
+ .ui-colorpicker table td {
56
+ vertical-align: top;
57
+ }
58
+
59
+ .ui-colorpicker-padding-left {
60
+ padding-left: 10px;
61
+ }
62
+ .ui-colorpicker-padding-top {
63
+ padding-top: 10px;
64
+ }
65
+
66
+ .ui-colorpicker-border {
67
+ border: 1px inset;
68
+ display: inline-block;
69
+ }
70
+
71
+ /* Bar & map */
72
+ .ui-colorpicker-map > *,
73
+ .ui-colorpicker-bar > * {
74
+ position: absolute;
75
+ cursor: crosshair;
76
+ }
77
+
78
+ .ui-colorpicker-map-pointer,
79
+ .ui-colorpicker-bar-pointer {
80
+ position: absolute;
81
+ left: 0;
82
+ }
83
+ /* Map */
84
+ .ui-colorpicker-map,
85
+ .ui-colorpicker-map > * {
86
+ display: block;
87
+ width: 256px;
88
+ height: 256px;
89
+ overflow: hidden;
90
+ }
91
+
92
+ .ui-colorpicker-map-layer-1,
93
+ .ui-colorpicker-map-layer-2 {
94
+ background: url(../js/images/map.png) no-repeat;
95
+ }
96
+
97
+ .ui-colorpicker-map-128,
98
+ .ui-colorpicker-map-128 > * {
99
+ width: 128px;
100
+ height: 128px;
101
+ }
102
+
103
+ .ui-colorpicker-map-128 .ui-colorpicker-map-layer-1,
104
+ .ui-colorpicker-map-128 .ui-colorpicker-map-layer-2 {
105
+ background: url(../js/images/128/map.png) no-repeat;
106
+ }
107
+
108
+ .ui-colorpicker-map-layer-alpha {
109
+ background: url(../js/images/map-opacity.png);
110
+ }
111
+
112
+ .ui-colorpicker-map-pointer {
113
+ display: inline-block;
114
+ width: 15px;
115
+ height: 15px;
116
+ background: url(../js/images/map-pointer.png) no-repeat;
117
+ }
118
+
119
+ /* Bar */
120
+ .ui-colorpicker-bar,
121
+ .ui-colorpicker-bar > * {
122
+ display: block;
123
+ width: 20px;
124
+ height: 256px;
125
+ overflow: hidden;
126
+ background-repeat: repeat-x;
127
+ }
128
+
129
+ .ui-colorpicker-bar-128,
130
+ .ui-colorpicker-bar-128 > * {
131
+ height: 128px;
132
+ }
133
+
134
+ .ui-colorpicker-bar-layer-1,
135
+ .ui-colorpicker-bar-layer-2,
136
+ .ui-colorpicker-bar-layer-3,
137
+ .ui-colorpicker-bar-layer-4 {
138
+ background: url(../js/images/bar.png) repeat-x;
139
+ }
140
+
141
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-1,
142
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-2,
143
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-3,
144
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-4 {
145
+ background: url(../js/images/128/bar.png) repeat-x;
146
+ }
147
+
148
+ .ui-colorpicker-bar-layer-alpha {
149
+ background: url(../js/images/bar-opacity.png);
150
+ }
151
+
152
+ .ui-colorpicker-bar-layer-alphabar {
153
+ background: url(../js/images/bar-alpha.png);
154
+ }
155
+
156
+ .ui-colorpicker-bar-128 .ui-colorpicker-bar-layer-alphabar {
157
+ background: url(../js/images/128/bar-alpha.png);
158
+ }
159
+
160
+ .ui-colorpicker-bar-pointer {
161
+ display: inline-block;
162
+ width: 20px;
163
+ height: 7px;
164
+ background: url(../js/images/bar-pointer.png) no-repeat;
165
+ }
166
+
167
+ /* Preview */
168
+ .ui-colorpicker-preview {
169
+ text-align: center;
170
+ height: 20px;
171
+ }
172
+
173
+ .ui-colorpicker-preview-initial {
174
+ cursor: pointer;
175
+ }
176
+
177
+ .ui-colorpicker-preview-initial,
178
+ .ui-colorpicker-preview-current {
179
+ width: 50px;
180
+ height: 20px;
181
+ display: inline-block;
182
+ }
183
+
184
+ .ui-colorpicker-preview-initial-alpha,
185
+ .ui-colorpicker-preview-current-alpha {
186
+ width: 50px;
187
+ height: 20px;
188
+ display: inline-block;
189
+ background: url(../js/images/preview-opacity.png) repeat;
190
+ }
191
+
192
+ /* Inputs */
193
+ .ui-colorpicker-rgb label,
194
+ .ui-colorpicker-hsv label,
195
+ .ui-colorpicker-hsl label,
196
+ .ui-colorpicker-lab label,
197
+ .ui-colorpicker-cmyk label,
198
+ .ui-colorpicker-alpha label {
199
+ width: 1.5em;
200
+ display: inline-block;
201
+ }
202
+
203
+ .ui-colorpicker-number {
204
+ margin: .1em;
205
+ width: 4em;
206
+ }
207
+
208
+ /* Hex */
209
+ .ui-colorpicker-hex {
210
+ text-align: center;
211
+ }
212
+
213
+ /* Swatches */
214
+ .ui-colorpicker-swatches {
215
+ height: 256px;
216
+ overflow: auto;
217
+ background-color: #f8f8f8;
218
+ }
219
+
220
+ .ui-colorpicker-swatch {
221
+ cursor: pointer;
222
+ float: left;
223
+ width: 11px;
224
+ height: 11px;
225
+ border-right: 1px solid black;
226
+ border-bottom: 1px solid black;
227
+ }
{fonts → css/fonts}/Lato-Bla.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-BlaIta.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-Bol.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-BolIta.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-Hai.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-HaiIta.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-Lig.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-LigIta.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-Reg.ttf RENAMED
File without changes
{fonts → css/fonts}/Lato-RegIta.ttf RENAMED
File without changes
{fonts → css/fonts}/fontomas-webfont.eot RENAMED
File without changes
{fonts → css/fonts}/fontomas-webfont.svg RENAMED
File without changes
{fonts → css/fonts}/fontomas-webfont.ttf RENAMED
File without changes
{fonts → css/fonts}/fontomas-webfont.woff RENAMED
File without changes
css/jquery-ui.css CHANGED
@@ -13,7 +13,7 @@
13
  .ui-helper-hidden { display: none; }
14
  .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
  .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
- .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
17
  .ui-helper-clearfix:after { clear: both; }
18
  .ui-helper-clearfix { zoom: 1; }
19
  .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
@@ -35,7 +35,7 @@
35
  ----------------------------------*/
36
 
37
  /* Overlays */
38
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
39
 
40
 
41
  /*!
@@ -56,26 +56,26 @@
56
  .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
57
  .ui-widget .ui-widget { font-size: 1em; }
58
  .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
59
- .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
60
  .ui-widget-content a { color: #222222; }
61
- .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
62
  .ui-widget-header a { color: #222222; }
63
 
64
  /* Interaction states
65
  ----------------------------------*/
66
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
67
  .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
68
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
69
  .ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
70
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
71
  .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
72
  .ui-widget :active { outline: none; }
73
 
74
  /* Interaction Cues
75
  ----------------------------------*/
76
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
77
  .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
78
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
79
  .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
80
  .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
81
  .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
@@ -85,16 +85,6 @@
85
  /* Icons
86
  ----------------------------------*/
87
 
88
- /* states and images */
89
- .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
90
- .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
91
- .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
92
- .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
93
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
94
- .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
95
- .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
96
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
97
-
98
  /* positioning */
99
  .ui-icon-carat-1-n { background-position: 0 0; }
100
  .ui-icon-carat-1-ne { background-position: -16px 0; }
@@ -283,8 +273,8 @@
283
  .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
284
 
285
  /* Overlays */
286
- .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
287
- .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
288
  * jQuery UI Resizable 1.8.23
289
  *
290
  * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
@@ -341,7 +331,7 @@
341
  *
342
  * http://docs.jquery.com/UI/Autocomplete#theming
343
  */
344
- .ui-autocomplete { position: absolute; cursor: default; }
345
 
346
  /* workarounds */
347
  * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
@@ -397,8 +387,8 @@
397
  .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
398
  .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
399
  button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
400
- .ui-button-icons-only { width: 3.4em; }
401
- button.ui-button-icons-only { width: 3.7em; }
402
 
403
  /*button text element */
404
  .ui-button .ui-button-text { display: block; line-height: 1.4; }
@@ -432,10 +422,10 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
432
  *
433
  * http://docs.jquery.com/UI/Dialog#theming
434
  */
435
- .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
436
  .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
437
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
438
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
439
  .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
440
  .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
441
  .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
@@ -506,7 +496,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
506
  .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
507
  .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
508
  .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
509
- .ui-datepicker select.ui-datepicker-month,
510
  .ui-datepicker select.ui-datepicker-year { width: 49%;}
511
  .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
512
  .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
@@ -543,13 +533,13 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
543
 
544
  /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
545
  .ui-datepicker-cover {
546
- position: absolute; /*must have*/
547
- z-index: -1; /*must have*/
548
- filter: mask(); /*must have*/
549
- top: -4px; /*must have*/
550
- left: -4px; /*must have*/
551
- width: 200px; /*must have*/
552
- height: 200px; /*must have*/
553
  }/*!
554
  * jQuery UI Progressbar 1.8.23
555
  *
@@ -560,4 +550,12 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
560
  * http://docs.jquery.com/UI/Progressbar#theming
561
  */
562
  .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
563
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
 
 
 
 
 
 
 
 
13
  .ui-helper-hidden { display: none; }
14
  .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
15
  .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
16
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { height: 5px; content: ""; display: table; }
17
  .ui-helper-clearfix:after { clear: both; }
18
  .ui-helper-clearfix { zoom: 1; }
19
  .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
35
  ----------------------------------*/
36
 
37
  /* Overlays */
38
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 3000px; z-index: 3; }
39
 
40
 
41
  /*!
56
  .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
57
  .ui-widget .ui-widget { font-size: 1em; }
58
  .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
59
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; color: #222222; }
60
  .ui-widget-content a { color: #222222; }
61
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc 50% 50% repeat-x; color: #222222; font-weight: bold; }
62
  .ui-widget-header a { color: #222222; }
63
 
64
  /* Interaction states
65
  ----------------------------------*/
66
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 50% 50% repeat-x; font-weight: normal; color: #555555; }
67
  .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
68
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada 50% 50% repeat-x; font-weight: normal; color: #212121; }
69
  .ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
70
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; font-weight: normal; color: #212121; }
71
  .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
72
  .ui-widget :active { outline: none; }
73
 
74
  /* Interaction Cues
75
  ----------------------------------*/
76
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee 50% 50% repeat-x; color: #363636; }
77
  .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
78
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec 50% 50% repeat-x; color: #cd0a0a; }
79
  .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
80
  .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
81
  .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
85
  /* Icons
86
  ----------------------------------*/
87
 
 
 
 
 
 
 
 
 
 
 
88
  /* positioning */
89
  .ui-icon-carat-1-n { background-position: 0 0; }
90
  .ui-icon-carat-1-ne { background-position: -16px 0; }
273
  .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
274
 
275
  /* Overlays */
276
+ .ui-widget-overlay { background: #aaaaaa 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
277
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
278
  * jQuery UI Resizable 1.8.23
279
  *
280
  * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
331
  *
332
  * http://docs.jquery.com/UI/Autocomplete#theming
333
  */
334
+ .ui-autocomplete { position: absolute; cursor: default; }
335
 
336
  /* workarounds */
337
  * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
387
  .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
388
  .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
389
  button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
390
+ .ui-button-icons-only { width: 3.4em; }
391
+ button.ui-button-icons-only { width: 3.7em; }
392
 
393
  /*button text element */
394
  .ui-button .ui-button-text { display: block; line-height: 1.4; }
422
  *
423
  * http://docs.jquery.com/UI/Dialog#theming
424
  */
425
+ .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; z-index: 3; }
426
  .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
427
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
428
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .5em; top: 45%; width: 24px; margin: -10px 0 0 0; padding: 1px; height: 24px; }
429
  .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
430
  .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
431
  .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
496
  .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
497
  .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
498
  .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
499
+ .ui-datepicker select.ui-datepicker-month,
500
  .ui-datepicker select.ui-datepicker-year { width: 49%;}
501
  .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
502
  .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
533
 
534
  /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
535
  .ui-datepicker-cover {
536
+ position: absolute; /*must have*/
537
+ z-index: -1; /*must have*/
538
+ filter: mask(); /*must have*/
539
+ top: -4px; /*must have*/
540
+ left: -4px; /*must have*/
541
+ width: 200px; /*must have*/
542
+ height: 200px; /*must have*/
543
  }/*!
544
  * jQuery UI Progressbar 1.8.23
545
  *
550
  * http://docs.jquery.com/UI/Progressbar#theming
551
  */
552
  .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
553
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
554
+
555
+
556
+ /*fixed position pop-up*/
557
+ .fixed-dialog{
558
+ position: fixed;
559
+ top:2px;
560
+
561
+ }
css/jquery.modalbox-basic.css ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .modalboxContent {
2
+ display:none;
3
+ }
4
+ .modalgallery {
5
+ display:block;
6
+ }
7
+ div#modalBoxFaderLayer,
8
+ div#modalBoxAjaxLoader,
9
+ div#modalBox,
10
+ div#modalBox div#modalBoxBody,
11
+ div#modalBox div#modalBoxBody div.modalBoxBodyContent,
12
+ div#modalBox div#modalBoxBody div.modalboxStyleContainerContent,
13
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton,
14
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox,
15
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox span,
16
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topLeft,
17
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topRight,
18
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomLeft,
19
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomRight,
20
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top,
21
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom,
22
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_left,
23
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_right,
24
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top div.modalboxStyleContainer_surface_body,
25
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom div.modalboxStyleContainer_surface_body {/* default reset */
26
+ margin:0;
27
+ padding:0;
28
+ }
29
+ div#modalBox.modalboxIsDraggable div#modalBoxBody div.modalboxStyleContainer_surface_top,
30
+ div#modalBox.modalboxIsDraggable div#modalBoxBody div.modalboxStyleContainer_surface_bottom {
31
+ cursor:move;
32
+ }
33
+
34
+ /*div#modalBox div#modalBoxBody div#modalBoxCloseButton {
35
+ display: none;
36
+ }*/
37
+
38
+ div#modalBoxFaderLayer {
39
+ display:none;
40
+ position:fixed;
41
+ top:0;
42
+ left:0;
43
+ width:100%;
44
+ height:100%;
45
+ z-index:9998;
46
+ }
47
+ div#modalBoxAjaxLoader {
48
+ background:transparent url(../images/ajax-loader.gif) 50% 40% no-repeat;
49
+ padding:120px 100px 80px 100px;
50
+ text-align:center;
51
+ overflow:hidden;
52
+ }
53
+ div#modalBox {
54
+ display:none;
55
+ position:fixed;
56
+ z-index:9999;
57
+ text-align:left;
58
+ background-color:transparent;
59
+ }
60
+ div#modalBox {
61
+ /*width:600px; default wide */
62
+ }
63
+ div#modalBox.small {
64
+ width:400px;
65
+ }
66
+ div#modalBox.medium {
67
+ width:500px;
68
+ }
69
+ div#modalBox.large {
70
+ width:700px;
71
+ }
72
+ div#modalBox.auto {/* for image content only */
73
+ width:auto;
74
+ }
75
+ div#modalBox div#modalBoxBody {
76
+ position:relative;
77
+ }
78
+
79
+
80
+ div#modalBox.disablingClickToClose div#modalBoxBody div#modalBoxCloseButton {
81
+ display:none;
82
+ }
83
+
84
+
85
+ div#modalBox.modalBoxSingleImage {
86
+ width:auto;
87
+ max-width:80%;
88
+ }
89
+ div#modalBox.modalBoxSingleImage div#modalBoxBody div.modalboxStyleContainerContent a.modalBoxImageLink {
90
+ display:block;
91
+ }
92
+ div#modalBox.modalBoxSingleImage div#modalBoxBody div.modalboxStyleContainerContent img.modalBoxImagePreload {
93
+ visibility:hidden;
94
+ }
95
+ div#modalBox.modalBoxSingleImage div#modalBoxBody div.modalboxStyleContainerContent img.modalBoxImagePreload,
96
+ div#modalBox.modalBoxSingleImage div#modalBoxBody div.modalboxStyleContainerContent img.modalBoxImageLoadingSuccessful {
97
+ max-width:100%;
98
+ }
99
+ div#modalBox.modalBoxSingleImage div#modalBoxBody div.modalboxStyleContainerContent img.modalBoxImageNoLink {
100
+ cursor:pointer;
101
+ }
102
+
103
+
104
+ /* clearfix */
105
+ .modalboxStyleContainerContent:after,
106
+ .modalBoxBodyContent:after {
107
+ content:".";
108
+ display:block;
109
+ height:0;
110
+ line-height:0;
111
+ clear:both;
112
+ visibility:hidden;
113
+ }
114
+ * html .modalboxStyleContainerContent,
115
+ * html .modalBoxBodyContent {/*IE6*/
116
+ zoom:1;
117
+ display:block;
118
+ }
119
+ *+html .modalboxStyleContainerContent,
120
+ *+html .modalBoxBodyContent {/*IE7*/
121
+ zoom:1;
122
+ display:block;
123
+ }
124
+
125
+ @media print {
126
+ div#modalboxPreCacheContainer {
127
+ display:none;
128
+ }
129
+ }
130
+
131
+ /* modalBoxCloseButton */
132
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton {
133
+ position: absolute;
134
+ color: #00A8FF;
135
+ cursor: pointer;
136
+ float: right;
137
+ font-size: 1.5em;
138
+ height: 1em;
139
+ width: 1em;
140
+ right: 10px;
141
+ text-decoration: none;
142
+ }
143
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox,
144
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox span {
145
+ text-decoration:none;
146
+ color:#f4f4f4;
147
+ cursor:pointer;
148
+ }
149
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox {
150
+ display:block;
151
+ width:20px;
152
+ height:20px;
153
+ }
154
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox span {
155
+ display:none;
156
+ }
css/jquery.modalbox-skin-precious-white.css ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* skin precious-white - BEGIN */
2
+
3
+
4
+ /* modalBoxBodyContent */
5
+ div#modalBox div#modalBoxBody div.modalBoxBodyContent {
6
+ background-color:white;
7
+ padding:15px;
8
+ }
9
+ div#modalBox.modalBoxBodyContentImageContainer div#modalBoxBody div.modalBoxBodyContent {
10
+ padding:0;
11
+ }
12
+ div#modalBox.emphasis div#modalBoxBody div.modalBoxBodyContent {
13
+ border:1px dotted red;
14
+ }
15
+
16
+
17
+ /* modalBoxCloseButton */
18
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton {
19
+ position:absolute;
20
+ top:11px;
21
+ right:12px;
22
+ }
23
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox,
24
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox span {
25
+ text-decoration:none;
26
+ color:#f4f4f4;
27
+ cursor:pointer;
28
+ }
29
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox {
30
+ display:block;
31
+ width:20px;
32
+ height:20px;
33
+ background:transparent url(../img/skins/precious_white/closebutton_13x13.png) center center no-repeat;
34
+ }
35
+ div#modalBox div#modalBoxBody div#modalBoxCloseButton a.closeModalBox span {
36
+ display:none;
37
+ }
38
+
39
+
40
+ div#modalBox div#modalBoxBody {
41
+ padding:36px 0;
42
+ }
43
+ div#modalBox div#modalBoxBody div.modalboxStyleContainerContent {
44
+ padding:0;
45
+ }
46
+
47
+ /* set image sprite */
48
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top div.modalboxStyleContainer_surface_body,
49
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom div.modalboxStyleContainer_surface_body,
50
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topLeft,
51
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topRight,
52
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomLeft,
53
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomRight {
54
+ background-color:transparent;
55
+ background-image:url(../img/skins/precious_white/bg_shadows_sprite.png);
56
+ }
57
+ /* modalboxStyleContainer_corner */
58
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topLeft,
59
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topRight,
60
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomLeft,
61
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomRight {
62
+ background-repeat:no-repeat;
63
+ position:absolute;
64
+ width:36px;
65
+ }
66
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topLeft{
67
+ background-position:0 -72px;
68
+ left:0;
69
+ top:0;
70
+ height:36px;
71
+ }
72
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_topRight{
73
+ background-position:-36px -72px;
74
+ right:0;
75
+ top:0;
76
+ height:36px;
77
+ }
78
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomLeft{
79
+ background-position:0 -108px;
80
+ left:0;
81
+ bottom:0;
82
+ height:36px;
83
+ }
84
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_corner_bottomRight{
85
+ background-position:-36px -108px;
86
+ right:0;
87
+ bottom:0;
88
+ height:36px;
89
+ }
90
+ /* modalboxStyleContainer_surface */
91
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top,
92
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom {
93
+ position:absolute;
94
+ width:100%;
95
+ }
96
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top div.modalboxStyleContainer_surface_body,
97
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom div.modalboxStyleContainer_surface_body {
98
+ background-color:transparent;
99
+ background-repeat:repeat-x;
100
+ margin:0 36px;
101
+ }
102
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top {
103
+ left:0;
104
+ top:0;
105
+ }
106
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_top div.modalboxStyleContainer_surface_body {
107
+ height:36px;
108
+ background-position:0 0;
109
+ }
110
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom {
111
+ left:0;
112
+ bottom:0;
113
+ }
114
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_bottom div.modalboxStyleContainer_surface_body {
115
+ height:36px;
116
+ background-position:0 -36px;
117
+ }
118
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_left {
119
+ background:transparent url(../img/skins/precious_white/bg_shadows_left.png) left top repeat-y;
120
+ }
121
+ div#modalBox div#modalBoxBody div.modalboxStyleContainer_surface_right {
122
+ background:transparent url(../img/skins/precious_white/bg_shadows_right.png) right top repeat-y;
123
+ padding:0 36px;
124
+ }
125
+ /* skin precious-white - END */
css/polls/add-edit.css ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ input#yop-poll-title {
2
+
3
+ width: 98%;
4
+
5
+ }
6
+
7
+ .yop-poll-answers-fieldset {
8
+
9
+ border: solid;
10
+
11
+ border-width: 1px;
12
+
13
+ }
14
+
15
+ .yop-poll-answers-fieldset legend {
16
+
17
+ border: solid;
18
+
19
+ border-width: 1px;
20
+
21
+ font-weight: bold;
22
+
23
+ }
24
+
25
+ .yop-poll-answer-options-td {
26
+
27
+ display: none;
28
+
29
+ }
30
+
31
+ .ui-dialog {
32
+
33
+ padding: 0px;
34
+ width: auto !important;
35
+ }
36
+
37
+ .ui-widget-header {
38
+
39
+ background: #00A8FF;
40
+
41
+ border: 0;
42
+
43
+ color: #fff;
44
+
45
+ font-weight: normal;
46
+
47
+ border-radius: 0;
48
+
49
+ }
50
+
51
+ .ui-dialog .ui-dialog-titlebar {
52
+
53
+ padding: 0.1em .5em;
54
+
55
+ position: relative;
56
+
57
+ font-size: 1em;
58
+
59
+ }
60
+
61
+ .ui-dialog-titlebar-close {
62
+
63
+ background: url(../../images/yop-poll-close.png) !important;
64
+
65
+ }
66
+
67
+ .ui-dialog-content {
68
+ margin-left: auto;
69
+ margin-right: auto;
70
+ position: relative;
71
+ }
72
+ #WFItem394041 {
73
+ background: #f7f7f7; /* Old browsers */
74
+ background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
75
+ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #f7f7f7), color-stop(100%, #ffffff)); /* Chrome,Safari4+ */
76
+ background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Chrome10+,Safari5.1+ */
77
+ background: -o-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Opera 11.10+ */
78
+ background: -ms-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* IE10+ */
79
+ background: linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* W3C */
80
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#ffffff', GradientType=1); /* IE6-9 fallback on horizontal gradient */
81
+ border: 1px solid #fff;
82
+ -moz-box-shadow: 0px 0px 9px #dadada;
83
+ -webkit-box-shadow: 0px 0px 9px #dadada;
84
+ box-shadow: 0px 0px 9px #dadada;
85
+ color: #95abb7;
86
+ text-align: center;
87
+ width: 25em;
88
+ height: auto;
89
+ }
90
+ #WFItem394041 h1 {
91
+ font-size: 8em;
92
+ margin: 0.2em;
93
+ color: #fff;
94
+ font-family: Lato-Bla, Arial, Helvetica, sans-serif;
95
+ line-height: 1em;
96
+ }
97
+
98
+ #WFItem394041 label {
99
+ position: relative;
100
+ }
101
+
102
+ #WFItem394041 h2 {
103
+ font-size: 3em;
104
+ margin-top: 0.5em;
105
+ font-variant: small-caps;
106
+ font-weight: bold;
107
+ color: #95abb7;
108
+ }
109
+
110
+ #WFItem394041 h3 {
111
+ font-size: 2em;
112
+ margin-top: 0.2em;
113
+ font-weight: bold;
114
+ color: #95abb7;
115
+ display: inline;
116
+ }
117
+
118
+ #WFItem394041 #circle {
119
+ border-radius: 50%;
120
+ background: #00a8ff;
121
+ position: relative;
122
+ margin: 0 auto;
123
+ width: 7.75em;
124
+ height: 7.75em;
125
+ }
126
+
127
+ #WFItem394041 #email {
128
+ border-style: none;
129
+ border: 1px solid #00a8ff;
130
+ background: #fff;
131
+ margin-top: 0.5em;
132
+ padding-left: 2em;
133
+ font-size: 1.125em;
134
+ font-family: Calibri, Arial, Helvetica, sans-serif;
135
+ color: #aeaaaa;
136
+ -webkit-transition: all 0.3s linear;
137
+ -moz-transition: all 0.3s linear;
138
+ -o-transition: all 0.3s linear;
139
+ transition: all 0.3s linear;
140
+ width: 75%;
141
+ height: 2.3em;
142
+ }
143
+
144
+ #WFItem394041 #email:focus {
145
+ background: #f9f9f9;
146
+ }
147
+
148
+ #WFItem394041 .wf-button {
149
+ margin-top: 10px;
150
+ font-size: 1.4em;
151
+ height: 1.7em;
152
+ margin-bottom: 0.5em;
153
+ border: none;
154
+ background: #00a8ff;
155
+ color: white;
156
+ cursor: pointer;
157
+ width: 75%;
158
+ }
159
+
160
+ #WFItem394041 .wf-button:active {
161
+ background: #0098e6;
162
+ }
163
+
164
+ #yop-poll-close-modal-box {
165
+ text-decoration: none;
166
+ position: absolute;
167
+ color: #00A8FF;
168
+ cursor: pointer;
169
+ float: right;
170
+ font-size: 1.5em;
171
+ height: 1em;
172
+ width: 1em;
173
+ top: 5px;
174
+ right: 5px;
175
+ }
176
+
177
+ #WFItem394041 [data-icon]:after {
178
+ left: 2px;
179
+ content: attr(data-icon);
180
+ font-family: 'FontomasCustomRegular';
181
+ color: #00a8ff;
182
+ position: absolute;
183
+ left: 5px;
184
+ top: 4px;
185
+ width: 20px;
186
+ }
187
+ .yop_poll_tooltip-buy{
188
+ opacity: 0.5;
189
+ }
190
+ .radio_for_pro {
191
+ display: none;
192
+ }
193
+
194
+ #loading{
195
+ width: 200px;
196
+ height: 100px;
197
+ background: url("../../images/ajax-loader.gif") no-repeat !important;
198
+
199
+ }
css/polls/view-poll.css ADDED
@@ -0,0 +1,535 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .yop-poll-slider {
2
+
3
+ padding: 0 !important;
4
+
5
+ }
6
+
7
+
8
+
9
+ .yop-poll-slider .hndle {
10
+
11
+ padding-left: 15px !important;
12
+
13
+ }
14
+
15
+
16
+
17
+ .yop-poll-slider-container {
18
+
19
+ position: relative;
20
+
21
+ height: 475px;
22
+
23
+ width: 100%;
24
+
25
+ border: #E5E5E5 1px solid;
26
+
27
+ border-top: none;
28
+
29
+ border-bottom: none;
30
+
31
+ z-index: 0;
32
+
33
+ }
34
+
35
+
36
+
37
+ .yop-poll-slider-container a {
38
+
39
+ outline: 0;
40
+
41
+ }
42
+
43
+
44
+
45
+ .yop-poll-slider-container .hndle {
46
+
47
+ cursor: default;
48
+
49
+ }
50
+
51
+
52
+
53
+ .yop-poll-slider-container h4 span {
54
+
55
+ background: #555;
56
+
57
+ color: #E6E5E5;
58
+
59
+ padding: 8px;
60
+
61
+ font-size: 14px;
62
+
63
+ border: 1px solid #FFF;
64
+
65
+ }
66
+
67
+
68
+
69
+ .yop-poll-slider-container #yop-poll-template-width, .yop-poll-slider-container #yop-poll-widget-template-width {
70
+
71
+ border-radius: 0;
72
+
73
+ border: 1px solid #00A8FF;
74
+
75
+ margin-left: 10px;
76
+
77
+ }
78
+
79
+
80
+
81
+ .yop-poll-page-slider, .yop-poll-widget-slider, .yop-poll-buy-slider {
82
+
83
+ overflow: hidden;
84
+
85
+ position: relative;
86
+
87
+ width: 100%;
88
+
89
+ }
90
+ .yop-poll-pro-slider, .yop-poll-widget-slider, .yop-poll-buy-slider {
91
+
92
+ overflow: hidden;
93
+
94
+ position: relative;
95
+
96
+ width: 100%;
97
+
98
+ }
99
+
100
+
101
+
102
+ .yop-poll-page-slider ul, .yop-poll-widget-slider ul, .yop-poll-buy-slider ul {
103
+
104
+ list-style: none outside none;
105
+
106
+ margin: 0;
107
+
108
+ margin-top: 10px;
109
+
110
+ padding: 0;
111
+
112
+ position: relative;
113
+
114
+ width: 20000em;
115
+
116
+ }.yop-poll-pro-slider ul, .yop-poll-widget-slider ul, .yop-poll-buy-slider ul {
117
+
118
+ list-style: none outside none;
119
+
120
+ margin: 0;
121
+
122
+ margin-top: 10px;
123
+
124
+ padding: 0;
125
+
126
+ position: relative;
127
+
128
+ width: 20000em;
129
+
130
+ }
131
+
132
+
133
+
134
+ .yop-poll-page-slider .yop-poll-page-template-li, .yop-poll-widget-slider .yop-poll-widget-template-li, .yop-poll-buy-slider .yop-poll-buy-template-li {
135
+
136
+ -moz-box-sizing: border-box;
137
+
138
+ -webkit-box-sizing: border-box;
139
+
140
+ box-sizing: border-box;
141
+
142
+ float: left;
143
+
144
+ /*width: 220px !important;
145
+
146
+ height: 210px;*/
147
+
148
+ }
149
+ .yop-poll-pro-slider .yop-poll-pro-template-li, .yop-poll-widget-slider .yop-poll-widget-template-li, .yop-poll-buy-slider .yop-poll-buy-template-li {
150
+
151
+ -moz-box-sizing: border-box;
152
+
153
+ -webkit-box-sizing: border-box;
154
+
155
+ box-sizing: border-box;
156
+
157
+ float: left;
158
+
159
+ /*width: 220px !important;
160
+
161
+ height: 210px;*/
162
+
163
+ }
164
+
165
+
166
+
167
+ .yop-poll-page-slider .yop-poll-page-template-li p, .yop-poll-widget-slider .yop-poll-widget-template-li p .yop-poll-buy-slider .yop-poll-buy-template-li p{
168
+
169
+ margin: 0 auto;
170
+
171
+ padding: 3px;
172
+
173
+ width: 150px;
174
+
175
+ border: 1px solid #00A8FF;
176
+
177
+ font-weight: 600;
178
+
179
+ }
180
+
181
+
182
+ .yop-poll-pro-slider .yop-poll-pro-template-li p, .yop-poll-widget-slider .yop-poll-widget-template-li p, .yop-poll-buy-slider .yop-poll-buy-template-li p {
183
+
184
+ margin: 0;
185
+
186
+ padding: 3px;
187
+
188
+ width: 150px;
189
+
190
+ border: 1px solid #00A8FF;
191
+
192
+ font-weight: 600;
193
+
194
+ }
195
+
196
+
197
+
198
+ .yop-poll-page-slider img .yop-poll-widget-slider img .yop-poll-buy-slider img {
199
+
200
+ display: block;
201
+
202
+ height: auto !important;
203
+
204
+ max-width: 100%;
205
+
206
+ }
207
+
208
+ .yop-poll-pro-slider img .yop-poll-widget-slider img .yop-poll-buy-slider img {
209
+
210
+ display: block;
211
+
212
+ height: auto !important;
213
+
214
+ max-width: 100%;
215
+
216
+ }
217
+
218
+
219
+
220
+ .yop-poll-page-slider-control-prev, .yop-poll-page-slider-control-next, .yop-poll-widget-slider-control-prev, .yop-poll-widget-slider-control-next, .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-next {
221
+
222
+ background: none repeat scroll 0 0 #4E443C;
223
+
224
+ border: 1px solid #CCC;
225
+
226
+ color: #CCC;
227
+
228
+ font: 24px/27px Arial, sans-serif;
229
+
230
+ height: 30px;
231
+
232
+ position: absolute;
233
+
234
+ text-align: center;
235
+
236
+ text-decoration: none;
237
+
238
+ top: 50%;
239
+
240
+ width: 30px;
241
+
242
+ z-index: 3;
243
+
244
+ -webkit-transition: all 0.3s linear;
245
+
246
+ -moz-transition: all 0.3s linear;
247
+
248
+ -ms-transition: all 0.3s linear;
249
+
250
+ -o-transition: all 0.3s linear;
251
+
252
+ transition: all 0.3s linear;
253
+
254
+ }
255
+ .yop-poll-pro-slider-control-prev, .yop-poll-pro-slider-control-next, .yop-poll-widget-slider-control-prev, .yop-poll-widget-slider-control-next, .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-next {
256
+
257
+ background: none repeat scroll 0 0 #4E443C;
258
+
259
+ border: 1px solid #CCC;
260
+
261
+ color: #CCC;
262
+
263
+ font: 24px/27px Arial, sans-serif;
264
+
265
+ height: 30px;
266
+
267
+ position: absolute;
268
+
269
+ text-align: center;
270
+
271
+ text-decoration: none;
272
+
273
+ top: 50%;
274
+
275
+ width: 30px;
276
+
277
+ z-index: 3;
278
+
279
+ -webkit-transition: all 0.3s linear;
280
+
281
+ -moz-transition: all 0.3s linear;
282
+
283
+ -ms-transition: all 0.3s linear;
284
+
285
+ -o-transition: all 0.3s linear;
286
+
287
+ transition: all 0.3s linear;
288
+
289
+ }
290
+
291
+
292
+
293
+ .yop-poll-page-slider-control-prev:focus {
294
+
295
+ border: 1px solid #FFFFFF;
296
+
297
+ color: #FFFFFF;
298
+
299
+ }
300
+
301
+ .yop-poll-pro-slider-control-prev:focus {
302
+
303
+ border: 1px solid #FFFFFF;
304
+
305
+ color: #FFFFFF;
306
+
307
+ }
308
+ .yop-poll-buy-slider-control-prev:focus {
309
+
310
+ border: 1px solid #FFFFFF;
311
+
312
+ color: #FFFFFF;
313
+
314
+ }
315
+
316
+
317
+
318
+ .yop-poll-buy-slider-control-prev:hover, .yop-poll-buy-slider-control-prev:focus, .yop-poll-page-slider-control-prev:hover, .yop-poll-page-slider-control-prev:focus, .yop-poll-page-slider-control-next:hover, .yop-poll-page-slider-control-next:focus, .yop-poll-widget-slider-control-prev:hover, .yop-poll-widget-slider-control-prev:focus, .yop-poll-widget-slider-control-next:hover, .yop-poll-widget-slider-control-next:focus {
319
+
320
+ border: 1px solid #FFFFFF;
321
+
322
+ color: #FFFFFF;
323
+
324
+ }
325
+
326
+ .yop-poll-buy-slider-control-prev:hover, .yop-poll-buy-slider-control-prev:focus, .yop-poll-pro-slider-control-prev:hover, .yop-poll-pro-slider-control-prev:focus, .yop-poll-pro-slider-control-next:hover, .yop-poll-pro-slider-control-next:focus, .yop-poll-widget-slider-control-prev:hover, .yop-poll-widget-slider-control-prev:focus, .yop-poll-widget-slider-control-next:hover, .yop-poll-widget-slider-control-next:focus {
327
+
328
+ border: 1px solid #FFFFFF;
329
+
330
+ color: #FFFFFF;
331
+
332
+ }
333
+
334
+
335
+
336
+ .yop-poll-page-slider-control-prev, .yop-poll-widget-slider-control-prev {
337
+
338
+ left: 15px;
339
+
340
+ }
341
+ .yop-poll-pro-slider-control-prev, .yop-poll-widget-slider-control-prev {
342
+
343
+ left: 15px;
344
+
345
+ }
346
+
347
+ .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-prev {
348
+
349
+ left: 15px;
350
+
351
+ }
352
+
353
+ .yop-poll-page-slider-control-next, .yop-poll-widget-slider-control-next {
354
+
355
+ right: 15px;
356
+
357
+ }
358
+
359
+ .yop-poll-pro-slider-control-next, .yop-poll-widget-slider-control-next {
360
+
361
+ right: 15px;
362
+
363
+ }
364
+ .yop-poll-buy-slider-control-next, .yop-poll-buy-slider-control-next {
365
+
366
+ right: 15px;
367
+
368
+ }
369
+
370
+
371
+
372
+ .yop-poll-page-slider-pagination, .yop-poll-widget-slider-pagination, .yop-poll-buy-slider-pagination {
373
+
374
+ bottom: 0px;
375
+
376
+ left: 50%;
377
+
378
+ margin: 0;
379
+
380
+ position: absolute;
381
+
382
+ transform: translate(-50%, 0px);
383
+
384
+ z-index: 999;
385
+
386
+ }
387
+
388
+ .yop-poll-pro-slider-pagination, .yop-poll-widget-slider-pagination, .yop-poll-buy-slider-pagination {
389
+
390
+ bottom: 0px;
391
+
392
+ left: 50%;
393
+
394
+ margin: 0;
395
+
396
+ position: absolute;
397
+
398
+ transform: translate(-50%, 0px);
399
+
400
+ z-index: 999;
401
+
402
+ }
403
+
404
+
405
+
406
+ .yop-poll-page-slider-pagination a, .yop-poll-widget-slider-pagination a, .yop-poll-buy-slider-pagination a {
407
+
408
+ background: none repeat scroll 0 0 #FFFFFF;
409
+
410
+ border-radius: 10px;
411
+
412
+ box-shadow: 0 0 2px #4E443C;
413
+
414
+ color: #4E443C;
415
+
416
+ display: inline-block;
417
+
418
+ font-size: 11px;
419
+
420
+ height: 10px;
421
+
422
+ line-height: 10px;
423
+
424
+ margin-right: 7px;
425
+
426
+ text-decoration: none;
427
+
428
+ text-indent: -9999px;
429
+
430
+ width: 10px;
431
+
432
+ }
433
+ .yop-poll-pro-slider-pagination a, .yop-poll-widget-slider-pagination a, .yop-poll-buy-slider-pagination a {
434
+
435
+ background: none repeat scroll 0 0 #FFFFFF;
436
+
437
+ border-radius: 10px;
438
+
439
+ box-shadow: 0 0 2px #4E443C;
440
+
441
+ color: #4E443C;
442
+
443
+ display: inline-block;
444
+
445
+ font-size: 11px;
446
+
447
+ height: 10px;
448
+
449
+ line-height: 10px;
450
+
451
+ margin-right: 7px;
452
+
453
+ text-decoration: none;
454
+
455
+ text-indent: -9999px;
456
+
457
+ width: 10px;
458
+
459
+ }
460
+
461
+
462
+
463
+ .yop-poll-page-slider-pagination a.active, .yop-poll-widget-slider-pagination a.active,.yop-poll-buy-slider-pagination a.active {
464
+
465
+ background: none repeat scroll 0 0 #4E443C;
466
+
467
+ box-shadow: 0 0 2px #F0EFE7;
468
+
469
+ color: #FFFFFF;
470
+
471
+ opacity: 1;
472
+
473
+ }
474
+
475
+ .yop-poll-pro-slider-pagination a.active, .yop-poll-widget-slider-pagination a.active, .yop-poll-buy-slider-pagination a.active {
476
+
477
+ background: none repeat scroll 0 0 #4E443C;
478
+
479
+ box-shadow: 0 0 2px #F0EFE7;
480
+
481
+ color: #FFFFFF;
482
+
483
+ opacity: 1;
484
+
485
+ }
486
+
487
+
488
+
489
+ .yop-poll-page-template-selected p, .yop-poll-widget-template-selected p, .yop-poll-buy-template-selected p {
490
+
491
+ background: #00A8FF;
492
+
493
+ color: #FFF;
494
+
495
+ -webkit-transition: all 0.3s linear;
496
+
497
+ -moz-transition: all 0.3s linear;
498
+
499
+ -ms-transition: all 0.3s linear;
500
+
501
+ -o-transition: all 0.3s linear;
502
+
503
+ transition: all 0.3s linear;
504
+
505
+ }
506
+ li:before, li:after {
507
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
508
+ }
509
+ .yop-poll-pro-template-selected p, .yop-poll-widget-template-selected p, .yop-poll-buy-template-selected p {
510
+
511
+ background: #00A8FF;
512
+
513
+ color: #FFF;
514
+
515
+ -webkit-transition: all 0.3s linear;
516
+
517
+ -moz-transition: all 0.3s linear;
518
+
519
+ -ms-transition: all 0.3s linear;
520
+
521
+ -o-transition: all 0.3s linear;
522
+
523
+ transition: all 0.3s linear;
524
+
525
+ }
526
+ li:before, li:after {
527
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
528
+ }
529
+ .align-with-item-per-page{
530
+ margin: 0 15px 0 0 !important;
531
+ }
532
+ .align-with-item-per-page2{
533
+ margin: 0 10px 0 0 !important;
534
+ }
535
+
css/yop-poll-add-edit.css ADDED
@@ -0,0 +1 @@
 
0
  width: 98%;
1
+ input#yop-poll-title {
2
  width: 98%;
css/yop-poll-admin-add-new.css DELETED
@@ -1,32 +0,0 @@
1
- input#yop-poll-question, input#yop-poll-name {
2
- width: 98%;
3
- }
4
-
5
- p#yop-poll-add-answer-holder {
6
- display: none;
7
- padding-right: 10px;
8
- text-align: right;
9
- }
10
-
11
- p#yop-poll-add-customfield-holder {
12
- display: none;
13
- padding-right: 10px;
14
- text-align: right;
15
- }
16
-
17
- .yop_poll_tr_customize_answer td table {
18
- margin-left: 50px;
19
- }
20
-
21
- .yop_poll_tr_customize_answer input[type="text"] {
22
- width:auto !important;
23
- }
24
- .yop-poll-answers-fieldset {
25
- border:solid;
26
- border-width: 1px;
27
- }
28
- .yop-poll-answers-fieldset legend{
29
- border:solid;
30
- border-width: 1px;
31
- font-weight: bold;
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/yop-poll-admin-custom-fields.css DELETED
@@ -1,8 +0,0 @@
1
- .yop-poll-admin-result-bar {
2
- background-color: #FBD55E;
3
- border: 1px solid #EDB918;
4
- display: block;
5
- height: 15px;
6
- margin: 0;
7
- padding: 5px 0 4px;
8
- }
 
 
 
 
 
 
 
 
css/yop-poll-admin-options.css DELETED
@@ -1,9 +0,0 @@
1
- .yop-poll-options-fieldset {
2
- border:solid;
3
- border-width: 1px;
4
- }
5
- .yop-poll-options-fieldset legend{
6
- border:solid;
7
- border-width: 1px;
8
- font-weight: bold;
9
- }
 
 
 
 
 
 
 
 
 
css/yop-poll-admin-results.css DELETED
@@ -1,8 +0,0 @@
1
- .yop-poll-admin-result-bar {
2
- background-color: #FBD55E;
3
- border: 1px solid #EDB918;
4
- display: block;
5
- height: 15px;
6
- margin: 0;
7
- padding: 5px 0 4px;
8
- }
 
 
 
 
 
 
 
 
css/yop-poll-admin.css CHANGED
@@ -1,4 +1,44 @@
1
- .icon32-yop-poll{background:url(../images/yop-poll-admin-menu-icon32.png) no-repeat center center;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  .yop-small-input { max-width:280px; }
3
  #donate_ul{ margin-left: 20px; margin-right: 20px; }
4
  #donate_ul li { line-height: 16px; list-style: disc outside none; }
@@ -7,4 +47,229 @@
7
  .yop_poll_suboption th {
8
  padding-left: 35px;
9
  background:url(../images/yop-poll-list-style.png) no-repeat 20px 8px;
10
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .icon32-yop-poll {
2
+ position: relative;
3
+ width: 32px;
4
+ height: 32px;
5
+ background:url(../images/yop-poll-admin-menu-icon32.png) no-repeat center center;
6
+ float: left;
7
+ margin: 5px;
8
+ }
9
+ .icon32-yop-poll-question-section {
10
+ position: relative;
11
+ width: 32px;
12
+ height: 32px;
13
+ background:url(../images/yop-poll-admin-question-section-icon32.png) no-repeat center center;
14
+ float: left;
15
+ margin: 5px;
16
+ }.more_details {
17
+ position: relative;
18
+ width: 15px;
19
+ height: 15px;
20
+ background:url(../images/more-details-button.png) no-repeat center center;
21
+ float: left;
22
+ margin: 5px;
23
+ }
24
+ .less_details{
25
+ position: relative;
26
+ width: 15px;
27
+ height: 15px;
28
+ background:url(../images/less-details-button.png) no-repeat center center;
29
+ float: left;
30
+ margin: 5px;
31
+ }
32
+
33
+ .yop-poll-section-header{
34
+ padding: 9px 15px 4px 0 !important;
35
+ clear:none !important;
36
+ margin-top:0px !important;
37
+ /*margin-bottom:5px !important;
38
+ border-bottom: solid;
39
+ border-bottom-width: 1px;
40
+ border-bottom-color: #DFDFDF;*/
41
+ }
42
  .yop-small-input { max-width:280px; }
43
  #donate_ul{ margin-left: 20px; margin-right: 20px; }
44
  #donate_ul li { line-height: 16px; list-style: disc outside none; }
47
  .yop_poll_suboption th {
48
  padding-left: 35px;
49
  background:url(../images/yop-poll-list-style.png) no-repeat 20px 8px;
50
+ }
51
+
52
+ .stuffbox {
53
+ background-color: #ffffff;
54
+ margin-bottom: 2px;
55
+ }
56
+
57
+ .stuffbox .handlediv {
58
+ float: right;
59
+ height: 30px;
60
+ width: 27px;
61
+ cursor: pointer;
62
+ }
63
+
64
+ .yop-poll-sortable .stuffbox .hndle {
65
+ cursor: move;
66
+ }
67
+
68
+ .yop-poll-titlediv {
69
+ margin-bottom: 5px;
70
+ position: relative;
71
+ }
72
+
73
+ .yop-poll-titlewrap {
74
+ border: 0 none;
75
+ padding: 0;
76
+ }
77
+
78
+ .yop-poll-titlediv .yop-poll-titlewrap input[type="text"] {
79
+ font-size: 1.7em;
80
+ height: 1.7em;
81
+ line-height: 100%;
82
+ margin: 1px 0;
83
+ outline: 0 none;
84
+ padding: 3px 8px;
85
+ width: 100%;
86
+ background-color: #FFFFFF;
87
+ border-radius: 3px;
88
+ border-style: solid;
89
+ border-width: 1px;
90
+ }
91
+ .yop-poll-titlediv .yop-poll-titlewrap label {
92
+ color: #BBBBBB;
93
+ font-size: 1.7em;
94
+ padding: 11px 10px;
95
+ position: absolute;
96
+ cursor: text;
97
+ }
98
+
99
+ .yop-poll-subtitlediv {
100
+ margin-bottom: 5px;
101
+ position: relative;
102
+ }
103
+
104
+ .yop-poll-subtitlewrap {
105
+ border: 0 none;
106
+ padding: 0;
107
+ }
108
+
109
+ .yop-poll-subtitlediv .yop-poll-subtitlewrap input[type="text"] {
110
+ font-size: 1.2em;
111
+ height: 1.7em;
112
+ line-height: 100%;
113
+ margin: 1px 0;
114
+ outline: 0 none;
115
+ padding: 3px 8px;
116
+ width: 100%;
117
+ background-color: #FFFFFF;
118
+ border-radius: 3px;
119
+ border-style: solid;
120
+ border-width: 1px;
121
+ }
122
+ .yop-poll-subtitlediv .yop-poll-subtitlewrap label {
123
+ color: #BBBBBB;
124
+ font-size: 1.2em;
125
+ padding: 5px;
126
+ position: absolute;
127
+ cursor: text;
128
+ }
129
+
130
+ .yop-poll-subsection {
131
+ /*border-bottom: solid;
132
+ border-bottom-width: 1px;
133
+ border-bottom-color: #DFDFDF;*/
134
+ }
135
+
136
+ .yop-poll-subsection-title {
137
+ margin: 5px 0px;
138
+ color: #464646;
139
+ }
140
+
141
+ .yop-poll-subsection-body {
142
+ margin-left: 20px;
143
+ }
144
+
145
+ .yop-poll-movable {
146
+ background: url("../images/yop-poll-movable-icon.png") no-repeat scroll center 6px;
147
+ cursor: move;
148
+ width: 20px;
149
+ }
150
+
151
+ .yop-poll-movable-div {
152
+ background-position: center 0;
153
+ float: left;
154
+ height: 24px;
155
+ }
156
+
157
+ .yop-poll-sections-delimiter {
158
+ width: 100%;
159
+ height: 1px;
160
+ border: 0;
161
+ background-color: #DFDFDF ;
162
+ }
163
+
164
+ .yop-poll-button-delete {
165
+ border-color: #cc0000 !important;
166
+ color: #CC0000 !important;
167
+ }
168
+
169
+ .yop-poll-options-table th {
170
+ text-align: left;
171
+ font-weight: normal;
172
+ width: 30%;
173
+ }
174
+
175
+ .yop-poll-fixedSidebar {
176
+ position: fixed;
177
+ top: 30px;
178
+ right: 315px;
179
+ float: right !important;
180
+ }
181
+ .yop-poll-admin-result-bar {
182
+ background-color: #FBD55E;
183
+ border: 1px solid #EDB918;
184
+ display: block;
185
+ height: 15px;
186
+ margin: 0;
187
+ padding: 5px 0 4px;
188
+ }
189
+
190
+ .ui-tooltip {
191
+ border-radius: 5px;
192
+ background: #00A8FF !important;
193
+ border: medium none;
194
+ color: #FFFFFF !important;
195
+ cursor: pointer;
196
+ font-size: 1.25em;
197
+ margin: 20px;
198
+ padding: 10px;
199
+ position: absolute;
200
+ z-index: 20;
201
+ }
202
+ .arrow {
203
+ width: 70px;
204
+ height: 12px;
205
+ overflow: hidden;
206
+ position: absolute;
207
+ left: 50%;
208
+ margin-left: -35px;
209
+ bottom: -16px;
210
+ }
211
+ .arrow.top {
212
+ top: -16px;
213
+ bottom: auto;
214
+ }
215
+ .arrow.left {
216
+ left: 20%;
217
+ }
218
+ .arrow:after {
219
+ content: "";
220
+ position: absolute;
221
+ left: 20px;
222
+ top: -20px;
223
+ width: 25px;
224
+ height: 25px;
225
+ box-shadow: 6px 5px 9px -9px black;
226
+ -webkit-transform: rotate(45deg);
227
+ -moz-transform: rotate(45deg);
228
+ -ms-transform: rotate(45deg);
229
+ -o-transform: rotate(45deg);
230
+ tranform: rotate(45deg);
231
+ }
232
+ .arrow.top:after {
233
+ bottom: -20px;
234
+ top: auto;
235
+ }
236
+
237
+ .dropdown-menu {
238
+ background-clip: padding-box;
239
+ background-color: #ffffff;
240
+ border: 1px solid rgba(0, 0, 0, 0.2);
241
+ border-radius: 6px;
242
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
243
+ display: none;
244
+ float: left;
245
+ left: 0;
246
+ list-style: none outside none;
247
+ margin: 2px 0 0;
248
+ min-width: 160px;
249
+ padding: 5px 0;
250
+ position: absolute;
251
+ top: 100%;
252
+ z-index: 1000;
253
+ }
254
+ .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus {
255
+ background-color: #0081c2;
256
+ background-image: linear-gradient(to bottom, #0088cc, #0077b3);
257
+ background-repeat: repeat-x;
258
+ color: #ffffff;
259
+ outline: 0 none;
260
+ text-decoration: none;
261
+ }
262
+ .dropdown-menu > li > a {
263
+ clear: both;
264
+ color: #333333;
265
+ display: block;
266
+ font-weight: normal;
267
+ line-height: 20px;
268
+ padding: 3px 20px;
269
+ white-space: nowrap;
270
+ }
271
+ a {
272
+ color: #0088cc;
273
+ text-decoration: none;
274
+ }
275
+ .wp-switch-editor { display:none!important; }
css/yop-poll-donate.css CHANGED
@@ -1,62 +1,62 @@
1
  #donate {
2
- width: 100%;
3
  }
4
 
5
  #donate #toggle {
6
- background: #00a8ff !important;
7
- height: 1.5em;
8
- font-variant: small-caps;
9
- font-size: 1.25em;
10
- padding: 5px 15px 0px 15px;
11
- color:#FFFFFF;
12
  }
13
 
14
  #donate #toggle #toggle_title{
15
- width: 12em;
16
- display: inline-block;
17
  }
18
 
19
  #donate .handlediv {
20
- color: #FFFFFF !important;
21
  }
22
 
23
  #donate .inside {
24
- background: #f7f7f7; /* Old browsers */
25
- background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
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, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
28
- background: -o-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */
29
- background: -ms-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* IE10+ */
30
- background: linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* W3C */
31
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
32
- border: 1px solid #cfcccc;
33
- color: #95abb7;
34
- padding: 5px 5px 20px 10px;
35
- margin: 0 !important;
36
  }
37
 
38
  #donate .inside #donateButton {
39
- position: relative;
40
- padding-top: 3px;
41
- width: 9em;
42
- font-size: 1.25em;
43
- border: none;
44
- background: #00a8ff;
45
- height: 1.5em;
46
- color: #FFFFFF !important;
47
- cursor: pointer;
48
- margin-left: auto;
49
- margin-right: auto;
50
  }
51
 
52
  #donateButton span {
53
- width: 100%;
54
- margin-left: 30%;
55
- margin-right: auto;
56
  }
57
 
58
  #donate .inside a {
59
- text-decoration: none;
60
- color: #00a8ff;
61
- width: auto;
62
  }
1
  #donate {
2
+ width: 100%;
3
  }
4
 
5
  #donate #toggle {
6
+ background: #00a8ff !important;
7
+ height: 1.5em;
8
+ font-variant: small-caps;
9
+ font-size: 1.25em;
10
+ padding: 5px 15px 0px 15px;
11
+ color:#FFFFFF;
12
  }
13
 
14
  #donate #toggle #toggle_title{
15
+ width: 12em;
16
+ display: inline-block;
17
  }
18
 
19
  #donate .handlediv {
20
+ color: #FFFFFF !important;
21
  }
22
 
23
  #donate .inside {
24
+ background: #f7f7f7; /* Old browsers */
25
+ background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
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, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
28
+ background: -o-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */
29
+ background: -ms-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* IE10+ */
30
+ background: linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* W3C */
31
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
32
+ border: 1px solid #cfcccc;
33
+ color: #95abb7;
34
+ padding: 5px 5px 20px 10px;
35
+ margin: 0 !important;
36
  }
37
 
38
  #donate .inside #donateButton {
39
+ position: relative;
40
+ padding-top: 3px;
41
+ width: 9em;
42
+ font-size: 1.25em;
43
+ border: none;
44
+ background: #00a8ff;
45
+ height: 1.5em;
46
+ color: #FFFFFF !important;
47
+ cursor: pointer;
48
+ margin-left: auto;
49
+ margin-right: auto;
50
  }
51
 
52
  #donateButton span {
53
+ width: 100%;
54
+ margin-left: 30%;
55
+ margin-right: auto;
56
  }
57
 
58
  #donate .inside a {
59
+ text-decoration: none;
60
+ color: #00a8ff;
61
+ width: auto;
62
  }
css/yop-poll-optin1.css DELETED
@@ -1,116 +0,0 @@
1
- @font-face{
2
- font-family: Lato-Reg;
3
- src: url(../fonts/Lato-Reg.ttf);
4
- }
5
-
6
- @font-face{
7
- font-family: Lato-Lig;
8
- src: url(../fonts/Lato-Lig.ttf);
9
- }
10
-
11
- @font-face{
12
- font-family: Lato-Bla;
13
- src: url(../fonts/Lato-Lato-Bla.ttf);
14
- }
15
-
16
- @font-face {
17
- font-family: 'FontomasCustomRegular';
18
- src: url('../fonts/fontomas-webfont.eot');
19
- src: url('../fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'),
20
- url('../fonts/fontomas-webfont.woff') format('woff'),
21
- url('../fonts/fontomas-webfont.ttf') format('truetype'),
22
- url('../fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
23
- font-weight: normal;
24
- font-style: normal;
25
- }
26
-
27
- .optin {
28
- text-align: center;
29
- width: 18.75em;
30
- margin: 0;
31
- padding: 0;
32
- border: 0;
33
- font-size: 100%;
34
- font: inherit;
35
- vertical-align: baseline;
36
- }
37
-
38
- .optin #circle {
39
- border-radius: 50%;
40
- background: #00a8ff;
41
- position: relative;
42
- margin: 0 auto;
43
- margin-top: 0.75em;
44
- width: 7.75em;
45
- height: 7.75em;
46
- }
47
-
48
- .optin h1 {
49
- font-size: 8em;
50
- color: #fff;
51
- font-family: Lato-Bla, Arial, Helvetica, sans-serif;
52
- line-height: 1em;
53
- }
54
-
55
- .optin h2 {
56
- font-size: 1.5em;
57
- margin-top: 0.5em;
58
- font-variant: small-caps;
59
- color: #95ABB7;
60
- }
61
-
62
- .optin label {
63
- position: relative;
64
- padding-right: 5px;
65
- }
66
-
67
- #optin1 {
68
- background: #f7f7f7; /* Old browsers */
69
- background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
70
- background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#f7f7f7), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
71
- background: -webkit-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
72
- background: -o-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* Opera 11.10+ */
73
- background: -ms-linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* IE10+ */
74
- background: linear-gradient(45deg, #f7f7f7 0%,#ffffff 100%); /* W3C */
75
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
76
- border: 1px solid #fff;
77
- -moz-box-shadow: 0px 0px 9px #dadada;
78
- -webkit-box-shadow: 0px 0px 9px #dadada;
79
- box-shadow: 0px 0px 9px #dadada;
80
- color: #95abb7;
81
- }
82
-
83
- #optin1 #circle {
84
- background: #00a8ff;
85
- position: relative;
86
- margin: 0 auto;
87
- margin-top: 0.75em;
88
- width: 125px;
89
- height: 125px;
90
- }
91
-
92
- #optin1 #email {
93
- width: 95%;
94
- height: 3em;
95
- }
96
-
97
- #optin1 #email:focus {
98
- background: #f9f9f9;
99
- }
100
-
101
- #optin1 #send {
102
- margin-top: 10px;
103
- font-size: 1.5em;
104
- height: 2.5;
105
- }
106
-
107
- #optin1 [data-icon]:after {
108
- left: 2px;
109
- content: attr(data-icon);
110
- font-family: 'FontomasCustomRegular';
111
- color: #00a8ff;
112
- position: absolute;
113
- left: 5px;
114
- top: 4px;
115
- width: 20px;
116
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/yop-poll-optin2.css CHANGED
@@ -1,147 +1,160 @@
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: 170px;
14
- position: relative;
15
- }
16
-
17
- #WFItem394041 #content {
18
- text-align: left;
19
- padding: 10px 15px 0px 15px;
20
- position: absolute;
21
- }
22
-
23
- #WFItem394041 #circle{
24
- background: rgba(255,255,255,0.1);
25
- position: absolute;
26
- width: 250px;
27
- height: 250px;
28
- margin-top: 0px;
29
- margin-left: 80px;
30
  }
31
 
32
- #WFItem394041 h1 {
33
- margin-top: 10px;
34
- font-size: 13em;
35
- color: rgba(255,255,255,0.1);
36
- z-index: 0;
37
- }
38
-
39
- #WFItem394041 .wf-button {
40
- border: 1px solid rgba(255,255,255,0.5);
41
- font-size: 1em;
42
- margin-top: 10px;
43
- z-index: 999;
44
- position: relative !important;
45
- }
46
-
47
- @font-face{
48
- font-family: Lato-Reg;
49
- src: url(../fonts/Lato-Reg.ttf);
50
- }
51
 
52
- @font-face{
53
- font-family: Lato-Lig;
54
- src: url(../fonts/Lato-Lig.ttf);
55
  }
56
 
57
- @font-face{
58
- font-family: Lato-Bla;
59
- src: url(../fonts/Lato-Bla.ttf);
60
  }
61
 
62
  @font-face {
63
- font-family: 'FontomasCustomRegular';
64
- src: url('../fonts/fontomas-webfont.eot');
65
- src: url('../fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'),
66
- url('../fonts/fontomas-webfont.woff') format('woff'),
67
- url('../fonts/fontomas-webfont.ttf') format('truetype'),
68
- url('../fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
69
- font-weight: normal;
70
- font-style: normal;
71
  }
72
 
73
-
74
- .optin {
75
- text-align: center;
 
 
 
76
  }
77
 
78
- .optin #circle {
79
- border-radius: 50%;
80
- background: #00a8ff;
81
- position: relative;
82
- margin: 0 auto;
83
- margin-top: 0.75em;
84
- width: 7.75em;
85
- height: 7.75em;
86
- z-index: 0;
 
 
 
 
 
 
 
 
87
  }
88
-
89
- .optin h1 {
90
- font-size: 8em;
91
- color: #fff;
92
- font-family: Lato-Bla, Arial, Helvetica, sans-serif;
93
- line-height: 1em;
94
  }
95
 
96
- .optin h2 {
97
- font-size: 1.5em;
98
- margin-top: 0.5em;
99
- font-variant: small-caps;
100
  }
101
 
102
-
103
- .optin label {
104
- position: relative;
 
 
 
105
  }
106
 
107
- .optin #email {
108
- background: none repeat scroll 0 0 #FFFFFF;
109
- border: 1px solid #00A8FF;
110
- color: #AEAAAA;
111
- font-family: Calibri,Arial,Helvetica,sans-serif;
112
- font-size: 1.125em;
113
- height: 2em;
114
- margin-top: 0.5em;
115
- padding-left: 2em;
116
- transition: all 0.3s linear 0s;
117
- width: 95%;
118
  }
119
 
120
- .optin #email:focus {
121
- background: #f9f9f9;
 
 
 
 
 
122
  }
123
 
124
- .optin [data-icon]:after {
125
- content: attr(data-icon);
126
- font-family: 'FontomasCustomRegular';
127
- font-size: 1.5em;
128
- color: #00a8ff;
129
- position: absolute;
130
- left: 0px;
131
- top: 4px;
132
- width: 30px;
 
 
 
 
 
 
133
  }
134
 
135
- .wf-button {
136
- margin-bottom: 0.5em;
137
- border: none;
138
- background: #00a8ff;
139
- height: 2em;
140
- color: white;
141
- cursor: pointer;
142
- z-index: 100 !important;
143
  }
144
 
145
- .wf-button:active {
146
- background: #0098e6;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
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');
36
+ src: url('fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/fontomas-webfont.woff') format('woff'), url('fonts/fontomas-webfont.ttf') format('truetype'), url('fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
37
+ font-weight: normal;
38
+ font-style: normal;
39
  }
40
 
41
+ /* Optin */
42
+ #WFItem394041 {
43
+ background: #f7f7f7; /* Old browsers */
44
+ background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
45
+ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #f7f7f7), color-stop(100%, #ffffff)); /* Chrome,Safari4+ */
46
+ background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Chrome10+,Safari5.1+ */
47
+ background: -o-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Opera 11.10+ */
48
+ background: -ms-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* IE10+ */
49
+ background: linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* W3C */
50
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#ffffff', GradientType=1); /* IE6-9 fallback on horizontal gradient */
51
+ border: 1px solid #fff;
52
+ -moz-box-shadow: 0px 0px 9px #dadada;
53
+ -webkit-box-shadow: 0px 0px 9px #dadada;
54
+ box-shadow: 0px 0px 9px #dadada;
55
+ color: #95abb7;
56
+ text-align: center;
57
+ height: auto;
58
  }
59
+ #WFItem394041 h1 {
60
+ font-size: 8em;
61
+ margin: 0.2em;
62
+ color: #fff;
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;
74
+ font-variant: small-caps;
75
+ font-weight: bold;
76
+ color: #95abb7;
77
  }
78
 
79
+ #WFItem394041 h3 {
80
+ font-size: 2em;
81
+ margin-top: 0.2em;
82
+ font-weight: bold;
83
+ color: #95abb7;
84
+ display: inline;
 
 
 
 
 
85
  }
86
 
87
+ #WFItem394041 #circle {
88
+ border-radius: 50%;
89
+ background: #00a8ff;
90
+ position: relative;
91
+ margin: 0 auto;
92
+ width: 7.75em;
93
+ height: 7.75em;
94
  }
95
 
96
+ #WFItem394041 #email {
97
+ border-style: none;
98
+ border: 1px solid #00a8ff;
99
+ background: #fff;
100
+ margin-top: 0.5em;
101
+ padding-left: 2em;
102
+ font-size: 1.125em;
103
+ font-family: Calibri, Arial, Helvetica, sans-serif;
104
+ color: #aeaaaa;
105
+ -webkit-transition: all 0.3s linear;
106
+ -moz-transition: all 0.3s linear;
107
+ -o-transition: all 0.3s linear;
108
+ transition: all 0.3s linear;
109
+ width: 75%;
110
+ height: 2.3em;
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: #00A8FF;
137
+ cursor: pointer;
138
+ float: right;
139
+ font-size: 1.5em;
140
+ height: 1em;
141
+ width: 1em;
142
+ top: 5px;
143
+ right: 5px;
144
+ }
145
+
146
+ #WFItem394041 [data-icon]:after {
147
+ left: 2px;
148
+ content: attr(data-icon);
149
+ font-family: 'FontomasCustomRegular';
150
+ color: #00a8ff;
151
+ position: absolute;
152
+ left: 5px;
153
+ top: 4px;
154
+ width: 20px;
155
+ }
156
+
157
+ #poststuff h2 {
158
+
159
+ margin-bottom: -15px !important;
160
  }
css/yop-poll-slider.css ADDED
@@ -0,0 +1,587 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .yop-poll-slider {
2
+
3
+ padding: 0 !important;
4
+
5
+ }
6
+
7
+
8
+
9
+ .yop-poll-slider .hndle {
10
+
11
+ padding-left: 15px !important;
12
+
13
+ }
14
+
15
+
16
+
17
+ .yop-poll-slider-container {
18
+
19
+ position: relative;
20
+
21
+ height: 475px;
22
+
23
+ width: 100%;
24
+
25
+ border: #E5E5E5 1px solid;
26
+
27
+ border-top: none;
28
+
29
+ border-bottom: none;
30
+
31
+ z-index: 0;
32
+
33
+ }
34
+ .yop-poll-slider-container2 {
35
+
36
+ position: relative;
37
+
38
+ height: 475px;
39
+
40
+ width: 670px;
41
+
42
+ border: none;
43
+
44
+ border-top: none;
45
+
46
+ border-bottom: none;
47
+
48
+ z-index: 0;
49
+
50
+
51
+ }
52
+
53
+
54
+ .yop-poll-slider-container a {
55
+
56
+ outline: 0;
57
+
58
+ }
59
+
60
+
61
+
62
+ .yop-poll-slider-container .hndle {
63
+
64
+ cursor: default;
65
+
66
+ }
67
+
68
+
69
+
70
+ .yop-poll-slider-container h4 span {
71
+
72
+ background: #555;
73
+
74
+ color: #E6E5E5;
75
+
76
+ padding: 8px;
77
+
78
+ font-size: 14px;
79
+
80
+ border: 1px solid #FFF;
81
+
82
+ }
83
+
84
+
85
+
86
+ .yop-poll-slider-container #yop-poll-template-width, .yop-poll-slider-container #yop-poll-widget-template-width {
87
+
88
+ border-radius: 0;
89
+
90
+ border: 1px solid #00A8FF;
91
+
92
+ margin-left: 10px;
93
+
94
+ }
95
+
96
+
97
+
98
+ .yop-poll-page-slider, .yop-poll-widget-slider, .yop-poll-buy-slider {
99
+
100
+ overflow: hidden;
101
+
102
+ position: relative;
103
+
104
+ width: 100%;
105
+
106
+ }
107
+ .yop-poll-pro-slider, .yop-poll-widget-slider, .yop-poll-buy-slider {
108
+
109
+ overflow: hidden;
110
+
111
+ position: relative;
112
+
113
+ width: 100%;
114
+
115
+ }
116
+
117
+
118
+
119
+ .yop-poll-page-slider ul, .yop-poll-widget-slider ul, .yop-poll-buy-slider ul {
120
+
121
+ list-style: none outside none;
122
+
123
+ margin: 0;
124
+
125
+ margin-top: 10px;
126
+
127
+ padding: 0;
128
+
129
+ position: relative;
130
+
131
+ width: 20000em;
132
+
133
+ }.yop-poll-pro-slider ul, .yop-poll-widget-slider ul, .yop-poll-buy-slider ul {
134
+
135
+ list-style: none outside none;
136
+
137
+ margin: 0;
138
+
139
+ margin-top: 10px;
140
+
141
+ padding: 0;
142
+
143
+ position: relative;
144
+
145
+ width: 20000em;
146
+
147
+ }
148
+
149
+
150
+
151
+ .yop-poll-page-slider .yop-poll-page-template-li, .yop-poll-widget-slider .yop-poll-widget-template-li, .yop-poll-buy-slider .yop-poll-buy-template-li {
152
+
153
+ -moz-box-sizing: border-box;
154
+
155
+ -webkit-box-sizing: border-box;
156
+
157
+ box-sizing: border-box;
158
+
159
+ float: left;
160
+
161
+ /*width: 220px !important;
162
+
163
+ height: 210px;*/
164
+
165
+ }
166
+ .yop-poll-pro-slider .yop-poll-pro-template-li, .yop-poll-widget-slider .yop-poll-widget-template-li, .yop-poll-buy-slider .yop-poll-buy-template-li {
167
+
168
+ -moz-box-sizing: border-box;
169
+
170
+ -webkit-box-sizing: border-box;
171
+
172
+ box-sizing: border-box;
173
+
174
+ float: left;
175
+
176
+ /*width: 220px !important;
177
+
178
+ height: 210px;*/
179
+
180
+ }
181
+
182
+
183
+
184
+ .yop-poll-page-slider .yop-poll-page-template-li p, .yop-poll-widget-slider .yop-poll-widget-template-li p .yop-poll-buy-slider .yop-poll-buy-template-li p{
185
+
186
+ margin: 0 auto;
187
+
188
+ padding: 3px;
189
+
190
+ width: 150px;
191
+
192
+ border: 1px solid #00A8FF;
193
+
194
+ font-weight: 600;
195
+
196
+ }
197
+
198
+
199
+ .yop-poll-pro-slider .yop-poll-pro-template-li p, .yop-poll-widget-slider .yop-poll-widget-template-li p, .yop-poll-buy-slider .yop-poll-buy-template-li p {
200
+
201
+ margin: 0;
202
+
203
+ padding: 3px;
204
+
205
+ width: 150px;
206
+
207
+ border: 1px solid #00A8FF;
208
+
209
+ font-weight: 600;
210
+
211
+ }
212
+
213
+
214
+
215
+ .yop-poll-page-slider img .yop-poll-widget-slider img .yop-poll-buy-slider img {
216
+
217
+ display: block;
218
+
219
+ height: auto !important;
220
+
221
+ max-width: 100%;
222
+
223
+ }
224
+
225
+ .yop-poll-pro-slider img .yop-poll-widget-slider img .yop-poll-buy-slider img {
226
+
227
+ display: block;
228
+
229
+ height: auto !important;
230
+
231
+ max-width: 100%;
232
+
233
+ }
234
+
235
+
236
+
237
+ .yop-poll-page-slider-control-prev, .yop-poll-page-slider-control-next, .yop-poll-widget-slider-control-prev, .yop-poll-widget-slider-control-next, .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-next {
238
+
239
+ background: none repeat scroll 0 0 #4E443C;
240
+
241
+ border: 1px solid #CCC;
242
+
243
+ color: #CCC;
244
+
245
+ font: 24px/27px Arial, sans-serif;
246
+
247
+ height: 30px;
248
+
249
+ position: absolute;
250
+
251
+ text-align: center;
252
+
253
+ text-decoration: none;
254
+
255
+ top: 50%;
256
+
257
+ width: 30px;
258
+
259
+ z-index: 3;
260
+
261
+ -webkit-transition: all 0.3s linear;
262
+
263
+ -moz-transition: all 0.3s linear;
264
+
265
+ -ms-transition: all 0.3s linear;
266
+
267
+ -o-transition: all 0.3s linear;
268
+
269
+ transition: all 0.3s linear;
270
+
271
+ }
272
+ .yop-poll-pro-slider-control-prev, .yop-poll-pro-slider-control-next, .yop-poll-widget-slider-control-prev, .yop-poll-widget-slider-control-next, .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-next {
273
+
274
+ background: none repeat scroll 0 0 #4E443C;
275
+
276
+ border: 1px solid #CCC;
277
+
278
+ color: #CCC;
279
+
280
+ font: 24px/27px Arial, sans-serif;
281
+
282
+ height: 30px;
283
+
284
+ position: absolute;
285
+
286
+ text-align: center;
287
+
288
+ text-decoration: none;
289
+
290
+ top: 50%;
291
+
292
+ width: 30px;
293
+
294
+ z-index: 3;
295
+
296
+ -webkit-transition: all 0.3s linear;
297
+
298
+ -moz-transition: all 0.3s linear;
299
+
300
+ -ms-transition: all 0.3s linear;
301
+
302
+ -o-transition: all 0.3s linear;
303
+
304
+ transition: all 0.3s linear;
305
+
306
+ }
307
+
308
+
309
+
310
+ .yop-poll-page-slider-control-prev:focus {
311
+
312
+ border: 1px solid #FFFFFF;
313
+
314
+ color: #FFFFFF;
315
+
316
+ }
317
+
318
+ .yop-poll-pro-slider-control-prev:focus {
319
+
320
+ border: 1px solid #FFFFFF;
321
+
322
+ color: #FFFFFF;
323
+
324
+ }
325
+ .yop-poll-buy-slider-control-prev:focus {
326
+
327
+ border: 1px solid #FFFFFF;
328
+
329
+ color: #FFFFFF;
330
+
331
+ }
332
+ .yop-poll-buy-slider-control-next:focus {
333
+
334
+ border: 1px solid #FFFFFF;
335
+
336
+ color: #FFFFFF;
337
+
338
+ }
339
+
340
+
341
+ .yop-poll-buy-slider-control-prev:hover, .yop-poll-buy-slider-control-prev:focus, .yop-poll-page-slider-control-prev:hover, .yop-poll-page-slider-control-prev:focus, .yop-poll-page-slider-control-next:hover, .yop-poll-page-slider-control-next:focus, .yop-poll-widget-slider-control-prev:hover, .yop-poll-widget-slider-control-prev:focus, .yop-poll-widget-slider-control-next:hover, .yop-poll-widget-slider-control-next:focus {
342
+
343
+ border: 1px solid #FFFFFF;
344
+
345
+ color: #FFFFFF;
346
+
347
+ }
348
+
349
+ .yop-poll-buy-slider-control-prev:hover, .yop-poll-buy-slider-control-prev:focus, .yop-poll-pro-slider-control-prev:hover, .yop-poll-pro-slider-control-prev:focus, .yop-poll-pro-slider-control-next:hover, .yop-poll-pro-slider-control-next:focus, .yop-poll-widget-slider-control-prev:hover, .yop-poll-widget-slider-control-prev:focus, .yop-poll-widget-slider-control-next:hover, .yop-poll-widget-slider-control-next:focus {
350
+
351
+ border: 1px solid #FFFFFF;
352
+
353
+ color: #FFFFFF;
354
+
355
+ }
356
+ .yop-poll-buy-slider-control-next:hover{
357
+
358
+ border: 1px solid #FFFFFF;
359
+
360
+ color: #FFFFFF;
361
+ }
362
+
363
+
364
+
365
+ .yop-poll-page-slider-control-prev, .yop-poll-widget-slider-control-prev {
366
+
367
+ left: 15px;
368
+
369
+ }
370
+ .yop-poll-pro-slider-control-prev, .yop-poll-widget-slider-control-prev {
371
+
372
+ left: 15px;
373
+
374
+ }
375
+
376
+ .yop-poll-buy-slider-control-prev, .yop-poll-buy-slider-control-prev {
377
+
378
+ left: 15px;
379
+
380
+ }
381
+
382
+ .yop-poll-page-slider-control-next, .yop-poll-widget-slider-control-next {
383
+
384
+ right: 15px;
385
+
386
+ }
387
+
388
+ .yop-poll-pro-slider-control-next, .yop-poll-widget-slider-control-next {
389
+
390
+ right: 15px;
391
+
392
+ }
393
+ .yop-poll-buy-slider-control-next, .yop-poll-buy-slider-control-next {
394
+
395
+ right: 15px;
396
+
397
+ }
398
+
399
+
400
+
401
+ .yop-poll-page-slider-pagination, .yop-poll-widget-slider-pagination, .yop-poll-buy-slider-pagination {
402
+
403
+ bottom: 0px;
404
+
405
+ left: 50%;
406
+
407
+ margin: 0;
408
+
409
+ position: absolute;
410
+
411
+ transform: translate(-50%, 0px);
412
+
413
+ z-index: 999;
414
+
415
+ }
416
+
417
+ .yop-poll-pro-slider-pagination, .yop-poll-widget-slider-pagination, .yop-poll-buy-slider-pagination {
418
+
419
+ bottom: 0px;
420
+
421
+ left: 50%;
422
+
423
+ margin: 0;
424
+
425
+ position: absolute;
426
+
427
+ transform: translate(-50%, 0px);
428
+
429
+ z-index: 999;
430
+
431
+ }
432
+
433
+
434
+
435
+ .yop-poll-page-slider-pagination a, .yop-poll-widget-slider-pagination a, .yop-poll-buy-slider-pagination a {
436
+
437
+ background: none repeat scroll 0 0 #FFFFFF;
438
+
439
+ border-radius: 10px;
440
+
441
+ box-shadow: 0 0 2px #4E443C;
442
+
443
+ color: #4E443C;
444
+
445
+ display: inline-block;
446
+
447
+ font-size: 11px;
448
+
449
+ height: 10px;
450
+
451
+ line-height: 10px;
452
+
453
+ margin-right: 7px;
454
+
455
+ text-decoration: none;
456
+
457
+ text-indent: -9999px;
458
+
459
+ width: 10px;
460
+
461
+ }
462
+ .yop-poll-pro-slider-pagination a, .yop-poll-widget-slider-pagination a, .yop-poll-buy-slider-pagination a {
463
+
464
+ background: none repeat scroll 0 0 #FFFFFF;
465
+
466
+ border-radius: 10px;
467
+
468
+ box-shadow: 0 0 2px #4E443C;
469
+
470
+ color: #4E443C;
471
+
472
+ display: inline-block;
473
+
474
+ font-size: 11px;
475
+
476
+ height: 10px;
477
+
478
+ line-height: 10px;
479
+
480
+ margin-right: 7px;
481
+
482
+ text-decoration: none;
483
+
484
+ text-indent: -9999px;
485
+
486
+ width: 10px;
487
+
488
+ }
489
+
490
+
491
+
492
+ .yop-poll-page-slider-pagination a.active, .yop-poll-widget-slider-pagination a.active,.yop-poll-buy-slider-pagination a.active {
493
+
494
+ background: none repeat scroll 0 0 #4E443C;
495
+
496
+ box-shadow: 0 0 2px #F0EFE7;
497
+
498
+ color: #FFFFFF;
499
+
500
+ opacity: 1;
501
+
502
+ }
503
+
504
+ .yop-poll-pro-slider-pagination a.active, .yop-poll-widget-slider-pagination a.active, .yop-poll-buy-slider-pagination a.active {
505
+
506
+ background: none repeat scroll 0 0 #4E443C;
507
+
508
+ box-shadow: 0 0 2px #F0EFE7;
509
+
510
+ color: #FFFFFF;
511
+
512
+ opacity: 1;
513
+
514
+ }
515
+
516
+
517
+
518
+ .yop-poll-page-template-selected p, .yop-poll-widget-template-selected p, .yop-poll-buy-template-selected p {
519
+
520
+ background: #00A8FF;
521
+
522
+ color: #FFF;
523
+
524
+ -webkit-transition: all 0.3s linear;
525
+
526
+ -moz-transition: all 0.3s linear;
527
+
528
+ -ms-transition: all 0.3s linear;
529
+
530
+ -o-transition: all 0.3s linear;
531
+
532
+ transition: all 0.3s linear;
533
+
534
+ }
535
+ li:before, li:after {
536
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
537
+ }
538
+ .yop-poll-pro-template-selected p, .yop-poll-widget-template-selected p, .yop-poll-buy-template-selected p {
539
+
540
+ background: #00A8FF;
541
+
542
+ color: #FFF;
543
+
544
+ -webkit-transition: all 0.3s linear;
545
+
546
+ -moz-transition: all 0.3s linear;
547
+
548
+ -ms-transition: all 0.3s linear;
549
+
550
+ -o-transition: all 0.3s linear;
551
+
552
+ transition: all 0.3s linear;
553
+
554
+ }
555
+ li:before, li:after {
556
+ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
557
+ }
558
+
559
+
560
+ .ui-dialog .ui-dialog-titlebar {
561
+
562
+ padding: 0.1em .5em;
563
+
564
+ position: relative;
565
+
566
+ font-size: 1em;
567
+
568
+ }
569
+
570
+ .ui-dialog-titlebar-close {
571
+
572
+ background: url(../images/yop-poll-close.png) !important;
573
+
574
+ }
575
+ .ui-widget-header {
576
+
577
+ background: #00A8FF;
578
+
579
+ border: 0;
580
+
581
+ color: #fff;
582
+
583
+ font-weight: normal;
584
+
585
+ border-radius: 0;
586
+
587
+ }
css/yop-poll-wizard.css ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ SmartWizard 2.0 plugin
3
+ jQuery Wizard control Plugin
4
+ by Dipu
5
+
6
+ http://www.techlaboratory.net
7
+ http://tech-laboratory.blogspot.com
8
+ */
9
+ #yop-poll-wizard {
10
+ position:relative;
11
+ display:block;
12
+ margin:0;
13
+ padding:0;
14
+ border: 0px solid #CCC;
15
+ overflow:visible;
16
+ float:left;
17
+ width: 100%;
18
+ }
19
+ #yop-poll-wizard .stepContainer {
20
+ display:block;
21
+ position: relative;
22
+ margin: 0;
23
+ padding:0;
24
+ border: 0px solid #CCC;
25
+ overflow:hidden;
26
+ clear:both;
27
+ height:auto !important;
28
+ }
29
+ .wizard_options ul.anchor li a{
30
+ width: 127px !important;
31
+ }
32
+
33
+ #yop-poll-wizard .stepContainer div.content {
34
+ display:block;
35
+ position: relative;
36
+ float:left;
37
+ margin: 0;
38
+ border: 1px solid #CCC;
39
+ font: normal 12px Verdana, Arial, Helvetica, sans-serif;
40
+ color:#5A5655;
41
+ background-color:#F8F8F8;
42
+ height:auto;
43
+ text-align:left;
44
+ overflow:hidden;
45
+ -webkit-border-radius: 5px;
46
+ -moz-border-radius : 5px;
47
+ width:100%;
48
+ clear:both;
49
+ }
50
+
51
+ #yop-poll-wizard div.actionBar {
52
+ display:block;
53
+ position: relative;
54
+ clear:both;
55
+ margin: 3px 0 0 0;
56
+ border: 1px solid #CCC;
57
+ padding: 0;
58
+ color: #5A5655;
59
+ background-color: #F8F8F8;
60
+ height:40px;
61
+ text-align:left;
62
+ overflow:auto;
63
+ -webkit-border-radius: 5px;
64
+ -moz-border-radius : 5px;
65
+ left:0;
66
+ }
67
+
68
+ #yop-poll-wizard .stepContainer .StepTitle {
69
+ display:block;
70
+ position: relative;
71
+ margin:0;
72
+ border:1px solid #E0E0E0;
73
+ padding:5px;
74
+ font: bold 16px Verdana, Arial, Helvetica, sans-serif;
75
+ color:#5A5655;
76
+ background-color:#E0E0E0;
77
+ clear:both;
78
+ text-align:left;
79
+ z-index:88;
80
+ -webkit-border-radius: 5px;
81
+ -moz-border-radius : 5px;
82
+ }
83
+ #yop-poll-wizard ul.anchor {
84
+ position: relative;
85
+ display:block;
86
+ float:left;
87
+ list-style: none;
88
+ padding: 0px;
89
+ margin: 10px 0;
90
+ clear: both;
91
+ border: 0px solid #CCCCCC;
92
+ background: transparent; /*#EEEEEE */
93
+ z-index: 0 !important;
94
+ }
95
+ #yop-poll-wizard ul.anchor li{
96
+ position: relative;
97
+ display:block;
98
+ margin: 0;
99
+ padding: 0;
100
+ padding-left:3px;
101
+ padding-right: 3px;
102
+ padding-bottom: 8px;
103
+ border: 0px solid #E0E0E0;
104
+ float: left;
105
+ }
106
+ /* Anchor Element Style */
107
+ #yop-poll-wizard ul.anchor li a {
108
+ display:block;
109
+ position:relative;
110
+ float:left;
111
+ text-align: center;
112
+ margin:0;
113
+ padding: 6px 3px 3px 3px;
114
+ height: 20px;
115
+ width: 155px;
116
+ text-decoration: none;
117
+ outline-style:none;
118
+ z-index:99;
119
+ -webkit-transition: all 0.25s linear;
120
+ -moz-transition: all 0.25s linear;
121
+ -ms-transition: all 0.25s linear;
122
+ -o-transition: all 0.25s linear;
123
+ transition: all 0.25s linear;
124
+ }
125
+ #yop-poll-wizard ul.anchor li a .stepNumber{
126
+ position:relative;
127
+ float:left;
128
+ width:20px;
129
+ text-align: center;
130
+ padding:5px;
131
+ padding-top:0;
132
+ font: bold 25px Verdana, Arial, Helvetica, sans-serif;
133
+ }
134
+ #yop-poll-wizard ul.anchor li a .stepDesc{
135
+ position:relative;
136
+ display:block;
137
+ float:left;
138
+ text-align: left;
139
+ padding:5px;
140
+
141
+ font: bold 20px Verdana, Arial, Helvetica, sans-serif;
142
+ }
143
+ #yop-poll-wizard ul.anchor li a .stepDesc small{
144
+ font: normal 12px Verdana, Arial, Helvetica, sans-serif;
145
+ }
146
+ #yop-poll-wizard ul.anchor li a.selected{
147
+ background: #00A8FF;
148
+ color: #E6E5E5;
149
+ border: 1px solid #58CEFF;
150
+ }
151
+ #yop-poll-wizard ul.anchor li a.selected:hover {
152
+ color: #FFF;
153
+ border: 1px solid #FFF;
154
+ }
155
+
156
+ #yop-poll-wizard ul.anchor li a.done {
157
+ position:relative;
158
+ color: #999;
159
+ background: #FFF;
160
+ border: 1px solid #58CEFF;
161
+ z-index:99;
162
+ }
163
+ #yop-poll-wizard ul.anchor li a.done:hover {
164
+ color: #00A8FF;
165
+ border: 1px solid #00A8FF;
166
+ }
167
+ #yop-poll-wizard ul.anchor li a.disabled {
168
+ color:#CCCCCC;
169
+ background: #F8F8F8;
170
+ border: 1px solid #CCC;
171
+ cursor: text;
172
+ }
173
+ #yop-poll-wizard ul.anchor li a.disabled:hover {
174
+ color:#CCCCCC;
175
+ background: #F8F8F8;
176
+ }
177
+
178
+ #yop-poll-wizard ul.anchor li a.error {
179
+ color:#6c6c6c !important;
180
+ background: #f08f75 !important;
181
+ border: 1px solid #fb3500 !important;
182
+ }
183
+ #yop-poll-wizard ul.anchor li a.error:hover {
184
+ color:#000 !important;
185
+ }
186
+
187
+ #yop-poll-wizard .buttonNext {
188
+ border: 1px solid #58CEFF;
189
+ color: #E6E5E5;
190
+ padding: 5px;
191
+ transition: all 0.3s linear 0s;
192
+ float:right;
193
+ margin:5px 3px 0 3px;
194
+ text-decoration: none;
195
+ text-align: center;
196
+ font: bold 13px Verdana, Arial, Helvetica, sans-serif;
197
+ width:100px;
198
+ outline-style:none;
199
+ background: none repeat scroll 0 0 #00A8FF;
200
+ -moz-border-radius : 5px;
201
+ -webkit-border-radius: 5px;
202
+ }
203
+
204
+ #yop-poll-wizard .buttonNext:hover {
205
+ color: #fff;
206
+ border: 1px solid #fff;
207
+ }
208
+ #yop-poll-wizard .buttonDisabled {
209
+ display: none;
210
+ }
211
+
212
+ #yop-poll-wizard .buttonPrevious {
213
+ border: 1px solid #58CEFF;
214
+ color: #E6E5E5;
215
+ padding: 5px;
216
+ transition: all 0.3s linear 0s;
217
+ float:right;
218
+ margin:5px 3px 0 3px;
219
+ text-decoration: none;
220
+ text-align: center;
221
+ font: bold 13px Verdana, Arial, Helvetica, sans-serif;
222
+ width:100px;
223
+ outline-style:none;
224
+ background: none repeat scroll 0 0 #00A8FF;
225
+ -moz-border-radius : 5px;
226
+ -webkit-border-radius: 5px;
227
+ }
228
+ #yop-poll-wizard .buttonPrevious:hover {
229
+ color: #fff;
230
+ border: 1px solid #fff;
231
+ }
232
+ #yop-poll-wizard .buttonFinish {
233
+ display:block;
234
+ float:right;
235
+ margin:5px 10px 0 3px;
236
+ padding:5px;
237
+ text-decoration: none;
238
+ text-align: center;
239
+ font: bold 13px Verdana, Arial, Helvetica, sans-serif;
240
+ width:100px;
241
+ color:#FFF;
242
+ outline-style:none;
243
+ background-color: #5A5655;
244
+ border: 1px solid #5A5655;
245
+ -moz-border-radius : 5px;
246
+ -webkit-border-radius: 5px;
247
+ }
248
+
249
+ /* Form Styles */
250
+
251
+ .txtBox {
252
+ border:1px solid #CCCCCC;
253
+ color:#5A5655;
254
+ font:13px Verdana,Arial,Helvetica,sans-serif;
255
+ padding:2px;
256
+ width:430px;
257
+ }
258
+ .txtBox:focus {
259
+ border:1px solid #EA8511;
260
+ }
261
+
262
+ #yop-poll-wizard .loader {
263
+ position:relative;
264
+ display:none;
265
+ float:left;
266
+ margin: 2px 0 0 2px;
267
+ padding:8px 10px 8px 40px;
268
+ border: 1px solid #FFD700;
269
+ font: bold 13px Verdana, Arial, Helvetica, sans-serif;
270
+ color:#5A5655;
271
+ background: #FFF url(../images/loader.gif) no-repeat 5px;
272
+ -moz-border-radius : 5px;
273
+ -webkit-border-radius: 5px;
274
+ z-index:998;
275
+ }
276
+ #yop-poll-wizard .msgBox {
277
+ position:relative;
278
+ display:none;
279
+ float:left;
280
+ margin: 4px 0 0 5px;
281
+ padding:5px;
282
+ border: 1px solid #FFD700;
283
+ background-color: #FFFFDD;
284
+ font: normal 12px Verdana, Arial, Helvetica, sans-serif;
285
+ color:#5A5655;
286
+ -moz-border-radius : 5px;
287
+ -webkit-border-radius: 5px;
288
+ z-index:999;
289
+ min-width:200px;
290
+ }
291
+ #yop-poll-wizard .msgBox .content {
292
+ font: normal 12px Verdana,Arial,Helvetica,sans-serif;
293
+ padding: 0px;
294
+ float:left;
295
+ }
296
+ #yop-poll-wizard .msgBox .close {
297
+ border: 1px solid #CCC;
298
+ border-radius: 3px;
299
+ color: #CCC;
300
+ display: block;
301
+ float: right;
302
+ margin: 0 0 0 5px;
303
+ outline-style: none;
304
+ padding: 0 2px 0 2px;
305
+ position: relative;
306
+ text-align: center;
307
+ text-decoration: none;
308
+ }
309
+ #yop-poll-wizard .msgBox .close:hover{
310
+ color: #EA8511;
311
+ border: 1px solid #EA8511;
312
+ }
images/Untitled-7.jpg ADDED
Binary file
images/ajax-loader.gif ADDED
Binary file
images/blue2.jpg ADDED
Binary file
images/blue_pro.jpg ADDED
Binary file
images/blue_v3_pro.jpg ADDED
Binary file
images/check_radio_sheet.jpg ADDED
Binary file
images/check_radio_sheet1.jpg ADDED
Binary file
images/dark_pro.jpg ADDED
Binary file
images/green_pro.jpg ADDED
Binary file
images/green_pro_4.jpg ADDED
Binary file
images/grey_pro.jpg ADDED
Binary file
images/grey_pro_v1.jpg ADDED
Binary file
images/grey_prov1.jpg ADDED
Binary file
images/grey_prov2.jpg ADDED
Binary file
images/image_five.jpg ADDED
Binary file
images/image_four.jpg ADDED
Binary file
images/image_one.jpg ADDED
Binary file
images/image_seven.jpg ADDED
Binary file
images/image_six.jpg ADDED
Binary file
images/image_three.jpg ADDED
Binary file
images/image_two.jpg ADDED
Binary file
images/images2/image_five.jpg ADDED
Binary file
images/images2/image_four.jpg ADDED
Binary file
images/images2/image_one.jpg ADDED
Binary file
images/images2/image_seven.jpg ADDED
Binary file
images/images2/image_six.jpg ADDED
Binary file
images/images2/image_three.jpg ADDED
Binary file
images/images2/image_two.jpg ADDED
Binary file
images/less-details-button.png ADDED
Binary file
images/loading100x100.gif CHANGED
Binary file
images/loading100x1001.gif ADDED
Binary file
images/loading36x36.gif CHANGED
Binary file
images/more-details-button.png ADDED
Binary file
images/orange_pro.jpg ADDED
Binary file
images/polar-bear.jpg ADDED
Binary file
images/red_pro.jpg ADDED
Binary file
images/white_pro.jpg ADDED
Binary file
images/yop-poll-admin-question-section-icon32.png ADDED
Binary file
images/yop-poll-arrow.png ADDED
Binary file
images/yop-poll-close.png ADDED
Binary file
images/yop-poll-movable-icon.png ADDED
Binary file
inc/WavFile.php CHANGED
@@ -1,1861 +1,1936 @@
1
  <?php
 
2
 
3
- // error_reporting(E_ALL); ini_set('display_errors', 1); // uncomment this line for debugging
4
-
5
- /**
6
- * Project: PHPWavUtils: Classes for creating, reading, and manipulating WAV files in PHP<br />
7
- * File: Yop_Poll_WavFile.php<br />
8
- *
9
- * Copyright (c) 2012, Drew Phillips
10
- * All rights reserved.
11
- *
12
- * Redistribution and use in source and binary forms, with or without modification,
13
- * are permitted provided that the following conditions are met:
14
- *
15
- * - Redistributions of source code must retain the above copyright notice,
16
- * this list of conditions and the following disclaimer.
17
- * - Redistributions in binary form must reproduce the above copyright notice,
18
- * this list of conditions and the following disclaimer in the documentation
19
- * and/or other materials provided with the distribution.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
- * POSSIBILITY OF SUCH DAMAGE.
32
- *
33
- * Any modifications to the library should be indicated clearly in the source code
34
- * to inform users that the changes are not a part of the original software.<br /><br />
35
- *
36
- * @copyright 2012 Drew Phillips
37
- * @author Drew Phillips <drew@drew-phillips.com>
38
- * @author Paul Voegler <http://www.voegler.eu/>
39
- * @version 1.0RC1 (April 2012)
40
- * @package PHPWavUtils
41
- * @license BSD License
42
- *
43
- * Changelog:
44
- *
45
- * 1.0 RC1 (4/20/2012)
46
- * - Initial release candidate
47
- * - Supports 8, 16, 24, 32 bit PCM, 32-bit IEEE FLOAT, Extensible Format
48
- * - Support for 18 channels of audio
49
- * - Ability to read an offset from a file to reduce memory footprint with large files
50
- * - Single-pass audio filter processing
51
- * - Highly accurate and efficient mix and normalization filters (http://www.voegler.eu/pub/audio/)
52
- * - Utility filters for degrading audio, and inserting silence
53
- *
54
- * 0.6 (4/12/2012)
55
- * - Support 8, 16, 24, 32 bit and PCM float (Paul Voegler)
56
- * - Add normalize filter, misc improvements and fixes (Paul Voegler)
57
- * - Normalize parameters to filter() to use filter constants as array indices
58
- * - Add option to mix filter to loop the target file if the source is longer
59
- *
60
- * 0.5 (4/3/2012)
61
- * - Fix binary pack routine (Paul Voegler)
62
- * - Add improved mixing function (Paul Voegler)
63
- *
64
- */
65
-
66
- class Yop_Poll_WavFile
67
- {
68
- /*%******************************************************************************************%*/
69
- // Class constants
70
 
71
- /** @var int Filter flag for mixing two files */
72
- const FILTER_MIX = 0x01;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- /** @var int Filter flag for normalizing audio data */
75
- const FILTER_NORMALIZE = 0x02;
 
 
 
76
 
77
- /** @var int Filter flag for degrading audio data */
78
- const FILTER_DEGRADE = 0x04;
79
 
80
- /** @var int Maximum number of channels */
81
- const MAX_CHANNEL = 18;
82
 
83
- /** @var int Maximum sample rate */
84
- const MAX_SAMPLERATE = 192000;
85
 
86
- /** Channel Locations for ChannelMask */
87
- const SPEAKER_DEFAULT = 0x000000;
88
- const SPEAKER_FRONT_LEFT = 0x000001;
89
- const SPEAKER_FRONT_RIGHT = 0x000002;
90
- const SPEAKER_FRONT_CENTER = 0x000004;
91
- const SPEAKER_LOW_FREQUENCY = 0x000008;
92
- const SPEAKER_BACK_LEFT = 0x000010;
93
- const SPEAKER_BACK_RIGHT = 0x000020;
94
- const SPEAKER_FRONT_LEFT_OF_CENTER = 0x000040;
95
- const SPEAKER_FRONT_RIGHT_OF_CENTER = 0x000080;
96
- const SPEAKER_BACK_CENTER = 0x000100;
97
- const SPEAKER_SIDE_LEFT = 0x000200;
98
- const SPEAKER_SIDE_RIGHT = 0x000400;
99
- const SPEAKER_TOP_CENTER = 0x000800;
100
- const SPEAKER_TOP_FRONT_LEFT = 0x001000;
101
- const SPEAKER_TOP_FRONT_CENTER = 0x002000;
102
- const SPEAKER_TOP_FRONT_RIGHT = 0x004000;
103
- const SPEAKER_TOP_BACK_LEFT = 0x008000;
104
- const SPEAKER_TOP_BACK_CENTER = 0x010000;
105
- const SPEAKER_TOP_BACK_RIGHT = 0x020000;
106
- const SPEAKER_ALL = 0x03FFFF;
107
 
108
- /** @var int PCM Audio Format */
109
- const WAVE_FORMAT_PCM = 0x0001;
110
 
111
- /** @var int IEEE FLOAT Audio Format */
112
- const WAVE_FORMAT_IEEE_FLOAT = 0x0003;
113
 
114
- /** @var int EXTENSIBLE Audio Format - actual audio format defined by SubFormat */
115
- const WAVE_FORMAT_EXTENSIBLE = 0xFFFE;
116
 
117
- /** @var string PCM Audio Format SubType - LE hex representation of GUID {00000001-0000-0010-8000-00AA00389B71} */
118
- const WAVE_SUBFORMAT_PCM = "0100000000001000800000aa00389b71";
119
 
120
- /** @var string IEEE FLOAT Audio Format SubType - LE hex representation of GUID {00000003-0000-0010-8000-00AA00389B71} */
121
- const WAVE_SUBFORMAT_IEEE_FLOAT = "0300000000001000800000aa00389b71";
122
 
 
 
123
 
124
- /*%******************************************************************************************%*/
125
- // Properties
126
 
127
- /** @var array Log base modifier lookup table for a given threshold (in 0.05 steps) used by normalizeSample.
128
- * Adjusts the slope (1st derivative) of the log function at the threshold to 1 for a smooth transition
129
- * from linear to logarithmic amplitude output. */
130
- protected static $LOOKUP_LOGBASE = array(
131
- 2.513, 2.667, 2.841, 3.038, 3.262,
132
- 3.520, 3.819, 4.171, 4.589, 5.093,
133
- 5.711, 6.487, 7.483, 8.806, 10.634,
134
- 13.302, 17.510, 24.970, 41.155, 96.088
135
- );
136
 
137
- /** @var int The actual physical file size */
138
- protected $_actualSize;
139
 
140
- /** @var int The size of the file in RIFF header */
141
- protected $_chunkSize;
142
 
143
- /** @var int The size of the "fmt " chunk */
144
- protected $_fmtChunkSize;
145
 
146
- /** @var int The size of the extended "fmt " data */
147
- protected $_fmtExtendedSize;
148
 
149
- /** @var int The size of the "fact" chunk */
150
- protected $_factChunkSize;
151
 
152
- /** @var int Size of the data chunk */
153
- protected $_dataSize;
154
 
155
- /** @var int Size of the data chunk in the opened wav file */
156
- protected $_dataSize_fp;
157
 
158
- /** @var int Does _dataSize really reflect strlen($_samples)? Case when a wav file is read with readData = false */
159
- protected $_dataSize_valid;
160
 
161
- /** @var int Starting offset of data chunk */
162
- protected $_dataOffset;
163
 
164
- /** @var int The audio format - Yop_Poll_WavFile::WAVE_FORMAT_* */
165
- protected $_audioFormat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
- /** @var int The audio subformat - Yop_Poll_WavFile::WAVE_SUBFORMAT_* */
168
- protected $_audioSubFormat;
 
 
 
 
 
169
 
170
- /** @var int Number of channels in the audio file */
171
- protected $_numChannels;
 
 
 
172
 
173
- /** @var int The channel mask */
174
- protected $_channelMask;
 
175
 
176
- /** @var int Samples per second */
177
- protected $_sampleRate;
 
 
 
 
 
 
 
178
 
179
- /** @var int Number of bits per sample */
180
- protected $_bitsPerSample;
181
 
182
- /** @var int Number of valid bits per sample */
183
- protected $_validBitsPerSample;
184
 
185
- /** @var int NumChannels * BitsPerSample/8 */
186
- protected $_blockAlign;
 
 
 
 
 
 
 
 
 
 
187
 
188
- /** @var int Number of sample blocks */
189
- protected $_numBlocks;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
- /** @var int Bytes per second */
192
- protected $_byteRate;
 
 
193
 
194
- /** @var string Binary string of samples */
195
- protected $_samples;
 
 
196
 
197
- /** @var resource The file pointer used for reading wavs from file or memory */
198
- protected $_fp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
 
 
 
 
 
 
200
 
201
- /*%******************************************************************************************%*/
202
- // Special methods
 
203
 
204
- /**
205
- * Yop_Poll_WavFile Constructor.
206
- *
207
- * <code>
208
- * $wav1 = new Yop_Poll_WavFile(2, 44100, 16); // new wav with 2 channels, at 44100 samples/sec and 16 bits per sample
209
- * $wav2 = new Yop_Poll_WavFile('./audio/sound.wav'); // open and read wav file
210
- * </code>
211
- *
212
- * @param string|int $numChannelsOrFileName (Optional) If string, the filename of the wav file to open. The number of channels otherwise. Defaults to 1.
213
- * @param int|bool $sampleRateOrReadData (Optional) If opening a file and boolean, decides whether to read the data chunk or not. Defaults to true. The sample rate in samples per second otherwise. 8000 = standard telephone, 16000 = wideband telephone, 32000 = FM radio and 44100 = CD quality. Defaults to 8000.
214
- * @param int $bitsPerSample (Optional) The number of bits per sample. Has to be 8, 16 or 24 for PCM audio or 32 for IEEE FLOAT audio. 8 = telephone, 16 = CD and 24 or 32 = studio quality. Defaults to 8.
215
- * @throws Yop_Poll_WavFormatException
216
- * @throws Yop_Poll_WavFileException
217
- */
218
- public function __construct($numChannelsOrFileName = null, $sampleRateOrReadData = null, $bitsPerSample = null)
219
- {
220
- $this->_actualSize = 44;
221
- $this->_chunkSize = 36;
222
- $this->_fmtChunkSize = 16;
223
- $this->_fmtExtendedSize = 0;
224
- $this->_factChunkSize = 0;
225
- $this->_dataSize = 0;
226
- $this->_dataSize_fp = 0;
227
- $this->_dataSize_valid = true;
228
- $this->_dataOffset = 44;
229
- $this->_audioFormat = self::WAVE_FORMAT_PCM;
230
- $this->_audioSubFormat = null;
231
- $this->_numChannels = 1;
232
- $this->_channelMask = self::SPEAKER_DEFAULT;
233
- $this->_sampleRate = 8000;
234
- $this->_bitsPerSample = 8;
235
- $this->_validBitsPerSample = 8;
236
- $this->_blockAlign = 1;
237
- $this->_numBlocks = 0;
238
- $this->_byteRate = 8000;
239
- $this->_samples = '';
240
- $this->_fp = null;
241
-
242
-
243
- if (is_string($numChannelsOrFileName)) {
244
- $this->openWav($numChannelsOrFileName, is_bool($sampleRateOrReadData) ? $sampleRateOrReadData : true);
245
-
246
- } else {
247
- $this->setNumChannels(is_null($numChannelsOrFileName) ? 1 : $numChannelsOrFileName)
248
- ->setSampleRate(is_null($sampleRateOrReadData) ? 8000 : $sampleRateOrReadData)
249
- ->setBitsPerSample(is_null($bitsPerSample) ? 8 : $bitsPerSample);
250
  }
251
- }
252
 
253
- public function __destruct() {
254
- if (is_resource($this->_fp)) $this->closeWav();
255
- }
 
 
 
 
 
 
 
 
 
 
 
256
 
257
- public function __clone() {
258
- $this->_fp = null;
259
- }
 
 
260
 
261
- /**
262
- * Output the wav file headers and data.
263
- *
264
- * @return string The encoded file.
265
- */
266
- public function __toString()
267
- {
268
- return $this->makeHeader() .
269
- $this->getDataSubchunk();
270
- }
 
 
 
 
 
 
271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
- /*%******************************************************************************************%*/
274
- // Static methods
 
 
275
 
276
- /**
277
- * Unpacks a single binary sample to numeric value.
278
- *
279
- * @param string $sampleBinary (Required) The sample to decode.
280
- * @param int $bitDepth (Optional) The bits per sample to decode. If omitted, derives it from the length of $sampleBinary.
281
- * @return int|float The numeric sample value. Float for 32-bit samples. Returns null for unsupported bit depths.
282
- */
283
- public static function unpackSample($sampleBinary, $bitDepth = null)
284
- {
285
- if ($bitDepth === null) {
286
- $bitDepth = strlen($sampleBinary) * 8;
287
- }
288
-
289
- switch ($bitDepth) {
290
- case 8:
291
- // unsigned char
292
- return ord($sampleBinary);
293
-
294
- case 16:
295
- // signed short, little endian
296
- $data = unpack('v', $sampleBinary);
297
- $sample = $data[1];
298
- if ($sample >= 0x8000) {
299
- $sample -= 0x10000;
300
- }
301
- return $sample;
302
-
303
- case 24:
304
- // 3 byte packed signed integer, little endian
305
- $data = unpack('C3', $sampleBinary);
306
- $sample = $data[1] | ($data[2] << 8) | ($data[3] << 16);
307
- if ($sample >= 0x800000) {
308
- $sample -= 0x1000000;
309
- }
310
- return $sample;
311
 
312
- case 32:
313
- // 32-bit float
314
- $data = unpack('f', $sampleBinary);
315
- return $data[1];
 
316
 
317
- default:
318
- return null;
319
- }
320
- }
 
321
 
322
- /**
323
- * Packs a single numeric sample to binary.
324
- *
325
- * @param int|float $sample (Required) The sample to encode. Has to be within valid range for $bitDepth. Float values only for 32 bits.
326
- * @param int $bitDepth (Required) The bits per sample to encode with.
327
- * @return string The encoded binary sample. Returns null for unsupported bit depths.
328
- */
329
- public static function packSample($sample, $bitDepth)
330
- {
331
- switch ($bitDepth) {
332
- case 8:
333
- // unsigned char
334
- return chr($sample);
335
-
336
- case 16:
337
- // signed short, little endian
338
- if ($sample < 0) {
339
- $sample += 0x10000;
340
- }
341
- return pack('v', $sample);
342
 
343
- case 24:
344
- // 3 byte packed signed integer, little endian
345
- if ($sample < 0) {
346
- $sample += 0x1000000;
347
- }
348
- return pack('C3', $sample & 0xff, ($sample >> 8) & 0xff, ($sample >> 16) & 0xff);
349
 
350
- case 32:
351
- // 32-bit float
352
- return pack('f', $sample);
353
 
354
- default:
355
- return null;
356
  }
357
- }
358
 
359
- /**
360
- * Unpacks a binary sample block to numeric values.
361
- *
362
- * @param string $sampleBlock (Required) The binary sample block (all channels).
363
- * @param int $bitDepth (Required) The bits per sample to decode.
364
- * @param int $numChannels (Optional) The number of channels to decode. If omitted, derives it from the length of $sampleBlock and $bitDepth.
365
- * @return array The sample values as an array of integers of floats for 32 bits. First channel is array index 1.
366
- */
367
- public static function unpackSampleBlock($sampleBlock, $bitDepth, $numChannels = null) {
368
- $sampleBytes = $bitDepth / 8;
369
- if ($numChannels === null) {
370
- $numChannels = strlen($sampleBlock) / $sampleBytes;
371
- }
372
 
373
- $samples = array();
374
- for ($i = 0; $i < $numChannels; $i++) {
375
- $sampleBinary = substr($sampleBlock, $i * $sampleBytes, $sampleBytes);
376
- $samples[$i + 1] = self::unpackSample($sampleBinary, $bitDepth);
377
  }
378
 
379
- return $samples;
380
- }
381
-
382
- /**
383
- * Packs an array of numeric channel samples to a binary sample block.
384
- *
385
- * @param array $samples (Required) The array of channel sample values. Expects float values for 32 bits and integer otherwise.
386
- * @param int $bitDepth (Required) The bits per sample to encode with.
387
- * @return string The encoded binary sample block.
388
- */
389
- public static function packSampleBlock($samples, $bitDepth) {
390
- $sampleBlock = '';
391
- foreach($samples as $sample) {
392
- $sampleBlock .= self::packSample($sample, $bitDepth);
393
  }
394
 
395
- return $sampleBlock;
396
- }
397
-
398
- /**
399
- * Normalizes a float audio sample. Maximum input range assumed for compression is [-2, 2].
400
- * See http://www.voegler.eu/pub/audio/ for more information.
401
- *
402
- * @param float $sampleFloat (Required) The float sample to normalize.
403
- * @param float $threshold (Required) The threshold or gain factor for normalizing the amplitude. <ul>
404
- * <li> >= 1 - Normalize by multiplying by the threshold (boost - positive gain). <br />
405
- * A value of 1 in effect means no normalization (and results in clipping). </li>
406
- * <li> <= -1 - Normalize by dividing by the the absolute value of threshold (attenuate - negative gain). <br />
407
- * A factor of 2 (-2) is about 6dB reduction in volume.</li>
408
- * <li> [0, 1) - (open inverval - not including 1) - The threshold
409
- * above which amplitudes are comressed logarithmically. <br />
410
- * e.g. 0.6 to leave amplitudes up to 60% "as is" and compress above. </li>
411
- * <li> (-1, 0) - (open inverval - not including -1 and 0) - The threshold
412
- * above which amplitudes are comressed linearly. <br />
413
- * e.g. -0.6 to leave amplitudes up to 60% "as is" and compress above. </li></ul>
414
- * @return float The normalized sample.
415
- **/
416
- public static function normalizeSample($sampleFloat, $threshold) {
417
- // apply positive gain
418
- if ($threshold >= 1) {
419
- return $sampleFloat * $threshold;
420
- }
421
-
422
- // apply negative gain
423
- if ($threshold <= -1) {
424
- return $sampleFloat / -$threshold;
425
- }
426
-
427
- $sign = $sampleFloat < 0 ? -1 : 1;
428
- $sampleAbs = abs($sampleFloat);
429
-
430
- // logarithmic compression
431
- if ($threshold >= 0 && $threshold < 1 && $sampleAbs > $threshold) {
432
- $loga = self::$LOOKUP_LOGBASE[(int)($threshold * 20)]; // log base modifier
433
- return $sign * ($threshold + (1 - $threshold) * log(1 + $loga * ($sampleAbs - $threshold) / (2 - $threshold)) / log(1 + $loga));
434
- }
435
-
436
- // linear compression
437
- $thresholdAbs = abs($threshold);
438
- if ($threshold > -1 && $threshold < 0 && $sampleAbs > $thresholdAbs) {
439
- return $sign * ($thresholdAbs + (1 - $thresholdAbs) / (2 - $thresholdAbs) * ($sampleAbs - $thresholdAbs));
440
- }
441
-
442
- // else ?
443
- return $sampleFloat;
444
- }
445
-
446
-
447
- /*%******************************************************************************************%*/
448
- // Getter and Setter methods for properties
449
 
450
- public function getActualSize() {
451
- return $this->_actualSize;
452
- }
453
 
454
- protected function setActualSize($actualSize = null) {
455
- if (is_null($actualSize)) {
456
- $this->_actualSize = 8 + $this->_chunkSize; // + "RIFF" header (ID + size)
457
- } else {
458
- $this->_actualSize = $actualSize;
459
  }
460
 
461
- return $this;
462
- }
463
-
464
- public function getChunkSize() {
465
- return $this->_chunkSize;
466
- }
467
-
468
- protected function setChunkSize($chunkSize = null) {
469
- if (is_null($chunkSize)) {
470
- $this->_chunkSize = 4 + // "WAVE" chunk
471
- 8 + $this->_fmtChunkSize + // "fmt " subchunk
472
- ($this->_factChunkSize > 0 ? 8 + $this->_factChunkSize : 0) + // "fact" subchunk
473
- 8 + $this->_dataSize + // "data" subchunk
474
- ($this->_dataSize & 1); // padding byte
475
- } else {
476
- $this->_chunkSize = $chunkSize;
477
  }
478
 
479
- $this->setActualSize();
480
-
481
- return $this;
482
- }
 
 
 
483
 
484
- public function getFmtChunkSize() {
485
- return $this->_fmtChunkSize;
486
- }
487
 
488
- protected function setFmtChunkSize($fmtChunkSize = null) {
489
- if (is_null($fmtChunkSize)) {
490
- $this->_fmtChunkSize = 16 + $this->_fmtExtendedSize;
491
- } else {
492
- $this->_fmtChunkSize = $fmtChunkSize;
493
  }
494
 
495
- $this->setChunkSize() // implicit setActualSize()
496
- ->setDataOffset();
 
497
 
498
- return $this;
499
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
- public function getFmtExtendedSize() {
502
- return $this->_fmtExtendedSize;
503
- }
504
 
505
- protected function setFmtExtendedSize($fmtExtendedSize = null) {
506
- if (is_null($fmtExtendedSize)) {
507
- if ($this->_audioFormat == self::WAVE_FORMAT_EXTENSIBLE) {
508
- $this->_fmtExtendedSize = 2 + 22; // extension size for WAVE_FORMAT_EXTENSIBLE
509
- } elseif ($this->_audioFormat != self::WAVE_FORMAT_PCM) {
510
- $this->_fmtExtendedSize = 2 + 0; // empty extension
511
- } else {
512
- $this->_fmtExtendedSize = 0; // no extension, only for WAVE_FORMAT_PCM
513
- }
514
- } else {
515
- $this->_fmtExtendedSize = $fmtExtendedSize;
516
  }
517
 
518
- $this->setFmtChunkSize(); // implicit setSize(), setActualSize(), setDataOffset()
 
 
519
 
520
- return $this;
521
- }
 
 
 
 
 
 
 
 
 
 
522
 
523
- public function getFactChunkSize() {
524
- return $this->_factChunkSize;
525
- }
526
 
527
- protected function setFactChunkSize($factChunkSize = null) {
528
- if (is_null($factChunkSize)) {
529
- if ($this->_audioFormat != self::WAVE_FORMAT_PCM) {
530
- $this->_factChunkSize = 4;
531
- } else {
532
- $this->_factChunkSize = 0;
533
- }
534
- } else {
535
- $this->_factChunkSize = $factChunkSize;
536
  }
537
 
538
- $this->setChunkSize() // implicit setActualSize()
539
- ->setDataOffset();
 
540
 
541
- return $this;
542
- }
 
 
 
 
 
543
 
544
- public function getDataSize() {
545
- return $this->_dataSize;
546
- }
547
 
548
- protected function setDataSize($dataSize = null) {
549
- if (is_null($dataSize)) {
550
- $this->_dataSize = strlen($this->_samples);
551
- } else {
552
- $this->_dataSize = $dataSize;
553
  }
554
 
555
- $this->setChunkSize() // implicit setActualSize()
556
- ->setNumBlocks();
557
- $this->_dataSize_valid = true;
558
-
559
- return $this;
560
- }
561
 
562
- public function getDataOffset() {
563
- return $this->_dataOffset;
564
- }
 
 
 
 
 
 
 
 
565
 
566
- protected function setDataOffset($dataOffset = null) {
567
- if (is_null($dataOffset)) {
568
- $this->_dataOffset = 8 + // "RIFF" header (ID + size)
569
- 4 + // "WAVE" chunk
570
- 8 + $this->_fmtChunkSize + // "fmt " subchunk
571
- ($this->_factChunkSize > 0 ? 8 + $this->_factChunkSize : 0) + // "fact" subchunk
572
- 8; // "data" subchunk
573
- } else {
574
- $this->_dataOffset = $dataOffset;
575
  }
576
 
577
- return $this;
578
- }
579
-
580
- public function getAudioFormat() {
581
- return $this->_audioFormat;
582
- }
583
 
584
- protected function setAudioFormat($audioFormat = null) {
585
- if (is_null($audioFormat)) {
586
- if (($this->_bitsPerSample <= 16 || $this->_bitsPerSample == 32)
587
- && $this->_validBitsPerSample == $this->_bitsPerSample
588
- && $this->_channelMask == self::SPEAKER_DEFAULT
589
- && $this->_numChannels <= 2) {
590
- if ($this->_bitsPerSample <= 16) {
591
- $this->_audioFormat = self::WAVE_FORMAT_PCM;
592
- } else {
593
- $this->_audioFormat = self::WAVE_FORMAT_IEEE_FLOAT;
 
 
 
 
 
 
594
  }
595
- } else {
596
- $this->_audioFormat = self::WAVE_FORMAT_EXTENSIBLE;
597
  }
598
- } else {
599
- $this->_audioFormat = $audioFormat;
600
- }
601
-
602
- $this->setAudioSubFormat()
603
- ->setFactChunkSize() // implicit setSize(), setActualSize(), setDataOffset()
604
- ->setFmtExtendedSize(); // implicit setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
605
-
606
- return $this;
607
- }
608
-
609
- public function getAudioSubFormat() {
610
- return $this->_audioSubFormat;
611
- }
612
-
613
- protected function setAudioSubFormat($audioSubFormat = null) {
614
- if (is_null($audioSubFormat)) {
615
- if ($this->_bitsPerSample == 32) {
616
- $this->_audioSubFormat = self::WAVE_SUBFORMAT_IEEE_FLOAT; // 32 bits are IEEE FLOAT in this class
617
- } else {
618
- $this->_audioSubFormat = self::WAVE_SUBFORMAT_PCM; // 8, 16 and 24 bits are PCM in this class
619
  }
620
- } else {
621
- $this->_audioSubFormat = $audioSubFormat;
622
- }
623
 
624
- return $this;
625
- }
 
626
 
627
- public function getNumChannels() {
628
- return $this->_numChannels;
629
- }
630
-
631
- public function setNumChannels($numChannels) {
632
- if ($numChannels < 1 || $numChannels > self::MAX_CHANNEL) {
633
- throw new Yop_Poll_WavFileException('Unsupported number of channels. Only up to ' . self::MAX_CHANNEL . ' channels are supported.');
634
- } elseif ($this->_samples !== '') {
635
- trigger_error('Wav already has sample data. Changing the number of channels does not convert and may corrupt the data.', E_USER_NOTICE);
636
  }
637
 
638
- $this->_numChannels = (int)$numChannels;
639
-
640
- $this->setAudioFormat() // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
641
- ->setByteRate()
642
- ->setBlockAlign(); // implicit setNumBlocks()
643
-
644
- return $this;
645
- }
646
-
647
- public function getChannelMask() {
648
- return $this->_channelMask;
649
- }
650
 
651
- public function setChannelMask($channelMask = self::SPEAKER_DEFAULT) {
652
- if ($channelMask != 0) {
653
- // count number of set bits - Hamming weight
654
- $c = (int)$channelMask;
655
- $n = 0;
656
- while ($c > 0) {
657
- $n += $c & 1;
658
- $c >>= 1;
659
  }
660
- if ($n != $this->_numChannels || (((int)$channelMask | self::SPEAKER_ALL) != self::SPEAKER_ALL)) {
661
- throw new Yop_Poll_WavFileException('Invalid channel mask. The number of channels does not match the number of locations in the mask.');
662
  }
 
 
663
  }
664
 
665
- $this->_channelMask = (int)$channelMask;
 
 
666
 
667
- $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
 
 
 
 
 
 
668
 
669
- return $this;
670
- }
671
 
672
- public function getSampleRate() {
673
- return $this->_sampleRate;
674
- }
675
 
676
- public function setSampleRate($sampleRate) {
677
- if ($sampleRate < 1 || $sampleRate > self::MAX_SAMPLERATE) {
678
- throw new Yop_Poll_WavFileException('Invalid sample rate.');
679
- } elseif ($this->_samples !== '') {
680
- trigger_error('Wav already has sample data. Changing the sample rate does not convert the data and may yield undesired results.', E_USER_NOTICE);
681
  }
682
 
683
- $this->_sampleRate = (int)$sampleRate;
 
 
684
 
685
- $this->setByteRate();
 
 
 
 
 
 
 
 
 
 
 
 
686
 
687
- return $this;
688
- }
689
 
690
- public function getBitsPerSample() {
691
- return $this->_bitsPerSample;
692
- }
693
 
694
- public function setBitsPerSample($bitsPerSample) {
695
- if (!in_array($bitsPerSample, array(8, 16, 24, 32))) {
696
- throw new Yop_Poll_WavFileException('Unsupported bits per sample. Only 8, 16, 24 and 32 bits are supported.');
697
- } elseif ($this->_samples !== '') {
698
- trigger_error('Wav already has sample data. Changing the bits per sample does not convert and may corrupt the data.', E_USER_NOTICE);
699
  }
700
 
701
- $this->_bitsPerSample = (int)$bitsPerSample;
702
-
703
- $this->setValidBitsPerSample() // implicit setAudioFormat(), setAudioSubFormat(), setFmtChunkSize(), setFactChunkSize(), setSize(), setActualSize(), setDataOffset()
704
- ->setByteRate()
705
- ->setBlockAlign(); // implicit setNumBlocks()
706
-
707
- return $this;
708
- }
709
-
710
- public function getValidBitsPerSample() {
711
- return $this->_validBitsPerSample;
712
- }
713
 
714
- protected function setValidBitsPerSample($validBitsPerSample = null) {
715
- if (is_null($validBitsPerSample)) {
716
- $this->_validBitsPerSample = $this->_bitsPerSample;
717
- } else {
718
- if ($validBitsPerSample < 1 || $validBitsPerSample > $this->_bitsPerSample) {
719
- throw new Yop_Poll_WavFileException('ValidBitsPerSample cannot be greater than BitsPerSample.');
720
  }
721
- $this->_validBitsPerSample = (int)$validBitsPerSample;
722
- }
723
 
724
- $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
725
 
726
- return $this;
727
- }
728
 
729
- public function getBlockAlign() {
730
- return $this->_blockAlign;
731
- }
732
 
733
- protected function setBlockAlign($blockAlign = null) {
734
- if (is_null($blockAlign)) {
735
- $this->_blockAlign = $this->_numChannels * $this->_bitsPerSample / 8;
736
- } else {
737
- $this->_blockAlign = $blockAlign;
738
  }
739
 
740
- $this->setNumBlocks();
 
 
 
 
 
 
741
 
742
- return $this;
743
- }
744
 
745
- public function getNumBlocks()
746
- {
747
- return $this->_numBlocks;
748
- }
749
 
750
- protected function setNumBlocks($numBlocks = null) {
751
- if (is_null($numBlocks)) {
752
- $this->_numBlocks = (int)($this->_dataSize / $this->_blockAlign); // do not count incomplete sample blocks
753
- } else {
754
- $this->_numBlocks = $numBlocks;
755
  }
756
 
757
- return $this;
758
- }
759
-
760
- public function getByteRate() {
761
- return $this->_byteRate;
762
- }
763
-
764
- protected function setByteRate($byteRate = null) {
765
- if (is_null($byteRate)) {
766
- $this->_byteRate = $this->_sampleRate * $this->_numChannels * $this->_bitsPerSample / 8;
767
- } else {
768
- $this->_byteRate = $byteRate;
769
  }
770
 
771
- return $this;
772
- }
 
 
 
 
 
 
 
 
773
 
774
- public function getSamples() {
775
- return $this->_samples;
776
- }
777
 
778
- public function setSamples(&$samples = '') {
779
- if (strlen($samples) % $this->_blockAlign != 0) {
780
- throw new Yop_Poll_WavFileException('Incorrect samples size. Has to be a multiple of BlockAlign.');
781
  }
782
 
783
- $this->_samples = $samples;
784
-
785
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
786
-
787
- return $this;
788
- }
789
-
790
 
791
- /*%******************************************************************************************%*/
792
- // Getters
 
 
 
 
 
793
 
794
- public function getMinAmplitude()
795
- {
796
- if ($this->_bitsPerSample == 8) {
797
- return 0;
798
- } elseif ($this->_bitsPerSample == 32) {
799
- return -1.0;
800
- } else {
801
- return -(1 << ($this->_bitsPerSample - 1));
802
- }
803
- }
804
 
805
- public function getZeroAmplitude()
806
- {
807
- if ($this->_bitsPerSample == 8) {
808
- return 0x80;
809
- } elseif ($this->_bitsPerSample == 32) {
810
- return 0.0;
811
- } else {
812
- return 0;
813
  }
814
- }
815
 
816
- public function getMaxAmplitude()
817
- {
818
- if($this->_bitsPerSample == 8) {
819
- return 0xFF;
820
- } elseif($this->_bitsPerSample == 32) {
821
- return 1.0;
822
- } else {
823
- return (1 << ($this->_bitsPerSample - 1)) - 1;
824
  }
825
- }
826
-
827
 
828
- /*%******************************************************************************************%*/
829
- // Wave file methods
830
-
831
- /**
832
- * Construct a wav header from this object. Includes "fact" chunk in necessary.
833
- * http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html
834
- *
835
- * @return string The RIFF header data.
836
- */
837
- public function makeHeader()
838
- {
839
- // reset and recalculate
840
- $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
841
- $this->setNumBlocks();
842
-
843
- // RIFF header
844
- $header = pack('N', 0x52494646); // ChunkID - "RIFF"
845
- $header .= pack('V', $this->getChunkSize()); // ChunkSize
846
- $header .= pack('N', 0x57415645); // Format - "WAVE"
847
-
848
- // "fmt " subchunk
849
- $header .= pack('N', 0x666d7420); // SubchunkID - "fmt "
850
- $header .= pack('V', $this->getFmtChunkSize()); // SubchunkSize
851
- $header .= pack('v', $this->getAudioFormat()); // AudioFormat
852
- $header .= pack('v', $this->getNumChannels()); // NumChannels
853
- $header .= pack('V', $this->getSampleRate()); // SampleRate
854
- $header .= pack('V', $this->getByteRate()); // ByteRate
855
- $header .= pack('v', $this->getBlockAlign()); // BlockAlign
856
- $header .= pack('v', $this->getBitsPerSample()); // BitsPerSample
857
- if($this->getFmtExtendedSize() == 24) {
858
- $header .= pack('v', 22); // extension size = 24 bytes, cbSize: 24 - 2 = 22 bytes
859
- $header .= pack('v', $this->getValidBitsPerSample()); // ValidBitsPerSample
860
- $header .= pack('V', $this->getChannelMask()); // ChannelMask
861
- $header .= pack('H32', $this->getAudioSubFormat()); // SubFormat
862
- } elseif ($this->getFmtExtendedSize() == 2) {
863
- $header .= pack('v', 0); // extension size = 2 bytes, cbSize: 2 - 2 = 0 bytes
864
- }
865
-
866
- // "fact" subchunk
867
- if ($this->getFactChunkSize() == 4) {
868
- $header .= pack('N', 0x66616374); // SubchunkID - "fact"
869
- $header .= pack('V', 4); // SubchunkSize
870
- $header .= pack('V', $this->getNumBlocks()); // SampleLength (per channel)
871
- }
872
-
873
- return $header;
874
- }
875
 
876
- /**
877
- * Construct wav DATA chunk.
878
- *
879
- * @return string The DATA header and chunk.
880
- */
881
- public function getDataSubchunk()
882
- {
883
- // check preconditions
884
- if (!$this->_dataSize_valid) {
885
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
886
  }
887
 
 
 
 
888
 
889
- // create subchunk
890
- return pack('N', 0x64617461) . // SubchunkID - "data"
891
- pack('V', $this->getDataSize()) . // SubchunkSize
892
- $this->_samples . // Subchunk data
893
- ($this->getDataSize() & 1 ? chr(0) : ''); // padding byte
894
- }
 
895
 
896
- /**
897
- * Save the wav data to a file.
898
- *
899
- * @param string $filename (Required) The file path to save the wav to.
900
- * @throws Yop_Poll_WavFileException
901
- */
902
- public function save($filename)
903
- {
904
- $fp = @fopen($filename, 'w+b');
905
- if (!is_resource($fp)) {
906
- throw new Yop_Poll_WavFileException('Failed to open "' . $filename . '" for writing.');
907
  }
908
 
909
- fwrite($fp, $this->makeHeader());
910
- fwrite($fp, $this->getDataSubchunk());
911
- fclose($fp);
912
 
913
- return $this;
914
- }
 
 
915
 
916
- /**
917
- * Reads a wav header and data from a file.
918
- *
919
- * @param string $filename (Required) The path to the wav file to read.
920
- * @param bool $readData (Optional) If true, also read the data chunk.
921
- * @throws Yop_Poll_WavFormatException
922
- * @throws Yop_Poll_WavFileException
923
- */
924
- public function openWav($filename, $readData = true)
925
- {
926
- // check preconditions
927
- if (!file_exists($filename)) {
928
- throw new Yop_Poll_WavFileException('Failed to open "' . $filename . '". File not found.');
929
- } elseif (!is_readable($filename)) {
930
- throw new Yop_Poll_WavFileException('Failed to open "' . $filename . '". File is not readable.');
931
- } elseif (is_resource($this->_fp)) {
932
- $this->closeWav();
933
- }
934
 
 
935
 
936
- // open the file
937
- $this->_fp = @fopen($filename, 'rb');
938
- if (!is_resource($this->_fp)) {
939
- throw new Yop_Poll_WavFileException('Failed to open "' . $filename . '".');
940
  }
941
 
942
- // read the file
943
- return $this->readWav($readData);
944
- }
945
 
946
- /**
947
- * Close a with openWav() previously opened wav file or free the buffer of setWavData().
948
- * Not necessary if the data has been read (readData = true) already.
949
- */
950
- public function closeWav() {
951
- if (is_resource($this->_fp)) fclose($this->_fp);
952
-
953
- return $this;
954
- }
955
 
956
- /**
957
- * Set the wav file data and properties from a wav file in a string.
958
- *
959
- * @param string $data (Required) The wav file data. Passed by reference.
960
- * @param bool $free (Optional) True to free the passed $data after copying.
961
- * @throws Yop_Poll_WavFormatException
962
- * @throws Yop_Poll_WavFileException
963
- */
964
- public function setWavData(&$data, $free = true)
965
- {
966
- // check preconditions
967
- if (is_resource($this->_fp)) $this->closeWav();
968
 
 
 
 
 
 
 
 
 
 
 
 
969
 
970
- // open temporary stream in memory
971
- $this->_fp = @fopen('php://memory', 'w+b');
972
- if (!is_resource($this->_fp)) {
973
- throw new Yop_Poll_WavFileException('Failed to open memory stream to write wav data. Use openWav() instead.');
 
 
 
 
 
 
974
  }
975
 
976
- // prepare stream
977
- fwrite($this->_fp, $data);
978
- rewind($this->_fp);
979
 
980
- // free the passed data
981
- if ($free) $data = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
982
 
983
- // read the stream like a file
984
- return $this->readWav(true);
985
- }
 
 
 
986
 
987
- /**
988
- * Read wav file from a stream.
989
- *
990
- * @param $readData (Optional) If true, also read the data chunk.
991
- * @throws Yop_Poll_WavFormatException
992
- * @throws Yop_Poll_WavFileException
993
- */
994
- protected function readWav($readData = true)
995
- {
996
- if (!is_resource($this->_fp)) {
997
- throw new Yop_Poll_WavFileException('No wav file open. Use openWav() first.');
998
  }
999
 
1000
- try {
1001
- $this->readWavHeader();
1002
- } catch (Yop_Poll_WavFileException $ex) {
1003
- $this->closeWav();
1004
- throw $ex;
1005
- }
 
 
 
 
1006
 
1007
- if ($readData) return $this->readWavData();
1008
 
1009
- return $this;
1010
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1011
 
1012
- /**
1013
- * Parse a wav header.
1014
- * http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html
1015
- *
1016
- * @throws Yop_Poll_WavFormatException
1017
- * @throws Yop_Poll_WavFileException
1018
- */
1019
- protected function readWavHeader()
1020
- {
1021
- if (!is_resource($this->_fp)) {
1022
- throw new Yop_Poll_WavFileException('No wav file open. Use openWav() first.');
1023
  }
1024
 
1025
- // get actual file size
1026
- $stat = fstat($this->_fp);
1027
- $actualSize = $stat['size'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1028
 
1029
- $this->_actualSize = $actualSize;
1030
 
 
 
 
 
 
1031
 
1032
- // read the common header
1033
- $header = fread($this->_fp, 36); // minimum size of the wav header
1034
- if (strlen($header) < 36) {
1035
- throw new Yop_Poll_WavFormatException('Not wav format. Header too short.', 1);
1036
  }
1037
 
 
 
 
 
 
 
 
 
1038
 
1039
- // check "RIFF" header
1040
- $RIFF = unpack('NChunkID/VChunkSize/NFormat', $header);
1041
-
1042
- if ($RIFF['ChunkID'] != 0x52494646) { // "RIFF"
1043
- throw new Yop_Poll_WavFormatException('Not wav format. "RIFF" signature missing.', 2);
1044
  }
1045
 
1046
- if ($actualSize - 8 < $RIFF['ChunkSize']) {
1047
- trigger_error('"RIFF" chunk size does not match actual file size. Found ' . $RIFF['ChunkSize'] . ', expected ' . ($actualSize - 8) . '.', E_USER_NOTICE);
1048
- $RIFF['ChunkSize'] = $actualSize - 8;
1049
- //throw new Yop_Poll_WavFormatException('"RIFF" chunk size does not match actual file size. Found ' . $RIFF['ChunkSize'] . ', expected ' . ($actualSize - 8) . '.', 3);
1050
- }
 
 
 
 
 
 
 
 
 
1051
 
1052
- if ($RIFF['Format'] != 0x57415645) { // "WAVE"
1053
- throw new Yop_Poll_WavFormatException('Not wav format. "RIFF" chunk format is not "WAVE".', 4);
1054
- }
1055
 
1056
- $this->_chunkSize = $RIFF['ChunkSize'];
 
 
 
 
1057
 
 
 
 
1058
 
1059
- // check common "fmt " subchunk
1060
- $fmt = unpack('NSubchunkID/VSubchunkSize/vAudioFormat/vNumChannels/'
1061
- .'VSampleRate/VByteRate/vBlockAlign/vBitsPerSample',
1062
- substr($header, 12));
1063
 
1064
- if ($fmt['SubchunkID'] != 0x666d7420) { // "fmt "
1065
- throw new Yop_Poll_WavFormatException('Bad wav header. Expected "fmt " subchunk.', 11);
1066
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1067
 
1068
- if ($fmt['SubchunkSize'] < 16) {
1069
- throw new Yop_Poll_WavFormatException('Bad "fmt " subchunk size.', 12);
1070
- }
 
 
 
1071
 
1072
- if ( $fmt['AudioFormat'] != self::WAVE_FORMAT_PCM
1073
- && $fmt['AudioFormat'] != self::WAVE_FORMAT_IEEE_FLOAT
1074
- && $fmt['AudioFormat'] != self::WAVE_FORMAT_EXTENSIBLE)
1075
- {
1076
- throw new Yop_Poll_WavFormatException('Unsupported audio format. Only PCM or IEEE FLOAT (EXTENSIBLE) audio is supported.', 13);
1077
- }
1078
 
1079
- if ($fmt['NumChannels'] < 1 || $fmt['NumChannels'] > self::MAX_CHANNEL) {
1080
- throw new Yop_Poll_WavFormatException('Invalid number of channels in "fmt " subchunk.', 14);
1081
  }
1082
 
1083
- if ($fmt['SampleRate'] < 1 || $fmt['SampleRate'] > self::MAX_SAMPLERATE) {
1084
- throw new Yop_Poll_WavFormatException('Invalid sample rate in "fmt " subchunk.', 15);
1085
- }
 
 
 
 
 
 
 
 
1086
 
1087
- if ( ($fmt['AudioFormat'] == self::WAVE_FORMAT_PCM && !in_array($fmt['BitsPerSample'], array(8, 16, 24)))
1088
- || ($fmt['AudioFormat'] == self::WAVE_FORMAT_IEEE_FLOAT && $fmt['BitsPerSample'] != 32)
1089
- || ($fmt['AudioFormat'] == self::WAVE_FORMAT_EXTENSIBLE && !in_array($fmt['BitsPerSample'], array(8, 16, 24, 32))))
1090
- {
1091
- throw new Yop_Poll_WavFormatException('Only 8, 16 and 24-bit PCM and 32-bit IEEE FLOAT (EXTENSIBLE) audio is supported.', 16);
1092
- }
1093
 
1094
- $blockAlign = $fmt['NumChannels'] * $fmt['BitsPerSample'] / 8;
1095
- if ($blockAlign != $fmt['BlockAlign']) {
1096
- trigger_error('Invalid block align in "fmt " subchunk. Found ' . $fmt['BlockAlign'] . ', expected ' . $blockAlign . '.', E_USER_NOTICE);
1097
- $fmt['BlockAlign'] = $blockAlign;
1098
- //throw new Yop_Poll_WavFormatException('Invalid block align in "fmt " subchunk. Found ' . $fmt['BlockAlign'] . ', expected ' . $blockAlign . '.', 17);
1099
- }
1100
 
1101
- $byteRate = $fmt['SampleRate'] * $blockAlign;
1102
- if ($byteRate != $fmt['ByteRate']) {
1103
- trigger_error('Invalid average byte rate in "fmt " subchunk. Found ' . $fmt['ByteRate'] . ', expected ' . $byteRate . '.', E_USER_NOTICE);
1104
- $fmt['ByteRate'] = $byteRate;
1105
- //throw new Yop_Poll_WavFormatException('Invalid average byte rate in "fmt " subchunk. Found ' . $fmt['ByteRate'] . ', expected ' . $byteRate . '.', 18);
1106
- }
1107
 
1108
- $this->_fmtChunkSize = $fmt['SubchunkSize'];
1109
- $this->_audioFormat = $fmt['AudioFormat'];
1110
- $this->_numChannels = $fmt['NumChannels'];
1111
- $this->_sampleRate = $fmt['SampleRate'];
1112
- $this->_byteRate = $fmt['ByteRate'];
1113
- $this->_blockAlign = $fmt['BlockAlign'];
1114
- $this->_bitsPerSample = $fmt['BitsPerSample'];
1115
 
 
 
1116
 
1117
- // read extended "fmt " subchunk data
1118
- $extendedFmt = '';
1119
- if ($fmt['SubchunkSize'] > 16) {
1120
- // possibly handle malformed subchunk without a padding byte
1121
- $extendedFmt = fread($this->_fp, $fmt['SubchunkSize'] - 16 + ($fmt['SubchunkSize'] & 1)); // also read padding byte
1122
- if (strlen($extendedFmt) < $fmt['SubchunkSize'] - 16) {
1123
- throw new Yop_Poll_WavFormatException('Not wav format. Header too short.', 1);
1124
  }
1125
- }
1126
 
 
 
 
 
 
1127
 
1128
- // check extended "fmt " for EXTENSIBLE Audio Format
1129
- if ($fmt['AudioFormat'] == self::WAVE_FORMAT_EXTENSIBLE) {
1130
- if (strlen($extendedFmt) < 24) {
1131
- throw new Yop_Poll_WavFormatException('Invalid EXTENSIBLE "fmt " subchunk size. Found ' . $fmt['SubchunkSize'] . ', expected at least 40.', 19);
1132
  }
1133
 
1134
- $extensibleFmt = unpack('vSize/vValidBitsPerSample/VChannelMask/H32SubFormat', substr($extendedFmt, 0, 24));
1135
 
1136
- if ( $extensibleFmt['SubFormat'] != self::WAVE_SUBFORMAT_PCM
1137
- && $extensibleFmt['SubFormat'] != self::WAVE_SUBFORMAT_IEEE_FLOAT)
1138
- {
1139
- throw new Yop_Poll_WavFormatException('Unsupported audio format. Only PCM or IEEE FLOAT (EXTENSIBLE) audio is supported.', 13);
1140
- }
1141
 
1142
- if ( ($extensibleFmt['SubFormat'] == self::WAVE_SUBFORMAT_PCM && !in_array($fmt['BitsPerSample'], array(8, 16, 24)))
1143
- || ($extensibleFmt['SubFormat'] == self::WAVE_SUBFORMAT_IEEE_FLOAT && $fmt['BitsPerSample'] != 32))
1144
- {
1145
- throw new Yop_Poll_WavFormatException('Only 8, 16 and 24-bit PCM and 32-bit IEEE FLOAT (EXTENSIBLE) audio is supported.', 16);
1146
- }
1147
 
1148
- if ($extensibleFmt['Size'] != 22) {
1149
- trigger_error('Invaid extension size in EXTENSIBLE "fmt " subchunk.', E_USER_NOTICE);
1150
- $extensibleFmt['Size'] = 22;
1151
- //throw new Yop_Poll_WavFormatException('Invaid extension size in EXTENSIBLE "fmt " subchunk.', 20);
1152
  }
1153
 
1154
- if ($extensibleFmt['ValidBitsPerSample'] != $fmt['BitsPerSample']) {
1155
- trigger_error('Invaid or unsupported valid bits per sample in EXTENSIBLE "fmt " subchunk.', E_USER_NOTICE);
1156
- $extensibleFmt['ValidBitsPerSample'] = $fmt['BitsPerSample'];
1157
- //throw new Yop_Poll_WavFormatException('Invaid or unsupported valid bits per sample in EXTENSIBLE "fmt " subchunk.', 21);
1158
  }
1159
 
1160
- if ($extensibleFmt['ChannelMask'] != 0) {
1161
- // count number of set bits - Hamming weight
1162
- $c = (int)$extensibleFmt['ChannelMask'];
1163
- $n = 0;
1164
- while ($c > 0) {
1165
- $n += $c & 1;
1166
- $c >>= 1;
1167
- }
1168
- if ($n != $fmt['NumChannels'] || (((int)$extensibleFmt['ChannelMask'] | self::SPEAKER_ALL) != self::SPEAKER_ALL)) {
1169
- trigger_error('Invalid channel mask in EXTENSIBLE "fmt " subchunk. The number of channels does not match the number of locations in the mask.', E_USER_NOTICE);
1170
- $extensibleFmt['ChannelMask'] = 0;
1171
- //throw new Yop_Poll_WavFormatException('Invalid channel mask in EXTENSIBLE "fmt " subchunk. The number of channels does not match the number of locations in the mask.', 22);
1172
- }
1173
  }
1174
 
1175
- $this->_fmtExtendedSize = strlen($extendedFmt);
1176
- $this->_validBitsPerSample = $extensibleFmt['ValidBitsPerSample'];
1177
- $this->_channelMask = $extensibleFmt['ChannelMask'];
1178
- $this->_audioSubFormat = $extensibleFmt['SubFormat'];
1179
 
1180
- } else {
1181
- $this->_fmtExtendedSize = strlen($extendedFmt);
1182
- $this->_validBitsPerSample = $fmt['BitsPerSample'];
1183
- $this->_channelMask = 0;
1184
- $this->_audioSubFormat = null;
1185
- }
1186
 
 
 
 
 
 
 
1187
 
1188
- // read additional subchunks until "data" subchunk is found
1189
- $factSubchunk = array();
1190
- $dataSubchunk = array();
 
 
 
1191
 
1192
- while (!feof($this->_fp)) {
1193
- $subchunkHeader = fread($this->_fp, 8);
1194
- if (strlen($subchunkHeader) < 8) {
1195
- throw new Yop_Poll_WavFormatException('Missing "data" subchunk.', 101);
 
1196
  }
1197
 
1198
- $subchunk = unpack('NSubchunkID/VSubchunkSize', $subchunkHeader);
 
 
 
 
 
 
1199
 
1200
- if ($subchunk['SubchunkID'] == 0x66616374) { // "fact"
 
 
 
1201
  // possibly handle malformed subchunk without a padding byte
1202
- $subchunkData = fread($this->_fp, $subchunk['SubchunkSize'] + ($subchunk['SubchunkSize'] & 1)); // also read padding byte
1203
- if (strlen($subchunkData) < 4) {
1204
- throw new Yop_Poll_WavFormatException('Invalid "fact" subchunk.', 102);
1205
  }
 
1206
 
1207
- $factParams = unpack('VSampleLength', substr($subchunkData, 0, 4));
1208
- $factSubchunk = array_merge($subchunk, $factParams);
1209
 
1210
- } elseif ($subchunk['SubchunkID'] == 0x64617461) { // "data"
1211
- $dataSubchunk = $subchunk;
 
 
 
1212
 
1213
- break;
1214
 
1215
- } elseif ($subchunk['SubchunkID'] == 0x7761766C) { // "wavl"
1216
- throw new Yop_Poll_WavFormatException('Wave List Chunk ("wavl" subchunk) is not supported.', 106);
1217
- } else {
1218
- // skip all other (unknown) subchunks
1219
- // possibly handle malformed subchunk without a padding byte
1220
- if ( $subchunk['SubchunkSize'] < 0
1221
- || fseek($this->_fp, $subchunk['SubchunkSize'] + ($subchunk['SubchunkSize'] & 1), SEEK_CUR) !== 0) { // also skip padding byte
1222
- throw new Yop_Poll_WavFormatException('Invalid subchunk (0x' . dechex($subchunk['SubchunkID']) . ') encountered.', 103);
1223
  }
1224
- }
1225
- }
1226
 
1227
- if (empty($dataSubchunk)) {
1228
- throw new Yop_Poll_WavFormatException('Missing "data" subchunk.', 101);
1229
- }
 
 
1230
 
 
 
 
 
 
1231
 
1232
- // check "data" subchunk
1233
- $dataOffset = ftell($this->_fp);
1234
- if ($dataSubchunk['SubchunkSize'] < 0 || $actualSize - $dataOffset < $dataSubchunk['SubchunkSize']) {
1235
- trigger_error('Invalid "data" subchunk size.', E_USER_NOTICE);
1236
- $dataSubchunk['SubchunkSize'] = $actualSize - $dataOffset;
1237
- //throw new Yop_Poll_WavFormatException('Invalid "data" subchunk size.', 104);
1238
- }
1239
 
1240
- $this->_dataOffset = $dataOffset;
1241
- $this->_dataSize = $dataSubchunk['SubchunkSize'];
1242
- $this->_dataSize_fp = $dataSubchunk['SubchunkSize'];
1243
- $this->_dataSize_valid = false;
1244
- $this->_samples = '';
 
 
 
 
 
 
 
 
 
1245
 
 
 
 
 
1246
 
1247
- // check "fact" subchunk
1248
- $numBlocks = (int)($dataSubchunk['SubchunkSize'] / $fmt['BlockAlign']);
 
 
 
 
 
1249
 
1250
- if (empty($factSubchunk)) { // construct fake "fact" subchunk
1251
- $factSubchunk = array('SubchunkSize' => 0, 'SampleLength' => $numBlocks);
1252
- }
1253
 
1254
- if ($factSubchunk['SampleLength'] != $numBlocks) {
1255
- trigger_error('Invalid sample length in "fact" subchunk.', E_USER_NOTICE);
1256
- $factSubchunk['SampleLength'] = $numBlocks;
1257
- //throw new Yop_Poll_WavFormatException('Invalid sample length in "fact" subchunk.', 105);
1258
- }
1259
 
1260
- $this->_factChunkSize = $factSubchunk['SubchunkSize'];
1261
- $this->_numBlocks = $factSubchunk['SampleLength'];
 
 
 
1262
 
 
1263
 
1264
- return $this;
 
 
 
 
 
1265
 
1266
- }
 
1267
 
1268
- /**
1269
- * Read the wav data from the file into the buffer.
1270
- *
1271
- * @param $dataOffset (Optional) The byte offset to skip before starting to read. Must be a multiple of BlockAlign.
1272
- * @param $dataSize (Optional) The size of the data to read in bytes. Must be a multiple of BlockAlign. Defaults to all data.
1273
- * @throws Yop_Poll_WavFileException
1274
- */
1275
- public function readWavData($dataOffset = 0, $dataSize = null)
1276
- {
1277
- // check preconditions
1278
- if (!is_resource($this->_fp)) {
1279
- throw new Yop_Poll_WavFileException('No wav file open. Use openWav() first.');
1280
- }
1281
 
1282
- if ($dataOffset < 0 || $dataOffset % $this->getBlockAlign() > 0) {
1283
- throw new Yop_Poll_WavFileException('Invalid data offset. Has to be a multiple of BlockAlign.');
1284
- }
1285
 
1286
- if (is_null($dataSize)) {
1287
- $dataSize = $this->_dataSize_fp - ($this->_dataSize_fp % $this->getBlockAlign()); // only read complete blocks
1288
- } elseif ($dataSize < 0 || $dataSize % $this->getBlockAlign() > 0) {
1289
- throw new Yop_Poll_WavFileException('Invalid data size to read. Has to be a multiple of BlockAlign.');
1290
- }
 
 
 
 
 
 
 
 
 
1291
 
 
 
 
1292
 
1293
- // skip offset
1294
- if ($dataOffset > 0 && fseek($this->_fp, $dataOffset, SEEK_CUR) !== 0) {
1295
- throw new Yop_Poll_WavFileException('Seeking to data offset failed.');
1296
- }
1297
 
1298
- // read data
1299
- $this->_samples .= fread($this->_fp, $dataSize); // allow appending
1300
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
 
 
 
 
1301
 
1302
- // close file or memory stream
1303
- return $this->closeWav();
1304
- }
 
 
1305
 
1306
 
1307
- /*%******************************************************************************************%*/
1308
- // Sample manipulation methods
1309
 
1310
- /**
1311
- * Return a single sample block from the file.
1312
- *
1313
- * @param int $blockNum (Required) The sample block number. Zero based.
1314
- * @return string The binary sample block (all channels). Returns null if the sample block number was out of range.
1315
- */
1316
- public function getSampleBlock($blockNum)
1317
- {
1318
- // check preconditions
1319
- if (!$this->_dataSize_valid) {
1320
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1321
- }
1322
 
1323
- $offset = $blockNum * $this->_blockAlign;
1324
- if ($offset + $this->_blockAlign > $this->_dataSize || $offset < 0) {
1325
- return null;
1326
- }
 
1327
 
 
 
1328
 
1329
- // read data
1330
- return substr($this->_samples, $offset, $this->_blockAlign);
1331
- }
1332
 
1333
- /**
1334
- * Set a single sample block. <br />
1335
- * Allows to append a sample block.
1336
- *
1337
- * @param string $sampleBlock (Required) The binary sample block (all channels).
1338
- * @param int $blockNum (Required) The sample block number. Zero based.
1339
- * @throws Yop_Poll_WavFileException
1340
- */
1341
- public function setSampleBlock($sampleBlock, $blockNum)
1342
- {
1343
- // check preconditions
1344
- $blockAlign = $this->_blockAlign;
1345
- if (!isset($sampleBlock[$blockAlign - 1]) || isset($sampleBlock[$blockAlign])) { // faster than: if (strlen($sampleBlock) != $blockAlign)
1346
- throw new Yop_Poll_WavFileException('Incorrect sample block size. Got ' . strlen($sampleBlock) . ', expected ' . $blockAlign . '.');
1347
- }
1348
 
1349
- if (!$this->_dataSize_valid) {
1350
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1351
  }
1352
 
1353
- $numBlocks = (int)($this->_dataSize / $blockAlign);
1354
- $offset = $blockNum * $blockAlign;
1355
- if ($blockNum > $numBlocks || $blockNum < 0) { // allow appending
1356
- throw new Yop_Poll_WavFileException('Sample block number is out of range.');
1357
- }
 
 
 
 
 
 
 
 
1358
 
 
 
 
1359
 
1360
- // replace or append data
1361
- if ($blockNum == $numBlocks) {
1362
- // append
1363
- $this->_samples .= $sampleBlock;
1364
- $this->_dataSize += $blockAlign;
1365
- $this->_chunkSize += $blockAlign;
1366
- $this->_actualSize += $blockAlign;
1367
- $this->_numBlocks++;
1368
- } else {
1369
- // replace
1370
- for ($i = 0; $i < $blockAlign; ++$i) {
1371
- $this->_samples[$offset + $i] = $sampleBlock[$i];
1372
  }
1373
- }
1374
 
1375
- return $this;
1376
- }
1377
 
1378
- /**
1379
- * Get a float sample value for a specific sample block and channel number.
1380
- *
1381
- * @param int $blockNum (Required) The sample block number to fetch. Zero based.
1382
- * @param int $channelNum (Required) The channel number within the sample block to fetch. First channel is 1.
1383
- * @return float The float sample value. Returns null if the sample block number was out of range.
1384
- * @throws Yop_Poll_WavFileException
1385
- */
1386
- public function getSampleValue($blockNum, $channelNum)
1387
- {
1388
- // check preconditions
1389
- if ($channelNum < 1 || $channelNum > $this->_numChannels) {
1390
- throw new Yop_Poll_WavFileException('Channel number is out of range.');
1391
- }
1392
 
1393
- if (!$this->_dataSize_valid) {
1394
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1395
- }
1396
 
1397
- $sampleBytes = $this->_bitsPerSample / 8;
1398
- $offset = $blockNum * $this->_blockAlign + ($channelNum - 1) * $sampleBytes;
1399
- if ($offset + $sampleBytes > $this->_dataSize || $offset < 0) {
1400
- return null;
1401
  }
1402
 
1403
- // read binary value
1404
- $sampleBinary = substr($this->_samples, $offset, $sampleBytes);
1405
 
1406
- // convert binary to value
1407
- switch ($this->_bitsPerSample) {
1408
- case 8:
1409
- // unsigned char
1410
- return (float)((ord($sampleBinary) - 0x80) / 0x80);
1411
 
1412
- case 16:
1413
- // signed short, little endian
1414
- $data = unpack('v', $sampleBinary);
1415
- $sample = $data[1];
1416
- if ($sample >= 0x8000) {
1417
- $sample -= 0x10000;
1418
- }
1419
- return (float)($sample / 0x8000);
1420
-
1421
- case 24:
1422
- // 3 byte packed signed integer, little endian
1423
- $data = unpack('C3', $sampleBinary);
1424
- $sample = $data[1] | ($data[2] << 8) | ($data[3] << 16);
1425
- if ($sample >= 0x800000) {
1426
- $sample -= 0x1000000;
1427
- }
1428
- return (float)($sample / 0x800000);
1429
 
1430
- case 32:
1431
- // 32-bit float
1432
- $data = unpack('f', $sampleBinary);
1433
- return (float)$data[1];
1434
 
1435
- default:
1436
- return null;
1437
- }
1438
- }
1439
 
1440
- /**
1441
- * Sets a float sample value for a specific sample block number and channel. <br />
1442
- * Converts float values to appropriate integer values and clips properly. <br />
1443
- * Allows to append samples (in order).
1444
- *
1445
- * @param float $sampleFloat (Required) The float sample value to set. Converts float values and clips if necessary.
1446
- * @param int $blockNum (Required) The sample block number to set or append. Zero based.
1447
- * @param int $channelNum (Required) The channel number within the sample block to set or append. First channel is 1.
1448
- * @throws Yop_Poll_WavFileException
1449
- */
1450
- public function setSampleValue($sampleFloat, $blockNum, $channelNum)
1451
- {
1452
- // check preconditions
1453
- if ($channelNum < 1 || $channelNum > $this->_numChannels) {
1454
- throw new Yop_Poll_WavFileException('Channel number is out of range.');
1455
- }
 
 
 
1456
 
1457
- if (!$this->_dataSize_valid) {
1458
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1459
- }
1460
 
1461
- $dataSize = $this->_dataSize;
1462
- $bitsPerSample = $this->_bitsPerSample;
1463
- $sampleBytes = $bitsPerSample / 8;
1464
- $offset = $blockNum * $this->_blockAlign + ($channelNum - 1) * $sampleBytes;
1465
- if (($offset + $sampleBytes > $dataSize && $offset != $dataSize) || $offset < 0) { // allow appending
1466
- throw new Yop_Poll_WavFileException('Sample block or channel number is out of range.');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1467
  }
1468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
 
1470
- // convert to value, quantize and clip
1471
- if ($bitsPerSample == 32) {
1472
- $sample = $sampleFloat < -1.0 ? -1.0 : ($sampleFloat > 1.0 ? 1.0 : $sampleFloat);
1473
- } else {
1474
- $p = 1 << ($bitsPerSample - 1); // 2 to the power of _bitsPerSample divided by 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1475
 
1476
- // project and quantize (round) float to integer values
1477
- $sample = $sampleFloat < 0 ? (int)($sampleFloat * $p - 0.5) : (int)($sampleFloat * $p + 0.5);
 
 
1478
 
1479
- // clip if necessary to [-$p, $p - 1]
1480
- if ($sample < -$p) {
1481
- $sample = -$p;
1482
- } elseif ($sample > $p - 1) {
1483
- $sample = $p - 1;
1484
  }
1485
  }
1486
 
1487
- // convert to binary
1488
- switch ($bitsPerSample) {
1489
- case 8:
1490
- // unsigned char
1491
- $sampleBinary = chr($sample + 0x80);
1492
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1493
 
1494
- case 16:
1495
- // signed short, little endian
1496
- if ($sample < 0) {
1497
- $sample += 0x10000;
1498
- }
1499
- $sampleBinary = pack('v', $sample);
1500
- break;
1501
 
1502
- case 24:
1503
- // 3 byte packed signed integer, little endian
1504
- if ($sample < 0) {
1505
- $sample += 0x1000000;
1506
- }
1507
- $sampleBinary = pack('C3', $sample & 0xff, ($sample >> 8) & 0xff, ($sample >> 16) & 0xff);
1508
- break;
1509
 
1510
- case 32:
1511
- // 32-bit float
1512
- $sampleBinary = pack('f', $sample);
1513
- break;
 
 
1514
 
1515
- default:
1516
- $sampleBinary = null;
1517
- $sampleBytes = 0;
1518
- break;
1519
- }
1520
 
1521
- // replace or append data
1522
- if ($offset == $dataSize) {
1523
- // append
1524
- $this->_samples .= $sampleBinary;
1525
- $this->_dataSize += $sampleBytes;
1526
- $this->_chunkSize += $sampleBytes;
1527
- $this->_actualSize += $sampleBytes;
1528
- $this->_numBlocks = (int)($this->_dataSize / $this->_blockAlign);
1529
- } else {
1530
- // replace
1531
- for ($i = 0; $i < $sampleBytes; ++$i) {
1532
- $this->_samples{$offset + $i} = $sampleBinary{$i};
1533
  }
1534
- }
1535
 
1536
- return $this;
1537
- }
 
 
 
 
 
 
 
 
 
 
 
 
1538
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1539
 
1540
- /*%******************************************************************************************%*/
1541
- // Audio processing methods
 
 
 
 
 
 
 
 
 
 
 
 
 
1542
 
1543
- /**
1544
- * Run samples through audio processing filters.
1545
- *
1546
- * <code>
1547
- * $wav->filter(
1548
- * array(
1549
- * Yop_Poll_WavFile::FILTER_MIX => array( // Filter for mixing 2 Yop_Poll_WavFile instances.
1550
- * 'wav' => $wav2, // (Required) The Yop_Poll_WavFile to mix into this WhavFile. If no optional arguments are given, can be passed without the array.
1551
- * 'loop' => true, // (Optional) Loop the selected portion (with warping to the beginning at the end).
1552
- * 'blockOffset' => 0, // (Optional) Block number to start mixing from.
1553
- * 'numBlocks' => null // (Optional) Number of blocks to mix in or to select for looping. Defaults to the end or all data for looping.
1554
- * ),
1555
- * Yop_Poll_WavFile::FILTER_NORMALIZE => 0.6, // (Required) Normalization of (mixed) audio samples - see threshold parameter for normalizeSample().
1556
- * Yop_Poll_WavFile::FILTER_DEGRADE => 0.9 // (Required) Introduce random noise. The quality relative to the amplitude. 1 = no noise, 0 = max. noise.
1557
- * ),
1558
- * 0, // (Optional) The block number of this Yop_Poll_WavFile to start with.
1559
- * null // (Optional) The number of blocks to process.
1560
- * );
1561
- * </code>
1562
- *
1563
- * @param array $filters (Required) An array of 1 or more audio processing filters.
1564
- * @param int $blockOffset (Optional) The block number to start precessing from.
1565
- * @param int $numBlocks (Optional) The maximum number of blocks to process.
1566
- * @throws Yop_Poll_WavFileException
1567
- */
1568
- public function filter($filters, $blockOffset = 0, $numBlocks = null)
1569
- {
1570
- // check preconditions
1571
- $totalBlocks = $this->getNumBlocks();
1572
- $numChannels = $this->getNumChannels();
1573
- if (is_null($numBlocks)) $numBlocks = $totalBlocks - $blockOffset;
1574
-
1575
- if (!is_array($filters) || empty($filters) || $blockOffset < 0 || $blockOffset > $totalBlocks || $numBlocks <= 0) {
1576
- // nothing to do
1577
  return $this;
1578
  }
1579
 
1580
- // check filtes
1581
- $filter_mix = false;
1582
- if (array_key_exists(self::FILTER_MIX, $filters)) {
1583
- if (!is_array($filters[self::FILTER_MIX])) {
1584
- // assume the 'wav' parameter
1585
- $filters[self::FILTER_MIX] = array('wav' => $filters[self::FILTER_MIX]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1586
  }
1587
 
1588
- $mix_wav = @$filters[self::FILTER_MIX]['wav'];
1589
- if (!($mix_wav instanceof Yop_Poll_WavFile)) {
1590
- throw new Yop_Poll_WavFileException("WavFile to mix is missing or invalid.");
1591
- } elseif ($mix_wav->getSampleRate() != $this->getSampleRate()) {
1592
- throw new Yop_Poll_WavFileException("Sample rate of Yop_Poll_WavFile to mix does not match.");
1593
- } else if ($mix_wav->getNumChannels() != $this->getNumChannels()) {
1594
- throw new Yop_Poll_WavFileException("Number of channels of Yop_Poll_WavFile to mix does not match.");
1595
  }
1596
 
1597
- $mix_loop = @$filters[self::FILTER_MIX]['loop'];
1598
- if (is_null($mix_loop)) $mix_loop = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1599
 
1600
- $mix_blockOffset = @$filters[self::FILTER_MIX]['blockOffset'];
1601
- if (is_null($mix_blockOffset)) $mix_blockOffset = 0;
 
 
1602
 
1603
- $mix_totalBlocks = $mix_wav->getNumBlocks();
1604
- $mix_numBlocks = @$filters[self::FILTER_MIX]['numBlocks'];
1605
- if (is_null($mix_numBlocks)) $mix_numBlocks = $mix_loop ? $mix_totalBlocks : $mix_totalBlocks - $mix_blockOffset;
1606
- $mix_maxBlock = min($mix_blockOffset + $mix_numBlocks, $mix_totalBlocks);
1607
 
1608
- $filter_mix = true;
1609
- }
 
 
 
 
 
 
 
1610
 
1611
- $filter_normalize = false;
1612
- if (array_key_exists(self::FILTER_NORMALIZE, $filters)) {
1613
- $normalize_threshold = @$filters[self::FILTER_NORMALIZE];
1614
 
1615
- if (!is_null($normalize_threshold) && abs($normalize_threshold) != 1) $filter_normalize = true;
1616
- }
 
 
1617
 
1618
- $filter_degrade = false;
1619
- if (array_key_exists(self::FILTER_DEGRADE, $filters)) {
1620
- $degrade_quality = @$filters[self::FILTER_DEGRADE];
1621
- if (is_null($degrade_quality)) $degrade_quality = 1;
 
 
1622
 
1623
- if ($degrade_quality >= 0 && $degrade_quality < 1) $filter_degrade = true;
1624
- }
 
 
1625
 
1626
 
1627
- // loop through all sample blocks
1628
- for ($block = 0; $block < $numBlocks; ++$block) {
1629
- // loop through all channels
1630
- for ($channel = 1; $channel <= $numChannels; ++$channel) {
1631
- // read current sample
1632
- $currentBlock = $blockOffset + $block;
1633
- $sampleFloat = $this->getSampleValue($currentBlock, $channel);
1634
 
1635
 
1636
- /************* MIX FILTER ***********************/
1637
- if ($filter_mix) {
1638
- if ($mix_loop) {
1639
- $mixBlock = ($mix_blockOffset + ($block % $mix_numBlocks)) % $mix_totalBlocks;
1640
- } else {
1641
- $mixBlock = $mix_blockOffset + $block;
 
 
 
 
 
 
1642
  }
1643
 
1644
- if ($mixBlock < $mix_maxBlock) {
1645
- $sampleFloat += $mix_wav->getSampleValue($mixBlock, $channel);
 
1646
  }
1647
- }
1648
 
1649
- /************* NORMALIZE FILTER *******************/
1650
- if ($filter_normalize) {
1651
- $sampleFloat = $this->normalizeSample($sampleFloat, $normalize_threshold);
1652
- }
1653
 
1654
- /************* DEGRADE FILTER *******************/
1655
- if ($filter_degrade) {
1656
- $sampleFloat += rand(1000000 * ($degrade_quality - 1), 1000000 * (1 - $degrade_quality)) / 1000000;
1657
  }
 
1658
 
 
 
1659
 
1660
- // write current sample
1661
- $this->setSampleValue($sampleFloat, $currentBlock, $channel);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1662
  }
1663
- }
1664
 
1665
- return $this;
1666
- }
1667
 
1668
- /**
1669
- * Append a wav file to the current wav. <br />
1670
- * The wav files must have the same sample rate, number of bits per sample, and number of channels.
1671
- *
1672
- * @param Yop_Poll_WavFile $wav (Required) The wav file to append.
1673
- * @throws Yop_Poll_WavFileException
1674
- */
1675
- public function appendWav(Yop_Poll_WavFile $wav) {
1676
- // basic checks
1677
- if ($wav->getSampleRate() != $this->getSampleRate()) {
1678
- throw new Yop_Poll_WavFileException("Sample rate for wav files do not match.");
1679
- } else if ($wav->getBitsPerSample() != $this->getBitsPerSample()) {
1680
- throw new Yop_Poll_WavFileException("Bits per sample for wav files do not match.");
1681
- } else if ($wav->getNumChannels() != $this->getNumChannels()) {
1682
- throw new Yop_Poll_WavFileException("Number of channels for wav files do not match.");
1683
  }
1684
 
1685
- $this->_samples .= $wav->_samples;
1686
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1687
-
1688
- return $this;
1689
- }
1690
-
1691
- /**
1692
- * Mix 2 wav files together. <br />
1693
- * Both wavs must have the same sample rate and same number of channels.
1694
- *
1695
- * @param Yop_Poll_WavFile $wav (Required) The Yop_Poll_WavFile to mix.
1696
- * @param float $normalizeThreshold (Optional) See normalizeSample for an explanation.
1697
- * @throws Yop_Poll_WavFileException
1698
- */
1699
- public function mergeWav(Yop_Poll_WavFile $wav, $normalizeThreshold = null) {
1700
- return $this->filter(array(
1701
- Yop_Poll_WavFile::FILTER_MIX => $wav,
1702
- Yop_Poll_WavFile::FILTER_NORMALIZE => $normalizeThreshold
1703
- ));
1704
- }
 
 
 
 
 
 
 
 
 
 
 
 
1705
 
1706
- /**
1707
- * Add silence to the wav file.
1708
- *
1709
- * @param float $duration (Optional) How many seconds of silence. If negative, add to the beginning of the file. Defaults to 1s.
1710
- */
1711
- public function insertSilence($duration = 1.0)
1712
- {
1713
- $numSamples = $this->getSampleRate() * abs($duration);
1714
- $numChannels = $this->getNumChannels();
1715
 
1716
- $data = str_repeat(self::packSample($this->getZeroAmplitude(), $this->getBitsPerSample()), $numSamples * $numChannels);
1717
- if ($duration >= 0) {
1718
- $this->_samples .= $data;
1719
- } else {
1720
- $this->_samples = $data . $this->_samples;
1721
  }
1722
 
1723
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1724
 
1725
- return $this;
1726
- }
1727
 
1728
- /**
1729
- * Degrade the quality of the wav file by introducing random noise.
1730
- *
1731
- * @param float quality (Optional) The quality relative to the amplitude. 1 = no noise, 0 = max. noise.
1732
- */
1733
- public function degrade($quality = 1.0)
1734
- {
1735
- return $this->filter(self::FILTER_DEGRADE, array(
1736
- Yop_Poll_WavFile::FILTER_DEGRADE => $quality
1737
- ));
1738
- }
1739
 
1740
- /**
1741
- * Generate noise at the end of the wav for the specified duration and volume.
1742
- *
1743
- * @param float $duration (Optional) Number of seconds of noise to generate.
1744
- * @param float $percent (Optional) The percentage of the maximum amplitude to use. 100 = full amplitude.
1745
- */
1746
- public function generateNoise($duration = 1.0, $percent = 100)
1747
- {
1748
- $numChannels = $this->getNumChannels();
1749
- $numSamples = $this->getSampleRate() * $duration;
1750
- $minAmp = $this->getMinAmplitude();
1751
- $maxAmp = $this->getMaxAmplitude();
1752
- $bitDepth = $this->getBitsPerSample();
1753
 
1754
- for ($s = 0; $s < $numSamples; ++$s) {
1755
- if ($bitDepth == 32) {
1756
- $val = rand(-$percent * 10000, $percent * 10000) / 1000000;
1757
- } else {
1758
- $val = rand($minAmp, $maxAmp);
1759
- $val = (int)($val * $percent / 100);
 
 
 
 
1760
  }
1761
 
1762
- $this->_samples .= str_repeat(self::packSample($val, $bitDepth), $numChannels);
1763
- }
1764
-
1765
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
 
 
1766
 
1767
- return $this;
1768
- }
 
 
1769
 
1770
- /**
1771
- * Convert sample data to different bits per sample.
1772
- *
1773
- * @param int $bitsPerSample (Required) The new number of bits per sample;
1774
- * @throws Yop_Poll_WavFileException
1775
- */
1776
- public function convertBitsPerSample($bitsPerSample) {
1777
- if ($this->getBitsPerSample() == $bitsPerSample) {
1778
  return $this;
1779
  }
1780
 
1781
- $tempWav = new Yop_Poll_WavFile($this->getNumChannels(), $this->getSampleRate(), $bitsPerSample);
1782
- $tempWav->filter(
1783
- array(self::FILTER_MIX => $this),
1784
- 0,
1785
- $this->getNumBlocks()
1786
- );
1787
-
1788
- $this->setSamples() // implicit setDataSize(), setSize(), setActualSize(), setNumBlocks()
1789
- ->setBitsPerSample($bitsPerSample); // implicit setValidBitsPerSample(), setAudioFormat(), setAudioSubFormat(), setFmtChunkSize(), setFactChunkSize(), setSize(), setActualSize(), setDataOffset(), setByteRate(), setBlockAlign(), setNumBlocks()
1790
- $this->_samples = $tempWav->_samples;
1791
- $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1792
 
1793
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1794
  }
1795
 
1796
 
1797
  /*%******************************************************************************************%*/
1798
- // Miscellaneous methods
1799
 
1800
  /**
1801
- * Output information about the wav object.
1802
  */
1803
- public function displayInfo()
1804
- {
1805
- $s = "File Size: %u\n"
1806
- ."Chunk Size: %u\n"
1807
- ."fmt Subchunk Size: %u\n"
1808
- ."Extended fmt Size: %u\n"
1809
- ."fact Subchunk Size: %u\n"
1810
- ."Data Offset: %u\n"
1811
- ."Data Size: %u\n"
1812
- ."Audio Format: %s\n"
1813
- ."Audio SubFormat: %s\n"
1814
- ."Channels: %u\n"
1815
- ."Channel Mask: 0x%s\n"
1816
- ."Sample Rate: %u\n"
1817
- ."Bits Per Sample: %u\n"
1818
- ."Valid Bits Per Sample: %u\n"
1819
- ."Sample Block Size: %u\n"
1820
- ."Number of Sample Blocks: %u\n"
1821
- ."Byte Rate: %uBps\n";
1822
-
1823
- $s = sprintf($s, $this->getActualSize(),
1824
- $this->getChunkSize(),
1825
- $this->getFmtChunkSize(),
1826
- $this->getFmtExtendedSize(),
1827
- $this->getFactChunkSize(),
1828
- $this->getDataOffset(),
1829
- $this->getDataSize(),
1830
- $this->getAudioFormat() == self::WAVE_FORMAT_PCM ? 'PCM' : ($this->getAudioFormat() == self::WAVE_FORMAT_IEEE_FLOAT ? 'IEEE FLOAT' : 'EXTENSIBLE'),
1831
- $this->getAudioSubFormat() == self::WAVE_SUBFORMAT_PCM ? 'PCM' : 'IEEE FLOAT',
1832
- $this->getNumChannels(),
1833
- dechex($this->getChannelMask()),
1834
- $this->getSampleRate(),
1835
- $this->getBitsPerSample(),
1836
- $this->getValidBitsPerSample(),
1837
- $this->getBlockAlign(),
1838
- $this->getNumBlocks(),
1839
- $this->getByteRate());
1840
-
1841
- if (php_sapi_name() == 'cli') {
1842
- return $s;
1843
- } else {
1844
- return nl2br($s);
1845
- }
1846
  }
1847
- }
1848
-
1849
-
1850
- /*%******************************************************************************************%*/
1851
- // Exceptions
1852
 
1853
- /**
1854
- * Yop_Poll_WavFileException indicates an illegal state or argument in this class.
1855
- */
1856
- class Yop_Poll_WavFileException extends Exception {}
1857
-
1858
- /**
1859
- * Yop_Poll_WavFormatException indicates a malformed or unsupported wav file header.
1860
- */
1861
- class Yop_Poll_WavFormatException extends Yop_Poll_WavFileException {}
1
  <?php
2
+ // error_reporting(E_ALL); ini_set('display_errors', 1); // uncomment this line for debugging
3
 
4
+ /**
5
+ * Project: PHPWavUtils: Classes for creating, reading, and manipulating WAV files in PHP<br />
6
+ * File: Yop_Poll_WavFile.php<br />
7
+ *
8
+ * Copyright (c) 2012, Drew Phillips
9
+ * All rights reserved.
10
+ *
11
+ * Redistribution and use in source and binary forms, with or without modification,
12
+ * are permitted provided that the following conditions are met:
13
+ *
14
+ * - Redistributions of source code must retain the above copyright notice,
15
+ * this list of conditions and the following disclaimer.
16
+ * - Redistributions in binary form must reproduce the above copyright notice,
17
+ * this list of conditions and the following disclaimer in the documentation
18
+ * and/or other materials provided with the distribution.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ * POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ * Any modifications to the library should be indicated clearly in the source code
33
+ * to inform users that the changes are not a part of the original software.<br /><br />
34
+ *
35
+ * @copyright 2012 Drew Phillips
36
+ * @author Drew Phillips <drew@drew-phillips.com>
37
+ * @author Paul Voegler <http://www.voegler.eu/>
38
+ * @version 1.0RC1 (April 2012)
39
+ * @package PHPWavUtils
40
+ * @license BSD License
41
+ *
42
+ * Changelog:
43
+ *
44
+ * 1.0 RC1 (4/20/2012)
45
+ * - Initial release candidate
46
+ * - Supports 8, 16, 24, 32 bit PCM, 32-bit IEEE FLOAT, Extensible Format
47
+ * - Support for 18 channels of audio
48
+ * - Ability to read an offset from a file to reduce memory footprint with large files
49
+ * - Single-pass audio filter processing
50
+ * - Highly accurate and efficient mix and normalization filters (http://www.voegler.eu/pub/audio/)
51
+ * - Utility filters for degrading audio, and inserting silence
52
+ *
53
+ * 0.6 (4/12/2012)
54
+ * - Support 8, 16, 24, 32 bit and PCM float (Paul Voegler)
55
+ * - Add normalize filter, misc improvements and fixes (Paul Voegler)
56
+ * - Normalize parameters to filter() to use filter constants as array indices
57
+ * - Add option to mix filter to loop the target file if the source is longer
58
+ *
59
+ * 0.5 (4/3/2012)
60
+ * - Fix binary pack routine (Paul Voegler)
61
+ * - Add improved mixing function (Paul Voegler)
62
+ *
63
+ */
 
 
 
 
 
 
 
64
 
65
+ class Yop_Poll_WavFile{
66
+ /*%******************************************************************************************%*/
67
+ // Class constants
68
+
69
+ /** @var int Filter flag for mixing two files */
70
+ const FILTER_MIX = 0x01;
71
+
72
+ /** @var int Filter flag for normalizing audio data */
73
+ const FILTER_NORMALIZE = 0x02;
74
+
75
+ /** @var int Filter flag for degrading audio data */
76
+ const FILTER_DEGRADE = 0x04;
77
+
78
+ /** @var int Maximum number of channels */
79
+ const MAX_CHANNEL = 18;
80
+
81
+ /** @var int Maximum sample rate */
82
+ const MAX_SAMPLERATE = 192000;
83
+
84
+ /** Channel Locations for ChannelMask */
85
+ const SPEAKER_DEFAULT = 0x000000;
86
+ const SPEAKER_FRONT_LEFT = 0x000001;
87
+ const SPEAKER_FRONT_RIGHT = 0x000002;
88
+ const SPEAKER_FRONT_CENTER = 0x000004;
89
+ const SPEAKER_LOW_FREQUENCY = 0x000008;
90
+ const SPEAKER_BACK_LEFT = 0x000010;
91
+ const SPEAKER_BACK_RIGHT = 0x000020;
92
+ const SPEAKER_FRONT_LEFT_OF_CENTER = 0x000040;
93
+ const SPEAKER_FRONT_RIGHT_OF_CENTER = 0x000080;
94
+ const SPEAKER_BACK_CENTER = 0x000100;
95
+ const SPEAKER_SIDE_LEFT = 0x000200;
96
+ const SPEAKER_SIDE_RIGHT = 0x000400;
97
+ const SPEAKER_TOP_CENTER = 0x000800;
98
+ const SPEAKER_TOP_FRONT_LEFT = 0x001000;
99
+ const SPEAKER_TOP_FRONT_CENTER = 0x002000;
100
+ const SPEAKER_TOP_FRONT_RIGHT = 0x004000;
101
+ const SPEAKER_TOP_BACK_LEFT = 0x008000;
102
+ const SPEAKER_TOP_BACK_CENTER = 0x010000;
103
+ const SPEAKER_TOP_BACK_RIGHT = 0x020000;
104
+ const SPEAKER_ALL = 0x03FFFF;
105
+
106
+ /** @var int PCM Audio Format */
107
+ const WAVE_FORMAT_PCM = 0x0001;
108
+
109
+ /** @var int IEEE FLOAT Audio Format */
110
+ const WAVE_FORMAT_IEEE_FLOAT = 0x0003;
111
+
112
+ /** @var int EXTENSIBLE Audio Format - actual audio format defined by SubFormat */
113
+ const WAVE_FORMAT_EXTENSIBLE = 0xFFFE;
114
+
115
+ /** @var string PCM Audio Format SubType - LE hex representation of GUID {00000001-0000-0010-8000-00AA00389B71} */
116
+ const WAVE_SUBFORMAT_PCM = "0100000000001000800000aa00389b71";
117
+
118
+ /** @var string IEEE FLOAT Audio Format SubType - LE hex representation of GUID {00000003-0000-0010-8000-00AA00389B71} */
119
+ const WAVE_SUBFORMAT_IEEE_FLOAT = "0300000000001000800000aa00389b71";
120
+
121
+
122
+ /*%******************************************************************************************%*/
123
+ // Properties
124
+
125
+ /** @var array Log base modifier lookup table for a given threshold (in 0.05 steps) used by normalizeSample.
126
+ * Adjusts the slope (1st derivative) of the log function at the threshold to 1 for a smooth transition
127
+ * from linear to logarithmic amplitude output. */
128
+ protected static $LOOKUP_LOGBASE = array(
129
+ 2.513, 2.667, 2.841, 3.038, 3.262,
130
+ 3.520, 3.819, 4.171, 4.589, 5.093,
131
+ 5.711, 6.487, 7.483, 8.806, 10.634,
132
+ 13.302, 17.510, 24.970, 41.155, 96.088
133
+ );
134
 
135
+ /** @var int The actual physical file size */
136
+ protected $_actualSize;
137
+
138
+ /** @var int The size of the file in RIFF header */
139
+ protected $_chunkSize;
140
 
141
+ /** @var int The size of the "fmt " chunk */
142
+ protected $_fmtChunkSize;
143
 
144
+ /** @var int The size of the extended "fmt " data */
145
+ protected $_fmtExtendedSize;
146
 
147
+ /** @var int The size of the "fact" chunk */
148
+ protected $_factChunkSize;
149
 
150
+ /** @var int Size of the data chunk */
151
+ protected $_dataSize;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ /** @var int Size of the data chunk in the opened wav file */
154
+ protected $_dataSize_fp;
155
 
156
+ /** @var int Does _dataSize really reflect strlen($_samples)? Case when a wav file is read with readData = false */
157
+ protected $_dataSize_valid;
158
 
159
+ /** @var int Starting offset of data chunk */
160
+ protected $_dataOffset;
161
 
162
+ /** @var int The audio format - Yop_Poll_WavFile::WAVE_FORMAT_* */
163
+ protected $_audioFormat;
164
 
165
+ /** @var int The audio subformat - Yop_Poll_WavFile::WAVE_SUBFORMAT_* */
166
+ protected $_audioSubFormat;
167
 
168
+ /** @var int Number of channels in the audio file */
169
+ protected $_numChannels;
170
 
171
+ /** @var int The channel mask */
172
+ protected $_channelMask;
173
 
174
+ /** @var int Samples per second */
175
+ protected $_sampleRate;
 
 
 
 
 
 
 
176
 
177
+ /** @var int Number of bits per sample */
178
+ protected $_bitsPerSample;
179
 
180
+ /** @var int Number of valid bits per sample */
181
+ protected $_validBitsPerSample;
182
 
183
+ /** @var int NumChannels * BitsPerSample/8 */
184
+ protected $_blockAlign;
185
 
186
+ /** @var int Number of sample blocks */
187
+ protected $_numBlocks;
188
 
189
+ /** @var int Bytes per second */
190
+ protected $_byteRate;
191
 
192
+ /** @var string Binary string of samples */
193
+ protected $_samples;
194
 
195
+ /** @var resource The file pointer used for reading wavs from file or memory */
196
+ protected $_fp;
197
 
 
 
198
 
199
+ /*%******************************************************************************************%*/
200
+ // Special methods
201
 
202
+ /**
203
+ * Yop_Poll_WavFile Constructor.
204
+ *
205
+ * <code>
206
+ * $wav1 = new Yop_Poll_WavFile(2, 44100, 16); // new wav with 2 channels, at 44100 samples/sec and 16 bits per sample
207
+ * $wav2 = new Yop_Poll_WavFile('./audio/sound.wav'); // open and read wav file
208
+ * </code>
209
+ *
210
+ * @param string|int $numChannelsOrFileName (Optional) If string, the filename of the wav file to open. The number of channels otherwise. Defaults to 1.
211
+ * @param int|bool $sampleRateOrReadData (Optional) If opening a file and boolean, decides whether to read the data chunk or not. Defaults to true. The sample rate in samples per second otherwise. 8000 = standard telephone, 16000 = wideband telephone, 32000 = FM radio and 44100 = CD quality. Defaults to 8000.
212
+ * @param int $bitsPerSample (Optional) The number of bits per sample. Has to be 8, 16 or 24 for PCM audio or 32 for IEEE FLOAT audio. 8 = telephone, 16 = CD and 24 or 32 = studio quality. Defaults to 8.
213
+ *
214
+ * @throws Yop_Poll_WavFormatException
215
+ * @throws Yop_Poll_WavFileException
216
+ */
217
+ public function __construct( $numChannelsOrFileName = NULL, $sampleRateOrReadData = NULL, $bitsPerSample = NULL ) {
218
+ $this->_actualSize = 44;
219
+ $this->_chunkSize = 36;
220
+ $this->_fmtChunkSize = 16;
221
+ $this->_fmtExtendedSize = 0;
222
+ $this->_factChunkSize = 0;
223
+ $this->_dataSize = 0;
224
+ $this->_dataSize_fp = 0;
225
+ $this->_dataSize_valid = true;
226
+ $this->_dataOffset = 44;
227
+ $this->_audioFormat = self::WAVE_FORMAT_PCM;
228
+ $this->_audioSubFormat = NULL;
229
+ $this->_numChannels = 1;
230
+ $this->_channelMask = self::SPEAKER_DEFAULT;
231
+ $this->_sampleRate = 8000;
232
+ $this->_bitsPerSample = 8;
233
+ $this->_validBitsPerSample = 8;
234
+ $this->_blockAlign = 1;
235
+ $this->_numBlocks = 0;
236
+ $this->_byteRate = 8000;
237
+ $this->_samples = '';
238
+ $this->_fp = NULL;
239
+
240
+
241
+ if ( is_string( $numChannelsOrFileName ) ){
242
+ $this->openWav( $numChannelsOrFileName, is_bool( $sampleRateOrReadData ) ? $sampleRateOrReadData : true );
243
 
244
+ }
245
+ else {
246
+ $this->setNumChannels( is_null( $numChannelsOrFileName ) ? 1 : $numChannelsOrFileName )
247
+ ->setSampleRate( is_null( $sampleRateOrReadData ) ? 8000 : $sampleRateOrReadData )
248
+ ->setBitsPerSample( is_null( $bitsPerSample ) ? 8 : $bitsPerSample );
249
+ }
250
+ }
251
 
252
+ public function __destruct() {
253
+ if ( is_resource( $this->_fp ) ){
254
+ $this->closeWav();
255
+ }
256
+ }
257
 
258
+ public function __clone() {
259
+ $this->_fp = NULL;
260
+ }
261
 
262
+ /**
263
+ * Output the wav file headers and data.
264
+ *
265
+ * @return string The encoded file.
266
+ */
267
+ public function __toString() {
268
+ return $this->makeHeader() .
269
+ $this->getDataSubchunk();
270
+ }
271
 
 
 
272
 
273
+ /*%******************************************************************************************%*/
274
+ // Static methods
275
 
276
+ /**
277
+ * Unpacks a single binary sample to numeric value.
278
+ *
279
+ * @param string $sampleBinary (Required) The sample to decode.
280
+ * @param int $bitDepth (Optional) The bits per sample to decode. If omitted, derives it from the length of $sampleBinary.
281
+ *
282
+ * @return int|float The numeric sample value. Float for 32-bit samples. Returns null for unsupported bit depths.
283
+ */
284
+ public static function unpackSample( $sampleBinary, $bitDepth = NULL ) {
285
+ if ( $bitDepth === NULL ){
286
+ $bitDepth = strlen( $sampleBinary ) * 8;
287
+ }
288
 
289
+ switch ( $bitDepth ) {
290
+ case 8:
291
+ // unsigned char
292
+ return ord( $sampleBinary );
293
+
294
+ case 16:
295
+ // signed short, little endian
296
+ $data = unpack( 'v', $sampleBinary );
297
+ $sample = $data[1];
298
+ if ( $sample >= 0x8000 ){
299
+ $sample -= 0x10000;
300
+ }
301
+ return $sample;
302
+
303
+ case 24:
304
+ // 3 byte packed signed integer, little endian
305
+ $data = unpack( 'C3', $sampleBinary );
306
+ $sample = $data[1] | ( $data[2] << 8 ) | ( $data[3] << 16 );
307
+ if ( $sample >= 0x800000 ){
308
+ $sample -= 0x1000000;
309
+ }
310
+ return $sample;
311
 
312
+ case 32:
313
+ // 32-bit float
314
+ $data = unpack( 'f', $sampleBinary );
315
+ return $data[1];
316
 
317
+ default:
318
+ return NULL;
319
+ }
320
+ }
321
 
322
+ /**
323
+ * Packs a single numeric sample to binary.
324
+ *
325
+ * @param int|float $sample (Required) The sample to encode. Has to be within valid range for $bitDepth. Float values only for 32 bits.
326
+ * @param int $bitDepth (Required) The bits per sample to encode with.
327
+ *
328
+ * @return string The encoded binary sample. Returns null for unsupported bit depths.
329
+ */
330
+ public static function packSample( $sample, $bitDepth ) {
331
+ switch ( $bitDepth ) {
332
+ case 8:
333
+ // unsigned char
334
+ return chr( $sample );
335
+
336
+ case 16:
337
+ // signed short, little endian
338
+ if ( $sample < 0 ){
339
+ $sample += 0x10000;
340
+ }
341
+ return pack( 'v', $sample );
342
 
343
+ case 24:
344
+ // 3 byte packed signed integer, little endian
345
+ if ( $sample < 0 ){
346
+ $sample += 0x1000000;
347
+ }
348
+ return pack( 'C3', $sample & 0xff, ( $sample >> 8 ) & 0xff, ( $sample >> 16 ) & 0xff );
349
 
350
+ case 32:
351
+ // 32-bit float
352
+ return pack( 'f', $sample );
353
 
354
+ default:
355
+ return NULL;
356
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  }
 
358
 
359
+ /**
360
+ * Unpacks a binary sample block to numeric values.
361
+ *
362
+ * @param string $sampleBlock (Required) The binary sample block (all channels).
363
+ * @param int $bitDepth (Required) The bits per sample to decode.
364
+ * @param int $numChannels (Optional) The number of channels to decode. If omitted, derives it from the length of $sampleBlock and $bitDepth.
365
+ *
366
+ * @return array The sample values as an array of integers of floats for 32 bits. First channel is array index 1.
367
+ */
368
+ public static function unpackSampleBlock( $sampleBlock, $bitDepth, $numChannels = NULL ) {
369
+ $sampleBytes = $bitDepth / 8;
370
+ if ( $numChannels === NULL ){
371
+ $numChannels = strlen( $sampleBlock ) / $sampleBytes;
372
+ }
373
 
374
+ $samples = array();
375
+ for ( $i = 0; $i < $numChannels; $i++ ) {
376
+ $sampleBinary = substr( $sampleBlock, $i * $sampleBytes, $sampleBytes );
377
+ $samples[$i + 1] = self::unpackSample( $sampleBinary, $bitDepth );
378
+ }
379
 
380
+ return $samples;
381
+ }
382
+
383
+ /**
384
+ * Packs an array of numeric channel samples to a binary sample block.
385
+ *
386
+ * @param array $samples (Required) The array of channel sample values. Expects float values for 32 bits and integer otherwise.
387
+ * @param int $bitDepth (Required) The bits per sample to encode with.
388
+ *
389
+ * @return string The encoded binary sample block.
390
+ */
391
+ public static function packSampleBlock( $samples, $bitDepth ) {
392
+ $sampleBlock = '';
393
+ foreach ( $samples as $sample ) {
394
+ $sampleBlock .= self::packSample( $sample, $bitDepth );
395
+ }
396
 
397
+ return $sampleBlock;
398
+ }
399
+
400
+ /**
401
+ * Normalizes a float audio sample. Maximum input range assumed for compression is [-2, 2].
402
+ * See http://www.voegler.eu/pub/audio/ for more information.
403
+ *
404
+ * @param float $sampleFloat (Required) The float sample to normalize.
405
+ * @param float $threshold (Required) The threshold or gain factor for normalizing the amplitude. <ul>
406
+ * <li> >= 1 - Normalize by multiplying by the threshold (boost - positive gain). <br />
407
+ * A value of 1 in effect means no normalization (and results in clipping). </li>
408
+ * <li> <= -1 - Normalize by dividing by the the absolute value of threshold (attenuate - negative gain). <br />
409
+ * A factor of 2 (-2) is about 6dB reduction in volume.</li>
410
+ * <li> [0, 1) - (open inverval - not including 1) - The threshold
411
+ * above which amplitudes are comressed logarithmically. <br />
412
+ * e.g. 0.6 to leave amplitudes up to 60% "as is" and compress above. </li>
413
+ * <li> (-1, 0) - (open inverval - not including -1 and 0) - The threshold
414
+ * above which amplitudes are comressed linearly. <br />
415
+ * e.g. -0.6 to leave amplitudes up to 60% "as is" and compress above. </li></ul>
416
+ *
417
+ * @return float The normalized sample.
418
+ **/
419
+ public static function normalizeSample( $sampleFloat, $threshold ) {
420
+ // apply positive gain
421
+ if ( $threshold >= 1 ){
422
+ return $sampleFloat * $threshold;
423
+ }
424
 
425
+ // apply negative gain
426
+ if ( $threshold <= -1 ){
427
+ return $sampleFloat / -$threshold;
428
+ }
429
 
430
+ $sign = $sampleFloat < 0 ? -1 : 1;
431
+ $sampleAbs = abs( $sampleFloat );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
 
433
+ // logarithmic compression
434
+ if ( $threshold >= 0 && $threshold < 1 && $sampleAbs > $threshold ){
435
+ $loga = self::$LOOKUP_LOGBASE[(int)( $threshold * 20 )]; // log base modifier
436
+ return $sign * ( $threshold + ( 1 - $threshold ) * log( 1 + $loga * ( $sampleAbs - $threshold ) / ( 2 - $threshold ) ) / log( 1 + $loga ) );
437
+ }
438
 
439
+ // linear compression
440
+ $thresholdAbs = abs( $threshold );
441
+ if ( $threshold > -1 && $threshold < 0 && $sampleAbs > $thresholdAbs ){
442
+ return $sign * ( $thresholdAbs + ( 1 - $thresholdAbs ) / ( 2 - $thresholdAbs ) * ( $sampleAbs - $thresholdAbs ) );
443
+ }
444
 
445
+ // else ?
446
+ return $sampleFloat;
447
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
 
 
 
 
 
 
 
449
 
450
+ /*%******************************************************************************************%*/
451
+ // Getter and Setter methods for properties
 
452
 
453
+ public function getActualSize() {
454
+ return $this->_actualSize;
455
  }
 
456
 
457
+ protected function setActualSize( $actualSize = NULL ) {
458
+ if ( is_null( $actualSize ) ){
459
+ $this->_actualSize = 8 + $this->_chunkSize; // + "RIFF" header (ID + size)
460
+ }
461
+ else {
462
+ $this->_actualSize = $actualSize;
463
+ }
 
 
 
 
 
 
464
 
465
+ return $this;
 
 
 
466
  }
467
 
468
+ public function getChunkSize() {
469
+ return $this->_chunkSize;
 
 
 
 
 
 
 
 
 
 
 
 
470
  }
471
 
472
+ protected function setChunkSize( $chunkSize = NULL ) {
473
+ if ( is_null( $chunkSize ) ){
474
+ $this->_chunkSize = 4 + // "WAVE" chunk
475
+ 8 + $this->_fmtChunkSize + // "fmt " subchunk
476
+ ( $this->_factChunkSize > 0 ? 8 + $this->_factChunkSize : 0 ) + // "fact" subchunk
477
+ 8 + $this->_dataSize + // "data" subchunk
478
+ ( $this->_dataSize & 1 ); // padding byte
479
+ }
480
+ else {
481
+ $this->_chunkSize = $chunkSize;
482
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
 
484
+ $this->setActualSize();
 
 
485
 
486
+ return $this;
 
 
 
 
487
  }
488
 
489
+ public function getFmtChunkSize() {
490
+ return $this->_fmtChunkSize;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
  }
492
 
493
+ protected function setFmtChunkSize( $fmtChunkSize = NULL ) {
494
+ if ( is_null( $fmtChunkSize ) ){
495
+ $this->_fmtChunkSize = 16 + $this->_fmtExtendedSize;
496
+ }
497
+ else {
498
+ $this->_fmtChunkSize = $fmtChunkSize;
499
+ }
500
 
501
+ $this->setChunkSize() // implicit setActualSize()
502
+ ->setDataOffset();
 
503
 
504
+ return $this;
 
 
 
 
505
  }
506
 
507
+ public function getFmtExtendedSize() {
508
+ return $this->_fmtExtendedSize;
509
+ }
510
 
511
+ protected function setFmtExtendedSize( $fmtExtendedSize = NULL ) {
512
+ if ( is_null( $fmtExtendedSize ) ){
513
+ if ( $this->_audioFormat == self::WAVE_FORMAT_EXTENSIBLE ){
514
+ $this->_fmtExtendedSize = 2 + 22; // extension size for WAVE_FORMAT_EXTENSIBLE
515
+ }
516
+ elseif ( $this->_audioFormat != self::WAVE_FORMAT_PCM ) {
517
+ $this->_fmtExtendedSize = 2 + 0; // empty extension
518
+ }
519
+ else {
520
+ $this->_fmtExtendedSize = 0; // no extension, only for WAVE_FORMAT_PCM
521
+ }
522
+ }
523
+ else {
524
+ $this->_fmtExtendedSize = $fmtExtendedSize;
525
+ }
526
 
527
+ $this->setFmtChunkSize(); // implicit setSize(), setActualSize(), setDataOffset()
 
 
528
 
529
+ return $this;
 
 
 
 
 
 
 
 
 
 
530
  }
531
 
532
+ public function getFactChunkSize() {
533
+ return $this->_factChunkSize;
534
+ }
535
 
536
+ protected function setFactChunkSize( $factChunkSize = NULL ) {
537
+ if ( is_null( $factChunkSize ) ){
538
+ if ( $this->_audioFormat != self::WAVE_FORMAT_PCM ){
539
+ $this->_factChunkSize = 4;
540
+ }
541
+ else {
542
+ $this->_factChunkSize = 0;
543
+ }
544
+ }
545
+ else {
546
+ $this->_factChunkSize = $factChunkSize;
547
+ }
548
 
549
+ $this->setChunkSize() // implicit setActualSize()
550
+ ->setDataOffset();
 
551
 
552
+ return $this;
 
 
 
 
 
 
 
 
553
  }
554
 
555
+ public function getDataSize() {
556
+ return $this->_dataSize;
557
+ }
558
 
559
+ protected function setDataSize( $dataSize = NULL ) {
560
+ if ( is_null( $dataSize ) ){
561
+ $this->_dataSize = strlen( $this->_samples );
562
+ }
563
+ else {
564
+ $this->_dataSize = $dataSize;
565
+ }
566
 
567
+ $this->setChunkSize() // implicit setActualSize()
568
+ ->setNumBlocks();
569
+ $this->_dataSize_valid = true;
570
 
571
+ return $this;
 
 
 
 
572
  }
573
 
574
+ public function getDataOffset() {
575
+ return $this->_dataOffset;
576
+ }
 
 
 
577
 
578
+ protected function setDataOffset( $dataOffset = NULL ) {
579
+ if ( is_null( $dataOffset ) ){
580
+ $this->_dataOffset = 8 + // "RIFF" header (ID + size)
581
+ 4 + // "WAVE" chunk
582
+ 8 + $this->_fmtChunkSize + // "fmt " subchunk
583
+ ( $this->_factChunkSize > 0 ? 8 + $this->_factChunkSize : 0 ) + // "fact" subchunk
584
+ 8; // "data" subchunk
585
+ }
586
+ else {
587
+ $this->_dataOffset = $dataOffset;
588
+ }
589
 
590
+ return $this;
 
 
 
 
 
 
 
 
591
  }
592
 
593
+ public function getAudioFormat() {
594
+ return $this->_audioFormat;
595
+ }
 
 
 
596
 
597
+ protected function setAudioFormat( $audioFormat = NULL ) {
598
+ if ( is_null( $audioFormat ) ){
599
+ if ( ( $this->_bitsPerSample <= 16 || $this->_bitsPerSample == 32 )
600
+ && $this->_validBitsPerSample == $this->_bitsPerSample
601
+ && $this->_channelMask == self::SPEAKER_DEFAULT
602
+ && $this->_numChannels <= 2
603
+ ){
604
+ if ( $this->_bitsPerSample <= 16 ){
605
+ $this->_audioFormat = self::WAVE_FORMAT_PCM;
606
+ }
607
+ else {
608
+ $this->_audioFormat = self::WAVE_FORMAT_IEEE_FLOAT;
609
+ }
610
+ }
611
+ else {
612
+ $this->_audioFormat = self::WAVE_FORMAT_EXTENSIBLE;
613
  }
 
 
614
  }
615
+ else {
616
+ $this->_audioFormat = $audioFormat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  }
 
 
 
618
 
619
+ $this->setAudioSubFormat()
620
+ ->setFactChunkSize() // implicit setSize(), setActualSize(), setDataOffset()
621
+ ->setFmtExtendedSize(); // implicit setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
622
 
623
+ return $this;
 
 
 
 
 
 
 
 
624
  }
625
 
626
+ public function getAudioSubFormat() {
627
+ return $this->_audioSubFormat;
628
+ }
 
 
 
 
 
 
 
 
 
629
 
630
+ protected function setAudioSubFormat( $audioSubFormat = NULL ) {
631
+ if ( is_null( $audioSubFormat ) ){
632
+ if ( $this->_bitsPerSample == 32 ){
633
+ $this->_audioSubFormat = self::WAVE_SUBFORMAT_IEEE_FLOAT; // 32 bits are IEEE FLOAT in this class
634
+ }
635
+ else {
636
+ $this->_audioSubFormat = self::WAVE_SUBFORMAT_PCM; // 8, 16 and 24 bits are PCM in this class
637
+ }
638
  }
639
+ else {
640
+ $this->_audioSubFormat = $audioSubFormat;
641
  }
642
+
643
+ return $this;
644
  }
645
 
646
+ public function getNumChannels() {
647
+ return $this->_numChannels;
648
+ }
649
 
650
+ public function setNumChannels( $numChannels ) {
651
+ if ( $numChannels < 1 || $numChannels > self::MAX_CHANNEL ){
652
+ throw new Yop_Poll_WavFileException( 'Unsupported number of channels. Only up to ' . self::MAX_CHANNEL . ' channels are supported.' );
653
+ }
654
+ elseif ( $this->_samples !== '' ) {
655
+ trigger_error( 'Wav already has sample data. Changing the number of channels does not convert and may corrupt the data.', E_USER_NOTICE );
656
+ }
657
 
658
+ $this->_numChannels = (int)$numChannels;
 
659
 
660
+ $this->setAudioFormat() // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
661
+ ->setByteRate()
662
+ ->setBlockAlign(); // implicit setNumBlocks()
663
 
664
+ return $this;
 
 
 
 
665
  }
666
 
667
+ public function getChannelMask() {
668
+ return $this->_channelMask;
669
+ }
670
 
671
+ public function setChannelMask( $channelMask = self::SPEAKER_DEFAULT ) {
672
+ if ( $channelMask != 0 ){
673
+ // count number of set bits - Hamming weight
674
+ $c = (int)$channelMask;
675
+ $n = 0;
676
+ while ( $c > 0 ) {
677
+ $n += $c & 1;
678
+ $c >>= 1;
679
+ }
680
+ if ( $n != $this->_numChannels || ( ( (int)$channelMask | self::SPEAKER_ALL ) != self::SPEAKER_ALL ) ){
681
+ throw new Yop_Poll_WavFileException( 'Invalid channel mask. The number of channels does not match the number of locations in the mask.' );
682
+ }
683
+ }
684
 
685
+ $this->_channelMask = (int)$channelMask;
 
686
 
687
+ $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
 
 
688
 
689
+ return $this;
 
 
 
 
690
  }
691
 
692
+ public function getSampleRate() {
693
+ return $this->_sampleRate;
694
+ }
 
 
 
 
 
 
 
 
 
695
 
696
+ public function setSampleRate( $sampleRate ) {
697
+ if ( $sampleRate < 1 || $sampleRate > self::MAX_SAMPLERATE ){
698
+ throw new Yop_Poll_WavFileException( 'Invalid sample rate.' );
699
+ }
700
+ elseif ( $this->_samples !== '' ) {
701
+ trigger_error( 'Wav already has sample data. Changing the sample rate does not convert the data and may yield undesired results.', E_USER_NOTICE );
702
  }
 
 
703
 
704
+ $this->_sampleRate = (int)$sampleRate;
705
 
706
+ $this->setByteRate();
 
707
 
708
+ return $this;
709
+ }
 
710
 
711
+ public function getBitsPerSample() {
712
+ return $this->_bitsPerSample;
 
 
 
713
  }
714
 
715
+ public function setBitsPerSample( $bitsPerSample ) {
716
+ if ( !in_array( $bitsPerSample, array( 8, 16, 24, 32 ) ) ){
717
+ throw new Yop_Poll_WavFileException( 'Unsupported bits per sample. Only 8, 16, 24 and 32 bits are supported.' );
718
+ }
719
+ elseif ( $this->_samples !== '' ) {
720
+ trigger_error( 'Wav already has sample data. Changing the bits per sample does not convert and may corrupt the data.', E_USER_NOTICE );
721
+ }
722
 
723
+ $this->_bitsPerSample = (int)$bitsPerSample;
 
724
 
725
+ $this->setValidBitsPerSample() // implicit setAudioFormat(), setAudioSubFormat(), setFmtChunkSize(), setFactChunkSize(), setSize(), setActualSize(), setDataOffset()
726
+ ->setByteRate()
727
+ ->setBlockAlign(); // implicit setNumBlocks()
 
728
 
729
+ return $this;
 
 
 
 
730
  }
731
 
732
+ public function getValidBitsPerSample() {
733
+ return $this->_validBitsPerSample;
 
 
 
 
 
 
 
 
 
 
734
  }
735
 
736
+ protected function setValidBitsPerSample( $validBitsPerSample = NULL ) {
737
+ if ( is_null( $validBitsPerSample ) ){
738
+ $this->_validBitsPerSample = $this->_bitsPerSample;
739
+ }
740
+ else {
741
+ if ( $validBitsPerSample < 1 || $validBitsPerSample > $this->_bitsPerSample ){
742
+ throw new Yop_Poll_WavFileException( 'ValidBitsPerSample cannot be greater than BitsPerSample.' );
743
+ }
744
+ $this->_validBitsPerSample = (int)$validBitsPerSample;
745
+ }
746
 
747
+ $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
 
 
748
 
749
+ return $this;
 
 
750
  }
751
 
752
+ public function getBlockAlign() {
753
+ return $this->_blockAlign;
754
+ }
 
 
 
 
755
 
756
+ protected function setBlockAlign( $blockAlign = NULL ) {
757
+ if ( is_null( $blockAlign ) ){
758
+ $this->_blockAlign = $this->_numChannels * $this->_bitsPerSample / 8;
759
+ }
760
+ else {
761
+ $this->_blockAlign = $blockAlign;
762
+ }
763
 
764
+ $this->setNumBlocks();
 
 
 
 
 
 
 
 
 
765
 
766
+ return $this;
 
 
 
 
 
 
 
767
  }
 
768
 
769
+ public function getNumBlocks() {
770
+ return $this->_numBlocks;
 
 
 
 
 
 
771
  }
 
 
772
 
773
+ protected function setNumBlocks( $numBlocks = NULL ) {
774
+ if ( is_null( $numBlocks ) ){
775
+ $this->_numBlocks = (int)( $this->_dataSize / $this->_blockAlign ); // do not count incomplete sample blocks
776
+ }
777
+ else {
778
+ $this->_numBlocks = $numBlocks;
779
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
 
781
+ return $this;
 
 
 
 
 
 
 
 
 
782
  }
783
 
784
+ public function getByteRate() {
785
+ return $this->_byteRate;
786
+ }
787
 
788
+ protected function setByteRate( $byteRate = NULL ) {
789
+ if ( is_null( $byteRate ) ){
790
+ $this->_byteRate = $this->_sampleRate * $this->_numChannels * $this->_bitsPerSample / 8;
791
+ }
792
+ else {
793
+ $this->_byteRate = $byteRate;
794
+ }
795
 
796
+ return $this;
 
 
 
 
 
 
 
 
 
 
797
  }
798
 
799
+ public function getSamples() {
800
+ return $this->_samples;
801
+ }
802
 
803
+ public function setSamples( &$samples = '' ) {
804
+ if ( strlen( $samples ) % $this->_blockAlign != 0 ){
805
+ throw new Yop_Poll_WavFileException( 'Incorrect samples size. Has to be a multiple of BlockAlign.' );
806
+ }
807
 
808
+ $this->_samples = $samples;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
809
 
810
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
811
 
812
+ return $this;
 
 
 
813
  }
814
 
 
 
 
815
 
816
+ /*%******************************************************************************************%*/
817
+ // Getters
 
 
 
 
 
 
 
818
 
819
+ public function getMinAmplitude() {
820
+ if ( $this->_bitsPerSample == 8 ){
821
+ return 0;
822
+ }
823
+ elseif ( $this->_bitsPerSample == 32 ) {
824
+ return -1.0;
825
+ }
826
+ else {
827
+ return -( 1 << ( $this->_bitsPerSample - 1 ) );
828
+ }
829
+ }
 
830
 
831
+ public function getZeroAmplitude() {
832
+ if ( $this->_bitsPerSample == 8 ){
833
+ return 0x80;
834
+ }
835
+ elseif ( $this->_bitsPerSample == 32 ) {
836
+ return 0.0;
837
+ }
838
+ else {
839
+ return 0;
840
+ }
841
+ }
842
 
843
+ public function getMaxAmplitude() {
844
+ if ( $this->_bitsPerSample == 8 ){
845
+ return 0xFF;
846
+ }
847
+ elseif ( $this->_bitsPerSample == 32 ) {
848
+ return 1.0;
849
+ }
850
+ else {
851
+ return ( 1 << ( $this->_bitsPerSample - 1 ) ) - 1;
852
+ }
853
  }
854
 
 
 
 
855
 
856
+ /*%******************************************************************************************%*/
857
+ // Wave file methods
858
+
859
+ /**
860
+ * Construct a wav header from this object. Includes "fact" chunk in necessary.
861
+ * http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html
862
+ *
863
+ * @return string The RIFF header data.
864
+ */
865
+ public function makeHeader() {
866
+ // reset and recalculate
867
+ $this->setAudioFormat(); // implicit setAudioSubFormat(), setFactChunkSize(), setFmtExtendedSize(), setFmtChunkSize(), setSize(), setActualSize(), setDataOffset()
868
+ $this->setNumBlocks();
869
+
870
+ // RIFF header
871
+ $header = pack( 'N', 0x52494646 ); // ChunkID - "RIFF"
872
+ $header .= pack( 'V', $this->getChunkSize() ); // ChunkSize
873
+ $header .= pack( 'N', 0x57415645 ); // Format - "WAVE"
874
+
875
+ // "fmt " subchunk
876
+ $header .= pack( 'N', 0x666d7420 ); // SubchunkID - "fmt "
877
+ $header .= pack( 'V', $this->getFmtChunkSize() ); // SubchunkSize
878
+ $header .= pack( 'v', $this->getAudioFormat() ); // AudioFormat
879
+ $header .= pack( 'v', $this->getNumChannels() ); // NumChannels
880
+ $header .= pack( 'V', $this->getSampleRate() ); // SampleRate
881
+ $header .= pack( 'V', $this->getByteRate() ); // ByteRate
882
+ $header .= pack( 'v', $this->getBlockAlign() ); // BlockAlign
883
+ $header .= pack( 'v', $this->getBitsPerSample() ); // BitsPerSample
884
+ if ( $this->getFmtExtendedSize() == 24 ){
885
+ $header .= pack( 'v', 22 ); // extension size = 24 bytes, cbSize: 24 - 2 = 22 bytes
886
+ $header .= pack( 'v', $this->getValidBitsPerSample() ); // ValidBitsPerSample
887
+ $header .= pack( 'V', $this->getChannelMask() ); // ChannelMask
888
+ $header .= pack( 'H32', $this->getAudioSubFormat() ); // SubFormat
889
+ }
890
+ elseif ( $this->getFmtExtendedSize() == 2 ) {
891
+ $header .= pack( 'v', 0 ); // extension size = 2 bytes, cbSize: 2 - 2 = 0 bytes
892
+ }
893
 
894
+ // "fact" subchunk
895
+ if ( $this->getFactChunkSize() == 4 ){
896
+ $header .= pack( 'N', 0x66616374 ); // SubchunkID - "fact"
897
+ $header .= pack( 'V', 4 ); // SubchunkSize
898
+ $header .= pack( 'V', $this->getNumBlocks() ); // SampleLength (per channel)
899
+ }
900
 
901
+ return $header;
 
 
 
 
 
 
 
 
 
 
902
  }
903
 
904
+ /**
905
+ * Construct wav DATA chunk.
906
+ *
907
+ * @return string The DATA header and chunk.
908
+ */
909
+ public function getDataSubchunk() {
910
+ // check preconditions
911
+ if ( !$this->_dataSize_valid ){
912
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
913
+ }
914
 
 
915
 
916
+ // create subchunk
917
+ return pack( 'N', 0x64617461 ) . // SubchunkID - "data"
918
+ pack( 'V', $this->getDataSize() ) . // SubchunkSize
919
+ $this->_samples . // Subchunk data
920
+ ( $this->getDataSize() & 1 ? chr( 0 ) : '' ); // padding byte
921
+ }
922
+
923
+ /**
924
+ * Save the wav data to a file.
925
+ *
926
+ * @param string $filename (Required) The file path to save the wav to.
927
+ *
928
+ * @throws Yop_Poll_WavFileException
929
+ */
930
+ public function save( $filename ) {
931
+ $fp = @fopen( $filename, 'w+b' );
932
+ if ( !is_resource( $fp ) ){
933
+ throw new Yop_Poll_WavFileException( 'Failed to open "' . $filename . '" for writing.' );
934
+ }
935
 
936
+ fwrite( $fp, $this->makeHeader() );
937
+ fwrite( $fp, $this->getDataSubchunk() );
938
+ fclose( $fp );
939
+
940
+ return $this;
 
 
 
 
 
 
941
  }
942
 
943
+ /**
944
+ * Reads a wav header and data from a file.
945
+ *
946
+ * @param string $filename (Required) The path to the wav file to read.
947
+ * @param bool $readData (Optional) If true, also read the data chunk.
948
+ *
949
+ * @throws Yop_Poll_WavFormatException
950
+ * @throws Yop_Poll_WavFileException
951
+ */
952
+ public function openWav( $filename, $readData = true ) {
953
+ // check preconditions
954
+ if ( !file_exists( $filename ) ){
955
+ throw new Yop_Poll_WavFileException( 'Failed to open "' . $filename . '". File not found.' );
956
+ }
957
+ elseif ( !is_readable( $filename ) ) {
958
+ throw new Yop_Poll_WavFileException( 'Failed to open "' . $filename . '". File is not readable.' );
959
+ }
960
+ elseif ( is_resource( $this->_fp ) ) {
961
+ $this->closeWav();
962
+ }
963
 
 
964
 
965
+ // open the file
966
+ $this->_fp = @fopen( $filename, 'rb' );
967
+ if ( !is_resource( $this->_fp ) ){
968
+ throw new Yop_Poll_WavFileException( 'Failed to open "' . $filename . '".' );
969
+ }
970
 
971
+ // read the file
972
+ return $this->readWav( $readData );
 
 
973
  }
974
 
975
+ /**
976
+ * Close a with openWav() previously opened wav file or free the buffer of setWavData().
977
+ * Not necessary if the data has been read (readData = true) already.
978
+ */
979
+ public function closeWav() {
980
+ if ( is_resource( $this->_fp ) ){
981
+ fclose( $this->_fp );
982
+ }
983
 
984
+ return $this;
 
 
 
 
985
  }
986
 
987
+ /**
988
+ * Set the wav file data and properties from a wav file in a string.
989
+ *
990
+ * @param string $data (Required) The wav file data. Passed by reference.
991
+ * @param bool $free (Optional) True to free the passed $data after copying.
992
+ *
993
+ * @throws Yop_Poll_WavFormatException
994
+ * @throws Yop_Poll_WavFileException
995
+ */
996
+ public function setWavData( &$data, $free = true ) {
997
+ // check preconditions
998
+ if ( is_resource( $this->_fp ) ){
999
+ $this->closeWav();
1000
+ }
1001
 
 
 
 
1002
 
1003
+ // open temporary stream in memory
1004
+ $this->_fp = @fopen( 'php://memory', 'w+b' );
1005
+ if ( !is_resource( $this->_fp ) ){
1006
+ throw new Yop_Poll_WavFileException( 'Failed to open memory stream to write wav data. Use openWav() instead.' );
1007
+ }
1008
 
1009
+ // prepare stream
1010
+ fwrite( $this->_fp, $data );
1011
+ rewind( $this->_fp );
1012
 
1013
+ // free the passed data
1014
+ if ( $free ){
1015
+ $data = NULL;
1016
+ }
1017
 
1018
+ // read the stream like a file
1019
+ return $this->readWav( true );
1020
+ }
1021
+
1022
+ /**
1023
+ * Read wav file from a stream.
1024
+ *
1025
+ * @param $readData (Optional) If true, also read the data chunk.
1026
+ *
1027
+ * @throws Yop_Poll_WavFormatException
1028
+ * @throws Yop_Poll_WavFileException
1029
+ */
1030
+ protected function readWav( $readData = true ) {
1031
+ if ( !is_resource( $this->_fp ) ){
1032
+ throw new Yop_Poll_WavFileException( 'No wav file open. Use openWav() first.' );
1033
+ }
1034
 
1035
+ try {
1036
+ $this->readWavHeader();
1037
+ } catch ( Yop_Poll_WavFileException $ex ) {
1038
+ $this->closeWav();
1039
+ throw $ex;
1040
+ }
1041
 
1042
+ if ( $readData ){
1043
+ return $this->readWavData();
1044
+ }
 
 
 
1045
 
1046
+ return $this;
 
1047
  }
1048
 
1049
+ /**
1050
+ * Parse a wav header.
1051
+ * http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/wave.html
1052
+ *
1053
+ * @throws Yop_Poll_WavFormatException
1054
+ * @throws Yop_Poll_WavFileException
1055
+ */
1056
+ protected function readWavHeader() {
1057
+ if ( !is_resource( $this->_fp ) ){
1058
+ throw new Yop_Poll_WavFileException( 'No wav file open. Use openWav() first.' );
1059
+ }
1060
 
1061
+ // get actual file size
1062
+ $stat = fstat( $this->_fp );
1063
+ $actualSize = $stat['size'];
 
 
 
1064
 
1065
+ $this->_actualSize = $actualSize;
 
 
 
 
 
1066
 
 
 
 
 
 
 
1067
 
1068
+ // read the common header
1069
+ $header = fread( $this->_fp, 36 ); // minimum size of the wav header
1070
+ if ( strlen( $header ) < 36 ){
1071
+ throw new Yop_Poll_WavFormatException( 'Not wav format. Header too short.', 1 );
1072
+ }
1073
+
 
1074
 
1075
+ // check "RIFF" header
1076
+ $RIFF = unpack( 'NChunkID/VChunkSize/NFormat', $header );
1077
 
1078
+ if ( $RIFF['ChunkID'] != 0x52494646 ){ // "RIFF"
1079
+ throw new Yop_Poll_WavFormatException( 'Not wav format. "RIFF" signature missing.', 2 );
 
 
 
 
 
1080
  }
 
1081
 
1082
+ if ( $actualSize - 8 < $RIFF['ChunkSize'] ){
1083
+ trigger_error( '"RIFF" chunk size does not match actual file size. Found ' . $RIFF['ChunkSize'] . ', expected ' . ( $actualSize - 8 ) . '.', E_USER_NOTICE );
1084
+ $RIFF['ChunkSize'] = $actualSize - 8;
1085
+ //throw new Yop_Poll_WavFormatException('"RIFF" chunk size does not match actual file size. Found ' . $RIFF['ChunkSize'] . ', expected ' . ($actualSize - 8) . '.', 3);
1086
+ }
1087
 
1088
+ if ( $RIFF['Format'] != 0x57415645 ){ // "WAVE"
1089
+ throw new Yop_Poll_WavFormatException( 'Not wav format. "RIFF" chunk format is not "WAVE".', 4 );
 
 
1090
  }
1091
 
1092
+ $this->_chunkSize = $RIFF['ChunkSize'];
1093
 
 
 
 
 
 
1094
 
1095
+ // check common "fmt " subchunk
1096
+ $fmt = unpack( 'NSubchunkID/VSubchunkSize/vAudioFormat/vNumChannels/'
1097
+ . 'VSampleRate/VByteRate/vBlockAlign/vBitsPerSample',
1098
+ substr( $header, 12 ) );
 
1099
 
1100
+ if ( $fmt['SubchunkID'] != 0x666d7420 ){ // "fmt "
1101
+ throw new Yop_Poll_WavFormatException( 'Bad wav header. Expected "fmt " subchunk.', 11 );
 
 
1102
  }
1103
 
1104
+ if ( $fmt['SubchunkSize'] < 16 ){
1105
+ throw new Yop_Poll_WavFormatException( 'Bad "fmt " subchunk size.', 12 );
 
 
1106
  }
1107
 
1108
+ if ( $fmt['AudioFormat'] != self::WAVE_FORMAT_PCM
1109
+ && $fmt['AudioFormat'] != self::WAVE_FORMAT_IEEE_FLOAT
1110
+ && $fmt['AudioFormat'] != self::WAVE_FORMAT_EXTENSIBLE
1111
+ ){
1112
+ throw new Yop_Poll_WavFormatException( 'Unsupported audio format. Only PCM or IEEE FLOAT (EXTENSIBLE) audio is supported.', 13 );
 
 
 
 
 
 
 
 
1113
  }
1114
 
1115
+ if ( $fmt['NumChannels'] < 1 || $fmt['NumChannels'] > self::MAX_CHANNEL ){
1116
+ throw new Yop_Poll_WavFormatException( 'Invalid number of channels in "fmt " subchunk.', 14 );
1117
+ }
 
1118
 
1119
+ if ( $fmt['SampleRate'] < 1 || $fmt['SampleRate'] > self::MAX_SAMPLERATE ){
1120
+ throw new Yop_Poll_WavFormatException( 'Invalid sample rate in "fmt " subchunk.', 15 );
1121
+ }
 
 
 
1122
 
1123
+ if ( ( $fmt['AudioFormat'] == self::WAVE_FORMAT_PCM && !in_array( $fmt['BitsPerSample'], array( 8, 16, 24 ) ) )
1124
+ || ( $fmt['AudioFormat'] == self::WAVE_FORMAT_IEEE_FLOAT && $fmt['BitsPerSample'] != 32 )
1125
+ || ( $fmt['AudioFormat'] == self::WAVE_FORMAT_EXTENSIBLE && !in_array( $fmt['BitsPerSample'], array( 8, 16, 24, 32 ) ) )
1126
+ ){
1127
+ throw new Yop_Poll_WavFormatException( 'Only 8, 16 and 24-bit PCM and 32-bit IEEE FLOAT (EXTENSIBLE) audio is supported.', 16 );
1128
+ }
1129
 
1130
+ $blockAlign = $fmt['NumChannels'] * $fmt['BitsPerSample'] / 8;
1131
+ if ( $blockAlign != $fmt['BlockAlign'] ){
1132
+ trigger_error( 'Invalid block align in "fmt " subchunk. Found ' . $fmt['BlockAlign'] . ', expected ' . $blockAlign . '.', E_USER_NOTICE );
1133
+ $fmt['BlockAlign'] = $blockAlign;
1134
+ //throw new Yop_Poll_WavFormatException('Invalid block align in "fmt " subchunk. Found ' . $fmt['BlockAlign'] . ', expected ' . $blockAlign . '.', 17);
1135
+ }
1136
 
1137
+ $byteRate = $fmt['SampleRate'] * $blockAlign;
1138
+ if ( $byteRate != $fmt['ByteRate'] ){
1139
+ trigger_error( 'Invalid average byte rate in "fmt " subchunk. Found ' . $fmt['ByteRate'] . ', expected ' . $byteRate . '.', E_USER_NOTICE );
1140
+ $fmt['ByteRate'] = $byteRate;
1141
+ //throw new Yop_Poll_WavFormatException('Invalid average byte rate in "fmt " subchunk. Found ' . $fmt['ByteRate'] . ', expected ' . $byteRate . '.', 18);
1142
  }
1143
 
1144
+ $this->_fmtChunkSize = $fmt['SubchunkSize'];
1145
+ $this->_audioFormat = $fmt['AudioFormat'];
1146
+ $this->_numChannels = $fmt['NumChannels'];
1147
+ $this->_sampleRate = $fmt['SampleRate'];
1148
+ $this->_byteRate = $fmt['ByteRate'];
1149
+ $this->_blockAlign = $fmt['BlockAlign'];
1150
+ $this->_bitsPerSample = $fmt['BitsPerSample'];
1151
 
1152
+
1153
+ // read extended "fmt " subchunk data
1154
+ $extendedFmt = '';
1155
+ if ( $fmt['SubchunkSize'] > 16 ){
1156
  // possibly handle malformed subchunk without a padding byte
1157
+ $extendedFmt = fread( $this->_fp, $fmt['SubchunkSize'] - 16 + ( $fmt['SubchunkSize'] & 1 ) ); // also read padding byte
1158
+ if ( strlen( $extendedFmt ) < $fmt['SubchunkSize'] - 16 ){
1159
+ throw new Yop_Poll_WavFormatException( 'Not wav format. Header too short.', 1 );
1160
  }
1161
+ }
1162
 
 
 
1163
 
1164
+ // check extended "fmt " for EXTENSIBLE Audio Format
1165
+ if ( $fmt['AudioFormat'] == self::WAVE_FORMAT_EXTENSIBLE ){
1166
+ if ( strlen( $extendedFmt ) < 24 ){
1167
+ throw new Yop_Poll_WavFormatException( 'Invalid EXTENSIBLE "fmt " subchunk size. Found ' . $fmt['SubchunkSize'] . ', expected at least 40.', 19 );
1168
+ }
1169
 
1170
+ $extensibleFmt = unpack( 'vSize/vValidBitsPerSample/VChannelMask/H32SubFormat', substr( $extendedFmt, 0, 24 ) );
1171
 
1172
+ if ( $extensibleFmt['SubFormat'] != self::WAVE_SUBFORMAT_PCM
1173
+ && $extensibleFmt['SubFormat'] != self::WAVE_SUBFORMAT_IEEE_FLOAT
1174
+ ){
1175
+ throw new Yop_Poll_WavFormatException( 'Unsupported audio format. Only PCM or IEEE FLOAT (EXTENSIBLE) audio is supported.', 13 );
 
 
 
 
1176
  }
 
 
1177
 
1178
+ if ( ( $extensibleFmt['SubFormat'] == self::WAVE_SUBFORMAT_PCM && !in_array( $fmt['BitsPerSample'], array( 8, 16, 24 ) ) )
1179
+ || ( $extensibleFmt['SubFormat'] == self::WAVE_SUBFORMAT_IEEE_FLOAT && $fmt['BitsPerSample'] != 32 )
1180
+ ){
1181
+ throw new Yop_Poll_WavFormatException( 'Only 8, 16 and 24-bit PCM and 32-bit IEEE FLOAT (EXTENSIBLE) audio is supported.', 16 );
1182
+ }
1183
 
1184
+ if ( $extensibleFmt['Size'] != 22 ){
1185
+ trigger_error( 'Invaid extension size in EXTENSIBLE "fmt " subchunk.', E_USER_NOTICE );
1186
+ $extensibleFmt['Size'] = 22;
1187
+ //throw new Yop_Poll_WavFormatException('Invaid extension size in EXTENSIBLE "fmt " subchunk.', 20);
1188
+ }
1189
 
1190
+ if ( $extensibleFmt['ValidBitsPerSample'] != $fmt['BitsPerSample'] ){
1191
+ trigger_error( 'Invaid or unsupported valid bits per sample in EXTENSIBLE "fmt " subchunk.', E_USER_NOTICE );
1192
+ $extensibleFmt['ValidBitsPerSample'] = $fmt['BitsPerSample'];
1193
+ //throw new Yop_Poll_WavFormatException('Invaid or unsupported valid bits per sample in EXTENSIBLE "fmt " subchunk.', 21);
1194
+ }
 
 
1195
 
1196
+ if ( $extensibleFmt['ChannelMask'] != 0 ){
1197
+ // count number of set bits - Hamming weight
1198
+ $c = (int)$extensibleFmt['ChannelMask'];
1199
+ $n = 0;
1200
+ while ( $c > 0 ) {
1201
+ $n += $c & 1;
1202
+ $c >>= 1;
1203
+ }
1204
+ if ( $n != $fmt['NumChannels'] || ( ( (int)$extensibleFmt['ChannelMask'] | self::SPEAKER_ALL ) != self::SPEAKER_ALL ) ){
1205
+ trigger_error( 'Invalid channel mask in EXTENSIBLE "fmt " subchunk. The number of channels does not match the number of locations in the mask.', E_USER_NOTICE );
1206
+ $extensibleFmt['ChannelMask'] = 0;
1207
+ //throw new Yop_Poll_WavFormatException('Invalid channel mask in EXTENSIBLE "fmt " subchunk. The number of channels does not match the number of locations in the mask.', 22);
1208
+ }
1209
+ }
1210
 
1211
+ $this->_fmtExtendedSize = strlen( $extendedFmt );
1212
+ $this->_validBitsPerSample = $extensibleFmt['ValidBitsPerSample'];
1213
+ $this->_channelMask = $extensibleFmt['ChannelMask'];
1214
+ $this->_audioSubFormat = $extensibleFmt['SubFormat'];
1215
 
1216
+ }
1217
+ else {
1218
+ $this->_fmtExtendedSize = strlen( $extendedFmt );
1219
+ $this->_validBitsPerSample = $fmt['BitsPerSample'];
1220
+ $this->_channelMask = 0;
1221
+ $this->_audioSubFormat = NULL;
1222
+ }
1223
 
 
 
 
1224
 
1225
+ // read additional subchunks until "data" subchunk is found
1226
+ $factSubchunk = array();
1227
+ $dataSubchunk = array();
 
 
1228
 
1229
+ while ( !feof( $this->_fp ) ) {
1230
+ $subchunkHeader = fread( $this->_fp, 8 );
1231
+ if ( strlen( $subchunkHeader ) < 8 ){
1232
+ throw new Yop_Poll_WavFormatException( 'Missing "data" subchunk.', 101 );
1233
+ }
1234
 
1235
+ $subchunk = unpack( 'NSubchunkID/VSubchunkSize', $subchunkHeader );
1236
 
1237
+ if ( $subchunk['SubchunkID'] == 0x66616374 ){ // "fact"
1238
+ // possibly handle malformed subchunk without a padding byte
1239
+ $subchunkData = fread( $this->_fp, $subchunk['SubchunkSize'] + ( $subchunk['SubchunkSize'] & 1 ) ); // also read padding byte
1240
+ if ( strlen( $subchunkData ) < 4 ){
1241
+ throw new Yop_Poll_WavFormatException( 'Invalid "fact" subchunk.', 102 );
1242
+ }
1243
 
1244
+ $factParams = unpack( 'VSampleLength', substr( $subchunkData, 0, 4 ) );
1245
+ $factSubchunk = array_merge( $subchunk, $factParams );
1246
 
1247
+ }
1248
+ elseif ( $subchunk['SubchunkID'] == 0x64617461 ) { // "data"
1249
+ $dataSubchunk = $subchunk;
 
 
 
 
 
 
 
 
 
 
1250
 
1251
+ break;
 
 
1252
 
1253
+ }
1254
+ elseif ( $subchunk['SubchunkID'] == 0x7761766C ) { // "wavl"
1255
+ throw new Yop_Poll_WavFormatException( 'Wave List Chunk ("wavl" subchunk) is not supported.', 106 );
1256
+ }
1257
+ else {
1258
+ // skip all other (unknown) subchunks
1259
+ // possibly handle malformed subchunk without a padding byte
1260
+ if ( $subchunk['SubchunkSize'] < 0
1261
+ || fseek( $this->_fp, $subchunk['SubchunkSize'] + ( $subchunk['SubchunkSize'] & 1 ), SEEK_CUR ) !== 0
1262
+ ){ // also skip padding byte
1263
+ throw new Yop_Poll_WavFormatException( 'Invalid subchunk (0x' . dechex( $subchunk['SubchunkID'] ) . ') encountered.', 103 );
1264
+ }
1265
+ }
1266
+ }
1267
 
1268
+ if ( empty( $dataSubchunk ) ){
1269
+ throw new Yop_Poll_WavFormatException( 'Missing "data" subchunk.', 101 );
1270
+ }
1271
 
 
 
 
 
1272
 
1273
+ // check "data" subchunk
1274
+ $dataOffset = ftell( $this->_fp );
1275
+ if ( $dataSubchunk['SubchunkSize'] < 0 || $actualSize - $dataOffset < $dataSubchunk['SubchunkSize'] ){
1276
+ trigger_error( 'Invalid "data" subchunk size.', E_USER_NOTICE );
1277
+ $dataSubchunk['SubchunkSize'] = $actualSize - $dataOffset;
1278
+ //throw new Yop_Poll_WavFormatException('Invalid "data" subchunk size.', 104);
1279
+ }
1280
 
1281
+ $this->_dataOffset = $dataOffset;
1282
+ $this->_dataSize = $dataSubchunk['SubchunkSize'];
1283
+ $this->_dataSize_fp = $dataSubchunk['SubchunkSize'];
1284
+ $this->_dataSize_valid = false;
1285
+ $this->_samples = '';
1286
 
1287
 
1288
+ // check "fact" subchunk
1289
+ $numBlocks = (int)( $dataSubchunk['SubchunkSize'] / $fmt['BlockAlign'] );
1290
 
1291
+ if ( empty( $factSubchunk ) ){ // construct fake "fact" subchunk
1292
+ $factSubchunk = array( 'SubchunkSize' => 0, 'SampleLength' => $numBlocks );
1293
+ }
 
 
 
 
 
 
 
 
 
1294
 
1295
+ if ( $factSubchunk['SampleLength'] != $numBlocks ){
1296
+ trigger_error( 'Invalid sample length in "fact" subchunk.', E_USER_NOTICE );
1297
+ $factSubchunk['SampleLength'] = $numBlocks;
1298
+ //throw new Yop_Poll_WavFormatException('Invalid sample length in "fact" subchunk.', 105);
1299
+ }
1300
 
1301
+ $this->_factChunkSize = $factSubchunk['SubchunkSize'];
1302
+ $this->_numBlocks = $factSubchunk['SampleLength'];
1303
 
 
 
 
1304
 
1305
+ return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1306
 
 
 
1307
  }
1308
 
1309
+ /**
1310
+ * Read the wav data from the file into the buffer.
1311
+ *
1312
+ * @param $dataOffset (Optional) The byte offset to skip before starting to read. Must be a multiple of BlockAlign.
1313
+ * @param $dataSize (Optional) The size of the data to read in bytes. Must be a multiple of BlockAlign. Defaults to all data.
1314
+ *
1315
+ * @throws Yop_Poll_WavFileException
1316
+ */
1317
+ public function readWavData( $dataOffset = 0, $dataSize = NULL ) {
1318
+ // check preconditions
1319
+ if ( !is_resource( $this->_fp ) ){
1320
+ throw new Yop_Poll_WavFileException( 'No wav file open. Use openWav() first.' );
1321
+ }
1322
 
1323
+ if ( $dataOffset < 0 || $dataOffset % $this->getBlockAlign() > 0 ){
1324
+ throw new Yop_Poll_WavFileException( 'Invalid data offset. Has to be a multiple of BlockAlign.' );
1325
+ }
1326
 
1327
+ if ( is_null( $dataSize ) ){
1328
+ $dataSize = $this->_dataSize_fp - ( $this->_dataSize_fp % $this->getBlockAlign() ); // only read complete blocks
1329
+ }
1330
+ elseif ( $dataSize < 0 || $dataSize % $this->getBlockAlign() > 0 ) {
1331
+ throw new Yop_Poll_WavFileException( 'Invalid data size to read. Has to be a multiple of BlockAlign.' );
 
 
 
 
 
 
 
1332
  }
 
1333
 
 
 
1334
 
1335
+ // skip offset
1336
+ if ( $dataOffset > 0 && fseek( $this->_fp, $dataOffset, SEEK_CUR ) !== 0 ){
1337
+ throw new Yop_Poll_WavFileException( 'Seeking to data offset failed.' );
1338
+ }
 
 
 
 
 
 
 
 
 
 
1339
 
1340
+ // read data
1341
+ $this->_samples .= fread( $this->_fp, $dataSize ); // allow appending
1342
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1343
 
1344
+ // close file or memory stream
1345
+ return $this->closeWav();
 
 
1346
  }
1347
 
 
 
1348
 
1349
+ /*%******************************************************************************************%*/
1350
+ // Sample manipulation methods
 
 
 
1351
 
1352
+ /**
1353
+ * Return a single sample block from the file.
1354
+ *
1355
+ * @param int $blockNum (Required) The sample block number. Zero based.
1356
+ *
1357
+ * @return string The binary sample block (all channels). Returns null if the sample block number was out of range.
1358
+ */
1359
+ public function getSampleBlock( $blockNum ) {
1360
+ // check preconditions
1361
+ if ( !$this->_dataSize_valid ){
1362
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1363
+ }
 
 
 
 
 
1364
 
1365
+ $offset = $blockNum * $this->_blockAlign;
1366
+ if ( $offset + $this->_blockAlign > $this->_dataSize || $offset < 0 ){
1367
+ return NULL;
1368
+ }
1369
 
 
 
 
 
1370
 
1371
+ // read data
1372
+ return substr( $this->_samples, $offset, $this->_blockAlign );
1373
+ }
1374
+
1375
+ /**
1376
+ * Set a single sample block. <br />
1377
+ * Allows to append a sample block.
1378
+ *
1379
+ * @param string $sampleBlock (Required) The binary sample block (all channels).
1380
+ * @param int $blockNum (Required) The sample block number. Zero based.
1381
+ *
1382
+ * @throws Yop_Poll_WavFileException
1383
+ */
1384
+ public function setSampleBlock( $sampleBlock, $blockNum ) {
1385
+ // check preconditions
1386
+ $blockAlign = $this->_blockAlign;
1387
+ if ( !isset( $sampleBlock[$blockAlign - 1] ) || isset( $sampleBlock[$blockAlign] ) ){ // faster than: if (strlen($sampleBlock) != $blockAlign)
1388
+ throw new Yop_Poll_WavFileException( 'Incorrect sample block size. Got ' . strlen( $sampleBlock ) . ', expected ' . $blockAlign . '.' );
1389
+ }
1390
 
1391
+ if ( !$this->_dataSize_valid ){
1392
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1393
+ }
1394
 
1395
+ $numBlocks = (int)( $this->_dataSize / $blockAlign );
1396
+ $offset = $blockNum * $blockAlign;
1397
+ if ( $blockNum > $numBlocks || $blockNum < 0 ){ // allow appending
1398
+ throw new Yop_Poll_WavFileException( 'Sample block number is out of range.' );
1399
+ }
1400
+
1401
+
1402
+ // replace or append data
1403
+ if ( $blockNum == $numBlocks ){
1404
+ // append
1405
+ $this->_samples .= $sampleBlock;
1406
+ $this->_dataSize += $blockAlign;
1407
+ $this->_chunkSize += $blockAlign;
1408
+ $this->_actualSize += $blockAlign;
1409
+ $this->_numBlocks++;
1410
+ }
1411
+ else {
1412
+ // replace
1413
+ for ( $i = 0; $i < $blockAlign; ++$i ) {
1414
+ $this->_samples[$offset + $i] = $sampleBlock[$i];
1415
+ }
1416
+ }
1417
+
1418
+ return $this;
1419
  }
1420
 
1421
+ /**
1422
+ * Get a float sample value for a specific sample block and channel number.
1423
+ *
1424
+ * @param int $blockNum (Required) The sample block number to fetch. Zero based.
1425
+ * @param int $channelNum (Required) The channel number within the sample block to fetch. First channel is 1.
1426
+ *
1427
+ * @return float The float sample value. Returns null if the sample block number was out of range.
1428
+ * @throws Yop_Poll_WavFileException
1429
+ */
1430
+ public function getSampleValue( $blockNum, $channelNum ) {
1431
+ // check preconditions
1432
+ if ( $channelNum < 1 || $channelNum > $this->_numChannels ){
1433
+ throw new Yop_Poll_WavFileException( 'Channel number is out of range.' );
1434
+ }
1435
+
1436
+ if ( !$this->_dataSize_valid ){
1437
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1438
+ }
1439
+
1440
+ $sampleBytes = $this->_bitsPerSample / 8;
1441
+ $offset = $blockNum * $this->_blockAlign + ( $channelNum - 1 ) * $sampleBytes;
1442
+ if ( $offset + $sampleBytes > $this->_dataSize || $offset < 0 ){
1443
+ return NULL;
1444
+ }
1445
 
1446
+ // read binary value
1447
+ $sampleBinary = substr( $this->_samples, $offset, $sampleBytes );
1448
+
1449
+ // convert binary to value
1450
+ switch ( $this->_bitsPerSample ) {
1451
+ case 8:
1452
+ // unsigned char
1453
+ return (float)( ( ord( $sampleBinary ) - 0x80 ) / 0x80 );
1454
+
1455
+ case 16:
1456
+ // signed short, little endian
1457
+ $data = unpack( 'v', $sampleBinary );
1458
+ $sample = $data[1];
1459
+ if ( $sample >= 0x8000 ){
1460
+ $sample -= 0x10000;
1461
+ }
1462
+ return (float)( $sample / 0x8000 );
1463
+
1464
+ case 24:
1465
+ // 3 byte packed signed integer, little endian
1466
+ $data = unpack( 'C3', $sampleBinary );
1467
+ $sample = $data[1] | ( $data[2] << 8 ) | ( $data[3] << 16 );
1468
+ if ( $sample >= 0x800000 ){
1469
+ $sample -= 0x1000000;
1470
+ }
1471
+ return (float)( $sample / 0x800000 );
1472
 
1473
+ case 32:
1474
+ // 32-bit float
1475
+ $data = unpack( 'f', $sampleBinary );
1476
+ return (float)$data[1];
1477
 
1478
+ default:
1479
+ return NULL;
 
 
 
1480
  }
1481
  }
1482
 
1483
+ /**
1484
+ * Sets a float sample value for a specific sample block number and channel. <br />
1485
+ * Converts float values to appropriate integer values and clips properly. <br />
1486
+ * Allows to append samples (in order).
1487
+ *
1488
+ * @param float $sampleFloat (Required) The float sample value to set. Converts float values and clips if necessary.
1489
+ * @param int $blockNum (Required) The sample block number to set or append. Zero based.
1490
+ * @param int $channelNum (Required) The channel number within the sample block to set or append. First channel is 1.
1491
+ *
1492
+ * @throws Yop_Poll_WavFileException
1493
+ */
1494
+ public function setSampleValue( $sampleFloat, $blockNum, $channelNum ) {
1495
+ // check preconditions
1496
+ if ( $channelNum < 1 || $channelNum > $this->_numChannels ){
1497
+ throw new Yop_Poll_WavFileException( 'Channel number is out of range.' );
1498
+ }
1499
+
1500
+ if ( !$this->_dataSize_valid ){
1501
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1502
+ }
1503
 
1504
+ $dataSize = $this->_dataSize;
1505
+ $bitsPerSample = $this->_bitsPerSample;
1506
+ $sampleBytes = $bitsPerSample / 8;
1507
+ $offset = $blockNum * $this->_blockAlign + ( $channelNum - 1 ) * $sampleBytes;
1508
+ if ( ( $offset + $sampleBytes > $dataSize && $offset != $dataSize ) || $offset < 0 ){ // allow appending
1509
+ throw new Yop_Poll_WavFileException( 'Sample block or channel number is out of range.' );
1510
+ }
1511
 
 
 
 
 
 
 
 
1512
 
1513
+ // convert to value, quantize and clip
1514
+ if ( $bitsPerSample == 32 ){
1515
+ $sample = $sampleFloat < -1.0 ? -1.0 : ( $sampleFloat > 1.0 ? 1.0 : $sampleFloat );
1516
+ }
1517
+ else {
1518
+ $p = 1 << ( $bitsPerSample - 1 ); // 2 to the power of _bitsPerSample divided by 2
1519
 
1520
+ // project and quantize (round) float to integer values
1521
+ $sample = $sampleFloat < 0 ? (int)( $sampleFloat * $p - 0.5 ) : (int)( $sampleFloat * $p + 0.5 );
 
 
 
1522
 
1523
+ // clip if necessary to [-$p, $p - 1]
1524
+ if ( $sample < -$p ){
1525
+ $sample = -$p;
1526
+ }
1527
+ elseif ( $sample > $p - 1 ) {
1528
+ $sample = $p - 1;
1529
+ }
 
 
 
 
 
1530
  }
 
1531
 
1532
+ // convert to binary
1533
+ switch ( $bitsPerSample ) {
1534
+ case 8:
1535
+ // unsigned char
1536
+ $sampleBinary = chr( $sample + 0x80 );
1537
+ break;
1538
+
1539
+ case 16:
1540
+ // signed short, little endian
1541
+ if ( $sample < 0 ){
1542
+ $sample += 0x10000;
1543
+ }
1544
+ $sampleBinary = pack( 'v', $sample );
1545
+ break;
1546
 
1547
+ case 24:
1548
+ // 3 byte packed signed integer, little endian
1549
+ if ( $sample < 0 ){
1550
+ $sample += 0x1000000;
1551
+ }
1552
+ $sampleBinary = pack( 'C3', $sample & 0xff, ( $sample >> 8 ) & 0xff, ( $sample >> 16 ) & 0xff );
1553
+ break;
1554
+
1555
+ case 32:
1556
+ // 32-bit float
1557
+ $sampleBinary = pack( 'f', $sample );
1558
+ break;
1559
+
1560
+ default:
1561
+ $sampleBinary = NULL;
1562
+ $sampleBytes = 0;
1563
+ break;
1564
+ }
1565
 
1566
+ // replace or append data
1567
+ if ( $offset == $dataSize ){
1568
+ // append
1569
+ $this->_samples .= $sampleBinary;
1570
+ $this->_dataSize += $sampleBytes;
1571
+ $this->_chunkSize += $sampleBytes;
1572
+ $this->_actualSize += $sampleBytes;
1573
+ $this->_numBlocks = (int)( $this->_dataSize / $this->_blockAlign );
1574
+ }
1575
+ else {
1576
+ // replace
1577
+ for ( $i = 0; $i < $sampleBytes; ++$i ) {
1578
+ $this->_samples{$offset + $i} = $sampleBinary{$i};
1579
+ }
1580
+ }
1581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1582
  return $this;
1583
  }
1584
 
1585
+
1586
+ /*%******************************************************************************************%*/
1587
+ // Audio processing methods
1588
+
1589
+ /**
1590
+ * Run samples through audio processing filters.
1591
+ *
1592
+ * <code>
1593
+ * $wav->filter(
1594
+ * array(
1595
+ * Yop_Poll_WavFile::FILTER_MIX => array( // Filter for mixing 2 Yop_Poll_WavFile instances.
1596
+ * 'wav' => $wav2, // (Required) The Yop_Poll_WavFile to mix into this WhavFile. If no optional arguments are given, can be passed without the array.
1597
+ * 'loop' => true, // (Optional) Loop the selected portion (with warping to the beginning at the end).
1598
+ * 'blockOffset' => 0, // (Optional) Block number to start mixing from.
1599
+ * 'numBlocks' => null // (Optional) Number of blocks to mix in or to select for looping. Defaults to the end or all data for looping.
1600
+ * ),
1601
+ * Yop_Poll_WavFile::FILTER_NORMALIZE => 0.6, // (Required) Normalization of (mixed) audio samples - see threshold parameter for normalizeSample().
1602
+ * Yop_Poll_WavFile::FILTER_DEGRADE => 0.9 // (Required) Introduce random noise. The quality relative to the amplitude. 1 = no noise, 0 = max. noise.
1603
+ * ),
1604
+ * 0, // (Optional) The block number of this Yop_Poll_WavFile to start with.
1605
+ * null // (Optional) The number of blocks to process.
1606
+ * );
1607
+ * </code>
1608
+ *
1609
+ * @param array $filters (Required) An array of 1 or more audio processing filters.
1610
+ * @param int $blockOffset (Optional) The block number to start precessing from.
1611
+ * @param int $numBlocks (Optional) The maximum number of blocks to process.
1612
+ *
1613
+ * @throws Yop_Poll_WavFileException
1614
+ */
1615
+ public function filter( $filters, $blockOffset = 0, $numBlocks = NULL ) {
1616
+ // check preconditions
1617
+ $totalBlocks = $this->getNumBlocks();
1618
+ $numChannels = $this->getNumChannels();
1619
+ if ( is_null( $numBlocks ) ){
1620
+ $numBlocks = $totalBlocks - $blockOffset;
1621
  }
1622
 
1623
+ if ( !is_array( $filters ) || empty( $filters ) || $blockOffset < 0 || $blockOffset > $totalBlocks || $numBlocks <= 0 ){
1624
+ // nothing to do
1625
+ return $this;
 
 
 
 
1626
  }
1627
 
1628
+ // check filtes
1629
+ $filter_mix = false;
1630
+ if ( array_key_exists( self::FILTER_MIX, $filters ) ){
1631
+ if ( !is_array( $filters[self::FILTER_MIX] ) ){
1632
+ // assume the 'wav' parameter
1633
+ $filters[self::FILTER_MIX] = array( 'wav' => $filters[self::FILTER_MIX] );
1634
+ }
1635
+
1636
+ $mix_wav = @$filters[self::FILTER_MIX]['wav'];
1637
+ if ( !( $mix_wav instanceof Yop_Poll_WavFile ) ){
1638
+ throw new Yop_Poll_WavFileException( "WavFile to mix is missing or invalid." );
1639
+ }
1640
+ elseif ( $mix_wav->getSampleRate() != $this->getSampleRate() ) {
1641
+ throw new Yop_Poll_WavFileException( "Sample rate of Yop_Poll_WavFile to mix does not match." );
1642
+ }
1643
+ else {
1644
+ if ( $mix_wav->getNumChannels() != $this->getNumChannels() ){
1645
+ throw new Yop_Poll_WavFileException( "Number of channels of Yop_Poll_WavFile to mix does not match." );
1646
+ }
1647
+ }
1648
 
1649
+ $mix_loop = @$filters[self::FILTER_MIX]['loop'];
1650
+ if ( is_null( $mix_loop ) ){
1651
+ $mix_loop = false;
1652
+ }
1653
 
1654
+ $mix_blockOffset = @$filters[self::FILTER_MIX]['blockOffset'];
1655
+ if ( is_null( $mix_blockOffset ) ){
1656
+ $mix_blockOffset = 0;
1657
+ }
1658
 
1659
+ $mix_totalBlocks = $mix_wav->getNumBlocks();
1660
+ $mix_numBlocks = @$filters[self::FILTER_MIX]['numBlocks'];
1661
+ if ( is_null( $mix_numBlocks ) ){
1662
+ $mix_numBlocks = $mix_loop ? $mix_totalBlocks : $mix_totalBlocks - $mix_blockOffset;
1663
+ }
1664
+ $mix_maxBlock = min( $mix_blockOffset + $mix_numBlocks, $mix_totalBlocks );
1665
+
1666
+ $filter_mix = true;
1667
+ }
1668
 
1669
+ $filter_normalize = false;
1670
+ if ( array_key_exists( self::FILTER_NORMALIZE, $filters ) ){
1671
+ $normalize_threshold = @$filters[self::FILTER_NORMALIZE];
1672
 
1673
+ if ( !is_null( $normalize_threshold ) && abs( $normalize_threshold ) != 1 ){
1674
+ $filter_normalize = true;
1675
+ }
1676
+ }
1677
 
1678
+ $filter_degrade = false;
1679
+ if ( array_key_exists( self::FILTER_DEGRADE, $filters ) ){
1680
+ $degrade_quality = @$filters[self::FILTER_DEGRADE];
1681
+ if ( is_null( $degrade_quality ) ){
1682
+ $degrade_quality = 1;
1683
+ }
1684
 
1685
+ if ( $degrade_quality >= 0 && $degrade_quality < 1 ){
1686
+ $filter_degrade = true;
1687
+ }
1688
+ }
1689
 
1690
 
1691
+ // loop through all sample blocks
1692
+ for ( $block = 0; $block < $numBlocks; ++$block ) {
1693
+ // loop through all channels
1694
+ for ( $channel = 1; $channel <= $numChannels; ++$channel ) {
1695
+ // read current sample
1696
+ $currentBlock = $blockOffset + $block;
1697
+ $sampleFloat = $this->getSampleValue( $currentBlock, $channel );
1698
 
1699
 
1700
+ /************* MIX FILTER ***********************/
1701
+ if ( $filter_mix ){
1702
+ if ( $mix_loop ){
1703
+ $mixBlock = ( $mix_blockOffset + ( $block % $mix_numBlocks ) ) % $mix_totalBlocks;
1704
+ }
1705
+ else {
1706
+ $mixBlock = $mix_blockOffset + $block;
1707
+ }
1708
+
1709
+ if ( $mixBlock < $mix_maxBlock ){
1710
+ $sampleFloat += $mix_wav->getSampleValue( $mixBlock, $channel );
1711
+ }
1712
  }
1713
 
1714
+ /************* NORMALIZE FILTER *******************/
1715
+ if ( $filter_normalize ){
1716
+ $sampleFloat = $this->normalizeSample( $sampleFloat, $normalize_threshold );
1717
  }
 
1718
 
1719
+ /************* DEGRADE FILTER *******************/
1720
+ if ( $filter_degrade ){
1721
+ $sampleFloat += rand( 1000000 * ( $degrade_quality - 1 ), 1000000 * ( 1 - $degrade_quality ) ) / 1000000;
1722
+ }
1723
 
1724
+
1725
+ // write current sample
1726
+ $this->setSampleValue( $sampleFloat, $currentBlock, $channel );
1727
  }
1728
+ }
1729
 
1730
+ return $this;
1731
+ }
1732
 
1733
+ /**
1734
+ * Append a wav file to the current wav. <br />
1735
+ * The wav files must have the same sample rate, number of bits per sample, and number of channels.
1736
+ *
1737
+ * @param Yop_Poll_WavFile $wav (Required) The wav file to append.
1738
+ *
1739
+ * @throws Yop_Poll_WavFileException
1740
+ */
1741
+ public function appendWav( Yop_Poll_WavFile $wav ) {
1742
+ // basic checks
1743
+ if ( $wav->getSampleRate() != $this->getSampleRate() ){
1744
+ throw new Yop_Poll_WavFileException( "Sample rate for wav files do not match." );
1745
+ }
1746
+ else {
1747
+ if ( $wav->getBitsPerSample() != $this->getBitsPerSample() ){
1748
+ throw new Yop_Poll_WavFileException( "Bits per sample for wav files do not match." );
1749
+ }
1750
+ else {
1751
+ if ( $wav->getNumChannels() != $this->getNumChannels() ){
1752
+ throw new Yop_Poll_WavFileException( "Number of channels for wav files do not match." );
1753
+ }
1754
+ }
1755
  }
 
1756
 
1757
+ $this->_samples .= $wav->_samples;
1758
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1759
 
1760
+ return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1761
  }
1762
 
1763
+ /**
1764
+ * Mix 2 wav files together. <br />
1765
+ * Both wavs must have the same sample rate and same number of channels.
1766
+ *
1767
+ * @param Yop_Poll_WavFile $wav (Required) The Yop_Poll_WavFile to mix.
1768
+ * @param float $normalizeThreshold (Optional) See normalizeSample for an explanation.
1769
+ *
1770
+ * @throws Yop_Poll_WavFileException
1771
+ */
1772
+ public function mergeWav( Yop_Poll_WavFile $wav, $normalizeThreshold = NULL ) {
1773
+ return $this->filter( array(
1774
+ Yop_Poll_WavFile::FILTER_MIX => $wav,
1775
+ Yop_Poll_WavFile::FILTER_NORMALIZE => $normalizeThreshold
1776
+ ) );
1777
+ }
1778
+
1779
+ /**
1780
+ * Add silence to the wav file.
1781
+ *
1782
+ * @param float $duration (Optional) How many seconds of silence. If negative, add to the beginning of the file. Defaults to 1s.
1783
+ */
1784
+ public function insertSilence( $duration = 1.0 ) {
1785
+ $numSamples = $this->getSampleRate() * abs( $duration );
1786
+ $numChannels = $this->getNumChannels();
1787
+
1788
+ $data = str_repeat( self::packSample( $this->getZeroAmplitude(), $this->getBitsPerSample() ), $numSamples * $numChannels );
1789
+ if ( $duration >= 0 ){
1790
+ $this->_samples .= $data;
1791
+ }
1792
+ else {
1793
+ $this->_samples = $data . $this->_samples;
1794
+ }
1795
 
1796
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
 
 
 
 
 
 
 
 
1797
 
1798
+ return $this;
 
 
 
 
1799
  }
1800
 
1801
+ /**
1802
+ * Degrade the quality of the wav file by introducing random noise.
1803
+ *
1804
+ * @param float quality (Optional) The quality relative to the amplitude. 1 = no noise, 0 = max. noise.
1805
+ */
1806
+ public function degrade( $quality = 1.0 ) {
1807
+ return $this->filter( self::FILTER_DEGRADE, array(
1808
+ Yop_Poll_WavFile::FILTER_DEGRADE => $quality
1809
+ ) );
1810
+ }
1811
+
1812
+ /**
1813
+ * Generate noise at the end of the wav for the specified duration and volume.
1814
+ *
1815
+ * @param float $duration (Optional) Number of seconds of noise to generate.
1816
+ * @param float $percent (Optional) The percentage of the maximum amplitude to use. 100 = full amplitude.
1817
+ */
1818
+ public function generateNoise( $duration = 1.0, $percent = 100 ) {
1819
+ $numChannels = $this->getNumChannels();
1820
+ $numSamples = $this->getSampleRate() * $duration;
1821
+ $minAmp = $this->getMinAmplitude();
1822
+ $maxAmp = $this->getMaxAmplitude();
1823
+ $bitDepth = $this->getBitsPerSample();
1824
+
1825
+ for ( $s = 0; $s < $numSamples; ++$s ) {
1826
+ if ( $bitDepth == 32 ){
1827
+ $val = rand( -$percent * 10000, $percent * 10000 ) / 1000000;
1828
+ }
1829
+ else {
1830
+ $val = rand( $minAmp, $maxAmp );
1831
+ $val = (int)( $val * $percent / 100 );
1832
+ }
1833
 
1834
+ $this->_samples .= str_repeat( self::packSample( $val, $bitDepth ), $numChannels );
1835
+ }
1836
 
1837
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
 
 
 
 
 
 
 
 
 
 
1838
 
1839
+ return $this;
1840
+ }
 
 
 
 
 
 
 
 
 
 
 
1841
 
1842
+ /**
1843
+ * Convert sample data to different bits per sample.
1844
+ *
1845
+ * @param int $bitsPerSample (Required) The new number of bits per sample;
1846
+ *
1847
+ * @throws Yop_Poll_WavFileException
1848
+ */
1849
+ public function convertBitsPerSample( $bitsPerSample ) {
1850
+ if ( $this->getBitsPerSample() == $bitsPerSample ){
1851
+ return $this;
1852
  }
1853
 
1854
+ $tempWav = new Yop_Poll_WavFile( $this->getNumChannels(), $this->getSampleRate(), $bitsPerSample );
1855
+ $tempWav->filter(
1856
+ array( self::FILTER_MIX => $this ),
1857
+ 0,
1858
+ $this->getNumBlocks()
1859
+ );
1860
 
1861
+ $this->setSamples() // implicit setDataSize(), setSize(), setActualSize(), setNumBlocks()
1862
+ ->setBitsPerSample( $bitsPerSample ); // implicit setValidBitsPerSample(), setAudioFormat(), setAudioSubFormat(), setFmtChunkSize(), setFactChunkSize(), setSize(), setActualSize(), setDataOffset(), setByteRate(), setBlockAlign(), setNumBlocks()
1863
+ $this->_samples = $tempWav->_samples;
1864
+ $this->setDataSize(); // implicit setSize(), setActualSize(), setNumBlocks()
1865
 
 
 
 
 
 
 
 
 
1866
  return $this;
1867
  }
1868
 
 
 
 
 
 
 
 
 
 
 
 
1869
 
1870
+ /*%******************************************************************************************%*/
1871
+ // Miscellaneous methods
1872
+
1873
+ /**
1874
+ * Output information about the wav object.
1875
+ */
1876
+ public function displayInfo() {
1877
+ $s = "File Size: %u\n"
1878
+ . "Chunk Size: %u\n"
1879
+ . "fmt Subchunk Size: %u\n"
1880
+ . "Extended fmt Size: %u\n"
1881
+ . "fact Subchunk Size: %u\n"
1882
+ . "Data Offset: %u\n"
1883
+ . "Data Size: %u\n"
1884
+ . "Audio Format: %s\n"
1885
+ . "Audio SubFormat: %s\n"
1886
+ . "Channels: %u\n"
1887
+ . "Channel Mask: 0x%s\n"
1888
+ . "Sample Rate: %u\n"
1889
+ . "Bits Per Sample: %u\n"
1890
+ . "Valid Bits Per Sample: %u\n"
1891
+ . "Sample Block Size: %u\n"
1892
+ . "Number of Sample Blocks: %u\n"
1893
+ . "Byte Rate: %uBps\n";
1894
+
1895
+ $s = sprintf( $s, $this->getActualSize(),
1896
+ $this->getChunkSize(),
1897
+ $this->getFmtChunkSize(),
1898
+ $this->getFmtExtendedSize(),
1899
+ $this->getFactChunkSize(),
1900
+ $this->getDataOffset(),
1901
+ $this->getDataSize(),
1902
+ $this->getAudioFormat() == self::WAVE_FORMAT_PCM ? 'PCM' : ( $this->getAudioFormat() == self::WAVE_FORMAT_IEEE_FLOAT ? 'IEEE FLOAT' : 'EXTENSIBLE' ),
1903
+ $this->getAudioSubFormat() == self::WAVE_SUBFORMAT_PCM ? 'PCM' : 'IEEE FLOAT',
1904
+ $this->getNumChannels(),
1905
+ dechex( $this->getChannelMask() ),
1906
+ $this->getSampleRate(),
1907
+ $this->getBitsPerSample(),
1908
+ $this->getValidBitsPerSample(),
1909
+ $this->getBlockAlign(),
1910
+ $this->getNumBlocks(),
1911
+ $this->getByteRate() );
1912
+
1913
+ if ( php_sapi_name() == 'cli' ){
1914
+ return $s;
1915
+ }
1916
+ else {
1917
+ return nl2br( $s );
1918
+ }
1919
+ }
1920
  }
1921
 
1922
 
1923
  /*%******************************************************************************************%*/
1924
+ // Exceptions
1925
 
1926
  /**
1927
+ * Yop_Poll_WavFileException indicates an illegal state or argument in this class.
1928
  */
1929
+ class Yop_Poll_WavFileException extends Exception{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1930
  }
 
 
 
 
 
1931
 
1932
+ /**
1933
+ * Yop_Poll_WavFormatException indicates a malformed or unsupported wav file header.
1934
+ */
1935
+ class Yop_Poll_WavFormatException extends Yop_Poll_WavFileException{
1936
+ }
 
 
 
 
inc/abstract_admin.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class YOP_POLL_Abstract_Admin {
3
+ protected $twig = NULL;
4
+ protected $type = NULL;
5
+
6
+ protected function __construct( $type ) {
7
+ $this->type = $type . '_';
8
+ $this->loadTwig();
9
+ }
10
+
11
+ private function loadTwig() {
12
+ $loader = new Twig_Loader_Filesystem( YOP_POLL_PATH . 'templates/');
13
+ $this->twig = new Twig_Environment( $loader, array() );
14
+ $this->twig->addExtension(new Twig_Extension_YopPoll() );
15
+ }
16
+
17
+ protected function make_order_array( $fields = array(), $default_order = 'asc', $orderby = NULL, $order = 'asc' ) {
18
+ $return_array = array();
19
+ if ( is_foreach_array( $fields ) ) {
20
+ foreach( $fields as $field ) {
21
+ if ( $field == $orderby )
22
+ $return_array[ $field ] = $order;
23
+ else
24
+ $return_array[ $field ] = $default_order;
25
+ }
26
+ }
27
+ return $return_array;
28
+ }
29
+
30
+ protected function render( $template, $data ) {
31
+ return $this->twig->render( $this->type . $template, $data );
32
+ }
33
+
34
+ protected function display( $template, $data ) {
35
+ $this->twig->display( $this->type . $template, $data );
36
+ }
37
+
38
+ public function get_new_answer_template( $args = array() ) {
39
+
40
+ $question_id = ( isset( $args['question_id'] ) && $args['question_id'] != '' ) ? $args['question_id'] : uniqid( 'q_' );
41
+ $answer_id = ( isset( $args['answer_id'] ) && $args['answer_id'] != '' ) ? $args['answer_id'] : uniqid( 'a_' );
42
+
43
+ $questionObj = new YOP_POLL_Question_Model( $question_id );
44
+ $answerObj = new YOP_POLL_Answer_Model( $answer_id );
45
+ if ( ! isset( $questionObj->ID ) ) {
46
+ $questionObj->ID = $question_id;
47
+ }
48
+
49
+ $data['question'] = $questionObj;
50
+
51
+ if ( ! isset( $answerObj->ID ) ) {
52
+ $answerObj->ID = $answer_id;
53
+ }
54
+
55
+ $data['answer'] = $answerObj;
56
+ if($_POST['type']=='text')
57
+ $this->display( 'answer_template.html', $data );
58
+ else
59
+ $this->display( 'answer_media_template.html', $data );
60
+ }
61
+
62
+ public function get_new_question_template( $args = array() ) {
63
+
64
+ $question_id = ( isset( $args['question_id'] ) && $args['question_id'] != '' ) ? $args['question_id'] : uniqid( 'q_' );
65
+
66
+ $questionObj = new YOP_POLL_Question_Model( $question_id );
67
+ if ( ! isset( $questionObj->ID ) ) {
68
+ $questionObj->ID = $question_id;
69
+ }
70
+
71
+ $data['question'] = $questionObj;
72
+
73
+ if($_POST['type']=="text")
74
+ $this->display( 'question_template.html', $data );
75
+ else
76
+ $this->display('question_template_media.html',$data);
77
+
78
+ }
79
+ }
inc/admin.php CHANGED
@@ -1,9398 +1,247 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- class Yop_Poll_Admin extends Yop_Poll_Plugin{
4
- protected function init() {
5
- $this->add_action( 'init', 'admin_loader' );
6
- $this->add_action( 'admin_notices', 'popup_bar' );
7
- $this->add_action( 'admin_init', 'popup_bar_operations' );
8
- $this->add_action( 'admin_enqueue_scripts', 'my_yop_poll_button' );
9
- $this->add_action( 'wpmu_new_blog', 'new_blog', 10, 6 );
10
- $this->add_action( 'delete_blog', 'delete_blog', 10, 2 );
11
- register_activation_hook( $this->_config->plugin_file, array( $this, 'yop_poll_activate' ) );
12
- register_deactivation_hook( $this->_config->plugin_file, array( $this, 'yop_poll_deactivate' ) );
13
- register_uninstall_hook( $this->_config->plugin_file, 'yop_poll_uninstall' );
14
- $this->add_action( 'admin_enqueue_scripts', 'load_editor_functions' );
15
- $this->add_action( 'plugins_loaded', 'db_update' );
16
- }
17
-
18
- function new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
19
- global $wpdb;
20
- if ( !function_exists( 'is_plugin_active_for_network' ) ){
21
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
22
- }
23
- if ( is_plugin_active_for_network( 'yop-poll/yop_poll.php' ) ){
24
- $old_blog = $wpdb->blogid;
25
- switch_to_blog( $blog_id );
26
- $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
27
- $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
28
- $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';
29
- $wpdb->yop_poll_custom_fields = $wpdb->prefix . 'yop_poll_custom_fields';
30
- $wpdb->yop_pollmeta = $wpdb->prefix . 'yop_pollmeta';
31
- $wpdb->yop_poll_answermeta = $wpdb->prefix . 'yop_poll_answermeta';
32
- $wpdb->yop_poll_logs = $wpdb->prefix . 'yop_poll_logs';
33
- $wpdb->yop_poll_voters = $wpdb->prefix . 'yop_poll_voters';
34
- $wpdb->yop_poll_bans = $wpdb->prefix . 'yop_poll_bans';
35
- $wpdb->yop_poll_votes_custom_fields = $wpdb->prefix . 'yop_poll_votes_custom_fields';
36
- $wpdb->yop_poll_facebook_users = $wpdb->prefix . 'yop_poll_facebook_users';
37
- $this->activate( NULL );
38
- switch_to_blog( $old_blog );
39
- }
40
- }
41
-
42
- function delete_blog( $blog_id ) {
43
- global $wpdb;
44
- $old_blog = $wpdb->blogid;
45
- switch_to_blog( $blog_id );
46
- $wpdb->query( "DROP TABLE `" . $wpdb->prefix . "yop_pollmeta`, `" . $wpdb->prefix . "yop_polls`, `" . $wpdb->prefix . "yop_poll_answermeta`, `" . $wpdb->prefix . "yop_poll_answers`, `" . $wpdb->prefix . "yop_poll_custom_fields`, `" . $wpdb->prefix . "yop_poll_logs`, `" . $wpdb->prefix . "yop_poll_voters`, `" . $wpdb->prefix . "yop_poll_bans`, `" . $wpdb->prefix . "yop_poll_templates`, `" . $wpdb->prefix . "yop_poll_votes_custom_fields`, `" . $wpdb->prefix . "yop_poll_facebook_users`" );
47
- switch_to_blog( $old_blog );
48
- }
49
-
50
- function yop_poll_network_propagate( $pfunction, $networkwide ) {
51
- global $wpdb;
52
-
53
- if ( function_exists( 'is_multisite' ) && is_multisite() ){
54
- // check if it is a network activation - if so, run the activation function
55
- // for each blog id
56
- if ( $networkwide ){
57
- $old_blog = $wpdb->blogid;
58
- // Get all blog ids
59
- $blogids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
60
- foreach ( $blogids as $blog_id ) {
61
- switch_to_blog( $blog_id );
62
- $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
63
- $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
64
- $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';
65
- $wpdb->yop_poll_custom_fields = $wpdb->prefix . 'yop_poll_custom_fields';
66
- $wpdb->yop_pollmeta = $wpdb->prefix . 'yop_pollmeta';
67
- $wpdb->yop_poll_answermeta = $wpdb->prefix . 'yop_poll_answermeta';
68
- $wpdb->yop_poll_logs = $wpdb->prefix . 'yop_poll_logs';
69
- $wpdb->yop_poll_voters = $wpdb->prefix . 'yop_poll_voters';
70
- $wpdb->yop_poll_bans = $wpdb->prefix . 'yop_poll_bans';
71
- $wpdb->yop_poll_votes_custom_fields = $wpdb->prefix . 'yop_poll_votes_custom_fields';
72
- $wpdb->yop_poll_facebook_users = $wpdb->prefix . 'yop_poll_facebook_users';
73
- call_user_func( array( $this, $pfunction ), $networkwide );
74
- }
75
- switch_to_blog( $old_blog );
76
- return;
77
- }
78
- }
79
- call_user_func( array( $this, $pfunction ), $networkwide );
80
- }
81
-
82
- function yop_poll_activate( $networkwide ) {
83
- $this->yop_poll_network_propagate( 'activate', $networkwide );
84
- }
85
-
86
- function yop_poll_deactivate( $networkwide ) {
87
- $this->yop_poll_network_propagate( 'deactivate', $networkwide );
88
- }
89
-
90
- public function db_update() {
91
- global $wpdb;
92
- global $current_user;
93
-
94
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
95
- $installed_version = get_option( "yop_poll_version" );
96
-
97
- // update for version 1.5
98
- if ( version_compare( $installed_version, '1.5', '<=' ) ){
99
- $default_options = get_option( 'yop_poll_options' );
100
- if ( !isset ( $default_options ['vote_button_label'] ) ){
101
- $default_options ['vote_button_label'] = 'Vote';
102
- }
103
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
104
- update_option( 'yop_poll_options', $default_options );
105
- }
106
-
107
- // update for version 1.6
108
- if ( version_compare( $installed_version, '1.6', '<=' ) ){
109
- $default_options = get_option( 'yop_poll_options' );
110
- if ( !isset ( $default_options ['display_other_answers_values'] ) ){
111
- $default_options ['display_other_answers_values'] = 'no';
112
- }
113
- if ( !isset ( $default_options ['percentages_decimals'] ) ){
114
- $default_options ['percentages_decimals'] = '0';
115
- }
116
- if ( !isset ( $default_options ['plural_answer_result_votes_number_label'] ) ){
117
- $default_options ['singular_answer_result_votes_number_label'] = 'vote';
118
- }
119
- if ( !isset ( $default_options ['plural_answer_result_votes_number_label'] ) ){
120
- $default_options ['plural_answer_result_votes_number_label'] = 'votes';
121
- }
122
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
123
- update_option( 'yop_poll_options', $default_options );
124
- }
125
-
126
- // update for version 2.0
127
- if ( version_compare( $installed_version, '2.0', '<=' ) ){
128
- $wpdb->query( 'ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `total_votes` `total_answers` INT( 11 ) NOT NULL ' );
129
- $wpdb->query( 'ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `total_voters` `total_votes` INT( 11 ) NOT NULL ' );
130
- $wpdb->query( "
131
- UPDATE " . $wpdb->yop_poll_templates . "
132
- SET
133
- before_vote_template = REPLACE( before_vote_template, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
134
- after_vote_template = REPLACE( after_vote_template, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
135
- before_start_date_template = REPLACE( before_start_date_template, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
136
- after_end_date_template = REPLACE( after_end_date_template, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
137
- css = REPLACE( css, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
138
- js = REPLACE( js, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS')
139
- " );
140
- $default_options = get_option( 'yop_poll_options' );
141
- if ( !isset ( $default_options ['view_total_answers'] ) ){
142
- $default_options ['view_total_answers'] = $default_options ['view_total_voters'];
143
- }
144
- if ( !isset ( $default_options ['view_total_answers_label'] ) ){
145
- $default_options ['view_total_answers_label'] = 'Total Answers %POLL-TOTAL-ANSWERS%';
146
- }
147
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
148
- update_option( 'yop_poll_options', $default_options );
149
- }
150
-
151
- // update for version 3.2
152
- if ( version_compare( $installed_version, '3.2', '<=' ) ){
153
- $wpdb->query( "
154
- UPDATE " . $wpdb->yop_poll_templates . "
155
- SET
156
- js = REPLACE( js, 'findWidest = false ) {\r\n', 'findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n ')
157
- " );
158
-
159
- $default_options = get_option( 'yop_poll_options' );
160
- if ( !isset ( $default_options ['auto_generate_poll_page'] ) ){
161
- $default_options ['auto_generate_poll_page'] = 'no';
162
- }
163
- if ( !isset ( $default_options ['has_auto_generate_poll_page'] ) ){
164
- $default_options ['has_auto_generate_poll_page'] = 'no';
165
- }
166
- update_option( 'yop_poll_options', $default_options );
167
-
168
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
169
- }
170
-
171
- // update for version 3.3
172
- if ( version_compare( $installed_version, '3.3', '<=' ) ){
173
- $yop_poll_first_install_date = get_option( 'yop_poll_first_install_date' );
174
- if ( !$yop_poll_first_install_date ){
175
- $oldest_yop_poll = Yop_Poll_Model::get_oldest_poll_from_database();
176
- update_option( "yop_poll_first_install_date", $oldest_yop_poll ['date_added'] );
177
- }
178
- $yop_poll_admin_notices_donate = get_option( 'yop_poll_admin_notices_donate' );
179
- if ( !$yop_poll_admin_notices_donate ){
180
- update_option( "yop_poll_admin_notices_donate", 'yes' );
181
- }
182
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
183
- }
184
-
185
- // update for version 3.7
186
- if ( version_compare( $installed_version, '3.7', '<=' ) ){
187
- $default_options = get_option( 'yop_poll_options' );
188
- if ( !isset ( $default_options ['poll_name_html_tags'] ) ){
189
- $default_options ['poll_name_html_tags'] = 'no';
190
- }
191
- if ( !isset ( $default_options ['poll_question_html_tags'] ) ){
192
- $default_options ['poll_question_html_tags'] = 'no';
193
- }
194
- if ( !isset ( $default_options ['poll_answer_html_tags'] ) ){
195
- $default_options ['poll_answer_html_tags'] = 'no';
196
- }
197
- if ( !isset ( $default_options ['poll_custom_field_html_tags'] ) ){
198
- $default_options ['poll_custom_field_html_tags'] = 'no';
199
- }
200
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
201
- update_option( 'yop_poll_options', $default_options );
202
- }
203
-
204
- if ( version_compare( $installed_version, '3.9', '<=' ) ){
205
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
206
- require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
207
- Yop_Poll_DbSchema::create_polls_table();
208
- Yop_Poll_DbSchema::create_polls_templates_table();
209
-
210
- wp_get_current_user();
211
- if ( $current_user->ID > 0 ){
212
- $wpdb->query( "UPDATE " . $wpdb->yop_polls . " SET poll_author = " . $current_user->ID . " WHERE poll_author = 0" );
213
- $wpdb->query( "UPDATE " . $wpdb->yop_poll_templates . " SET template_author = " . $current_user->ID . " WHERE template_author = 0" );
214
- }
215
-
216
- $default_options = get_option( 'yop_poll_options' );
217
- if ( !isset ( $default_options ['use_default_loading_image'] ) ){
218
- $default_options ['use_default_loading_image'] = 'yes';
219
- }
220
- if ( !isset ( $default_options ['loading_image_url'] ) ){
221
- $default_options ['loading_image_url'] = '';
222
- }
223
- update_option( 'yop_poll_options', $default_options );
224
-
225
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
226
- }
227
-
228
- if ( version_compare( $installed_version, '4.1', '<=' ) ){
229
-
230
- $this->update_to_4_2();
231
- $default_options = get_option( 'yop_poll_options' );
232
- if ( !isset ( $default_options ['use_captcha'] ) ){
233
- $default_options ['use_captcha'] = 'no';
234
- }
235
-
236
- update_option( 'yop_poll_options', $default_options );
237
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
238
- }
239
-
240
- if ( version_compare( $installed_version, '4.2', '<=' ) ){
241
-
242
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
243
- require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
244
- Yop_Poll_DbSchema::create_poll_facebook_users_table();
245
- Yop_Poll_DbSchema::create_poll_logs_table();
246
- Yop_Poll_DbSchema::create_poll_votes_custom_fields_table();
247
-
248
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
249
- if ( !isset ( $optin_box_modal_options ['show'] ) ){
250
- $optin_box_modal_options ['show'] = 'yes';
251
- }
252
- if ( !isset ( $optin_box_modal_options ['last_show_date'] ) ){
253
- $optin_box_modal_options ['last_show_date'] = Yop_Poll_Model::get_mysql_curent_date();
254
- }
255
- if ( !isset ( $optin_box_modal_options ['modal_had_submit'] ) ){
256
- $optin_box_modal_options ['modal_had_submit'] = 'no';
257
- }
258
- if ( !isset ( $optin_box_modal_options ['sidebar_had_submit'] ) ){
259
- $optin_box_modal_options ['sidebar_had_submit'] = 'no';
260
- }
261
- update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
262
-
263
- $pro_options = get_option( 'yop_poll_pro_options' );
264
- if ( !isset ( $pro_options ['pro_key'] ) ){
265
- $pro_options ['pro_key'] = '';
266
- }
267
- if ( !isset ( $pro_options ['pro_api_key'] ) ){
268
- $pro_options ['pro_api_key'] = '';
269
- }
270
- if ( !isset ( $pro_options ['pro_api_server_url'] ) ){
271
- $pro_options ['pro_api_server_url'] = 'http://www.yop-poll.com/pro';
272
- }
273
- if ( !isset ( $pro_options ['pro_user'] ) ){
274
- $pro_options ['pro_user'] = 'no';
275
- }
276
-
277
- $default_options = get_option( 'yop_poll_options' );
278
- if ( !isset ( $default_options ['vote_permisions_facebook'] ) ){
279
- $default_options ['vote_permisions_facebook'] = 'no';
280
- }
281
- if ( !isset ( $default_options ['vote_permisions_facebook_label'] ) ){
282
- $default_options ['vote_permisions_facebook_label'] = 'Vote as Facebook User';
283
- }
284
- if ( !isset ( $default_options ['vote_permisions_wordpress'] ) ){
285
- $default_options ['vote_permisions_wordpress'] = 'no';
286
- }
287
- if ( !isset ( $default_options ['vote_permisions_wordpress_label'] ) ){
288
- $default_options ['vote_permisions_wordpress_label'] = 'Vote as Wordpress User';
289
- }
290
- if ( !isset ( $default_options ['vote_permisions_anonymous'] ) ){
291
- $default_options ['vote_permisions_anonymous'] = 'no';
292
- }
293
- if ( !isset ( $default_options ['vote_permisions_anonymous_label'] ) ){
294
- $default_options ['vote_permisions_anonymous_label'] = 'Vote as Anonymous User';
295
- }
296
-
297
- if ( !isset ( $default_options ['share_after_vote'] ) ){
298
- $default_options ['share_after_vote'] = 'no';
299
- }
300
- if ( !isset ( $default_options ['share_picture'] ) ){
301
- $default_options ['share_picture'] = '';
302
- }
303
- if ( !isset ( $default_options ['share_name'] ) ){
304
- $default_options ['share_name'] = '';
305
- }
306
- if ( !isset ( $default_options ['share_caption'] ) ){
307
- $default_options ['share_caption'] = '';
308
- }
309
- if ( !isset ( $default_options ['share_description'] ) ){
310
- $default_options ['share_description'] = '';
311
- }
312
- if ( !isset ( $default_options ['redirect_after_vote'] ) ){
313
- $default_options ['redirect_after_vote'] = 'no';
314
- }
315
- if ( !isset ( $default_options ['redirect_after_vote_url'] ) ){
316
- $default_options ['redirect_after_vote_url'] = '';
317
- }
318
- if ( !isset ( $default_options ['allow_multiple_answers_min_number'] ) ){
319
- $default_options ['allow_multiple_answers_min_number'] = '1';
320
- }
321
- if ( !isset ( $default_options ['is_default_answer'] ) ){
322
- $default_options ['is_default_answer'] = 'no';
323
- }
324
- if ( !isset ( $default_options ['template_width'] ) ){
325
- $default_options ['template_width'] = '200px';
326
- }
327
- if ( !isset ( $default_options ['widget_template'] ) ){
328
- $default_options ['widget_template'] = $default_options['template'];
329
- }
330
- if ( !isset ( $default_options ['widget_template_width'] ) ){
331
- $default_options ['widget_template_width'] = '200px';
332
- }
333
-
334
- $wpdb->query( "
335
- UPDATE " . $wpdb->yop_poll_templates . "
336
- SET
337
- css = REPLACE( css, 'width:200px;', 'width:%POLL-WIDTH%;')
338
- " );
339
-
340
- update_option( 'yop_poll_options', $default_options );
341
-
342
- update_option( 'yop_poll_pro_options', $pro_options );
343
-
344
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
345
- }
346
-
347
- if ( version_compare( $installed_version, '4.3', '<=' ) ){
348
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
349
- require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
350
- Yop_Poll_DbSchema::create_poll_voters_table();
351
-
352
- $wpdb->query( "
353
- UPDATE " . $wpdb->yop_poll_templates . "
354
- SET
355
- css = CONCAT( css, '\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}' )
356
- WHERE
357
- css NOT LIKE '%#yop-poll-container-success-%'
358
- " );
359
-
360
- $default_options = get_option( 'yop_poll_options' );
361
-
362
- if ( !isset ( $default_options ['limit_number_of_votes_per_user'] ) ){
363
- $default_options ['limit_number_of_votes_per_user'] = 'no';
364
- }
365
-
366
- if ( !isset ( $default_options ['number_of_votes_per_user'] ) ){
367
- $default_options ['number_of_votes_per_user'] = 1;
368
- }
369
-
370
- if ( !isset ( $default_options ['message_after_vote'] ) ){
371
- $default_options ['message_after_vote'] = 'Thank you for your vote!';
372
- }
373
-
374
- if ( !isset ( $default_options ['start_scheduler'] ) ){
375
- $default_options ['start_scheduler'] = 'no';
376
- }
377
- if ( !isset ( $default_options ['schedule_reset_poll_stats'] ) ){
378
- $default_options ['schedule_reset_poll_stats'] = 'no';
379
- }
380
- if ( !isset ( $default_options ['schedule_reset_poll_date'] ) ){
381
- $default_options ['schedule_reset_poll_date'] = current_time( 'timestamp' );
382
- }
383
- if ( !isset ( $default_options ['schedule_reset_poll_recurring_value'] ) ){
384
- $default_options ['schedule_reset_poll_recurring_value'] = '9999';
385
- }
386
- if ( !isset ( $default_options ['schedule_reset_poll_recurring_unit'] ) ){
387
- $default_options ['schedule_reset_poll_recurring_unit'] = 'DAY';
388
- }
389
-
390
- update_option( 'yop_poll_options', $default_options );
391
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
392
- }
393
-
394
- if ( version_compare( $installed_version, '4.4', '<=' ) ){
395
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
396
- require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
397
- Yop_Poll_DbSchema::create_poll_logs_table();
398
- Yop_Poll_DbSchema::create_poll_votes_custom_fields_table();
399
-
400
- $default_options = get_option( 'yop_poll_options' );
401
-
402
- if ( !isset ( $default_options ['view_results_permissions'] ) ){
403
- $default_options ['view_results_permissions'] = 'guest-registered';
404
- }
405
-
406
- if ( !isset ( $default_options ['date_format'] ) ){
407
- $default_options ['date_format'] = 'd/m/Y H:i:s';
408
- }
409
-
410
- if ( !isset ( $default_options ['add_other_answers_to_default_answers'] ) ){
411
- $default_options ['add_other_answers_to_default_answers'] = 'no';
412
- }
413
-
414
- update_option( 'yop_poll_options', $default_options );
415
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
416
- }
417
-
418
- if ( version_compare( $installed_version, '4.5', '<=' ) ){
419
-
420
- $default_options = get_option( 'yop_poll_options' );
421
-
422
- if ( !isset ( $default_options ['send_email_notifications'] ) ){
423
- $default_options ['send_email_notifications'] = 'no';
424
- }
425
-
426
- if ( !isset ( $default_options ['email_notifications_from_name'] ) ){
427
- $default_options ['email_notifications_from_name'] = 'Yop Poll';
428
- }
429
-
430
- $sitename = strtolower( $_SERVER['SERVER_NAME'] );
431
- if ( substr( $sitename, 0, 4 ) == 'www.' ){
432
- $sitename = substr( $sitename, 4 );
433
- }
434
-
435
- if ( !isset ( $default_options ['email_notifications_from_email'] ) ){
436
- $default_options ['email_notifications_from_email'] = 'yop-poll@' . $sitename;
437
- }
438
-
439
- if ( !isset ( $default_options ['email_notifications_recipients'] ) ){
440
- $default_options ['email_notifications_recipients'] = '';
441
- }
442
-
443
- if ( !isset ( $default_options ['email_notifications_subject'] ) ){
444
- $default_options ['email_notifications_subject'] = 'New Vote';
445
- }
446
-
447
- if ( !isset ( $default_options ['email_notifications_body'] ) ){
448
- $default_options ['email_notifications_body'] = '<p>A new vote was registered on [VOTE_DATE] for [POLL_NAME]</p>
449
- <p>Vote Details:</p>
450
- <p><b>Question:</b> [QUESTION]</p>
451
- <p><b>Answers:</b> <br />[ANSWERS]</p>
452
- <p><b>Custom Fields:</b> <br />[CUSTOM_FIELDS]</p>
453
- <p><b>Vote ID:</b> <br />[VOTE_ID]</p>';
454
- }
455
-
456
- update_option( 'yop_poll_options', $default_options );
457
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
458
- }
459
-
460
- if ( version_compare( $installed_version, '4.7', '<=' ) ){
461
- $this->update_to_4_8();
462
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
463
- }
464
-
465
- if ( version_compare( $installed_version, '4.8', '<=' ) ){
466
- $this->update_to_4_9();
467
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
468
- }
469
-
470
- if ( version_compare( $installed_version, '4.9', '<=' ) ){
471
- $this->update_to_4_9_1();
472
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
473
- }
474
-
475
- if ( version_compare( $installed_version, '4.9.1', '<=' ) ){
476
-
477
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
478
- }
479
- if ( version_compare( $installed_version, '4.9.2', '<=' ) ){
480
-
481
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
482
- }
483
- }
484
-
485
- public function update_to_4_2() {
486
- global $wpdb;
487
-
488
- $saved_templates = $wpdb->get_results( "
489
- SELECT id FROM " . $wpdb->yop_poll_templates . "
490
- WHERE
491
- before_vote_template LIKE '%<div id=\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">%' AND
492
- before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
493
- ", ARRAY_A );
494
-
495
- $updated_templates = $wpdb->get_results( "
496
- SELECT id FROM " . $wpdb->yop_poll_templates . "
497
- WHERE
498
- before_vote_template LIKE '%<div id=\\\\\\\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\\\\\\\" . '"' . " class=\\\\\\\\" . '"' . "yop-poll-footer\\\\\\\\" . '"' . ">%' AND
499
- before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
500
- ", ARRAY_A );
501
- if ( count( $saved_templates ) > 0 ){
502
- foreach ( $saved_templates as $template ) {
503
- $wpdb->query( "
504
- UPDATE " . $wpdb->yop_poll_templates . " SET
505
- before_vote_template = REPLACE( before_vote_template, '<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">', '[CAPTCHA_CONTAINER]\r\n<div id=\"yop-poll-captcha-%POLL-ID%\">\r\n <div class=\"yop-poll-captcha-image-div\" id=\"yop-poll-captcha-image-div-%POLL-ID%\">\r\n %CAPTCHA-IMAGE%\r\n <div class=\"yop-poll-captcha-helpers-div\" id=\"yop-poll-captcha-helpers-div-%POLL-ID%\">%RELOAD-CAPTCHA-IMAGE% </div>\r\n <div class=\"yop_poll_clear\"></div>\r\n </div>\r\n %CAPTCHA-LABEL%\r\n <div class=\"yop-poll-captcha-input-div\" id=\"yop-poll-captcha-input-div-%POLL-ID%\">%CAPTCHA-INPUT%</div>\r\n</div>\r\n[/CAPTCHA_CONTAINER]\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">')
506
- WHERE
507
- id = " . $template ['id'] . " AND
508
- before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
509
- " );
510
- }
511
- }
512
- if ( count( $updated_templates ) > 0 ){
513
- foreach ( $updated_templates as $template ) {
514
- $wpdb->query( "
515
- UPDATE " . $wpdb->yop_poll_templates . " SET
516
- before_vote_template = REPLACE( before_vote_template, '<div id=\\\\" . '"' . "yop-poll-vote-%POLL-ID%\\\\" . '"' . " class=\\\\" . '"' . "yop-poll-footer\\\\" . '"' . ">', '[CAPTCHA_CONTAINER]\r\n<div id=\"yop-poll-captcha-%POLL-ID%\">\r\n <div class=\"yop-poll-captcha-image-div\" id=\"yop-poll-captcha-image-div-%POLL-ID%\">\r\n %CAPTCHA-IMAGE%\r\n <div class=\"yop-poll-captcha-helpers-div\" id=\"yop-poll-captcha-helpers-div-%POLL-ID%\">%RELOAD-CAPTCHA-IMAGE% </div>\r\n <div class=\"yop_poll_clear\"></div>\r\n </div>\r\n %CAPTCHA-LABEL%\r\n <div class=\"yop-poll-captcha-input-div\" id=\"yop-poll-captcha-input-div-%POLL-ID%\">%CAPTCHA-INPUT%</div>\r\n</div>\r\n[/CAPTCHA_CONTAINER]\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">')
517
- WHERE
518
- id = " . $template ['id'] . " AND
519
- before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
520
- " );
521
- }
522
- }
523
-
524
- $css_templates = $wpdb->get_results( "
525
- SELECT id FROM " . $wpdb->yop_poll_templates . "
526
- WHERE
527
- css LIKE '%#yop-poll-custom-%POLL-ID% ul li input { margin:0px 0px 5px 0px; padding:2\%; width:96\%; text-indent:2\%; font-size:12px; }%' AND
528
- css NOT LIKE '%yop-poll-captcha%'
529
- ", ARRAY_A );
530
-
531
- if ( count( $css_templates ) > 0 ){
532
- foreach ( $css_templates as $template ) {
533
- $wpdb->query( "
534
- UPDATE " . $wpdb->yop_poll_templates . " SET
535
- css = REPLACE( css, '#yop-poll-custom-%POLL-ID% ul li input { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }', '#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n')
536
- WHERE
537
- id = " . $template ['id'] . " AND
538
- css NOT LIKE '%yop-poll-captcha%'
539
- " );
540
- }
541
- }
542
-
543
- $css_templates_1 = $wpdb->get_results( "
544
- SELECT id FROM " . $wpdb->yop_poll_templates . "
545
- WHERE
546
- css LIKE '%#yop-poll-custom-%POLL-ID% ul li input { margin:0px 0px 5px 0px; padding:2\%; width:95\%; text-indent:2\%; font-size:12px; }%' AND
547
- css NOT LIKE '%yop-poll-captcha%'
548
- ", ARRAY_A );
549
-
550
- if ( count( $css_templates_1 ) > 0 ){
551
- foreach ( $css_templates_1 as $template ) {
552
- $wpdb->query( "
553
- UPDATE " . $wpdb->yop_poll_templates . " SET
554
- css = REPLACE( css, '#yop-poll-custom-%POLL-ID% ul li input { margin:0px 0px 5px 0px; padding:2%; width:95%; text-indent:2%; font-size:12px; }', '#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n')
555
- WHERE
556
- id = " . $template ['id'] . " AND
557
- css NOT LIKE '%yop-poll-captcha%'
558
- " );
559
- }
560
- }
561
- }
562
-
563
- public function update_to_4_8() {
564
- global $wpdb;
565
- $sql = <<<EOT
566
- UPDATE $wpdb->yop_poll_templates
567
- SET
568
- js = CONCAT( js, '
569
- jQuery(document).ready(function(){
570
- runOnPollStateChange_%POLL-ID%();
571
- });
572
-
573
- function runOnPollStateChange_%POLL-ID%() {};'
574
- )
575
- WHERE js NOT LIKE '%runOnPollStateChange_%'
576
- EOT;
577
- $updated_templates = $wpdb->query( $sql );
578
- }
579
-
580
- public function update_to_4_9() {
581
- global $wpdb;
582
- $sql = <<<EOT
583
- UPDATE $wpdb->yop_poll_templates
584
- SET `before_vote_template` =
585
- REPLACE( `before_vote_template` ,
586
- '<div id="yop-poll-answers-%POLL-ID"',
587
- '<div id="yop-poll-answers-%POLL-ID%"' )
588
- WHERE `before_vote_template` LIKE '%<div id="yop-poll-answers-%POLL-ID"%'
589
- EOT;
590
- $wpdb->query( $sql );
591
- }
592
-
593
- public function update_to_4_9_1() {
594
- global $wpdb;
595
- $sql = <<<EOT
596
- UPDATE $wpdb->yop_poll_templates
597
- SET `before_vote_template` =
598
- REPLACE( `before_vote_template` ,
599
- '<div id="yop-poll-answers-%POLL-ID"',
600
- '<div id="yop-poll-answers-%POLL-ID%"' )
601
- WHERE `before_vote_template` LIKE '%<div id="yop-poll-answers-\%POLL-ID"%'
602
- EOT;
603
- $wpdb->query( $sql );
604
-
605
- $sql = <<<EOT
606
- UPDATE $wpdb->yop_poll_templates
607
- SET `before_vote_template` =
608
- REPLACE( `before_vote_template` ,
609
- '<li class="yop-poll-li-answer-%POLL-ID"',
610
- '<li class="yop-poll-li-answer-%POLL-ID%"' )
611
- WHERE `before_vote_template` LIKE '%<li class="yop-poll-li-answer-\%POLL-ID"%'
612
- EOT;
613
- $wpdb->query( $sql );
614
- }
615
-
616
- public function admin_loader() {
617
- // $this->add_action ( 'network_admin_menu', 'admin_menu', 1 );
618
- $this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
619
- $this->add_action( 'admin_menu', 'admin_menu', 1 );
620
- $this->add_action( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
621
- $this->add_action( 'wp_ajax_yop_poll_preview_template', 'ajax_preview_template', 1 );
622
- $this->add_action( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
623
- $this->add_action( 'wp_ajax_yop_poll_edit_add_new_poll', 'ajax_edit_add_new_poll', 1 );
624
- $this->add_action( 'wp_ajax_yop_poll_edit_add_new_poll_template', 'ajax_edit_add_new_poll_template', 1 );
625
- $this->add_action( 'wp_ajax_yop_poll_reset_poll_template', 'ajax_reset_poll_template', 1 );
626
- $this->add_action( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
627
- $this->add_action( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
628
- $this->add_action( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
629
- $this->add_action( 'wp_ajax_yop_poll_show_change_votes_number_answer', 'ajax_show_change_votes_number_answer', 1 );
630
- $this->add_action( 'wp_ajax_yop_poll_do_change_votes_number_answer', 'ajax_do_change_votes_number_answer', 1 );
631
-
632
- $this->add_action( 'wp_ajax_yop_poll_show_change_total_number_poll', 'ajax_show_change_total_number_poll', 1 );
633
- $this->add_action( 'wp_ajax_yop_poll_do_change_total_number_poll', 'ajax_do_change_total_number_poll', 1 );
634
-
635
- $this->add_action( 'wp_ajax_yop_poll_show_change_poll_author', 'ajax_show_change_poll_author', 1 );
636
- $this->add_action( 'wp_ajax_yop_poll_do_change_poll_author', 'ajax_do_change_poll_author', 1 );
637
-
638
- $this->add_action( 'wp_ajax_yop_poll_show_change_template_author', 'ajax_show_change_template_author', 1 );
639
- $this->add_action( 'wp_ajax_yop_poll_do_change_template_author', 'ajax_do_change_template_author', 1 );
640
-
641
- $this->add_action( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
642
- $this->add_action( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
643
-
644
- $this->add_action( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
645
- $this->add_action( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
646
-
647
- $this->add_action( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
648
- $this->add_action( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
649
-
650
- $this->add_action( 'wp_ajax_yop_poll_load_css', 'yop_poll_load_css', 1 );
651
- $this->add_action( 'wp_ajax_nopriv_yop_poll_load_css', 'yop_poll_load_css', 1 );
652
-
653
- $this->add_action( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
654
- $this->add_action( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
655
-
656
- $this->add_action( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
657
- $this->add_action( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
658
-
659
- $this->add_action( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
660
- $this->add_action( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
661
-
662
- $this->add_action( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
663
- $this->add_action( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
664
-
665
- $this->add_action( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
666
- $this->add_action( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
667
- }
668
-
669
- /**
670
- * this file is executed on activation
671
- * it creates the database and adds some data to database's table
672
- */
673
- public function activate( $networkwide ) {
674
- global $wp_version;
675
- if ( !version_compare( $wp_version, YOP_POLL_WP_VERSION, '>=' ) ){
676
- $error = new WP_Error ( 'Wordpress_version_error', sprintf( __( 'You need at least Wordpress version %s to use this plugin', 'yop_poll' ), YOP_POLL_WP_VERSION ), __( 'Error: Wordpress Version Problem', 'yop_poll' ) );
677
-
678
- // die & print error message & code - for admins only!
679
- if ( isset ( $error ) && is_wp_error( $error ) && current_user_can( 'manage_options' ) ){
680
- wp_die( $error->get_error_message(), $error->get_error_data() );
681
- }
682
- }
683
- else {
684
- if ( !extension_loaded( 'json' ) ){
685
- $error = new WP_Error ( 'Wordpress_json_error', __( 'You need the json php extension for this plugin', 'yop_poll' ), __( 'Error: Wordpress Extension Problem', 'yop_poll' ) );
686
-
687
- // die & print error message & code - for admins only!
688
- if ( isset ( $error ) && is_wp_error( $error ) && current_user_can( 'manage_options' ) ){
689
- wp_die( $error->get_error_message(), $error->get_error_data() );
690
- }
691
- }
692
- // including upgrade.php for using dbDelta()
693
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
694
- // including db_schema class file
695
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
696
- require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
697
- // create tables
698
- Yop_Poll_DbSchema::create_poll_database_tables();
699
- }
700
- }
701
-
702
- public function deactivate( $networkwide ) {
703
- /*
704
- * global $wpdb; delete_option( 'yop_poll_version' ); delete_option( 'yop_poll_options' ); delete_option( 'yop_poll_first_install_date' ); delete_option( 'yop_poll_admin_notices_donate' ); $wpdb->query("DROP TABLE `". $wpdb->prefix ."yop_pollmeta`, `". $wpdb->prefix ."yop_polls`, `". $wpdb->prefix ."yop_poll_answermeta`, `". $wpdb->prefix ."yop_poll_answers`, `". $wpdb->prefix ."yop_poll_custom_fields`, `". $wpdb->prefix ."yop_poll_logs`, `". $wpdb->prefix ."yop_poll_bans`, `". $wpdb->prefix ."yop_poll_templates`, `". $wpdb->prefix ."yop_poll_votes_custom_fields`");
705
- */
706
- $poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
707
- if ( $poll_archive_page ){
708
- $poll_archive_page_id = $poll_archive_page ['ID'];
709
- wp_delete_post( $poll_archive_page_id, true );
710
- }
711
- $schedule_timestamp = wp_next_scheduled( 'yop_poll_hourly_event', array() );
712
- if ( $schedule_timestamp ){
713
- wp_unschedule_event( $schedule_timestamp, 'yop_poll_hourly_event', array() );
714
- }
715
- }
716
-
717
- public function admin_menu() {
718
- if ( is_admin() && $this->current_user_can( 'edit_own_polls' ) ){
719
- if ( function_exists( 'add_menu_page' ) ){
720
- if ( $this->current_user_can( 'edit_own_polls' ) ){
721
- $page = add_menu_page( __( 'Yop Poll', 'yop_poll' ), __( 'Yop Poll', 'yop_poll' ), 'read', 'yop-polls', array( $this, 'manage_pages' ), "{$this->_config->plugin_url}/images/yop-poll-admin-menu-icon16.png", '28.734' );
722
- }
723
- }
724
- if ( $this->current_user_can( 'edit_own_polls' ) ){
725
- add_action( "load-$page", array( &$this, 'manage_pages_load' ) );
726
- }
727
- if ( function_exists( 'add_submenu_page' ) ){
728
-
729
- if ( $this->current_user_can( 'edit_own_polls' ) ){
730
- $subpage = add_submenu_page( 'yop-polls', __( 'All Polls', 'yop_poll' ), __( 'All Polls', 'yop_poll' ), 'read', 'yop-polls', array( &$this, 'manage_pages' ) );
731
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
732
- }
733
- if ( $this->current_user_can( 'edit_own_polls' ) ){
734
- $subpage = add_submenu_page( 'yop-polls', __( 'Add New', 'yop_poll' ), __( 'Add New', 'yop_poll' ), 'read', 'yop-polls-add-new', array( &$this, 'manage_pages' ) );
735
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
736
- }
737
- if ( $this->current_user_can( 'manage_polls_options' ) ){
738
- $subpage = add_submenu_page( 'yop-polls', __( 'Options', 'yop_poll' ), __( 'Options', 'yop_poll' ), 'read', 'yop-polls-options', array( &$this, 'manage_pages' ) );
739
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
740
- }
741
- if ( $this->current_user_can( 'edit_own_polls_templates' ) ){
742
- $subpage = add_submenu_page( 'yop-polls', __( 'Templates', 'yop_poll' ), __( 'Templates', 'yop_poll' ), 'read', 'yop-polls-templates', array( &$this, 'manage_pages' ) );
743
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
744
- }
745
- if ( $this->current_user_can( 'view_own_polls_logs' ) ){
746
- $subpage = add_submenu_page( 'yop-polls', __( 'Logs', 'yop_poll' ), __( 'Logs', 'yop_poll' ), 'read', 'yop-polls-logs', array( &$this, 'manage_pages' ) );
747
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
748
- }
749
- if ( $this->current_user_can( 'manage_polls_bans' ) ){
750
- $subpage = add_submenu_page( 'yop-polls', __( 'Bans', 'yop_poll' ), __( 'Bans', 'yop_poll' ), 'read', 'yop-polls-bans', array( &$this, 'manage_pages' ) );
751
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
752
- }
753
- if ( $this->current_user_can( 'become_pro' ) ){
754
- $subpage = add_submenu_page( 'yop-polls', __( 'Become Pro', 'yop_poll' ), __( 'Become Pro', 'yop_poll' ), 'read', 'yop-polls-become-pro', array( &$this, 'manage_pages' ) );
755
- add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
756
- }
757
- }
758
- }
759
- }
760
-
761
- public function manage_pages() {
762
- global $page, $action;
763
- switch ( $page ) {
764
- case 'yop-polls' :
765
- if ( 'custom-fields' == $action ){
766
- $this->view_poll_custom_fields();
767
- break;
768
- }
769
- if ( 'results' == $action ){
770
- $this->view_poll_results();
771
- break;
772
- }
773
- elseif ( 'edit' == $action ) {
774
- }
775
- else {
776
- $this->view_all_polls();
777
- break;
778
- }
779
- case 'yop-polls-add-new' :
780
- $this->view_add_edit_new_poll();
781
- break;
782
- case 'yop-polls-options' :
783
- $this->view_yop_poll_options();
784
- break;
785
- case 'yop-polls-logs' :
786
- $this->view_yop_poll_logs();
787
- break;
788
- case 'yop-polls-bans' :
789
- $this->view_yop_poll_bans();
790
- break;
791
- case 'yop-polls-become-pro' :
792
- $this->view_yop_poll_become_pro();
793
- break;
794
- case 'yop-polls-templates' :
795
- if ( 'add-new' == $action || 'edit' == $action ){
796
- $this->view_add_edit_poll_template();
797
- }
798
- else {
799
- $this->view_yop_poll_templates();
800
- }
801
- break;
802
- default :
803
- $this->view_all_polls();
804
- }
805
- }
806
-
807
- public function manage_pages_load() {
808
- wp_reset_vars( array( 'page', 'action', 'orderby', 'order' ) );
809
- global $page, $action, $orderby, $order, $yop_poll_add_new_config;
810
- $default_options = get_option( 'yop_poll_options', array() );
811
-
812
- wp_enqueue_style( 'yop-poll-admin', "{$this->_config->plugin_url}/css/yop-poll-admin.css", array(), $this->_config->version );
813
- $answers_number = $this->_config->min_number_of_answers + 1; // total +1
814
- $customfields_number = $this->_config->min_number_of_customfields + 1; // total +1
815
-
816
- wp_enqueue_script( 'yop-poll-admin', "{$this->_config->plugin_url}/js/yop-poll-admin.js", array( 'jquery' ), $this->_config->version, true );
817
- $doScroll = 0;
818
- switch ( $page ) {
819
- case 'yop-polls' :
820
- if ( 'results' == $action ){
821
- wp_enqueue_style( 'yop-poll-admin-results', "{$this->_config->plugin_url}/css/yop-poll-admin-results.css", array(), $this->_config->version );
822
- wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
823
- wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
824
- wp_enqueue_script( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), $this->_config->version, true );
825
- wp_enqueue_style( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/css/yop-poll-admin-custom-fields.css", array(), $this->_config->version );
826
- wp_enqueue_script( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/js/yop-poll-admin-custom-fields.js", array( 'jquery', 'yop-poll-jquery-ui-timepicker' ), $this->_config->version, true );
827
- $this->yop_poll_custom_fields_results_operations();
828
- break;
829
- }
830
- if ( 'custom-fields' == $action ){
831
- wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
832
- wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
833
- wp_enqueue_script( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), $this->_config->version, true );
834
- wp_enqueue_style( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/css/yop-poll-admin-custom-fields.css", array(), $this->_config->version );
835
- wp_enqueue_script( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/js/yop-poll-admin-custom-fields.js", array( 'jquery', 'yop-poll-jquery-ui-timepicker' ), $this->_config->version, true );
836
- $this->yop_poll_custom_fields_operations();
837
- break;
838
- }
839
- elseif ( 'edit' == $action ) {
840
- $doScroll = 1;
841
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
842
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
843
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
844
- $answers = Yop_Poll_Model::get_poll_answers( $poll_id );
845
- $answers_number = count( $answers ) + 1; // total +1
846
- $custom_fields = Yop_Poll_Model::get_poll_customfields( $poll_id );
847
- $customfields_number = count( $custom_fields ) + 1; // total +1
848
- }
849
- else {
850
- $this->view_all_polls_operations();
851
- wp_enqueue_script( 'link' );
852
- wp_enqueue_script( 'xfn' );
853
- wp_enqueue_script( 'yop-poll-optin-form', "http://app.getresponse.com/view_webform.js?wid=394041&mg_param1=1", NULL, $this->_config->version, true );
854
- $this->load_optin_box();
855
- break;
856
- }
857
-
858
- case 'yop-polls-add-new' :
859
- $doScroll = 1;
860
- $yop_poll_add_new_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_edit_add_new_poll', 'beforeSendMessage' => __( 'Please wait a moment while we process your request...', 'yop_poll' ), 'errorMessage' => __( 'An error has occured...', 'yop_poll' ) ), 'text_answer' => __( 'Answer', 'yop_poll' ), 'text_customfield' => __( 'Custom Text Field', 'yop_poll' ), 'text_requiered_customfield' => __( 'Required', 'yop_poll' ), 'text_remove_answer' => __( 'Remove', 'yop_poll' ), 'text_remove_customfield' => __( 'Remove', 'yop_poll' ), 'text_customize_answer' => __( 'More Options', 'yop_poll' ), 'text_change_votes_number_answer' => __( 'Change Number Of Votes', 'yop_poll' ), 'text_change_votes_number_poll' => __( 'Change Number Of Total Votes', 'yop_poll' ), 'text_change_answers_number_poll' => __( 'Change Number Of Total Answers', 'yop_poll' ), 'plugin_url' => $this->_config->plugin_url, 'default_number_of_answers' => $answers_number, 'default_number_of_customfields' => $customfields_number, 'text_is_default_answer' => __( 'Make this the default answer', 'yop_poll' ) . '<br><font size="0">(' . __( 'if "yes", answer will be autoselected when poll is displayed', 'yop_poll' ) . ')</font>', 'text_poll_bar_style' => array( 'use_template_bar_label' => __( 'Use Template Result Bar', 'yop_poll' ), 'use_template_bar_yes_label' => __( 'Yes', 'yop_poll' ), 'use_template_bar_no_label' => __( 'No', 'yop_poll' ), 'poll_bar_style_label' => __( 'Yop Poll Bar Style', 'yop_poll' ), 'poll_bar_preview_label' => __( 'Yop Poll Bar Preview', 'yop_poll' ), 'poll_bar_style_background_label' => __( 'Background Color', 'yop_poll' ), 'poll_bar_style_height_label' => __( 'Height', 'yop_poll' ), 'poll_bar_style_border_color_label' => __( 'Border Color', 'yop_poll' ), 'poll_bar_style_border_width_label' => __( 'Border Width', 'yop_poll' ), 'poll_bar_style_border_style_label' => __( 'Border Style', 'yop_poll' ) ), 'poll_bar_default_options' => array( 'use_template_bar' => isset ( $default_options ['use_template_bar'] ) ? $default_options ['use_template_bar'] : 'yes', 'height' => isset ( $default_options ['bar_height'] ) ? $default_options ['bar_height'] : 10, 'background_color' => isset ( $default_options ['bar_background'] ) ? $default_options ['bar_background'] : 'd8e1eb', 'border' => isset ( $default_options ['bar_border_style'] ) ? $default_options ['bar_border_style'] : 'solid', 'border_width' => isset ( $default_options ['bar_border_width'] ) ? $default_options ['bar_border_width'] : 1, 'border_color' => isset ( $default_options ['bar_border_color'] ) ? $default_options ['bar_border_color'] : 'c8c8c8' ) );
861
- wp_enqueue_style( 'yop-poll-admin-add-new', "{$this->_config->plugin_url}/css/yop-poll-admin-add-new.css", array(), $this->_config->version );
862
- wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
863
- wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
864
-
865
- wp_enqueue_script( 'yop-poll-admin-add-new', "{$this->_config->plugin_url}/js/yop-poll-admin-add-new.js", array( 'jquery', 'yop-poll-jquery-ui-timepicker' ), $this->_config->version, true );
866
- wp_enqueue_script( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), $this->_config->version, true );
867
- wp_enqueue_script( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array( 'jquery' ), $this->_config->version, true );
868
- wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array(), $this->_config->version );
869
- wp_localize_script( 'yop-poll-admin-add-new', 'yop_poll_add_new_config', $yop_poll_add_new_config );
870
- wp_enqueue_script( 'link' );
871
- wp_enqueue_script( 'xfn' );
872
- break;
873
- case 'yop-polls-logs' :
874
- wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
875
- wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
876
- wp_enqueue_script( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), $this->_config->version, true );
877
- wp_enqueue_script( 'yop-poll-admin-logs', "{$this->_config->plugin_url}/js/yop-poll-admin-logs.js", array( 'jquery', 'yop-poll-jquery-ui-timepicker' ), $this->_config->version, true );
878
- $this->view_yop_poll_logs_operations();
879
- break;
880
- case 'yop-polls-bans' :
881
- wp_enqueue_script( 'yop-poll-admin-bans', "{$this->_config->plugin_url}/js/yop-poll-admin-bans.js", array( 'jquery' ), $this->_config->version, true );
882
- $this->view_yop_poll_bans_operations();
883
- break;
884
- case 'yop-polls-options' :
885
- $doScroll = 1;
886
- wp_enqueue_style( 'yop-poll-admin-options', "{$this->_config->plugin_url}/css/yop-poll-admin-options.css", array(), $this->_config->version );
887
- wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
888
- wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
889
- wp_enqueue_script( 'yop-poll-admin-options', "{$this->_config->plugin_url}/js/yop-poll-admin-options.js", array( 'jquery', 'yop-poll-jquery-ui-timepicker' ), $this->_config->version, true );
890
- wp_enqueue_script( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), $this->_config->version, true );
891
- wp_enqueue_script( 'link' );
892
- wp_enqueue_script( 'xfn' );
893
- break;
894
- case 'yop-polls-templates' :
895
- if ( 'edit' == $action || 'add-new' == $action ){
896
- $doScroll = 1;
897
- }
898
- add_filter( 'user_can_richedit', create_function( '$a', 'return false;' ), 1 );
899
- wp_enqueue_script( array( 'editor', 'thickbox' ) );
900
- wp_enqueue_style( 'thickbox' );
901
- wp_enqueue_script( 'yop-poll-admin-templates', "{$this->_config->plugin_url}/js/yop-poll-admin-templates.js", array( 'jquery' ), $this->_config->version, true );
902
- $yop_poll_add_new_template_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_edit_add_new_poll_template', 'reset_action' => 'yop_poll_reset_poll_template', 'beforeSendMessage' => __( 'Please wait a moment while we process your request...', 'yop_poll' ), 'errorMessage' => __( 'An error has occured...', 'yop_poll' ) ) );
903
- wp_enqueue_script( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array( 'jquery' ), $this->_config->version, true );
904
- wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array(), $this->_config->version );
905
- wp_localize_script( 'yop-poll-admin-templates', 'yop_poll_add_new_template_config', $yop_poll_add_new_template_config );
906
- $this->view_yop_poll_templates_operations();
907
- break;
908
- default :
909
- $this->view_all_polls_operations();
910
- break;
911
- }
912
- wp_localize_script( 'yop-poll-admin', "yop_poll_do_scroll", array( 'doScroll' => $doScroll ) );
913
- }
914
-
915
- /**
916
- * Start operations section
917
- */
918
- public function view_yop_poll_logs_operations() {
919
- global $page, $action, $order, $orderby, $current_user;
920
- if ( '-1' != $action && isset ( $_REQUEST ['yoppolllogscheck'] ) ){
921
- if ( 'delete' == $action ){
922
- check_admin_referer( 'yop-poll-logs' );
923
- $bulklogs = ( array )$_REQUEST ['yoppolllogscheck'];
924
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
925
- $total_deleted = 0;
926
- foreach ( $bulklogs as $log_id ) {
927
- $log_id = ( int )$log_id;
928
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log_id );
929
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
930
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
931
- Yop_Poll_Model::delete_poll_log_from_db( $log_id );
932
- }
933
- else {
934
- $total_deleted++;
935
- }
936
- }
937
- wp_redirect( add_query_arg( 'deleted', count( $bulklogs ) - $total_deleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'yoppolllogscheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
938
- exit ();
939
- }
940
-
941
- if ( 'delete_group' == $action ){
942
- check_admin_referer( 'yop-poll-logs' );
943
- $bulklogs = ( array )$_REQUEST ['yoppolllogscheck'];
944
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
945
- $total_deleted_group = 0;
946
- foreach ( $bulklogs as $vote_id ) {
947
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $vote_id );
948
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
949
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
950
- Yop_Poll_Model::delete_group_poll_log_from_db( $vote_id );
951
- }
952
- else {
953
- $total_deleted_group++;
954
- }
955
- }
956
- wp_redirect( add_query_arg( 'deleted', count( $bulklogs ) - $total_deleted_group, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'yoppolllogscheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
957
- exit ();
958
- }
959
- }
960
- elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
961
- if ( 'delete' == $action ){
962
- check_admin_referer( 'yop-poll-logs-delete' );
963
- $log_id = ( int )$_REQUEST ['id'];
964
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
965
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log_id );
966
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
967
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
968
- Yop_Poll_Model::delete_poll_log_from_db( $log_id );
969
- }
970
- else {
971
- wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
972
- }
973
- wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
974
- exit ();
975
- }
976
- if ( 'delete_group' == $action ){
977
- check_admin_referer( 'yop-poll-logs-delete' );
978
- $vote_id = $_REQUEST ['id'];
979
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
980
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $vote_id );
981
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
982
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
983
- Yop_Poll_Model::delete_group_poll_log_from_db( $vote_id );
984
- }
985
- else {
986
- wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
987
- }
988
- wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
989
- exit ();
990
- }
991
- }
992
- elseif ( isset ( $_REQUEST ['export'] ) ) {
993
- global $wpdb;
994
- if ( isset( $_REQUEST ['a'] ) && __( 'Export', 'yop_poll' ) == $_REQUEST ['a'] ){
995
- check_admin_referer( 'yop-poll-logs' );
996
- $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
997
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
998
- $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
999
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
1000
- $log_sdate = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
1001
- $log_edate = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
1002
- $group_by = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
1003
-
1004
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1005
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
1006
- if ( $this->current_user_can( 'view_own_polls_logs' ) && $poll_id ){
1007
- if ( $poll_author != $current_user->ID && !$this->current_user_can( 'view_polls_logs' ) ){
1008
- wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
1009
- }
1010
- }
1011
- elseif ( !$this->current_user_can( 'view_polls_logs' ) ) {
1012
- wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
1013
- }
1014
-
1015
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
1016
- if ( $group_by == 'vote' ){
1017
- $search = array( 'fields' => array( 'name', 'ip', 'user_nicename', 'user_email', 'user_from', 'tr_id' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
1018
- }
1019
- else {
1020
- $search = array( 'fields' => array( 'name', 'answer', 'ip', 'other_answer_value', 'user_nicename', 'user_from', 'user_email', 'tr_id' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
1021
- }
1022
- $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
1023
- if ( 'all' == $_REQUEST ['export'] ){
1024
- if ( $group_by == 'vote' ){
1025
- $logs = Yop_Poll_Model::get_group_logs_filter_search( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1026
- }
1027
- else {
1028
- $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1029
- }
1030
- }
1031
- if ( 'page' == $_REQUEST ['export'] ){
1032
- if ( $group_by == 'vote' ){
1033
- $logs = Yop_Poll_Model::get_group_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
1034
- }
1035
- else {
1036
- $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
1037
- }
1038
- }
1039
-
1040
- $csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
1041
- $csv_header_array = array( __( '#', 'yop_poll' ), __( 'Vote ID', 'yop_poll' ), __( 'POLL Name', 'yop_poll' ), __( 'Answer', 'yop_poll' ), __( 'User Type', 'yop_poll' ), __( 'User', 'yop_poll' ), __( 'User Email', 'yop_poll' ), __( 'Tracking ID', 'yop_poll' ), __( 'IP', 'yop_poll' ), __( 'Vote Date', 'yop_poll' ) );
1042
-
1043
- header( 'Content-type: application/csv' );
1044
- header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1045
- ob_start();
1046
- $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1047
-
1048
- if ( !fputcsv( $f, $csv_header_array ) ){
1049
- _e( "Can't write header!", 'yop_poll' );
1050
- }
1051
-
1052
- if ( count( $logs ) > 0 ){
1053
- $index = 1;
1054
- foreach ( $logs as $log ) {
1055
- $logs_data = array( $index, $log ['vote_id'], stripslashes( $log ['name'] ), ( 'Other' == $log ['answer'] ) ? 'Other - ' . stripslashes( $log ['other_answer_value'] ) : stripslashes( $log ['answer'] ), stripslashes( $log ['user_from'] ), stripslashes( $log ['user_nicename'] ), stripslashes( $log ['user_email'] ), stripslashes( $log ['tr_id'] ), stripslashes( $log ['ip'] ), stripslashes( $log ['vote_date'] ) );
1056
- if ( !fputcsv( $f, $logs_data ) ){
1057
- _e( "Can't write header!", 'yop_poll' );
1058
- }
1059
- $index++;
1060
- }
1061
- }
1062
-
1063
- fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1064
- $csvStr = ob_get_contents();
1065
- ob_end_clean();
1066
-
1067
- echo $csvStr;
1068
- exit ();
1069
- }
1070
-
1071
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1072
- exit ();
1073
- }
1074
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1075
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1076
- exit ();
1077
- }
1078
- }
1079
-
1080
- public function yop_poll_custom_fields_operations() {
1081
- global $page, $action;
1082
- if ( isset ( $_REQUEST ['export'] ) ){
1083
- check_admin_referer( 'yop-poll-custom-fields' );
1084
- if ( '' != $_REQUEST ['export'] ){
1085
- $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
1086
- $page_no = ( isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1 );
1087
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1088
- $sdate = ( isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '' );
1089
- $edate = ( isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '' );
1090
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1091
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1092
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1093
- $custom_fields_number = count( $poll_custom_fields );
1094
- $column_custom_fields_ids = array();
1095
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $sdate, $edate );
1096
- $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $per_page );
1097
- if ( intval( $page_no ) > intval( $total_custom_fields_logs_pages ) ){
1098
- $page_no = 1;
1099
- }
1100
-
1101
- if ( 'all' == $_REQUEST ['export'] ){
1102
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', 0, 99999999, $sdate, $edate );
1103
- }
1104
- if ( 'page' == $_REQUEST ['export'] ){
1105
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $page_no - 1 ) * $per_page, $per_page, $sdate, $edate );
1106
- }
1107
-
1108
- $csv_file_name = 'custom_fields_export.' . date( 'YmdHis' ) . '.csv';
1109
- $csv_header_array = array( __( '#', 'yop_poll' ) );
1110
- foreach ( $poll_custom_fields as $custom_field ) {
1111
- $column_custom_fields_ids [] = $custom_field ['id'];
1112
- $csv_header_array [] = ucfirst( $custom_field ['custom_field'] );
1113
- }
1114
- $csv_header_array [] = __( 'Vote Date', 'yop_poll' );
1115
-
1116
- header( 'Content-type: application/csv' );
1117
- header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1118
- ob_start();
1119
- $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1120
- $n = 0;
1121
- if ( isset ( $csv_header_array ) ){
1122
- if ( !fputcsv( $f, $csv_header_array ) ){
1123
- _e( "Can't write header!", 'yop_poll' );
1124
- }
1125
- }
1126
-
1127
- if ( count( $custom_fields_logs ) > 0 ){
1128
- $index = 1;
1129
- foreach ( $custom_fields_logs as $logs ) {
1130
- $column_custom_fields_values = array( $index );
1131
- foreach ( $column_custom_fields_ids as $custom_field_id ) {
1132
- $vote_log_values = array();
1133
- $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
1134
- if ( count( $vote_logs ) > 0 ){
1135
- foreach ( $vote_logs as $vote_log ) {
1136
- $temp = explode( '<#!->', $vote_log );
1137
- $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
1138
- }
1139
- }
1140
- $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
1141
- }
1142
- $column_custom_fields_values [] = $logs ['vote_date'];
1143
- if ( !fputcsv( $f, $column_custom_fields_values ) ){
1144
- _e( "Can't write record!", 'yop_poll' );
1145
- }
1146
- $index++;
1147
- }
1148
- }
1149
- fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1150
- $csvStr = ob_get_contents();
1151
- ob_end_clean();
1152
-
1153
- echo $csvStr;
1154
- exit ();
1155
- }
1156
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1157
- exit ();
1158
- }
1159
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1160
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1161
- exit ();
1162
- }
1163
- }
1164
-
1165
- public function yop_poll_custom_fields_results_operations() {
1166
- global $page, $action;
1167
- if ( isset ( $_REQUEST ['export'] ) ){
1168
- check_admin_referer( 'yop-poll-custom-fields' );
1169
- if ( __( 'Export', 'yop_poll' ) == $_REQUEST ['a'] ){
1170
- $cf_per_page = ( isset ( $_GET ['cf_per_page'] ) ? intval( $_GET ['cf_per_page'] ) : 100 );
1171
- $cf_page_no = ( isset ( $_REQUEST ['cf_page_no'] ) ? ( int )$_REQUEST ['cf_page_no'] : 1 );
1172
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1173
- $cf_sdate = ( isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '' );
1174
- $cf_edate = ( isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '' );
1175
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1176
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1177
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1178
- $custom_fields_number = count( $poll_custom_fields );
1179
- $column_custom_fields_ids = array();
1180
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $cf_sdate, $cf_edate );
1181
- $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $cf_per_page );
1182
- if ( intval( $cf_page_no ) > intval( $total_custom_fields_logs_pages ) ){
1183
- $cf_page_no = 1;
1184
- }
1185
-
1186
- if ( 'all' == $_REQUEST ['export'] ){
1187
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', 0, 99999999, $cf_sdate, $cf_edate );
1188
- }
1189
- if ( 'page' == $_REQUEST ['export'] ){
1190
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $cf_page_no - 1 ) * $cf_per_page, $cf_per_page, $cf_sdate, $cf_edate );
1191
- }
1192
-
1193
- $csv_file_name = 'custom_fields_export.' . date( 'YmdHis' ) . '.csv';
1194
- $csv_header_array = array( __( '#', 'yop_poll' ) );
1195
- foreach ( $poll_custom_fields as $custom_field ) {
1196
- $column_custom_fields_ids [] = $custom_field ['id'];
1197
- $csv_header_array [] = ucfirst( $custom_field ['custom_field'] );
1198
- }
1199
- $csv_header_array [] = __( 'Vote ID', 'yop_poll' );
1200
- $csv_header_array [] = __( 'Traking ID', 'yop_poll' );
1201
- $csv_header_array [] = __( 'Vote Date', 'yop_poll' );
1202
-
1203
- header( 'Content-type: application/csv' );
1204
- header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1205
- ob_start();
1206
- $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1207
- $n = 0;
1208
- if ( isset ( $csv_header_array ) ){
1209
- if ( !fputcsv( $f, $csv_header_array ) ){
1210
- _e( "Can't write header!", 'yop_poll' );
1211
- }
1212
- }
1213
-
1214
- if ( count( $custom_fields_logs ) > 0 ){
1215
- $index = 1;
1216
- foreach ( $custom_fields_logs as $logs ) {
1217
- $column_custom_fields_values = array( $index );
1218
- foreach ( $column_custom_fields_ids as $custom_field_id ) {
1219
- $vote_log_values = array();
1220
- $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
1221
- if ( count( $vote_logs ) > 0 ){
1222
- foreach ( $vote_logs as $vote_log ) {
1223
- $temp = explode( '<#!->', $vote_log );
1224
- $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
1225
- }
1226
- }
1227
- $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
1228
- }
1229
- $column_custom_fields_values [] = $logs ['vote_id'];
1230
- $column_custom_fields_values [] = $logs ['tr_id'];
1231
- $column_custom_fields_values [] = $logs ['vote_date'];
1232
- if ( !fputcsv( $f, $column_custom_fields_values ) ){
1233
- _e( "Can't write record!", 'yop_poll' );
1234
- }
1235
- $index++;
1236
- }
1237
- }
1238
- fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1239
- $csvStr = ob_get_contents();
1240
- ob_end_clean();
1241
-
1242
- echo $csvStr;
1243
- exit ();
1244
- }
1245
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1246
- exit ();
1247
- }
1248
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1249
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1250
- exit ();
1251
- }
1252
- }
1253
-
1254
- public function view_yop_poll_bans_operations() {
1255
- global $page, $action;
1256
- if ( '-1' != $action && isset ( $_REQUEST ['yoppollbanscheck'] ) ){
1257
- if ( 'delete' == $action ){
1258
- check_admin_referer( 'yop-poll-bans' );
1259
- $bulkbans = ( array )$_REQUEST ['yoppollbanscheck'];
1260
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1261
- foreach ( $bulkbans as $ban_id ) {
1262
- $ban_id = ( int )$ban_id;
1263
- Yop_Poll_Model::delete_poll_ban_from_db( $ban_id );
1264
- }
1265
- wp_redirect( add_query_arg( 'deleted', count( $bulkbans ), remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollbanscheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1266
- exit ();
1267
- }
1268
- }
1269
- elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1270
- if ( 'delete' == $action ){
1271
- check_admin_referer( 'yop-poll-bans-delete' );
1272
- $ban_id = ( int )$_REQUEST ['id'];
1273
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1274
- Yop_Poll_Model::delete_poll_ban_from_db( $ban_id );
1275
- wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1276
- exit ();
1277
- }
1278
- }
1279
- elseif ( 'add-ban' == $action ) {
1280
- check_admin_referer( 'yop-poll-add-ban' );
1281
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1282
- $bans = Yop_Poll_Model::add_bans( $_REQUEST );
1283
- if ( $bans ['error'] != '' ){
1284
- wp_redirect( add_query_arg( 'bans-error', urlencode( $bans ['error'] ), remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1285
- exit ();
1286
- }
1287
- else {
1288
- wp_redirect( add_query_arg( 'bans-added', urlencode( ( int )$bans ['success'] ), remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1289
- exit ();
1290
- }
1291
- }
1292
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1293
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1294
- exit ();
1295
- }
1296
- }
1297
-
1298
- public function view_yop_poll_templates_operations() {
1299
- global $page, $action, $yop_poll_add_new_config, $current_user;
1300
- if ( '-1' != $action && isset ( $_REQUEST ['templatecheck'] ) ){
1301
- if ( 'delete' == $action ){
1302
- check_admin_referer( 'yop-poll-templates' );
1303
- $bulktemplates = ( array )$_REQUEST ['templatecheck'];
1304
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1305
- $total_deleted = 0;
1306
- foreach ( $bulktemplates as $template_id ) {
1307
- $template_id = ( int )$template_id;
1308
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1309
- if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){
1310
- Yop_Poll_Model::delete_poll_template_from_db( $template_id );
1311
- }
1312
- else {
1313
- $total_deleted++;
1314
- }
1315
- }
1316
- wp_redirect( add_query_arg( 'deleted', count( $bulktemplates ) - $total_deleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'templatecheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1317
- exit ();
1318
- }
1319
- if ( 'clone' == $action ){
1320
- check_admin_referer( 'yop-poll-templates' );
1321
- $bulktemplates = ( array )$_REQUEST ['templatecheck'];
1322
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1323
- $total_cloned = 0;
1324
- foreach ( $bulktemplates as $template_id ) {
1325
- $template_id = ( int )$template_id;
1326
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1327
- if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){
1328
- Yop_Poll_Model::clone_poll_template( $template_id );
1329
- }
1330
- else {
1331
- $total_cloned++;
1332
- }
1333
- }
1334
- wp_redirect( add_query_arg( 'cloned', count( $bulktemplates ) - $total_cloned, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'templatecheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1335
- exit ();
1336
- }
1337
- }
1338
- elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1339
- if ( 'delete' == $action ){
1340
- check_admin_referer( 'yop-poll-templates' );
1341
- $template_id = ( int )$_REQUEST ['id'];
1342
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1343
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1344
- if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){
1345
- Yop_Poll_Model::delete_poll_template_from_db( $template_id );
1346
- }
1347
- else {
1348
- wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
1349
- }
1350
- wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1351
- exit ();
1352
- }
1353
- if ( 'clone' == $action ){
1354
- check_admin_referer( 'yop-poll-templates' );
1355
- $template_id = ( int )$_REQUEST ['id'];
1356
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1357
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1358
- if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){
1359
- Yop_Poll_Model::clone_poll_template( $template_id );
1360
- }
1361
- else {
1362
- wp_die( __( 'You are not allowed to clone this item.', 'yop_poll' ) );
1363
- }
1364
- wp_redirect( add_query_arg( 'cloned', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1365
- exit ();
1366
- }
1367
- }
1368
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1369
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1370
- exit ();
1371
- }
1372
- }
1373
-
1374
- public function view_all_polls_operations() {
1375
- global $page, $action, $yop_poll_add_new_config, $current_user;
1376
- if ( '-1' != $action && isset ( $_REQUEST ['yoppollcheck'] ) ){
1377
- if ( 'delete' == $action ){
1378
- check_admin_referer( 'yop-poll-view' );
1379
- $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1380
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1381
- $total_undeleted = 0;
1382
- foreach ( $bulkyoppolls as $yoppoll_id ) {
1383
- $yoppoll_id = ( int )$yoppoll_id;
1384
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1385
- if ( ( $this->current_user_can( 'delete_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){
1386
- Yop_Poll_Model::delete_poll_from_db( $yoppoll_id );
1387
- }
1388
- else {
1389
- $total_undeleted++;
1390
- }
1391
- }
1392
- wp_redirect( add_query_arg( 'deleted', count( $bulkyoppolls ) - $total_undeleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1393
- exit ();
1394
- }
1395
- if ( 'clone' == $action ){
1396
- check_admin_referer( 'yop-poll-view' );
1397
- $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1398
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1399
- $total_uncloned = 0;
1400
- foreach ( $bulkyoppolls as $yoppoll_id ) {
1401
- $yoppoll_id = ( int )$yoppoll_id;
1402
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1403
- if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
1404
- Yop_Poll_Model::clone_poll( $yoppoll_id );
1405
- }
1406
- else {
1407
- $total_uncloned++;
1408
- }
1409
- }
1410
- wp_redirect( add_query_arg( 'cloned', count( $bulkyoppolls ) - $total_uncloned, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1411
- exit ();
1412
- }
1413
- if ( 'reset_votes' == $action ){
1414
- check_admin_referer( 'yop-poll-view' );
1415
- $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1416
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1417
- $total_unreseted = 0;
1418
- foreach ( $bulkyoppolls as $yoppoll_id ) {
1419
- $yoppoll_id = ( int )$yoppoll_id;
1420
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1421
- if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){
1422
- Yop_Poll_Model::reset_votes_for_poll( $yoppoll_id );
1423
- }
1424
- else {
1425
- $total_unreseted++;
1426
- }
1427
- }
1428
- wp_redirect( add_query_arg( 'reseted_votes', count( $bulkyoppolls ) - $total_unreseted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1429
- exit ();
1430
- }
1431
- if ( 'delete_logs' == $action ){
1432
- check_admin_referer( 'yop-poll-view' );
1433
- $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1434
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1435
- $total_undeleted_logs = 0;
1436
- foreach ( $bulkyoppolls as $yoppoll_id ) {
1437
- $yoppoll_id = ( int )$yoppoll_id;
1438
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1439
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
1440
- Yop_Poll_Model::delete_all_poll_logs( $yoppoll_id );
1441
- }
1442
- else {
1443
- $total_undeleted_logs++;
1444
- }
1445
- }
1446
- wp_redirect( add_query_arg( 'deleted_logs', count( $bulkyoppolls ) - $total_undeleted_logs, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1447
- exit ();
1448
- }
1449
- }
1450
- elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1451
- if ( 'delete' == $action ){
1452
- check_admin_referer( 'yop-poll-delete' );
1453
- $yoppoll_id = ( int )$_REQUEST ['id'];
1454
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1455
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1456
- if ( ( $this->current_user_can( 'delete_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){
1457
- Yop_Poll_Model::delete_poll_from_db( $yoppoll_id );
1458
- }
1459
- else {
1460
- wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
1461
- }
1462
- wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1463
- exit ();
1464
- }
1465
-
1466
- if ( 'clone' == $action ){
1467
- check_admin_referer( 'yop-poll-clone' );
1468
- $yoppoll_id = ( int )$_REQUEST ['id'];
1469
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1470
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1471
- if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
1472
- Yop_Poll_Model::clone_poll( $yoppoll_id );
1473
- }
1474
- else {
1475
- wp_die( __( 'You are not allowed to clone this item.', 'yop_poll' ) );
1476
- }
1477
- wp_redirect( add_query_arg( 'cloned', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1478
- exit ();
1479
- }
1480
-
1481
- if ( 'reset_votes' == $action ){
1482
- check_admin_referer( 'yop-poll-reset-votes' );
1483
- $yoppoll_id = ( int )$_REQUEST ['id'];
1484
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1485
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1486
- if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){
1487
- Yop_Poll_Model::reset_votes_for_poll( $yoppoll_id );
1488
- }
1489
- else {
1490
- wp_die( __( 'You are not allowed to reset stats for this item.', 'yop_poll' ) );
1491
- }
1492
- wp_redirect( add_query_arg( 'reseted_votes', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1493
- exit ();
1494
- }
1495
-
1496
- if ( 'delete_logs' == $action ){
1497
- check_admin_referer( 'yop-poll-delete-logs' );
1498
- $yoppoll_id = ( int )$_REQUEST ['id'];
1499
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1500
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1501
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
1502
- Yop_Poll_Model::delete_all_poll_logs( $yoppoll_id );
1503
- }
1504
- else {
1505
- wp_die( __( 'You are not allowed to delete logs for this item.', 'yop_poll' ) );
1506
- }
1507
- wp_redirect( add_query_arg( 'deleted_logs', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
1508
- exit ();
1509
- }
1510
- }
1511
- elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1512
- wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
1513
- exit ();
1514
- }
1515
- }
1516
-
1517
- /**
1518
- * End operations section
1519
- */
1520
-
1521
- /**
1522
- * Start Views section
1523
- */
1524
- public function view_all_polls() {
1525
- global $page, $action, $orderby, $order, $current_user;
1526
- $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
1527
- $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'question' => 'asc', 'start_date' => 'asc', 'end_date' => 'asc', 'total_votes' => 'asc', 'total_answers' => 'asc' );
1528
- $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
1529
-
1530
- $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'question' => 'desc', 'start_date' => 'desc', 'end_date' => 'desc', 'total_votes' => 'desc', 'total_answers' => 'desc' );
1531
- $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
1532
-
1533
- $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'question' => 'sortable', 'start_date' => 'sortable', 'end_date' => 'sortable', 'total_votes' => 'sortable', 'total_answers' => 'sortable' );
1534
- $order_sortable [$orderby] = 'sorted';
1535
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1536
- $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
1537
- if ( isset ( $_REQUEST ['filters'] ) ){
1538
- switch ( $_REQUEST ['filters'] ) {
1539
- case 'started' :
1540
- $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
1541
- break;
1542
- case 'not_started' :
1543
- $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '>=' );
1544
- break;
1545
- case 'never_expire' :
1546
- $filter = array( 'field' => 'end_date', 'value' => '9999-12-31 23:59:59', 'operator' => '=' );
1547
- break;
1548
- case 'expired' :
1549
- $filter = array( 'field' => 'end_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
1550
- break;
1551
- }
1552
- }
1553
- $search = array(
1554
- 'fields' => array( 'name', 'question' ),
1555
- 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : ''
1556
- );
1557
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( $orderby, $order, $filter, $search );
1558
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
1559
- $optin_box_modal_query = admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) );
1560
- $optin_box_modal_query = add_query_arg( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
1561
- ?>
1562
- <?php if ( $optin_box_modal_options['show'] == 'yes' ){ ?>
1563
- <a id="yop-poll-show-modal-box"
1564
- href="<?php echo $optin_box_modal_query; ?>" style="display: none;"></a>
1565
- <?php } ?>
1566
- <div class="wrap">
1567
- <div class="icon32 icon32-yop-poll">
1568
- <br>
1569
-
1570
- </div>
1571
- <h2><?php _e( 'Yop Poll', 'yop_poll' ); ?><a class="add-new-h2"
1572
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-add-new', 'id' => false, 'deleted' => false, 'cloned' => false ) ) ); ?>"><?php _e( 'Add New', 'yop_poll' ); ?></a>
1573
- </h2>
1574
- <?php
1575
- if ( isset ( $_REQUEST ['deleted'] ) ){
1576
- echo '<div id="message" class="updated"><p>';
1577
- $deleted = ( int )$_REQUEST ['deleted'];
1578
- printf( _n( '%s Poll deleted.', '%s Polls deleted.', $deleted ), $deleted );
1579
- echo '</p></div>';
1580
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
1581
- }
1582
- ?>
1583
- <?php
1584
- if ( isset ( $_REQUEST ['cloned'] ) ){
1585
- echo '<div id="message" class="updated"><p>';
1586
- $cloned = ( int )$_REQUEST ['cloned'];
1587
- printf( _n( '%s Poll cloned.', '%s Polls cloned.', $cloned ), $cloned );
1588
- echo '</p></div>';
1589
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'cloned' ), $_SERVER ['REQUEST_URI'] );
1590
- }
1591
- ?>
1592
- <?php
1593
- if ( isset ( $_REQUEST ['reseted_votes'] ) ){
1594
- echo '<div id="message" class="updated"><p>';
1595
- $reseted_votes = ( int )$_REQUEST ['reseted_votes'];
1596
- printf( _n( 'Vote reseted for %s Poll.', 'Votes reseted for %s Poll.', $reseted_votes ), $reseted_votes );
1597
- echo '</p></div>';
1598
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'reseted_votes' ), $_SERVER ['REQUEST_URI'] );
1599
- }
1600
- ?>
1601
-
1602
- <?php
1603
- if ( isset ( $_REQUEST ['deleted_logs'] ) ){
1604
- echo '<div id="message" class="updated"><p>';
1605
- $deleted_logs = ( int )$_REQUEST ['deleted_logs'];
1606
- printf( _n( 'Log deleted for %s Poll.', 'Log deleted for %s Polls.', $deleted_logs ), $deleted_logs );
1607
- echo '</p></div>';
1608
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted_logs' ), $_SERVER ['REQUEST_URI'] );
1609
- }
1610
- ?>
1611
-
1612
- <div id="poststuff">
1613
- <div id="post-body" class="metabox-holder columns-2">
1614
- <form action="" method="get">
1615
- <div id="post-body-content">
1616
- <?php wp_nonce_field( 'yop-poll-view' ); ?>
1617
- <input type="hidden" name="order" value="<?php echo $order ?>"/>
1618
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
1619
- <input type="hidden" name="page" value="yop-polls"/>
1620
- <p class="search-box">
1621
- <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
1622
- <input id="yop-poll-search-input" type="search"
1623
- value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
1624
- name="s"/> <input id="search-submit" class="button"
1625
- type="submit" value="<?php _e( 'Search Polls', 'yop_poll' ); ?>"
1626
- name=""/>
1627
- </p>
1628
- <div class="tablenav top">
1629
- <div class="alignleft actions">
1630
- <select name="action">
1631
- <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
1632
- <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
1633
- <option value="clone"><?php _e( 'Clone', 'yop_poll' ); ?></option>
1634
- <option value="reset_votes"><?php _e( 'Reset Votes', 'yop_poll' ); ?></option>
1635
- <option value="delete_logs"><?php _e( 'Delete Logs', 'yop_poll' ); ?></option>
1636
- </select>
1637
- <input type="submit"
1638
- value="<?php _e( 'Apply', 'yop_poll' ); ?>"
1639
- class="button-secondary action" id="doaction" name="">
1640
- </div>
1641
- <div class="alignleft actions">
1642
- <select name="filters">
1643
- <option value="0"><?php _e( 'View All Polls', 'yop_poll' ); ?></option>
1644
- <option
1645
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'never_expire' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1646
- value="never_expire"><?php _e( 'No end date', 'yop_poll' ); ?></option>
1647
- <option
1648
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'expired' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1649
- value="expired"><?php _e( 'Expired', 'yop_poll' ); ?></option>
1650
- <option
1651
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1652
- value="started"><?php _e( 'Started', 'yop_poll' ); ?></option>
1653
- <option
1654
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'not_started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1655
- value="not_started"><?php _e( 'Not Started', 'yop_poll' ); ?></option>
1656
- </select>
1657
- <input type="submit"
1658
- value="<?php _e( 'Filter', 'yop_poll' ); ?>"
1659
- class="button-secondary" id="post-query-submit" name="">
1660
- </div>
1661
- <br class="clear">
1662
- </div>
1663
- <table class="wp-list-table widefat fixed" cellspacing="0">
1664
- <thead>
1665
- <tr>
1666
- <th id="cb" class="manage-column column-cb check-column"
1667
- style="width: 3%;" scope="col"><input type="checkbox"></th>
1668
- <th id="name"
1669
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
1670
- style="width: 30%" scope="col"><a
1671
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
1672
- <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
1673
- class="sorting-indicator"></span>
1674
- </a></th>
1675
- <th id="total_votes"
1676
- class="manage-column <?php echo $order_sortable['total_votes'] ?> <?php echo $order_direction_reverse['total_votes'] ?>"
1677
- style="width: 6%" scope="col"><a
1678
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction['total_votes'] ) ) ); ?>">
1679
- <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
1680
- class="sorting-indicator"></span>
1681
- </a></th>
1682
- <th id="total_answers"
1683
- class="manage-column <?php echo $order_sortable['total_answers'] ?> <?php echo $order_direction_reverse['total_answers'] ?>"
1684
- style="width: 7%" scope="col"><a
1685
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction['total_answers'] ) ) ); ?>">
1686
- <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
1687
- class="sorting-indicator"></span>
1688
- </a></th>
1689
- <th id="question"
1690
- class="manage-column <?php echo $order_sortable['question'] ?> <?php echo $order_direction_reverse['question'] ?>"
1691
- style="width: 24%" scope="col"><a
1692
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction['question'] ) ) ); ?>">
1693
- <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
1694
- class="sorting-indicator"></span>
1695
- </a></th>
1696
- <th id="poll_author" class="manage-column" style="width: 8%"
1697
- scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
1698
- <th id="start-date"
1699
- class="manage-column <?php echo $order_sortable['start_date'] ?> <?php echo $order_direction_reverse['start_date'] ?>"
1700
- style="width: 10%" scope="col"><a
1701
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction['start_date'] ) ) ); ?>">
1702
- <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
1703
- class="sorting-indicator"></span>
1704
- </a></th>
1705
- <th id="end-date"
1706
- class="manage-column <?php echo $order_sortable['end_date'] ?> <?php echo $order_direction_reverse['end_date'] ?>"
1707
- style="width: 10%" scope="col"><a
1708
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction['end_date'] ) ) ); ?>">
1709
- <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
1710
- class="sorting-indicator"></span>
1711
- </a></th>
1712
- </tr>
1713
- </thead>
1714
- <?php
1715
- if ( count( $yop_polls ) > 0 ){
1716
- foreach ( $yop_polls as $yop_poll ) {
1717
- ?>
1718
- <tbody id="the-list">
1719
- <tr valign="middle" class="alternate"
1720
- id="yop-poll-<?php echo $yop_poll['id']; ?>">
1721
- <th class="check-column" scope="row">
1722
- <?php if ( ( $this->current_user_can( 'delete_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){ ?>
1723
- <input type="checkbox"
1724
- value="<?php echo $yop_poll['id']; ?>" name="yoppollcheck[]">
1725
- <?php } ?>
1726
- </th>
1727
- <td><strong>
1728
- <?php if (( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) )) { ?>
1729
- <a
1730
- title="<?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>"
1731
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"
1732
- class="row-title">
1733
- <?php } ?>
1734
- <?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>
1735
- <?php if (( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) )) { ?>
1736
- </a>
1737
- <?php } ?>
1738
- </strong><br>
1739
- <div class="row-actions">
1740
- <?php if ( ( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) ) ){ ?>
1741
- <span class="edit"><a
1742
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
1743
- | </span>
1744
- <?php } ?>
1745
- <?php if ( ( $this->current_user_can( 'view_own_polls_logs' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'view_polls_logs' ) ) ){ ?>
1746
- <span class="edit"><a
1747
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-logs', 'poll_id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Logs', 'yop_poll' ) ?></a>
1748
- | </span>
1749
- <?php } ?>
1750
- <?php if ( ( $this->current_user_can( 'delete_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){ ?>
1751
- <span class="delete"><a
1752
- onclick="if ( confirm( '<?php echo __( "You are about to delete this poll", 'yop_poll' ) . ": \'" . esc_html( $yop_poll['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to delete', 'yop_poll' ); ?>' ) ) { return true;}return false;"
1753
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete' ); ?>"
1754
- class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a>
1755
- | </span>
1756
- <?php } ?>
1757
- <?php if ( ( $this->current_user_can( 'clone_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){ ?>
1758
- <span class="clone"><a
1759
- onclick="if ( confirm( '<?php echo __( "You are about to clone this poll", 'yop_poll' ) . ": \'" . esc_html( $yop_poll['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to clone', 'yop_poll' ); ?>' ) ) { return true;}return false;"
1760
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $yop_poll['id'] ) ), 'yop-poll-clone' ); ?>"
1761
- class="submitclone"><?php _e( 'Clone', 'yop_poll' ) ?></a> |
1762
- </span>
1763
- <?php } ?>
1764
- <?php if ( ( $this->current_user_can( 'view_own_polls_results' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'view_polls_results' ) ) ){ ?>
1765
- <span class="results"><a
1766
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'results', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Results', 'yop_poll' ) ?></a>
1767
- | </span>
1768
- <?php } ?>
1769
- <?php if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){ ?>
1770
- <span class="delete"><a
1771
- onclick="if ( confirm( '<?php echo __( "You are about to reset votes for this poll", 'yop_poll' ) . ": \'" . esc_html( $yop_poll['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to reset votes', 'yop_poll' ); ?>' ) ) { return true;}return false;"
1772
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'reset_votes', 'id' => $yop_poll['id'] ) ), 'yop-poll-reset-votes' ); ?>"
1773
- class="submitresetvotes"><?php _e( 'Reset Stats', 'yop_poll' ) ?></a>
1774
- | </span>
1775
- <?php } ?>
1776
- <?php if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){ ?>
1777
- <span class="delete"><a
1778
- onclick="if ( confirm( '<?php echo __( "You are about to delete logs for this poll", 'yop_poll' ) . ": \'" . esc_html( $yop_poll['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to delete logs', 'yop_poll' ); ?>' ) ) { return true;}return false;"
1779
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_logs', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete-logs' ); ?>"
1780
- class="submitresetvotes"><?php _e( 'Delete Logs', 'yop_poll' ) ?></a></span>
1781
- <?php } ?>
1782
- </div></td>
1783
- <td>
1784
- <?php echo esc_html( stripslashes( $yop_poll['total_votes'] ) ); ?>
1785
- </td>
1786
- <td>
1787
- <?php echo esc_html( stripslashes( $yop_poll['total_answers'] ) ); ?>
1788
- </td>
1789
- <td>
1790
- <?php echo esc_html( stripslashes( $yop_poll['question'] ) ); ?>
1791
- </td>
1792
- <td>
1793
- <?php
1794
- $user_info = get_userdata( $yop_poll ['poll_author'] );
1795
- if ( $user_info ){
1796
- echo esc_html( stripslashes( $user_info->user_login ) );
1797
- }
1798
- else {
1799
- echo '';
1800
- }
1801
- ?>
1802
- </td>
1803
- <td>
1804
- <?php echo esc_html( stripslashes( $yop_poll['start_date'] ) ); ?>
1805
- </td>
1806
- <td>
1807
- <?php
1808
- if ( YOP_POLL_MODEL::get_mysql_curent_date() > $yop_poll ['end_date'] ){
1809
- echo '<font style="color:#CC0000;"><b>';
1810
- }
1811
- echo ( '9999-12-31 23:59:59' == $yop_poll ['end_date'] ) ? __( 'No end date', 'yop_poll' ) : esc_html( stripslashes( $yop_poll ['end_date'] ) );
1812
- if ( YOP_POLL_MODEL::get_mysql_curent_date() > $yop_poll ['end_date'] ){
1813
- echo '</b></font>';
1814
- }?>
1815
- </td>
1816
- </tr>
1817
- </tbody>
1818
- <?php
1819
- }
1820
- }
1821
- else {
1822
- ?>
1823
- <tbody id="the-list">
1824
- <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
1825
- <th colspan="8">
1826
- <?php _e( 'No poll found!', 'yop_poll' ); ?>
1827
- </th>
1828
- </tr>
1829
- </tbody>
1830
- <?php
1831
- }
1832
- ?>
1833
-
1834
- <tfoot>
1835
- <tr>
1836
- <th id="cb" class="manage-column column-cb check-column"
1837
- style="" scope="col"><input type="checkbox"></th>
1838
- <th id="name"
1839
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
1840
- style="" scope="col"><a
1841
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
1842
- <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
1843
- class="sorting-indicator"></span>
1844
- </a></th>
1845
- <th id="total_votes"
1846
- class="manage-column <?php echo $order_sortable['total_votes'] ?> <?php echo $order_direction_reverse['total_votes'] ?>"
1847
- style="" scope="col"><a
1848
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction['total_votes'] ) ) ); ?>">
1849
- <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
1850
- class="sorting-indicator"></span>
1851
- </a></th>
1852
- <th id="total_answers"
1853
- class="manage-column <?php echo $order_sortable['total_answers'] ?> <?php echo $order_direction_reverse['total_answers'] ?>"
1854
- style="" scope="col"><a
1855
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction['total_answers'] ) ) ); ?>">
1856
- <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
1857
- class="sorting-indicator"></span>
1858
- </a></th>
1859
- <th id="question"
1860
- class="manage-column <?php echo $order_sortable['question'] ?> <?php echo $order_direction_reverse['question'] ?>"
1861
- style="" scope="col"><a
1862
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction['question'] ) ) ); ?>">
1863
- <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
1864
- class="sorting-indicator"></span>
1865
- </a></th>
1866
- <th id="poll_author" class="manage-column" style="width: 5%"
1867
- scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
1868
- <th id="start-date"
1869
- class="manage-column <?php echo $order_sortable['start_date'] ?> <?php echo $order_direction_reverse['start_date'] ?>"
1870
- style="" scope="col"><a
1871
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction['start_date'] ) ) ); ?>">
1872
- <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
1873
- class="sorting-indicator"></span>
1874
- </a></th>
1875
- <th id="end-date"
1876
- class="manage-column <?php echo $order_sortable['end_date'] ?> <?php echo $order_direction_reverse['end_date'] ?>"
1877
- style="" scope="col"><a
1878
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction['end_date'] ) ) ); ?>">
1879
- <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
1880
- class="sorting-indicator"></span>
1881
- </a></th>
1882
- </tr>
1883
- </tfoot>
1884
- </table>
1885
- </div>
1886
- </form>
1887
- <?php $this->yop_poll_donate(); ?>
1888
- </div>
1889
- <br class="clear">
1890
- </div>
1891
- </div>
1892
- <?php
1893
- }
1894
-
1895
- public function view_poll_results() {
1896
- global $page, $action, $current_user;
1897
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1898
- $results_order_by = ( isset ( $_GET ['results_order_by'] ) ? $_GET ['results_order_by'] : 'id' );
1899
- $results_order = ( isset ( $_GET ['results_order'] ) ? $_GET ['results_order'] : 'ASC' );
1900
- $soav = ( isset ( $_GET ['soav'] ) ? $_GET ['soav'] : 'no' );
1901
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1902
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
1903
- if ( ( !$this->current_user_can( 'view_own_polls_results' ) || $poll_author != $current_user->ID ) && ( !$this->current_user_can( 'view_polls_results' ) ) ){
1904
- wp_die( __( 'You are not allowed to view results for this item.', 'yop_poll' ) );
1905
- }
1906
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1907
- if ( 'yes' == $soav ){
1908
- $display_other_answers_values = true;
1909
- }
1910
- else {
1911
- $display_other_answers_values = false;
1912
- }
1913
- $poll_answers = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'default', 'other' ), $results_order_by, $results_order, $display_other_answers_values );
1914
- $poll_other_answer = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'other' ) );
1915
-
1916
- // other-answers
1917
- $oa_per_page = ( isset ( $_GET ['oa_per_page'] ) ? intval( $_GET ['oa_per_page'] ) : 100 );
1918
- $oa_page_no = ( isset ( $_REQUEST ['oa_page_no'] ) ? ( int )$_REQUEST ['oa_page_no'] : 1 );
1919
- $total_logs_other_answers = count( YOP_POLL_MODEL::get_other_answers_votes( isset ( $poll_other_answer [0] ['id'] ) ? $poll_other_answer [0] ['id'] : 0 ) );
1920
- $total_logs_other_answers_pages = ceil( $total_logs_other_answers / $oa_per_page );
1921
- if ( intval( $oa_page_no ) > intval( $total_logs_other_answers_pages ) ){
1922
- $oa_page_no = 1;
1923
- }
1924
- $logs_other_answers = YOP_POLL_MODEL::get_other_answers_votes( isset ( $poll_other_answer [0] ['id'] ) ? $poll_other_answer [0] ['id'] : 0, ( $oa_page_no - 1 ) * $oa_per_page, $oa_per_page );
1925
-
1926
- $oa_args = array( 'base' => remove_query_arg( 'oa_page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&oa_page_no=%#%', 'total' => $total_logs_other_answers_pages, 'current' => max( 1, $oa_page_no ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
1927
- $oa_pagination = paginate_links( $oa_args );
1928
- // other-answers
1929
-
1930
- // custom-fields
1931
- $cf_per_page = ( isset ( $_GET ['cf_per_page'] ) ? intval( $_GET ['cf_per_page'] ) : 100 );
1932
- $cf_page_no = ( isset ( $_REQUEST ['cf_page_no'] ) ? ( int )$_REQUEST ['cf_page_no'] : 1 );
1933
- $cf_sdate = ( isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '' );
1934
- $cf_edate = ( isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '' );
1935
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1936
- $custom_fields_number = count( $poll_custom_fields );
1937
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $cf_sdate, $cf_edate );
1938
- $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $cf_per_page );
1939
- if ( intval( $cf_page_no ) > intval( $total_custom_fields_logs_pages ) ){
1940
- $cf_page_no = 1;
1941
- }
1942
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $cf_page_no - 1 ) * $cf_per_page, $cf_per_page, $cf_sdate, $cf_edate );
1943
-
1944
- $column_custom_fields_ids = array();
1945
- $cf_args = array( 'base' => remove_query_arg( 'cf_page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&cf_page_no=%#%', 'total' => $total_custom_fields_logs_pages, 'current' => max( 1, $cf_page_no ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
1946
- $cf_pagination = paginate_links( $cf_args );
1947
- // custom-fields
1948
- ?>
1949
- <div class="wrap">
1950
- <div class="icon32 icon32-yop-poll">
1951
- <br>
1952
-
1953
- </div>
1954
- <h2><?php _e( 'Yop Poll Results', 'yop_poll' ); ?><a class="add-new-h2"
1955
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls' ), remove_query_arg( array( 'action', 'id' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ) ); ?>"><?php _e( 'All Yop Polls', 'yop_poll' ); ?></a>
1956
- </h2>
1957
- <?php
1958
- if ( $poll_details ){
1959
- ?>
1960
- <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) ) ?></h3>
1961
- <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) ) ?></h4>
1962
- <form method="get">
1963
- <input type="hidden" name="page" value="yop-polls"/>
1964
- <input type="hidden" name="action" value="results"/>
1965
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
1966
- <input type="hidden" name="oa_page_no"
1967
- value="<?php echo $oa_page_no; ?>"/>
1968
- <input type="hidden" name="cf_page_no"
1969
- value="<?php echo $cf_page_no; ?>"/>
1970
- <input type="hidden" name="oa_per_page"
1971
- value="<?php echo $oa_per_page; ?>"/>
1972
-
1973
- <div class="tablenav top">
1974
- <div class="alignleft actions">
1975
- <div style="display:inline; float:left; margin:7px;"><?php _e( 'Order By', 'yop_poll' ); ?></div>
1976
- <select name="results_order_by">
1977
- <option <?php selected( $results_order_by, 'id' ) ?> value="id"><?php _e( 'Answer ID', 'yop_poll' ); ?></option>
1978
- <option <?php selected( $results_order_by, 'answer' ) ?> value="answer"><?php _e( 'Answer Value', 'yop_poll' ); ?></option>
1979
- <option <?php selected( $results_order_by, 'votes' ) ?> value="votes"><?php _e( 'Votes', 'yop_poll' ); ?></option>
1980
- </select>
1981
- <select name="results_order">
1982
- <option <?php selected( $results_order, 'ASC' ) ?> value="ASC"><?php _e( 'ASC', 'yop_poll' ); ?></option>
1983
- <option <?php selected( $results_order, 'DESC' ) ?> value="DESC"><?php _e( 'DESC', 'yop_poll' ); ?></option>
1984
- </select>
1985
- &nbsp;| &nbsp;
1986
- <input type="checkbox" value="yes" <?php checked( $soav, 'yes' ); ?> name="soav" id="yop-poll-show_other_answers_values"/>
1987
- <label for="yop-poll-show_other_answers_values"><?php _e( 'Show Other Answers Values', 'yop_poll' ); ?></label>
1988
- <input type="submit"
1989
- value="<?php _e( 'Filter', 'yop_poll' ); ?>"
1990
- class="button-secondary action" id="doaction" name="a">
1991
- </div>
1992
- <br class="clear">
1993
- </div>
1994
- </form>
1995
- <table class="wp-list-table widefat fixed" cellspacing="0">
1996
- <thead>
1997
- <tr>
1998
- <th id="" class="column-answer" style="width: 40%;" scope="col"><?php _e( 'Answer', 'yop_poll' ); ?></th>
1999
- <th id="" class="column-votes" style="width: 5%;" scope="col"><?php _e( 'Votes', 'yop_poll' ); ?></th>
2000
- <th id="" class="column-percent" style="width: 5%;" scope="col"><?php _e( 'Percent', 'yop_poll' ); ?></th>
2001
- <th id="" class="column-bar" style="width: 45%;" scope="col"></th>
2002
- </tr>
2003
- </thead>
2004
- <tbody>
2005
- <?php
2006
- if ( count( $poll_answers ) > 0 ){
2007
- foreach ( $poll_answers as $answer ) {
2008
- ?>
2009
- <tr>
2010
- <th><?php echo esc_html( stripslashes( $answer['answer'] ) ); ?></th>
2011
- <td><?php echo esc_html( stripslashes( $answer['votes'] ) ); ?></td>
2012
- <td><?php echo esc_html( stripslashes( $answer['procentes'] ) ); ?>%</td>
2013
- <td><span class="yop-poll-admin-result-bar" style="width: <?php echo esc_html( stripslashes( $answer['procentes'] ) ); ?>%;">
2014
- </span></td>
2015
- </tr>
2016
- <?php
2017
- }
2018
- }
2019
- else {
2020
- ?>
2021
- <tr>
2022
- <th colspan="4"><?php _e( 'No answers defined!', 'yop_poll' ); ?></th>
2023
- </tr>
2024
- <?php
2025
- }
2026
- ?>
2027
- </tbody>
2028
- </table>
2029
- <br> <br>
2030
- <div style="width: 30%; float: left;">
2031
- <h3><?php _e( 'Poll Other Answers', 'yop_poll' ); ?></h3>
2032
- <form method="get">
2033
- <input type="hidden" name="page" value="yop-polls"/>
2034
- <input type="hidden" name="action" value="results"/>
2035
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2036
- <input type="hidden" name="cf_page_no"
2037
- value="<?php echo $cf_page_no; ?>"/>
2038
- <input type="hidden" name="oa_page_no"
2039
- value="<?php echo $oa_page_no; ?>"/>
2040
- <input type="hidden" name="cf_per_page"
2041
- value="<?php echo $cf_per_page; ?>"/>
2042
- <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>"/>
2043
- <input type="hidden" name="results_order" value="<?php echo $results_order; ?>"/>
2044
- <input type="hidden" name="soav" value="<?php echo $soav; ?>"/>
2045
- <div class="tablenav top">
2046
- <div class="tablenav-pages one-page">
2047
- <label for="yop-poll-oa-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2048
- :</label><input
2049
- id="yop-poll-oa-items-per-page" type="text" name="oa_per_page"
2050
- value="<?php echo $oa_per_page; ?>"/> <input name="a"
2051
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2052
- class="displaying-num"><?php echo count( $logs_other_answers ); ?>
2053
- / <?php echo $total_logs_other_answers; ?> items</span>
2054
- <?php print $oa_pagination; ?>
2055
- </div>
2056
- <br class="clear">
2057
- </div>
2058
- <table class="wp-list-table widefat fixed" cellspacing="0">
2059
- <thead>
2060
- <tr>
2061
- <th id="" class="column-answer" style="width: 40%;" scope="col"><?php _e( 'Other Answers', 'yop_poll' ); ?></th>
2062
- <th id="" class="column-votes" style="width: 5%;" scope="col"><?php _e( 'Votes', 'yop_poll' ); ?></th>
2063
- </tr>
2064
- </thead>
2065
- <tbody>
2066
- <?php
2067
- if ( count( $logs_other_answers ) > 0 ){
2068
- foreach ( $logs_other_answers as $answer ) {
2069
- ?>
2070
- <tr>
2071
- <td><?php echo esc_html( stripslashes( $answer['other_answer_value'] ) ); ?></td>
2072
- <td><?php echo esc_html( stripslashes( $answer['votes'] ) ); ?></td>
2073
- </tr>
2074
- <?php
2075
- }
2076
- }
2077
- else {
2078
- ?>
2079
- <tr>
2080
- <td colspan="2"><?php _e( 'No other answers defined!', 'yop_poll' ); ?></td>
2081
- </tr>
2082
- <?php
2083
- }
2084
- ?>
2085
- </tbody>
2086
- </table>
2087
- <div class="tablenav top">
2088
- <div class="tablenav-pages one-page">
2089
- <?php print $oa_pagination; ?>
2090
- </div>
2091
- </div>
2092
- <br class="clear">
2093
- </form>
2094
- </div>
2095
- <div style="width: 69%; float: right;">
2096
- <h3><?php _e( 'Custom Fields', 'yop_poll' ); ?></h3>
2097
- <form method="get">
2098
- <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2099
- <input type="hidden" name="page" value="yop-polls"/>
2100
- <input type="hidden" name="action" value="results"/>
2101
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2102
- <input type="hidden" name="oa_page_no"
2103
- value="<?php echo $oa_page_no; ?>"/>
2104
- <input type="hidden" name="cf_page_no"
2105
- value="<?php echo $cf_page_no; ?>"/>
2106
- <input type="hidden" name="oa_per_page"
2107
- value="<?php echo $oa_per_page; ?>"/>
2108
- <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>"/>
2109
- <input type="hidden" name="results_order" value="<?php echo $results_order; ?>"/>
2110
- <input type="hidden" name="soav" value="<?php echo $soav; ?>"/>
2111
-
2112
- <div class="tablenav top">
2113
- <div class="alignleft actions">
2114
- <select name="export">
2115
- <option value="page"><?php _e( 'This Page', 'yop_poll' ); ?></option>
2116
- <option value="all"><?php _e( 'All Pages', 'yop_poll' ); ?></option>
2117
- </select> <input type="submit"
2118
- value="<?php _e( 'Export', 'yop_poll' ); ?>"
2119
- class="button-secondary action" id="doaction" name="a">
2120
- &nbsp;&nbsp;&nbsp; <label
2121
- for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2122
- :</label>
2123
- <input id="yop-poll-custom-field-start-date-input" type="text"
2124
- name="cf_sdate" value="<?php echo $cf_sdate; ?>"/>&nbsp;&nbsp; <label
2125
- for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>
2126
- :</label>
2127
- <input id="yop-poll-custom-field-end-date-input" type="text"
2128
- name="cf_edate" value="<?php echo $cf_edate; ?>"/>&nbsp;&nbsp; <input
2129
- value="<?php _e( 'Filter', 'yop_poll' ); ?>" type="submit"
2130
- name="a"/>
2131
- </div>
2132
- <div class="tablenav-pages one-page">
2133
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2134
- :</label><input
2135
- id="yop-poll-items-per-page" type="text" name="cf_per_page"
2136
- value="<?php echo $cf_per_page; ?>"/> <input name="a"
2137
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2138
- class="displaying-num"><?php echo count( $custom_fields_logs ); ?>
2139
- / <?php echo $total_custom_fields_logs; ?> items</span>
2140
- <?php print $cf_pagination; ?>
2141
- </div>
2142
- <br class="clear">
2143
- </div>
2144
- <table class="wp-list-table widefat fixed" cellspacing="0">
2145
- <thead>
2146
- <tr>
2147
- <th id="" class="column-answer" style="width: 5%" scope="col"><?php _e( '#', 'yop_poll' ); ?></th>
2148
- <?php
2149
- foreach ( $poll_custom_fields as $custom_field ) {
2150
- $column_custom_fields_ids [] = $custom_field ['id'];
2151
- ?>
2152
- <th id="custom_field_<?php echo $custom_field['id']; ?>" class="column-custom-field" style="width:<?php echo intval( 80 / intval( $custom_fields_number ) ); ?>%" scope="col"><?php echo ucfirst( $custom_field['custom_field'] ); ?></th>
2153
- <?php
2154
- }
2155
- ?>
2156
- <th id="" class="column-vote-id" style="width:20%"
2157
- scope="col"><?php _e( 'Vote ID', 'yop_poll' ); ?></th>
2158
- <th id="" class="column-tr-id" style="width:15%"
2159
- scope="col"><?php _e( 'Tracking ID', 'yop_poll' ); ?></th>
2160
- <th id="" class="column-vote-date" style="width:15%"
2161
- scope="col"><?php _e( 'Vote Date', 'yop_poll' ); ?></th>
2162
- </tr>
2163
- </thead>
2164
- <tbody>
2165
- <?php
2166
- if ( count( $custom_fields_logs ) > 0 ){
2167
- $index = ( $cf_page_no - 1 ) * $cf_per_page + 1;
2168
- foreach ( $custom_fields_logs as $logs ) {
2169
- ?>
2170
- <tr>
2171
- <td><?php echo $index; ?></td>
2172
- <?php
2173
- foreach ( $column_custom_fields_ids as $custom_field_id ) {
2174
- $vote_log_values = array();
2175
- $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
2176
- if ( count( $vote_logs ) > 0 ){
2177
- foreach ( $vote_logs as $vote_log ) {
2178
- $temp = explode( '<#!->', $vote_log );
2179
- $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
2180
- }
2181
- }
2182
- ?>
2183
- <td><?php echo isset( $vote_log_values[$custom_field_id] ) ? $vote_log_values[$custom_field_id] : ''; ?></td>
2184
- <?php
2185
- }
2186
- ?>
2187
- <td><?php echo $logs['vote_id']; ?></td>
2188
- <td><?php echo $logs['tr_id']; ?></td>
2189
- <td><?php echo $logs['vote_date']; ?></td>
2190
- </tr>
2191
- <?php
2192
- $index++;
2193
- }
2194
- }
2195
- ?>
2196
- </tbody>
2197
- </table>
2198
- <div class="tablenav top">
2199
- <div class="tablenav-pages one-page">
2200
- <?php print $cf_pagination; ?>
2201
- </div>
2202
- <br class="clear">
2203
- </div>
2204
- </form>
2205
- </div>
2206
- <div style="clear: both;"></div>
2207
- </div>
2208
- <?php
2209
- }
2210
- else {
2211
- ?>
2212
- <h3><?php _e( 'Your poll doesn`t exist!', 'yop_poll' ); ?></h3>
2213
- <?php
2214
- }
2215
- }
2216
-
2217
- public function view_poll_custom_fields() {
2218
- global $page, $action;
2219
- $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
2220
- $page_no = ( isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1 );
2221
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
2222
- $sdate = ( isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '' );
2223
- $edate = ( isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '' );
2224
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2225
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
2226
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
2227
- $custom_fields_number = count( $poll_custom_fields );
2228
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $sdate, $edate );
2229
- $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $per_page );
2230
- if ( intval( $page_no ) > intval( $total_custom_fields_logs_pages ) ){
2231
- $page_no = 1;
2232
- }
2233
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $page_no - 1 ) * $per_page, $per_page, $sdate, $edate );
2234
-
2235
- $column_custom_fields_ids = array();
2236
- $args = array( 'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&page_no=%#%', 'total' => $total_custom_fields_logs_pages, 'current' => max( 1, $page_no ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
2237
- $pagination = paginate_links( $args );
2238
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
2239
- ?>
2240
- <div class="wrap">
2241
- <div class="icon32 icon32-yop-poll">
2242
- <br>
2243
-
2244
- </div>
2245
- <h2><?php _e( 'Custom Fields', 'yop_poll' ); ?><a class="add-new-h2"
2246
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls' ), remove_query_arg( array( 'action', 'id' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ) ); ?>"><?php _e( 'All Yop Polls', 'yop_poll' ); ?></a>
2247
- </h2>
2248
- <?php
2249
- if ( $poll_details ){
2250
- if ( $poll_custom_fields ){
2251
- ?>
2252
- <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) ) ?></h3>
2253
- <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) ) ?></h4>
2254
- <form method="get">
2255
- <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2256
- <input type="hidden" name="page" value="yop-polls"/>
2257
- <input type="hidden" name="action" value="custom-fields"/>
2258
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2259
- <input type="hidden" name="page_no" value="<?php echo $page_no; ?>"/>
2260
- <table cellspacing="5" align=" center">
2261
- <tbody>
2262
- <tr>
2263
- <th><label for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2264
- :</label>
2265
- </th>
2266
- <td><input id="yop-poll-custom-field-start-date-input" type="text"
2267
- name="sdate" value="<?php echo $sdate; ?>"/></td>
2268
- </tr>
2269
- <tr>
2270
- <th><label for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>
2271
- :</label>
2272
- </th>
2273
- <td><input id="yop-poll-custom-field-end-date-input" type="text"
2274
- name="edate" value="<?php echo $edate; ?>"/></td>
2275
- </tr>
2276
- <tr>
2277
- <th colspan="2"><input value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2278
- type="submit" name="a"/></th>
2279
- </tr>
2280
- </tbody>
2281
- </table>
2282
- <div class="tablenav top">
2283
- <div class="alignleft actions">
2284
- <select name="export">
2285
- <option selected="selected" value=""><?php _e( 'Do Not Export', 'yop_poll' ); ?></option>
2286
- <option value="page"><?php _e( 'This Page', 'yop_poll' ); ?></option>
2287
- <option value="all"><?php _e( 'All Pages', 'yop_poll' ); ?></option>
2288
- </select> <input type="submit"
2289
- value="<?php _e( 'Export', 'yop_poll' ); ?>"
2290
- class="button-secondary action" id="doaction" name="a">
2291
- </div>
2292
- <div class="tablenav-pages one-page">
2293
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2294
- :</label><input
2295
- id="yop-poll-items-per-page" type="text" name="per_page"
2296
- value="<?php echo $per_page; ?>"/> <input name="a"
2297
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2298
- class="displaying-num"><?php echo count( $custom_fields_logs ); ?>
2299
- / <?php echo $total_custom_fields_logs; ?> items</span>
2300
- <?php print $pagination; ?>
2301
- </div>
2302
- <br class="clear">
2303
- </div>
2304
- <table class="wp-list-table widefat fixed" cellspacing="0">
2305
- <thead>
2306
- <tr>
2307
- <th id="" class="column-answer" style="width: 5%" scope="col"><?php _e( '#', 'yop_poll' ); ?></th>
2308
- <?php
2309
- foreach ( $poll_custom_fields as $custom_field ) {
2310
- $column_custom_fields_ids [] = $custom_field ['id'];
2311
- ?>
2312
- <th id="custom_field_<?php echo $custom_field['id']; ?>" class="column-custom-field" style="width:<?php echo intval( 80 / intval( $custom_fields_number ) ); ?>%" scope="col"><?php echo ucfirst( $custom_field['custom_field'] ); ?></th>
2313
- <?php
2314
- }
2315
- ?>
2316
- <th id="" class="column-vote-date" style="width: 15%"
2317
- scope="col"><?php _e( 'Vote Date', 'yop_poll' ); ?></th>
2318
- </tr>
2319
- </thead>
2320
- <tbody>
2321
- <?php
2322
- if ( count( $custom_fields_logs ) > 0 ){
2323
- $index = ( $page_no - 1 ) * $per_page + 1;
2324
- foreach ( $custom_fields_logs as $logs ) {
2325
- ?>
2326
- <tr>
2327
- <td><?php echo $index; ?></td>
2328
- <?php
2329
- foreach ( $column_custom_fields_ids as $custom_field_id ) {
2330
- $vote_log_values = array();
2331
- $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
2332
- if ( count( $vote_logs ) > 0 ){
2333
- foreach ( $vote_logs as $vote_log ) {
2334
- $temp = explode( '<#!->', $vote_log );
2335
- $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
2336
- }
2337
- }
2338
- ?>
2339
- <td><?php echo isset( $vote_log_values[$custom_field_id] ) ? $vote_log_values[$custom_field_id] : ''; ?></td>
2340
- <?php
2341
- }
2342
- ?>
2343
- <td><?php echo $logs['vote_date']; ?></td>
2344
- </tr>
2345
- <?php
2346
- $index++;
2347
- }
2348
- }
2349
- ?>
2350
- </tbody>
2351
- </table>
2352
- <div class="tablenav top">
2353
- <div class="tablenav-pages one-page">
2354
- <?php print $pagination; ?>
2355
- </div>
2356
- <br class="clear">
2357
- </div>
2358
- </form>
2359
- </div>
2360
- <?php
2361
- }
2362
- else {
2363
- ?>
2364
- <h3><?php _e( 'This poll doesn\'t have set custom fields!', 'yop_poll' ); ?></h3>
2365
- <?php
2366
- }
2367
- }
2368
- else {
2369
- ?>
2370
- <h3><?php _e( 'Your Poll doesn`t exist!', 'yop_poll' ); ?></h3>
2371
- <?php
2372
- }
2373
- }
2374
-
2375
- public function view_yop_poll_templates() {
2376
- global $page, $action, $orderby, $order, $current_user;
2377
- $orderby = ( empty ( $orderby ) ) ? 'last_modified' : $orderby;
2378
- $order = ( empty ( $order ) ) ? 'desc' : $order;
2379
- $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'last_modified' => 'desc' );
2380
- $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
2381
-
2382
- $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'last_modified' => 'desc' );
2383
- $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
2384
-
2385
- $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'last_modified' => 'sortable' );
2386
- $order_sortable [$orderby] = 'sorted';
2387
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2388
- $search = array( 'fields' => array( 'name', 'last_modified' ), 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : '' );
2389
- $yop_poll_templates = Yop_Poll_Model::get_yop_poll_templates_search( $orderby, $order, $search );
2390
- ?>
2391
- <div class="wrap">
2392
- <div class="icon32 icon32-yop-poll">
2393
- <br>
2394
-
2395
- </div>
2396
- <h2><?php _e( 'Yop Poll Templates', 'yop_poll' ); ?><a
2397
- class="add-new-h2"
2398
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-templates', 'action' => 'add-new', 'id' => false, 'deleted' => false, 'cloned' => false ) ) ); ?>"><?php _e( 'Add New', 'yop_poll' ); ?></a>
2399
- </h2>
2400
- <?php
2401
- if ( isset ( $_REQUEST ['deleted'] ) ){
2402
- echo '<div id="message" class="updated"><p>';
2403
- $deleted = ( int )$_REQUEST ['deleted'];
2404
- printf( _n( '%s Poll template deleted.', '%s Poll templates deleted.', $deleted ), $deleted );
2405
- echo '</p></div>';
2406
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
2407
- }
2408
- ?>
2409
- <?php
2410
- if ( isset ( $_REQUEST ['cloned'] ) ){
2411
- echo '<div id="message" class="updated"><p>';
2412
- $cloned = ( int )$_REQUEST ['cloned'];
2413
- printf( _n( '%s Poll template cloned.', '%s Poll templates cloned.', $cloned ), $cloned );
2414
- echo '</p></div>';
2415
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'cloned' ), $_SERVER ['REQUEST_URI'] );
2416
- }
2417
- ?>
2418
- <form action="" method="get">
2419
- <?php wp_nonce_field( 'yop-poll-templates' ); ?>
2420
- <input type="hidden" name="order" value="<?php echo $order ?>"/>
2421
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
2422
- <input type="hidden" name="page" value="yop-polls-templates"/>
2423
- <p class="search-box">
2424
- <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
2425
- <input id="yop-poll-search-input" type="search"
2426
- value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
2427
- name="s"/> <input id="search-submit" class="button" type="submit"
2428
- value="<?php _e( 'Search Polls', 'yop_poll' ); ?>" name=""/>
2429
- </p>
2430
- <div class="tablenav top">
2431
- <div class="alignleft actions">
2432
- <select name="action">
2433
- <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
2434
- <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
2435
- <option value="clone"><?php _e( 'Clone', 'yop_poll' ); ?></option>
2436
- </select> <input type="submit"
2437
- value="<?php _e( 'Apply', 'yop_poll' ); ?>"
2438
- class="button-secondary action" id="doaction" name="">
2439
- </div>
2440
- <br class="clear">
2441
- </div>
2442
- <table class="wp-list-table widefat fixed" cellspacing="0">
2443
- <thead>
2444
- <tr>
2445
- <th id="cb" class="manage-column column-cb check-column"
2446
- scope="col" style="width: 2%;"><input type="checkbox"></th>
2447
- <th id="id"
2448
- class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
2449
- style="width: 10%;" scope="col"><a
2450
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
2451
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2452
- class="sorting-indicator"></span>
2453
- </a></th>
2454
- <th id="name"
2455
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2456
- style="width: 38%;" scope="col"><a
2457
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2458
- <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2459
- class="sorting-indicator"></span>
2460
- </a></th>
2461
- <th id="template_author" class="manage-column" style="width: 10%;"
2462
- scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2463
- <th id="last_modified"
2464
- class="manage-column <?php echo $order_sortable['last_modified'] ?> <?php echo $order_direction_reverse['last_modified'] ?>"
2465
- style="width: 40%;" scope="col"><a
2466
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction['last_modified'] ) ) ); ?>">
2467
- <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2468
- class="sorting-indicator"></span>
2469
- </a></th>
2470
- </tr>
2471
- </thead>
2472
- <?php
2473
- if ( count( $yop_poll_templates ) > 0 ){
2474
- foreach ( $yop_poll_templates as $template ) {
2475
- ?>
2476
- <tbody id="the-list">
2477
- <tr valign="middle" class="alternate"
2478
- id="yop-poll-<?php echo $template['id']; ?>">
2479
- <th class="check-column" scope="row">
2480
- <?php if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){ ?>
2481
- <input type="checkbox" value="<?php echo $template['id']; ?>"
2482
- name="templatecheck[]">
2483
- <?php } ?>
2484
- </th>
2485
- <td><strong>
2486
- <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2487
- <a title="<?php echo $template['id']; ?>"
2488
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2489
- class="row-title">
2490
- <?php } ?>
2491
- <?php echo $template['id']; ?>
2492
- <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2493
- </a>
2494
- <?php } ?>
2495
- </strong><br>
2496
- <div class="row-actions">
2497
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) ) ){ ?>
2498
- <span class="edit"><a
2499
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
2500
- | </span>
2501
- <?php } ?>
2502
- <?php if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){ ?>
2503
- <span class="delete"><a
2504
- onclick="if ( confirm( '<?php echo __( "You are about to delete this poll template", 'yop_poll' ) . ": \'" . esc_html( $template['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to delete', 'yop_poll' ); ?>' ) ) { return true;}return false;"
2505
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2506
- class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a> | </span>
2507
- <?php } ?>
2508
- <?php if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){ ?>
2509
- <span class="clone"><a
2510
- onclick="if ( confirm( '<?php echo __( "You are about to clone this poll template", 'yop_poll' ) . ": \'" . esc_html( $template['name'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to clone', 'yop_poll' ); ?>' ) ) { return true;}return false;"
2511
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2512
- class="submitdelete"><?php _e( 'Clone', 'yop_poll' ) ?></a></span>
2513
- <?php } ?>
2514
- </div></td>
2515
- <td><strong>
2516
- <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2517
- <a
2518
- title="<?php echo esc_html( stripslashes( $template['name'] ) ); ?>"
2519
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2520
- class="row-title">
2521
- <?php } ?>
2522
- <?php echo esc_html( stripslashes( $template['name'] ) ); ?>
2523
- <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2524
- </a>
2525
- <?php } ?>
2526
- </strong><br></td>
2527
- <td>
2528
- <?php
2529
- $user_info = get_userdata( $template ['template_author'] );
2530
- if ( $user_info ){
2531
- echo esc_html( stripslashes( $user_info->user_login ) );
2532
- }
2533
- else {
2534
- echo '';
2535
- }
2536
- ?>
2537
- </td>
2538
- <td>
2539
- <?php echo esc_html( stripslashes( $template['last_modified'] ) ); ?>
2540
- </td>
2541
- </tr>
2542
- </tbody>
2543
- <?php
2544
- }
2545
- }
2546
- else {
2547
- ?>
2548
- <tbody id="the-list">
2549
- <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
2550
- <td id="empty-set" colspan="5">
2551
- <h3 style="margin-bottom: 0px;"><?php _e( " You haven't used our template editor to create any yop poll templates!", 'yop_poll' ); ?> </h3>
2552
- <p style="margin-bottom: 20px;"><?php _e( "Please create your poll template first.", 'yop_poll' ); ?></p>
2553
- <a class="button-primary"
2554
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-templates', 'action' => 'add-new', 'id' => false, 'deleted' => false, 'cloned' => false ) ) ); ?>"><?php _e( "Create a poll template now", 'yop_poll' ); ?></a>
2555
- <br/> <br/>
2556
- </td>
2557
- </tr>
2558
- </tbody>
2559
- <?php
2560
- }
2561
- ?>
2562
-
2563
- <tfoot>
2564
- <tr>
2565
- <th id="cb" class="manage-column column-cb check-column" style=""
2566
- scope="col"><input type="checkbox"></th>
2567
- <th id="id"
2568
- class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
2569
- style="" scope="col"><a
2570
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
2571
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2572
- class="sorting-indicator"></span>
2573
- </a></th>
2574
- <th id="name"
2575
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2576
- style="" scope="col"><a
2577
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2578
- <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2579
- class="sorting-indicator"></span>
2580
- </a></th>
2581
- <th id="template_author" class="manage-column" style="width: 10%;"
2582
- scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2583
- <th id="question"
2584
- class="manage-column <?php echo $order_sortable['last_modified'] ?> <?php echo $order_direction_reverse['last_modified'] ?>"
2585
- style="" scope="col"><a
2586
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction['last_modified'] ) ) ); ?>">
2587
- <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2588
- class="sorting-indicator"></span>
2589
- </a></th>
2590
- </tr>
2591
- </tfoot>
2592
- </table>
2593
- </form>
2594
- </div>
2595
- <?php
2596
- }
2597
-
2598
- public function view_yop_poll_logs() {
2599
- global $wpdb, $page, $action, $orderby, $order, $current_user;
2600
- $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
2601
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
2602
- $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
2603
- $order_direction = array( 'vote_id' => 'asc', 'name' => 'asc', 'answer' => 'asc', 'user_nicename' => 'asc', 'user_email' => 'asc', 'user_from' => 'asc', 'tr_id' => 'asc', 'ip' => 'asc', 'vote_date' => 'asc' );
2604
- $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
2605
-
2606
- $order_direction_reverse = array( 'vote_id' => 'desc', 'name' => 'desc', 'answer' => 'desc', 'user_nicename' => 'desc', 'user_email' => 'desc', 'user_from' => 'desc', 'tr_id' => 'desc', 'ip' => 'desc', 'vote_date' => 'desc' );
2607
- $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
2608
-
2609
- $order_sortable = array( 'vote_id' => 'sortable', 'name' => 'sortable', 'answer' => 'sortable', 'user_nicename' => 'sortable', 'user_email' => 'sortable', 'user_from' => 'sortable', 'tr_id' => 'sortable', 'ip' => 'sortable', 'vote_date' => 'sortable' );
2610
- $order_sortable [$orderby] = 'sorted';
2611
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
2612
-
2613
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2614
-
2615
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2616
- if ( $this->current_user_can( 'view_own_polls_logs' ) && $poll_id ){
2617
- if ( $poll_author != $current_user->ID && !$this->current_user_can( 'view_polls_logs' ) ){
2618
- wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
2619
- }
2620
- }
2621
- elseif ( !$this->current_user_can( 'view_polls_logs' ) ) {
2622
- wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
2623
- }
2624
- $log_sdate = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
2625
- $log_edate = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
2626
- $group_by = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
2627
-
2628
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
2629
- if ( $group_by == 'vote' ){
2630
- $search = array( 'fields' => array( 'name', 'ip', 'user_nicename', 'user_email', 'user_from', 'tr_id' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
2631
- }
2632
- else {
2633
- $search = array( 'fields' => array( 'name', 'answer', 'ip', 'other_answer_value', 'user_nicename', 'user_from', 'tr_id', 'user_email' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
2634
- }
2635
- $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
2636
- if ( $group_by == 'vote' ){
2637
- $total_logs = Yop_Poll_Model::get_total_group_logs_filter_search( $search, $poll_id, $log_sdate, $log_edate );
2638
- }
2639
- else {
2640
- $total_logs = Yop_Poll_Model::get_total_logs_filter_search( $search, $poll_id, $log_sdate, $log_edate );
2641
- }
2642
- $total_logs_pages = ceil( $total_logs / $per_page );
2643
- if ( intval( $page_no ) > intval( $total_logs_pages ) ){
2644
- $page_no = 1;
2645
- }
2646
- if ( $group_by == 'vote' ){
2647
- $logs = Yop_Poll_Model::get_group_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
2648
- }
2649
- else {
2650
- $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
2651
- }
2652
-
2653
- $args = array( 'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&page_no=%#%', 'total' => $total_logs_pages, 'current' => max( 1, $page_no ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
2654
- $pagination = paginate_links( $args );
2655
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
2656
- ?>
2657
- <div class="wrap">
2658
- <div class="icon32 icon32-yop-poll">
2659
- <br>
2660
-
2661
- </div>
2662
- <h2><?php _e( 'Yop Poll Logs', 'yop_poll' ); ?></h2>
2663
- <?php
2664
- if ( isset ( $_REQUEST ['deleted'] ) ){
2665
- echo '<div id="message" class="updated"><p>';
2666
- $deleted = ( int )$_REQUEST ['deleted'];
2667
- printf( _n( '%s Poll Log deleted.', '%s Poll Logs deleted.', $deleted ), $deleted );
2668
- echo '</p></div>';
2669
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
2670
- }
2671
- ?>
2672
- <form method="get">
2673
- <?php wp_nonce_field( 'yop-poll-logs' ); ?>
2674
- <input type="hidden" name="order" value="<?php echo $order ?>"/>
2675
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
2676
- <input type="hidden" name="page" value="yop-polls-logs"/>
2677
- <p class="search-box">
2678
- <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Logs', 'yop_poll' ) ?></label>
2679
- <input id="yop-poll-search-input" type="search"
2680
- value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
2681
- name="s"/> <input id="search-submit" class="button" type="submit"
2682
- value="<?php _e( 'Search Poll Logs', 'yop_poll' ); ?>" name=""/>
2683
- </p>
2684
- <div class="tablenav top">
2685
- <div class="alignleft actions">
2686
- <select name="group_by">
2687
- <option <?php echo selected( $group_by, 'answer' ); ?>
2688
- value="answer"><?php _e( 'Group Logs By Answer', 'yop_poll' ); ?></option>
2689
- <option <?php echo selected( $group_by, 'vote' ); ?> value="vote"><?php _e( 'Group Logs By Vote', 'yop_poll' ); ?></option>
2690
- </select> <input type="submit"
2691
- value="<?php _e( 'Group', 'yop_poll' ); ?>"
2692
- class="button-secondary action" id="doaction" name=""/>
2693
- </div>
2694
- </div>
2695
- <div class="tablenav top">
2696
- <div class="alignleft actions">
2697
- <select name="action">
2698
- <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
2699
- <?php if ( $group_by == 'vote' ){ ?>
2700
- <option value="delete_group"><?php _e( 'Delete', 'yop_poll' ); ?></option>
2701
- <?php
2702
-
2703
- }
2704
- else {
2705
- ?>
2706
- <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
2707
- <?php } ?>
2708
- </select> <input type="submit"
2709
- value="<?php _e( 'Apply', 'yop_poll' ); ?>"
2710
- class="button-secondary action" id="doaction" name="">&nbsp;|&nbsp;
2711
- </div>
2712
- <div class="alignleft actions">
2713
- <select name="poll_id">
2714
- <option value=""><?php _e( 'All Logs', 'yop_poll' ); ?></option>
2715
- <?php
2716
- if ( count( $yop_polls ) > 0 ){
2717
- foreach ( $yop_polls as $yop_poll ) {
2718
- ?>
2719
- <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
2720
- value="<?php echo $yop_poll['id'] ?>"><?php echo $yop_poll['name'] ?></option>
2721
- <?php
2722
- }
2723
- }
2724
- ?>
2725
- </select> <label for="yop-poll-logs-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2726
- :</label>
2727
- <input id="yop-poll-logs-start-date-input" type="text"
2728
- name="log_sdate" value="<?php echo $log_sdate; ?>"/>&nbsp;&nbsp; <label
2729
- for="yop-poll-logs-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>:</label>
2730
- <input id="yop-poll-logs-end-date-input" type="text"
2731
- name="log_edate" value="<?php echo $log_edate; ?>"/>&nbsp;&nbsp; <input
2732
- type="submit" value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2733
- class="button-secondary" id="post-query-submit" name="">&nbsp;|&nbsp;
2734
- </div>
2735
- <div class="alignleft actions">
2736
- <select name="export">
2737
- <option value="page"><?php _e( 'This Page', 'yop_poll' ); ?></option>
2738
- <option value="all"><?php _e( 'All Pages', 'yop_poll' ); ?></option>
2739
- </select> <input type="submit"
2740
- value="<?php _e( 'Export', 'yop_poll' ); ?>"
2741
- class="button-secondary action" id="doaction" name="a">
2742
- &nbsp;&nbsp;&nbsp;
2743
-
2744
- </div>
2745
- <div class="tablenav-pages one-page">
2746
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2747
- :</label>
2748
- <input id="yop-poll-items-per-page" type="text" name="per_page"
2749
- value="<?php echo $per_page; ?>"/> <input name="a"
2750
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;
2751
- <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?>
2752
- logs</span>
2753
- <?php print $pagination; ?>
2754
- </div>
2755
- <br class="clear">
2756
- </div>
2757
- <table class="wp-list-table widefat fixed" cellspacing="0">
2758
- <thead>
2759
- <tr>
2760
- <th id="cb" class="manage-column column-cb check-column"
2761
- style="width: 2%;" scope="col"><input type="checkbox"></th>
2762
- <th id="id"
2763
- class="manage-column <?php echo $order_sortable['vote_id'] ?> <?php echo $order_direction_reverse['vote_id'] ?>"
2764
- style="width: 10%" scope="col"><a
2765
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction['vote_id'] ) ) ); ?>">
2766
- <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
2767
- class="sorting-indicator"></span>
2768
- </a></th>
2769
- <th id="name"
2770
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2771
- style="width: 20%" scope="col"><a
2772
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2773
- <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
2774
- class="sorting-indicator"></span>
2775
- </a></th>
2776
- <th id="total_votes"
2777
- class="manage-column <?php echo $order_sortable['answer'] ?> <?php echo $order_direction_reverse['answer'] ?>"
2778
- style="width: 18%" scope="col"><a
2779
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction['answer'] ) ) ); ?>">
2780
- <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
2781
- class="sorting-indicator"></span>
2782
- </a></th>
2783
- <th id="user_from"
2784
- class="manage-column <?php echo $order_sortable['user_from'] ?> <?php echo $order_direction_reverse['user_from'] ?>"
2785
- style="width: 10%" scope="col"><a
2786
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction['user_from'] ) ) ); ?>">
2787
- <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
2788
- class="sorting-indicator"></span>
2789
- </a></th>
2790
- <th id="user_nicename"
2791
- class="manage-column <?php echo $order_sortable['user_nicename'] ?> <?php echo $order_direction_reverse['user_nicename'] ?>"
2792
- style="width: 10%" scope="col"><a
2793
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction['user_nicename'] ) ) ); ?>">
2794
- <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
2795
- class="sorting-indicator"></span>
2796
- </a></th>
2797
- <th id="user_email"
2798
- class="manage-column <?php echo $order_sortable['user_email'] ?> <?php echo $order_direction_reverse['user_email'] ?>"
2799
- style="width: 10%" scope="col"><a
2800
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction['user_email'] ) ) ); ?>">
2801
- <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
2802
- class="sorting-indicator"></span>
2803
- </a></th>
2804
- <th id="tr_id"
2805
- class="manage-column <?php echo $order_sortable['tr_id'] ?> <?php echo $order_direction_reverse['tr_id'] ?>"
2806
- style="width: 5%" scope="col"><a
2807
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction['tr_id'] ) ) ); ?>">
2808
- <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
2809
- class="sorting-indicator"></span>
2810
- </a></th>
2811
- <th id="ip"
2812
- class="manage-column <?php echo $order_sortable['ip'] ?> <?php echo $order_direction_reverse['ip'] ?>"
2813
- style="width: 5%" scope="col"><a
2814
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction['ip'] ) ) ); ?>">
2815
- <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
2816
- class="sorting-indicator"></span>
2817
- </a></th>
2818
- <th id="vote_date"
2819
- class="manage-column <?php echo $order_sortable['vote_date'] ?> <?php echo $order_direction_reverse['vote_date'] ?>"
2820
- style="width: 10%" scope="col"><a
2821
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction['vote_date'] ) ) ); ?>">
2822
- <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
2823
- class="sorting-indicator"></span>
2824
- </a></th>
2825
- </tr>
2826
- </thead>
2827
- <tfoot>
2828
- <tr>
2829
- <th id="footer_cb" class="manage-column column-cb check-column"
2830
- style="width: 2%;" scope="col"><input type="checkbox"></th>
2831
- <th id="id"
2832
- class="manage-column <?php echo $order_sortable['vote_id'] ?> <?php echo $order_direction_reverse['vote_id'] ?>"
2833
- style="width: 10%" scope="col"><a
2834
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction['vote_id'] ) ) ); ?>">
2835
- <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
2836
- class="sorting-indicator"></span>
2837
- </a></th>
2838
- <th id="footer_name"
2839
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2840
- style="width: 20%" scope="col"><a
2841
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2842
- <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
2843
- class="sorting-indicator"></span>
2844
- </a></th>
2845
- <th id="footer_answer"
2846
- class="manage-column <?php echo $order_sortable['answer'] ?> <?php echo $order_direction_reverse['answer'] ?>"
2847
- style="width: 18%" scope="col"><a
2848
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction['answer'] ) ) ); ?>">
2849
- <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
2850
- class="sorting-indicator"></span>
2851
- </a></th>
2852
- <th id="footer_user_from"
2853
- class="manage-column <?php echo $order_sortable['user_from'] ?> <?php echo $order_direction_reverse['user_from'] ?>"
2854
- style="width: 10%" scope="col"><a
2855
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction['user_from'] ) ) ); ?>">
2856
- <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
2857
- class="sorting-indicator"></span>
2858
- </a></th>
2859
- <th id="footer_user_nicename"
2860
- class="manage-column <?php echo $order_sortable['user_nicename'] ?> <?php echo $order_direction_reverse['user_nicename'] ?>"
2861
- style="width: 10%" scope="col"><a
2862
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction['user_nicename'] ) ) ); ?>">
2863
- <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
2864
- class="sorting-indicator"></span>
2865
- </a></th>
2866
- <th id="footer_user_email"
2867
- class="manage-column <?php echo $order_sortable['user_email'] ?> <?php echo $order_direction_reverse['user_email'] ?>"
2868
- style="width: 10%" scope="col"><a
2869
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction['user_email'] ) ) ); ?>">
2870
- <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
2871
- class="sorting-indicator"></span>
2872
- </a></th>
2873
- <th id="footer_tr_id"
2874
- class="manage-column <?php echo $order_sortable['tr_id'] ?> <?php echo $order_direction_reverse['tr_id'] ?>"
2875
- style="width: 5%" scope="col"><a
2876
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction['tr_id'] ) ) ); ?>">
2877
- <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
2878
- class="sorting-indicator"></span>
2879
- </a></th>
2880
- <th id="footer_ip"
2881
- class="manage-column <?php echo $order_sortable['ip'] ?> <?php echo $order_direction_reverse['ip'] ?>"
2882
- style="width: 5%" scope="col"><a
2883
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction['ip'] ) ) ); ?>">
2884
- <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
2885
- class="sorting-indicator"></span>
2886
- </a></th>
2887
- <th id="footer_vote_date"
2888
- class="manage-column <?php echo $order_sortable['vote_date'] ?> <?php echo $order_direction_reverse['vote_date'] ?>"
2889
- style="width: 10%" scope="col"><a
2890
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction['vote_date'] ) ) ); ?>">
2891
- <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
2892
- class="sorting-indicator"></span>
2893
- </a></th>
2894
- </tr>
2895
- </tfoot>
2896
- <?php
2897
- if ( count( $logs ) > 0 ){
2898
- foreach ( $logs as $log ) {
2899
- ?>
2900
- <tbody id="the-list">
2901
- <tr valign="middle" class="alternate"
2902
- id="yop-poll-log<?php echo $log['id']; ?>">
2903
- <th class="check-column" scope="row">
2904
- <?php if ( $group_by == 'vote' ){ ?>
2905
- <?php
2906
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $log ['vote_id'] );
2907
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2908
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2909
- ?>
2910
- <input type="checkbox"
2911
- value="<?php echo $log['vote_id']; ?>" name="yoppolllogscheck[]">
2912
- <?php } ?>
2913
- <?php
2914
-
2915
- }
2916
- else {
2917
- ?>
2918
- <?php
2919
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log ['id'] );
2920
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2921
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2922
- ?>
2923
- <input type="checkbox" value="<?php echo $log['id']; ?>"
2924
- name="yoppolllogscheck[]">
2925
- <?php } ?>
2926
- <?php } ?>
2927
- </th>
2928
- <td><strong><?php echo $log['vote_id']; ?></strong><br></td>
2929
- <td><strong><?php if ( $log['name'] != '' ){
2930
- echo esc_html( stripslashes( $log['name'] ) );
2931
- }
2932
- else {
2933
- echo esc_html( stripslashes( Yop_Poll_Model::get_poll_field_from_database_by_id( 'name', $poll_id ) ) );
2934
- } ?></strong><br>
2935
- <div class="row-actions">
2936
- <?php if ( $group_by == 'vote' ){ ?>
2937
- <?php
2938
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $log ['vote_id'] );
2939
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2940
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2941
- ?>
2942
- <span class="delete"><a
2943
- onclick="if ( confirm( '<?php echo __( "You are about to delete this vote log", 'yop_poll' ) . " \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to delete', 'yop_poll' ); ?>' ) ) { return true;}return false;"
2944
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_group', 'id' => $log['vote_id'] ) ), 'yop-poll-logs-delete' ); ?>"
2945
- class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
2946
- <?php } ?>
2947
- <?php
2948
-
2949
- }
2950
- else {
2951
- ?>
2952
- <?php
2953
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log ['id'] );
2954
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2955
- if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2956
- ?>
2957
- <span class="delete"><a
2958
- onclick="if ( confirm( '<?php echo __( "You are about to delete this poll log", 'yop_poll' ) . ": \'" . esc_html( $log['id'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to delete', 'yop_poll' ); ?>' ) ) { return true;}return false;"
2959
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $log['id'] ) ), 'yop-poll-logs-delete' ); ?>"
2960
- class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
2961
- <?php } ?>
2962
- <?php } ?>
2963
- </div></td>
2964
- <td>
2965
- <?php echo ( 'Other' == $log['answer'] ) ? 'Other - ' . esc_html( stripslashes( $log['other_answer_value'] ) ) : esc_html( stripslashes( $log['answer'] ) ); ?>
2966
- </td>
2967
- <td>
2968
- <?php echo esc_html( stripslashes( $log['user_from'] ) ); ?>
2969
- </td>
2970
- <td>
2971
- <?php echo esc_html( stripslashes( $log['user_nicename'] ) ); ?>
2972
- </td>
2973
- <td>
2974
- <?php echo esc_html( stripslashes( $log['user_email'] ) ); ?>
2975
- </td>
2976
- <td>
2977
- <?php echo esc_html( stripslashes( $log['tr_id'] ) ); ?>
2978
- </td>
2979
- <td>
2980
- <?php echo esc_html( stripslashes( $log['ip'] ) ); ?>
2981
- </td>
2982
- <td>
2983
- <?php echo esc_html( stripslashes( $log['vote_date'] ) ); ?>
2984
- </td>
2985
- </tr>
2986
- </tbody>
2987
- <?php
2988
- }
2989
- }
2990
- ?>
2991
- </table>
2992
- <div class="tablenav bottom">
2993
- <div class="tablenav-pages one-page">
2994
- <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?>
2995
- logs</span>
2996
- <?php print $pagination; ?>
2997
- </div>
2998
- </div>
2999
- </form>
3000
- </div>
3001
- <?php
3002
- }
3003
-
3004
- public function view_yop_poll_bans() {
3005
- global $wpdb, $page, $action, $orderby, $order;
3006
- $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
3007
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
3008
- $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
3009
- $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'type' => 'asc', 'value' => 'asc' );
3010
- $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
3011
-
3012
- $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'type' => 'desc', 'value' => 'desc' );
3013
- $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
3014
-
3015
- $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'type' => 'sortable', 'value' => 'sortable' );
3016
- $order_sortable [$orderby] = 'sorted';
3017
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
3018
- $type = isset ( $_REQUEST ['type'] ) ? $_REQUEST ['type'] : NULL;
3019
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
3020
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
3021
- $search = array( 'fields' => array( $wpdb->yop_poll_bans . '.value' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
3022
- $total_bans = count( Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $search, $type, $poll_id ) );
3023
- $total_bans_pages = ceil( $total_bans / $per_page );
3024
- if ( intval( $page_no ) > intval( $total_bans_pages ) ){
3025
- $page_no = 1;
3026
- }
3027
- $bans = Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $search, $type, $poll_id, ( $page_no - 1 ) * $per_page, $per_page );
3028
-
3029
- $args = array( 'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&page_no=%#%', 'total' => $total_bans_pages, 'current' => max( 1, $page_no ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
3030
- $pagination = paginate_links( $args );
3031
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
3032
- ?>
3033
- <div class="wrap">
3034
- <div class="icon32 icon32-yop-poll">
3035
- <br>
3036
-
3037
- </div>
3038
- <h2><?php _e( 'Yop Poll Bans', 'yop_poll' ); ?> <a
3039
- href="javascript:void(0);" class="add-new-h2"
3040
- id="yop-poll-add-new-ban"><?php _e( 'Add New', 'yop_poll' ); ?></a>
3041
- </h2>
3042
- <?php
3043
- if ( isset ( $_REQUEST ['deleted'] ) ){
3044
- echo '<div id="message" class="updated"><p>';
3045
- $deleted = ( int )$_REQUEST ['deleted'];
3046
- printf( _n( '%s Poll Ban deleted!', '%s Poll Bans deleted!', $deleted ), $deleted );
3047
- echo '</p></div>';
3048
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
3049
- }
3050
- ?>
3051
- <?php
3052
- if ( isset ( $_REQUEST ['bans-added'] ) ){
3053
- echo '<div id="message" class="updated"><p>';
3054
- $added = ( int )$_REQUEST ['bans-added'];
3055
- printf( _n( '%s Poll Ban added!', '%s Poll Bans added!', $added ), $added );
3056
- echo '</p></div>';
3057
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'bans-added' ), $_SERVER ['REQUEST_URI'] );
3058
- }
3059
- ?>
3060
- <?php
3061
- if ( isset ( $_REQUEST ['bans-error'] ) ){
3062
- echo '<div id="message" class="error"><p>';
3063
- print $_REQUEST ['bans-error'];
3064
- echo '</p></div>';
3065
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'bans-error' ), $_SERVER ['REQUEST_URI'] );
3066
- }
3067
- ?>
3068
- <div id='yop-poll-add-ban-div' style="display: none;">
3069
- <p><?php _e( 'Ban IP, Username or Email', 'yop_poll' ); ?></p>
3070
- <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
3071
- <input type="hidden" name="page" value="yop-polls-bans"/>
3072
- <input type="hidden" name="action" value="add-ban"/>
3073
- <?php wp_nonce_field( 'yop-poll-add-ban' ); ?>
3074
- <table class="form-table">
3075
- <tbody>
3076
- <tr class="form-field form-required">
3077
- <th scope="row"><label for="ban-poll-id"><?php _e( 'Poll', 'yop_poll' ); ?> <span
3078
- class="description">(required)</span></label></th>
3079
- <td><select id="ban-poll-id" name="ban_poll_id">
3080
- <option value="0"><?php _e( 'Bans For All Polls', 'yop_poll' ); ?></option>
3081
- <?php
3082
- if ( count( $yop_polls ) > 0 ){
3083
- foreach ( $yop_polls as $yop_poll ) {
3084
- ?>
3085
- <option value="<?php echo $yop_poll['id'] ?>"><?php echo $yop_poll['name'] ?></option>
3086
- <?php
3087
- }
3088
- }
3089
- ?>
3090
- </select></td>
3091
- </tr>
3092
- <tr class="form-field form-required">
3093
- <th scope="row"><label for="yop-poll-ban-type"><?php _e( 'Type', 'yop_poll' ); ?> <span
3094
- class="description">(required)</span></label></th>
3095
- <td><select id="yop-poll-ban-type" name="ban_type">
3096
- <option value=""><?php _e( 'Choose Ban Type', 'yop_poll' ); ?></option>
3097
- <option value="ip"><?php _e( 'IP', 'yop_poll' ); ?></option>
3098
- <option value="username"><?php _e( 'Username', 'yop_poll' ); ?></option>
3099
- <option value="email"><?php _e( 'Email', 'yop_poll' ); ?></option></td>
3100
- </tr>
3101
- <tr class="form-field form-required">
3102
- <th scope="row"><label for="yop-poll-ban-value"><?php _e( 'Value', 'yop_poll' ); ?>
3103
- <span
3104
- class="description">(required)</span><br> <small><i><?php _e( 'One Value Per Line', 'yop_poll' ); ?></i></small></label></th>
3105
- <td><textarea rows="5" cols="20" id="yop-poll-ban-value"
3106
- name="ban_value"></textarea></td>
3107
- </tr>
3108
- </tbody>
3109
- </table>
3110
- <p class="submit">
3111
- <input type="submit" value="<?php _e( 'Add Ban', 'yop_poll' ); ?> "
3112
- class="button-primary"> <input id="yop-poll-add-ban-close"
3113
- type="button" value="<?php _e( 'Close', 'yop_poll' ); ?> "
3114
- class="button-primary">
3115
-
3116
- </p>
3117
- </form>
3118
- </div>
3119
- <br/>
3120
- <form method="get">
3121
- <?php wp_nonce_field( 'yop-poll-bans' ); ?>
3122
- <input type="hidden" name="order" value="<?php echo $order ?>"/>
3123
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
3124
- <input type="hidden" name="page" value="yop-polls-bans"/>
3125
- <p class="search-box">
3126
- <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Bans', 'yop_poll' ) ?></label>
3127
- <input id="yop-poll-search-input" type="search"
3128
- value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
3129
- name="s"/> <input id="search-submit" class="button" type="submit"
3130
- value="<?php _e( 'Search Poll Bans', 'yop_poll' ); ?>" name=""/>
3131
- </p>
3132
- <div class="tablenav top">
3133
- <div class="alignleft actions">
3134
- <select name="action">
3135
- <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
3136
- <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
3137
- </select> <input type="submit"
3138
- value="<?php _e( 'Apply', 'yop_poll' ); ?>"
3139
- class="button-secondary action" id="doaction" name="">
3140
- </div>
3141
- <div class="alignleft actions">
3142
- <select name="poll_id">
3143
- <option value=""><?php _e( 'All Polls', 'yop_poll' ); ?></option>
3144
- <?php
3145
- if ( count( $yop_polls ) > 0 ){
3146
- foreach ( $yop_polls as $yop_poll ) {
3147
- ?>
3148
- <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
3149
- value="<?php echo $yop_poll['id'] ?>"><?php echo $yop_poll['name'] ?></option>
3150
- <?php
3151
- }
3152
- }
3153
- ?>
3154
- </select>
3155
- </div>
3156
- <div class="alignleft actions">
3157
- <select name="type">
3158
- <option value=""><?php _e( 'All Ban Types', 'yop_poll' ); ?></option>
3159
- <option <?php echo selected( 'ip', $type ); ?> value="ip"><?php _e( 'IP', 'yop_poll' ); ?></option>
3160
- <option <?php echo selected( 'username', $type ); ?> value="username"><?php _e( 'Username', 'yop_poll' ); ?></option>
3161
- <option <?php echo selected( 'email', $type ); ?> value="email"><?php _e( 'Email', 'yop_poll' ); ?></option>
3162
- </select> <input type="submit"
3163
- value="<?php _e( 'Filter', 'yop_poll' ); ?>"
3164
- class="button-secondary" id="post-query-submit" name="">
3165
- </div>
3166
- <div class="tablenav-pages one-page">
3167
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
3168
- :</label>
3169
- <input id="yop-poll-items-per-page" type="text" name="per_page"
3170
- value="<?php echo $per_page; ?>"/> <input name="a"
3171
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;
3172
- <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans;
3173
- _e( 'Bans', 'yop_poll' ) ?> </span>
3174
- <?php print $pagination; ?>
3175
- </div>
3176
- <br class="clear">
3177
- </div>
3178
- <table class="wp-list-table widefat fixed" cellspacing="0">
3179
- <thead>
3180
- <tr>
3181
- <th id="cb" class="manage-column column-cb check-column"
3182
- style="width: 2%;" scope="col"><input type="checkbox"></th>
3183
- <th id="id"
3184
- class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
3185
- style="width: 5%" scope="col"><a
3186
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
3187
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3188
- class="sorting-indicator"></span>
3189
- </a></th>
3190
- <th id="name"
3191
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
3192
- style="width: 25%" scope="col"><a
3193
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
3194
- <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3195
- class="sorting-indicator"></span>
3196
- </a></th>
3197
- <th id="type"
3198
- class="manage-column <?php echo $order_sortable['type'] ?> <?php echo $order_direction_reverse['type'] ?>"
3199
- style="width: 25%" scope="col"><a
3200
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction['type'] ) ) ); ?>">
3201
- <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3202
- class="sorting-indicator"></span>
3203
- </a></th>
3204
- <th id="value"
3205
- class="manage-column <?php echo $order_sortable['value'] ?> <?php echo $order_direction_reverse['value'] ?>"
3206
- style="width: 15%" scope="col"><a
3207
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction['value'] ) ) ); ?>">
3208
- <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3209
- class="sorting-indicator"></span>
3210
- </a></th>
3211
- </tr>
3212
- </thead>
3213
- <tfoot>
3214
- <tr>
3215
- <th id="cb" class="manage-column column-cb check-column"
3216
- style="width: 2%;" scope="col"><input type="checkbox"></th>
3217
- <th id="id"
3218
- class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
3219
- style="width: 5%" scope="col"><a
3220
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
3221
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3222
- class="sorting-indicator"></span>
3223
- </a></th>
3224
- <th id="name"
3225
- class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
3226
- style="width: 25%" scope="col"><a
3227
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
3228
- <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3229
- class="sorting-indicator"></span>
3230
- </a></th>
3231
- <th id="type"
3232
- class="manage-column <?php echo $order_sortable['type'] ?> <?php echo $order_direction_reverse['type'] ?>"
3233
- style="width: 25%" scope="col"><a
3234
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction['type'] ) ) ); ?>">
3235
- <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3236
- class="sorting-indicator"></span>
3237
- </a></th>
3238
- <th id="value"
3239
- class="manage-column <?php echo $order_sortable['value'] ?> <?php echo $order_direction_reverse['value'] ?>"
3240
- style="width: 15%" scope="col"><a
3241
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction['value'] ) ) ); ?>">
3242
- <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3243
- class="sorting-indicator"></span>
3244
- </a></th>
3245
- </tr>
3246
- </tfoot>
3247
- <?php
3248
- if ( count( $bans ) > 0 ){
3249
- foreach ( $bans as $ban ) {
3250
- ?>
3251
- <tbody id="the-list">
3252
- <tr valign="middle" class="alternate"
3253
- id="yop-poll-log<?php echo $ban['id']; ?>">
3254
- <th class="check-column" scope="row"><input type="checkbox"
3255
- value="<?php echo $ban['id']; ?>" name="yoppollbanscheck[]"></th>
3256
- <td><strong><?php echo $ban['id']; ?></strong><br></td>
3257
- <td><strong><?php echo esc_html( stripslashes( $ban['name'] ) ); ?></strong><br>
3258
- <div class="row-actions">
3259
- <span class="delete"><a
3260
- onclick="if ( confirm( '<?php echo __( "You are about to remove this poll ban", 'yop_poll' ) . ": \'" . esc_html( $log['id'] ) . "\' \\n \'" . __( "Cancel", 'yop_poll' ) . "\' " . __( 'to stop', 'yop_poll' ) . ", \'" . __( 'OK', 'yop_poll' ) . "\' " . __( 'to remove', 'yop_poll' ); ?>' ) ) { return true;}return false;"
3261
- href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $ban['id'] ) ), 'yop-poll-bans-delete' ); ?>"
3262
- class="submitdelete"><?php _e( 'Remove', 'yop_poll' ) ?></a></span>
3263
- </div></td>
3264
- <td>
3265
- <?php echo esc_html( stripslashes( $ban['type'] ) ); ?>
3266
- </td>
3267
- <td>
3268
- <?php echo esc_html( stripslashes( $ban['value'] ) ); ?>
3269
- </td>
3270
- </tr>
3271
- </tbody>
3272
- <?php
3273
- }
3274
- }
3275
- ?>
3276
- </table>
3277
- <div class="tablenav bottom">
3278
- <div class="tablenav-pages one-page">
3279
- <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans;
3280
- _e( 'Bans', 'yop_poll' ) ?> </span>
3281
- <?php print $pagination; ?>
3282
- </div>
3283
- </div>
3284
- </form>
3285
- </div>
3286
- <?php
3287
- }
3288
-
3289
- public function view_yop_poll_become_pro() {
3290
- global $wpdb, $page, $action;
3291
- require_once( ABSPATH . '/wp-admin/options-head.php' );
3292
- $pro_options = get_option( 'yop_poll_pro_options', array() );
3293
- ?>
3294
- <div class="wrap">
3295
- <div class="icon32 icon32-yop-poll">
3296
- <br>
3297
-
3298
- </div>
3299
- <h2><?php _e( 'Become Pro', 'yop_poll' ); ?></h2>
3300
- <div id="message"></div>
3301
- <form action="options.php" method="post">
3302
- <?php settings_fields( 'yop_poll_pro_options' ); ?>
3303
- <table class="form-table">
3304
- <tbody>
3305
- <tr valign="top">
3306
- <th scope="row"><label for="pro_key">Your Pro Key</label></th>
3307
- <td><input id="pro_key" class="regular-text" type="text"
3308
- value="<?php echo $pro_options['pro_key']; ?>"
3309
- name="yop_poll_pro_options[pro_key]">
3310
- </tr>
3311
- </tbody>
3312
- </table>
3313
- <?php submit_button(); ?>
3314
- </form>
3315
- </div>
3316
- <?php
3317
- }
3318
-
3319
- public function yop_poll_options_admin_init() {
3320
- register_setting( 'yop_poll_options', 'yop_poll_options', array( &$this, 'yop_poll_options_validate' ) );
3321
- register_setting( 'yop_poll_pro_options', 'yop_poll_pro_options', array( &$this, 'yop_poll_pro_options_validate' ) );
3322
- }
3323
-
3324
- public function yop_poll_pro_options_validate( $input ) {
3325
- $pro_options = get_option( 'yop_poll_pro_options', array() );
3326
- $newinput = $pro_options;
3327
- $errors = '';
3328
- $updated = '';
3329
- $message_delimiter = '<br>';
3330
- // set api key
3331
- if ( isset ( $input ['pro_key'] ) ){
3332
- if ( $input ['pro_key'] != '' ){
3333
- require_once( $this->_config->plugin_inc_dir . '/pro_member_model.php' );
3334
- $yop_poll_pro_member = Yop_Poll_Pro_Member_Model::getInstance();
3335
- if ( $yop_poll_pro_member->register_pro_member( $input ['pro_key'] ) ){
3336
- $newinput ['pro_key'] = trim( $input ['pro_key'] );
3337
- $newinput ['pro_api_key'] = $yop_poll_pro_member->api_return_data['apy_key'];
3338
- $newinput ['pro_user'] = 'yes';
3339
- $updated .= __( 'Your Pro Key Saved!', 'yop_poll' ) . $message_delimiter;
3340
- }
3341
- else {
3342
- $newinput ['pro_key'] = trim( $input ['pro_key'] );
3343
- $newinput ['pro_api_key'] = '';
3344
- $newinput ['pro_user'] = 'no';
3345
- $errors .= __( 'Pro Key Error: ', 'yop_poll' ) . $yop_poll_pro_member->error . $message_delimiter;
3346
- }
3347
- }
3348
- else {
3349
- $newinput ['pro_key'] = $pro_options ['pro_key'];
3350
- $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3351
- $newinput ['pro_user'] = $pro_options ['pro_user'];
3352
- $errors .= __( 'Pro Key Is Empty!', 'yop_poll' ) . $message_delimiter;
3353
- }
3354
- }
3355
- else {
3356
- $newinput ['pro_key'] = $pro_options ['pro_key'];
3357
- $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3358
- $newinput ['pro_user'] = $pro_options ['pro_user'];
3359
- $errors .= __( 'An Error Has Occured!', 'yop_poll' ) . $message_delimiter;
3360
- }
3361
-
3362
- if ( '' != $errors )
3363
- add_settings_error( 'general', 'yop-poll-errors', $errors, 'error' );
3364
- if ( '' != $updated )
3365
- add_settings_error( 'general', 'yop-poll-updates', $updated, 'updated' );
3366
-
3367
- return $newinput;
3368
- }
3369
-
3370
- public function yop_poll_options_validate( $input ) {
3371
- $default_options = get_option( 'yop_poll_options', array() );
3372
- $newinput = $default_options;
3373
- $errors = '';
3374
- $updated = '';
3375
- $message_delimiter = '<br>';
3376
- if ( $this->current_user_can( 'manage_polls_options' ) ){
3377
- // allow_other_answers
3378
- if ( isset ( $input ['allow_other_answers'] ) ){
3379
- if ( in_array( $input ['allow_other_answers'], array( 'yes', 'no' ) ) ){
3380
- if ( $default_options ['allow_other_answers'] != trim( $input ['allow_other_answers'] ) ){
3381
- $newinput ['allow_other_answers'] = trim( $input ['allow_other_answers'] );
3382
- $updated .= __( 'Option "Allow Other Answer" Updated!', 'yop_poll' ) . $message_delimiter;
3383
- }
3384
- }
3385
- else {
3386
- $newinput ['allow_other_answers'] = $default_options ['allow_other_answers'];
3387
- $errors .= __( 'Option "Allow Other Answer" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3388
- }
3389
-
3390
- if ( 'yes' == $input ['allow_other_answers'] ){
3391
- // other_answers_label
3392
- if ( isset ( $input ['other_answers_label'] ) ){
3393
- if ( $default_options ['other_answers_label'] != trim( $input ['other_answers_label'] ) ){
3394
- $newinput ['other_answers_label'] = trim( $input ['other_answers_label'] );
3395
- $updated .= __( 'Option "Other Answer Label" Updated!', 'yop_poll' ) . $message_delimiter;
3396
- }
3397
- }
3398
-
3399
- //add_other_answers_to_default_answers
3400
-
3401
- if ( isset ( $input ['add_other_answers_to_default_answers'] ) ){
3402
- if ( in_array( $input ['add_other_answers_to_default_answers'], array( 'yes', 'no' ) ) ){
3403
- if ( $default_options ['add_other_answers_to_default_answers'] != trim( $input ['add_other_answers_to_default_answers'] ) ){
3404
- $newinput ['add_other_answers_to_default_answers'] = trim( $input ['add_other_answers_to_default_answers'] );
3405
- $updated .= __( 'Option "Add the values submitted in \'Other\' as answers" Updated!', 'yop_poll' ) . $message_delimiter;
3406
- }
3407
- }
3408
- else {
3409
- $newinput ['add_other_answers_to_default_answers'] = $default_options ['add_other_answers_to_default_answers'];
3410
- $errors .= __( 'Option "Add the values submitted in \'Other\' as answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3411
- }
3412
- }
3413
-
3414
- if ( isset ( $input ['display_other_answers_values'] ) ){
3415
- if ( in_array( $input ['display_other_answers_values'], array( 'yes', 'no' ) ) ){
3416
- if ( $default_options ['display_other_answers_values'] != trim( $input ['display_other_answers_values'] ) ){
3417
- $newinput ['display_other_answers_values'] = trim( $input ['display_other_answers_values'] );
3418
- $updated .= __( 'Option "Display Other Answers Values" Updated!', 'yop_poll' ) . $message_delimiter;
3419
- }
3420
- }
3421
- else {
3422
- $newinput ['display_other_answers_values'] = $default_options ['display_other_answers_values'];
3423
- $errors .= __( 'Option "Display Other Answers Values" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3424
- }
3425
- }
3426
- }
3427
- }
3428
-
3429
- // allow_multiple_answers
3430
- if ( isset ( $input ['allow_multiple_answers'] ) ){
3431
- if ( in_array( $input ['allow_multiple_answers'], array( 'yes', 'no' ) ) ){
3432
- if ( $default_options ['allow_multiple_answers'] != trim( $input ['allow_multiple_answers'] ) ){
3433
- $newinput ['allow_multiple_answers'] = trim( $input ['allow_multiple_answers'] );
3434
- $updated .= __( 'Option "Allow Multiple Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3435
- }
3436
-
3437
- // allow_multiple_answers_number
3438
- if ( 'yes' == $input ['allow_multiple_answers'] ){
3439
- if ( isset ( $input ['allow_multiple_answers_number'] ) ){
3440
- if ( ctype_digit( $input ['allow_multiple_answers_number'] ) ){
3441
- if ( $default_options ['allow_multiple_answers_number'] != trim( $input ['allow_multiple_answers_number'] ) ){
3442
- $newinput ['allow_multiple_answers_number'] = trim( $input ['allow_multiple_answers_number'] );
3443
- $updated .= __( 'Option "Max Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3444
- }
3445
- }
3446
- else {
3447
- $newinput ['allow_multiple_answers_number'] = $default_options ['allow_multiple_answers_number'];
3448
- $errors .= __( 'Option "Max Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3449
- }
3450
- }
3451
- if ( isset ( $input ['allow_multiple_answers_min_number'] ) ){
3452
- if ( ctype_digit( $input ['allow_multiple_answers_min_number'] ) ){
3453
- if ( $default_options ['allow_multiple_answers_min_number'] != trim( $input ['allow_multiple_answers_min_number'] ) ){
3454
- $newinput ['allow_multiple_answers_min_number'] = trim( $input ['allow_multiple_answers_min_number'] );
3455
- $updated .= __( 'Option "Min Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3456
- }
3457
- }
3458
- else {
3459
- $newinput ['allow_multiple_answers_min_number'] = $default_options ['allow_multiple_answers_min_number'];
3460
- $errors .= __( 'Option "Min Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3461
- }
3462
- }
3463
- }
3464
- }
3465
- else {
3466
- $newinput ['allow_multiple_answers'] = $default_options ['allow_multiple_answers'];
3467
- $errors .= __( 'Option "Allow Multiple Answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3468
- }
3469
- }
3470
-
3471
- if ( isset ( $input ['use_captcha'] ) ){
3472
- if ( in_array( $input ['use_captcha'], array( 'yes', 'no' ) ) ){
3473
- if ( $default_options ['use_captcha'] != trim( $input ['use_captcha'] ) ){
3474
- $newinput ['use_captcha'] = trim( $input ['use_captcha'] );
3475
- $updated .= __( 'Option "Use CAPTCHA" Updated!', 'yop_poll' ) . $message_delimiter;
3476
- }
3477
- }
3478
- else {
3479
- $newinput ['use_captcha'] = $default_options ['use_captcha'];
3480
- $errors .= __( 'Option "Use CAPTCHA" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3481
- }
3482
- }
3483
-
3484
- // display_answers
3485
- if ( isset ( $input ['display_answers'] ) ){
3486
- if ( in_array( $input ['display_answers'], array( 'vertical', 'orizontal', 'tabulated' ) ) ){
3487
- if ( $default_options ['display_answers'] != trim( $input ['display_answers'] ) ){
3488
- $newinput ['display_answers'] = trim( $input ['display_answers'] );
3489
- $updated .= __( 'Option "Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3490
- }
3491
-
3492
- if ( 'tabulated' == $input ['display_answers'] ){
3493
- // display_answers_tabulated_cols
3494
- if ( isset ( $input ['display_answers_tabulated_cols'] ) ){
3495
- if ( ctype_digit( $input ['display_answers_tabulated_cols'] ) ){
3496
- if ( $default_options ['display_answers_tabulated_cols'] != trim( $input ['display_answers_tabulated_cols'] ) ){
3497
- $newinput ['display_answers_tabulated_cols'] = trim( $input ['display_answers_tabulated_cols'] );
3498
- $updated .= __( 'Option "Columns for Tabulated Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3499
- }
3500
- }
3501
- else {
3502
- $newinput ['display_answers_tabulated_cols'] = $default_options ['display_answers_tabulated_cols'];
3503
- $errors .= __( 'Option "Columns for Tabulated Display Answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3504
- }
3505
- }
3506
- }
3507
- }
3508
- else {
3509
- $newinput ['display_answers'] = $default_options ['display_answers'];
3510
- $errors .= __( 'Option "Display Answers" Not Updated! you must choose between \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3511
- }
3512
- }
3513
-
3514
- // display_results
3515
- if ( isset ( $input ['display_results'] ) ){
3516
- if ( in_array( $input ['display_results'], array( 'vertical', 'orizontal', 'tabulated' ) ) ){
3517
- if ( $default_options ['display_results'] != trim( $input ['display_results'] ) ){
3518
- $newinput ['display_results'] = trim( $input ['display_results'] );
3519
- $updated .= __( 'Option "Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
3520
- }
3521
-
3522
- if ( 'tabulated' == $input ['display_results'] ){
3523
- // display_results_tabulated_cols
3524
- if ( isset ( $input ['display_results_tabulated_cols'] ) ){
3525
- if ( ctype_digit( $input ['display_results_tabulated_cols'] ) ){
3526
- if ( $default_options ['display_results_tabulated_cols'] != trim( $input ['display_results_tabulated_cols'] ) ){
3527
- $newinput ['display_results_tabulated_cols'] = trim( $input ['display_results_tabulated_cols'] );
3528
- $updated .= __( 'Option "Columns for Tabulated Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
3529
- }
3530
- }
3531
- else {
3532
- $newinput ['display_results_tabulated_cols'] = $default_options ['display_results_tabulated_cols'];
3533
- $errors .= __( 'Option "Columns for Tabulated Display Results" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3534
- }
3535
- }
3536
- }
3537
- }
3538
- else {
3539
- $newinput ['display_results'] = $default_options ['display_results'];
3540
- $errors .= __( 'Option "Display Results" Not Updated! Choose the display layout: \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3541
- }
3542
- }
3543
- //template_width
3544
- if ( isset ( $input ['template_width'] ) ){
3545
- if ( '' != trim( $input ['template_width'] ) ){
3546
- if ( $default_options ['template_width'] != trim( $input ['template_width'] ) ){
3547
- $newinput ['template_width'] = trim( $input ['template_width'] );
3548
- $updated .= __( 'Option "Poll Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3549
- }
3550
- }
3551
- else {
3552
- $newinput ['template_width'] = $default_options ['template_width'];
3553
- $errors .= __( 'Option "Poll Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3554
- }
3555
- }
3556
-
3557
- //widget_template_width
3558
- if ( isset ( $input ['widget_template_width'] ) ){
3559
- if ( '' != trim( $input ['widget_template_width'] ) ){
3560
- if ( $default_options ['widget_template_width'] != trim( $input ['widget_template_width'] ) ){
3561
- $newinput ['widget_template_width'] = trim( $input ['widget_template_width'] );
3562
- $updated .= __( 'Option "Widget Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3563
- }
3564
- }
3565
- else {
3566
- $newinput ['widget_template_width'] = $default_options ['widget_template_width'];
3567
- $errors .= __( 'Option "Widget Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3568
- }
3569
- }
3570
-
3571
- // use_template_bar
3572
- if ( isset ( $input ['use_template_bar'] ) ){
3573
- if ( in_array( $input ['use_template_bar'], array( 'yes', 'no' ) ) ){
3574
- if ( $default_options ['use_template_bar'] != trim( $input ['use_template_bar'] ) ){
3575
- $newinput ['use_template_bar'] = trim( $input ['use_template_bar'] );
3576
- $updated .= __( 'Option "Use Template Result Bar" Updated!', 'yop_poll' ) . $message_delimiter;
3577
- }
3578
-
3579
- if ( 'no' == $input ['use_template_bar'] ){
3580
- // bar_background
3581
- if ( isset ( $input ['bar_background'] ) ){
3582
- if ( ctype_alnum( $input ['bar_background'] ) ){
3583
- if ( $default_options ['bar_background'] != trim( $input ['bar_background'] ) ){
3584
- $newinput ['bar_background'] = trim( $input ['bar_background'] );
3585
- $updated .= __( 'Option "Result Bar Background Color" Updated!', 'yop_poll' ) . $message_delimiter;
3586
- }
3587
- }
3588
- else {
3589
- $newinput ['bar_background'] = $default_options ['bar_background'];
3590
- $errors .= __( 'Option "Result Bar Background Color" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
3591
- }
3592
- }
3593
-
3594
- // bar_height
3595
- if ( isset ( $input ['bar_height'] ) ){
3596
- if ( ctype_digit( $input ['bar_height'] ) ){
3597
- if ( $default_options ['bar_height'] != trim( $input ['bar_height'] ) ){
3598
- $newinput ['bar_height'] = trim( $input ['bar_height'] );
3599
- $updated .= __( 'Option "Result Bar Height" Updated!', 'yop_poll' ) . $message_delimiter;
3600
- }
3601
- }
3602
- else {
3603
- $newinput ['bar_height'] = $default_options ['bar_height'];
3604
- $errors .= __( 'Option "Result Bar Height" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3605
- }
3606
- }
3607
-
3608
- // bar_border_color
3609
- if ( isset ( $input ['bar_border_color'] ) ){
3610
- if ( ctype_alnum( $input ['bar_border_color'] ) ){
3611
- if ( $default_options ['bar_border_color'] != trim( $input ['bar_border_color'] ) ){
3612
- $newinput ['bar_border_color'] = trim( $input ['bar_border_color'] );
3613
- $updated .= __( 'Option "Result Bar Border Color" Updated!', 'yop_poll' ) . $message_delimiter;
3614
- }
3615
- }
3616
- else {
3617
- $newinput ['bar_border_color'] = $default_options ['bar_border_color'];
3618
- $errors .= __( 'Option "Result Bar Border Color" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3619
- }
3620
- }
3621
-
3622
- // bar_border_width
3623
- if ( isset ( $input ['bar_border_width'] ) ){
3624
- if ( ctype_digit( $input ['bar_border_width'] ) ){
3625
- if ( $default_options ['bar_border_width'] != trim( $input ['bar_border_width'] ) ){
3626
- $newinput ['bar_border_width'] = trim( $input ['bar_border_width'] );
3627
- $updated .= __( 'Option "Result Bar Border Width" Updated!', 'yop_poll' ) . $message_delimiter;
3628
- }
3629
- }
3630
- else {
3631
- $newinput ['bar_border_width'] = $default_options ['bar_border_width'];
3632
- $errors .= __( 'Option "Result Bar Border Width" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3633
- }
3634
- }
3635
-
3636
- // bar_border_style
3637
- if ( isset ( $input ['bar_border_style'] ) ){
3638
- if ( ctype_alpha( $input ['bar_border_style'] ) ){
3639
- if ( $default_options ['bar_border_style'] != trim( $input ['bar_border_style'] ) ){
3640
- $newinput ['bar_border_style'] = trim( $input ['bar_border_style'] );
3641
- $updated .= __( 'Option "Result Bar Border Style" Updated!', 'yop_poll' ) . $message_delimiter;
3642
- }
3643
- }
3644
- else {
3645
- $newinput ['bar_border_style'] = $default_options ['bar_border_style'];
3646
- $errors .= __( 'Option "Result Bar Border Style" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
3647
- }
3648
- }
3649
- }
3650
- }
3651
- else {
3652
- $newinput ['use_template_bar'] = $default_options ['use_template_bar'];
3653
- $errors .= __( 'Option "Use Template Result Bar" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3654
- }
3655
- }
3656
-
3657
- // sorting_answers
3658
- if ( isset ( $input ['sorting_answers'] ) ){
3659
- if ( in_array( $input ['sorting_answers'], array( 'exact', 'alphabetical', 'random', 'votes' ) ) ){
3660
- if ( $default_options ['sorting_answers'] != trim( $input ['sorting_answers'] ) ){
3661
- $newinput ['sorting_answers'] = trim( $input ['sorting_answers'] );
3662
- $updated .= __( 'Option "Sort Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3663
- }
3664
-
3665
- // sorting_answers_direction
3666
- if ( isset ( $input ['sorting_answers_direction'] ) ){
3667
- if ( in_array( $input ['sorting_answers_direction'], array( 'asc', 'desc' ) ) ){
3668
- if ( $default_options ['sorting_answers_direction'] != trim( $input ['sorting_answers_direction'] ) ){
3669
- $newinput ['sorting_answers_direction'] = trim( $input ['sorting_answers_direction'] );
3670
- $updated .= __( 'Option "Sort Answers Direction" Updated!', 'yop_poll' ) . $message_delimiter;
3671
- }
3672
- }
3673
- else {
3674
- $newinput ['sorting_answers_direction'] = $default_options ['sorting_answers_direction'];
3675
- $errors .= __( 'Option "Sort Answers Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
3676
- }
3677
- }
3678
- }
3679
- else {
3680
- $newinput ['sorting_answers'] = $default_options ['sorting_answers'];
3681
- $errors .= __( 'Option "Sort Answers" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
3682
- }
3683
- }
3684
-
3685
- // sorting_results
3686
- if ( isset ( $input ['sorting_answers'] ) ){
3687
- if ( in_array( $input ['sorting_results'], array( 'exact', 'alphabetical', 'random', 'votes' ) ) ){
3688
- if ( $default_options ['sorting_results'] != trim( $input ['sorting_results'] ) ){
3689
- $newinput ['sorting_results'] = trim( $input ['sorting_results'] );
3690
- $updated .= __( 'Option "Sort Results" Updated!', 'yop_poll' ) . $message_delimiter;
3691
- }
3692
-
3693
- // sorting_results_direction
3694
- if ( isset ( $input ['sorting_results_direction'] ) ){
3695
- if ( in_array( $input ['sorting_results_direction'], array( 'asc', 'desc' ) ) ){
3696
- if ( $default_options ['sorting_results_direction'] != trim( $input ['sorting_results_direction'] ) ){
3697
- $newinput ['sorting_results_direction'] = trim( $input ['sorting_results_direction'] );
3698
- $updated .= __( 'Option "Sort Results Direction" Updated!', 'yop_poll' ) . $message_delimiter;
3699
- }
3700
- }
3701
- else {
3702
- $newinput ['sorting_results_direction'] = $default_options ['sorting_results_direction'];
3703
- $errors .= __( 'Option "Sort Results Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
3704
- }
3705
- }
3706
- }
3707
- else {
3708
- $newinput ['sorting_results'] = $default_options ['sorting_results'];
3709
- $errors .= __( 'Option "Sort Results" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
3710
- }
3711
- }
3712
-
3713
- // start_date
3714
- if ( isset ( $input ['start_date'] ) ){
3715
- if ( '' != trim( $input ['start_date'] ) ){
3716
- if ( $default_options ['start_date'] != trim( $input ['start_date'] ) ){
3717
- $newinput ['start_date'] = trim( $input ['start_date'] );
3718
- $updated .= __( 'Option "Poll Start Date" Updated!', 'yop_poll' ) . $message_delimiter;
3719
- }
3720
- }
3721
- else {
3722
- $newinput ['start_date'] = $default_options ['start_date'];
3723
- $errors .= __( 'Option "Poll Start Date" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3724
- }
3725
- }
3726
-
3727
- // never_expire
3728
- if ( !isset ( $input ['never_expire'] ) ){
3729
- $input ['never_expire'] = 'no';
3730
- }
3731
- if ( 'yes' == $input ['never_expire'] ){
3732
- if ( $default_options ['never_expire'] != trim( $input ['never_expire'] ) ){
3733
- $newinput ['never_expire'] = trim( $input ['never_expire'] );
3734
- $newinput ['end_date'] = '9999-12-31 23:59:59';
3735
- $updated .= __( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
3736
- }
3737
- }
3738
- else {
3739
- if ( isset ( $input ['end_date'] ) ){
3740
- if ( '' != $input ['end_date'] ){
3741
- if ( $default_options ['end_date'] != trim( $input ['end_date'] ) ){
3742
- $newinput ['end_date'] = $input ['end_date'];
3743
- $newinput ['never_expire'] = 'no';
3744
- $updated .= __( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
3745
- }
3746
- }
3747
- else {
3748
- $errors .= __( 'Option "Poll End Date" Not Updated! The field is empty! ', 'yop_poll' ) . $message_delimiter;
3749
- }
3750
- }
3751
- }
3752
-
3753
- // view_results
3754
- if ( isset ( $input ['view_results'] ) ){
3755
- if ( in_array( $input ['view_results'], array( 'before', 'after', 'after-poll-end-date', 'never', 'custom-date' ) ) ){
3756
- if ( $default_options ['view_results'] != trim( $input ['view_results'] ) ){
3757
- $newinput ['view_results'] = trim( $input ['view_results'] );
3758
- $updated .= __( 'Option "View Results" Updated!', 'yop_poll' ) . $message_delimiter;
3759
- }
3760
-
3761
- if ( 'custom-date' == $newinput ['view_results'] ){
3762
- // view_results_start_date
3763
- if ( isset ( $input ['view_results_start_date'] ) ){
3764
- if ( $default_options ['view_results_start_date'] != trim( $input ['view_results_start_date'] ) ){
3765
- $newinput ['view_results_start_date'] = $input ['view_results_start_date'];
3766
- $updated .= __( 'Option "View Results Custom Date" Updated!', 'yop_poll' ) . $message_delimiter;
3767
- }
3768
- }
3769
- }
3770
- }
3771
- else {
3772
- $newinput ['view_results'] = $default_options ['view_results'];
3773
- $errors .= __( 'Option "View Results" Not Updated! Please choose between: \'Before\', \'After\', \'After Poll End Date\', \'Never\' or \'Custom Date\'', 'yop_poll' ) . $message_delimiter;
3774
- }
3775
- }
3776
-
3777
- // vote_permisions
3778
- if ( isset ( $input ['view_results_permissions'] ) ){
3779
- if ( in_array( $input ['view_results_permissions'], array( 'quest-only', 'registered-only', 'guest-registered' ) ) ){
3780
- if ( $default_options ['view_results_permissions'] != trim( $input ['view_results_permissions'] ) ){
3781
- $newinput ['view_results_permissions'] = trim( $input ['view_results_permissions'] );
3782
- $updated .= __( 'Option "View Results Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
3783
- }
3784
- }
3785
- else {
3786
- $newinput ['view_results_permissions'] = $default_options ['view_results_permissions'];
3787
- $errors .= __( 'Option "View Results Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
3788
- }
3789
- }
3790
-
3791
- // view_results_type
3792
- if ( isset ( $input ['view_results_type'] ) ){
3793
- if ( in_array( $input ['view_results_type'], array( 'votes-number', 'percentages', 'votes-number-and-percentages' ) ) ){
3794
- if ( $default_options ['view_results_type'] != trim( $input ['view_results_type'] ) ){
3795
- $newinput ['view_results_type'] = trim( $input ['view_results_type'] );
3796
- $updated .= __( 'Option "View Results Type" Updated!', 'yop_poll' ) . $message_delimiter;
3797
- }
3798
- }
3799
- else {
3800
- $newinput ['view_results_type'] = $default_options ['view_results_type'];
3801
- $errors .= __( 'Option "View Results Type" Not Updated! Please choose between: \'Votes number\', \'Percentages\' or \'Votes number and percentages\' ', 'yop_poll' ) . $message_delimiter;
3802
- }
3803
- }
3804
-
3805
- // answer_result_label
3806
- if ( isset ( $input ['answer_result_label'] ) ){
3807
- if ( 'votes-number' == $input ['view_results_type'] ){
3808
- if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ){
3809
- $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3810
- $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES%!', 'yop_poll' ) . $message_delimiter;
3811
- }
3812
- else {
3813
- if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3814
- $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3815
- $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3816
- }
3817
- }
3818
- }
3819
-
3820
- if ( 'percentages' == $input ['view_results_type'] ){
3821
- if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
3822
- $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3823
- $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3824
- }
3825
- else {
3826
- if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3827
- $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3828
- $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3829
- }
3830
- }
3831
- }
3832
-
3833
- if ( 'votes-number-and-percentages' == $input ['view_results_type'] ){
3834
- if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
3835
- $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3836
- $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3837
- }
3838
- elseif ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ) {
3839
- $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3840
- $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3841
- }
3842
- else {
3843
- if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3844
- $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3845
- $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3846
- }
3847
- }
3848
- }
3849
- }
3850
-
3851
- // singular_answer_result_votes_number_label
3852
- if ( isset ( $input ['singular_answer_result_votes_number_label'] ) ){
3853
- if ( '' != $input ['singular_answer_result_votes_number_label'] ){
3854
- if ( $default_options ['singular_answer_result_votes_number_label'] != trim( $input ['singular_answer_result_votes_number_label'] ) ){
3855
- $newinput ['singular_answer_result_votes_number_label'] = trim( $input ['singular_answer_result_votes_number_label'] );
3856
- $updated .= __( 'Option "Poll Answer Result Votes Number Singular Label" Updated!', 'yop_poll' ) . $message_delimiter;
3857
- }
3858
- }
3859
- else {
3860
- $newinput ['singular_answer_result_votes_number_label'] = $default_options ['singular_answer_result_votes_number_label'];
3861
- $errors .= __( 'Option "Poll Answer Result Votes Number Singular Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3862
- }
3863
- }
3864
-
3865
- // plural_answer_result_votes_number_label
3866
- if ( isset ( $input ['plural_answer_result_votes_number_label'] ) ){
3867
- if ( '' != $input ['singular_answer_result_votes_number_label'] ){
3868
- if ( $default_options ['plural_answer_result_votes_number_label'] != trim( $input ['plural_answer_result_votes_number_label'] ) ){
3869
- $newinput ['plural_answer_result_votes_number_label'] = trim( $input ['plural_answer_result_votes_number_label'] );
3870
- $updated .= __( 'Option "Poll Answer Result Votes Number Plural Label" Updated!', 'yop_poll' ) . $message_delimiter;
3871
- }
3872
- }
3873
- else {
3874
- $newinput ['plural_answer_result_votes_number_label'] = $default_options ['plural_answer_result_votes_number_label'];
3875
- $errors .= __( 'Option "Poll Answer Result Votes Number Plural Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3876
- }
3877
- }
3878
-
3879
- // vote_button_label
3880
- if ( isset ( $input ['vote_button_label'] ) ){
3881
- if ( '' != $input ['vote_button_label'] ){
3882
- if ( $default_options ['vote_button_label'] != trim( $input ['vote_button_label'] ) ){
3883
- $newinput ['vote_button_label'] = trim( $input ['vote_button_label'] );
3884
- $updated .= __( 'Option "Vote Button Label" Updated!', 'yop_poll' ) . $message_delimiter;
3885
- }
3886
- }
3887
- else {
3888
- $newinput ['vote_button_label'] = $default_options ['vote_button_label'];
3889
- $errors .= __( 'Option "Vote Button Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3890
- }
3891
- }
3892
-
3893
- // view_results_link
3894
- if ( isset ( $input ['view_results_link'] ) ){
3895
- if ( in_array( $input ['view_results_link'], array( 'yes', 'no' ) ) ){
3896
- if ( $default_options ['view_results_link'] != trim( $input ['view_results_link'] ) ){
3897
- $newinput ['view_results_link'] = trim( $input ['view_results_link'] );
3898
- $updated .= __( 'Option "View Results Link" Updated!', 'yop_poll' ) . $message_delimiter;
3899
- }
3900
-
3901
- if ( 'yes' == $input ['view_results_link'] ){
3902
- // view_results_link_label
3903
- if ( isset ( $input ['view_results_link_label'] ) ){
3904
- if ( '' != $input ['view_results_link_label'] ){
3905
- if ( $default_options ['view_results_link_label'] != trim( $input ['view_results_link_label'] ) ){
3906
- $newinput ['view_results_link_label'] = trim( $input ['view_results_link_label'] );
3907
- $updated .= __( 'Option "View Results Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
3908
- }
3909
- }
3910
- else {
3911
- $newinput ['view_results_link_label'] = $default_options ['view_results_link_label'];
3912
- $errors .= __( 'Option "View Results Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3913
- }
3914
- }
3915
- }
3916
- }
3917
- else {
3918
- $newinput ['view_results_link'] = $default_options ['view_results_link'];
3919
- $errors .= __( 'Option "View Results Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3920
- }
3921
- }
3922
-
3923
- // view_back_to_vote_link
3924
- if ( isset ( $input ['view_back_to_vote_link'] ) ){
3925
- if ( in_array( $input ['view_back_to_vote_link'], array( 'yes', 'no' ) ) ){
3926
- if ( $default_options ['view_back_to_vote_link'] != trim( $input ['view_back_to_vote_link'] ) ){
3927
- $newinput ['view_back_to_vote_link'] = trim( $input ['view_back_to_vote_link'] );
3928
- $updated .= __( 'Option "View Back To Vote Link" Updated!', 'yop_poll' ) . $message_delimiter;
3929
- }
3930
-
3931
- if ( 'yes' == $input ['view_back_to_vote_link'] ){
3932
- // view_results_link_label
3933
- if ( isset ( $input ['view_back_to_vote_link_label'] ) ){
3934
- if ( '' != $input ['view_back_to_vote_link_label'] ){
3935
- if ( $default_options ['view_back_to_vote_link_label'] != trim( $input ['view_back_to_vote_link_label'] ) ){
3936
- $newinput ['view_back_to_vote_link_label'] = trim( $input ['view_back_to_vote_link_label'] );
3937
- $updated .= __( 'Option "View Back to Vote Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
3938
- }
3939
- }
3940
- else {
3941
- $newinput ['view_back_to_vote_link_label'] = $default_options ['view_back_to_vote_link_label'];
3942
- $errors .= __( 'Option "View Back to Vote Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3943
- }
3944
- }
3945
- }
3946
- }
3947
- else {
3948
- $newinput ['view_back_to_vote_link'] = $default_options ['view_back_to_vote_link'];
3949
- $errors .= __( 'Option "View Back to Vote Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3950
- }
3951
- }
3952
-
3953
- // view_total_votes
3954
- if ( isset ( $input ['view_total_votes'] ) ){
3955
- if ( in_array( $input ['view_total_votes'], array( 'yes', 'no' ) ) ){
3956
- if ( $default_options ['view_total_votes'] != trim( $input ['view_total_votes'] ) ){
3957
- $newinput ['view_total_votes'] = trim( $input ['view_total_votes'] );
3958
- $updated .= __( 'Option "View Total Votes" Updated!', 'yop_poll' ) . $message_delimiter;
3959
- }
3960
-
3961
- // view_total_votes
3962
- if ( 'yes' == $input ['view_total_votes'] ){
3963
- if ( isset ( $input ['view_total_votes_label'] ) ){
3964
- if ( stripos( $input ['view_total_votes_label'], '%POLL-TOTAL-VOTES%' ) === false ){
3965
- $newinput ['view_total_votes_label'] = $default_options ['view_total_votes_label'];
3966
- $errors .= __( 'You must use %POLL-TOTAL-VOTES% to define your Total Votes label!', 'yop_poll' ) . $message_delimiter;
3967
- }
3968
- else {
3969
- if ( $default_options ['view_total_votes_label'] != trim( $input ['view_total_votes_label'] ) ){
3970
- $newinput ['view_total_votes_label'] = trim( $input ['view_total_votes_label'] );
3971
- $updated .= __( 'Option "View Total Votes Label" Updated!', 'yop_poll' ) . $message_delimiter;
3972
- }
3973
- }
3974
- }
3975
- }
3976
- }
3977
- else {
3978
- $newinput ['view_total_votes'] = $default_options ['view_total_votes'];
3979
- $errors .= __( 'Option "View Total Votes" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3980
- }
3981
- }
3982
-
3983
- // view_total_answers
3984
- if ( isset ( $input ['view_total_answers'] ) ){
3985
- if ( in_array( $input ['view_total_answers'], array( 'yes', 'no' ) ) ){
3986
- if ( $default_options ['view_total_answers'] != trim( $input ['view_total_answers'] ) ){
3987
- $newinput ['view_total_answers'] = trim( $input ['view_total_answers'] );
3988
- $updated .= __( 'Option "View Total Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3989
- }
3990
-
3991
- // view_total_answers
3992
- if ( 'yes' == $input ['view_total_answers'] ){
3993
- if ( isset ( $input ['view_total_answers_label'] ) ){
3994
- if ( stripos( $input ['view_total_answers_label'], '%POLL-TOTAL-ANSWERS%' ) === false ){
3995
- $newinput ['view_total_answers_label'] = $default_options ['view_total_answers_label'];
3996
- $errors .= __( 'You must use %POLL-TOTAL-ANSWERS% to define your Total Answers label!', 'yop_poll' ) . $message_delimiter;
3997
- }
3998
- else {
3999
- if ( $default_options ['view_total_answers_label'] != trim( $input ['view_total_answers_label'] ) ){
4000
- $newinput ['view_total_answers_label'] = trim( $input ['view_total_answers_label'] );
4001
- $updated .= __( 'Option "View Total Answers Label" Updated!', 'yop_poll' ) . $message_delimiter;
4002
- }
4003
- }
4004
- }
4005
- }
4006
- }
4007
- else {
4008
- $newinput ['view_total_answers'] = $default_options ['view_total_answers'];
4009
- $errors .= __( 'Option "View Total Answers" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4010
- }
4011
- }
4012
-
4013
- if ( isset ( $input ['message_after_vote'] ) ){
4014
- if ( $default_options ['message_after_vote'] != trim( $input ['message_after_vote'] ) ){
4015
- $newinput ['message_after_vote'] = trim( $input ['message_after_vote'] );
4016
- $updated .= __( 'Option "Message After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4017
- }
4018
- }
4019
-
4020
- // use_default_loading_image
4021
- if ( isset ( $input ['use_default_loading_image'] ) ){
4022
- if ( in_array( $input ['use_default_loading_image'], array( 'yes', 'no' ) ) ){
4023
- if ( $default_options ['use_default_loading_image'] != trim( $input ['use_default_loading_image'] ) ){
4024
- $newinput ['use_default_loading_image'] = trim( $input ['use_default_loading_image'] );
4025
- $updated .= __( 'Option "Use Default Loading Image" Updated!', 'yop_poll' ) . $message_delimiter;
4026
- }
4027
-
4028
- if ( 'no' == $input ['use_default_loading_image'] ){
4029
- if ( isset ( $input ['loading_image_url'] ) ){
4030
- if ( stripos( $input ['loading_image_url'], 'http' ) === false ){
4031
- $newinput ['loading_image_url'] = $default_options ['loading_image_url'];
4032
- $errors .= __( 'You must use a url like "http://.." to define your Loading Image Url!', 'yop_poll' ) . $message_delimiter;
4033
- }
4034
- else {
4035
- if ( $default_options ['loading_image_url'] != trim( $input ['loading_image_url'] ) ){
4036
- $newinput ['loading_image_url'] = trim( $input ['loading_image_url'] );
4037
- $updated .= __( 'Option "Loading Image Url" Updated!', 'yop_poll' ) . $message_delimiter;
4038
- }
4039
- }
4040
- }
4041
- }
4042
- }
4043
- else {
4044
- $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4045
- $errors .= __( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4046
- }
4047
- }
4048
-
4049
- // vote_permisions
4050
- if ( isset ( $input ['vote_permisions'] ) ){
4051
- if ( in_array( $input ['vote_permisions'], array( 'quest-only', 'registered-only', 'guest-registered' ) ) ){
4052
- if ( $default_options ['vote_permisions'] != trim( $input ['vote_permisions'] ) ){
4053
- $newinput ['vote_permisions'] = trim( $input ['vote_permisions'] );
4054
- $updated .= __( 'Option "Vote Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
4055
- }
4056
-
4057
- if ( in_array( $input ['vote_permisions'], array( 'registered-only', 'guest-registered' ) ) ){
4058
-
4059
- if ( isset( $input['vote_permisions_facebook'] ) && in_array( $input['vote_permisions_facebook'], array( 'yes', 'no' ) ) ){
4060
- if ( $default_options ['vote_permisions_facebook'] != trim( $input ['vote_permisions_facebook'] ) ){
4061
- $newinput ['vote_permisions_facebook'] = trim( $input ['vote_permisions_facebook'] );
4062
- $updated .= __( 'Option "Vote as Facebook User" Updated!', 'yop_poll' ) . $message_delimiter;
4063
- }
4064
- if ( 'yes' == $input['vote_permisions_facebook'] ){
4065
- if ( $default_options ['vote_permisions_facebook_label'] != trim( $input ['vote_permisions_facebook_label'] ) ){
4066
- $newinput ['vote_permisions_facebook_label'] = trim( $input ['vote_permisions_facebook_label'] );
4067
- $updated .= __( 'Option "Vote as Facebook User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4068
- }
4069
- }
4070
- }
4071
- if ( isset( $input['vote_permisions_wordpress'] ) && in_array( $input['vote_permisions_wordpress'], array( 'yes', 'no' ) ) ){
4072
- if ( $default_options ['vote_permisions_wordpress'] != trim( $input ['vote_permisions_wordpress'] ) ){
4073
- $newinput ['vote_permisions_wordpress'] = trim( $input ['vote_permisions_wordpress'] );
4074
- $updated .= __( 'Option "Vote as Wordpress User" Updated!', 'yop_poll' ) . $message_delimiter;
4075
- }
4076
-
4077
- if ( 'yes' == $input['vote_permisions_wordpress'] ){
4078
- if ( $default_options ['vote_permisions_wordpress_label'] != trim( $input ['vote_permisions_wordpress_label'] ) ){
4079
- $newinput ['vote_permisions_wordpress_label'] = trim( $input ['vote_permisions_wordpress_label'] );
4080
- $updated .= __( 'Option "Vote as Wordpress User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4081
- }
4082
- }
4083
- }
4084
- if ( isset( $input['vote_permisions_anonymous'] ) && in_array( $input['vote_permisions_anonymous'], array( 'yes', 'no' ) ) ){
4085
- if ( $default_options ['vote_permisions_anonymous'] != trim( $input ['vote_permisions_anonymous'] ) ){
4086
- $newinput ['vote_permisions_anonymous'] = trim( $input ['vote_permisions_anonymous'] );
4087
- $updated .= __( 'Option "Vote as Anonymous User" Updated!', 'yop_poll' ) . $message_delimiter;
4088
- }
4089
-
4090
- if ( 'yes' == $input['vote_permisions_anonymous'] ){
4091
- if ( $default_options ['vote_permisions_anonymous_label'] != trim( $input ['vote_permisions_anonymous_label'] ) ){
4092
- $newinput ['vote_permisions_anonymous_label'] = trim( $input ['vote_permisions_anonymous_label'] );
4093
- $updated .= __( 'Option "Vote as Anonymous User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4094
- }
4095
- }
4096
- }
4097
- }
4098
- }
4099
- else {
4100
- $newinput ['vote_permisions'] = $default_options ['vote_permisions'];
4101
- $errors .= __( 'Option "Vote Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
4102
- }
4103
- }
4104
-
4105
- // blocking_voters
4106
- if ( isset ( $input ['blocking_voters'] ) ){
4107
- if ( in_array( $input ['blocking_voters'], array( 'dont-block', 'cookie', 'ip', 'username', 'cookie-ip' ) ) ){
4108
- if ( $default_options ['blocking_voters'] != trim( $input ['blocking_voters'] ) ){
4109
- $newinput ['blocking_voters'] = trim( $input ['blocking_voters'] );
4110
- $updated .= __( 'Option "Blocking Voters" Updated!', 'yop_poll' ) . $message_delimiter;
4111
- }
4112
-
4113
- if ( 'dont-block' != $newinput ['blocking_voters'] ){
4114
- // blocking_voters_interval_value
4115
- if ( isset ( $input ['blocking_voters_interval_value'] ) ){
4116
- if ( ctype_digit( $input ['blocking_voters_interval_value'] ) ){
4117
- if ( $default_options ['blocking_voters_interval_value'] != trim( $input ['blocking_voters_interval_value'] ) ){
4118
- $newinput ['blocking_voters_interval_value'] = trim( $input ['blocking_voters_interval_value'] );
4119
- $updated .= __( 'Option "Blocking Voters Interval Value" Updated!', 'yop_poll' ) . $message_delimiter;
4120
- }
4121
- }
4122
- else {
4123
- $newinput ['blocking_voters_interval_value'] = $default_options ['blocking_voters_interval_value'];
4124
- $errors .= __( 'Option "Blocking Voters Interval Value" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4125
- }
4126
- }
4127
-
4128
- // blocking_voters_interval_unit
4129
- if ( isset ( $input ['blocking_voters_interval_unit'] ) ){
4130
- if ( in_array( $input ['blocking_voters_interval_unit'], array( 'seconds', 'minutes', 'hours', 'days' ) ) ){
4131
- if ( $default_options ['blocking_voters_interval_unit'] != trim( $input ['blocking_voters_interval_unit'] ) ){
4132
- $newinput ['blocking_voters_interval_unit'] = trim( $input ['blocking_voters_interval_unit'] );
4133
- $updated .= __( 'Option "Blocking Voters Interval Unit" Updated!', 'yop_poll' ) . $message_delimiter;
4134
- }
4135
- }
4136
- else {
4137
- $newinput ['blocking_voters_interval_unit'] = $default_options ['blocking_voters_interval_unit'];
4138
- $errors .= __( 'Option "Blocking Voters Interval Unit" Not Updated! Please choose between \'Seconds\', \'Minutes\', \'Hours\' or \'Days\'', 'yop_poll' ) . $message_delimiter;
4139
- }
4140
- }
4141
- }
4142
- }
4143
- else {
4144
- $newinput ['blocking_voters'] = $default_options ['blocking_voters'];
4145
- $errors .= __( 'Option "Blocking Voters" Not Updated! Please choose between: \'Don`t Block\', \'Cookie\', \'Ip\', \'Username\', \'Cookie and Ip\'', 'yop_poll' ) . $message_delimiter;
4146
- }
4147
- }
4148
-
4149
- // limit_number_of_votes_per_user
4150
- if ( isset ( $input ['limit_number_of_votes_per_user'] ) ){
4151
- if ( in_array( $input ['limit_number_of_votes_per_user'], array( 'yes', 'no' ) ) ){
4152
- if ( $default_options ['limit_number_of_votes_per_user'] != trim( $input ['limit_number_of_votes_per_user'] ) ){
4153
- $newinput ['limit_number_of_votes_per_user'] = trim( $input ['limit_number_of_votes_per_user'] );
4154
- $updated .= __( 'Option "Limit Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
4155
- }
4156
-
4157
- if ( 'yes' == $input ['limit_number_of_votes_per_user'] ){
4158
- if ( isset ( $input ['number_of_votes_per_user'] ) ){
4159
- if ( intval( $input ['number_of_votes_per_user'] ) <= 0 ){
4160
- $newinput ['number_of_votes_per_user'] = $default_options ['number_of_votes_per_user'];
4161
- $errors .= __( '"Number of Votes per User" must be a number > 0 !', 'yop_poll' ) . $message_delimiter;
4162
- }
4163
- else {
4164
- if ( $default_options ['number_of_votes_per_user'] != $input ['number_of_votes_per_user'] ){
4165
- $newinput ['number_of_votes_per_user'] = trim( $input ['number_of_votes_per_user'] );
4166
- $updated .= __( 'Option "Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
4167
- }
4168
- }
4169
- }
4170
- }
4171
- }
4172
- else {
4173
- $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4174
- $errors .= __( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4175
- }
4176
- }
4177
-
4178
- // percentages_decimals
4179
- if ( isset ( $input ['percentages_decimals'] ) ){
4180
- if ( ctype_digit( $input ['percentages_decimals'] ) ){
4181
- if ( $default_options ['percentages_decimals'] != trim( $input ['percentages_decimals'] ) ){
4182
- $newinput ['percentages_decimals'] = trim( $input ['percentages_decimals'] );
4183
- $updated .= __( 'Option "Percentages Decimals" Updated!', 'yop_poll' ) . $message_delimiter;
4184
- }
4185
- }
4186
- else {
4187
- $newinput ['percentages_decimals'] = $default_options ['percentages_decimals'];
4188
- $errors .= __( 'Option "Percentages Decimals" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4189
- }
4190
- }
4191
-
4192
- // redirect_after_vote
4193
- if ( isset ( $input ['redirect_after_vote'] ) ){
4194
- if ( in_array( $input ['redirect_after_vote'], array( 'yes', 'no' ) ) ){
4195
- if ( $default_options ['redirect_after_vote'] != trim( $input ['redirect_after_vote'] ) ){
4196
- $newinput ['redirect_after_vote'] = trim( $input ['redirect_after_vote'] );
4197
- $updated .= __( 'Option "Redirect After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4198
- }
4199
-
4200
- if ( 'yes' == $input ['redirect_after_vote'] ){
4201
- // archive_order
4202
- if ( isset ( $input ['redirect_after_vote_url'] ) ){
4203
- if ( '' != $input ['redirect_after_vote_url'] ){
4204
- if ( $default_options ['redirect_after_vote_url'] != trim( $input ['redirect_after_vote_url'] ) ){
4205
- $newinput ['redirect_after_vote_url'] = trim( $input ['redirect_after_vote_url'] );
4206
- $updated .= __( 'Option "Redirect After Vote Url" Updated!', 'yop_poll' ) . $message_delimiter;
4207
- }
4208
- }
4209
- else {
4210
- $newinput ['redirect_after_vote_url'] = $default_options ['redirect_after_vote_url'];
4211
- $errors .= __( 'Option "Redirect After Vote Url" Not Updated! Please fill in an url!', 'yop_poll' ) . $message_delimiter;
4212
- }
4213
- }
4214
- }
4215
- }
4216
- else {
4217
- $newinput ['redirect_after_vote'] = $default_options ['redirect_after_vote'];
4218
- $errors .= __( 'Option ""Redirect After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4219
- }
4220
- }
4221
-
4222
- // date_format
4223
- if ( isset ( $input ['date_format'] ) ){
4224
- if ( $default_options ['date_format'] != trim( $input ['date_format'] ) ){
4225
- $newinput ['date_format'] = trim( $input ['date_format'] );
4226
- $updated .= __( 'Option "Poll Date Format" Updated!', 'yop_poll' ) . $message_delimiter;
4227
- }
4228
- }
4229
-
4230
- // view_poll_archive_link
4231
- if ( isset ( $input ['view_poll_archive_link'] ) ){
4232
- if ( in_array( $input ['view_poll_archive_link'], array( 'yes', 'no' ) ) ){
4233
- if ( $default_options ['view_poll_archive_link'] != trim( $input ['view_poll_archive_link'] ) ){
4234
- $newinput ['view_poll_archive_link'] = trim( $input ['view_poll_archive_link'] );
4235
- $updated .= __( 'Option "View Poll Archive Link" Updated!', 'yop_poll' ) . $message_delimiter;
4236
- }
4237
-
4238
- if ( 'yes' == $input ['view_poll_archive_link'] ){
4239
- // view_results_link_label
4240
- if ( isset ( $input ['view_poll_archive_link_label'] ) ){
4241
- if ( '' != $input ['view_poll_archive_link_label'] ){
4242
- if ( $default_options ['view_poll_archive_link_label'] != trim( $input ['view_poll_archive_link_label'] ) ){
4243
- $newinput ['view_poll_archive_link_label'] = trim( $input ['view_poll_archive_link_label'] );
4244
- $updated .= __( 'Option "View Poll Archive Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
4245
- }
4246
- }
4247
- else {
4248
- $newinput ['view_poll_archive_link_label'] = $default_options ['view_poll_archive_link_label'];
4249
- $errors .= __( 'Option "View Poll Archive Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4250
- }
4251
- }
4252
-
4253
- if ( isset ( $input ['poll_archive_url'] ) ){
4254
- if ( '' != $input ['poll_archive_url'] ){
4255
- if ( $default_options ['poll_archive_url'] != trim( $input ['poll_archive_url'] ) ){
4256
- $newinput ['poll_archive_url'] = trim( $input ['poll_archive_url'] );
4257
- $updated .= __( 'Option "Poll Archive URL" Updated!', 'yop_poll' ) . $message_delimiter;
4258
- }
4259
- }
4260
- else {
4261
- $newinput ['poll_archive_url'] = $default_options ['poll_archive_url'];
4262
- $errors .= __( 'Option "Poll Archive URL" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4263
- }
4264
- }
4265
- }
4266
- }
4267
- else {
4268
- $newinput ['view_poll_archive_link'] = $default_options ['view_poll_archive_link'];
4269
- $errors .= __( 'Option "View Poll Archive Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4270
- }
4271
- }
4272
-
4273
- // show_in_archive
4274
- if ( isset ( $input ['show_in_archive'] ) ){
4275
- if ( in_array( $input ['show_in_archive'], array( 'yes', 'no' ) ) ){
4276
- if ( $default_options ['show_in_archive'] != trim( $input ['show_in_archive'] ) ){
4277
- $newinput ['show_in_archive'] = trim( $input ['show_in_archive'] );
4278
- $updated .= __( 'Option "Show Poll in Arhive" Updated!', 'yop_poll' ) . $message_delimiter;
4279
- }
4280
-
4281
- if ( 'yes' == $input ['show_in_archive'] ){
4282
- // archive_order
4283
- if ( isset ( $input ['archive_order'] ) ){
4284
- if ( ctype_digit( $input ['archive_order'] ) ){
4285
- if ( $default_options ['archive_order'] != trim( $input ['archive_order'] ) ){
4286
- $newinput ['archive_order'] = trim( $input ['archive_order'] );
4287
- $updated .= __( 'Option "Archive Order" Updated!', 'yop_poll' ) . $message_delimiter;
4288
- }
4289
- }
4290
- else {
4291
- $newinput ['archive_order'] = $default_options ['archive_order'];
4292
- $errors .= __( 'Option "Archive Order" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4293
- }
4294
- }
4295
- }
4296
- }
4297
- else {
4298
- $newinput ['show_in_archive'] = $default_options ['show_in_archive'];
4299
- $errors .= __( 'Option "Show Poll in Archive" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4300
- }
4301
- }
4302
-
4303
- // send_email_notifications
4304
- if ( isset ( $input ['send_email_notifications'] ) ){
4305
- if ( in_array( $input ['send_email_notifications'], array( 'yes', 'no' ) ) ){
4306
- if ( $default_options ['send_email_notifications'] != trim( $input ['send_email_notifications'] ) ){
4307
- $newinput ['send_email_notifications'] = trim( $input ['send_email_notifications'] );
4308
- $updated .= __( 'Option "Send Email Notifications" Updated!', 'yop_poll' ) . $message_delimiter;
4309
- }
4310
-
4311
- if ( 'yes' == $input ['send_email_notifications'] ){
4312
- // email_notifications_from_name
4313
- if ( isset ( $input ['email_notifications_from_name'] ) ){
4314
- if ( '' != $input ['email_notifications_from_name'] ){
4315
- if ( $default_options ['email_notifications_from_name'] != trim( $input ['email_notifications_from_name'] ) ){
4316
- $newinput ['email_notifications_from_name'] = trim( $input ['email_notifications_from_name'] );
4317
- $updated .= __( 'Option "Notifications From Name" Updated!', 'yop_poll' ) . $message_delimiter;
4318
- }
4319
- }
4320
- else {
4321
- $newinput ['email_notifications_from_name'] = $default_options ['email_notifications_from_name'];
4322
- $errors .= __( 'Option "Notifications From Name" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4323
- }
4324
- }
4325
-
4326
- // email_notifications_from_email
4327
- if ( isset ( $input ['email_notifications_from_email'] ) ){
4328
- if ( '' != $input ['email_notifications_from_email'] ){
4329
- if ( $default_options ['email_notifications_from_email'] != trim( $input ['email_notifications_from_email'] ) ){
4330
- $newinput ['email_notifications_from_email'] = trim( $input ['email_notifications_from_email'] );
4331
- $updated .= __( 'Option "Notifications From Email" Updated!', 'yop_poll' ) . $message_delimiter;
4332
- }
4333
- }
4334
- else {
4335
- $newinput ['email_notifications_from_email'] = $default_options ['email_notifications_from_email'];
4336
- $errors .= __( 'Option "Notifications From Email" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4337
- }
4338
- }
4339
-
4340
- // email_notifications_recipients
4341
- if ( isset ( $input ['email_notifications_recipients'] ) ){
4342
- if ( '' != $input ['email_notifications_recipients'] ){
4343
- if ( $default_options ['email_notifications_recipients'] != trim( $input ['email_notifications_recipients'] ) ){
4344
- $newinput ['email_notifications_recipients'] = trim( $input ['email_notifications_recipients'] );
4345
- $updated .= __( 'Option "Email Notifications Recipients" Updated!', 'yop_poll' ) . $message_delimiter;
4346
- }
4347
- }
4348
- else {
4349
- $newinput ['email_notifications_recipients'] = $default_options ['email_notifications_recipients'];
4350
- $errors .= __( 'Option "Email Notifications Recipients" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4351
- }
4352
- }
4353
-
4354
- // email_notifications_subject
4355
- if ( isset ( $input ['email_notifications_subject'] ) ){
4356
- if ( '' != $input ['email_notifications_subject'] ){
4357
- if ( $default_options ['email_notifications_subject'] != trim( $input ['email_notifications_subject'] ) ){
4358
- $newinput ['email_notifications_subject'] = trim( $input ['email_notifications_subject'] );
4359
- $updated .= __( 'Option "Email Notifications Subject" Updated!', 'yop_poll' ) . $message_delimiter;
4360
- }
4361
- }
4362
- else {
4363
- $newinput ['email_notifications_subject'] = $default_options ['email_notifications_subject'];
4364
- $errors .= __( 'Option "Email Notifications Subject" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4365
- }
4366
- }
4367
-
4368
- // email_notifications_subject
4369
- if ( isset ( $input ['email_notifications_body'] ) ){
4370
- if ( '' != $input ['email_notifications_body'] ){
4371
- if ( $default_options ['email_notifications_body'] != trim( $input ['email_notifications_body'] ) ){
4372
- $newinput ['email_notifications_body'] = trim( $input ['email_notifications_body'] );
4373
- $updated .= __( 'Option "Email Notifications Body" Updated!', 'yop_poll' ) . $message_delimiter;
4374
- }
4375
- }
4376
- else {
4377
- $newinput ['email_notifications_body'] = $default_options ['email_notifications_body'];
4378
- $errors .= __( 'Option "Email Notifications Body" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4379
- }
4380
- }
4381
- }
4382
- }
4383
- else {
4384
- $newinput ['send_email_notifications'] = $default_options ['send_email_notifications'];
4385
- $errors .= __( 'Option "Send Email Notifications" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4386
- }
4387
- }
4388
-
4389
- // archive_polls_per_page
4390
- if ( isset ( $input ['archive_polls_per_page'] ) ){
4391
- if ( ctype_digit( $input ['archive_polls_per_page'] ) ){
4392
- if ( $default_options ['archive_polls_per_page'] != trim( $input ['archive_polls_per_page'] ) ){
4393
- $newinput ['archive_polls_per_page'] = trim( $input ['archive_polls_per_page'] );
4394
- $updated .= __( 'Option "Archive Polls Per Page', 'yop_poll' ) . $message_delimiter;
4395
- }
4396
- }
4397
- else {
4398
- $newinput ['archive_polls_per_page'] = $default_options ['archive_polls_per_page'];
4399
- $errors .= __( 'Option "Archive Polls Per Page" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4400
- }
4401
- }
4402
-
4403
- //share after vote
4404
- if ( isset ( $input ['share_after_vote'] ) ){
4405
- if ( in_array( $input ['share_after_vote'], array( 'yes', 'no' ) ) ){
4406
- if ( $default_options ['share_after_vote'] != trim( $input ['share_after_vote'] ) ){
4407
- $newinput ['share_after_vote'] = trim( $input ['share_after_vote'] );
4408
- $updated .= __( 'Option "Share After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4409
- }
4410
-
4411
- if ( 'yes' == $input ['share_after_vote'] ){
4412
- // share_name
4413
- if ( isset ( $input ['share_name'] ) ){
4414
- if ( $default_options ['share_name'] != trim( $input ['share_name'] ) ){
4415
- $newinput ['share_name'] = trim( $input ['share_name'] );
4416
- $updated .= __( 'Option "Share Name" Updated!', 'yop_poll' ) . $message_delimiter;
4417
- }
4418
- }
4419
- // share_caption
4420
- if ( isset ( $input ['share_caption'] ) ){
4421
- if ( $default_options ['share_caption'] != trim( $input ['share_caption'] ) ){
4422
- $newinput ['share_caption'] = trim( $input ['share_caption'] );
4423
- $updated .= __( 'Option "Share Caption" Updated!', 'yop_poll' ) . $message_delimiter;
4424
- }
4425
- }
4426
- // share_description
4427
- if ( isset ( $input ['share_description'] ) ){
4428
- if ( $default_options ['share_description'] != trim( $input ['share_description'] ) ){
4429
- $newinput ['share_description'] = trim( $input ['share_description'] );
4430
- $updated .= __( 'Option "Share Description" Updated!', 'yop_poll' ) . $message_delimiter;
4431
- }
4432
- }
4433
- // share_picture
4434
- if ( isset ( $input ['share_picture'] ) ){
4435
- if ( $default_options ['share_picture'] != trim( $input ['share_picture'] ) ){
4436
- $newinput ['share_picture'] = trim( $input ['share_picture'] );
4437
- $updated .= __( 'Option "Share Picture" Updated!', 'yop_poll' ) . $message_delimiter;
4438
- }
4439
- }
4440
- }
4441
- }
4442
- else {
4443
- $newinput ['share_after_vote'] = $default_options ['share_after_vote'];
4444
- $errors .= __( 'Option "Share After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4445
- }
4446
- }
4447
-
4448
- //start_scheduler
4449
- if ( isset ( $input ['start_scheduler'] ) ){
4450
- if ( in_array( $input ['start_scheduler'], array( 'yes', 'no' ) ) ){
4451
- if ( $default_options ['start_scheduler'] != trim( $input ['start_scheduler'] ) ){
4452
- $newinput ['start_scheduler'] = trim( $input ['start_scheduler'] );
4453
- $updated .= __( 'Option "Start Scheduler" Updated!', 'yop_poll' ) . $message_delimiter;
4454
- }
4455
- }
4456
- else {
4457
- $newinput ['start_scheduler'] = $default_options ['start_scheduler'];
4458
- $errors .= __( 'Option "Start Scheduler" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4459
- }
4460
- }
4461
- }
4462
- else {
4463
- $errors .= __( 'Bad Request!', 'yop_poll' ) . $message_delimiter;
4464
- }
4465
-
4466
- if ( '' != $errors )
4467
- add_settings_error( 'general', 'yop-poll-errors', $errors, 'error' );
4468
- if ( '' != $updated )
4469
- add_settings_error( 'general', 'yop-poll-updates', $updated, 'updated' );
4470
-
4471
- return $newinput;
4472
- }
4473
-
4474
- public function view_yop_poll_options() {
4475
- require_once( ABSPATH . '/wp-admin/options-head.php' );
4476
- global $page;
4477
- $default_options = get_option( 'yop_poll_options', array() );
4478
- $pro_options = get_option( 'yop_poll_pro_options' );
4479
- ?>
4480
- <div class="wrap">
4481
- <div class="icon32 icon32-yop-poll">
4482
- <br>
4483
-
4484
- </div>
4485
- <h2><?php _e( 'Yop Poll Options', 'yop_poll' ); ?></h2>
4486
- <div id="message"></div>
4487
- <br/>
4488
-
4489
- <form action="options.php" method="post">
4490
- <div id="poststuff">
4491
- <div id="post-body" class="metabox-holder columns-2">
4492
- <div id="post-body-content">
4493
- <?php settings_fields( 'yop_poll_options' ); ?>
4494
- <div class="meta-box-sortables ui-sortable" id="normal-sortables">
4495
- <div class="postbox" id="yop-poll-advanced-options-div1">
4496
- <div title="Click to toggle" class="handlediv">
4497
- <br/>
4498
- </div>
4499
- <h3 class="hndle">
4500
- <span><?php _e( 'Answers options', 'yop_poll' ); ?></span>
4501
- </h3>
4502
- <div class="inside">
4503
- <table cellspacing="0" class="links-table">
4504
- <tbody>
4505
- <tr>
4506
- <th>
4507
- <?php _e( 'Allow other answers ', 'yop_poll' ); ?>:
4508
- </th>
4509
- <td><label for="yop-poll-allow-other-answers-no"><input
4510
- id="yop-poll-allow-other-answers-no"
4511
- <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4512
- type="radio" name="yop_poll_options[allow_other_answers]"
4513
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4514
- for="yop-poll-allow-other-answers-yes"><input
4515
- id="yop-poll-allow-other-answers-yes"
4516
- <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4517
- type="radio" name="yop_poll_options[allow_other_answers]"
4518
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4519
- </tr>
4520
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4521
- <th>
4522
- <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
4523
- </th>
4524
- <td><input id="yop-poll-other-answers-label" type="text"
4525
- name="yop_poll_options[other_answers_label]"
4526
- value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>"/>
4527
- <input type="hidden"
4528
- name="yop_poll_options[other_answers_id]"
4529
- value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>"/>
4530
- </td>
4531
- </tr>
4532
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-to-results-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4533
- <th>
4534
- <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>
4535
- :<br><font size="0"><?php _e( 'all the values submitted in this field by your users will be automatically added as an available "Answer"', 'yop_poll' ) ?></font>
4536
- </th>
4537
- <td>
4538
- <label for="yop-poll-add-other-answers-to-default-answers-no"><input
4539
- id="yop-poll-add-other-answers-to-default-answers-no"
4540
- <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4541
- type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4542
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4543
- for="yop-poll-add-other-answers-to-default-answers-yes"><input
4544
- id="yop-poll-add-other-answers-to-default-answers-yes"
4545
- <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4546
- type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4547
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4548
- </td>
4549
- </tr>
4550
- <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4551
- <th>
4552
- <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
4553
- </th>
4554
- <td><label for="yop-poll-display-other-answers-values-no"><input
4555
- id="yop-poll-display-other-answers-values-no"
4556
- <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4557
- type="radio"
4558
- name="yop_poll_options[display_other_answers_values]"
4559
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4560
- for="yop-poll-display-other-answers-values-yes"><input
4561
- id="yop-poll-display-other-answers-values-yes"
4562
- <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4563
- type="radio"
4564
- name="yop_poll_options[display_other_answers_values]"
4565
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4566
- </tr>
4567
- <tr>
4568
- <th>
4569
- <?php _e( 'Allow Multiple Answers ', 'yop_poll' ); ?>:
4570
- </th>
4571
- <td><label for="yop-poll-allow-multiple-answers-no"><input
4572
- id="yop-poll-allow-multiple-answers-no"
4573
- <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
4574
- type="radio"
4575
- name="yop_poll_options[allow_multiple_answers]" value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label>
4576
- <label for="yop-poll-allow-multiple-answers-yes"><input
4577
- id="yop-poll-allow-multiple-answers-yes"
4578
- <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
4579
- type="radio"
4580
- name="yop_poll_options[allow_multiple_answers]" value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4581
-
4582
- </td>
4583
- </tr>
4584
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
4585
- <th>
4586
- <?php _e( 'Max Number of allowed answers', 'yop_poll' ); ?>:
4587
- </th>
4588
- <td><input id="yop-poll-allow-multiple-answers-number"
4589
- type="text"
4590
- name="yop_poll_options[allow_multiple_answers_number]"
4591
- value="<?php echo $default_options['allow_multiple_answers_number']; ?>"/>
4592
- </td>
4593
- </tr>
4594
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
4595
- <th>
4596
- <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
4597
- </th>
4598
- <td><input id="yop-poll-allow-multiple-answers-min-number"
4599
- type="text"
4600
- name="yop_poll_options[allow_multiple_answers_min_number]"
4601
- value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>"/>
4602
- </td>
4603
- </tr>
4604
- </tbody>
4605
- </table>
4606
- </div>
4607
- </div>
4608
- <div class="postbox" id="yop-poll-advanced-options-div2">
4609
- <div title="Click to toggle" class="handlediv">
4610
- <br/>
4611
- </div>
4612
- <h3 class="hndle">
4613
- <span><?php _e( 'Display Options', 'yop_poll' ); ?></span>
4614
- </h3>
4615
- <div class="inside">
4616
- <table cellspacing="0" class="links-table">
4617
- <tbody>
4618
- <tr>
4619
- <th>
4620
- <?php _e( 'Use CAPTCHA ', 'yop_poll' ); ?>:
4621
- </th>
4622
- <td><label for="yop-poll-use-captcha-no"><input
4623
- id="yop-poll-use-captcha-no"
4624
- <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
4625
- type="radio" name="yop_poll_options[use_captcha]"
4626
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4627
- for="yop-poll-use-captcha-yes"><input
4628
- id="yop-poll-use-captcha-yes"
4629
- <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
4630
- type="radio" name="yop_poll_options[use_captcha]"
4631
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4632
- </tr>
4633
- <tr>
4634
- <th>
4635
- <?php _e( 'Display Answers ', 'yop_poll' ); ?>:
4636
- </th>
4637
- <td><label for="yop-poll-display-answers-vertical"><input
4638
- id="yop-poll-display-answers-vertical"
4639
- <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
4640
- type="radio" name="yop_poll_options[display_answers]"
4641
- value="vertical"/> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
4642
- <label for="yop-poll-display-answers-orizontal"><input
4643
- id="yop-poll-display-answers-orizontal"
4644
- <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
4645
- type="radio" name="yop_poll_options[display_answers]"
4646
- value="orizontal"/> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
4647
- <label for="yop-poll-display-answers-tabulated"><input
4648
- id="yop-poll-display-answers-tabulated"
4649
- <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
4650
- type="radio" name="yop_poll_options[display_answers]"
4651
- value="tabulated"/> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
4652
- </td>
4653
- </tr>
4654
- <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
4655
- <th>
4656
- <?php _e( 'Columns', 'yop_poll' ); ?>:
4657
- </th>
4658
- <td><input id="yop-poll-display-answers-tabulated-cols"
4659
- type="text"
4660
- name="yop_poll_options[display_answers_tabulated_cols]"
4661
- value="<?php echo $default_options['display_answers_tabulated_cols']; ?>"/>
4662
- </td>
4663
- </tr>
4664
- <tr>
4665
- <th>
4666
- <?php _e( 'Display Results ', 'yop_poll' ); ?>:
4667
- </th>
4668
- <td><label for="yop-poll-display-results-vertical"><input
4669
- id="yop-poll-display-results-vertical"
4670
- <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
4671
- type="radio" name="yop_poll_options[display_results]"
4672
- value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
4673
- <label for="yop-poll-display-results-orizontal"><input
4674
- id="yop-poll-display-results-orizontal"
4675
- <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
4676
- type="radio" name="yop_poll_options[display_results]"
4677
- value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
4678
- <label for="yop-poll-display-results-tabulated"><input
4679
- id="yop-poll-display-results-tabulated"
4680
- <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
4681
- type="radio" name="yop_poll_options[display_results]"
4682
- value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
4683
- </td>
4684
- </tr>
4685
- <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
4686
- <th>
4687
- <?php _e( 'Columns', 'yop_poll' ); ?>:
4688
- </th>
4689
- <td><input id="yop-poll-display-results-tabulated-cols"
4690
- type="text"
4691
- name="yop_poll_options[display_results_tabulated_cols]"
4692
- value="<?php echo $default_options['display_results_tabulated_cols']; ?>"/>
4693
- </td>
4694
- </tr>
4695
- <tr>
4696
- <th>
4697
- <?php _e( 'Poll Template Width', 'yop_poll' ); ?>:
4698
- </th>
4699
- <td><input id="yop-poll-template-width"
4700
- type="text"
4701
- name="yop_poll_options[template_width]"
4702
- value="<?php echo $default_options['template_width']; ?>"/>
4703
- </td>
4704
- </tr>
4705
- <tr>
4706
- <th>
4707
- <?php _e( 'Widget Template Width', 'yop_poll' ); ?>:
4708
- </th>
4709
- <td><input id="yop-poll-widget-template-width"
4710
- type="text"
4711
- name="yop_poll_options[widget_template_width]"
4712
- value="<?php echo $default_options['widget_template_width']; ?>"/>
4713
- </td>
4714
- </tr>
4715
- </tbody>
4716
- </table>
4717
- </div>
4718
- </div>
4719
- <div class="postbox" id="yop-poll-advanced-options-div3">
4720
- <div title="Click to toggle" class="handlediv">
4721
- <br/>
4722
- </div>
4723
- <h3 class="hndle">
4724
- <span><?php _e( 'Poll Bar Style', 'yop_poll' ); ?></span>
4725
- </h3>
4726
- <div class="inside">
4727
- <table cellspacing="0" class="links-table">
4728
- <tbody>
4729
- <tr>
4730
- <th>
4731
- <?php _e( 'Use Template Result Bar', 'yop_poll' ); ?>:
4732
- </th>
4733
- <td><label for="yop-poll-use-template-bar-no"><input
4734
- id="yop-poll-use-template-bar-no"
4735
- <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
4736
- type="radio" name="yop_poll_options[use_template_bar]"
4737
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4738
- for="yop-poll-use-template-bar-yes"><input
4739
- id="yop-poll-use-template-bar-yes"
4740
- <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
4741
- type="radio" name="yop_poll_options[use_template_bar]"
4742
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4743
- </tr>
4744
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4745
- <th><label for="yop-poll-bar-background"><?php _e( 'Background Color', 'yop_poll' ); ?></label>
4746
- </th>
4747
- <td>#<input class="yop-small-input"
4748
- id="yop-poll-bar-background"
4749
- value="<?php echo $default_options['bar_background']; ?>"
4750
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
4751
- type="text" name="yop_poll_options[bar_background]"/>
4752
- </td>
4753
- </tr>
4754
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4755
- <th><label for="yop-poll-bar-height"><?php _e( 'Height', 'yop_poll' ); ?></label>
4756
- </th>
4757
- <td><input class="yop-small-input" id="yop-poll-bar-height"
4758
- value="<?php echo $default_options['bar_height']; ?>"
4759
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
4760
- type="text" name="yop_poll_options[bar_height]"/> px</td>
4761
- </tr>
4762
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4763
- <th><label for="yop-poll-bar-border-color"><?php _e( 'Border Color', 'yop_poll' ) ?></label>
4764
- </th>
4765
- <td>#<input class="yop-small-input"
4766
- id="yop-poll-bar-border-color"
4767
- value="<?php echo $default_options['bar_border_color']; ?>"
4768
- onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
4769
- type="text" name="yop_poll_options[bar_border_color]"/>
4770
- </td>
4771
- </tr>
4772
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4773
- <th><label for="yop-poll-bar-border-width"><?php _e( 'Border Width', 'yop_poll' ); ?></label>
4774
- </th>
4775
- <td><input class="yop-small-input"
4776
- id="yop-poll-bar-border-width"
4777
- value="<?php echo $default_options['bar_border_width']; ?>"
4778
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
4779
- type="text" name="yop_poll_options[bar_border_width]"/> px
4780
- </td>
4781
- </tr>
4782
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4783
- <th><label for="yop-poll-bar-border-style"><?php _e( 'Border Style', 'yop_poll' ); ?></label>
4784
- </th>
4785
- <td><select id="yop-poll-bar-border-style"
4786
- onchange="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-style', this.value)"
4787
- name="yop_poll_options[bar_border_style]">
4788
- <option
4789
- <?php print 'solid' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
4790
- value="solid">Solid</option>
4791
- <option
4792
- <?php print 'dashed' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
4793
- value="dashed">Dashed</option>
4794
- <option
4795
- <?php print 'dotted' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
4796
- value="dotted">Dotted</option>
4797
- </select></td>
4798
- </tr>
4799
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4800
- <th><label><?php _e( 'Yop Poll Bar Preview', 'yop_poll' ); ?></label>
4801
- </th>
4802
- <td>
4803
- <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>
4804
- px; background-color:#<?php
4805
-
4806
- echo $default_options ['bar_background'];
4807
- ?>
4808
- ; border-style: <?php echo $default_options['bar_border_style']; ?>
4809
- ; border-width: <?php echo $default_options['bar_border_width']; ?>
4810
- px; border-color: #<?php
4811
-
4812
- echo $default_options ['bar_border_color'];
4813
- ?>;"></div>
4814
- </td>
4815
- </tr>
4816
- </tbody>
4817
- </table>
4818
- </div>
4819
- </div>
4820
- <div class="postbox" id="yop-poll-advanced-options-div4">
4821
- <div title="Click to toggle" class="handlediv">
4822
- <br/>
4823
- </div>
4824
- <h3 class="hndle">
4825
- <span><?php _e( 'Sorting Answers &amp; Results', 'yop_poll' ); ?></span>
4826
- </h3>
4827
- <div class="inside">
4828
- <table cellspacing="0" class="links-table">
4829
- <tbody>
4830
- <tr>
4831
- <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
4832
- <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
4833
- id="yop_poll_sorting_answers_exact"
4834
- <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
4835
- type="radio" name="yop_poll_options[sorting_answers]"
4836
- value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
4837
- <label for="yop_poll_sorting_answers_alphabetical"><input
4838
- id="yop_poll_sorting_answers_alphabetical"
4839
- <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
4840
- type="radio" name="yop_poll_options[sorting_answers]"
4841
- value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
4842
- <label for="yop_poll_sorting_answers_random"><input
4843
- id="yop_poll_sorting_answers_random"
4844
- <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
4845
- type="radio" name="yop_poll_options[sorting_answers]"
4846
- value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
4847
- <label for="yop_poll_sorting_answers_votes"><input
4848
- id="yop_poll_sorting_answers_votes"
4849
- <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
4850
- type="radio" name="yop_poll_options[sorting_answers]"
4851
- value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
4852
- </td>
4853
- </tr>
4854
- <tr>
4855
- <th>
4856
- <?php _e( 'Sort Answers Rule', 'yop_poll' ); ?>:
4857
- </th>
4858
- <td><label for="yop_poll_sorting_answers_asc"><input
4859
- id="yop_poll_sorting_answers_asc"
4860
- <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
4861
- type="radio"
4862
- name="yop_poll_options[sorting_answers_direction]"
4863
- value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
4864
- <label for="yop_poll_sorting_answers_desc"><input
4865
- id="yop_poll_sorting_answers_desc"
4866
- <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
4867
- type="radio"
4868
- name="yop_poll_options[sorting_answers_direction]"
4869
- value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
4870
- </td>
4871
- </tr>
4872
- <tr>
4873
- <th><?php _e( 'Sorting Results', 'yop_poll' ); ?>:</th>
4874
- <td valign="top"><label for="yop_poll_sorting_results_exact"><input
4875
- id="yop_poll_sorting_results_exact"
4876
- <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
4877
- type="radio" name="yop_poll_options[sorting_results]"
4878
- value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
4879
- <label for="yop_poll_sorting_results_alphabetical"><input
4880
- id="yop_poll_sorting_results_alphabetical"
4881
- <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
4882
- type="radio" name="yop_poll_options[sorting_results]"
4883
- value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
4884
- <label for="yop_poll_sorting_results_random"><input
4885
- id="yop_poll_sorting_results_random"
4886
- <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
4887
- type="radio" name="yop_poll_options[sorting_results]"
4888
- value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
4889
- <label for="yop_poll_sorting_results_votes"><input
4890
- id="yop_poll_sorting_results_votes"
4891
- <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
4892
- type="radio" name="yop_poll_options[sorting_results]"
4893
- value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
4894
- </td>
4895
- </tr>
4896
- <tr>
4897
- <th>
4898
- <?php _e( 'Sorting Results Rule', 'yop_poll' ); ?>:
4899
- </th>
4900
- <td><label for="yop_poll_sorting_results_asc"><input
4901
- id="yop_poll_sorting_results_asc"
4902
- <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
4903
- type="radio"
4904
- name="yop_poll_options[sorting_results_direction]"
4905
- value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
4906
- <label for="yop_poll_sorting_results_desc"><input
4907
- id="yop_poll_sorting_results_desc"
4908
- <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
4909
- type="radio"
4910
- name="yop_poll_options[sorting_results_direction]"
4911
- value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
4912
- </td>
4913
- </tr>
4914
- </tbody>
4915
- </table>
4916
- </div>
4917
- </div>
4918
- <div class="postbox" id="yop-poll-advanced-options-div5">
4919
- <div title="Click to toggle" class="handlediv">
4920
- <br/>
4921
- </div>
4922
- <h3 class="hndle">
4923
- <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
4924
- </h3>
4925
- <div class="inside">
4926
- <table cellspacing="0" class="links-table">
4927
- <tbody>
4928
- <tr>
4929
- <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
4930
- :</label><br><font size="0">(<?php _e( 'Current Server Time', 'yop_poll' );
4931
- echo ': ' . current_time( 'mysql' ); ?>)</font>
4932
- </th>
4933
- <td><input id="yop-poll-start-date-input" type="text"
4934
- name="yop_poll_options[start_date]"
4935
- value="<?php echo '' == $default_options['start_date'] ? current_time( 'mysql' ) : $default_options['start_date']; ?>"/>
4936
- </td>
4937
- </tr>
4938
- <tr>
4939
- <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>
4940
- :</label><br><font size="0">(<?php _e( 'Current Server Time', 'yop_poll' );
4941
- echo ': ' . current_time( 'mysql' ); ?>)</font>
4942
- </th>
4943
- <td><input style="<?php echo 'yes' == $default_options['never_expire'] ? 'display: none;' : ''; ?>" <?php echo 'yes' == $default_options['never_expire'] ? 'disabled="disabled"' : ''; ?> id="yop-poll-end-date-input" type="text" name="yop_poll_options[end_date]" value="<?php echo '' == $default_options['end_date'] ? '' : $default_options['end_date']; ?>"/>
4944
- <label for="yop-poll-never-expire"><input type="checkbox"
4945
- <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
4946
- id="yop-poll-never-expire"
4947
- name="yop_poll_options[never_expire]" value="yes"/> <?php _e( 'No End Date', 'yop_poll' ); ?></label>
4948
- </td>
4949
- </tr>
4950
- </tbody>
4951
- </table>
4952
- </div>
4953
- </div>
4954
- <div class="postbox" id="yop-poll-advanced-options-div6">
4955
- <div title="Click to toggle" class="handlediv">
4956
- <br/>
4957
- </div>
4958
- <h3 class="hndle">
4959
- <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
4960
- </h3>
4961
- <div class="inside">
4962
- <table cellspacing="0" class="links-table">
4963
- <tbody>
4964
- <tr>
4965
- <th>
4966
- <?php _e( 'View Results', 'yop_poll' ); ?>:
4967
- </th>
4968
- <td><label for="yop-poll-view-results-before-vote"><input
4969
- class="yop-poll-view-results-hide-custom"
4970
- <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4971
- id="yop-poll-view-results-before-vote" type="radio"
4972
- value="before" name="yop_poll_options[view_results]"/> <?php _e( 'Before Vote', 'yop_poll' ); ?></label>
4973
- <label for="yop-poll-view-results-after-vote"><input
4974
- class="yop-poll-view-results-hide-custom"
4975
- <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4976
- id="yop-poll-view-results-after-vote" type="radio"
4977
- value="after" name="yop_poll_options[view_results]"/> <?php _e( 'After Vote', 'yop_poll' ); ?></label>
4978
- <label for="yop-poll-view-results-after-poll-end-date"><input
4979
- class="yop-poll-view-results-hide-custom"
4980
- <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4981
- id="yop-poll-view-results-after-poll-end-date" type="radio"
4982
- value="after-poll-end-date"
4983
- name="yop_poll_options[view_results]"/> <?php _e( 'After Poll End Date', 'yop_poll' ); ?></label>
4984
- <label for="yop-poll-view-results-never"><input
4985
- class="yop-poll-view-results-hide-custom"
4986
- <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4987
- id="yop-poll-view-results-never" type="radio" value="never"
4988
- name="yop_poll_options[view_results]"/> <?php _e( 'Never', 'yop_poll' ); ?></label>
4989
- <label for="yop-poll-view-results-custom"><input
4990
- class="yop-poll-view-results-show-custom"
4991
- <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4992
- id="yop-poll-view-results-custom" type="radio"
4993
- value="custom-date" name="yop_poll_options[view_results]"/> <?php _e( 'Custom Date', 'yop_poll' ); ?></label>
4994
- <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
4995
- <label for="yop-poll-view-results-start-date"><?php _e( 'Results display date (the users will be able to see the results starting with this date)', 'yop_poll' ); ?>
4996
- :</label>
4997
- <input id="yop-poll-view-results-start-date" type="text"
4998
- name="yop_poll_options[view_results_start_date]"
4999
- value="<?php echo $default_options['view_results_start_date']; ?>">
5000
- </div></td>
5001
- </tr>
5002
- <tr>
5003
- <th>
5004
- <?php _e( 'View Results Permissions', 'yop_poll' ); ?>:
5005
- </th>
5006
- <td><label for="yop-poll-view-results-permissions-quest-only"><input
5007
- id="yop-poll-view-results-permissions-quest-only"
5008
- <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5009
- type="radio" value="quest-only"
5010
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
5011
- <label for="yop-poll-view-results-permissions-registered-only"><input
5012
- id="yop-poll-view-results-permissions-registered-only"
5013
- <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5014
- type="radio" value="registered-only"
5015
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
5016
- <label for="yop-poll-view-results-permissions-guest-registered"><input
5017
- id="yop-poll-view-results-permissions-guest-registered"
5018
- <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5019
- type="radio" value="guest-registered"
5020
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
5021
- </td>
5022
- </tr>
5023
- <tr>
5024
- <th>
5025
- <?php _e( 'Results Display', 'yop_poll' ); ?>:
5026
- </th>
5027
- <td><label for="yop-poll-view-results-votes-number"><input
5028
- id="yop-poll-view-results-votes-number"
5029
- <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5030
- type="radio" value="votes-number"
5031
- name="yop_poll_options[view_results_type]"/> <?php _e( 'By Votes Number', 'yop_poll' ); ?></label>
5032
- <label for="yop-poll-view-results-percentages"><input
5033
- id="yop-poll-view-results-percentages"
5034
- <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5035
- type="radio" value="percentages"
5036
- name="yop_poll_options[view_results_type]"/> <?php _e( 'Percentages', 'yop_poll' ); ?></label>
5037
- <label
5038
- for="yop-poll-view-results-votes-number-and-percentages"><input
5039
- id="yop-poll-view-results-votes-number-and-percentages"
5040
- <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5041
- type="radio" value="votes-number-and-percentages"
5042
- name="yop_poll_options[view_results_type]"/> <?php _e( 'by Votes Number and Percentages', 'yop_poll' ); ?></label>
5043
- </td>
5044
- </tr>
5045
- <tr>
5046
- <th>
5047
- <?php _e( 'Poll Answer Result Label', 'yop_poll' ); ?>:
5048
- </th>
5049
- <td><input id="yop-poll-answer-result-label" type="text"
5050
- name="yop_poll_options[answer_result_label]"
5051
- value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>"/>
5052
- <small><i><?php _e( 'Use %POLL-ANSWER-RESULT-PERCENTAGES% for showing answer percentages and %POLL-ANSWER-RESULT-VOTES% for showing answer number of votes', 'yop_poll' ); ?></i></small>
5053
- </td>
5054
- </tr>
5055
- <tr>
5056
- <th>
5057
- <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>
5058
- :
5059
- </th>
5060
- <td>
5061
- <?php _e( 'Singular', 'yop_poll' ); ?>
5062
- <input
5063
- id="yop-poll-singular-answer-result-votes-number-label"
5064
- type="text"
5065
- name="yop_poll_options[singular_answer_result_votes_number_label]"
5066
- value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>"/>
5067
- <?php _e( 'Plural', 'yop_poll' ); ?>
5068
- <input
5069
- id="yop-poll-plural-answer-result-votes-number-label"
5070
- type="text"
5071
- name="yop_poll_options[plural_answer_result_votes_number_label]"
5072
- value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>"/>
5073
-
5074
- </td>
5075
- </tr>
5076
- <tr>
5077
- <th>
5078
- <?php _e( 'Vote Button Label', 'yop_poll' ); ?>:
5079
- </th>
5080
- <td><input id="yop-poll-vote-button-label" type="text"
5081
- name="yop_poll_options[vote_button_label]"
5082
- value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>"/>
5083
- </td>
5084
- </tr>
5085
- <tr>
5086
- <th>
5087
- <?php _e( 'View Results Link', 'yop_poll' ); ?>:
5088
- </th>
5089
- <td><label for="yop-poll-view-results-link-yes"><input
5090
- <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5091
- id="yop-poll-view-results-link-yes" type="radio"
5092
- value="yes" name="yop_poll_options[view_results_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5093
- <label for="yop-poll-view-results-link-no"><input
5094
- <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5095
- id="yop-poll-view-results-link-no" type="radio" value="no"
5096
- name="yop_poll_options[view_results_link]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5097
- </td>
5098
- </tr>
5099
- <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
5100
- <th>
5101
- <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
5102
- </th>
5103
- <td><input id="yop-poll-view-results-link-label" type="text"
5104
- name="yop_poll_options[view_results_link_label]"
5105
- value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>"/>
5106
- </td>
5107
- </tr>
5108
- <tr>
5109
- <th>
5110
- <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
5111
- </th>
5112
- <td><label for="yop-poll-view-back-to-vote-link-yes"><input
5113
- <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5114
- id="yop-poll-view-back-to-vote-link-yes" type="radio"
5115
- value="yes" name="yop_poll_options[view_back_to_vote_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5116
- <label for="yop-poll-view-back-to-vote-link-no"><input
5117
- <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5118
- id="yop-poll-view-back-to-vote-link-no" type="radio"
5119
- value="no" name="yop_poll_options[view_back_to_vote_link]"/><?php _e( 'No', 'yop_poll' ); ?></label>
5120
- </td>
5121
- </tr>
5122
- <tr class="yop_poll_suboption" id="yop-poll-view-back-to-vote-link-div" style="<?php echo 'yes' != $default_options['view_back_to_vote_link'] ? 'display: none;' : ''; ?>">
5123
- <th>
5124
- <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
5125
- </th>
5126
- <td><input id="yop-poll-view-back-to-vote-link-label"
5127
- type="text"
5128
- name="yop_poll_options[view_back_to_vote_link_label]"
5129
- value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>"/>
5130
- </td>
5131
- </tr>
5132
- <tr>
5133
- <th>
5134
- <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
5135
- </th>
5136
- <td><label for="yop-poll-view-total-votes-yes"><input
5137
- <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5138
- id="yop-poll-view-total-votes-yes" type="radio" value="yes"
5139
- name="yop_poll_options[view_total_votes]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5140
- <label for="yop-poll-view-total-votes-no"><input
5141
- <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5142
- id="yop-poll-view-total-votes-no" type="radio" value="no"
5143
- name="yop_poll_options[view_total_votes]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5144
- </td>
5145
- </tr>
5146
- <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
5147
- <th>
5148
- <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
5149
- </th>
5150
- <td><input id="yop-poll-view-total-votes-label" type="text"
5151
- name="yop_poll_options[view_total_votes_label]"
5152
- value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>"/>
5153
- </td>
5154
- </tr>
5155
- <tr>
5156
- <th>
5157
- <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
5158
- </th>
5159
- <td><label for="yop-poll-view-total-answers-yes"><input
5160
- <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5161
- id="yop-poll-view-total-answers-yes" type="radio"
5162
- value="yes" name="yop_poll_options[view_total_answers]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5163
- <label for="yop-poll-view-total-answers-no"><input
5164
- <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5165
- id="yop-poll-view-total-answers-no" type="radio" value="no"
5166
- name="yop_poll_options[view_total_answers]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5167
- </td>
5168
- </tr>
5169
- <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
5170
- <th>
5171
- <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
5172
- </th>
5173
- <td><input id="yop-poll-view-total-answers-label" type="text"
5174
- name="yop_poll_options[view_total_answers_label]"
5175
- value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>"/>
5176
- </td>
5177
- </tr>
5178
- <tr>
5179
- <th>
5180
- <?php _e( 'Message After Vote', 'yop_poll' ); ?>:
5181
- </th>
5182
- <td><input id="yop-poll-message-after-vote" type="text"
5183
- name="yop_poll_options[message_after_vote]"
5184
- value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>"/>
5185
- </td>
5186
- </tr>
5187
- <tr>
5188
- <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>
5189
- :</label>
5190
- </th>
5191
- <td><input id="yop-poll-page-url" type="text"
5192
- name="yop_poll_options[poll_page_url]"
5193
- value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>"/>
5194
- </td>
5195
- </tr>
5196
- </tbody>
5197
- </table>
5198
- </div>
5199
- </div>
5200
- <div class="postbox" id="yop-poll-advanced-options-div7">
5201
- <div title="Click to toggle" class="handlediv">
5202
- <br/>
5203
- </div>
5204
- <h3 class="hndle">
5205
- <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
5206
- </h3>
5207
- <div class="inside">
5208
- <table cellspacing="0" class="links-table">
5209
- <tbody>
5210
- <tr>
5211
- <th>
5212
- <?php _e( 'Vote Permissions ', 'yop_poll' ); ?>:
5213
- </th>
5214
- <td><label for="yop-poll-vote-permisions-quest-only"><input
5215
- id="yop-poll-vote-permisions-quest-only"
5216
- <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5217
- type="radio" value="quest-only"
5218
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
5219
- <label for="yop-poll-vote-permisions-registered-only"><input
5220
- id="yop-poll-vote-permisions-registered-only"
5221
- <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5222
- type="radio" value="registered-only"
5223
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
5224
- <label for="yop-poll-vote-permisions-guest-registered"><input
5225
- id="yop-poll-vote-permisions-guest-registered"
5226
- <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5227
- type="radio" value="guest-registered"
5228
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
5229
- </td>
5230
- </tr>
5231
- <?php if ( false ){ ?>
5232
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5233
- <th>
5234
- <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
5235
- <?php if ($pro_options['pro_user'] == 'no') { ?>
5236
- <br/><font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
5237
- )</font>
5238
- <?php } ?></label>
5239
- </th>
5240
- <td><label for="yop-poll-vote-permisions-facebook-yes"><input
5241
- <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5242
- id="yop-poll-vote-permisions-facebook-yes" type="radio"
5243
- value="yes" name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5244
- <label for="yop-poll-vote-permisions-facebook-no"><input
5245
- <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5246
- id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
5247
- name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5248
- </td>
5249
- </tr>
5250
-
5251
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-facebook-div" style="<?php echo 'yes' != $default_options['vote_permisions_facebook'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5252
- <th>
5253
- <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>
5254
- :
5255
- </th>
5256
- <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
5257
- name="yop_poll_options[vote_permisions_facebook_label]"
5258
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>"/>
5259
- </td>
5260
- </tr>
5261
- <?php } ?>
5262
-
5263
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5264
- <th>
5265
- <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?>
5266
- <br><font size="0">(<?php _e( 'Will force users to login into your blog', 'yop_poll' ); ?>
5267
- )</font>:
5268
- </th>
5269
- <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
5270
- <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5271
- id="yop-poll-vote-permisions-wordpress-yes" type="radio"
5272
- value="yes" name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5273
- <label for="yop-poll-vote-permisions-wordpress-no"><input
5274
- <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5275
- id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
5276
- name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5277
- </td>
5278
- </tr>
5279
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-wordpress-div" style="<?php echo 'yes' != $default_options['vote_permisions_wordpress'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5280
- <th>
5281
- <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>
5282
- :
5283
- </th>
5284
- <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
5285
- name="yop_poll_options[vote_permisions_wordpress_label]"
5286
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>"/>
5287
- </td>
5288
- </tr>
5289
-
5290
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5291
- <th>
5292
- <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?>
5293
- <br><font size="0">(<?php _e( 'Logged users will be treated as anonymous', 'yop_poll' ); ?>
5294
- )</font>:
5295
- </th>
5296
- <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
5297
- <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5298
- id="yop-poll-vote-permisions-anonymous-yes" type="radio"
5299
- value="yes" name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5300
- <label for="yop-poll-vote-permisions-anonymous-no"><input
5301
- <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5302
- id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
5303
- name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5304
- </td>
5305
- </tr>
5306
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-div" style="<?php echo 'yes' != $default_options['vote_permisions_anonymous'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5307
- <th>
5308
- <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>
5309
- :
5310
- </th>
5311
- <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
5312
- name="yop_poll_options[vote_permisions_anonymous_label]"
5313
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>"/>
5314
- </td>
5315
- </tr>
5316
-
5317
- <tr>
5318
- <th>
5319
- <?php _e( 'Blocking Voters', 'yop_poll' ); ?>:
5320
- </th>
5321
- <td><label for="yop-poll-blocking-voters-dont-block"><input
5322
- class="yop-poll-blocking-voters-hide-interval"
5323
- <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5324
- id="yop-poll-blocking-voters-dont-block" type="radio"
5325
- value="dont-block" name="yop_poll_options[blocking_voters]"/> <?php _e( 'Dont`t Block', 'yop_poll' ); ?></label>
5326
- <label for="yop-poll-blocking-voters-cookie"><input
5327
- class="yop-poll-blocking-voters-show-interval"
5328
- <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5329
- id="yop-poll-blocking-voters-cookie" type="radio"
5330
- value="cookie" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie', 'yop_poll' ); ?></label>
5331
- <label for="yop-poll-blocking-voters-ip"><input
5332
- class="yop-poll-blocking-voters-show-interval"
5333
- <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5334
- id="yop-poll-blocking-voters-ip" type="radio" value="ip"
5335
- name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Ip', 'yop_poll' ); ?></label>
5336
- <label for="yop-poll-blocking-voters-username"><input
5337
- class="yop-poll-blocking-voters-show-interval"
5338
- <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5339
- id="yop-poll-blocking-voters-username" type="radio"
5340
- value="username" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Username', 'yop_poll' ); ?></label>
5341
- <label for="yop-poll-blocking-voters-cookie-ip"><input
5342
- class="yop-poll-blocking-voters-show-interval"
5343
- <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5344
- id="yop-poll-blocking-voters-cookie-ip" type="radio"
5345
- value="cookie-ip" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie &amp; Ip', 'yop_poll' ); ?></label>
5346
- </td>
5347
- </tr>
5348
- <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
5349
- <th>
5350
- <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
5351
- </th>
5352
- <td><input type="text"
5353
- name="yop_poll_options[blocking_voters_interval_value]"
5354
- id="yop-poll-blocking-voters-interval-value"
5355
- value="<?php echo $default_options['blocking_voters_interval_value']; ?>"/>
5356
- <select id="yop-poll-blocking-voters-interval-unit"
5357
- name="yop_poll_options[blocking_voters_interval_unit]">
5358
- <option
5359
- <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5360
- value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
5361
- <option
5362
- <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5363
- value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
5364
- <option
5365
- <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5366
- value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
5367
- <option
5368
- <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5369
- value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
5370
- </select></td>
5371
- </tr>
5372
- <tr class="yop-poll-limit-number-of-votes-per-user-div">
5373
- <th>
5374
- <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>
5375
- :<br><small>(<?php _e( 'Only for logged users', 'yop_poll' ); ?>
5376
- )</small>
5377
- </th>
5378
- <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
5379
- <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5380
- id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
5381
- value="yes" name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5382
- <label for="yop-poll-limit-number-of-votes-per-user-no"><input
5383
- <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5384
- id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
5385
- name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5386
- </td>
5387
- </tr>
5388
- <tr class="yop-poll-limit-number-of-votes-per-user-divs yop_poll_suboption" id="yop-poll-number-of-votes-per-user-div" style="<?php echo 'yes' != $default_options['limit_number_of_votes_per_user'] ? 'display: none;' : '' ?>">
5389
- <th>
5390
- <?php _e( 'Number of Votes per User', 'yop_poll' ); ?>:
5391
- </th>
5392
- <td><input id="yop-poll-number-of-votes-per-user" type="text"
5393
- name="yop_poll_options[number_of_votes_per_user]"
5394
- value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>"/>
5395
- </td>
5396
- </tr>
5397
- <tr>
5398
- <th>
5399
- <?php _e( 'Percentages Decimals', 'yop_poll' ); ?>:
5400
- </th>
5401
- <td><input id="yop-poll-percentages-decimals" type="text"
5402
- name="yop_poll_options[percentages_decimals]"
5403
- value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>"/>
5404
- </td>
5405
- </tr>
5406
- <tr>
5407
- <th>
5408
- <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
5409
- </th>
5410
- <td><label for="yop-poll-use-default-loading-image-yes"><input
5411
- <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5412
- id="yop-poll-use-default-loading-image-yes" type="radio"
5413
- value="yes"
5414
- name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5415
- <label for="yop-poll-use-default-loading-image-no"><input
5416
- <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5417
- id="yop-poll-use-default-loading-image-no" type="radio"
5418
- value="no"
5419
- name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5420
- </td>
5421
- </tr>
5422
- <tr class="yop_poll_suboption" id="yop-poll-use-default-loading-image-div" style="<?php echo 'yes' == $default_options['use_default_loading_image'] ? 'display: none;' : ''; ?>">
5423
- <th>
5424
- <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
5425
- </th>
5426
- <td><input id="yop-poll-loading-image-url" type="text"
5427
- name="yop_poll_options[loading_image_url]"
5428
- value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>"/>
5429
- </td>
5430
- </tr>
5431
-
5432
- <tr>
5433
- <th>
5434
- <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
5435
- </th>
5436
- <td><label for="yop-poll-redirect-after-vote-yes"><input
5437
- <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5438
- id="yop-poll-redirect-after-vote-yes" type="radio"
5439
- value="yes"
5440
- name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5441
- <label for="yop-poll-redirect-after-vote-no"><input
5442
- <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5443
- id="yop-poll-redirect-after-vote-no" type="radio"
5444
- value="no"
5445
- name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5446
- </td>
5447
- </tr>
5448
- <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
5449
- <th>
5450
- <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
5451
- </th>
5452
- <td><input id="yop-poll-redirect-after-vote-url" type="text"
5453
- name="yop_poll_options[redirect_after_vote_url]"
5454
- value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>"/>
5455
- </td>
5456
- </tr>
5457
- <tr>
5458
- <th>
5459
- <?php _e( 'Poll Date Format', 'yop_poll' ); ?>
5460
- : <br/><font size="0"><?php _e( 'Check', 'yop_popll' ) ?>
5461
- <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e( 'documentation', 'yop_popll' ) ?></a></font>
5462
- </th>
5463
- <td><input id="yop-poll-date-format" type="text"
5464
- name="yop_poll_options[date_format]"
5465
- value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>"/>
5466
- </td>
5467
- </tr>
5468
- </tbody>
5469
- </table>
5470
- </div>
5471
- </div>
5472
- <div class="postbox" id="yop-poll-advanced-options-div8">
5473
- <div title="Click to toggle" class="handlediv">
5474
- <br/>
5475
- </div>
5476
- <h3 class="hndle">
5477
- <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
5478
- </h3>
5479
- <div class="inside">
5480
- <table cellspacing="0" class="links-table">
5481
- <tbody>
5482
- <tr>
5483
- <th>
5484
- <?php _e( 'View Poll Archive Link ', 'yop_poll' ); ?>:
5485
- </th>
5486
- <td><input
5487
- <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
5488
- id="yop-poll-view-poll-archive-link-yes" type="radio"
5489
- value="yes" name="yop_poll_options[view_poll_archive_link]"/><label
5490
- for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5491
- <input
5492
- <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
5493
- id="yop-poll-view-poll-archive-link-no" type="radio"
5494
- value="no" name="yop_poll_options[view_poll_archive_link]"/><label
5495
- for="yop-poll-view-poll-archive-link-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5496
- </td>
5497
- </tr>
5498
- <tr class="yop_poll_suboption" id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
5499
- <th>
5500
- <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
5501
- </th>
5502
- <td><input id="yop-poll-view-poll-archive-link-label"
5503
- type="text"
5504
- name="yop_poll_options[view_poll_archive_link_label]"
5505
- value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>"/>
5506
- </td>
5507
- </tr>
5508
- <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
5509
- <th>
5510
- <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
5511
- </th>
5512
- <td><input id="yop-poll-poll-archive-url" type="text"
5513
- name="yop_poll_options[poll_archive_url]"
5514
- value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>"/>
5515
- </td>
5516
- </tr>
5517
- <tr>
5518
- <th>
5519
- <?php _e( 'Show Poll In Archive ', 'yop_poll' ); ?>:
5520
- </th>
5521
- <td><label for="yop-poll-show-in-archive-yes"><input
5522
- <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
5523
- id="yop-poll-show-in-archive-yes" type="radio" value="yes"
5524
- name="yop_poll_options[show_in_archive]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5525
- <label for="yop-poll-show-in-archive-no"><input
5526
- <?php checked( 'no', $default_options['show_in_archive'] ); ?>
5527
- id="yop-poll-show-in-archive-no" type="radio" value="no"
5528
- name="yop_poll_options[show_in_archive]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5529
- </td>
5530
- </tr>
5531
- <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
5532
- <th>
5533
- <?php _e( 'Archive Order', 'yop_poll' ); ?>:
5534
- </th>
5535
- <td><input id="yop-poll-show-in-archive-order" type="text"
5536
- name="yop_poll_options[archive_order]"
5537
- value="<?php echo $default_options['archive_order']; ?>"/>
5538
- </td>
5539
- </tr>
5540
- <tr>
5541
- <th>
5542
- <?php _e( 'Archive Polls Per Page', 'yop_poll' ); ?>:
5543
- </th>
5544
- <td><input id="yop-poll-archive-polls-per-page" type="text"
5545
- name="yop_poll_options[archive_polls_per_page]"
5546
- value="<?php echo $default_options['archive_polls_per_page']; ?>"/>
5547
- </td>
5548
- </tr>
5549
-
5550
- </table>
5551
- </div>
5552
- </div>
5553
-
5554
- <div class="postbox" id="yop-poll-advanced-options-div8">
5555
- <div title="Click to toggle" class="handlediv">
5556
- <br/>
5557
- </div>
5558
- <h3 class="hndle">
5559
- <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
5560
- </h3>
5561
- <div class="inside">
5562
- <table cellspacing="0" class="links-table">
5563
- <tbody>
5564
- <tr>
5565
- <th>
5566
- <?php _e( 'Send Email Notifications', 'yop_poll' ); ?>:
5567
- </th>
5568
- <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
5569
- id="yop-poll-send-email-notifications-yes" type="radio"
5570
- value="yes" name="yop_poll_options[send_email_notifications]"/><label
5571
- for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5572
- <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
5573
- id="yop-poll-send-email-notifications-no" type="radio"
5574
- value="no" name="yop_poll_options[send_email_notifications]"/><label
5575
- for="yop-poll-send-email-notifications-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5576
- </td>
5577
- </tr>
5578
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-from-name-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
5579
- <th>
5580
- <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
5581
- </th>
5582
- <td valign="top">
5583
- <input id="yop-poll-email-notifications-from-name"
5584
- type="text"
5585
- name="yop_poll_options[email_notifications_from_name]"
5586
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>"/>
5587
- </td>
5588
- </tr>
5589
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-from-email-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
5590
- <th>
5591
- <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
5592
- </th>
5593
- <td valign="top">
5594
- <input id="yop-poll-email-notifications-from-email"
5595
- type="text"
5596
- name="yop_poll_options[email_notifications_from_email]"
5597
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>"/>
5598
- </td>
5599
- </tr>
5600
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-recipients-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
5601
- <th>
5602
- <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>
5603
- :<br><font size="0"><?php _e( 'Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll' ) ?></font>
5604
- </th>
5605
- <td valign="top">
5606
- <input id="yop-poll-email-notifications-recipients"
5607
- type="text"
5608
- name="yop_poll_options[email_notifications_recipients]"
5609
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>"/>
5610
- </td>
5611
- </tr>
5612
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-subject-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
5613
- <th>
5614
- <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
5615
- </th>
5616
- <td>
5617
- <input id="yop-poll-email-notifications-subject"
5618
- type="text"
5619
- name="yop_poll_options[email_notifications_subject]"
5620
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_subject'] ) ); ?>"
5621
- />
5622
- </td>
5623
- </tr>
5624
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-body-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
5625
- <th>
5626
- <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
5627
- </th>
5628
- <td>
5629
- <textarea id="yop-poll-email-notifications-body" rows="10"
5630
- name="yop_poll_options[email_notifications_body]"><?php echo esc_html( stripslashes( $default_options['email_notifications_body'] ) ); ?></textarea>
5631
- </td>
5632
- </tr>
5633
- </table>
5634
- </div>
5635
- </div>
5636
-
5637
- <?php if ( false ){ ?>
5638
- <div class="postbox" id="yop-poll-advanced-options-div9">
5639
- <div title="Click to toggle" class="handlediv">
5640
- <br/>
5641
- </div>
5642
- <h3 class="hndle">
5643
- <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
5644
- <?php if ( $pro_options['pro_user'] == 'no' ){ ?>
5645
- <font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
5646
- )</font>
5647
- <?php } ?>
5648
- </span>
5649
- </h3>
5650
- <div class="inside">
5651
- <table cellspacing="0" class="links-table">
5652
- <tbody>
5653
- <tr>
5654
- <th>
5655
- <?php _e( 'Share After Vote ', 'yop_poll' ); ?>:
5656
- </th>
5657
- <td><input
5658
- <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
5659
- id="yop-poll-share-after-vote-yes" type="radio"
5660
- value="yes" name="yop_poll_options[share_after_vote]"/><label
5661
- for="yop-poll-share-after-vote-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5662
- <input
5663
- <?php checked( 'no', $default_options['share_after_vote'] ); ?>
5664
- id="yop-poll-share-after-vote-no" type="radio"
5665
- value="no" name="yop_poll_options[share_after_vote]"/><label
5666
- for="yop-poll-share-after-vote-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5667
- </td>
5668
- </tr>
5669
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5670
- <th>
5671
- <?php _e( 'Share Name', 'yop_poll' ); ?>:
5672
- </th>
5673
- <td><input id="yop-poll-share-name"
5674
- type="text"
5675
- name="yop_poll_options[share_name]"
5676
- value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>"/>
5677
- </td>
5678
- </tr>
5679
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5680
- <th>
5681
- <?php _e( 'Share Caption', 'yop_poll' ); ?>:
5682
- </th>
5683
- <td><input id="yop-poll-share-caption"
5684
- type="text"
5685
- name="yop_poll_options[share_caption]"
5686
- value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>"/>
5687
- </td>
5688
- </tr>
5689
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5690
- <th>
5691
- <?php _e( 'Share Description', 'yop_poll' ); ?>:
5692
- </th>
5693
- <td><input id="yop-poll-share-description"
5694
- type="text"
5695
- name="yop_poll_options[share_description]"
5696
- value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>"/>
5697
- </td>
5698
- </tr>
5699
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5700
- <th>
5701
- <?php _e( 'Share Picture', 'yop_poll' ); ?>:
5702
- </th>
5703
- <td><input id="yop-poll-share-picture"
5704
- type="text"
5705
- name="yop_poll_options[share_picture]"
5706
- value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>"/>
5707
- </td>
5708
- </tr>
5709
-
5710
- </table>
5711
- </div>
5712
- </div>
5713
- <?php } ?>
5714
- </div>
5715
- <input name="Submit" class="button-primary" type="submit"
5716
- value="<?php _e( 'Save Changes', 'yop_poll' ); ?>"/>
5717
- </div>
5718
-
5719
- <div class="postbox-container" id="postbox-container-1">
5720
- <div class="meta-box-sortables ui-sortable" id="side-sortables">
5721
- <div class="postbox " id="linksubmitdiv">
5722
- <div title="Click to toggle" class="handlediv">
5723
- <br/>
5724
- </div>
5725
- <h3 class="hndle">
5726
- <span><?php _e( 'Save Changes', 'yop_poll' ); ?></span>
5727
- </h3>
5728
- <div class="inside">
5729
- <div id="submitlink" class="submitbox">
5730
- <div id="major-publishing-actions">
5731
-
5732
-
5733
- <div id="publishing-action">
5734
- <input name="Submit" class="button-primary" type="submit"
5735
- value="<?php _e( 'Save Changes', 'yop_poll' ); ?>"/>
5736
- </div>
5737
- <div class="clear"></div>
5738
- </div>
5739
- <div class="clear"></div>
5740
- </div>
5741
- </div>
5742
- </div>
5743
- </div>
5744
- </div>
5745
- </div>
5746
- </div>
5747
- </form>
5748
- </div>
5749
-
5750
- <?php
5751
- }
5752
-
5753
- public function view_add_edit_new_poll() {
5754
- global $yop_poll_add_new_config, $action, $current_user;
5755
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
5756
- $yop_poll_model = new Yop_Poll_Model ();
5757
- $page_name = __( 'Add New Yop Poll', 'yop_poll' );
5758
- $action_type = 'add-new';
5759
- $poll_id = '';
5760
- $default_options = get_option( 'yop_poll_options', array() );
5761
- if ( 'edit' == $action ){
5762
- $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
5763
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
5764
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_author != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
5765
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
5766
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
5767
- $answers = Yop_Poll_Model::get_poll_answers( $poll_id );
5768
- $other_answer = Yop_Poll_Model::get_poll_answers( $poll_id, array( 'other' ) );
5769
- $custom_fields = Yop_Poll_Model::get_poll_customfields( $poll_id );
5770
- $page_name = __( 'Edit Poll', 'yop_poll' );
5771
- $action_type = 'edit';
5772
- $poll_default_options = get_yop_poll_meta( $poll_id, 'options', true );
5773
- foreach ( $default_options as $option_name => $option_value ) {
5774
- if ( isset ( $poll_default_options [$option_name] ) ){
5775
- $default_options [$option_name] = $poll_default_options [$option_name];
5776
- }
5777
- }
5778
- }
5779
- $current_poll = $yop_poll_model->get_current_poll();
5780
- $answers_number = $yop_poll_add_new_config ['default_number_of_answers'];
5781
- $customfields_number = $yop_poll_add_new_config ['default_number_of_customfields'];
5782
- ?>
5783
- <div class="wrap">
5784
- <div class="icon32 icon32-yop-poll">
5785
- <br>
5786
-
5787
- </div>
5788
- <h2><?php print $page_name; ?><?php if ('edit' == $action): ?><a
5789
- class="add-new-h2"
5790
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-add-new', 'action' => false, 'id' => false ) ) ); ?>"><?php _e( 'Add New', 'yop_poll' ); ?></a><?php endif; ?></h2>
5791
- <div id="message"></div>
5792
- <form method="post" name="yop_poll_edit_add_new_form"
5793
- id="yop-poll-edit-add-new-form">
5794
- <?php wp_nonce_field( 'yop-poll-edit-add-new' ); ?>
5795
- <span <?php if ( 'edit' != $action ){ ?> style="display: none;"
5796
- <?php } ?>> Shortcode: <input id="yop_poll_shortcode" type="text"
5797
- value='[yop_poll id="<?php echo $current_poll['id']; ?>"]'
5798
- readonly="readonly">
5799
- </span>
5800
- <div id="poststuff">
5801
- <div id="post-body" class="metabox-holder columns-2">
5802
- <div id="post-body-content">
5803
- <div class="stuffbox" id="yop-poll-namediv">
5804
- <h3>
5805
- <label for="yop-poll-name"><?php _e( 'Poll Name', 'yop_poll' ); ?></label>
5806
- </h3>
5807
- <div class="inside">
5808
- <input type="text" id="yop-poll-name"
5809
- value="<?php echo esc_html( stripslashes( $current_poll['name'] ) ); ?>"
5810
- tabindex="1" name="yop_poll_name" size="30"/>
5811
- <p><?php _e( 'Example: Test Poll', 'yop_poll' ); ?></p>
5812
- </div>
5813
- </div>
5814
- <div class="stuffbox" id="yop-poll-questiondiv">
5815
- <h3>
5816
- <label for="yop-poll-question"><?php _e( 'Question', 'yop_poll' ); ?></label>
5817
- </h3>
5818
- <div class="inside">
5819
- <input type="text" id="yop-poll-question"
5820
- value="<?php echo esc_html( stripslashes( $current_poll['question'] ) ); ?>"
5821
- tabindex="1" name="yop_poll_question" size="30"/>
5822
- <p><?php _e( 'Example: How is my plugin?', 'yop_poll' ); ?></p>
5823
- </div>
5824
- </div>
5825
- <div class="stuffbox" id="yop-poll-answersdiv">
5826
- <h3>
5827
- <span><?php _e( 'Answers', 'yop_poll' ); ?></span>
5828
- </h3>
5829
- <div class="inside">
5830
- <table cellspacing="0" class="links-table"
5831
- id='yop-poll-answer-table'>
5832
- <tbody>
5833
- <?php
5834
- for ($answer_id = 1;
5835
- $answer_id < $answers_number;
5836
- $answer_id++) {
5837
- if ( isset ( $answers [$answer_id - 1] ) ){
5838
- $answer_options = get_yop_poll_answer_meta( $answers [$answer_id - 1] ['id'], 'options' );
5839
- }
5840
- ?>
5841
- <tr class="yop_poll_tr_answer"
5842
- id="yop_poll_tr_answer<?php echo $answer_id ?>">
5843
- <th scope="row"><label class="yop_poll_answer_label"
5844
- for="yop-poll-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_answer']; ?> <?php echo $answer_id ?></label></th>
5845
- <td><input type="hidden"
5846
- value="<?php echo isset( $answers[$answer_id - 1]['id'] ) ? $answers[$answer_id - 1]['id'] : ''; ?>"
5847
- name="yop_poll_answer_ids[answer<?php echo $answer_id ?>]"/>
5848
- <input type="text"
5849
- value="<?php echo isset( $answers[$answer_id - 1]['answer'] ) ? esc_html( stripslashes( $answers[$answer_id - 1]['answer'] ) ) : ''; ?>"
5850
- id="yop-poll-answer<?php echo $answer_id ?>"
5851
- name="yop_poll_answer[answer<?php echo $answer_id ?>]"/></td>
5852
- <td align="right">
5853
- <?php if ( 'edit' == $action ){ ?>
5854
- <input type="button"
5855
- value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $answers[$answer_id - 1]['votes'] ?>)"
5856
- onclick="yop_poll_show_change_votes_number_answer(<?php echo $answers [$answer_id - 1] ['id'] ?>); return false;"
5857
- class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $answers [$answer_id - 1] ['id'] ?>"/>
5858
- <?php } ?>
5859
- <input type="button"
5860
- value="<?php echo $yop_poll_add_new_config['text_customize_answer']; ?>"
5861
- onclick="yop_poll_toogle_customize_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
5862
- class="button"/>
5863
- <input
5864
- onclick="yop_poll_remove_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
5865
- type="button"
5866
- value="<?php echo $yop_poll_add_new_config['text_remove_answer']; ?>"
5867
- class="button"/></td>
5868
- </tr>
5869
- <tr class="yop_poll_tr_customize_answer"
5870
- id="yop_poll_tr_customize_answer<?php echo $answer_id ?>"
5871
- style="display: none;">
5872
- <td colspan="3">
5873
- <table cellspacing="0" width="100%">
5874
- <tbody>
5875
- <tr>
5876
- <th>
5877
- <?php echo $yop_poll_add_new_config['text_is_default_answer']; ?>
5878
- :
5879
- </th>
5880
- <td valign="top"><input
5881
- id="yop-poll-is-default-answer-no-<?php echo $answer_id ?>"
5882
- <?php echo checked( 'no', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
5883
- type="radio"
5884
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
5885
- value="no"/> <label
5886
- for="yop-poll-id-default-answer-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
5887
- <input
5888
- id="yop-poll-is-default-answer-yes-<?php echo $answer_id ?>"
5889
- <?php echo checked( 'yes', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
5890
- type="radio"
5891
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
5892
- value="yes"/> <label
5893
- for="yop-poll-id-default-answer-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5894
- </td>
5895
- </tr>
5896
- </tbody>
5897
- </table>
5898
- <table cellspacing="0" width="100%">
5899
- <tbody>
5900
- <tr>
5901
- <th>
5902
- <?php echo $yop_poll_add_new_config['text_poll_bar_style']['use_template_bar_label']; ?>
5903
- :
5904
- </th>
5905
- <td><input
5906
- onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').show();"
5907
- id="yop-poll-answer-use-template-bar-no-<?php echo $answer_id ?>"
5908
- <?php echo checked( 'no', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
5909
- type="radio"
5910
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
5911
- value="no"/> <label
5912
- for="yop-poll-answer-use-template-bar-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
5913
- <input
5914
- onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').hide();"
5915
- id="yop-poll-answer-use-template-bar-yes-<?php echo $answer_id ?>"
5916
- <?php echo checked( 'yes', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
5917
- type="radio"
5918
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
5919
- value="yes"/> <label
5920
- for="yop-poll-answer-use-template-bar-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5921
- </td>
5922
- </tr>
5923
- </tbody>
5924
- </table>
5925
- <table cellspacing="0" width="100%" id="yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>" style="<?php echo( 'yes' == ( isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ) ? 'display: none;' : '' ); ?>">
5926
- <tbody>
5927
- <tr>
5928
- <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_label']; ?></label>
5929
- </th>
5930
- <td>
5931
- <table cellspacing="0" style="margin-left: 0px;"
5932
- style="width:100%">
5933
- <tbody>
5934
- <tr>
5935
- <th><label
5936
- for="yop-poll-answer-option-bar-background-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_background_label']; ?></label>
5937
- </th>
5938
- <td>#<input
5939
- id="yop-poll-answer-option-bar-background-answer<?php echo $answer_id ?>"
5940
- value="<?php echo isset ( $answer_options[0]['bar_background'] ) ? $answer_options[0]['bar_background'] : $default_options['bar_background']; ?>"
5941
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'background-color', '#' + this.value)"
5942
- type="text"
5943
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_background]"/>
5944
- </td>
5945
- </tr>
5946
- <tr>
5947
- <th><label
5948
- for="yop-poll-answer-option-bar-height-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_height_label']; ?></label>
5949
- </th>
5950
- <td><input
5951
- id="yop-poll-answer-option-bar-height-answer<?php echo $answer_id ?>"
5952
- value="<?php echo isset ( $answer_options[0]['bar_height'] ) ? $answer_options[0]['bar_height'] : $default_options['bar_height']; ?>"
5953
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'height', this.value + 'px')"
5954
- type="text"
5955
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_height]"/>
5956
- px</td>
5957
- </tr>
5958
- <tr>
5959
- <th><label
5960
- for="yop-poll-answer-option-bar-border-color-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_color_label']; ?></label>
5961
- </th>
5962
- <td>#<input
5963
- id="yop-poll-answer-option-bar-border-color-answer<?php echo $answer_id ?>"
5964
- value="<?php echo isset ( $answer_options[0]['bar_border_color'] ) ? $answer_options[0]['bar_border_color'] : $default_options['bar_border_color']; ?>"
5965
- onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-color', '#' + this.value )"
5966
- type="text"
5967
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_color]"/>
5968
- </td>
5969
- </tr>
5970
- <tr>
5971
- <th><label
5972
- for="yop-poll-answer-option-bar-border-width-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_width_label']; ?></label>
5973
- </th>
5974
- <td><input
5975
- id="yop-poll-answer-option-bar-border-width-answer<?php echo $answer_id ?>"
5976
- value="<?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>"
5977
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-width', this.value + 'px')"
5978
- type="text"
5979
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_width]"/>
5980
- px</td>
5981
- </tr>
5982
- <tr>
5983
- <th><label
5984
- for="yop-poll-answer-option-bar_border-style-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_style_label']; ?></label>
5985
- </th>
5986
- <td><select
5987
- id="yop-poll-answer-option-bar_border-style-answer<?php echo $answer_id ?>"
5988
- onchange="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-style', this.value)"
5989
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_style]">
5990
- <option
5991
- <?php print ( 'solid' == ( isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style'] ) ) ? 'selected="selected"' : ''; ?>
5992
- value="solid">Solid</option>
5993
- <option
5994
- <?php print ( 'dashed' == ( isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style'] ) ) ? 'selected="selected"' : ''; ?>
5995
- value="dashed">Dashed</option>
5996
- <option
5997
- <?php print ( 'dotted' == ( isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style'] ) ) ? 'selected="selected"' : ''; ?>
5998
- value="dotted">Dotted</option>
5999
- </select></td>
6000
- </tr>
6001
- </tbody>
6002
- </table>
6003
- </td>
6004
- </tr>
6005
- <tr>
6006
- <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
6007
- </th>
6008
- <td>
6009
- <div id="yop-poll-bar-preview<?php echo $answer_id ?>"; style="width: 100px; height: <?php echo isset ( $answer_options[0]['bar_height'] ) ? $answer_options[0]['bar_height'] : $default_options['bar_height']; ?>
6010
- px; background-color:#<?php
6011
-
6012
- echo isset ( $answer_options [0] ['bar_background'] ) ? $answer_options [0] ['bar_background'] : $default_options ['bar_background'];
6013
- ?>
6014
- ; border-style: <?php echo isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style']; ?>
6015
- ; border-width: <?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>
6016
- px; border-color: #<?php
6017
-
6018
- echo isset ( $answer_options [0] ['bar_border_color'] ) ? $answer_options [0] ['bar_border_color'] : $default_options ['bar_border_color'];
6019
- ?>;"></div>
6020
- </td>
6021
- </tr>
6022
- </tbody>
6023
- </table>
6024
- </td>
6025
- </tr>
6026
- <?php } ?>
6027
- </tbody>
6028
- </table>
6029
- <p id="yop-poll-add-answer-holder" style="display: block;">
6030
- <button id="yop-poll-add-answer-button" class="button"><?php _e( 'Add New Answer', 'yop_poll' ) ?></button>
6031
- <button id="yop-poll-answers-advanced-options-button"
6032
- class="button"><?php _e( 'Answers Advanced Options', 'yop_poll' ); ?></button>
6033
- </p>
6034
-
6035
- <table cellspacing="0" id="yop-poll-answers-advanced-options-div"
6036
- style="display: none;" class="links-table">
6037
- <tbody>
6038
- <tr>
6039
- <th>
6040
- <?php _e( 'Allow other answers ', 'yop_poll' ); ?>:
6041
- </th>
6042
- <td><label for="yop-poll-allow-other-answers-no"><input
6043
- id="yop-poll-allow-other-answers-no"
6044
- <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6045
- type="radio" name="yop_poll_options[allow_other_answers]"
6046
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6047
- for="yop-poll-allow-other-answers-yes"><input
6048
- id="yop-poll-allow-other-answers-yes"
6049
- <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6050
- type="radio" name="yop_poll_options[allow_other_answers]"
6051
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6052
- <?php if ( 'edit' == $action ){ ?>
6053
- <input type="button"
6054
- value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $other_answer[0]['votes'] ?>)"
6055
- onclick="yop_poll_show_change_votes_number_answer(<?php echo $other_answer[0] ['id'] ?>); return false;"
6056
- class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $other_answer[0] ['id'] ?>"/>
6057
- <?php } ?>
6058
- </td>
6059
- </tr>
6060
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6061
- <th>
6062
- <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
6063
- </th>
6064
- <td><input id="yop-poll-other-answers-label" type="text"
6065
- name="yop_poll_options[other_answers_label]"
6066
- value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>"/>
6067
- <input type="hidden"
6068
- name="yop_poll_options[other_answers_id]"
6069
- value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>"/>
6070
- </td>
6071
- </tr>
6072
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-to-results-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6073
- <th>
6074
- <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>
6075
- :<br><small><?php _e( 'all the values submitted in this field by your users will be automatically added as an available "Answer"', 'yop_poll' ) ?></small>
6076
- </th>
6077
- <td>
6078
- <label for="yop-poll-add-other-answers-to-default-answers-no"><input
6079
- id="yop-poll-add-other-answers-to-default-answers-no"
6080
- <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6081
- type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6082
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6083
- for="yop-poll-add-other-answers-to-default-answers-yes"><input
6084
- id="yop-poll-add-other-answers-to-default-answers-yes"
6085
- <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6086
- type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6087
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6088
- </td>
6089
- </tr>
6090
- <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6091
- <th>
6092
- <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
6093
- </th>
6094
- <td><label for="yop-poll-display-other-answers-values-no"><input
6095
- id="yop-poll-display-other-answers-values-no"
6096
- <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6097
- type="radio"
6098
- name="yop_poll_options[display_other_answers_values]"
6099
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6100
- for="yop-poll-display-other-answers-values-yes"><input
6101
- id="yop-poll-display-other-answers-values-yes"
6102
- <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6103
- type="radio"
6104
- name="yop_poll_options[display_other_answers_values]"
6105
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6106
- </tr>
6107
- <tr class="yop_poll_suboption" id="yop-poll-is-default-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6108
- <th>
6109
- <?php _e( 'Make "Other answer" default answer ', 'yop_poll' ); ?>
6110
- :<br>
6111
- <small><?php _e( '"Other Answer" will be autoselected', 'yop_poll' ); ?></small>
6112
- </th>
6113
- <td><label for="yop-poll-is-default-other-answers-no"><input
6114
- id="yop-poll-is-default-other-answers-no"
6115
- <?php echo $default_options['is_default_answer'] == 'no' ? 'checked="checked"' : ''; ?>
6116
- type="radio" name="yop_poll_options[is_default_answer]"
6117
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6118
- for="yop-poll-is-default-other-answers-yes"><input
6119
- id="yop-poll-is-default-other-answers-yes"
6120
- <?php echo $default_options['is_default_answer'] == 'yes' ? 'checked="checked"' : ''; ?>
6121
- type="radio" name="yop_poll_options[is_default_answer]"
6122
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6123
- </tr>
6124
- <tr>
6125
- <th>
6126
- <?php _e( 'Allow Multiple Answers ', 'yop_poll' ); ?>:
6127
- </th>
6128
- <td><label for="yop-poll-allow-multiple-answers-no"><input
6129
- id="yop-poll-allow-multiple-answers-no"
6130
- <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
6131
- type="radio" name="yop_poll_options[allow_multiple_answers]"
6132
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6133
- for="yop-poll-allow-multiple-answers-yes"><input
6134
- id="yop-poll-allow-multiple-answers-yes"
6135
- <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
6136
- type="radio" name="yop_poll_options[allow_multiple_answers]"
6137
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6138
- </tr>
6139
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6140
- <th>
6141
- <?php _e( 'Number of allowed answers', 'yop_poll' ); ?>:
6142
- </th>
6143
- <td><input id="yop-poll-allow-multiple-answers-number"
6144
- type="text"
6145
- name="yop_poll_options[allow_multiple_answers_number]"
6146
- value="<?php echo $default_options['allow_multiple_answers_number']; ?>"/>
6147
- </td>
6148
- </tr>
6149
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6150
- <th>
6151
- <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
6152
- </th>
6153
- <td><input id="yop-poll-allow-multiple-answers-min-number"
6154
- type="text"
6155
- name="yop_poll_options[allow_multiple_answers_min_number]"
6156
- value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>"/>
6157
- </td>
6158
- </tr>
6159
- <tr>
6160
- <th>
6161
- <?php _e( 'Display Answers ', 'yop_poll' ); ?>:
6162
- </th>
6163
- <td><label for="yop-poll-display-answers-vertical"><input
6164
- id="yop-poll-display-answers-vertical"
6165
- <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
6166
- type="radio" name="yop_poll_options[display_answers]"
6167
- value="vertical"/> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6168
- <label for="yop-poll-display-answers-orizontal"><input
6169
- id="yop-poll-display-answers-orizontal"
6170
- <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6171
- type="radio" name="yop_poll_options[display_answers]"
6172
- value="orizontal"/> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6173
- <label for="yop-poll-display-answers-tabulated"><input
6174
- id="yop-poll-display-answers-tabulated"
6175
- <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6176
- type="radio" name="yop_poll_options[display_answers]"
6177
- value="tabulated"/> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6178
- </td>
6179
- </tr>
6180
- <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
6181
- <th>
6182
- <?php _e( 'Columns', 'yop_poll' ); ?>:
6183
- </th>
6184
- <td><input id="yop-poll-display-answers-tabulated-cols"
6185
- type="text"
6186
- name="yop_poll_options[display_answers_tabulated_cols]"
6187
- value="<?php echo $default_options['display_answers_tabulated_cols']; ?>"/>
6188
- </td>
6189
- </tr>
6190
- <tr>
6191
- <th>
6192
- <?php _e( 'Display Results ', 'yop_poll' ); ?>:
6193
- </th>
6194
- <td><label for="yop-poll-display-results-vertical"><input
6195
- id="yop-poll-display-results-vertical"
6196
- <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
6197
- type="radio" name="yop_poll_options[display_results]"
6198
- value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6199
- <label for="yop-poll-display-results-orizontal"><input
6200
- id="yop-poll-display-results-orizontal"
6201
- <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6202
- type="radio" name="yop_poll_options[display_results]"
6203
- value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6204
- <label for="yop-poll-display-results-tabulated"><input
6205
- id="yop-poll-display-results-tabulated"
6206
- <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6207
- type="radio" name="yop_poll_options[display_results]"
6208
- value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6209
- </td>
6210
- </tr>
6211
- <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
6212
- <th>
6213
- <?php _e( 'Columns', 'yop_poll' ); ?>:
6214
- </th>
6215
- <td><input id="yop-poll-display-results-tabulated-cols"
6216
- type="text"
6217
- name="yop_poll_options[display_results_tabulated_cols]"
6218
- value="<?php echo $default_options['display_results_tabulated_cols']; ?>"/>
6219
- </td>
6220
- </tr>
6221
- <tr>
6222
- <th>
6223
- <?php _e( 'Use Template Result Bar', 'yop_poll' ); ?>:
6224
- </th>
6225
- <td><label for="yop-poll-use-template-bar-no"><input
6226
- id="yop-poll-use-template-bar-no"
6227
- <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6228
- type="radio" name="yop_poll_options[use_template_bar]"
6229
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6230
- for="yop-poll-use-template-bar-yes"><input
6231
- id="yop-poll-use-template-bar-yes"
6232
- <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6233
- type="radio" name="yop_poll_options[use_template_bar]"
6234
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6235
- </tr>
6236
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6237
- <th><label for="yop-poll-bar-background"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_background_label']; ?></label>
6238
- </th>
6239
- <td>#<input class="yop-small-input"
6240
- id="yop-poll-bar-background"
6241
- value="<?php echo $default_options['bar_background']; ?>"
6242
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
6243
- type="text" name="yop_poll_options[bar_background]"/>
6244
- </td>
6245
- </tr>
6246
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6247
- <th><label for="yop-poll-bar-height"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_height_label']; ?></label>
6248
- </th>
6249
- <td><input class="yop-small-input" id="yop-poll-bar-height"
6250
- value="<?php echo $default_options['bar_height']; ?>"
6251
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
6252
- type="text" name="yop_poll_options[bar_height]"/> px</td>
6253
- </tr>
6254
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6255
- <th><label for="yop-poll-bar-border-color"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_color_label']; ?></label>
6256
- </th>
6257
- <td>#<input class="yop-small-input"
6258
- id="yop-poll-bar-border-color"
6259
- value="<?php echo $default_options['bar_border_color']; ?>"
6260
- onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
6261
- type="text" name="yop_poll_options[bar_border_color]"/>
6262
- </td>
6263
- </tr>
6264
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6265
- <th><label for="yop-poll-bar-border-width"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_width_label']; ?></label>
6266
- </th>
6267
- <td><input class="yop-small-input"
6268
- id="yop-poll-bar-border-width"
6269
- value="<?php echo $default_options['bar_border_width']; ?>"
6270
- onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
6271
- type="text" name="yop_poll_options[bar_border_width]"/> px</td>
6272
- </tr>
6273
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6274
- <th><label for="yop-poll-bar-border-style"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_style_label']; ?></label>
6275
- </th>
6276
- <td><select id="yop-poll-bar-border-style"
6277
- onchange="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-style', this.value)"
6278
- name="yop_poll_options[bar_border_style]">
6279
- <option
6280
- <?php print 'solid' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
6281
- value="solid">Solid</option>
6282
- <option
6283
- <?php print 'dashed' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
6284
- value="dashed">Dashed</option>
6285
- <option
6286
- <?php print 'dotted' == $default_options['bar_border_style'] ? 'selected="selected"' : ''; ?>
6287
- value="dotted">Dotted</option>
6288
- </select></td>
6289
- </tr>
6290
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6291
-
6292
- <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
6293
- </th>
6294
- <td>
6295
- <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>
6296
- px; background-color:#<?php
6297
-
6298
- echo $default_options ['bar_background'];
6299
- ?>
6300
- ; border-style: <?php echo $default_options['bar_border_style']; ?>
6301
- ; border-width: <?php echo $default_options['bar_border_width']; ?>
6302
- px; border-color: #<?php
6303
-
6304
- echo $default_options ['bar_border_color'];
6305
- ?>;"></div>
6306
- </td>
6307
- </tr>
6308
- <tr>
6309
- <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
6310
- <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
6311
- id="yop_poll_sorting_answers_exact"
6312
- <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
6313
- type="radio" name="yop_poll_options[sorting_answers]"
6314
- value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6315
- <label for="yop_poll_sorting_answers_alphabetical"><input
6316
- id="yop_poll_sorting_answers_alphabetical"
6317
- <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6318
- type="radio" name="yop_poll_options[sorting_answers]"
6319
- value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6320
- <label for="yop_poll_sorting_answers_random"><input
6321
- id="yop_poll_sorting_answers_random"
6322
- <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
6323
- type="radio" name="yop_poll_options[sorting_answers]"
6324
- value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6325
- <label for="yop_poll_sorting_answers_votes"><input
6326
- id="yop_poll_sorting_answers_votes"
6327
- <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
6328
- type="radio" name="yop_poll_options[sorting_answers]"
6329
- value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6330
- </td>
6331
- </tr>
6332
- <tr>
6333
- <th>
6334
- <?php _e( 'Sort Answers Rule', 'yop_poll' ); ?>:
6335
- </th>
6336
- <td><label for="yop_poll_sorting_answers_asc"><input
6337
- id="yop_poll_sorting_answers_asc"
6338
- <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6339
- type="radio"
6340
- name="yop_poll_options[sorting_answers_direction]"
6341
- value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6342
- <label for="yop_poll_sorting_answers_desc"><input
6343
- id="yop_poll_sorting_answers_desc"
6344
- <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6345
- type="radio"
6346
- name="yop_poll_options[sorting_answers_direction]"
6347
- value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
6348
- </td>
6349
- </tr>
6350
- <tr>
6351
- <th><?php _e( 'Sorting Results in', 'yop_poll' ); ?>:</th>
6352
- <td valign="top"><label for="yop_poll_sorting_results_exact"><input
6353
- id="yop_poll_sorting_results_exact"
6354
- <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
6355
- type="radio" name="yop_poll_options[sorting_results]"
6356
- value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6357
- <label for="yop_poll_sorting_results_alphabetical"><input
6358
- id="yop_poll_sorting_results_alphabetical"
6359
- <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6360
- type="radio" name="yop_poll_options[sorting_results]"
6361
- value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6362
- <label for="yop_poll_sorting_results_random"><input
6363
- id="yop_poll_sorting_results_random"
6364
- <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
6365
- type="radio" name="yop_poll_options[sorting_results]"
6366
- value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6367
- <label for="yop_poll_sorting_results_votes"><input
6368
- id="yop_poll_sorting_results_votes"
6369
- <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
6370
- type="radio" name="yop_poll_options[sorting_results]"
6371
- value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6372
- </td>
6373
- </tr>
6374
- <tr>
6375
- <th>
6376
- <?php _e( 'Sorting Results Rule', 'yop_poll' ); ?>:
6377
- </th>
6378
- <td><label for="yop_poll_sorting_results_asc"><input
6379
- id="yop_poll_sorting_results_asc"
6380
- <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6381
- type="radio"
6382
- name="yop_poll_options[sorting_results_direction]"
6383
- value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6384
- <label for="yop_poll_sorting_results_desc"><input
6385
- id="yop_poll_sorting_results_desc"
6386
- <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6387
- type="radio"
6388
- name="yop_poll_options[sorting_results_direction]"
6389
- value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
6390
- </td>
6391
- </tr>
6392
- </tbody>
6393
- </table>
6394
-
6395
- </div>
6396
- </div>
6397
- <div class="stuffbox" id="yop-poll-customfieldsdiv">
6398
- <h3>
6399
- <span><?php _e( 'Custom Text Fields', 'yop_poll' ); ?></span>
6400
- </h3>
6401
- <div class="inside">
6402
- <table cellspacing="0" class="links-table"
6403
- id='yop-poll-customfields-table'>
6404
- <tbody>
6405
- <?php
6406
- for ( $custom_field_id = 1; $custom_field_id < $customfields_number; $custom_field_id++ ) {
6407
- if ( isset ( $custom_fields [$custom_field_id - 1] ['id'] ) ){
6408
- ?>
6409
- <tr class="yop_poll_tr_customfields"
6410
- id="yop_poll_tr_customfield<?php echo $custom_field_id; ?>">
6411
- <th scope="row"><label class="yop_poll_customfield_label"
6412
- for="yop_poll_customfield<?php echo $custom_field_id; ?>"><?php echo $yop_poll_add_new_config['text_customfield'] ?> <?php echo $custom_field_id ?></label>
6413
- </th>
6414
- <td><input type="hidden"
6415
- value="<?php echo isset( $custom_fields[$custom_field_id - 1]['id'] ) ? $custom_fields[$custom_field_id - 1]['id'] : ''; ?>"
6416
- name="yop_poll_customfield_ids[customfield<?php echo $custom_field_id ?>]"/>
6417
- <input type="text"
6418
- value="<?php echo isset( $custom_fields[$custom_field_id - 1]['custom_field'] ) ? $custom_fields[$custom_field_id - 1]['custom_field'] : ''; ?>"
6419
- id="yop-poll-customfield<?php echo $custom_field_id ?>"
6420
- name="yop_poll_customfield[customfield<?php echo $custom_field_id ?>]"/>
6421
- <input value="yes"
6422
- <?php if ( isset ( $custom_fields[$custom_field_id - 1]['required'] ) )
6423
- echo ( 'yes' == $custom_fields[$custom_field_id - 1]['required'] ) ? 'checked="checked"' : ''; ?>
6424
- id="yop-poll-customfield-required-<?php echo $custom_field_id ?>"
6425
- type="checkbox"
6426
- name="yop_poll_customfield_required[customfield<?php echo $custom_field_id ?>]"/>
6427
- <label
6428
- for="yop-poll-customfield-required-<?php echo $custom_field_id ?>"><?php echo $yop_poll_add_new_config['text_requiered_customfield'] ?></label>
6429
- </td>
6430
- <td align="right"><input
6431
- onclick="yop_poll_remove_customfield( '#yop-poll-customfields-table', <?php echo $custom_field_id ?> ); return false;"
6432
- type="button"
6433
- value="<?php echo $yop_poll_add_new_config['text_remove_customfield']; ?>"
6434
- class="button"/></td>
6435
- </tr>
6436
- <?php
6437
- }
6438
- }
6439
- ?>
6440
- </tbody>
6441
- </table>
6442
- <p id="yop-poll-add-customfield-holder" style="display: block;">
6443
- <button id="yop-poll-add-customfield-button" class="button"><?php _e( 'Add New Custom Field', 'yop_poll' ) ?></button>
6444
- </p>
6445
- </div>
6446
- </div>
6447
- <div class="meta-box-sortables ui-sortable" id="normal-sortables">
6448
- <div class="postbox" id="yop-poll-advanced-options-div">
6449
- <div title="Click to toggle" class="handlediv">
6450
- <br/>
6451
- </div>
6452
- <h3 class="hndle">
6453
- <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
6454
- </h3>
6455
- <div class="inside">
6456
- <table cellspacing="0" class="links-table">
6457
- <tbody>
6458
- <tr>
6459
- <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
6460
- :</label><br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
6461
- echo ': ' . current_time( 'mysql' ); ?>)</small>
6462
- </th>
6463
- <td><input id="yop-poll-start-date-input" type="text"
6464
- name="yop_poll_options[start_date]"
6465
- value="<?php echo ( 'edit' != $action ) ? current_time( 'mysql' ) : ( '' == $default_options['start_date'] ) ? current_time( 'mysql' ) : $default_options['start_date']; ?>"/>
6466
- </td>
6467
- </tr>
6468
- <tr>
6469
- <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>
6470
- :</label><br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
6471
- echo ': ' . current_time( 'mysql' ); ?>)</small>
6472
- </th>
6473
- <td><input style="<?php echo 'yes' == $default_options['never_expire'] ? 'display: none;' : ''; ?>" <?php echo 'yes' == $default_options['never_expire'] ? 'disabled="disabled"' : ''; ?> id="yop-poll-end-date-input" type="text" name="yop_poll_options[end_date]" value="<?php echo '' == $default_options['end_date'] ? '' : $default_options['end_date']; ?>"/>
6474
- <label for="yop-poll-never-expire"><input type="checkbox"
6475
- <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
6476
- id="yop-poll-never-expire"
6477
- name="yop_poll_options[never_expire]" value="yes"/> <?php _e( 'No end date', 'yop_poll' ); ?></label>
6478
- </td>
6479
- </tr>
6480
- </tbody>
6481
- </table>
6482
- </div>
6483
- </div>
6484
- <div class="postbox" id="yop-poll-advanced-options-div">
6485
- <div title="Click to toggle" class="handlediv">
6486
- <br/>
6487
- </div>
6488
- <h3 class="hndle">
6489
- <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
6490
- </h3>
6491
- <div class="inside">
6492
- <table cellspacing="0" class="links-table">
6493
- <tbody>
6494
- <tr>
6495
- <th>
6496
- <?php _e( 'View Results', 'yop_poll' ); ?>:
6497
- </th>
6498
- <td><label for="yop-poll-view-results-before-vote"><input
6499
- class="yop-poll-view-results-hide-custom"
6500
- <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6501
- id="yop-poll-view-results-before-vote" type="radio"
6502
- value="before" name="yop_poll_options[view_results]"/> <?php _e( 'Before Vote', 'yop_poll' ); ?></label>
6503
- <label for="yop-poll-view-results-after-vote"><input
6504
- class="yop-poll-view-results-hide-custom"
6505
- <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6506
- id="yop-poll-view-results-after-vote" type="radio"
6507
- value="after" name="yop_poll_options[view_results]"/> <?php _e( 'After Vote', 'yop_poll' ); ?></label>
6508
- <label for="yop-poll-view-results-after-poll-end-date"><input
6509
- class="yop-poll-view-results-hide-custom"
6510
- <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6511
- id="yop-poll-view-results-after-poll-end-date" type="radio"
6512
- value="after-poll-end-date"
6513
- name="yop_poll_options[view_results]"/> <?php _e( 'After Poll End Date', 'yop_poll' ); ?></label>
6514
- <label for="yop-poll-view-results-never"><input
6515
- class="yop-poll-view-results-hide-custom"
6516
- <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6517
- id="yop-poll-view-results-never" type="radio" value="never"
6518
- name="yop_poll_options[view_results]"/> <?php _e( 'Never', 'yop_poll' ); ?></label>
6519
- <label for="yop-poll-view-results-custom"><input
6520
- class="yop-poll-view-results-show-custom"
6521
- <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6522
- id="yop-poll-view-results-custom" type="radio"
6523
- value="custom-date" name="yop_poll_options[view_results]"/> <?php _e( 'Custom Date', 'yop_poll' ); ?></label>
6524
- <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
6525
- <label for="yop-poll-view-results-start-date"><?php _e( 'Results display date (the users will be able to see the results starting with this date)', 'yop_poll' ); ?>
6526
- :</label>
6527
- <input id="yop-poll-view-results-start-date" type="text"
6528
- name="yop_poll_options[view_results_start_date]"
6529
- value="<?php echo $default_options['view_results_start_date']; ?>">
6530
- </div></td>
6531
- </tr>
6532
- <tr>
6533
- <th>
6534
- <?php _e( 'View Results Permissions', 'yop_poll' ); ?>:
6535
- </th>
6536
- <td><label for="yop-poll-view-results-permissions-quest-only"><input
6537
- id="yop-poll-view-results-permissions-quest-only"
6538
- <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6539
- type="radio" value="quest-only"
6540
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
6541
- <label for="yop-poll-view-results-permissions-registered-only"><input
6542
- id="yop-poll-view-results-permissions-registered-only"
6543
- <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6544
- type="radio" value="registered-only"
6545
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
6546
- <label for="yop-poll-view-results-permissions-guest-registered"><input
6547
- id="yop-poll-view-results-permissions-guest-registered"
6548
- <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6549
- type="radio" value="guest-registered"
6550
- name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
6551
- </td>
6552
- </tr>
6553
- <tr>
6554
- <th>
6555
- <?php _e( 'Results Display', 'yop_poll' ); ?>:
6556
- </th>
6557
- <td><label for="yop-poll-view-results-votes-number"><input
6558
- id="yop-poll-view-results-votes-number"
6559
- <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6560
- type="radio" value="votes-number"
6561
- name="yop_poll_options[view_results_type]"/> <?php _e( 'By Votes Number', 'yop_poll' ); ?></label>
6562
- <label for="yop-poll-view-results-percentages"><input
6563
- id="yop-poll-view-results-percentages"
6564
- <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6565
- type="radio" value="percentages"
6566
- name="yop_poll_options[view_results_type]"/> <?php _e( 'Percentages', 'yop_poll' ); ?></label>
6567
- <label
6568
- for="yop-poll-view-results-votes-number-and-percentages"><input
6569
- id="yop-poll-view-results-votes-number-and-percentages"
6570
- <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6571
- type="radio" value="votes-number-and-percentages"
6572
- name="yop_poll_options[view_results_type]"/> <?php _e( 'by Votes Number and Percentages', 'yop_poll' ); ?></label>
6573
- </td>
6574
- </tr>
6575
- <tr>
6576
- <th>
6577
- <?php _e( 'Poll Answer Result Label', 'yop_poll' ); ?>:
6578
- </th>
6579
- <td><input id="yop-poll-answer-result-label" type="text"
6580
- name="yop_poll_options[answer_result_label]"
6581
- value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>"/>
6582
- <small><i><?php _e( 'Use %POLL-ANSWER-RESULT-PERCENTAGES% for showing answer percentages and %POLL-ANSWER-RESULT-VOTES% for showing answer number of votes', 'yop_poll' ); ?></i></small>
6583
- </td>
6584
- </tr>
6585
- <tr>
6586
- <th>
6587
- <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>
6588
- :
6589
- </th>
6590
- <td>
6591
- <?php _e( 'Singular', 'yop_poll' ); ?>
6592
- <input
6593
- id="yop-poll-singular-answer-result-votes-number-label"
6594
- type="text"
6595
- name="yop_poll_options[singular_answer_result_votes_number_label]"
6596
- value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>"/>
6597
- <?php _e( 'Plural', 'yop_poll' ); ?>
6598
- <input
6599
- id="yop-poll-plural-answer-result-votes-number-label"
6600
- type="text"
6601
- name="yop_poll_options[plural_answer_result_votes_number_label]"
6602
- value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>"/>
6603
-
6604
- </td>
6605
- </tr>
6606
- <tr>
6607
- <th>
6608
- <?php _e( 'Vote Button Label', 'yop_poll' ); ?>:
6609
- </th>
6610
- <td><input id="yop-poll-vote-button-label" type="text"
6611
- name="yop_poll_options[vote_button_label]"
6612
- value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>"/>
6613
- </td>
6614
- </tr>
6615
- <tr>
6616
- <th>
6617
- <?php _e( 'View Results Link', 'yop_poll' ); ?>:
6618
- </th>
6619
- <td><label for="yop-poll-view-results-link-yes"><input
6620
- <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6621
- id="yop-poll-view-results-link-yes" type="radio"
6622
- value="yes" name="yop_poll_options[view_results_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6623
- <label for="yop-poll-view-results-link-no"><input
6624
- <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6625
- id="yop-poll-view-results-link-no" type="radio" value="no"
6626
- name="yop_poll_options[view_results_link]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6627
- </td>
6628
- </tr>
6629
- <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
6630
- <th>
6631
- <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
6632
- </th>
6633
- <td><input id="yop-poll-view-results-link-label" type="text"
6634
- name="yop_poll_options[view_results_link_label]"
6635
- value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>"/>
6636
- </td>
6637
- </tr>
6638
- <tr>
6639
- <th>
6640
- <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
6641
- </th>
6642
- <td><label for="yop-poll-view-back-to-vote-link-yes"><input
6643
- <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
6644
- id="yop-poll-view-back-to-vote-link-yes" type="radio"
6645
- value="yes" name="yop_poll_options[view_back_to_vote_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6646
- <label for="yop-poll-view-back-to-vote-link-no"><input
6647
- <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
6648
- id="yop-poll-view-back-to-vote-link-no" type="radio"
6649
- value="no" name="yop_poll_options[view_back_to_vote_link]"/><?php _e( 'No', 'yop_poll' ); ?></label>
6650
- </td>
6651
- </tr>
6652
- <tr class="yop_poll_suboption" id="yop-poll-view-back-to-vote-link-div" style="<?php echo 'yes' != $default_options['view_back_to_vote_link'] ? 'display: none;' : ''; ?>">
6653
- <th>
6654
- <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
6655
- </th>
6656
- <td><input id="yop-poll-view-back-to-vote-link-label"
6657
- type="text"
6658
- name="yop_poll_options[view_back_to_vote_link_label]"
6659
- value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>"/>
6660
- </td>
6661
- </tr>
6662
- <tr>
6663
- <th>
6664
- <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
6665
- </th>
6666
- <td><label for="yop-poll-view-total-votes-yes"><input
6667
- <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
6668
- id="yop-poll-view-total-votes-yes" type="radio" value="yes"
6669
- name="yop_poll_options[view_total_votes]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6670
- <label for="yop-poll-view-total-votes-no"><input
6671
- <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
6672
- id="yop-poll-view-total-votes-no" type="radio" value="no"
6673
- name="yop_poll_options[view_total_votes]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6674
- </td>
6675
- </tr>
6676
- <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
6677
- <th>
6678
- <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
6679
- </th>
6680
- <td><input id="yop-poll-view-total-votes-label" type="text"
6681
- name="yop_poll_options[view_total_votes_label]"
6682
- value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>"/>
6683
- </td>
6684
- </tr>
6685
- <tr>
6686
- <th>
6687
- <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
6688
- </th>
6689
- <td><label for="yop-poll-view-total-answers-yes"><input
6690
- <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
6691
- id="yop-poll-view-total-answers-yes" type="radio"
6692
- value="yes" name="yop_poll_options[view_total_answers]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6693
- <label for="yop-poll-view-total-answers-no"><input
6694
- <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
6695
- id="yop-poll-view-total-answers-no" type="radio" value="no"
6696
- name="yop_poll_options[view_total_answers]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6697
- </td>
6698
- </tr>
6699
- <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
6700
- <th>
6701
- <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
6702
- </th>
6703
- <td><input id="yop-poll-view-total-answers-label" type="text"
6704
- name="yop_poll_options[view_total_answers_label]"
6705
- value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>"/>
6706
- </td>
6707
- </tr>
6708
- <tr>
6709
- <th>
6710
- <?php _e( 'Message After Vote', 'yop_poll' ); ?>:
6711
- </th>
6712
- <td><input id="yop-poll-message-after-vote" type="text"
6713
- name="yop_poll_options[message_after_vote]"
6714
- value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>"/>
6715
- </td>
6716
- </tr>
6717
- <?php if ( 'no' == $default_options['has_auto_generate_poll_page'] ){ ?>
6718
- <tr>
6719
- <th>
6720
- <?php _e( 'Auto Generate Poll Page ', 'yop_poll' ); ?>:
6721
- </th>
6722
- <td><input
6723
- <?php checked( 'yes', $default_options['auto_generate_poll_page'] ); ?>
6724
- id="yop-poll-auto-generate-poll-page-yes" type="radio"
6725
- value="yes" name="yop_poll_options[auto_generate_poll_page]"/><label
6726
- for="yop-poll-auto-generate-poll-page-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
6727
- <input
6728
- <?php checked( 'no', $default_options['auto_generate_poll_page'] ); ?>
6729
- id="yop-poll-auto-generate-poll-page-no" type="radio"
6730
- value="no" name="yop_poll_options[auto_generate_poll_page]"/><label
6731
- for="yop-poll-auto-generate-poll-page-no"><?php _e( 'No', 'yop_poll' ); ?></label>
6732
- </td>
6733
- </tr>
6734
- <?php } ?>
6735
- <tr>
6736
- <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>
6737
- :</label>
6738
- </th>
6739
- <td><input id="yop-poll-page-url" type="text"
6740
- name="yop_poll_options[poll_page_url]"
6741
- value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>"/>
6742
- </td>
6743
- </tr>
6744
- </tbody>
6745
- </table>
6746
- </div>
6747
- </div>
6748
- <div class="postbox" id="yop-poll-advanced-options-div">
6749
- <div title="Click to toggle" class="handlediv"><br/></div>
6750
- <h3 class="hndle">
6751
- <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
6752
- </h3>
6753
- <div class="inside">
6754
- <table cellspacing="0" class="links-table">
6755
- <tbody>
6756
- <tr>
6757
- <th>
6758
- <?php _e( 'Use CAPTCHA ', 'yop_poll' ); ?>:
6759
- </th>
6760
- <td><label for="yop-poll-use-captcha-no"><input
6761
- id="yop-poll-use-captcha-no"
6762
- <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
6763
- type="radio" name="yop_poll_options[use_captcha]"
6764
- value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6765
- for="yop-poll-use-captcha-yes"><input
6766
- id="yop-poll-use-captcha-yes"
6767
- <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
6768
- type="radio" name="yop_poll_options[use_captcha]"
6769
- value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6770
- </tr>
6771
- <tr>
6772
- <th>
6773
- <?php _e( 'Vote Permissions ', 'yop_poll' ); ?>:
6774
- </th>
6775
- <td><label for="yop-poll-vote-permisions-quest-only"><input
6776
- id="yop-poll-vote-permisions-quest-only"
6777
- <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6778
- type="radio" value="quest-only"
6779
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
6780
- <label for="yop-poll-vote-permisions-registered-only"><input
6781
- id="yop-poll-vote-permisions-registered-only"
6782
- <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6783
- type="radio" value="registered-only"
6784
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
6785
- <label for="yop-poll-vote-permisions-guest-registered"><input
6786
- id="yop-poll-vote-permisions-guest-registered"
6787
- <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6788
- type="radio" value="guest-registered"
6789
- name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
6790
- </td>
6791
- </tr>
6792
- <?php if ( false ){ ?>
6793
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6794
- <th>
6795
- <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
6796
- <?php if ($pro_options['pro_user'] == 'no') { ?>
6797
- <br/><small>(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
6798
- )</small>
6799
- <?php } ?></label>
6800
- </th>
6801
- <td><label for="yop-poll-vote-permisions-facebook-yes"><input
6802
- <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
6803
- id="yop-poll-vote-permisions-facebook-yes" type="radio"
6804
- value="yes" name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6805
- <label for="yop-poll-vote-permisions-facebook-no"><input
6806
- <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
6807
- id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
6808
- name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6809
- </td>
6810
- </tr>
6811
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-facebook-div" style="<?php echo 'yes' != $default_options['vote_permisions_facebook'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6812
- <th>
6813
- <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>
6814
- :
6815
- </th>
6816
- <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
6817
- name="yop_poll_options[vote_permisions_facebook_label]"
6818
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>"/>
6819
- </td>
6820
- </tr>
6821
- <?php } ?>
6822
-
6823
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6824
- <th>
6825
- <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?>
6826
- <br><small> (<?php _e( 'Will force users to login into your blog', 'yop_poll' ); ?>
6827
- )</small>:
6828
- </th>
6829
- <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
6830
- <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
6831
- id="yop-poll-vote-permisions-wordpress-yes" type="radio"
6832
- value="yes" name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6833
- <label for="yop-poll-vote-permisions-wordpress-no"><input
6834
- <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
6835
- id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
6836
- name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6837
- </td>
6838
- </tr>
6839
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-wordpress-div" style="<?php echo 'yes' != $default_options['vote_permisions_wordpress'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6840
- <th>
6841
- <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>
6842
- :
6843
- </th>
6844
- <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
6845
- name="yop_poll_options[vote_permisions_wordpress_label]"
6846
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>"/>
6847
- </td>
6848
- </tr>
6849
-
6850
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6851
- <th>
6852
- <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?>
6853
- <br><small>(<?php _e( 'Logged users will be treated as anonymous', 'yop_poll' ); ?>
6854
- )</small>:
6855
- </th>
6856
- <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
6857
- <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
6858
- id="yop-poll-vote-permisions-anonymous-yes" type="radio"
6859
- value="yes" name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6860
- <label for="yop-poll-vote-permisions-anonymous-no"><input
6861
- <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
6862
- id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
6863
- name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6864
- </td>
6865
- </tr>
6866
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-div" style="<?php echo 'yes' != $default_options['vote_permisions_anonymous'] ? 'display: none;' : 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6867
- <th>
6868
- <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>
6869
- :
6870
- </th>
6871
- <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
6872
- name="yop_poll_options[vote_permisions_anonymous_label]"
6873
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>"/>
6874
- </td>
6875
- </tr>
6876
-
6877
- <tr>
6878
- <th>
6879
- <?php _e( 'Blocking Voters ', 'yop_poll' ); ?>:
6880
- </th>
6881
- <td><label for="yop-poll-blocking-voters-dont-block"><input
6882
- class="yop-poll-blocking-voters-hide-interval"
6883
- <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6884
- id="yop-poll-blocking-voters-dont-block" type="radio"
6885
- value="dont-block" name="yop_poll_options[blocking_voters]"/> <?php _e( 'Dont`t Block', 'yop_poll' ); ?></label>
6886
- <label for="yop-poll-blocking-voters-cookie"><input
6887
- class="yop-poll-blocking-voters-show-interval"
6888
- <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6889
- id="yop-poll-blocking-voters-cookie" type="radio"
6890
- value="cookie" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie', 'yop_poll' ); ?></label>
6891
- <label for="yop-poll-blocking-voters-ip"><input
6892
- class="yop-poll-blocking-voters-show-interval"
6893
- <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6894
- id="yop-poll-blocking-voters-ip" type="radio" value="ip"
6895
- name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Ip', 'yop_poll' ); ?></label>
6896
- <label for="yop-poll-blocking-voters-username"><input
6897
- class="yop-poll-blocking-voters-show-interval"
6898
- <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6899
- id="yop-poll-blocking-voters-username" type="radio"
6900
- value="username" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Username', 'yop_poll' ); ?></label>
6901
- <label for="yop-poll-blocking-voters-cookie-ip"><input
6902
- class="yop-poll-blocking-voters-show-interval"
6903
- <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6904
- id="yop-poll-blocking-voters-cookie-ip" type="radio"
6905
- value="cookie-ip" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie &amp; Ip', 'yop_poll' ); ?></label>
6906
- </td>
6907
- </tr>
6908
- <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
6909
- <th>
6910
- <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
6911
- </th>
6912
- <td><input type="text"
6913
- name="yop_poll_options[blocking_voters_interval_value]"
6914
- id="yop-poll-blocking-voters-interval-value"
6915
- value="<?php echo $default_options['blocking_voters_interval_value']; ?>"/>
6916
- <select id="yop-poll-blocking-voters-interval-unit"
6917
- name="yop_poll_options[blocking_voters_interval_unit]">
6918
- <option
6919
- <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6920
- value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
6921
- <option
6922
- <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6923
- value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
6924
- <option
6925
- <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6926
- value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
6927
- <option
6928
- <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6929
- value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
6930
- </select></td>
6931
- </tr>
6932
- <tr class="yop-poll-limit-number-of-votes-per-user-div">
6933
- <th>
6934
- <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>:
6935
- <br><small>(<?php _e( 'Only for logged users', 'yop_poll' ); ?>
6936
- )</small>
6937
- </th>
6938
- <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
6939
- <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
6940
- id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
6941
- value="yes" name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6942
- <label for="yop-poll-limit-number-of-votes-per-user-no"><input
6943
- <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
6944
- id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
6945
- name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6946
- </td>
6947
- </tr>
6948
- <tr class="yop-poll-limit-number-of-votes-per-user-divs yop_poll_suboption" id="yop-poll-number-of-votes-per-user-div" style="<?php echo 'yes' != $default_options['limit_number_of_votes_per_user'] ? 'display: none;' : '' ?>">
6949
- <th>
6950
- <?php _e( 'Number of Votes per User', 'yop_poll' ); ?>:
6951
- </th>
6952
- <td><input id="yop-poll-number-of-votes-per-user" type="text"
6953
- name="yop_poll_options[number_of_votes_per_user]"
6954
- value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>"/>
6955
- </td>
6956
- </tr>
6957
- <tr>
6958
- <th><?php _e( 'Poll Template ', 'yop_poll' ); ?>:</th>
6959
- <td>
6960
- <?php
6961
- $templates = YOP_POLL_MODEL::get_yop_poll_templates_search( 'id', 'asc' );
6962
- ?>
6963
- <select class="yop-poll-template" id="yop-poll-template"
6964
- name="yop_poll_options[template]"
6965
- onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_page_template', 1);">
6966
- <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
6967
- <?php
6968
- if ( count( $templates ) > 0 ){
6969
- foreach ( $templates as $template ) {
6970
- ?>
6971
- <option
6972
- <?php if ( $default_options['template'] == $template['id'] )
6973
- echo 'selected="selected"' ?>
6974
- value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
6975
- <?php
6976
- }
6977
- }
6978
- ?>
6979
- </select>
6980
- <div id="yop_poll_preview_page_template" style="position: relative; float: right;">
6981
- <?php
6982
- if ( ( $default_options['template'] ) )
6983
- print( Yop_Poll_Model::return_template_preview_html( $default_options['template'], 1 ) );
6984
- ?>
6985
- </div>
6986
- </td>
6987
- </tr>
6988
- <tr class="yop_poll_suboption">
6989
- <th>
6990
- <?php _e( 'Poll Template Width', 'yop_poll' ); ?>:
6991
- </th>
6992
- <td><input id="yop-poll-template-width"
6993
- type="text"
6994
- name="yop_poll_options[template_width]"
6995
- style="width: 50%;"
6996
- value="<?php echo $default_options['template_width']; ?>"/>
6997
- </td>
6998
- </tr>
6999
- <tr>
7000
- <th><?php _e( 'Widget Template ', 'yop_poll' ); ?>:</th>
7001
- <td>
7002
- <?php
7003
- $templates = YOP_POLL_MODEL::get_yop_poll_templates_search( 'id', 'asc' );
7004
- ?>
7005
- <select class="yop-poll-widget-template" id="yop-poll-widget-template"
7006
- name="yop_poll_options[widget_template]"
7007
- onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_widget_template', 2);">
7008
- <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
7009
- <?php
7010
- if ( count( $templates ) > 0 ){
7011
- foreach ( $templates as $template ) {
7012
- ?>
7013
- <option
7014
- <?php if ( $default_options['widget_template'] == $template['id'] )
7015
- echo 'selected="selected"' ?>
7016
- value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
7017
- <?php
7018
- }
7019
- }
7020
- ?>
7021
- </select>
7022
- <div id="yop_poll_preview_widget_template" style="position: relative; float: right;">
7023
- <?php
7024
- if ( ( $default_options['widget_template'] ) )
7025
- print( Yop_Poll_Model::return_template_preview_html( $default_options['widget_template'], 2 ) );
7026
- ?>
7027
- </div>
7028
- </td>
7029
- </tr>
7030
- <tr class="yop_poll_suboption">
7031
- <th>
7032
- <?php _e( 'Widget Template Width', 'yop_poll' ); ?>:
7033
- </th>
7034
- <td><input id="yop-poll-widget-template-width"
7035
- type="text"
7036
- name="yop_poll_options[widget_template_width]"
7037
- style="width: 50%;"
7038
- value="<?php echo $default_options['widget_template_width']; ?>"/>
7039
- </td>
7040
- </tr>
7041
- <tr>
7042
- <th>
7043
- <?php _e( 'Percentages Decimals', 'yop_poll' ); ?>:
7044
- </th>
7045
- <td><input id="yop-poll-percentages-decimals" type="text"
7046
- name="yop_poll_options[percentages_decimals]"
7047
- value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>"/>
7048
- </td>
7049
- </tr>
7050
- <tr>
7051
- <th>
7052
- <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
7053
- </th>
7054
- <td><label for="yop-poll-use-default-loading-image-yes"><input
7055
- <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7056
- id="yop-poll-use-default-loading-image-yes" type="radio"
7057
- value="yes"
7058
- name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7059
- <label for="yop-poll-use-default-loading-image-no"><input
7060
- <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7061
- id="yop-poll-use-default-loading-image-no" type="radio"
7062
- value="no"
7063
- name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7064
- </td>
7065
- </tr>
7066
- <tr class="yop_poll_suboption" id="yop-poll-use-default-loading-image-div" style="<?php echo 'yes' == $default_options['use_default_loading_image'] ? 'display: none;' : ''; ?>">
7067
- <th>
7068
- <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
7069
- </th>
7070
- <td><input id="yop-poll-loading-image-url" type="text"
7071
- name="yop_poll_options[loading_image_url]"
7072
- value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>"/>
7073
- </td>
7074
- </tr>
7075
-
7076
- <tr>
7077
- <th>
7078
- <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
7079
- </th>
7080
- <td><label for="yop-poll-redirect-after-vote-yes"><input
7081
- <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7082
- id="yop-poll-redirect-after-vote-yes" type="radio"
7083
- value="yes"
7084
- name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7085
- <label for="yop-poll-redirect-after-vote-no"><input
7086
- <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7087
- id="yop-poll-redirect-after-vote-no" type="radio"
7088
- value="no"
7089
- name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7090
- </td>
7091
- </tr>
7092
- <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
7093
- <th>
7094
- <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
7095
- </th>
7096
- <td><input id="yop-poll-redirect-after-vote-url" type="text"
7097
- name="yop_poll_options[redirect_after_vote_url]"
7098
- value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>"/>
7099
- </td>
7100
- </tr>
7101
-
7102
- <tr>
7103
- <th>
7104
- <?php _e( 'Reset Poll Stats Automatically', 'yop_poll' ); ?>:
7105
- </th>
7106
- <td><label for="yop-poll-schedule-reset-poll-stats-yes"><input
7107
- <?php echo 'yes' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7108
- id="yop-poll-schedule-reset-poll-stats-yes" type="radio"
7109
- value="yes"
7110
- name="yop_poll_options[schedule_reset_poll_stats]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7111
- <label for="yop-poll-schedule-reset-poll-stats-no"><input
7112
- <?php echo 'no' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7113
- id="yop-poll-schedule-reset-poll-stats-no" type="radio"
7114
- value="no"
7115
- name="yop_poll_options[schedule_reset_poll_stats]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7116
- </td>
7117
- </tr>
7118
- <tr class="yop-poll-schedule-reset-poll-stats-options-div yop_poll_suboption" style="<?php echo 'no' == $default_options['schedule_reset_poll_stats'] ? 'display: none;' : ''; ?>">
7119
- <th>
7120
- <?php _e( 'Reset Stats Date', 'yop_poll' ); ?>
7121
- :<br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
7122
- echo ': ' . current_time( 'mysql' ); ?>)</small>
7123
- </th>
7124
- <td><input id="yop-poll-schedule-reset-poll-stats-date" type="text"
7125
- name="yop_poll_options[schedule_reset_poll_date]"
7126
- value="<?php echo date( 'Y-m-d H:i:s', $default_options['schedule_reset_poll_date'] ); ?>"/>
7127
- </td>
7128
- </tr>
7129
- <tr class="yop-poll-schedule-reset-poll-stats-options-div yop_poll_suboption" style="<?php echo 'no' == $default_options['schedule_reset_poll_stats'] ? 'display: none;' : ''; ?>">
7130
- <th>
7131
- <?php _e( 'Reset Stats Every', 'yop_poll' ); ?>:
7132
- </th>
7133
- <td><input style="width:20%" id="yop-poll-schedule-reset-poll-stats-recurring-value" type="text"
7134
- name="yop_poll_options[schedule_reset_poll_recurring_value]"
7135
- value="<?php echo esc_html( stripslashes( $default_options['schedule_reset_poll_recurring_value'] ) ); ?>"/>
7136
- <select name="yop_poll_options[schedule_reset_poll_recurring_unit]">
7137
- <option value="hour" <?php echo selected( 'hour', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>HOURS</option>
7138
- <option value="day" <?php echo selected( 'day', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>DAYS</option>
7139
- </select>
7140
- </td>
7141
- </tr>
7142
- <tr>
7143
- <th>
7144
- <?php _e( 'Poll Date Format', 'yop_poll' ); ?>
7145
- : <br/><small><?php _e( 'Check', 'yop_popll' ) ?>
7146
- <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e( 'documentation', 'yop_popll' ) ?></a></small>
7147
- </th>
7148
- <td><input id="yop-poll-date-format" type="text"
7149
- name="yop_poll_options[date_format]"
7150
- value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>"/>
7151
- </td>
7152
- </tr>
7153
- </tbody>
7154
- </table>
7155
- </div>
7156
- </div>
7157
- <div class="postbox" id="yop-poll-advanced-options-div">
7158
- <div title="Click to toggle" class="handlediv">
7159
- <br/>
7160
- </div>
7161
- <h3 class="hndle">
7162
- <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
7163
- </h3>
7164
- <div class="inside">
7165
- <table cellspacing="0" class="links-table">
7166
- <tbody>
7167
- <tr>
7168
- <th>
7169
- <?php _e( 'View Poll Archive Link ', 'yop_poll' ); ?>:
7170
- </th>
7171
- <td><input
7172
- <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
7173
- id="yop-poll-view-poll-archive-link-yes" type="radio"
7174
- value="yes" name="yop_poll_options[view_poll_archive_link]"/><label
7175
- for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7176
- <input
7177
- <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
7178
- id="yop-poll-view-poll-archive-link-no" type="radio"
7179
- value="no" name="yop_poll_options[view_poll_archive_link]"/><label
7180
- for="yop-poll-view-poll-archive-link-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7181
- </td>
7182
- </tr>
7183
- <tr class="yop_poll_suboption" id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
7184
- <th>
7185
- <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
7186
- </th>
7187
- <td><input id="yop-poll-view-poll-archive-link-label"
7188
- type="text"
7189
- name="yop_poll_options[view_poll_archive_link_label]"
7190
- value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>"/>
7191
- </td>
7192
- </tr>
7193
- <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
7194
- <th>
7195
- <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
7196
- </th>
7197
- <td><input id="yop-poll-poll-archive-url" type="text"
7198
- name="yop_poll_options[poll_archive_url]"
7199
- value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>"/>
7200
- </td>
7201
- </tr>
7202
- <tr>
7203
- <th>
7204
- <?php _e( 'Show Poll In Archive ', 'yop_poll' ); ?>:
7205
- </th>
7206
- <td><label for="yop-poll-show-in-archive-yes"><input
7207
- <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
7208
- id="yop-poll-show-in-archive-yes" type="radio" value="yes"
7209
- name="yop_poll_options[show_in_archive]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7210
- <label for="yop-poll-show-in-archive-no"><input
7211
- <?php checked( 'no', $default_options['show_in_archive'] ); ?>
7212
- id="yop-poll-show-in-archive-no" type="radio" value="no"
7213
- name="yop_poll_options[show_in_archive]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7214
- </td>
7215
- </tr>
7216
- <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
7217
- <th>
7218
- <?php _e( 'Archive Order', 'yop_poll' ); ?>:
7219
- </th>
7220
- <td><input id="yop-poll-show-in-archive-order" type="text"
7221
- name="yop_poll_options[archive_order]"
7222
- value="<?php echo esc_html( stripslashes( $default_options['archive_order'] ) ); ?>"/>
7223
- </td>
7224
- </tr>
7225
-
7226
- </table>
7227
- </div>
7228
- </div>
7229
- <div class="postbox" id="yop-poll-advanced-options-div8">
7230
- <div title="Click to toggle" class="handlediv">
7231
- <br/>
7232
- </div>
7233
- <h3 class="hndle">
7234
- <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
7235
- </h3>
7236
- <div class="inside">
7237
- <table cellspacing="0" class="links-table">
7238
- <tbody>
7239
- <tr>
7240
- <th>
7241
- <?php _e( 'Send Email Notifications', 'yop_poll' ); ?>:
7242
- </th>
7243
- <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
7244
- id="yop-poll-send-email-notifications-yes" type="radio"
7245
- value="yes" name="yop_poll_options[send_email_notifications]"/><label
7246
- for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7247
- <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
7248
- id="yop-poll-send-email-notifications-no" type="radio"
7249
- value="no" name="yop_poll_options[send_email_notifications]"/><label
7250
- for="yop-poll-send-email-notifications-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7251
- </td>
7252
- </tr>
7253
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-from-name-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
7254
- <th>
7255
- <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
7256
- </th>
7257
- <td valign="top">
7258
- <input id="yop-poll-email-notifications-from-name"
7259
- type="text"
7260
- name="yop_poll_options[email_notifications_from_name]"
7261
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>"/>
7262
- </td>
7263
- </tr>
7264
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-from-email-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
7265
- <th>
7266
- <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
7267
- </th>
7268
- <td valign="top">
7269
- <input id="yop-poll-email-notifications-from-email"
7270
- type="text"
7271
- name="yop_poll_options[email_notifications_from_email]"
7272
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>"/>
7273
- </td>
7274
- </tr>
7275
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-recipients-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
7276
- <th>
7277
- <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>
7278
- :<br><small><?php _e( 'Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll' ) ?></small>
7279
- </th>
7280
- <td valign="top">
7281
- <input id="yop-poll-email-notifications-recipients"
7282
- type="text"
7283
- name="yop_poll_options[email_notifications_recipients]"
7284
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>"/>
7285
- </td>
7286
- </tr>
7287
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-subject-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
7288
- <th>
7289
- <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
7290
- </th>
7291
- <td>
7292
- <input id="yop-poll-email-notifications-subject"
7293
- type="text"
7294
- name="yop_poll_options[email_notifications_subject]"
7295
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_subject'] ) ); ?>"
7296
- />
7297
- </td>
7298
- </tr>
7299
- <tr class="yop_poll_suboption yop-poll-email-notifications-div" id="yop-poll-email-notifications-body-div" style="<?php echo 'yes' != $default_options['send_email_notifications'] ? 'display: none;' : ''; ?>">
7300
- <th>
7301
- <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
7302
- </th>
7303
- <td>
7304
- <textarea id="yop-poll-email-notifications-body" rows="10"
7305
- name="yop_poll_options[email_notifications_body]"><?php echo esc_html( stripslashes( $default_options['email_notifications_body'] ) ); ?></textarea>
7306
- </td>
7307
- </tr>
7308
- </table>
7309
- </div>
7310
- </div>
7311
- <?php if ( false ){ ?>
7312
- <div class="postbox" id="yop-poll-advanced-options-div9">
7313
- <div title="Click to toggle" class="handlediv">
7314
- <br/>
7315
- </div>
7316
- <h3 class="hndle">
7317
- <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
7318
- <?php if ( $pro_options['pro_user'] == 'no' ){ ?>
7319
- <small>(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?> )</small>
7320
- <?php } ?>
7321
- </span>
7322
- </h3>
7323
- <div class="inside">
7324
- <table cellspacing="0" class="links-table">
7325
- <tbody>
7326
- <tr>
7327
- <th>
7328
- <?php _e( 'Share After Vote ', 'yop_poll' ); ?>:
7329
- </th>
7330
- <td><input
7331
- <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
7332
- id="yop-poll-share-after-vote-yes" type="radio"
7333
- value="yes" name="yop_poll_options[share_after_vote]"/><label
7334
- for="yop-poll-share-after-vote-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7335
- <input
7336
- <?php checked( 'no', $default_options['share_after_vote'] ); ?>
7337
- id="yop-poll-share-after-vote-no" type="radio"
7338
- value="no" name="yop_poll_options[share_after_vote]"/><label
7339
- for="yop-poll-share-after-vote-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7340
- </td>
7341
- </tr>
7342
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7343
- <th>
7344
- <?php _e( 'Share Name', 'yop_poll' ); ?>:
7345
- </th>
7346
- <td><input id="yop-poll-share-name"
7347
- type="text"
7348
- name="yop_poll_options[share_name]"
7349
- value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>"/>
7350
- </td>
7351
- </tr>
7352
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7353
- <th>
7354
- <?php _e( 'Share Caption', 'yop_poll' ); ?>:
7355
- </th>
7356
- <td><input id="yop-poll-share-caption"
7357
- type="text"
7358
- name="yop_poll_options[share_caption]"
7359
- value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>"/>
7360
- </td>
7361
- </tr>
7362
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7363
- <th>
7364
- <?php _e( 'Share Description', 'yop_poll' ); ?>:
7365
- </th>
7366
- <td><input id="yop-poll-share-description"
7367
- type="text"
7368
- name="yop_poll_options[share_description]"
7369
- value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>"/>
7370
- </td>
7371
- </tr>
7372
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7373
- <th>
7374
- <?php _e( 'Share Picture', 'yop_poll' ); ?>:
7375
- </th>
7376
- <td><input id="yop-poll-share-picture"
7377
- type="text"
7378
- name="yop_poll_options[share_picture]"
7379
- value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>"/>
7380
- </td>
7381
- </tr>
7382
-
7383
- </table>
7384
- </div>
7385
- </div>
7386
- <?php } ?>
7387
- </div>
7388
- <input type="hidden" value="<?php echo $poll_id ?>"
7389
- name="yop_poll_id" id="yop-poll-edit-add-new-form-poll-id"/> <input
7390
- type="hidden" value="<?php echo $action_type ?>"
7391
- name="action_type" id="yop-poll-edit-add-new-form-action-type"/>
7392
- <input type="button" accesskey="p" class="button-primary"
7393
- value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7394
- id="yop-poll-edit-add-new-form-submit"/>
7395
- </div>
7396
- <div class="postbox-container" id="postbox-container-1">
7397
- <div class="meta-box-sortables ui-sortable" id="side-sortables">
7398
- <div class="postbox " id="linksubmitdiv">
7399
- <div title="Click to toggle" class="handlediv">
7400
- <br/>
7401
- </div>
7402
- <h3 class="hndle">
7403
- <span><?php _e( 'Save', 'yop_poll' ); ?></span>
7404
- </h3>
7405
- <div class="inside">
7406
- <div id="submitlink" class="submitbox">
7407
- <div id="major-publishing-actions">
7408
- <div id="publishing-action">
7409
- <input type="button" accesskey="p" class="button-primary"
7410
- value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7411
- id="yop-poll-edit-add-new-form-submit1"/>
7412
- </div>
7413
- <div class="clear"></div>
7414
- </div>
7415
- <div class="clear"></div>
7416
- </div>
7417
- </div>
7418
- </div>
7419
- <?php if ( 'edit' == $action ) : ?>
7420
- <div id="submitdiv" class="postbox ">
7421
- <div title="Click to toggle" class="handlediv">
7422
- <br/>
7423
- </div>
7424
- <h3 class="hndle">
7425
- <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
7426
- </h3>
7427
- <div class="inside">
7428
- <div id="submitpost" class="submitbox">
7429
- <div id="minor-publishing">
7430
- <div id="misc-publishing-actions">
7431
- <div class="misc-pub-section">
7432
- <label for="post_status"><?php _e( 'Poll Author', 'yop_poll' ) ?>
7433
- :</label>
7434
- <span id="yop-poll-change-poll-author-container-<?php echo $current_poll['id'] ?>"><b><?php $poll_author = get_user_by( 'id', $current_poll ['poll_author'] );
7435
- echo $poll_author->user_nicename; ?></b></span>
7436
- <a class="edit-post-status hide-if-no-js" href="javascript:void(0)" onclick="yop_poll_show_change_poll_author( '<?php echo $current_poll ['id'] ?>', 'answers'); return false;" style="display: inline;">Edit</a>
7437
- </div>
7438
- </div>
7439
- <div id="misc-publishing-actions">
7440
- <div class="misc-pub-section">
7441
- <label for="post_status"><?php _e( 'Total Votes', 'yop_poll' ) ?>
7442
- :</label>
7443
- <span id="yop-poll-change-no-votes-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_votes'] ?></b></span>
7444
- <a class="edit-post-status hide-if-no-js" href="javascript:void(0)" onclick="yop_poll_show_change_total_number_poll( '<?php echo $current_poll ['id'] ?>', 'votes'); return false;" style="display: inline;">Edit</a>
7445
- </div>
7446
- </div>
7447
- <div id="misc-publishing-actions">
7448
- <div class="misc-pub-section">
7449
- <label for="post_status"><?php _e( 'Total Answers', 'yop_poll' ) ?>
7450
- :</label>
7451
- <span id="yop-poll-change-no-answers-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_answers'] ?></b></span>
7452
- <a class="edit-post-status hide-if-no-js" href="javascript:void(0)" onclick="yop_poll_show_change_total_number_poll( '<?php echo $current_poll ['id'] ?>', 'answers'); return false;" style="display: inline;">Edit</a>
7453
- </div>
7454
- </div>
7455
- </div>
7456
- <div class="clear"></div>
7457
- </div>
7458
- </div>
7459
- </div>
7460
- <?php endif; ?>
7461
- </div>
7462
- </div>
7463
- </div>
7464
- <br class="clear">
7465
- </div>
7466
- </form>
7467
- </div>
7468
- <?php
7469
- }
7470
-
7471
- public function view_add_edit_poll_template() {
7472
- global $action, $current_user;
7473
- $page_name = __( 'Add New Poll Template', 'yop_poll' );
7474
- $action_type = 'add-new';
7475
- $template_id = '';
7476
- if ( 'edit' == $action ){
7477
- $template_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
7478
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
7479
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_author != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7480
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7481
- $page_name = __( 'Edit Poll Template', 'yop_poll' );
7482
- $action_type = 'edit';
7483
- }
7484
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7485
- $current_template = YOP_POLL_MODEL::get_poll_template_from_database_by_id( $template_id );
7486
- ?>
7487
- <div class="wrap">
7488
- <div class="icon32 icon32-yop-poll">
7489
- <br>
7490
-
7491
- </div>
7492
- <h2><?php print $page_name; ?><?php if ('edit' == $action): ?><a
7493
- class="add-new-h2"
7494
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-templates', 'action' => 'add-new', 'id' => false ) ) ); ?>"><?php _e( 'Add New', 'yop_poll' ); ?></a><?php endif; ?></h2>
7495
- <div id="message"></div>
7496
- <form method="post" name="yop_poll_edit_add_new_template_form"
7497
- id="yop-poll-edit-add-new-template-form">
7498
- <?php wp_nonce_field( 'yop-poll-edit-add-new-template' ); ?>
7499
- <div id="poststuff">
7500
- <div id="post-body" class="metabox-holder columns-2">
7501
- <div id="post-body-content">
7502
- <div class="stuffbox" id="yop-poll-template-namediv">
7503
- <h3>
7504
- <label for="yop-poll-template-name"><?php _e( 'Template Name', 'yop_poll' ); ?></label>
7505
- </h3>
7506
- <div class="inside">
7507
- <input type="text" id="yop-poll-template-name"
7508
- value="<?php echo esc_html( stripslashes( $current_template['name'] ) ); ?>"
7509
- tabindex="1" name="yop_poll_template_name" size="30"/>
7510
- <p><?php _e( 'Example: Test Poll Template', 'yop_poll' ); ?></p>
7511
- </div>
7512
- </div>
7513
- <div class="stuffbox" id="yop-poll-before-vote-template-div">
7514
- <h3>
7515
- <label for="yop-poll-before_vote-template-input"><?php _e( 'Template Before Vote', 'yop_poll' ); ?></label>
7516
- </h3>
7517
- <div class="inside">
7518
- <?php wp_editor( stripslashes( $current_template['before_vote_template'] ), 'yop-poll-before-vote-template-input', array( 'textarea_name' => 'yop_poll_before_vote_template', 'teeny' => true, 'media_buttons' => false ) ); ?>
7519
- </div>
7520
- </div>
7521
- <div class="stuffbox" id="yop-poll-after-vote-template-div">
7522
- <h3>
7523
- <label for="yop-poll-after-vote-template-input"><?php _e( 'Template After Vote', 'yop_poll' ); ?></label>
7524
- </h3>
7525
- <div class="inside">
7526
- <?php wp_editor( stripslashes( $current_template['after_vote_template'] ), 'yop-poll-after-vote-template-input', array( 'textarea_name' => 'yop_poll_after_vote_template', 'teeny' => true, 'media_buttons' => false ) ); ?>
7527
- </div>
7528
- </div>
7529
- <div class="postbox" id="yop-poll-template-before-start-date-div">
7530
- <div title="Click to toggle" class="handlediv"
7531
- id="yop-poll-template-before-start-date-handler">
7532
- <br>
7533
-
7534
- </div>
7535
- <h3>
7536
- <label for="yop-poll-template-before-start-date-input"><?php _e( 'Template Before Start Date', 'yop_poll' ); ?></label>
7537
- </h3>
7538
- <div class="inside">
7539
- <?php wp_editor( stripslashes( $current_template['before_start_date_template'] ), 'yop-poll-template-before-start-date-input', array( 'textarea_name' => 'yop_poll_template_before_start_date', 'teeny' => true, 'media_buttons' => false ) ); ?>
7540
- </div>
7541
- </div>
7542
- <div class="postbox" id="yop-poll-template-after-end-date-div">
7543
- <div title="Click to toggle" class="handlediv"
7544
- id="yop-poll-template-after-end-date-handler">
7545
- <br>
7546
-
7547
- </div>
7548
- <h3>
7549
- <label for="yop-poll-template-after-end-date-input"><?php _e( 'Template After End Date', 'yop_poll' ); ?></label>
7550
- </h3>
7551
- <div class="inside">
7552
- <?php wp_editor( stripslashes( $current_template['after_end_date_template'] ), 'yop-poll-template-after-end-date-input', array( 'textarea_name' => 'yop_poll_template_after_end_date', 'teeny' => true, 'media_buttons' => false ) ); ?>
7553
- </div>
7554
- </div>
7555
- <div class="postbox" id="yop-poll-template-css-div">
7556
- <div title="Click to toggle" class="handlediv"
7557
- id="yop-poll-template-css-handler">
7558
- <br>
7559
-
7560
- </div>
7561
- <h3>
7562
- <label for="yop-poll-template-css-input"><?php _e( 'Css', 'yop_poll' ); ?></label>
7563
- </h3>
7564
- <div class="inside">
7565
- <?php wp_editor( stripslashes( $current_template['css'] ), 'yop-poll-template-css-input', array( 'textarea_name' => 'yop_poll_template_css', 'teeny' => true, 'media_buttons' => false ) ); ?>
7566
- </div>
7567
- </div>
7568
- <div class="postbox" id="yop-poll-template-js-div">
7569
- <div title="Click to toggle" class="handlediv"
7570
- id="yop-poll-template-js-handler">
7571
- <br>
7572
-
7573
- </div>
7574
- <h3>
7575
- <label for="yop-poll-template-js-input"><?php _e( 'JavaScript', 'yop_poll' ); ?></label>
7576
- </h3>
7577
- <div class="inside">
7578
- <?php wp_editor( stripslashes( $current_template['js'] ), 'yop-poll-template-js-input', array( 'textarea_name' => 'yop_poll_template_js', 'teeny' => true, 'media_buttons' => false ) ); ?>
7579
- </div>
7580
- </div>
7581
-
7582
- <input type="hidden" value="<?php echo $current_template['id']; ?>"
7583
- name="template_id"
7584
- id="yop-poll-edit-add-new-template-form-template-id"/> <input
7585
- type="hidden" value="<?php echo $action_type ?>"
7586
- name="action_type"
7587
- id="yop-poll-edit-add-new-template-form-action-type"/> <input
7588
- type="button" class="button-primary"
7589
- value="<?php _e( 'Save Poll Template', 'yop_poll' ) ?>"
7590
- id="yop-poll-edit-add-new-template-form-save"/>
7591
- </div>
7592
- <div class="postbox-container" id="postbox-container-1">
7593
- <div class="meta-box-sortables ui-sortable" id="side-sortables">
7594
- <div class="postbox " id="linksubmitdiv">
7595
- <div title="Click to toggle" class="handlediv">
7596
- <br/>
7597
- </div>
7598
- <h3 class="hndle">
7599
- <span><?php _e( 'Save', 'yop_poll' ); ?></span>
7600
- </h3>
7601
- <div class="inside">
7602
- <div id="submitlink" class="submitbox">
7603
- <div id="major-publishing-actions">
7604
- <div id="publishing-action">
7605
- <input type="button" accesskey="p" class="button-primary"
7606
- value="<?php _e( 'Save Poll Template', 'yop_poll' ); ?>"
7607
- id="yop-poll-edit-add-new-template-form-save1"/>
7608
- </div>
7609
- <div class="clear"></div>
7610
- </div>
7611
- <div class="clear"></div>
7612
- </div>
7613
- </div>
7614
- </div>
7615
- <?php
7616
- if ( 'edit' == $action ){
7617
- ?>
7618
- <div id="submitdiv" class="postbox ">
7619
- <div title="Click to toggle" class="handlediv">
7620
- <br/>
7621
- </div>
7622
- <h3 class="hndle">
7623
- <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
7624
- </h3>
7625
- <div class="inside">
7626
- <div id="submitpost" class="submitbox">
7627
- <div id="minor-publishing">
7628
- <div id="misc-publishing-actions">
7629
- <div class="misc-pub-section">
7630
- <label for="post_status"><?php _e( 'Template Author', 'yop_poll' ) ?>
7631
- :</label>
7632
- <span id="yop-poll-change-template-author-container-<?php echo $current_template['id'] ?>"><b><?php $template_author = get_user_by( 'id', $current_template['template_author'] );
7633
- echo $template_author->user_nicename; ?></b></span>
7634
- <a class="edit-post-status hide-if-no-js" href="javascript:void(0)" onclick="yop_poll_show_change_template_author( '<?php echo $current_template ['id'] ?>', 'answers'); return false;" style="display: inline;">Edit</a>
7635
- </div>
7636
- </div>
7637
- </div>
7638
- <div class="clear"></div>
7639
- </div>
7640
- <div id="submitpost" class="submitbox">
7641
- <div id="minor-publishing">
7642
- <div id="misc-publishing-actions">
7643
- <div class="misc-pub-section">
7644
- <p><?php _e( 'Select Template For Reset', 'yop_poll' ) ?>
7645
- :</p>
7646
- <select name="yop_poll_reset_template_id"
7647
- id="yop-poll-reset-template-id">
7648
- <option <?php selected( 'White', $current_template['name'] ); ?> value="1"><?php _e( 'White', 'yop_poll' ) ?></option>
7649
- <option <?php selected( 'Grey', $current_template['name'] ); ?> value="2"><?php _e( 'Grey', 'yop_poll' ) ?></option>
7650
- <option <?php selected( 'Dark', $current_template['name'] ); ?> value="3"><?php _e( 'Dark', 'yop_poll' ) ?></option>
7651
- <option <?php selected( 'Blue v1', $current_template['name'] ); ?> value="4"><?php _e( 'Blue v1', 'yop_poll' ) ?></option>
7652
- <option <?php selected( 'Blue v2', $current_template['name'] ); ?> value="5"><?php _e( 'Blue v2', 'yop_poll' ) ?></option>
7653
- <option <?php selected( 'Blue v3', $current_template['name'] ); ?> value="6"><?php _e( 'Blue v3', 'yop_poll' ) ?></option>
7654
- <option <?php selected( 'Red v1', $current_template['name'] ); ?> value="7"><?php _e( 'Red v1', 'yop_poll' ) ?></option>
7655
- <option <?php selected( 'Red v2', $current_template['name'] ); ?> value="8"><?php _e( 'Red v2', 'yop_poll' ) ?></option>
7656
- <option <?php selected( 'Red v3', $current_template['name'] ); ?> value="9"><?php _e( 'Red v3', 'yop_poll' ) ?></option>
7657
- <option <?php selected( 'Green v1', $current_template['name'] ); ?> value="10"><?php _e( 'Green v1', 'yop_poll' ) ?></option>
7658
- <option <?php selected( 'Green v2', $current_template['name'] ); ?> value="11"><?php _e( 'Green v2', 'yop_poll' ) ?></option>
7659
- <option <?php selected( 'Green v3', $current_template['name'] ); ?> value="12"><?php _e( 'Green v3', 'yop_poll' ) ?></option>
7660
- <option <?php selected( 'Orange v1', $current_template['name'] ); ?> value="13"><?php _e( 'Orange v1', 'yop_poll' ) ?></option>
7661
- <option <?php selected( 'Orange v2', $current_template['name'] ); ?> value="14"><?php _e( 'Orange v2', 'yop_poll' ) ?></option>
7662
- <option <?php selected( 'Orange v3', $current_template['name'] ); ?> value="15"><?php _e( 'Orange v3', 'yop_poll' ) ?></option>
7663
- </select>
7664
- </div>
7665
- </div>
7666
- </div>
7667
- <div class="clear"></div>
7668
- </div>
7669
- <div id="submitlink" class="submitbox">
7670
- <div id="major-publishing-actions">
7671
- <div id="publishing-action">
7672
- <input type="button" accesskey="r" class="button-primary"
7673
- value="<?php _e( 'Reset Poll Template', 'yop_poll' ); ?>"
7674
- id="yop-poll-edit-add-new-template-form-reset" onclick="if (confirm('<?php _e( 'Are You Sure You Want To Reset This Template?' ); ?>')) { yop_poll_reset_template() }"/>
7675
- </div>
7676
- <div class="clear"></div>
7677
- </div>
7678
- <div class="clear"></div>
7679
- </div>
7680
- </div>
7681
- </div>
7682
- <?php
7683
- }
7684
- ?>
7685
- </div>
7686
- </div>
7687
- </div>
7688
- <br class="clear">
7689
- </div>
7690
- </form>
7691
- </div>
7692
- <?php
7693
- }
7694
- /**
7695
- * End Views section
7696
- */
7697
-
7698
- /**
7699
- * Start Ajax section
7700
- */
7701
- function ajax_edit_add_new_poll() {
7702
- if ( is_admin() ){
7703
- global $wpdb, $current_user;
7704
- check_ajax_referer( 'yop-poll-edit-add-new' );
7705
-
7706
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7707
- $yop_poll_model = new Yop_Poll_Model ();
7708
- if ( 'add-new' == $_REQUEST ['action_type'] ){
7709
- if ( ( !$this->current_user_can( 'edit_own_polls' ) ) && ( !$this->current_user_can( 'edit_polls' ) ) )
7710
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7711
- else {
7712
- $yop_poll_id = $yop_poll_model->add_poll_to_database( $_REQUEST, $this->_config );
7713
- if ( $yop_poll_id ){
7714
- _e( 'Poll successfully added!', 'yop_poll' );
7715
- }
7716
- else {
7717
- echo $yop_poll_model->error;
7718
- }
7719
- }
7720
- }
7721
- if ( 'edit' == $_REQUEST ['action_type'] ){
7722
- if ( ctype_digit( $_REQUEST ['yop_poll_id'] ) ){
7723
- $poll_details = Yop_Poll_Model::get_poll_from_database_by_id( $_REQUEST ['yop_poll_id'] );
7724
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
7725
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7726
- else {
7727
- $yop_poll_id = $yop_poll_model->edit_poll_in_database( $_REQUEST, $this->_config );
7728
- if ( $yop_poll_id )
7729
- _e( 'Poll successfully Edited!', 'yop_poll' );
7730
- else
7731
- echo $yop_poll_model->error;
7732
- }
7733
- }
7734
- else
7735
- _e( 'We\'re unable to update your poll!', 'yop_poll' );
7736
- }
7737
- unset ( $yop_poll_model );
7738
- }
7739
- die ();
7740
- }
7741
-
7742
- function ajax_edit_add_new_poll_template() {
7743
- if ( is_admin() ){
7744
- global $wpdb, $current_user;
7745
- check_ajax_referer( 'yop-poll-edit-add-new-template' );
7746
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7747
- $yop_poll_model = new Yop_Poll_Model ();
7748
- if ( 'add-new' == $_REQUEST ['action_type'] ){
7749
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7750
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7751
- else {
7752
- $yop_poll_template_id = $yop_poll_model->add_poll_template_to_database( $_REQUEST, $this->_config );
7753
- if ( $yop_poll_template_id ){
7754
- _e( 'Poll template successfully added!', 'yop_poll' );
7755
- }
7756
- else {
7757
- echo $yop_poll_model->error;
7758
- }
7759
- }
7760
- }
7761
- if ( 'edit' == $_REQUEST ['action_type'] ){
7762
- if ( ctype_digit( $_REQUEST ['template_id'] ) ){
7763
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
7764
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7765
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7766
- else {
7767
- $yop_poll_template_id = $yop_poll_model->edit_poll_template_in_database( $_REQUEST, $this->_config );
7768
- if ( $yop_poll_template_id ){
7769
- _e( 'Poll Template successfully Edited!', 'yop_poll' );
7770
- }
7771
- else {
7772
- echo $yop_poll_model->error;
7773
- }
7774
- }
7775
- }
7776
- else
7777
- _e( 'We\'re unable to update your poll template!', 'yop_poll' );
7778
- }
7779
- unset ( $yop_poll_model );
7780
- }
7781
- die ();
7782
- }
7783
-
7784
- function ajax_reset_poll_template() {
7785
- if ( is_admin() ){
7786
- global $wpdb, $current_user;
7787
- check_ajax_referer( 'yop-poll-edit-add-new-template' );
7788
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7789
- $yop_poll_model = new Yop_Poll_Model ();
7790
- if ( 'edit' == $_REQUEST ['action_type'] ){
7791
- if ( ctype_digit( $_REQUEST ['template_id'] ) ){
7792
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
7793
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7794
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7795
- else {
7796
- $yop_poll_template_id = $yop_poll_model->reset_poll_template( $_REQUEST, $this->_config );
7797
- if ( $yop_poll_template_id ){
7798
- _e( 'Poll Template Successfully Reseted!', 'yop_poll' );
7799
- }
7800
- else {
7801
- echo $yop_poll_model->error;
7802
- }
7803
- }
7804
- }
7805
- else
7806
- _e( 'We\'re unable to reset your poll template!', 'yop_poll' );
7807
- }
7808
- unset ( $yop_poll_model );
7809
- }
7810
- die ();
7811
- }
7812
-
7813
- public function yop_poll_do_vote() {
7814
- $error = '';
7815
- $success = '';
7816
- $message = '';
7817
- if ( is_admin() ){
7818
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
7819
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7820
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7821
- $unique_id =strip_tags(xss_clean($unique_id));
7822
- $location = strip_tags(xss_clean($location));
7823
- if ( $poll_id ){
7824
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7825
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7826
- $yop_poll_model->set_unique_id( $unique_id );
7827
- $poll_html = $yop_poll_model->register_vote( $_REQUEST );
7828
- if ( $poll_html ){
7829
- $message = $poll_html;
7830
- $success = $yop_poll_model->success;
7831
- }
7832
- else {
7833
- $error = $yop_poll_model->error;
7834
- }
7835
- unset ( $yop_poll_model );
7836
- }
7837
- else {
7838
- $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7839
- }
7840
- }
7841
- print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
7842
- die ();
7843
- }
7844
 
7845
- public function yop_poll_view_results() {
7846
- $error = '';
7847
- $success = '';
7848
- $message = '';
7849
 
7850
- if ( is_admin() ){
7851
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
7852
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
7853
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
7854
- $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
7855
- $unique_id =strip_tags(xss_clean($unique_id));
7856
- $location = strip_tags(xss_clean($location));
7857
- $tr_id = strip_tags(xss_clean($tr_id));
7858
- if ( wp_verify_nonce( $_REQUEST['yop-poll-nonce-' . $poll_id . $unique_id], 'yop_poll-' . $poll_id . $unique_id . '-user-actions' ) ){
7859
- if ( $poll_id ){
7860
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7861
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7862
- $yop_poll_model->set_unique_id( $unique_id );
7863
- $yop_poll_model->vote = true;
7864
- $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array( 'tr_id' => $tr_id, 'location' => $location ) ) );
7865
- if ( $poll_html ){
7866
- $message = $poll_html;
7867
- $success = $yop_poll_model->success;
7868
- }
7869
- else {
7870
- $error = $yop_poll_model->error;
7871
- }
7872
- unset ( $yop_poll_model );
7873
- }
7874
- else {
7875
- $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7876
- }
7877
- }
7878
 
7879
- else {
7880
- $error = __( 'Bad Request! Try later!', 'yop_poll' );
7881
- }
7882
 
 
 
7883
  }
 
 
7884
 
7885
- print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
7886
- die ();
7887
- }
7888
-
7889
- public function yop_poll_back_to_vote() {
7890
- $error = '';
7891
- $success = '';
7892
- $message = '';
7893
- if ( is_admin() ){
7894
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
7895
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
7896
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
7897
- $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
7898
- $unique_id =strip_tags(xss_clean($unique_id));
7899
- $location = strip_tags(xss_clean($location));
7900
- $tr_id = strip_tags(xss_clean($tr_id));
7901
- if ( $poll_id ){
7902
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7903
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7904
- $yop_poll_model->set_unique_id( $unique_id );
7905
- $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array( 'tr_id' => $tr_id, 'location' => $location ) ) );
7906
- if ( $poll_html ){
7907
- $message = $poll_html;
7908
- $success = $yop_poll_model->success;
7909
- }
7910
- else {
7911
- $error = $yop_poll_model->error;
7912
- }
7913
- unset ( $yop_poll_model );
7914
- }
7915
- else {
7916
- $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7917
- }
7918
- }
7919
- print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
7920
- die ();
7921
- }
7922
-
7923
- public function yop_poll_load_css() {
7924
- header( 'Content-Type: text/css' );
7925
- // check_ajax_referer('yop-poll-public-css');
7926
- if ( is_admin() ){
7927
- $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
7928
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7929
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7930
- if ( $poll_id ){
7931
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7932
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7933
- $yop_poll_model->set_unique_id( $unique_id );
7934
- $poll_css = $yop_poll_model->return_poll_css( array( 'location' => $location ) );
7935
- print $poll_css;
7936
- unset ( $yop_poll_model );
7937
- }
7938
- }
7939
- die ();
7940
- }
7941
-
7942
- public function yop_poll_load_js() {
7943
- header( 'Content-Type: text/javascript' );
7944
- // check_ajax_referer('yop-poll-public-js');
7945
- if ( is_admin() ){
7946
- $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
7947
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7948
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7949
- if ( $poll_id ){
7950
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7951
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7952
- $yop_poll_model->set_unique_id( $unique_id );
7953
- $poll_js = $yop_poll_model->return_poll_js( array( 'location' => $location ) );
7954
- print $poll_js;
7955
- unset ( $yop_poll_model );
7956
- }
7957
- }
7958
- die ();
7959
- }
7960
-
7961
- public function ajax_get_polls_for_editor() {
7962
- check_ajax_referer( 'yop-poll-editor' );
7963
- if ( is_admin() ){
7964
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7965
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
7966
- ?>
7967
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
7968
- <html xmlns="http://www.w3.org/1999/xhtml">
7969
- <head>
7970
- <title><?php _e( 'Insert Poll', 'yop_poll' ); ?></title>
7971
- <script type="text/javascript"
7972
- src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
7973
- <script type="text/javascript">
7974
- function insertYopPollTinyMce( poll_id, tr_id ) {
7975
- tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
7976
- if ( isNaN( poll_id ) ) {
7977
- alert( '<?php _e( 'Error: Invalid Yop Poll!\n\nPlease choose the poll again:\n\n', 'yop_poll' ) ?>' );
7978
- }
7979
- else {
7980
- if ( poll_id != null && poll_id != '' ) {
7981
- if ( tr_id != '' ) {
7982
- tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll id="' + poll_id + '" tr_id="' + tr_id + '"]' );
7983
- }
7984
- else {
7985
- tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll id="' + poll_id + '"]' );
7986
- }
7987
- }
7988
- else {
7989
- tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll]' );
7990
- }
7991
- tinyMCEPopup.close();
7992
- }
7993
- }
7994
- </script>
7995
- </head>
7996
- <body>
7997
- <p>
7998
- <label for="yop-poll-id-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
7999
- <select class="widefat" name="yop_poll_id" id="yop-poll-id-dialog">
8000
- <option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
8001
- <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
8002
- <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
8003
- <?php
8004
- if ( count( $yop_polls ) > 0 ){
8005
- foreach ( $yop_polls as $yop_poll ) {
8006
- ?>
8007
- <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
8008
- <?php
8009
- }
8010
- }
8011
- ?>
8012
- </select>
8013
- </label>
8014
- <br/>
8015
- <label for="yop-poll-tr-id-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span><br>
8016
- <input class="widefat" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog"/>
8017
- </label>
8018
-
8019
-
8020
- <center> <input type="button" class="button-primary"
8021
- value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
8022
- onclick=" insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value );"/></center>
8023
- <br/>
8024
- <center> <input type="button" class="button-primary"
8025
- value="<?php _e( 'Close', 'yop_poll' ); ?>"
8026
- onclick="tinyMCEPopup.close();"/></center>
8027
- </p>
8028
- </body>
8029
- </html>
8030
- <?php
8031
- }
8032
- die ();
8033
- }
8034
-
8035
- public function ajax_preview_template() {
8036
- if ( true /*check_ajax_referer( 'yop-poll-edit-add-new' )*/ ){
8037
- if ( is_admin() ){
8038
- $template_id = trim( $_POST['template_id'] );
8039
- $loc = trim( $_POST['loc'] );
8040
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8041
- $yop_poll_model = new Yop_Poll_Model();
8042
- $template = $yop_poll_model->return_template_preview_html( $template_id, $loc );
8043
- print $template;
8044
- unset( $yop_poll_model );
8045
- }
8046
- }
8047
- die();
8048
- }
8049
-
8050
- public function ajax_get_polls_for_html_editor() {
8051
- check_ajax_referer( 'yop-poll-html-editor' );
8052
- if ( is_admin() ){
8053
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8054
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
8055
- ?>
8056
- <p style="text-align: center;">
8057
- <label for="yop-poll-id-html-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
8058
- <select class="widefat" name="yop_poll_id"
8059
- id="yop-poll-id-html-dialog">
8060
- <option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
8061
- <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
8062
- <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
8063
- <?php
8064
- if ( count( $yop_polls ) > 0 ){
8065
- foreach ( $yop_polls as $yop_poll ) {
8066
- ?>
8067
- <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
8068
- <?php
8069
- }
8070
- }
8071
- ?>
8072
- </select>
8073
- </label>
8074
- <br/><br/>
8075
- <label for="yop-poll-tr-id-html-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span>
8076
- <input type="text" name="yop_poll_tr_id" id="yop-poll-tr-id-html-dialog" class="widefat" value=""/>
8077
- </label>
8078
-
8079
- <br/> <br/> <input type="button" class=""
8080
- value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
8081
- onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value );"/>
8082
- <br/> <br/> <input type="button" class=""
8083
- value="<?php _e( 'Close', 'yop_poll' ); ?>" onclick="tb_remove();"/>
8084
- </p>
8085
-
8086
- <?php
8087
- }
8088
- die ();
8089
- }
8090
-
8091
- public function ajax_show_captcha() {
8092
- if ( is_admin() ){
8093
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8094
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8095
- if ( $poll_id ){
8096
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8097
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8098
- $yop_poll_model->set_unique_id( $unique_id );
8099
- $poll_options = $yop_poll_model->poll_options;
8100
- if ( 'yes' == $poll_options ['use_captcha'] ){
8101
- require_once( $this->_config->plugin_inc_dir . '/securimage.php' );
8102
- $img = new Yop_Poll_Securimage ();
8103
- $img->ttf_file = $this->_config->plugin_path . 'captcha/AHGBold.ttf';
8104
- $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8105
- $img->image_height = 60;
8106
- $img->image_width = intval( $img->image_height * M_E );
8107
- $img->text_color = new Yop_Poll_Securimage_Color ( rand( 0, 255 ), rand( 0, 255 ), rand( 0, 255 ) );
8108
- $img->show();
8109
- }
8110
- }
8111
- else
8112
- wp_die( 'Invalid Poll' );
8113
- }
8114
- else
8115
- wp_die( 'captcha error' );
8116
- die ();
8117
- }
8118
-
8119
- public function ajax_play_captcha() {
8120
- if ( is_admin() ){
8121
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8122
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8123
- if ( $poll_id ){
8124
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8125
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8126
- $poll_options = $yop_poll_model->poll_options;
8127
- if ( 'yes' == $poll_options ['use_captcha'] ){
8128
- require_once( $this->_config->plugin_inc_dir . '/securimage.php' );
8129
- $img = new Yop_Poll_Securimage ();
8130
- $img->audio_path = $this->_config->plugin_path . 'captcha/audio/';
8131
- $img->audio_noise_path = $this->_config->plugin_path . 'captcha/audio/noise/';
8132
- $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8133
-
8134
- $img->outputAudioFile();
8135
- }
8136
- }
8137
- else
8138
- wp_die( 'Invalid Poll' );
8139
- }
8140
- else
8141
- wp_die( 'captcha error' );
8142
- die ();
8143
- }
8144
-
8145
- public function ajax_show_optin_box_modal() {
8146
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8147
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8148
- $optin_box_modal_options ['show'] = 'no'; //restore to no
8149
- $optin_box_modal_options ['last_show_date'] = Yop_Poll_Model::get_mysql_curent_date();
8150
- update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8151
- ?>
8152
- <?php
8153
- $this->yop_poll_optin_form1();
8154
- ?>
8155
- <?php
8156
- die ();
8157
- }
8158
-
8159
- public function ajax_modal_option_signup() {
8160
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8161
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8162
- $optin_box_modal_options ['modal_had_submit'] = 'yes';
8163
- update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8164
- die ();
8165
- }
8166
-
8167
- public function ajax_sidebar_option_signup() {
8168
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8169
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8170
- $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
8171
- update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8172
- die ();
8173
- }
8174
-
8175
- public function ajax_is_wordpress_user() {
8176
- global $current_user;
8177
- if ( $current_user->ID > 0 )
8178
- print '[response]true[/response]';
8179
- else
8180
- print '[response]false[/response]';
8181
- die();
8182
- }
8183
-
8184
- public static function base64_decode( $str ) {
8185
- $str = str_replace( '-', '/', $str );
8186
- $str = str_replace( '_', '+', $str );
8187
- return base64_decode( $str );
8188
- }
8189
-
8190
- public function ajax_set_wordpress_vote() {
8191
-
8192
- $poll_id = self::base64_decode( $_GET['poll_id'] );
8193
- $unique_id = self::base64_decode( $_GET['unique_id'] );
8194
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8195
- $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8196
-
8197
- $answers = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'default', 'other' ) );
8198
- $yop_poll_answers = array();
8199
- if ( count( $answers ) > 0 ){
8200
- foreach ( $answers as $answer ) {
8201
- $yop_poll_answers[] = array( 'id' => $answer['id'], 'value' => html_entity_decode( (string)$answer['answer'], ENT_QUOTES, 'UTF-8' ), 'type' => $answer['type'] );
8202
- }
8203
- }
8204
-
8205
- $public_config = array( 'poll_options' => array( 'share_after_vote' => $yop_poll_model->poll_options['share_after_vote'], 'share_name' => html_entity_decode( (string)$yop_poll_model->poll_options['share_name'], ENT_QUOTES, 'UTF-8' ), 'share_caption' => html_entity_decode( (string)$yop_poll_model->poll_options['share_caption'], ENT_QUOTES, 'UTF-8' ), 'share_description' => html_entity_decode( (string)$yop_poll_model->poll_options['share_description'], ENT_QUOTES, 'UTF-8' ), 'share_picture' => html_entity_decode( (string)$yop_poll_model->poll_options['share_picture'], ENT_QUOTES, 'UTF-8' ), 'share_question' => html_entity_decode( (string)$yop_poll_model->poll['question'], ENT_QUOTES, 'UTF-8' ), 'share_poll_name' => html_entity_decode( (string)$yop_poll_model->poll['name'], ENT_QUOTES, 'UTF-8' ), 'share_link' => $yop_poll_model->poll_options['poll_page_url'] == '' ? site_url() : $yop_poll_model->poll_options['poll_page_url'], 'answers' => $yop_poll_answers, 'redirect_after_vote' => html_entity_decode( (string)$yop_poll_model->poll['redirect_after_vote'], ENT_QUOTES, 'UTF-8' ), 'redirect_after_vote_url' => html_entity_decode( (string)$yop_poll_model->poll['redirect_after_vote_url'], ENT_QUOTES, 'UTF-8' ),
8206
-
8207
- ) );
8208
-
8209
- ?>
8210
- <!DOCTYPE html>
8211
- <html>
8212
- <head>
8213
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8214
- <script type="text/javascript">
8215
-
8216
- function close_window() {
8217
- var yop_poll_various_config = new Object();
8218
- yop_poll_various_config.poll_id = '<?php echo self::base64_decode( $_GET['poll_id'] ) ?>';
8219
- yop_poll_various_config.unique_id = '<?php echo self::base64_decode( $_GET['unique_id'] ) ?>';
8220
- yop_poll_various_config.poll_location = '<?php echo self::base64_decode( $_GET['poll_location'] ) ?>';
8221
- yop_poll_various_config.is_modal = <?php echo self::base64_decode( $_GET['is_modal'] ) == 'true' ? 'true' : 'false'; ?>;
8222
- yop_poll_various_config.vote_loading_image_target = '<?php echo self::base64_decode( $_GET['vote_loading_image_target'] ) ?>';
8223
- yop_poll_various_config.vote_loading_image_id = '<?php echo self::base64_decode( $_GET['vote_loading_image_id'] ) ?>';
8224
- yop_poll_various_config.vote_type = '<?php echo self::base64_decode( $_GET['vote_type'] ) ?>';
8225
- yop_poll_various_config.facebook_user_details = '<?php echo isset( $_GET['facebook_user_details'] ) ? $_GET['facebook_user_details'] : '' ?>';
8226
- yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? $_GET['facebook_error'] : '' ?>';
8227
- yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
8228
- window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id + yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
8229
- result = window.opener.yop_poll_do_vote( yop_poll_various_config );
8230
- if ( result ) {
8231
- window.close();
8232
- }
8233
- }
8234
- </script>
8235
- </head>
8236
- <body onload="close_window()">
8237
- <div style="margin:auto; width: 100px; height: 100px; text-align: center;"><img src="<?php echo $this->_config->plugin_url ?>/images/loading100x100.gif" alt="<?php _e( 'Loading', 'yop_poll' ) ?>"/><br>
8238
- </div>
8239
- </body>
8240
- </html>
8241
- <?php
8242
- die();
8243
- }
8244
-
8245
- public function ajax_do_change_votes_number_answer() {
8246
- global $current_user;
8247
- $answer_id = intval( $_POST['yop_poll_answer_id'] );
8248
- $votes_number = intval( $_POST['yop_poll_answer_votes'] );
8249
- $change_to_all = $_POST['yop_poll_change_to_all_poll_answers'];
8250
- $according_to_logs = $_POST['yop_poll_update_answers_with_logs'];
8251
- $response = NULL;
8252
-
8253
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8254
- $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8255
-
8256
- $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8257
- $poll_details = $yop_poll_model->get_current_poll();
8258
-
8259
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8260
- $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8261
- }
8262
- else {
8263
- if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-votes-number-answer-' . $answer_id], 'yop_poll-change-votes-number-answer-action-' . $answer_id ) ){
8264
- $response = __( 'Bad Request!', 'yop_poll' );
8265
- }
8266
- else {
8267
- if ( 'yes' == $according_to_logs ){
8268
- if ( 'yes' == $change_to_all ){
8269
- $poll_answers = YOP_POLL_MODEL::get_poll_answers( $answer_details['poll_id'], array( 'default', 'other' ) );
8270
- if ( count( $poll_answers ) > 0 )
8271
- foreach ( $poll_answers as $answer ) {
8272
- Yop_Poll_Model::update_answer_field( $answer['id'], array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer['id'] ), 'type' => '%d' ) );
8273
- }
8274
- }
8275
- else
8276
- Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer_id ), 'type' => '%d' ) );
8277
- $response = __( 'Success', 'yop_poll' );
8278
- }
8279
- else {
8280
- if ( intval( $votes_number ) < 0 )
8281
- $response = __( 'Invalid Number Of Votes', 'yop_poll' ) . '!';
8282
- else {
8283
- if ( 'yes' == $change_to_all )
8284
- Yop_Poll_Model::update_all_poll_answers_field( $answer_details['poll_id'], array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8285
- else
8286
- Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8287
- $response = __( 'Success', 'yop_poll' );
8288
- }
8289
- }
8290
- }
8291
- }
8292
- print '[response]' . $response . '[/response]';
8293
- die();
8294
- }
8295
-
8296
- public function ajax_do_change_total_number_poll() {
8297
- global $current_user;
8298
- $poll_id = intval( $_POST['yop_poll_id'] );
8299
- $total_votes = intval( $_POST['yop_poll_total_votes'] );
8300
- $total_answers = intval( $_POST['yop_poll_total_answers'] );
8301
- $type = $_POST['yop_poll_type'];
8302
- $change_to_all = $_POST['yop_poll_change_to_all'];
8303
- $according_to_logs = $_POST['yop_poll_update_poll_with_logs'];
8304
- $according_to_answers = $_POST['yop_poll_update_poll_with_answers'];
8305
- $response = NULL;
8306
-
8307
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8308
- $poll_details = $yop_poll_model->get_current_poll();
8309
-
8310
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8311
- $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8312
- }
8313
- else {
8314
- if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-total-number-poll-' . $poll_id], 'yop_poll-change-total-number-poll-action-' . $poll_id ) ){
8315
- $response = __( 'Bad Request!', 'yop_poll' );
8316
- }
8317
- else {
8318
- if ( 'yes' == $according_to_logs ){
8319
- if ( 'votes' == $type ){
8320
- if ( 'yes' == $change_to_all ){
8321
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8322
- if ( count( $all_polls ) > 0 ){
8323
- foreach ( $all_polls as $poll )
8324
- Yop_Poll_Model::update_poll_field( $poll['id'], array( 'name' => 'total_votes', 'value' => YOP_POLL_MODEL::get_poll_total_votes_from_logs( $poll['id'] ), 'type' => '%d' ) );
8325
- }
8326
- }
8327
- else {
8328
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_votes', 'value' => YOP_POLL_MODEL::get_poll_total_votes_from_logs( $poll_id ), 'type' => '%d' ) );
8329
- }
8330
- }
8331
- if ( 'answers' == $type ){
8332
- if ( 'yes' == $change_to_all ){
8333
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8334
- if ( count( $all_polls ) > 0 ){
8335
- foreach ( $all_polls as $poll )
8336
- Yop_Poll_Model::update_poll_field( $poll['id'], array( 'name' => 'total_answers', 'value' => YOP_POLL_MODEL::get_poll_total_answers_from_logs( $poll['id'] ), 'type' => '%d' ) );
8337
- }
8338
- }
8339
- else {
8340
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_answers', 'value' => YOP_POLL_MODEL::get_poll_total_answers_from_logs( $poll_id ), 'type' => '%d' ) );
8341
- }
8342
- }
8343
- $response = __( 'Success', 'yop_poll' );
8344
- }
8345
- elseif ( 'yes' == $according_to_answers ) {
8346
- if ( 'votes' == $type ){
8347
- if ( 'yes' == $change_to_all ){
8348
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8349
- if ( count( $all_polls ) > 0 ){
8350
- foreach ( $all_polls as $poll )
8351
- Yop_Poll_Model::update_poll_field( $poll['id'], array( 'name' => 'total_votes', 'value' => YOP_POLL_MODEL::get_poll_total_votes_from_answers( $poll['id'] ), 'type' => '%d' ) );
8352
- }
8353
- }
8354
- else {
8355
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_votes', 'value' => YOP_POLL_MODEL::get_poll_total_votes_from_answers( $poll_id ), 'type' => '%d' ) );
8356
- }
8357
- }
8358
- $response = __( 'Success', 'yop_poll' );
8359
- }
8360
- else {
8361
- if ( intval( $total_votes ) < 0 && $type == 'votes' )
8362
- $response = __( 'Invalid Number Of Total Votes', 'yop_poll' ) . '!';
8363
- if ( intval( $total_answers ) < 0 && $type == 'answers' )
8364
- $response = __( 'Invalid Number Of Total Answers', 'yop_poll' ) . '!';
8365
- else {
8366
- if ( 'votes' == $type ){
8367
- if ( 'yes' == $change_to_all )
8368
- Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8369
- else
8370
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8371
- }
8372
- if ( 'answers' == $type ){
8373
- if ( 'yes' == $change_to_all )
8374
- Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8375
- else
8376
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8377
- }
8378
- $response = __( 'Success', 'yop_poll' );
8379
- }
8380
- }
8381
- }
8382
- }
8383
- print '[response]' . $response . '[/response]';
8384
- die();
8385
- }
8386
-
8387
- public function ajax_do_change_poll_author() {
8388
- global $current_user;
8389
- $poll_id = intval( $_POST['yop_poll_id'] );
8390
- $poll_author = intval( $_POST['yop_poll_author'] );
8391
- $response = NULL;
8392
-
8393
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8394
- $poll_details = $yop_poll_model->get_current_poll();
8395
-
8396
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8397
- $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8398
- }
8399
- else {
8400
- if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-poll-author-' . $poll_id], 'yop_poll-change-poll-author-action-' . $poll_id ) ){
8401
- $response = __( 'Bad Request!', 'yop_poll' );
8402
- }
8403
- else {
8404
- if ( intval( $poll_author ) <= 0 )
8405
- $response = __( 'Invalid Poll Author', 'yop_poll' ) . '!';
8406
- else {
8407
- Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'poll_author', 'value' => $poll_author, 'type' => '%d' ) );
8408
- $response = __( 'Success', 'yop_poll' );
8409
- }
8410
- }
8411
- }
8412
- print '[response]' . $response . '[/response]';
8413
- die();
8414
- }
8415
-
8416
- public function ajax_do_change_template_author() {
8417
- global $current_user;
8418
- $template_id = intval( $_POST['yop_poll_template_id'] );
8419
- $template_author = intval( $_POST['yop_poll_template_author'] );
8420
- $response = NULL;
8421
-
8422
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $template_id );
8423
-
8424
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details ['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) ){
8425
- $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8426
- }
8427
- else {
8428
- if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-poll-template-author-' . $template_id], 'yop_poll-change-poll-template-author-action-' . $template_id ) ){
8429
- $response = __( 'Bad Request!', 'yop_poll' );
8430
- }
8431
- else {
8432
- if ( intval( $template_author ) <= 0 )
8433
- $response = __( 'Invalid Template Author', 'yop_poll' ) . '!';
8434
- else {
8435
- Yop_Poll_Model::update_template_field( $template_id, array( 'name' => 'template_author', 'value' => $template_author, 'type' => '%d' ) );
8436
- $response = __( 'Success', 'yop_poll' );
8437
- }
8438
- }
8439
- }
8440
- print '[response]' . $response . '[/response]';
8441
- die();
8442
- }
8443
-
8444
- public function ajax_show_change_votes_number_answer() {
8445
- global $current_user;
8446
- $answer_id = intval( $_GET['answer_id'] );
8447
-
8448
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8449
- $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8450
- $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8451
- $poll_details = $yop_poll_model->get_current_poll();
8452
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8453
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8454
- ?>
8455
- <div id="yop-poll-change-votes">
8456
- <form id="yop-poll-change-answer-no-votes-form">
8457
- <table class="links-table" cellspacing="0">
8458
- <tbody>
8459
- <tr><td colspan="2" align="center"><b><?php echo $answer_details['answer']; ?></b></td></tr>
8460
- <tr><td colspan="2" align="center" id="yop-poll-change-no-votes-error" class="error-message"></td></tr>
8461
- <tr id="yop-poll-manual-change-no-votes">
8462
- <td>
8463
- <label class="yop_poll_answer_no_votes_label" for="yop-poll-answer-no-votes"><?php _e( 'New Number Of Votes', 'yop_poll' ); ?>
8464
- :</label></td>
8465
- <td>
8466
- <input id="yop-poll-answer-no-votes" type="text" value="<?php echo $answer_details['votes']; ?>" name="yop_poll_answer_votes"/>
8467
- </td>
8468
- </tr>
8469
- <tr>
8470
- <td colspan="2">
8471
- <input type="checkbox" name="yop_poll_update_answers_with_logs" value="yes" id="yop-poll-update-answers-with-logs" onclick="if ( jQuery(this).prop('checked') ) jQuery( '#yop-poll-manual-change-no-votes').hide(); else jQuery( '#yop-poll-manual-change-no-votes').show();"/>
8472
- <label for="yop-poll-update-answers-with-logs"><?php _e( 'Update According To Logs', 'yop_poll' ); ?></label>
8473
- </td>
8474
- </tr>
8475
- <tr>
8476
- <td colspan="2">
8477
- <input type="checkbox" name="yop_poll_change_to_all_poll_answers" value="yes" id="yop-poll-change-to-all-poll-answers" onclick="if ( jQuery(this).prop('checked') )return confirm('<?php _e( 'Are You Sure You Want To Change To All Poll Answers?', 'yop_poll' ); ?>');"/>
8478
- <label for="yop-poll-change-to-all-poll-answers"><?php _e( 'Change To All Poll Answers', 'yop_poll' ); ?></label>
8479
- </td>
8480
- </tr>
8481
- <tr>
8482
- <td colspan="2" align="center">
8483
- <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_votes_number_answer( '<?php echo $answer_details['id']; ?>' )"/>
8484
- <input type="hidden" name="yop_poll_answer_id" value="<?php echo $answer_details['id']; ?>"/>
8485
- </td>
8486
- </tr>
8487
- </tbody>
8488
- </table>
8489
- <?php wp_nonce_field( 'yop_poll-change-votes-number-answer-action-' . $answer_id, 'yop-poll-nonce-change-votes-number-answer-' . $answer_id, false ); ?>
8490
- </form>
8491
- </div>
8492
- <?php
8493
- die();
8494
- }
8495
-
8496
- public function ajax_show_change_total_number_poll() {
8497
- global $current_user;
8498
- $poll_id = intval( $_GET['poll_id'] );
8499
- $type = $_GET['type'];
8500
-
8501
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8502
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8503
- $poll_details = $yop_poll_model->get_current_poll();
8504
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8505
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8506
- ?>
8507
- <div id="yop-poll-change-total">
8508
- <form id="yop-poll-change-poll-total-no-form">
8509
- <table class="links-table" cellspacing="0">
8510
- <tbody>
8511
- <tr><td colspan="2" align="center"><b><?php echo $poll_details['name']; ?></b></td></tr>
8512
- <tr><td colspan="2" align="center" id="yop-poll-change-total-no-error" class="error-message"></td></tr>
8513
- <?php if ( 'votes' == $type ){ ?>
8514
- <tr id="yop-poll-manual-change-no-votes">
8515
- <td>
8516
- <label class="yop_poll_total_votes_label" for="yop-poll-total-votes"><?php _e( 'New Number Of Poll Total Votes', 'yop_poll' ); ?>
8517
- :</label></td>
8518
- <td>
8519
- <input id="yop-poll-total-votes" type="text" value="<?php echo $poll_details['total_votes']; ?>" name="yop_poll_total_votes"/>
8520
- </td>
8521
- </tr>
8522
- <?php } ?>
8523
- <?php if ( 'answers' == $type ){ ?>
8524
- <tr id="yop-poll-manual-change-no-votes">
8525
- <td>
8526
- <label class="yop_poll_total_answers_label" for="yop-poll-total-answers"><?php _e( 'New Number Of Poll Total Answers', 'yop_poll' ); ?>
8527
- :</label></td>
8528
- <td>
8529
- <input id="yop-poll-total-answers" type="text" value="<?php echo $poll_details['total_answers']; ?>" name="yop_poll_total_answers"/>
8530
- </td>
8531
- </tr>
8532
- <?php } ?>
8533
- <tr>
8534
- <td colspan="2">
8535
- <input type="checkbox" name="yop_poll_update_poll_with_logs" value="yes" id="yop-poll-update-poll-with-logs" onclick="if ( jQuery(this).prop('checked') ) { jQuery( '#yop-poll-manual-change-no-votes').hide(); jQuery('#yop-poll-update-poll-with-answers').attr('checked', false)} else { if ( ! jQuery('#yop-poll-update-poll-with-answers').prop('checked') ) jQuery( '#yop-poll-manual-change-no-votes').show();} "/>
8536
- <label for="yop-poll-update-poll-with-logs"><?php _e( 'Update According To Logs', 'yop_poll' ); ?></label>
8537
- </td>
8538
- </tr>
8539
- <?php if ( 'votes' == $type ){ ?>
8540
- <tr>
8541
- <td colspan="2">
8542
- <input type="checkbox" name="yop_poll_update_poll_with_answers" value="yes" id="yop-poll-update-poll-with-answers" onclick="if ( jQuery(this).prop('checked') ) {jQuery( '#yop-poll-manual-change-no-votes').hide(); jQuery('#yop-poll-update-poll-with-logs').attr('checked', false ); } else { if ( ! jQuery('#yop-poll-update-poll-with-logs').prop('checked') ) jQuery( '#yop-poll-manual-change-no-votes').show(); }"/>
8543
- <label for="yop-poll-update-poll-with-answers"><?php _e( 'Update According To Answers', 'yop_poll' ); ?></label>
8544
- </td>
8545
- </tr>
8546
- <?php } ?>
8547
- <tr>
8548
- <td colspan="2">
8549
- <input type="checkbox" name="yop_poll_change_to_all" value="yes" id="yop-poll-change-to-all" onclick="if ( jQuery(this).prop('checked') )return confirm('<?php _e( 'Are You Sure You Want To Change To All Polls?', 'yop_poll' ); ?>');"/>
8550
- <label for="yop-poll-change-to-all"><?php _e( 'Change To All Polls', 'yop_poll' ); ?></label>
8551
- </td>
8552
- </tr>
8553
- <tr>
8554
- <td colspan="2" align="center">
8555
- <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_total_number_poll( '<?php echo $poll_details['id']; ?>', '<?php echo $type; ?>')"/>
8556
- <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>"/>
8557
- <input type="hidden" name="yop_poll_type" value="<?php echo $type; ?>"/>
8558
- </td>
8559
- </tr>
8560
- </tbody>
8561
- </table>
8562
- <?php wp_nonce_field( 'yop_poll-change-total-number-poll-action-' . $poll_id, 'yop-poll-nonce-change-total-number-poll-' . $poll_id, false ); ?>
8563
- </form>
8564
- </div>
8565
- <?php
8566
- die();
8567
- }
8568
-
8569
- public function ajax_show_change_poll_author() {
8570
- global $current_user;
8571
- $poll_id = intval( $_GET['poll_id'] );
8572
-
8573
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8574
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8575
- $poll_details = $yop_poll_model->get_current_poll();
8576
- $poll_author = get_user_by( 'id', $poll_details ['poll_author'] );
8577
- if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_author->ID != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8578
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8579
- ?>
8580
- <div id="yop-poll-change-poll-author">
8581
- <form id="yop-poll-change-poll-author-form">
8582
- <table class="links-table" cellspacing="0">
8583
- <tbody>
8584
- <tr><td colspan="2" align="center"><b><?php echo $poll_details['name']; ?></b></td></tr>
8585
- <tr><td colspan="2" align="center" id="yop-poll-change-poll-author-error" class="error-message"></td></tr>
8586
- <tr id="yop-poll-manual-change-no-votes">
8587
- <td>
8588
- <label class="yop_poll_total_votes_label" for="yop-poll-author"><?php _e( 'New Poll Author', 'yop_poll' ); ?>
8589
- :</label></td>
8590
- <td>
8591
- <?php
8592
- $blogusers = get_users( 'blog_id=' . $GLOBALS['blog_id'] . '&orderby=nicename&order=ASC' );
8593
- ?>
8594
- <select id="yop-poll-author-select" name="yop_poll_author">
8595
- <?php
8596
- foreach ( $blogusers as $user ) {
8597
- echo '<option ' . selected( $poll_author->ID, $user->ID, false ) . ' value="' . $user->ID . '">' . $user->user_nicename . '</option>';
8598
- }
8599
- ?>
8600
- </select>
8601
- </td>
8602
- </tr>
8603
- <tr>
8604
- <td colspan="2" align="center">
8605
- <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_poll_author( '<?php echo $poll_details['id']; ?>')"/>
8606
- <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>"/>
8607
- </td>
8608
- </tr>
8609
- </tbody>
8610
- </table>
8611
- <?php wp_nonce_field( 'yop_poll-change-poll-author-action-' . $poll_id, 'yop-poll-nonce-change-poll-author-' . $poll_id, false ); ?>
8612
- </form>
8613
- </div>
8614
- <?php
8615
- die();
8616
- }
8617
-
8618
- public function ajax_show_change_template_author() {
8619
- global $current_user;
8620
- $template_id = intval( $_GET['template_id'] );
8621
-
8622
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8623
- $template_details = YOP_POLL_MODEL::get_poll_template_from_database_by_id( $template_id );
8624
- $template_author = get_user_by( 'id', $template_details ['template_author'] );
8625
- if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_author->ID != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
8626
- wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8627
- ?>
8628
- <div id="yop-poll-change-template-author">
8629
- <form id="yop-poll-change-template-author-form">
8630
- <table class="links-table" cellspacing="0">
8631
- <tbody>
8632
- <tr><td colspan="2" align="center"><b><?php echo $template_details['name']; ?></b></td></tr>
8633
- <tr><td colspan="2" align="center" id="yop-poll-change-template-author-error" class="error-message"></td></tr>
8634
- <tr>
8635
- <td>
8636
- <label for="yop-template-author"><?php _e( 'New Template Author', 'yop_poll' ); ?>
8637
- :</label></td>
8638
- <td>
8639
- <?php
8640
- $blogusers = get_users( 'blog_id=' . $GLOBALS['blog_id'] . '&orderby=nicename&order=ASC' );
8641
- ?>
8642
- <select id="yop-poll-template-author-select" name="yop_poll_template_author">
8643
- <?php
8644
- foreach ( $blogusers as $user ) {
8645
- echo '<option ' . selected( $template_author->ID, $user->ID, false ) . ' value="' . $user->ID . '">' . $user->user_nicename . '</option>';
8646
- }
8647
- ?>
8648
- </select>
8649
- </td>
8650
- </tr>
8651
- <tr>
8652
- <td colspan="2" align="center">
8653
- <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_template_author( '<?php echo $template_details['id']; ?>')"/>
8654
- <input type="hidden" name="yop_poll_template_id" value="<?php echo $template_details['id']; ?>"/>
8655
- </td>
8656
- </tr>
8657
- </tbody>
8658
- </table>
8659
- <?php wp_nonce_field( 'yop_poll-change-poll-template-author-action-' . $template_id, 'yop-poll-nonce-change-poll-template-author-' . $template_id, false ); ?>
8660
- </form>
8661
- </div>
8662
- <?php
8663
- die();
8664
- }
8665
- /**
8666
- * End Ajax section
8667
- */
8668
-
8669
- /* start tinymce */
8670
- function load_editor_functions( $hook ) {
8671
- global $post;
8672
-
8673
- if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ){
8674
- $yop_poll_editor_config = array( 'dialog_url' => wp_nonce_url( admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_editor', 'yop-poll-editor' ), 'dialog_html_url' => wp_nonce_url( admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_html_editor', 'yop-poll-html-editor' ), 'name' => __( 'Yop Poll', 'yop_poll' ), 'title' => __( 'Insert Poll', 'yop_poll' ), 'prompt_insert_poll_id' => __( 'Please insert the poll ID:\n\n', 'yop_poll' ), 'prompt_insert_again_poll_id' => __( 'Error: Poll Id must be numeric!\n\nPlease insert the poll ID Again:\n\n', 'yop_poll' ) );
8675
- wp_enqueue_style( 'thickbox' );
8676
- wp_enqueue_script( 'thickbox' );
8677
- wp_enqueue_script( 'yop-poll-editor-functions', "{$this->_config->plugin_url}/tinymce/yop-poll-editor-functions.js", 'jquery', $this->_config->version, true );
8678
- wp_localize_script( 'yop-poll-editor-functions', 'yop_poll_editor_config', $yop_poll_editor_config );
8679
- }
8680
- }
8681
-
8682
- function register_button( $buttons ) {
8683
- array_push( $buttons, "separator", "yoppoll" );
8684
- return $buttons;
8685
- }
8686
-
8687
- function add_plugin( $plugin_array ) {
8688
- $plugin_array ['yoppoll'] = "{$this->_config->plugin_url}/tinymce/yop-poll-editor.js";
8689
- return $plugin_array;
8690
- }
8691
-
8692
- function my_yop_poll_button( $hook ) {
8693
- if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ){
8694
- if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ){
8695
- return;
8696
- }
8697
 
8698
- if ( get_user_option( 'rich_editing' ) == 'true' ){
8699
- add_filter( 'mce_external_plugins', array( &$this, 'add_plugin' ) );
8700
- add_filter( 'mce_buttons', array( &$this, 'register_button' ) );
8701
- }
8702
- }
8703
- }
8704
- /**
8705
- * end tinymce
8706
- */
8707
 
8708
- /*START donate*/
8709
- private function yop_poll_donate() {
8710
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8711
- wp_enqueue_style("yop-poll-donate-css", "{$this->_config->plugin_url}/css/yop-poll-donate.css");
8712
- ?>
8713
- <div class="postbox-container side" id="postbox-container-1">
8714
- <div class="meta-box-sortables ui-sortable" id="side-sortables">
8715
- <div class="postbox " id="donate">
8716
- <div title="Click to toggle" class="handlediv"><br/></div>
8717
- <div id="toggle">
8718
- <div id="toggle_title"><?php _e( 'Support This Plugin', 'yop_poll' ); ?></div>
8719
- </div>
8720
- <div class="inside">
8721
- <p><b><?php _e( 'Have you found this plugin useful? Please help support it\'s continued development with a donation', 'yop_poll' ); ?>
8722
- !</b></p>
8723
- <a href="http://www.yop-poll.com/thankyou/don.php" target="_blank">
8724
- <div id="donateButton"><span><?php _e( 'Donate', 'yop_poll' ); ?></span></div>
8725
- </a>
8726
- <br/>
8727
- <b><?php _e( 'Short on funds?', 'yop_poll' ); ?></b><br/>
8728
- <a target="_blank"
8729
- href="http://wordpress.org/support/view/plugin-reviews/yop-poll?filter=5"><b><?php _e( 'Rate YOP POLL 5&#9733;\'s on WordPress.org', 'yop_poll' ); ?></b></a>
8730
- </div>
8731
- </div>
8732
 
8733
- <?php
8734
- include_once( ABSPATH . WPINC . '/feed.php' );
8735
- $feed = fetch_feed( 'http://yop-poll.com/feed/' );
8736
- if ( !is_wp_error( $feed ) )
8737
- $feeditems = $feed->get_items( 0, $feed->get_item_quantity( 5 ) );
8738
- ?>
8739
- <?php
8740
- if ( $feeditems ){
8741
- ?>
8742
- <div class="postbox " id="linksubmitdiv2">
8743
- <div title="Click to toggle" class="handlediv">
8744
- <br/>
8745
- </div>
8746
- <h3 class="hndle">
8747
- <span><?php _e( 'The Latest About Yop Poll', 'yop_poll' ); ?></span>
8748
- </h3>
8749
- <div class="inside">
8750
- <ul id="news_ul">
8751
- <?php
8752
- foreach ( $feeditems as $item ) {
8753
- $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls = NULL, 'display' ) );
8754
- ?>
8755
- <li><a href="<?php echo $url ?>" target="_blank"><b><?php echo esc_html( $item->get_title() ); ?></b></a></li>
8756
- <?php
8757
- }
8758
- ?>
8759
- </ul>
8760
- </div>
8761
- </div>
8762
- <?php
8763
- }
8764
- ?>
8765
- <?php
8766
- if ( $optin_box_modal_options ['show'] == 'no' ){
8767
- if ( $optin_box_modal_options ['sidebar_had_submit'] == 'no' ){
8768
- if ( $optin_box_modal_options ['modal_had_submit'] == 'no' ){
8769
- ?>
8770
- <?php $this->yop_poll_optin_form2(); ?>
8771
- <?php
8772
- }
8773
- }
8774
- }
8775
- ?>
8776
- </div>
8777
- </div>
8778
- <?php
8779
- }
8780
 
8781
- private function yop_poll_optin_form() {
8782
- ?>
8783
- <style type="text/css">
8784
- #WFItem394041 html {
8785
- color: #000 !important;
8786
- background: #FFF !important;
8787
- }
8788
 
8789
- #WFItem394041 body, #WFItem394041 div, #WFItem394041 dl, #WFItem394041 dt, #WFItem394041 dd, #WFItem394041 ul, #WFItem394041 ol, #WFItem394041 li, #WFItem394041 h1, #WFItem394041 h2, #WFItem394041 h3, #WFItem394041 h4, #WFItem394041 h5, #WFItem394041 h6, #WFItem394041 pre, #WFItem394041 code, #WFItem394041 form, #WFItem394041 fieldset, #WFItem394041 legend, #WFItem394041 input, #WFItem394041 textarea, #WFItem394041 p, #WFItem394041 blockquote, #WFItem394041 th, #WFItem394041 td {
8790
- margin-left: 0 !important;
8791
- margin-right: 0 !important;
8792
- margin-top: 0 !important;
8793
- margin-bottom: 0 !important;
8794
- padding-left: 0 !important;
8795
- padding-bottom: 0 !important;
8796
- padding-right: 0 !important;
8797
- padding-top: 0 !important;
8798
- width: auto !important;
8799
- background-image: none !important;
8800
- }
8801
-
8802
- #WFItem394041 div, #WFItem394041 dl, #WFItem394041 dt, #WFItem394041 dd, #WFItem394041 ul, #WFItem394041 ol, #WFItem394041 li, #WFItem394041 h1, #WFItem394041 h2 {
8803
- border: none !important;
8804
- background: none !important;
8805
- float: none !important;
8806
- width: auto !important;
8807
- -moz-box-shadow: 0 !important;
8808
- -webkit-box-shadow: 0 !important;
8809
- box-shadow: 0 !important;
8810
- text-indent: inherit !important;
8811
- }
8812
-
8813
- #WFItem394041 table {
8814
- border-collapse: collapse !important;
8815
- border-spacing: 0 !important;
8816
- }
8817
-
8818
- #WFItem394041 fieldset, #WFItem394041 img {
8819
- border: 0 !important;
8820
- }
8821
-
8822
- #WFItem394041 address, #WFItem394041 caption, #WFItem394041 cite, #WFItem394041 code, #WFItem394041 dfn, #WFItem394041 em, #WFItem394041 th, #WFItem394041 var {
8823
- font-style: normal !important;
8824
- font-weight: normal !important;
8825
- }
8826
-
8827
- #WFItem394041 strong {
8828
- font-style: normal !important;
8829
- font-weight: bold !important;
8830
- }
8831
-
8832
- #WFItem394041 em {
8833
- font-style: italic !important;
8834
- font-weight: normal !important;
8835
- position: static !important;
8836
- }
8837
-
8838
- #WFItem394041 li {
8839
- list-style: none !important;
8840
- }
8841
-
8842
- caption, #WFItem394041 th {
8843
- text-align: left !important;
8844
- }
8845
-
8846
- #WFItem394041 h1, #WFItem394041 h2, #WFItem394041 h3, #WFItem394041 h4, #WFItem394041 h5, #WFItem394041 h6 {
8847
- font-size: 100% !important;
8848
- font-weight: normal !important;
8849
- }
8850
-
8851
- #WFItem394041 q:before, #WFItem394041 q:after {
8852
- content: " " !important;
8853
- }
8854
-
8855
- #WFItem394041 abbr, #WFItem394041 acronym {
8856
- border: 0 !important;
8857
- font-variant: normal !important;
8858
- }
8859
-
8860
- #WFItem394041 sup {
8861
- vertical-align: text-top !important;
8862
- }
8863
-
8864
- #WFItem394041 sub {
8865
- vertical-align: text-bottom !important;
8866
- }
8867
-
8868
- #WFItem394041 input, #WFItem394041 textarea, #WFItem394041 select {
8869
- font-family: inherit !important;
8870
- font-size: inherit !important;
8871
- font-weight: inherit !important;
8872
- height: auto !important;
8873
- line-height: auto !important;
8874
- }
8875
-
8876
- #WFItem394041 input, #WFItem394041 textarea, #WFItem394041 select {
8877
- *font-size: 100% !important;
8878
- }
8879
-
8880
- #WFItem394041 legend {
8881
- color: #000 !important;
8882
- }
8883
-
8884
- #WFItem394041 .clearfix:after {
8885
- visibility: hidden !important;
8886
- display: block !important;
8887
- font-size: 0 !important;
8888
- content: " " !important;
8889
- clear: both !important;
8890
- height: 0 !important;
8891
- }
8892
-
8893
- #WFItem394041 .clearer {
8894
- display: block !important;
8895
- clear: both !important;
8896
- font-size: 0.1px !important;
8897
- height: 0.1px !important;
8898
- line-height: 0.1px !important;
8899
- width: 100% !important;
8900
- }
8901
-
8902
- #WFWrapper .close {
8903
- background: url(https://app.getresponse.com/images/common/highslide/close.png) repeat scroll 0 0 transparent !important;
8904
- cursor: pointer !important;
8905
- height: 30px !important;
8906
- position: absolute !important;
8907
- right: -15px !important;
8908
- top: -15px !important;
8909
- width: 30px !important;
8910
- z-index: 1 !important;
8911
- }
8912
-
8913
- #wfCloseX {
8914
- background: url(https://app.getresponse.com/images/common/highslide/close.png) repeat scroll 0 0 transparent !important;
8915
- cursor: pointer !important;
8916
- height: 30px !important;
8917
- position: absolute !important;
8918
- right: 0 !important;
8919
- top: 0 !important;
8920
- width: 30px !important;
8921
- z-index: 1 !important;
8922
- cursor: pointer !important;
8923
- }
8924
-
8925
- #WFItem394041 .clrB {
8926
- clear: both !important;
8927
- text-align: left !important;
8928
- }
8929
-
8930
- #WFItem394041 * html .clearfix {
8931
- zoom: 1 !important;
8932
- }
8933
-
8934
- #WFItem394041 *:first-child + html .clearfix {
8935
- zoom: 1 !important;
8936
- }
8937
-
8938
- #WFItem394041 .wf-contbox {
8939
- width: 100% !important;
8940
- }
8941
-
8942
- .wf-formTpl li:before {
8943
- content: "" !important;
8944
- }
8945
-
8946
- #WFItem394041 form {
8947
- display: inline-block !important;
8948
- width: 100% !important;
8949
- }
8950
-
8951
- #WFItem394041 label {
8952
- margin: 0 !important;
8953
- }
8954
-
8955
- #WFItem394041 p {
8956
- line-height: 18px !important;
8957
- font-size: 11px !important;
8958
- }
8959
-
8960
- #WFItem394041 input[type="submit"] {
8961
- cursor: pointer !important;
8962
- text-shadow: none !important;
8963
- float: none !important;
8964
- text-transform: none !important;
8965
- letter-spacing: 0 !important;
8966
- white-space: nowrap !important;
8967
- }
8968
-
8969
- #WFItem394041 {
8970
- color: #555555 !important;
8971
- font-family: Arial, Helvetica, sans-serif !important;
8972
- font-size: 12px !important;
8973
- }
8974
-
8975
- #WFItem394041 .wf-body li {
8976
- padding: 10px 15px !important;
8977
- clear: both !important;
8978
- }
8979
-
8980
- #WFItem394041 .actTinyMceElBodyContent ul li {
8981
- padding: 3px !important;
8982
- list-style-type: disc !important;
8983
- }
8984
-
8985
- #WFItem394041 .actTinyMceElBodyContent ol li {
8986
- padding: 3px !important;
8987
- list-style-type: decimal !important;
8988
- }
8989
-
8990
- #WFItem394041 .actTinyMceElBodyContent ul {
8991
- margin-left: 20px !important;
8992
- }
8993
-
8994
- #WFItem394041 .actTinyMceElBodyContent ol {
8995
- margin-left: 25px !important;
8996
- }
8997
-
8998
- #WFItem394041 .actTinyMceElBodyContent ol ul, #WFItem394041 .actTinyMceElBodyContent ul ol, #WFItem394041 .actTinyMceElBodyContent ul ul, #WFItem394041 .actTinyMceElBodyContent ol ol {
8999
- margin-top: 0 !important;
9000
- margin-bottom: 0 !important;
9001
- }
9002
-
9003
- #WFItem394041 .wf-body {
9004
- background-image: none !important;
9005
- background-position: left top !important;
9006
- background-repeat: no-repeat !important;
9007
- border-color: #92757d !important;
9008
- border-width: 0px !important;
9009
- border-style: none !important;
9010
- padding-left: 0 !important;
9011
- padding-right: 0 !important;
9012
- padding-top: 0 !important;
9013
- padding-bottom: 0 !important;
9014
- -webkit-border-top-left-radius: 0px !important;
9015
- -moz-border-radius-topleft: 0px !important;
9016
- border-top-left-radius: 0px !important;
9017
- -webkit-border-top-right-radius: 0px !important;
9018
- -moz-border-radius-topright: 0px !important;
9019
- border-top-right-radius: 0px !important;
9020
- -webkit-border-bottom-left-radius: 0px !important;
9021
- -moz-border-radius-bottomleft: 0px !important;
9022
- border-bottom-left-radius: 0px !important;
9023
- -webkit-border-bottom-right-radius: 0px !important;
9024
- -moz-border-radius-bottomright: 0px !important;
9025
- border-bottom-right-radius: 0px !important;
9026
- }
9027
-
9028
- #WFItem394041 .wf-header {
9029
- color: #2B93D3 !important;
9030
- background-color: #F5F5F5 !important;
9031
- background-image: none !important;
9032
- background-position: left top !important;
9033
- background-repeat: no-repeat !important;
9034
- border-color: #6b6262 !important;
9035
- border-width: 0px !important;
9036
- border-style: none !important;
9037
- padding-left: 10px !important;
9038
- padding-right: 10px !important;
9039
- padding-top: 20px !important;
9040
- padding-bottom: 0px !important;
9041
- display: block !important;
9042
- min-height: 32px !important;
9043
- -webkit-border-top-left-radius: 0px !important;
9044
- -moz-border-radius-topleft: 0px !important;
9045
- border-top-left-radius: 0px !important;
9046
- -webkit-border-top-right-radius: 0px !important;
9047
- -moz-border-radius-topright: 0px !important;
9048
- border-top-right-radius: 0px !important;
9049
- -webkit-border-bottom-left-radius: 0px !important;
9050
- -moz-border-radius-bottomleft: 0px !important;
9051
- border-bottom-left-radius: 0px !important;
9052
- -webkit-border-bottom-right-radius: 0px !important;
9053
- -moz-border-radius-bottomright: 0px !important;
9054
- border-bottom-right-radius: 0px !important;
9055
- }
9056
-
9057
- #WFItem394041 .wf-footer {
9058
-
9059
- }
9060
-
9061
- #WFItem394041 .wf-input {
9062
- padding: 2px 0 !important;
9063
- font-family: Arial !important;
9064
- font-size: 14px !important;
9065
- color: #000000 !important;
9066
- font-weight: normal !important;
9067
- font-style: normal !important;
9068
- text-decoration: none !important;
9069
- background-color: #FFFFFF !important;
9070
- border-width: 1px !important;
9071
- border-color: #D9D9D9 !important;
9072
- border-style: solid !important;
9073
- width: 100% !important;
9074
- -webkit-border-top-left-radius: 8px !important;
9075
- -moz-border-radius-topleft: 8px !important;
9076
- border-top-left-radius: 8px !important;
9077
- -webkit-border-top-right-radius: 8px !important;
9078
- -moz-border-radius-topright: 8px !important;
9079
- border-top-right-radius: 8px !important;
9080
- -webkit-border-bottom-left-radius: 8px !important;
9081
- -moz-border-radius-bottomleft: 8px !important;
9082
- border-bottom-left-radius: 8px !important;
9083
- -webkit-border-bottom-right-radius: 8px !important;
9084
- -moz-border-radius-bottomright: 8px !important;
9085
- border-bottom-right-radius: 8px !important;
9086
- }
9087
-
9088
- #WFItem394041 .wf-label {
9089
- font-family: Arial !important;
9090
- font-size: 12px !important;
9091
- color: #555555 !important;
9092
- font-weight: bold !important;
9093
- font-style: normal !important;
9094
- text-decoration: none !important;
9095
- padding-top: 3px !important;
9096
- padding-bottom: 3px !important;
9097
- padding-left: 0 !important;
9098
- padding-right: 3px !important;
9099
- display: block !important;
9100
- }
9101
-
9102
- #WFItem394041 .wf-input {
9103
- font-family: Arial !important;
9104
- font-size: 14px !important;
9105
- color: #555555 !important;
9106
- font-weight: normal !important;
9107
- font-style: normal !important;
9108
- text-decoration: none !important;
9109
- background-color: #FFFFFF !important;
9110
- border-width: 1px !important;
9111
- border-color: #D9D9D9 !important;
9112
- border-style: solid !important;
9113
- width: 100% !important;
9114
- -webkit-border-top-left-radius: 8px !important;
9115
- -moz-border-radius-topleft: 8px !important;
9116
- border-top-left-radius: 8px !important;
9117
- -webkit-border-top-right-radius: 8px !important;
9118
- -moz-border-radius-topright: 8px !important;
9119
- border-top-right-radius: 8px !important;
9120
- -webkit-border-bottom-left-radius: 8px !important;
9121
- -moz-border-radius-bottomleft: 8px !important;
9122
- border-bottom-left-radius: 8px !important;
9123
- -webkit-border-bottom-right-radius: 8px !important;
9124
- -moz-border-radius-bottomright: 8px !important;
9125
- border-bottom-right-radius: 8px !important;
9126
- }
9127
-
9128
- #WFItem394041 .wf-button {
9129
- font-family: Arial !important;
9130
- font-size: 22px !important;
9131
- color: #FFFFFF !important;
9132
- font-weight: bold !important;
9133
- font-style: normal !important;
9134
- text-decoration: none !important;
9135
- background-color: #0DBAFF !important;
9136
- background-image: url(https://app.getresponse.com/images/core/webforms/gradient_top.png) !important;
9137
- border-width: 0px !important;
9138
- border-color: #000000 !important;
9139
- border-style: none !important;
9140
- padding-left: 16px !important;
9141
- padding-right: 16px !important;
9142
- padding-top: 8px !important;
9143
- padding-bottom: 8px !important;
9144
- -webkit-border-top-left-radius: 8px !important;
9145
- -moz-border-radius-topleft: 8px !important;
9146
- border-top-left-radius: 8px !important;
9147
- -webkit-border-top-right-radius: 8px !important;
9148
- -moz-border-radius-topright: 8px !important;
9149
- border-top-right-radius: 8px !important;
9150
- -webkit-border-bottom-left-radius: 8px !important;
9151
- -moz-border-radius-bottomleft: 8px !important;
9152
- border-bottom-left-radius: 8px !important;
9153
- -webkit-border-bottom-right-radius: 8px !important;
9154
- -moz-border-radius-bottomright: 8px !important;
9155
- border-bottom-right-radius: 8px !important;
9156
- }
9157
-
9158
- #WFItem394041 .wf-button:hover {
9159
- !important;
9160
-
9161
- }
9162
-
9163
- #WFItem394041 .wf-submit {
9164
- text-align: center !important;
9165
- }
9166
-
9167
- #WFItem394041 .wf-labelpos {
9168
- float: none !important;
9169
- width: auto !important;
9170
- text-align: left !important;
9171
- }
9172
-
9173
- #WFItem394041 .wf-inputpos {
9174
- float: none !important;
9175
- width: auto !important;
9176
- }
9177
-
9178
- #WFItem394041 .wf-privacy {
9179
- font-family: Arial !important;
9180
- font-size: 12px !important;
9181
- color: #B8B8B8 !important;
9182
- font-weight: normal !important;
9183
- font-style: italic !important;
9184
- text-decoration: none !important;
9185
- text-align: center !important;
9186
- }
9187
-
9188
- #WFItem394041 .wf-privacyico {
9189
- padding: 4px 0 0 20px !important;
9190
- background: url(https://app.getresponse.com/images/core/webforms/lock.png) no-repeat left center !important;
9191
- }
9192
-
9193
- #WFItem394041 .wf-counter {
9194
- font-family: Arial !important;
9195
- font-size: 12px !important;
9196
- color: #44454f !important;
9197
- font-weight: bold !important;
9198
- font-style: normal !important;
9199
- text-decoration: none !important;
9200
- text-align: center !important;
9201
- }
9202
-
9203
- #WFItem394041 .wf-poweredby {
9204
- font-family: Arial !important;
9205
- font-size: 10px !important;
9206
- color: #B8B8B8 !important;
9207
- font-weight: normal !important;
9208
- font-style: italic !important;
9209
- text-decoration: none !important;
9210
- text-align: center !important;
9211
- }
9212
-
9213
- #WFItem394041 .wf-link {
9214
- font-family: Arial !important;
9215
- font-size: 12px !important;
9216
- color: #ffffff !important;
9217
- font-weight: normal !important;
9218
- font-style: normal !important;
9219
- text-decoration: none !important;
9220
- }
9221
-
9222
- #WFItem394041 .wf-link:hover {
9223
- font-family: Arial !important;
9224
- font-size: 12px !important;
9225
- color: #ffffff !important;
9226
- font-weight: normal !important;
9227
- font-style: normal !important;
9228
- text-decoration: none !important;
9229
- }
9230
-
9231
- #WFItem394041 .wf-text {
9232
- font-family: Arial !important;
9233
- font-size: 12px !important;
9234
- color: #B8B8B8 !important;
9235
- }
9236
-
9237
- #WFItem394041 .wf-divider {
9238
- border-top-width: 1px !important;
9239
- border-color: #ffffff !important;
9240
- border-style: solid !important;
9241
- }
9242
-
9243
- #WFItem394041 .wf-image {
9244
- text-align: center !important;
9245
- }
9246
-
9247
- #WFItem394041 .wf-privacylink {
9248
- color: #B8B8B8 !important;
9249
- font-style: italic !important;
9250
- }
9251
-
9252
- #WFItem394041 .wf-poweredbylink {
9253
- color: #B8B8B8 !important;
9254
- font-style: italic !important;
9255
- }
9256
-
9257
- #WFItem394041 .wf-imgbox {
9258
- overflow: hidden !important;
9259
- }
9260
-
9261
- #WFItem394041 .wf-rc-reload {
9262
- display: inline-block !important;
9263
- width: 16px !important;
9264
- height: 16px !important;
9265
- overflow: hidden !important;
9266
- text-indent: -99999px !important;
9267
- position: relative !important;
9268
- top: 3px !important;
9269
- margin-left: 3px !important;
9270
- background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 -32px !important;
9271
- }
9272
-
9273
- #WFItem394041 .wf-rc-audio {
9274
- display: inline-block !important;
9275
- width: 16px !important;
9276
- height: 16px !important;
9277
- overflow: hidden !important;
9278
- text-indent: -99999px !important;
9279
- position: relative !important;
9280
- top: 3px !important;
9281
- margin-left: 3px !important;
9282
- background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 0 !important;
9283
- }
9284
-
9285
- #WFItem394041 .wf-rc-image {
9286
- display: inline-block !important;
9287
- width: 16px !important;
9288
- height: 16px !important;
9289
- overflow: hidden !important;
9290
- text-indent: -99999px !important;
9291
- position: relative !important;
9292
- top: 3px !important;
9293
- margin-left: 3px !important;
9294
- background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 -16px !important;
9295
- }
9296
-
9297
- #WFItem394041 #recaptcha_image {
9298
- width: 200px !important;
9299
- height: 38px !important;
9300
- }
9301
-
9302
- #WFItem394041 #recaptcha_image img {
9303
- width: 200px !important;
9304
- height: 38px !important;
9305
- }
9306
-
9307
- #WFItem394041 .wf-rc-boxm {
9308
- width: 200px !important;
9309
- margin: 0 auto !important;
9310
- overflow: hidden !important;
9311
- }
9312
-
9313
- #WFItem394041 em {
9314
- color: inherit !important;
9315
- font-style: italic !important;
9316
- }
9317
- </style>
9318
- <div id="WFItem394041" class="wf-formTpl">
9319
- <form accept-charset="utf-8"
9320
- action="https://app.getresponse.com/add_contact_webform.html"
9321
- method="post" target="_top">
9322
- <div class="box">
9323
- <div id="WFIcenter" class="wf-body">
9324
- <ul class="wf-sortable" id="wf-sort-id">
9325
- <li class="wf-email" rel="undefined"
9326
- style="display: block !important;">
9327
- <div class="wf-contbox">
9328
- <div class="wf-labelpos">
9329
- <label class="wf-label">Email:</label>
9330
- </div>
9331
- <div class="wf-inputpos">
9332
- <input type="text" class="wf-input wf-req wf-valid__email"
9333
- name="email"></input>
9334
- </div>
9335
- <em class="clearfix clearer"></em>
9336
- </div>
9337
- </li>
9338
- <li class="wf-submit" rel="undefined"
9339
- style="display: block !important;">
9340
- <div class="wf-contbox">
9341
- <div class="wf-inputpos">
9342
- <input type="submit"
9343
- style="width: 126px ! important; display: inline !important;"
9344
- value="Sign Up!" class="wf-button" name="submit"></input>
9345
- </div>
9346
- <em class="clearfix clearer"></em>
9347
- </div>
9348
- </li>
9349
- <li class="wf-captcha" rel="undefined"
9350
- style="display: none !important;">
9351
- <div wf-captchaerror="Incorrect please try again"
9352
- wf-captchasound="Enter the numbers you hear:"
9353
- wf-captchaword="Enter the words above:"
9354
- class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9355
- </li>
9356
- </ul>
9357
- </div>
9358
- <div id="WFIfooter" class="wf-footer el">
9359
- <div class="actTinyMceElBodyContent"></div>
9360
- <em class="clearfix clearer"></em>
9361
- </div>
9362
- </div>
9363
- <input type="hidden" name="webform_id" value="394041"/>
9364
- </form>
9365
- </div>
9366
- <?php
9367
- }
9368
-
9369
- private function yop_poll_optin_form1() {
9370
- ?>
9371
  <style type="text/css">
9372
  @font-face {
9373
  font-family: Lato-Reg;
9374
- src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Reg.ttf);
9375
  }
9376
 
9377
  @font-face {
9378
  font-family: Lato-Lig;
9379
- src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Lig.ttf);
9380
  }
9381
 
9382
  @font-face {
9383
  font-family: Lato-Bla;
9384
- src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Bla.ttf);
9385
  }
9386
 
9387
  @font-face {
9388
  font-family: 'FontomasCustomRegular';
9389
- src: url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.eot');
9390
- src: url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'), url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.woff') format('woff'), url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.ttf') format('truetype'), url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
9391
  font-weight: normal;
9392
  font-style: normal;
9393
  }
9394
 
9395
- /* Optin */
9396
  #WFItem394041 {
9397
  background: #f7f7f7; /* Old browsers */
9398
  background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
@@ -9427,16 +276,16 @@ EOT;
9427
  font-size: 3em;
9428
  margin-top: 0.5em;
9429
  font-variant: small-caps;
9430
- font-weight: bold;
9431
  color: #95abb7;
9432
  }
9433
 
9434
- #WFItem394041 h3 {
9435
  font-size: 2em;
9436
  margin-top: 0.2em;
9437
- font-weight: bold;
9438
  color: #95abb7;
9439
- display: inline;
9440
  }
9441
 
9442
  #WFItem394041 #circle {
@@ -9509,266 +358,846 @@ EOT;
9509
  width: 20px;
9510
  }
9511
 
9512
- </style>
9513
  <div id="WFItem394041" class="wf-formTpl">
9514
  <a href="javascript:void(0)" id="yop-poll-close-modal-box"><span>x</span></a>
9515
- <form accept-charset="utf-8"
9516
  action="https://app.getresponse.com/add_contact_webform.html"
9517
  method="post" target="_top">
9518
- <div class="box">
9519
- <div id="WFIcenter" class="wf-body">
9520
- <ul class="wf-sortable" id="wf-sort-id">
9521
- <li>
9522
  <div id="circle"><h1>?</h1></div>
9523
- <p><h2><?php _e( 'Need Help?', 'yop_poll' ); ?></h2><br><h3><?php _e( 'Download<br /> YOP Poll User Guide', 'yop_poll' ); ?></h3></p>
9524
- </li>
9525
- <li class="wf-email" rel="undefined"
9526
  style="display: block !important;">
9527
- <div class="wf-contbox">
9528
- <div class="wf-inputpos">
9529
  <label for="email" data-icon="e"/>
9530
- <input id="email" type="text" class="wf-input wf-req wf-valid__email"
9531
  name="email" placeholder="<?php _e( 'Email', 'yop_poll' ); ?>"></input>
9532
- </div>
9533
- <em class="clearfix clearer"></em>
9534
- </div>
9535
- </li>
9536
- <li class="wf-submit" rel="undefined"
9537
  style="display: block !important;">
9538
- <div class="wf-contbox">
9539
- <div class="wf-inputpos">
9540
- <input type="submit" value="<?php _e( 'Send me the FREE guide!', 'yop_poll' ); ?>" class="wf-button" name="submit"></input>
9541
- </div>
9542
- <em class="clearfix clearer"></em>
9543
- </div>
9544
- </li>
9545
- <li class="wf-captcha" rel="undefined"
9546
  style="display: none !important;">
9547
- <div wf-captchaerror="<?php _e( 'Incorrect please try again', 'yop_poll' ); ?>"
9548
  wf-captchasound="<?php _e( 'Enter the numbers you hear:', 'yop_poll' ); ?>"
9549
  wf-captchaword="<?php _e( 'Enter the words above:', 'yop_poll' ); ?>"
9550
  class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9551
- </li>
9552
- </ul>
9553
- </div>
9554
- <div id="WFIfooter" class="wf-footer el">
9555
- <div class="actTinyMceElBodyContent"></div>
9556
- <em class="clearfix clearer"></em>
9557
- </div>
9558
- </div>
9559
- <input type="hidden" name="webform_id" value="394041"/>
9560
- </form>
9561
- </div>
9562
- <?php
9563
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9564
 
9565
- private function yop_poll_optin_form2() {
9566
- wp_enqueue_style("yop-poll-optin2-css", "{$this->_config->plugin_url}/css/yop-poll-optin2.css");
9567
- ?>
 
 
 
 
 
 
 
 
 
9568
 
9569
- <div id="WFItem394041" class="optin">
9570
- <div id="circle">
9571
- <h1>?</h1>
9572
- </div>
9573
- <form accept-charset="utf-8"
9574
- action="https://app.getresponse.com/add_contact_webform.html"
9575
- method="post" target="_top">
9576
- <div class="box">
9577
- <div id="WFIcenter" class="wf-body">
9578
- <ul class="wf-sortable" id="wf-sort-id">
9579
- <li>
9580
- <p>
9581
- <b>
9582
- <?php _e( 'Need Help?', 'yop_poll' ); ?><br>
9583
- <?php _e( 'Download YOP Poll User Guide!', 'yop_poll' ); ?>
9584
- </b>
9585
- </p>
9586
- </li>
9587
- <li class="wf-email" rel="undefined"
9588
- style="display: block !important;">
9589
- <div class="wf-contbox">
9590
- <div class="wf-inputpos">
9591
- <label for="email" data-icon="e"/>
9592
- <input id="email" type="text" class="wf-input wf-req wf-valid__email"
9593
- name="email" placeholder="<?php _e( 'Email', 'yop_poll' ); ?>"></input>
9594
- </div>
9595
- <em class="clearfix clearer"></em>
9596
- </div>
9597
- </li>
9598
- <li class="wf-submit" rel="undefined"
9599
- style="display: block !important;">
9600
- <div class="wf-contbox">
9601
- <div class="wf-inputpos">
9602
- <input type="submit" value="<?php _e( 'Send me the guide!', 'yop_poll' ); ?>" class="wf-button" name="submit"></input>
9603
- </div>
9604
- <em class="clearfix clearer"></em>
9605
- </div>
9606
- </li>
9607
- <li class="wf-captcha" rel="undefined"
9608
- style="display: none !important;">
9609
- <div wf-captchaerror="<?php _e( 'Incorrect please try again', 'yop_poll' ); ?>"
9610
- wf-captchasound="<?php _e( 'Enter the numbers you hear:', 'yop_poll' ); ?>"
9611
- wf-captchaword="<?php _e( 'Enter the words above:', 'yop_poll' ); ?>"
9612
- class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9613
- </li>
9614
- </ul>
9615
- </div>
9616
- <div id="WFIfooter" class="wf-footer el">
9617
- <div class="actTinyMceElBodyContent"></div>
9618
- <em class="clearfix clearer"></em>
9619
- </div>
9620
- </div>
9621
- <input type="hidden" name="webform_id" value="394041"/>
9622
- </form>
9623
- </div>
9624
- <?php
9625
- }
9626
 
9627
- public function load_optin_box() {
9628
- $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
9629
- if ( $optin_box_modal_options ['show'] == 'yes' ){
9630
- wp_enqueue_script( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array( 'jquery' ), $this->_config->version, true );
9631
- wp_enqueue_script( 'yop-poll-modal-functions', "{$this->_config->plugin_url}/js/yop-poll-modal-functions.js", array( 'jquery', 'yop-poll-modal-box-js' ), $this->_config->version, true );
9632
- $yop_poll_modal_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_modal_option_signup' ) );
9633
- wp_localize_script( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
9634
- wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-basic.css", array(), $this->_config->version );
9635
- }
9636
- elseif ( $optin_box_modal_options ['sidebar_had_submit'] == 'no' ) {
9637
- wp_enqueue_script( 'yop-poll-sidebar-option-functions', "{$this->_config->plugin_url}/js/yop-poll-sidebar-optin-functions.js", array( 'jquery' ), $this->_config->version, true );
9638
- $yop_poll_sidebar_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_sidebar_option_signup' ) );
9639
- wp_localize_script( 'yop-poll-sidebar-option-functions', 'yop_poll_sidebar_functions_config', $yop_poll_sidebar_functions_config );
9640
- }
9641
- }
9642
 
9643
- public function popup_bar() {
9644
- require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
9645
- $date_30_days_before = Yop_Poll_Model::get_mysql_custom_date( -30, 'DAY' );
9646
- $yop_poll_first_install_date = get_option( 'yop_poll_first_install_date' );
9647
- $yop_poll_admin_notices_donate = get_option( 'yop_poll_admin_notices_donate' );
9648
- if ( $date_30_days_before >= $yop_poll_first_install_date ){
9649
- if ( 'yes' == $yop_poll_admin_notices_donate ){
9650
- ?>
9651
- <style type="text/css">
9652
- .yop-poll-updated {
9653
- background: #f7f7f7 !important; /* Old browsers */
9654
- background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* FF3.6+ */
9655
- background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #f7f7f7), color-stop(100%, #ffffff)) !important; /* Chrome,Safari4+ */
9656
- background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* Chrome10+,Safari5.1+ */
9657
- background: -o-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* Opera 11.10+ */
9658
- background: -ms-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* IE10+ */
9659
- background: linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* W3C */
9660
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#ffffff', GradientType=1) !important; /* IE6-9 fallback on horizontal gradient */
9661
- border: 1px solid #fff !important;
9662
- -moz-box-shadow: 0px 0px 9px #dadada !important;
9663
- -webkit-box-shadow: 0px 0px 9px #dadada !important;
9664
- box-shadow: 0px 0px 9px #dadada !important;
9665
- margin: 5px 0px 15px !important;
9666
- padding: 1px 12px !important;
9667
- font-size: 16px !important;
9668
- line-height: 1.4em !important;
9669
- text-shadow: 1px 1px #fff !important;
9670
- width: 98% !important;
9671
- border: none !important;
9672
- }
9673
 
9674
- .yop-poll-button {
9675
- border: none;
9676
- background: #fff;
9677
- border: 1px solid #00a8ff;
9678
- color: #95abb7;
9679
- padding: 5px;
9680
- font-family: Lato-Bla, Arial, Helvetica, sans-serif;
9681
- font-size: 16px;
9682
- -webkit-transition: all 0.3s linear;
9683
- -moz-transition: all 0.3s linear;
9684
- -o-transition: all 0.3s linear;
9685
- transition: all 0.3s linear;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9686
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9687
 
9688
- .yop-poll-button:hover {
9689
- color: #fff;
9690
- background: #00a8ff;
9691
- border: 1px solid #fff;
9692
- cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9693
  }
9694
- </style>
9695
- <div class="updated yop-poll-updated" id="message">
9696
- <p>
9697
- <?php _e( 'It looks like you\'ve been enjoying YOP POLL Plugin for at least 30 days.', 'yop_poll' ); ?>
9698
- <?php _e( 'Would you consider a small donation to help support continued development of the plugin?', 'yop_poll' ); ?>
9699
- </p>
9700
- <p>
9701
- <input type="button" class="yop-poll-button"
9702
- value="<?php _e( 'Support This Plugin', 'yop_poll' ) ?>"
9703
- onclick="window.open('<?php echo esc_url( add_query_arg( array( 'yop_poll_support_plugin' => 'yes', '_wpnonce' => wp_create_nonce( 'yop_poll_donate_addmin_notices' ) ) ) ); ?>', '_blank');"/>
9704
- <input type="button" class="yop-poll-button"
9705
- value="<?php _e( 'Rate it 5&#9733;\'s', 'yop_poll' ) ?>"
9706
- onclick="window.open('<?php echo esc_url( add_query_arg( array( 'yop_poll_rate_plugin' => 'yes', '_wpnonce' => wp_create_nonce( 'yop_poll_donate_addmin_notices' ) ) ) ); ?>', '_blank');"/>
9707
- <input type="button" class="yop-poll-button"
9708
- value="<?php _e( 'Tell Your Followers', 'yop_poll' ) ?>"
9709
- onclick="window.open('<?php echo esc_url( add_query_arg( array( 'yop_poll_tell_followers' => 'yes', '_wpnonce' => wp_create_nonce( 'yop_poll_donate_addmin_notices' ) ) ) ); ?>', '_blank');"/>
9710
- <input type="button" class="yop-poll-button"
9711
- value="<?php _e( 'Don\'t Bug Me Again', 'yop_poll' ) ?>"
9712
- onclick="document.location.href='<?php echo esc_url( add_query_arg( array( 'yop_poll_do_not_bug' => 'yes', '_wpnonce' => wp_create_nonce( 'yop_poll_donate_addmin_notices' ) ) ) ); ?>'"/>
9713
- </p>
9714
- </div>
9715
- <?php
9716
- }
9717
- }
9718
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9719
 
9720
- public function popup_bar_operations() {
9721
- if ( ( isset ( $_GET ['yop_poll_support_plugin'] ) || isset ( $_GET ['yop_poll_rate_plugin'] ) || isset ( $_GET ['yop_poll_tell_followers'] ) || isset ( $_GET ['yop_poll_do_not_bug'] ) ) && wp_verify_nonce( $_REQUEST ['_wpnonce'], 'yop_poll_donate_addmin_notices' ) ){
9722
- update_option( "yop_poll_admin_notices_donate", 'no' );
9723
- $this->remove_action( 'admin_notices', 'popup_bar' );
9724
 
9725
- if ( isset ( $_GET ['yop_poll_support_plugin'] ) ){
9726
- if ( 'yes' == $_GET ['yop_poll_support_plugin'] ){
9727
- wp_redirect( 'http://www.yop-poll.com/thankyou/don.php', '302' );
9728
- }
9729
- }
9730
 
9731
- if ( isset ( $_GET ['yop_poll_rate_plugin'] ) ){
9732
- if ( 'yes' == $_GET ['yop_poll_rate_plugin'] ){
9733
- wp_redirect( 'http://wordpress.org/support/view/plugin-reviews/yop-poll?filter=5', '302' );
9734
- }
9735
- }
9736
 
9737
- if ( isset ( $_GET ['yop_poll_tell_followers'] ) ){
9738
- if ( 'yes' == $_GET ['yop_poll_tell_followers'] ){
9739
- wp_redirect( 'http://twitter.com/home?status=' . urlencode( 'I use Yop Poll Plugin for WordPress and you should too - http://wordpress.org/extend/plugins/yop-poll/' ), '302' );
9740
- }
9741
- }
9742
 
9743
- if ( isset ( $_GET ['yop_poll_do_not_bug'] ) ){
9744
- if ( 'yes' == $_GET ['yop_poll_do_not_bug'] ){
9745
- wp_redirect( remove_query_arg( array( 'yop_poll_do_not_bug', '_wpnonce', 'yop_poll_tell_followers', 'yop_poll_rate_plugin', 'yop_poll_support_plugin' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ), '302' );
9746
- }
9747
- }
9748
- }
9749
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
9750
 
9751
- /* END donate */
9752
- private function current_user_can( $capability = '' ) {
9753
- global $current_user;
9754
- get_currentuserinfo();
9755
- $user_roles = $current_user->roles;
9756
- $user_role = array_shift( $user_roles );
9757
 
9758
- $capabilities_roles = array(
9759
- 'manage_polls_options' => array(
9760
- 'administrator' => true,
9761
- 'editor' => true,
9762
- 'author' => false,
9763
- 'contributor' => false,
9764
- 'subscriber' => false ),
9765
- 'manage_polls_bans' => array(
9766
- 'administrator' => true,
9767
- 'editor' => false,
9768
- 'author' => false,
9769
- 'contributor' => false, 'subscriber' => false ), 'delete_polls' => array( 'administrator' => true, 'editor' => false, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'delete_own_polls' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'edit_polls' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'edit_own_polls' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'clone_polls' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'clone_own_polls' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'view_polls_logs' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'view_own_polls_logs' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'view_polls_results' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'view_own_polls_results' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'reset_polls_stats' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'reset_own_polls_stats' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'delete_polls_logs' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'delete_own_polls_logs' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'edit_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'edit_own_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'delete_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'delete_own_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'clone_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => false, 'contributor' => false, 'subscriber' => false ), 'clone_own_polls_templates' => array( 'administrator' => true, 'editor' => true, 'author' => true, 'contributor' => false, 'subscriber' => false ), 'become_pro' => array( 'administrator' => false, 'editor' => false, 'author' => false, 'contributor' => false, 'subscriber' => false ) );
9770
- if ( isset ( $capabilities_roles [$capability] [$user_role] ) )
9771
- return $capabilities_roles [$capability] [$user_role];
9772
- return false;
9773
- }
9774
- }
1
  <?php
2
+ class Yop_Poll_Admin extends Yop_Poll_Plugin {
3
+
4
+ public function admin_loader() {
5
+ $this->add_action( 'admin_menu', 'admin_menu', 1 );
6
+ $this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
7
+ $this->wp_ajax_action( 'get_new_poll_answer_template' );
8
+ $this->wp_ajax_action( 'get_new_poll_question_template' );
9
+ $this->wp_ajax_action( 'add_edit_poll' );
10
+ $this->wp_ajax_action( 'add_edit_templates' );
11
+ $this->wp_ajax_action( 'reset_templates' );
12
+ $this->wp_ajax_action( 'reset_templates' );
13
+ $this->wp_ajax_action( 'add_votes' );
14
+
15
+ $this->add_action( 'admin_enqueue_scripts', 'my_yop_poll_button' );
16
+ $this->add_action( 'admin_enqueue_scripts', 'load_editor_functions' );
17
+
18
+ $this->add_action( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
19
+ $this->add_action( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
20
+
21
+ $this->add_action( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
22
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
23
+
24
+ $this->add_action( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
25
+ $this->add_action( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
26
+ $this->add_action( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
27
+
28
+ $this->add_action( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
29
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
30
+
31
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
32
+ $this->add_action( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
33
+
34
+ $this->add_action( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
35
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
36
+ register_uninstall_hook( $this->_config->plugin_file, 'yop_poll_uninstall' );
37
+
38
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
39
+ $this->add_action( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
40
+
41
+ $this->add_action( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
42
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
43
+
44
+ $this->add_action( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
45
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
46
+
47
+ $this->add_action( 'wp_ajax_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
48
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
49
+
50
+ $this->add_action( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
51
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
52
+
53
+ $this->add_action( 'wp_ajax_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
54
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
55
+
56
+ }
57
+ public function db_update() {
58
+ $main_obj=new YOP_POLL_Maintenance();
59
+ $main_obj ->some_function();
60
+
61
+ }
62
+ public function admin_menu() {
63
+
64
+ if( is_admin() ) {
65
+
66
+ $pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
67
+ if( function_exists( 'add_menu_page' ) ) {
68
+
69
+ $page = add_object_page( __yop_poll( 'Yop Poll' ), __yop_poll( 'Yop Poll' ), 'edit_own_yop_polls', 'yop-polls', array(
70
+ $pollAdminObj,
71
+ 'manage_polls'
72
+ ), YOP_POLL_URL . "images/yop-poll-admin-menu-icon16.png" );
73
+ if( $page ) {
74
+ $this->add_action( "load-$page", 'manage_pages_load' );
75
+ add_action( "load-$page", array(
76
+ $pollAdminObj,
77
+ 'manage_load_polls'
78
+ ) );
79
+
80
+ if( function_exists( 'add_submenu_page' ) ) {
81
+ if( current_user_can( 'edit_own_yop_polls' ) ) {
82
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'All Polls' ), __yop_poll( 'All Polls' ), 'edit_own_yop_polls', 'yop-polls', array(
83
+ $pollAdminObj,
84
+ 'manage_polls'
85
+ ) );
86
+ if( $subpage ) {
87
+ $this->add_action( "load-$subpage", 'manage_pages_load' );
88
+ add_action( "load-$subpage", array(
89
+ $pollAdminObj,
90
+ 'manage_load_polls'
91
+ ) );
92
+ }
93
+
94
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Add New' ), __yop_poll( 'Add New' ), 'edit_own_yop_polls', 'yop-polls-add-new', array(
95
+ &$pollAdminObj,
96
+ 'manage_polls'
97
+ ) );
98
+ if( $subpage ) {
99
+ $this->add_action( "load-$subpage", 'manage_pages_load' );
100
+ add_action( "load-$subpage", array(
101
+ $pollAdminObj,
102
+ 'manage_load_polls'
103
+ ) );
104
+ }
105
+ }
106
+ if( current_user_can( 'manage_yop_polls_imports' ) ) {
107
+
108
+ $importObj = YOP_POLL_Imports_Admin::get_instance();
109
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Import' ), __yop_poll( 'Import' ), 'view_yop_polls_imports', 'yop-polls-imports', array(
110
+ &$importObj,
111
+ "manage_imports"
112
+ ) );
113
+ if( $subpage ) {
114
+ $this->add_action( "load-$subpage", "manage_pages_load" );
115
+ add_action( "load-$subpage", array(
116
+ $importObj,
117
+ 'manage_load_imports'
118
+ ) );
119
+ }
120
 
121
+ }
122
+ if( current_user_can( 'view_yop_polls_logs' ) ) {
123
+ $logsObj = YOP_POLL_Logs_Admin::get_instance();
124
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Logs' ), __yop_poll( 'Logs' ), 'view_yop_polls_logs', 'yop-polls-logs', array(
125
+ &$logsObj,
126
+ "manage_logs"
127
+ ) );
128
+ if( $subpage ) {
129
+ $this->add_action( "load-$subpage", "manage_pages_load" );
130
+ add_action( "load-$subpage", array(
131
+ $logsObj,
132
+ 'manage_load_logs'
133
+ ) );
134
+ }
135
+ }
136
+ if( current_user_can( 'manage_yop_polls_options' ) ) {
137
+ $genOptObj = YOP_POLL_General_Options::get_instance();
138
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Options' ), __yop_poll( 'Options' ), 'manage_yop_polls_options', 'yop-polls-options', array(
139
+ &$genOptObj,
140
+ "manage_options"
141
+ ) );
142
+ if( $subpage ) {
143
+ $this->add_action( "load-$subpage", "manage_pages_load" );
144
+ add_action( "load-$subpage", array(
145
+ $genOptObj,
146
+ 'manage_load_general_options'
147
+ ) );
148
+ }
149
+ }
150
+ if( current_user_can( 'edit_yop_polls_templates' ) ) {
151
+ $templatesObj = YOP_POLL_Templates_Admin::get_instance();
152
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Templates' ), __yop_poll( 'Templates' ), 'edit_yop_polls_templates', 'yop-polls-templates', array(
153
+ &$templatesObj,
154
+ "manage_templates"
155
+ ) );
156
+ if( $subpage ) {
157
+ $this->add_action( "load-$subpage", "manage_pages_load" );
158
+ add_action( "load-$subpage", array(
159
+ $templatesObj,
160
+ 'manage_load_templates'
161
+ ) );
162
+ }
163
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
 
 
 
 
165
 
166
+ if( current_user_can( 'manage_yop_polls_bans' ) ) {
167
+ $bansObj = YOP_POLL_Ban_Admin::get_instance();
168
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Bans' ), __yop_poll( 'Bans' ), 'manage_yop_polls_bans', 'yop-polls-bans', array(
169
+ &$bansObj,
170
+ "manage_bans"
171
+ ) );
172
+ if( $subpage ) {
173
+ $this->add_action( "load-$subpage", "manage_pages_load" );
174
+ add_action( "load-$subpage", array(
175
+ $bansObj,
176
+ 'manage_load_bans'
177
+ ) );
178
+ }
179
+ }
180
+ if( current_user_can( 'become_yop_poll_pro' ) ) {
181
+ $proObj = YOP_POLL_Pro_Admin::get_instance();
182
+ $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Upgrade to Pro' ), __yop_poll( 'Upgrade to Pro' ), 'become_yop_poll_pro', 'yop-polls-become-pro', array(
183
+ &$proObj,
184
+ "manage_pages"
185
+ ) );
186
+ if( $subpage ) {
187
+ $this->add_action( "load-$subpage", "manage_pages_load" );
188
+ }
189
+ }
 
 
 
 
190
 
 
 
 
191
 
192
+ }
193
+ }
194
  }
195
+ }
196
+ }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
+ public function ajax_modal_option_signup() {
200
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
201
+ $optin_box_modal_options ['modal_had_submit'] = 'yes';
202
+ update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
203
+ die ();
204
+ }
205
+ public function ajax_show_optin_box_modal() {
206
+ $this->yop_poll_optin_form1();
 
207
 
208
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
209
+ $optin_box_modal_options ['show'] = 'no'; //restore to no
210
+ $optin_box_modal_options ['sidebar_had_submit'] = 'no';
211
+ $optin_box_modal_options ['modal_had_submit'] = 'no';
212
+ update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
 
 
 
 
 
 
 
215
 
216
+ die ();
217
+ }
218
+ private function yop_poll_optin_form1() {
219
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  <style type="text/css">
221
  @font-face {
222
  font-family: Lato-Reg;
223
+ src: url(<?php echo $this->_config->plugin_url; ?>css/fonts/Lato-Reg.ttf);
224
  }
225
 
226
  @font-face {
227
  font-family: Lato-Lig;
228
+ src: url(<?php echo $this->_config->plugin_url; ?>css/fonts/Lato-Lig.ttf);
229
  }
230
 
231
  @font-face {
232
  font-family: Lato-Bla;
233
+ src: url(<?php echo $this->_config->plugin_url; ?>css/fonts/Lato-Bla.ttf);
234
  }
235
 
236
  @font-face {
237
  font-family: 'FontomasCustomRegular';
238
+ src: url('<?php echo $this->_config->plugin_url; ?>css/fonts/fontomas-webfont.eot');
239
+ src: url('<?php echo $this->_config->plugin_url; ?>css/fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'), url('<?php echo $this->_config->plugin_url; ?>css/fonts/fontomas-webfont.woff') format('woff'), url('<?php echo $this->_config->plugin_url; ?>css/fonts/fontomas-webfont.ttf') format('truetype'), url('<?php echo $this->_config->plugin_url; ?>css/fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
240
  font-weight: normal;
241
  font-style: normal;
242
  }
243
 
244
+ /* Optin */
245
  #WFItem394041 {
246
  background: #f7f7f7; /* Old browsers */
247
  background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
276
  font-size: 3em;
277
  margin-top: 0.5em;
278
  font-variant: small-caps;
279
+ font-weight: bold;
280
  color: #95abb7;
281
  }
282
 
283
+ #WFItem394041 h3 {
284
  font-size: 2em;
285
  margin-top: 0.2em;
286
+ font-weight: bold;
287
  color: #95abb7;
288
+ display: inline;
289
  }
290
 
291
  #WFItem394041 #circle {
358
  width: 20px;
359
  }
360
 
361
+ </style>
362
  <div id="WFItem394041" class="wf-formTpl">
363
  <a href="javascript:void(0)" id="yop-poll-close-modal-box"><span>x</span></a>
364
+ <form accept-charset="utf-8"
365
  action="https://app.getresponse.com/add_contact_webform.html"
366
  method="post" target="_top">
367
+ <div class="box">
368
+ <div id="WFIcenter" class="wf-body">
369
+ <ul class="wf-sortable" id="wf-sort-id">
370
+ <li>
371
  <div id="circle"><h1>?</h1></div>
372
+ <p><h2><?php _e( 'Need Help?', 'yop_poll' ); ?></h2><br><h3><?php _e( 'Download<br /> YOP Poll User Guide', 'yop_poll' ); ?></h3></p>
373
+ </li>
374
+ <li class="wf-email" rel="undefined"
375
  style="display: block !important;">
376
+ <div class="wf-contbox">
377
+ <div class="wf-inputpos">
378
  <label for="email" data-icon="e"/>
379
+ <input id="email" type="text" class="wf-input wf-req wf-valid__email"
380
  name="email" placeholder="<?php _e( 'Email', 'yop_poll' ); ?>"></input>
381
+ </div>
382
+ <em class="clearfix clearer"></em>
383
+ </div>
384
+ </li>
385
+ <li class="wf-submit" rel="undefined"
386
  style="display: block !important;">
387
+ <div class="wf-contbox">
388
+ <div class="wf-inputpos">
389
+ <input type="submit" value="<?php _e( 'Send me the FREE guide!', 'yop_poll' ); ?>" class="wf-button" name="submit"></input>
390
+ </div>
391
+ <em class="clearfix clearer"></em>
392
+ </div>
393
+ </li>
394
+ <li class="wf-captcha" rel="undefined"
395
  style="display: none !important;">
396
+ <div wf-captchaerror="<?php _e( 'Incorrect please try again', 'yop_poll' ); ?>"
397
  wf-captchasound="<?php _e( 'Enter the numbers you hear:', 'yop_poll' ); ?>"
398
  wf-captchaword="<?php _e( 'Enter the words above:', 'yop_poll' ); ?>"
399
  class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
400
+ </li>
401
+ </ul>
402
+ </div>
403
+ <div id="WFIfooter" class="wf-footer el">
404
+ <div class="actTinyMceElBodyContent"></div>
405
+ <em class="clearfix clearer"></em>
406
+ </div>
407
+ </div>
408
+ <input type="hidden" name="webform_id" value="394041"/>
409
+ </form>
410
+ </div>
411
+ <?php
412
+ }
413
+ public function ajax_sidebar_option_signup() {
414
+
415
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
416
+ $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
417
+ $optin_box_modal_options ['modal_had_submit'] = 'yes';
418
+ update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
419
+ die ();
420
+ }
421
+
422
+ public function manage_pages_load() {
423
+ wp_reset_vars( array(
424
+ 'page',
425
+ 'action',
426
+ 'orderby',
427
+ 'order'
428
+ ) );
429
+ wp_enqueue_style( 'yop-poll-global-admin-css', YOP_POLL_URL . "css/yop-poll-admin.css", array(), YOP_POLL_VERSION );
430
+ wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
431
+ wp_enqueue_style( 'yop-poll-colorpicker', YOP_POLL_URL . "css/colorpicker.css", array(), YOP_POLL_VERSION );
432
+ wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
433
+ wp_enqueue_script( 'yop-poll-admin-js', YOP_POLL_URL . "js/yop-poll-admin.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
434
+ wp_enqueue_script( 'yop-poll-tool_tips-js', YOP_POLL_URL . "js/yop_poll_tool_tips.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
435
+ wp_enqueue_script( 'yop-poll-color', YOP_POLL_URL . "js/color.picker.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
436
+ wp_enqueue_script( 'yop-poll-jquery-ui-timepicker-addon', YOP_POLL_URL . "js/jquery-ui-timepicker-addon.js", array(
437
+ 'jquery',
438
+ 'jquery-ui-datepicker',
439
+ 'jquery-ui-slider'
440
+ ), YOP_POLL_VERSION, true );
441
+
442
+ $time_format="hh:mm:ss";
443
+ $options = get_option('yop_poll_options' );
444
+ if($options['date_format']=="UE")
445
+ $date_format="dd-mm-yy";
446
+ else{
447
+ $date_format="mm-dd-yy";
448
+ }
449
+
450
+ $yop_poll_global_settings = array(
451
+ 'ajax_url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ),
452
+ 'message_before_ajax_send' => __yop_poll( 'Please wait a moment while we process your request...' ),
453
+ 'error_message_ajax' => __yop_poll( 'An error has occured...' ),
454
+ 'time' =>$time_format,
455
+ 'date' =>$date_format,
456
+ 'date_format' =>$options['date_format']
457
+ );
458
+ $yop_poll_tooltips=array("buy_pro"=> __yop_poll( 'Please buy pro version to use this feature' ) );
459
+
460
+ wp_localize_script( 'yop-poll-admin-js', 'yop_poll_global_settings', $yop_poll_global_settings );
461
+ wp_localize_script( 'yop-poll-tool_tips-js', 'yop_poll_tool_tips', $yop_poll_tooltips );
462
+ wp_enqueue_media();
463
+ }
464
+
465
+ public function get_new_poll_answer_template() {
466
+ $pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
467
+ $pollAdminObj->get_new_answer_template( $_REQUEST );
468
+ die();
469
+ }
470
+
471
+ public function get_new_poll_question_template() {
472
+ $pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
473
+ $pollAdminObj->get_new_question_template( $_REQUEST );
474
+ die();
475
+ }
476
+
477
+ public function add_edit_poll() {
478
+ if( is_admin() ) {
479
+ if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
480
+ wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
481
+ }
482
 
483
+ $pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
484
+ $pollAdminObj->do_add_edit();
485
+ }
486
+ die();
487
+ }
488
+
489
+ public function add_edit_templates() {
490
+ if( is_admin() ) {
491
+ if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false )
492
+ ) {
493
+ wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
494
+ }
495
 
496
+ $pollAdminObj = YOP_POLL_Templates_Admin::get_instance();
497
+ $pollAdminObj->do_add_edit_template();
498
+ }
499
+ die();
500
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
 
502
+ public function reset_templates() {
503
+ if( is_admin() ) {
504
+ if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false ) ) {
505
+ wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
506
+ }
 
 
 
 
 
 
 
 
 
 
507
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
 
509
+ $pollAdminObj = YOP_POLL_Templates_Admin::get_instance();
510
+ $pollAdminObj->do_reset_template();
511
+ }
512
+ die();
513
+ }
514
+
515
+ public function yop_poll_options_admin_init() {
516
+ $genOptObj = YOP_POLL_General_Options::get_instance();
517
+ register_setting( 'yop_poll_options', 'yop_poll_options', array(
518
+ &$genOptObj,
519
+ 'general_options_validate'
520
+ ) );
521
+ }
522
+
523
+ public function disable_check_for_updates_wp( $r, $url ) {
524
+ if( 0 !== strpos( $url, 'https://api.wordpress.org/plugins/update-check' ) ) {
525
+ return $r;
526
+ } // Not a plugin update request. Bail immediately.
527
+
528
+ $plugins = json_decode( $r['body']['plugins'], true );
529
+ unset( $plugins['plugins'][YOP_POLL_SHORT_PLUGIN_FILE] );
530
+ unset( $plugins['active'][array_search( YOP_POLL_SHORT_PLUGIN_FILE, $plugins['active'] )] );
531
+
532
+ $r['body']['plugins'] = json_encode( $plugins );
533
+
534
+ return $r;
535
+ }
536
+
537
+ public function ajax_show_captcha() {
538
+ if( is_admin() ) {
539
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
540
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : null;
541
+ if( $poll_id ) {
542
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
543
+ $yop_poll_model = new YOP_POLL_Poll_Model ( $poll_id );
544
+ $yop_poll_model->unique_id = $unique_id;
545
+ if( 'yes' == $yop_poll_model->use_captcha ) {
546
+ require_once( YOP_POLL_INC . 'securimage.php' );
547
+ $img = new Yop_Poll_Securimage ();
548
+ $img->ttf_file = YOP_POLL_PATH . 'captcha/AHGBold.ttf';
549
+ $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
550
+ $img->image_height = 60;
551
+ $img->image_width = intval( $img->image_height * M_E );
552
+ $img->text_color = new Yop_Poll_Securimage_Color ( rand( 0, 255 ), rand( 0, 255 ), rand( 0, 255 ) );
553
+ $img->show();
554
+ }
555
+ }
556
+ else {
557
+ wp_die( 'Invalid Poll' );
558
+ }
559
+ }
560
+ else {
561
+ wp_die( 'captcha error' );
562
+ }
563
+ die ();
564
+ }
565
+
566
+ //region AJAX SECTION
567
+
568
+ public function ajax_play_captcha() {
569
+ if( is_admin() ) {
570
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
571
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : null;
572
+ if( $poll_id ) {
573
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
574
+ $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
575
+ if( 'yes' == $yop_poll_model->use_captcha ) {
576
+ require_once( YOP_POLL_INC . 'securimage.php' );
577
+ $img = new Yop_Poll_Securimage ();
578
+ $img->audio_path = YOP_POLL_PATH . 'captcha/audio/';
579
+ $img->audio_noise_path = YOP_POLL_PATH . 'captcha/audio/noise/';
580
+ $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
581
+
582
+ $img->outputAudioFile();
583
+ }
584
+ }
585
+ else {
586
+ wp_die( 'Invalid Poll' );
587
+ }
588
+ }
589
+ else {
590
+ wp_die( 'captcha error' );
591
+ }
592
+ die ();
593
+ }
594
+
595
+ public function yop_poll_do_vote() {
596
+ $error = '';
597
+ $success = '';
598
+ $message = '';
599
+ if(!isset($_POST)||empty($_POST)){
600
+ $error = __( 'Bad Request! Try later!', 'yop_poll' );
601
+ print '[ajax-response]' . json_encode( array(
602
+ 'error' => $error,
603
+ 'success' => $success
604
+
605
+ ) ) . '[/ajax-response]';
606
+ die ();
607
+ }
608
+ if( is_admin() ) {
609
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
610
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : null;
611
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : null;
612
+ $unique_id =strip_tags(xss_clean($unique_id));
613
+ $location = strip_tags(xss_clean($location));
614
+ if( $poll_id ) {
615
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
616
+ $yop_poll_model = new YOP_POLL_Poll_Model ( $poll_id );
617
+ $yop_poll_model->unique_id = $unique_id;
618
+ $poll_html = $yop_poll_model->register_vote( $_REQUEST );
619
+ if( $poll_html ) {
620
+ $message = $poll_html;
621
+ $success = $yop_poll_model->success;
622
+ }
623
+ else {
624
+ $error = $yop_poll_model->error;
625
+ }
626
+ unset ( $yop_poll_model );
627
+ }
628
+ else {
629
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
630
+ }
631
+ }
632
+ print '[ajax-response]' . json_encode( array(
633
+ 'error' => $error,
634
+ 'success' => $success,
635
+ 'message' => $message
636
+ ) ) . '[/ajax-response]';
637
+ die ();
638
+ }
639
+
640
+ public function yop_poll_view_results() {
641
+ $error = '';
642
+ $success = '';
643
+ $message = '';
644
+ if(!isset($_POST)||empty($_POST)){
645
+ $error = __( 'Bad Request! Try later!', 'yop_poll' );
646
+ print '[ajax-response]' . json_encode( array(
647
+ 'error' => $error,
648
+ 'success' => $success
649
+
650
+ ) ) . '[/ajax-response]';
651
+ die ();
652
+ }
653
+ if( is_admin() ) {
654
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
655
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
656
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
657
+ $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
658
+ $unique_id =strip_tags(xss_clean($unique_id));
659
+ $location = strip_tags(xss_clean($location));
660
+ $tr_id = strip_tags(xss_clean($tr_id));
661
+ if ( wp_verify_nonce( $_REQUEST['nonce'], 'yop_poll-' . $poll_id . $unique_id . '-user-actions' ) ){
662
+ if( $poll_id ) {
663
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
664
+ $yop_poll_model = new YOP_POLL_Poll_Model ( $poll_id );
665
+ $yop_poll_model->unique_id = $unique_id;
666
+ $yop_poll_model->vote = true;
667
+ $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array(
668
+ 'tr_id' => $tr_id,
669
+ 'location' => $location
670
+ ) ) );
671
+ if( $poll_html ) {
672
+ $message = $poll_html;
673
+ $success = $yop_poll_model->success;
674
+ }
675
+ else {
676
+ $error = $yop_poll_model->error;
677
+ }
678
+ unset ( $yop_poll_model );
679
+ }
680
+ else {
681
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
682
+ }
683
+ }
684
+ else
685
+ {
686
+ $error=__('Bad request!Try again later','yop_poll');
687
+ }
688
+ }
689
+ print '[ajax-response]' . json_encode( array(
690
+ 'error' => $error,
691
+ 'success' => $success,
692
+ 'message' => $message
693
+ ) ) . '[/ajax-response]';
694
+ die ();
695
+ }
696
+
697
+ public function yop_poll_back_to_vote() {
698
+ $error = '';
699
+ $success = '';
700
+ $message = '';
701
+ if(!isset($_POST)||empty($_POST)){
702
+ $error = __( 'Bad Request! Try later!', 'yop_poll' );
703
+ print '[ajax-response]' . json_encode( array(
704
+ 'error' => $error,
705
+ 'success' => $success
706
+
707
+ ) ) . '[/ajax-response]';
708
+ die ();
709
+ }
710
+ if( is_admin() ) {
711
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
712
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
713
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
714
+ $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
715
+ $unique_id =strip_tags(xss_clean($unique_id));
716
+ $location = strip_tags(xss_clean($location));
717
+ $tr_id = strip_tags(xss_clean($tr_id));
718
+ if ( wp_verify_nonce( $_REQUEST['nonce'], 'yop_poll-' . $poll_id . $unique_id . '-user-actions' ) ){
719
+ if( $poll_id ) {
720
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
721
+ $yop_poll_model = new YOP_POLL_Poll_Model ( $poll_id );
722
+ $yop_poll_model->unique_id = $unique_id;
723
+ $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array(
724
+ 'tr_id' => $tr_id,
725
+ 'location' => $location
726
+ ) ) );
727
+ if( $poll_html ) {
728
+ $message = $poll_html;
729
+ $success = $yop_poll_model->success;
730
+ }
731
+ else {
732
+ $error = $yop_poll_model->error;
733
+ }
734
+ unset ( $yop_poll_model );
735
+ }
736
+ else {
737
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
738
+ }
739
+ }
740
+ else $error=__('Bad Request!Try again later','yop_poll');
741
+ }
742
+ print '[ajax-response]' . json_encode( array(
743
+ 'error' => $error,
744
+ 'success' => $success,
745
+ 'message' => $message
746
+ ) ) . '[/ajax-response]';
747
+ die ();
748
+ }
749
+
750
+ public function yop_poll_load_js() {
751
+ header( 'Content-Type: text/javascript' );
752
+ // check_ajax_referer('yop-poll-public-js');
753
+ if( is_admin() ) {
754
+ $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : null;
755
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : null;
756
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : null;
757
+ if( $poll_id ) {
758
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
759
+ $yop_poll_model = new YOP_POLL_Poll_Model ( $poll_id );
760
+ $yop_poll_model->unique_id = $unique_id;
761
+ $poll_js = $yop_poll_model->return_poll_js( array( 'location' => $location ) );
762
+ print $poll_js;
763
+ unset ( $yop_poll_model );
764
+ }
765
+ }
766
+ die ();
767
+ }
768
+
769
+ public function ajax_set_google_vote() {
770
+ $poll_id = yop_poll_base64_decode( $_GET['poll_id'] );
771
+ $unique_id = yop_poll_base64_decode( $_GET['unique_id'] );
772
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
773
+ $yop_poll_model = new YOP_POLL_Poll_Model( $poll_id );
774
+
775
+ $publish = false;
776
+ $error = '';
777
+ if( isset( $_GET['error'] ) ) {
778
+ $error = $_GET['error'];
779
+ }
780
+ else {
781
+ require_once YOP_POLL_PATH . "lib/Google/facebook.php";
782
+ $options = get_option( 'yop_poll_options' );
783
+ if( isset( $options['google_integration'] ) && 'yes' == $options['google_integration'] ) {
784
+ if( isset( $options['google_appID'] ) && '' != $options['google_appID'] ) {
785
+ if( isset( $options['google_appSecret'] ) && '' != $options['google_appSecret'] ) {
786
+ $config = array(
787
+ 'appId' => $options['google_appID'],
788
+ 'secret' => $options['google_appSecret'],
789
+ 'allowSignedRequest' => false,
790
+ 'cookie' => true,
791
+ );
792
+
793
+ $facebook = new Facebook( $config );
794
+
795
+ $user = $facebook->getUser();
796
+
797
+ // We may or may not have this data based on whether the user is logged in.
798
+ //
799
+ // If we have a $user id here, it means we know the user is logged into
800
+ // Facebook, but we don't know if the access token is valid. An access
801
+ // token is invalid if the user logged out of Facebook.
802
+
803
+ if( $user ) {
804
+ try {
805
+ $fb_user_details = $facebook->api( "/me" );
806
+ $return_data = array(
807
+ 'user_details' => array(
808
+ 'id' => $user,
809
+ 'name' => $fb_user_details['name'],
810
+ 'first_name' => $fb_user_details['first_name'],
811
+ 'last_name' => $fb_user_details['last_name'],
812
+ 'username' => $fb_user_details['username'],
813
+ 'email' => $fb_user_details['email'],
814
+ 'link' => $fb_user_details['link'],
815
+ 'gender' => $fb_user_details['gender'],
816
+ 'picture' => 'https://graph.facebook.com/' . $user . '/picture'
817
+ )
818
+ );
819
+
820
+ $facebook_user_details = yop_poll_base64_encode( json_encode( $return_data ) );
821
+
822
+ $permissions = $facebook->api( "/me/permissions" );
823
+ if( $permissions[0]['publish_stream'] ) {
824
+ $publish = true;
825
+ }
826
+ }
827
+ catch( FacebookApiException $e ) {
828
+ echo "access token not available";
829
+ $error = $e;
830
+ }
831
  }
832
+ else {
833
+ $error = __yop_poll( "Please log in to cast your vote" );
834
+ }
835
+ }
836
+ else {
837
+ $error = __yop_poll( 'Request Failed' );
838
+ }
839
+ }
840
+ else {
841
+ $error = __yop_poll( 'Request Failed' );
842
+ }
843
+ }
844
+ else {
845
+ $error = __yop_poll( 'Request Failed' );
846
+ }
847
+
848
 
849
+ $public_config = array(
850
+ 'poll_options' => array(
851
+ 'share_after_vote' => $yop_poll_model->share_after_vote,
852
+ 'share_name' => html_entity_decode( (string)$yop_poll_model->share_name, ENT_QUOTES, 'UTF-8' ),
853
+ 'share_caption' => html_entity_decode( (string)$yop_poll_model->share_caption, ENT_QUOTES, 'UTF-8' ),
854
+ 'share_description' => html_entity_decode( (string)$yop_poll_model->share_description, ENT_QUOTES, 'UTF-8' ),
855
+ 'share_picture' => html_entity_decode( (string)$yop_poll_model->share_picture, ENT_QUOTES, 'UTF-8' ),
856
+ 'share_poll_name' => html_entity_decode( (string)$yop_poll_model->title, ENT_QUOTES, 'UTF-8' ),
857
+ 'share_link' => $yop_poll_model->poll_options['poll_page_url'] == '' ? site_url() : $yop_poll_model->poll_page_url,
858
+ 'redirect_after_vote' => html_entity_decode( (string)$yop_poll_model->redirect_after_vote, ENT_QUOTES, 'UTF-8' ),
859
+ 'redirect_after_vote_url' => html_entity_decode( (string)$yop_poll_model->redirect_after_vote_url, ENT_QUOTES, 'UTF-8' ),
860
+ )
861
+ );
862
+ }
863
+ ?>
864
+ <!DOCTYPE html>
865
+ <html>
866
+ <head>
867
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
868
+ <script type="text/javascript">
869
+ function close_window() {
870
+ var yop_poll_various_config = new Object();
871
+ yop_poll_various_config.poll_id = '<?php echo yop_poll_base64_decode( $_GET['poll_id'] ) ?>';
872
+ yop_poll_various_config.unique_id = '<?php echo yop_poll_base64_decode( $_GET['unique_id'] ) ?>';
873
+ yop_poll_various_config.poll_location = '<?php echo yop_poll_base64_decode( $_GET['poll_location'] ) ?>';
874
+ yop_poll_various_config.is_modal = <?php echo ( yop_poll_base64_decode( $_GET['is_modal'] ) == 'true' ) ? 'true' : 'false' ?>;
875
+ yop_poll_various_config.vote_loading_image_target = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_target'] ) ?>';
876
+ yop_poll_various_config.vote_loading_image_id = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_id'] ) ?>';
877
+ yop_poll_various_config.vote_type = '<?php echo yop_poll_base64_decode( $_GET['vote_type'] ) ?>';
878
+ yop_poll_various_config.facebook_user_details = '<?php echo $facebook_user_details; ?>';
879
+ yop_poll_various_config.facebook_error = '<?php echo $error ?>';
880
+ yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
881
+ window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
882
+ yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
883
+ result = window.opener.yop_poll_do_vote( yop_poll_various_config );
884
+ if( result ) {
885
+ window.close();
886
+ }
887
+ }
888
+ </script>
889
+ </head>
890
+ <body onload="close_window()">
891
+ <div style="margin:auto; width: 100px; height: 100px; text-align: center;">
892
+ <img src="<?php echo YOP_POLL_URL ?>images/loading100x100.gif"
893
+ alt="<?php _e( 'Loading', 'yop_poll' ) ?>"/><br>
894
+ </div>
895
+ </body>
896
+ </html>
897
+ <?php
898
+ $facebook->destroySession();
899
+ die();
900
+ }
901
+
902
+ public function ajax_set_wordpress_vote() {
903
+ $poll_id = yop_poll_base64_decode( $_GET['poll_id'] );
904
+ $unique_id = yop_poll_base64_decode( $_GET['unique_id'] );
905
+ require_once( YOP_POLL_MODELS . 'poll_model.php' );
906
+ $yop_poll_model = new YOP_POLL_Poll_Model( $poll_id );
907
+
908
+ $public_config = array(
909
+ 'poll_options' => array(
910
+ 'share_after_vote' => $yop_poll_model->share_after_vote,
911
+ 'share_name' => html_entity_decode( (string)$yop_poll_model->share_name, ENT_QUOTES, 'UTF-8' ),
912
+ 'share_caption' => html_entity_decode( (string)$yop_poll_model->share_caption, ENT_QUOTES, 'UTF-8' ),
913
+ 'share_description' => html_entity_decode( (string)$yop_poll_model->share_description, ENT_QUOTES, 'UTF-8' ),
914
+ 'share_picture' => html_entity_decode( (string)$yop_poll_model->share_picture, ENT_QUOTES, 'UTF-8' ),
915
+ 'share_poll_name' => html_entity_decode( (string)$yop_poll_model->title, ENT_QUOTES, 'UTF-8' ),
916
+ 'share_link' => $yop_poll_model->poll_options['poll_page_url'] == '' ? site_url() : $yop_poll_model->poll_page_url,
917
+ 'redirect_after_vote' => html_entity_decode( (string)$yop_poll_model->redirect_after_vote, ENT_QUOTES, 'UTF-8' ),
918
+ 'redirect_after_vote_url' => html_entity_decode( (string)$yop_poll_model->redirect_after_vote_url, ENT_QUOTES, 'UTF-8' ),
919
+ )
920
+ );
921
+ ?>
922
+ <!DOCTYPE html>
923
+ <html>
924
+ <head>
925
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
926
+ <script type="text/javascript">
927
+ function close_window() {
928
+ var yop_poll_various_config = new Object();
929
+ yop_poll_various_config.poll_id = '<?php echo yop_poll_base64_decode( $_GET['poll_id'] ) ?>';
930
+ yop_poll_various_config.unique_id = '<?php echo yop_poll_base64_decode( $_GET['unique_id'] ) ?>';
931
+ yop_poll_various_config.poll_location = '<?php echo yop_poll_base64_decode( $_GET['poll_location'] ) ?>';
932
+ yop_poll_various_config.is_modal = <?php echo ( yop_poll_base64_decode( $_GET['is_modal'] ) == 'true' ) ? 'true' : 'false' ?>;
933
+ yop_poll_various_config.vote_loading_image_target = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_target'] ) ?>';
934
+ yop_poll_various_config.vote_loading_image_id = '<?php echo yop_poll_base64_decode( $_GET['vote_loading_image_id'] ) ?>';
935
+ yop_poll_various_config.vote_type = '<?php echo yop_poll_base64_decode( $_GET['vote_type'] ) ?>';
936
+ yop_poll_various_config.facebook_user_details = '<?php echo $facebook_user_details; ?>';
937
+ yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? $_GET['facebook_error'] : '' ?>';
938
+ yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
939
+ window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
940
+ yop_poll_various_config.unique_id ).val( '<?php echo wp_create_nonce( 'yop_poll-'.$poll_id.$unique_id.'-user-actions' ) ?>' );
941
+ result = window.opener.yop_poll_do_vote( yop_poll_various_config );
942
+ if( result ) {
943
+ window.close();
944
+ }
945
+ }
946
+ </script>
947
+ </head>
948
+ <body onload="close_window()">
949
+ <div style="margin:auto; width: 100px; height: 100px; text-align: center;">
950
+ <img src="<?php echo YOP_POLL_URL ?>images/loading100x100.gif"
951
+ alt="<?php _e( 'Loading', 'yop_poll' ) ?>"/><br>
952
+ </div>
953
+ </body>
954
+ </html>
955
+ <?php
956
+ die();
957
+ }
958
+
959
+ public function ajax_is_wordpress_user() {
960
+ global $current_user;
961
+ if( $current_user->ID > 0 ) {
962
+ print '[response]true;' . $current_user->ID . '[/response]';
963
+ }
964
+ else {
965
+ print '[response]false;[/response]';
966
+ }
967
+ die();
968
+ }
969
+
970
+ public function ajax_get_polls_for_editor() {
971
+ //check_ajax_referer( 'yop-poll-editor' );
972
+ if( is_admin() ) {
973
+ require_once( YOP_POLL_MODELS . 'yop_poll_model.php' );
974
+ $yop_polls = Yop_Poll_Model::get_polls_for_view();
975
+ ?>
976
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
977
+ <html xmlns="http://www.w3.org/1999/xhtml">
978
+ <head>
979
+ <title><?php _e( 'Insert Poll', 'yop_poll' ); ?></title>
980
+ <script type="text/javascript"
981
+ src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
982
+ <script type="text/javascript">
983
+ function insertYopPollTinyMce(poll_id, tr_id) {
984
+ tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
985
+ if( isNaN( poll_id ) ) {
986
+ alert( '<?php _e( 'Error: Invalid Yop Poll!\n\nPlease choose the poll again:\n\n', 'yop_poll' ) ?>' );
987
+ }
988
+ else {
989
+ if( poll_id != null && poll_id != '' ) {
990
+ if( tr_id != '' ) {
991
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false,
992
+ '[yop_poll id="' + poll_id + '" tr_id="' +
993
+ tr_id + '"]' );
994
+ }
995
+ else {
996
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false,
997
+ '[yop_poll id="' + poll_id + '"]' );
998
+ }
999
+ }
1000
+ else {
1001
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll]' );
1002
+ }
1003
+ tinyMCEPopup.close();
1004
+ }
1005
+ }
1006
+ </script>
1007
+ </head>
1008
+ <body>
1009
+ <p>
1010
+ <label for="yop-poll-id-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
1011
+ <select class="widefat" name="yop_poll_id" id="yop-poll-id-dialog">
1012
+ <option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
1013
+ <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
1014
+ <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
1015
+ <?php
1016
+ if( count( $yop_polls ) > 0 ) {
1017
+ foreach( $yop_polls as $yop_poll ) {
1018
+ ?>
1019
+ <option value="<?php echo $yop_poll['ID']; ?>"><?php echo esc_html( stripslashes( $yop_poll['poll_title'] ) ); ?></option>
1020
+ <?php
1021
+ }
1022
  }
1023
+ ?>
1024
+ </select>
1025
+ </label>
1026
+ <br/>
1027
+ <label for="yop-poll-tr-id-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span><br>
1028
+ <input class="widefat" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog"/>
1029
+ </label>
1030
+
1031
+
1032
+ <center><input type="button"
1033
+ class="button-primary"
1034
+ value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
1035
+ onclick=" insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value );"/>
1036
+ </center>
1037
+ <br/>
1038
+ <center><input type="button"
1039
+ class="button-primary"
1040
+ value="<?php _e( 'Close', 'yop_poll' ); ?>"
1041
+ onclick="tinyMCEPopup.close();"/></center>
1042
+ </p>
1043
+ </body>
1044
+ </html>
1045
+ <?php
1046
+ }
1047
+ die ();
1048
+ }
1049
+
1050
+ public function ajax_get_polls_for_html_editor() {
1051
+ check_ajax_referer( 'yop-poll-html-editor' );
1052
+ if( is_admin() ) {
1053
+ require_once( YOP_POLL_MODELS . 'yop_poll_model.php' );
1054
+ $yop_polls = Yop_Poll_Model::get_polls_for_view();
1055
+ ?>
1056
+ <p style="text-align: center;">
1057
+ <label for="yop-poll-id-html-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
1058
+ <select class="widefat" name="yop_poll_id" id="yop-poll-id-html-dialog">
1059
+ <option value="-3"><?php _e( 'Display Random Poll', 'yop_poll' ); ?></option>
1060
+ <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
1061
+ <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
1062
+ <?php
1063
+ if( count( $yop_polls ) > 0 ) {
1064
+ foreach( $yop_polls as $yop_poll ) {
1065
+ ?>
1066
+ <option value="<?php echo $yop_poll['ID']; ?>"><?php echo esc_html( stripslashes( $yop_poll['poll_title'] ) ); ?></option>
1067
+ <?php
1068
+ }
1069
+ }
1070
+ ?>
1071
+ </select>
1072
+ </label>
1073
+ <br/><br/>
1074
+ <label for="yop-poll-tr-id-html-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span>
1075
+ <input type="text"
1076
+ name="yop_poll_tr_id"
1077
+ id="yop-poll-tr-id-html-dialog"
1078
+ class="widefat"
1079
+ value=""/>
1080
+ </label>
1081
+
1082
+ <br/> <br/> <input type="button"
1083
+ class=""
1084
+ value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
1085
+ onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value );"/>
1086
+ <br/> <br/> <input type="button"
1087
+ class=""
1088
+ value="<?php _e( 'Close', 'yop_poll' ); ?>"
1089
+ onclick="tb_remove();"/>
1090
+ </p>
1091
+
1092
+ <?php
1093
+ }
1094
+ die ();
1095
+ }
1096
+
1097
+ public function ajax_preview_add_edit() {
1098
+ if( is_admin() ) {
1099
+ if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
1100
+ wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
1101
+ }
1102
+ print Yop_Poll_Model::save_poll( true );
1103
+ }
1104
+ die();
1105
+ }
1106
+
1107
+ function load_editor_functions( $hook ) {
1108
+ global $post;
1109
+
1110
+ if( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
1111
+ $yop_poll_editor_config = array(
1112
+ 'dialog_url' => wp_nonce_url( admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_editor', 'yop-poll-editor' ),
1113
+ 'dialog_html_url' => wp_nonce_url( admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_html_editor', 'yop-poll-html-editor' ),
1114
+ 'name' => __( 'Yop Poll', 'yop_poll' ),
1115
+ 'title' => __( 'Insert Poll', 'yop_poll' ),
1116
+ 'prompt_insert_poll_id' => __( 'Please insert the poll ID:\n\n', 'yop_poll' ),
1117
+ 'prompt_insert_again_poll_id' => __( 'Error: Poll Id must be numeric!\n\nPlease insert the poll ID Again:\n\n', 'yop_poll' )
1118
+ );
1119
+ wp_enqueue_style( 'thickbox' );
1120
+ wp_enqueue_script( 'thickbox' );
1121
+ wp_enqueue_script( 'yop-poll-editor-functions', YOP_POLL_URL . "tinymce/yop-poll-editor-functions.js", 'jquery', YOP_POLL_VERSION, true );
1122
+ wp_localize_script( 'yop-poll-editor-functions', 'yop_poll_editor_config', $yop_poll_editor_config );
1123
+ }
1124
+ }
1125
+ //endregion
1126
+
1127
+ // region TINYMCE
1128
+
1129
+ function register_button( $buttons ) {
1130
+ array_push( $buttons, "separator", "yoppoll" );
1131
+
1132
+ return $buttons;
1133
+ }
1134
+
1135
+ function add_plugin( $plugin_array ) {
1136
+ $plugin_array ['yoppoll'] = YOP_POLL_URL . "tinymce/yop-poll-editor.js";
1137
+
1138
+ return $plugin_array;
1139
+ }
1140
+
1141
+ function my_yop_poll_button( $hook ) {
1142
+ if( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
1143
+ if( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
1144
+ return;
1145
+ }
1146
+
1147
+ if( get_user_option( 'rich_editing' ) == 'true' ) {
1148
+ add_filter( 'mce_external_plugins', array(
1149
+ &$this,
1150
+ 'add_plugin'
1151
+ ) );
1152
+ add_filter( 'mce_buttons', array(
1153
+ &$this,
1154
+ 'register_button'
1155
+ ) );
1156
+ }
1157
+ }
1158
+ }
1159
+ public function add_votes(){
1160
+
1161
+ if( is_admin() ) {
1162
+
1163
+ if( ! check_ajax_referer( 'yop-poll-results_vote_add_vote','yop-poll-results_votes_add_votes', false ) ) {
1164
+
1165
+ wp_die( __yop_poll( 'You are not allowed to access this request.' ) );
1166
+
1167
+ }
1168
+
1169
+
1170
+
1171
+ $pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
1172
 
 
 
 
 
1173
 
1174
+ $pollAdminObj->add_votes();
 
 
 
 
1175
 
1176
+ }
 
 
 
 
1177
 
1178
+ die();
 
 
 
 
1179
 
1180
+ }
1181
+ protected function init() {
1182
+ global $maintenance;
1183
+ $this->add_action( 'plugins_loaded', 'db_update' );
1184
+ $this->add_action( 'init', 'admin_loader', 1 );
1185
+ add_action( 'wpmu_new_blog', array(
1186
+ &$maintenance,
1187
+ 'new_blog'
1188
+ ), 10, 6 );
1189
+ add_action( 'delete_blog', array(
1190
+ &$maintenance,
1191
+ 'delete_blog'
1192
+ ), 10, 2 );
1193
+ add_action( 'plugins_loaded', array(
1194
+ &$maintenance,
1195
+ 'update'
1196
+ ) );
1197
+ }
1198
+ //endregion
1199
+ }
1200
 
 
 
 
 
 
 
1201
 
1202
+ ;
1203
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/bans_admin.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class YOP_POLL_Ban_Admin extends YOP_POLL_Abstract_Admin{
4
+ private static $_instance = NULL;
5
+
6
+ protected function __construct() {
7
+ parent::__construct( 'bans' );
8
+ }
9
+
10
+ public static function get_instance() {
11
+ if ( self::$_instance == NULL ){
12
+ $class = __CLASS__;
13
+ self::$_instance = new $class;
14
+ }
15
+ return self::$_instance;
16
+ }
17
+
18
+ public function manage_bans() {
19
+ switch ( $GLOBALS['page'] ) {
20
+ default:
21
+ $this->manage_options();
22
+ break;
23
+ }
24
+ }
25
+
26
+ public function manage_load_bans() {
27
+ wp_enqueue_script( 'yop-poll-admin-bans-js', YOP_POLL_URL . "js/yop-poll-admin-bans.js", array( 'jquery' ), YOP_POLL_VERSION, true );
28
+ wp_enqueue_script( 'yop-poll-edit-ban-js', YOP_POLL_URL . "js/yop-poll-edit-ban.js", array( 'jquery' ), YOP_POLL_VERSION, true );
29
+ wp_enqueue_script( 'yop-poll-add-edit-ban-js', YOP_POLL_URL . 'js/polls/yop-poll-add-edit.js', array( 'jquery', 'jquery-ui-sortable', 'yop-poll-admin-js' ), YOP_POLL_VERSION, true );
30
+ wp_enqueue_style( 'yop-poll-global-admin-bans-css', YOP_POLL_URL . "css/yop-poll-admin.css", array(), YOP_POLL_VERSION );
31
+ wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
32
+ wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
33
+ }
34
+
35
+ private function manage_options() {
36
+ global $page, $action, $message;
37
+ switch ( $action ) {
38
+ case 'add-ban':
39
+ {
40
+ $message = $this->add_bans( $_POST );
41
+ break;
42
+ }
43
+ case 'delete':
44
+ {
45
+ $message = $this->delete_bans( $_GET );
46
+ break;
47
+ }
48
+ case 'edit-ban':
49
+ {
50
+ $message = $this->edit_bans( $_POST );
51
+ break;
52
+ }
53
+ }
54
+ $this->view_bans();
55
+ }
56
+
57
+ private function view_bans() {
58
+ global $wpdb, $page, $action, $orderby, $order, $period, $message;
59
+ //load all options and display them
60
+ $order_fields = array( 'name', 'type', 'period', 'unit' );
61
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'name' : $GLOBALS['orderby'];
62
+ $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
63
+
64
+ $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
65
+ $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
66
+ $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
67
+
68
+ $data['title'] = __yop_poll( "Poll Bans" );
69
+ $data['REQUEST'] = $_REQUEST;
70
+ $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
71
+ $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
72
+ $data['orderby'] = ( empty ( $data['REQUEST']['orderby'] ) ) ? 'name' : $data['REQUEST']['orderby'];
73
+ $data['order_direction'] ['orderby'] = ( isset( $data['REQUEST']['order'] ) && 'desc' == $data['REQUEST']['order'] ) ? 'asc' : 'desc';
74
+ $data['order_direction_reverse'] ['orderby'] = ( isset( $data['REQUEST']['order'] ) && 'desc' == $data['REQUEST']['order'] ) ? 'desc' : 'asc';
75
+ $data['order_sortable']['orderby'] = 'sorted';
76
+ $data['poll_id'] = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
77
+ $data['type'] = isset ( $_REQUEST ['type'] ) ? $_REQUEST ['type'] : NULL;
78
+ $data['period'] = isset ( $_REQUEST ['period'] ) ? $_REQUEST ['period'] : NULL;
79
+ $data['id'] = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
80
+ $data['yop_polls'] = Yop_Poll_Model::get_polls_filter_search( 'ID', 'asc' );
81
+ $data['search'] = array( 'fields' => array( $wpdb->yop_poll_bans . '.value' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
82
+ $data['total_bans'] = count( Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $data['search'], $data['type'], $data['poll_id'] ) );
83
+ $data['total_bans_pages'] = ceil( $data['total_bans'] / $data['per_page'] );
84
+ if ( intval( $data['page_no'] ) > intval( $data['total_bans_pages'] ) ){
85
+ $page_no = 1;
86
+ }
87
+ $data['bans'] = Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $data['search'], $data['type'], $data['poll_id'], ( $data['page_no'] - 1 ) * $data['per_page'], $data['per_page'] );
88
+
89
+ $args = array( 'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&page_no=%#%', 'total' => $data['total_bans_pages'], 'current' => max( 1, $data['page_no'] ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
90
+ $data['pagination'] = paginate_links( $args );
91
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
92
+ $data['request']['uri'] = $_SERVER["REQUEST_URI"];
93
+ //display
94
+ $data['message'] = array( 'error' => $message['error'], 'succes' => $message['success'] );
95
+ $this->display( 'bans.html', $data );
96
+ }
97
+
98
+ public function add_bans( $request ) {
99
+ global $wpdb, $message;
100
+ $message['success'] = "";
101
+ $message['error'] = "";
102
+ if ( !isset( $request['ban_poll_id'] ) ){
103
+ $message['error'] = __yop_poll( 'You must choose a yop poll! ' );
104
+ }
105
+ else {
106
+ if ( !ctype_digit( $request['ban_poll_id'] ) ){
107
+ $message['error'] = __yop_poll( 'Invalid Yop Poll! Please try again! ' );
108
+ }
109
+ elseif ( !in_array( $request['ban_type'], array( 'ip', 'username', 'email' ) ) ) {
110
+ $message['error'] = __yop_poll( 'You must choose a ban type!', 'yop_poll' );
111
+ }
112
+ elseif ( !isset( $request['ban_period'] ) ) {
113
+ $message['error'] = __yop_poll( 'You must choose a ban period!', 'yop_poll' );
114
+ }
115
+ elseif ( !in_array( $request['ban_unit'], array( 'hours', 'days', 'weeks', 'months' ) ) ) {
116
+ $message['error'] = __yop_poll( 'You must choose a ban unit!', 'yop_poll' );
117
+ }
118
+ elseif ( '' == trim( $request['ban_value'] ) ) {
119
+ $message['error'] = __yop_poll( 'You must choose a ban value!', 'yop_poll' );
120
+ }
121
+ else {
122
+ $ban_textarea = nl2br( $request['ban_value'] );
123
+ $values = explode( '<br />', $ban_textarea );
124
+
125
+ if ( count( $values ) > 0 ){
126
+ foreach ( $values as $value ) {
127
+ if ( '' != trim( $value ) ){
128
+
129
+ $ban = array( 'poll_id' => trim( $request['ban_poll_id'] ), 'type' => trim( $request['ban_type'] ), 'period' => trim( $request['ban_period'] ), 'unit' => trim( $request['ban_unit'] ), 'value' => trim( $value ) );
130
+ if ( !( self::exists( $ban ) ) ){
131
+
132
+
133
+ $ban = self::insert_ban_to_database( $ban );
134
+
135
+ return $ban;
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ }
142
+ }
143
+ return $message;
144
+ }
145
+
146
+ private function exists( $ban ) {
147
+ global $wpdb, $message;
148
+ return $wpdb->get_var( $wpdb->prepare( "
149
+ SELECT id
150
+ FROM $wpdb->yop_poll_bans
151
+ WHERE poll_id in( 0, %d) AND
152
+ (type = %s and period = %s and unit = %s and value = %s )
153
+ LIMIT 0,1
154
+ ", $ban['poll_id'], $ban['type'], $ban['period'], $ban['unit'], $ban['value'] ) );
155
+ }
156
+
157
+
158
+ private static function insert_ban_to_database( $ban ) {
159
+ global $wpdb;
160
+ $response['success'] = "";
161
+ $response['error'] = "";
162
+ if ( check_admin_referer( 'yop-poll-add-edit-ban', 'yop-poll-add-edit-ban' ) ){
163
+ if ( current_user_can( 'manage_yop_polls_bans' ) ){
164
+ $sql = $wpdb->query( $wpdb->prepare( "
165
+ INSERT INTO $wpdb->yop_poll_bans
166
+ ( poll_id,type,value,period ,unit)
167
+ VALUES(%d,%s,%s,%d,%s)
168
+ ", $ban['poll_id'], $ban['type'], $ban['value'], intval( $ban['period'] ), $ban['unit'] ) );
169
+ if ( $sql ){
170
+ $response['success'] = __yop_poll( 'Ban added' );
171
+ $response['insert_id'] = __yop_poll( 'Ban added' );
172
+
173
+ }
174
+ else {
175
+ $response['error'] = __yop_poll( 'Could not insert ban into database! Please try again!' );
176
+ }
177
+ }
178
+ else {
179
+ $response['error'] = __yop_poll( 'You do not have enough permission to add a ban' );
180
+ }
181
+
182
+ return $response;
183
+ }
184
+ else {
185
+ wp_die( __yop_poll( 'You do not have enough permission to add a ban' ) );
186
+ }
187
+
188
+ }
189
+
190
+ public function delete_bans( $request ) {
191
+ global $message;
192
+ $message['success'] = "";
193
+ $message['error'] = "";
194
+
195
+ if ( isset ( $_REQUEST ['yoppollbanscheck'] ) ){
196
+ $bulkbans = ( array )$_REQUEST ['yoppollbanscheck'];
197
+ foreach ( $bulkbans as $ban_id ) {
198
+ $ban_id = ( int )$ban_id;
199
+ $message = self::delete_poll_ban_from_db( $ban_id );
200
+ }
201
+ return $message;
202
+ }
203
+ else {
204
+ if ( isset ( $_REQUEST ['id'] ) ){
205
+ return self::delete_poll_ban_from_db( $request['id'] );
206
+ }
207
+ }
208
+
209
+ return $message;
210
+ }
211
+
212
+
213
+ public function delete_poll_ban_from_db( $ban_id ) {
214
+ global $wpdb;
215
+ $response['success'] = "";
216
+ $response['error'] = "";
217
+
218
+ if ( check_admin_referer( 'yop-poll-bans', 'yop-poll-ban' ) ){
219
+ if ( current_user_can( 'manage_yop_polls_bans' ) ){
220
+ $sql = $wpdb->query( $wpdb->prepare( "
221
+ DELETE FROM $wpdb->yop_poll_bans
222
+ WHERE id = %d
223
+ ", $ban_id ) );
224
+ if ( $sql ){
225
+ $response['success'] = __yop_poll( 'Ban deleted' );
226
+ //$response['insert_id'] = __yop_poll('Ban deleted');
227
+
228
+ }
229
+ else {
230
+ $response['error'] = __yop_poll( 'Could not delete ban from database! Please try again!' );
231
+ }
232
+ }
233
+ else {
234
+ $response['error'] = __yop_poll( 'You do not have enough permission to delete a ban' );
235
+ }
236
+ }
237
+ else {
238
+ wp_die( __yop_poll( 'You do not have enough permission to delete a ban' ) );
239
+ }
240
+ return $response;
241
+
242
+
243
+ }
244
+
245
+ public function edit_bans( $request ) {
246
+ global $wpdb, $message;
247
+ $message['success'] = "";
248
+ $message['error'] = "";
249
+ if ( !isset( $request['ban_poll_id'] ) ){
250
+ $message['error'] = __yop_poll( 'You must choose a yop poll! ' );
251
+ }
252
+ else {
253
+ if ( !ctype_digit( $request['ban_poll_id'] ) ){
254
+ $message['error'] = __yop_poll( 'Invalid Yop Poll! Please try again! ' );
255
+ }
256
+ elseif ( !in_array( $request['ban_type'], array( 'ip', 'username', 'email' ) ) ) {
257
+ $message['error'] = __yop_poll( 'You must choose a ban type!', 'yop_poll' );
258
+ }
259
+ elseif ( !isset( $request['ban_period'] ) ) {
260
+ $message['error'] = __yop_poll( 'You must choose a ban period!', 'yop_poll' );
261
+ }
262
+ elseif ( !in_array( $request['ban_unit'], array( 'hours', 'days', 'weeks', 'months' ) ) ) {
263
+ $message['error'] = __yop_poll( 'You must choose a ban unit!', 'yop_poll' );
264
+ }
265
+ elseif ( '' == trim( $request['ban_value'] ) ) {
266
+ $message['error'] = __yop_poll( 'You must choose a ban value!', 'yop_poll' );
267
+ }
268
+ else {
269
+ $ban_textarea = nl2br( $request['ban_value'] );
270
+ $values = explode( '<br />', $ban_textarea );
271
+
272
+ if ( count( $values ) > 0 ){
273
+ foreach ( $values as $value ) {
274
+ if ( '' != trim( $value ) ){
275
+
276
+ $ban = array( 'poll_id' => trim( $request['ban_poll_id'] ), 'id' => trim( $request['retain_id'] ), 'type' => trim( $request['ban_type'] ), 'period' => trim( $request['ban_period'] ), 'unit' => trim( $request['ban_unit'] ), 'value' => trim( $value ) );
277
+ $ban = self::edit_ban_from_database( $ban );
278
+
279
+ return $ban;
280
+
281
+ }
282
+ }
283
+ }
284
+
285
+ }
286
+ }
287
+ return $message;
288
+ }
289
+
290
+
291
+ public function edit_ban_from_database( $ban ) {
292
+ global $wpdb;
293
+ $response['success'] = "";
294
+ $response['error'] = "";
295
+
296
+ if ( check_admin_referer( 'yop-poll-add-edit-ban', 'yop-poll-add-edit-ban' ) ){
297
+ if ( current_user_can( 'manage_yop_polls_bans' ) ){
298
+ $sql = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->yop_poll_bans SET type = %s ,value = %s ,period= %d ,unit=%s,poll_id = %d WHERE id = %d", $ban['type'], $ban['value'], intval( $ban['period'] ), $ban['unit'], $ban['poll_id'], $ban['id'] ) );
299
+ if ( $sql == "" | $sql ){
300
+ $response['success'] = __yop_poll( 'Ban edited' );
301
+ $response['insert_id'] = __yop_poll( 'Ban edited' );
302
+
303
+ }
304
+ else {
305
+ $response['error'] = __yop_poll( 'Could not edit ban from database! Please try again!' );
306
+ }
307
+ }
308
+ else {
309
+ $response['error'] = __yop_poll( 'You do not have enough permission to edit a ban' );
310
+ }
311
+
312
+ return $response;
313
+
314
+
315
+ }
316
+ else {
317
+ wp_die( __yop_poll( 'You do not have enough permission to edit a ban' ) );
318
+ }
319
+
320
+
321
+ }
322
+ }
inc/capabilities.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class YOP_POLL_Capabilities{
4
+
5
+ private static $_instance = NULL;
6
+ private $capabilities = array(
7
+ 'manage_yop_polls_options' => array(
8
+ 'administrator' => true,
9
+ 'editor' => true,
10
+ 'author' => false,
11
+ 'contributor' => false,
12
+ 'subscriber' => false
13
+ ),
14
+ 'manage_yop_polls_imports' => array(
15
+ 'administrator' => true,
16
+ 'editor' => true,
17
+ 'author' => false,
18
+ 'contributor' => false,
19
+ 'subscriber' => false
20
+ ),
21
+ 'manage_yop_polls_bans' => array(
22
+ 'administrator' => true,
23
+ 'editor' => false,
24
+ 'author' => false,
25
+ 'contributor' => false,
26
+ 'subscriber' => false
27
+ ),
28
+ 'delete_yop_polls' => array(
29
+ 'administrator' => true,
30
+ 'editor' => false,
31
+ 'author' => false,
32
+ 'contributor' => false,
33
+ 'subscriber' => false
34
+ ),
35
+ 'delete_own_yop_polls' => array(
36
+ 'administrator' => true,
37
+ 'editor' => true,
38
+ 'author' => true,
39
+ 'contributor' => false,
40
+ 'subscriber' => false
41
+ ),
42
+ 'edit_yop_polls' => array(
43
+ 'administrator' => true,
44
+ 'editor' => true,
45
+ 'author' => false,
46
+ 'contributor' => false,
47
+ 'subscriber' => false
48
+ ),
49
+ 'edit_own_yop_polls' => array(
50
+ 'administrator' => true,
51
+ 'editor' => true,
52
+ 'author' => true,
53
+ 'contributor' => false,
54
+ 'subscriber' => false
55
+ ),
56
+ 'clone_yop_polls' => array(
57
+ 'administrator' => true,
58
+ 'editor' => true,
59
+ 'author' => false,
60
+ 'contributor' => false,
61
+ 'subscriber' => false
62
+ ),
63
+ 'clone_own_yop_polls' => array(
64
+ 'administrator' => true,
65
+ 'editor' => true,
66
+ 'author' => true,
67
+ 'contributor' => false,
68
+ 'subscriber' => false
69
+ ),
70
+ 'view_yop_polls_logs' => array(
71
+ 'administrator' => true,
72
+ 'editor' => true,
73
+ 'author' => false,
74
+ 'contributor' => false,
75
+ 'subscriber' => false
76
+ ), 'view_yop_polls_imports' => array(
77
+ 'administrator' => true,
78
+ 'editor' => true,
79
+ 'author' => false,
80
+ 'contributor' => false,
81
+ 'subscriber' => false
82
+ ),
83
+ 'view_own_yop_polls_logs' => array(
84
+ 'administrator' => true,
85
+ 'editor' => true,
86
+ 'author' => true,
87
+ 'contributor' => false,
88
+ 'subscriber' => false
89
+ ),
90
+ 'view_yop_polls_results' => array(
91
+ 'administrator' => true,
92
+ 'editor' => true,
93
+ 'author' => false,
94
+ 'contributor' => false,
95
+ 'subscriber' => false
96
+ ),
97
+ 'view_own_yop_polls_results' => array(
98
+ 'administrator' => true,
99
+ 'editor' => true,
100
+ 'author' => true,
101
+ 'contributor' => false,
102
+ 'subscriber' => false
103
+ ),
104
+ 'reset_yop_polls_stats' => array(
105
+ 'administrator' => true,
106
+ 'editor' => true,
107
+ 'author' => false,
108
+ 'contributor' => false,
109
+ 'subscriber' => false
110
+ ),
111
+ 'reset_own_yop_polls_stats' => array(
112
+ 'administrator' => true,
113
+ 'editor' => true,
114
+ 'author' => true,
115
+ 'contributor' => false,
116
+ 'subscriber' => false
117
+ ),
118
+ 'delete_yop_polls_logs' => array(
119
+ 'administrator' => true,
120
+ 'editor' => true,
121
+ 'author' => false,
122
+ 'contributor' => false,
123
+ 'subscriber' => false
124
+ ),
125
+ 's' => array(
126
+ 'administrator' => true,
127
+ 'editor' => true,
128
+ 'author' => true,
129
+ 'contributor' => false,
130
+ 'subscriber' => false
131
+ ),
132
+ 'edit_yop_polls_templates' => array(
133
+ 'administrator' => true,
134
+ 'editor' => true,
135
+ 'author' => false,
136
+ 'contributor' => false,
137
+ 'subscriber' => false
138
+ ),
139
+ 'edit_own_yop_polls_templates' => array(
140
+ 'administrator' => true,
141
+ 'editor' => true,
142
+ 'author' => true,
143
+ 'contributor' => false,
144
+ 'subscriber' => false
145
+ ),
146
+ 'delete_yop_polls_templates' => array(
147
+ 'administrator' => true,
148
+ 'editor' => true,
149
+ 'author' => false,
150
+ 'contributor' => false,
151
+ 'subscriber' => false
152
+ ),
153
+ 'delete_own_yop_polls_templates' => array(
154
+ 'administrator' => true,
155
+ 'editor' => true,
156
+ 'author' => true,
157
+ 'contributor' => false,
158
+ 'subscriber' => false
159
+ ),
160
+ 'clone_yop_polls_templates' => array(
161
+ 'administrator' => true,
162
+ 'editor' => true,
163
+ 'author' => false,
164
+ 'contributor' => false,
165
+ 'subscriber' => false
166
+ ),
167
+ 'clone_own_yop_polls_templates' => array(
168
+ 'administrator' => true,
169
+ 'editor' => true,
170
+ 'author' => true,
171
+ 'contributor' => false,
172
+ 'subscriber' => false
173
+ ),
174
+ 'import_wp_polls' => array(
175
+ 'administrator' => true,
176
+ 'editor' => true,
177
+ 'author' => true,
178
+ 'contributor' => false,
179
+ 'subscriber' => false
180
+ ),
181
+ 'add_yop_poll_votes' => array(
182
+ 'administrator' => true,
183
+ 'editor' => true,
184
+ 'author' => true,
185
+ 'contributor' => false,
186
+ 'subscriber' => false
187
+ ),
188
+ 'become_yop_poll_pro' => array(
189
+ 'administrator' => true,
190
+ 'editor' => false,
191
+ 'author' => false,
192
+ 'contributor' => false,
193
+ 'subscriber' => false
194
+ )
195
+ );
196
+
197
+ public static function get_instance() {
198
+ if ( self::$_instance == NULL ){
199
+ $class = __CLASS__;
200
+ self::$_instance = new $class;
201
+ }
202
+ return self::$_instance;
203
+ }
204
+
205
+ private function __construct() {
206
+ }
207
+
208
+ private function __clone() {
209
+ }
210
+
211
+ public function install_capabilities() {
212
+ $roles = $GLOBALS['wp_roles']->roles;
213
+ global $wp_roles;
214
+
215
+ if ( ! isset( $roles ) ) {
216
+ $wp_roles = new WP_Roles();
217
+ $roles=$wp_roles->get_names();
218
+ }
219
+ if ( is_array( $roles) ){
220
+ foreach ( $roles as $key => $value ) {
221
+ $this->add_role_capabilities( $key );
222
+ }
223
+ }
224
+ }
225
+
226
+ public function uninstall_capabilities() {
227
+ $roles = $GLOBALS['wp_roles']->roles;
228
+ if ( is_array( $roles ) ){
229
+ foreach ( $roles as $key => $value ) {
230
+ $this->remove_role_capabilities( $key );
231
+ }
232
+ }
233
+ }
234
+
235
+ public function add_role_capabilities( $role_name ) {
236
+
237
+ foreach ( $this->capabilities as $capability => $roles ) {
238
+ if ( isset( $roles[$role_name] ) ){
239
+ if ( $roles[$role_name] ){
240
+ $this->add_capability( $role_name, $capability );
241
+ }
242
+ }
243
+ /*else
244
+ $this->remove_capability( $role_name, $capability );*/
245
+ }
246
+ }
247
+
248
+ public function remove_role_capabilities( $role_name ) {
249
+ foreach ( $this->capabilities as $capability => $roles ) {
250
+ $this->remove_capability( $role_name, $capability );
251
+ }
252
+ }
253
+
254
+ public function add_capability( $role_name, $capability ) {
255
+ $role = get_role( $role_name );
256
+ if ( $role ){
257
+ $role->add_cap( $capability );
258
+ }
259
+ }
260
+
261
+ public function remove_capability( $role_name, $capability ) {
262
+ $role = get_role( $role_name );
263
+ if ( $role ){
264
+ $role->remove_cap( $capability );
265
+ }
266
+ }
267
+ }
inc/config.php CHANGED
@@ -1,16 +1 @@
1
- <?php
2
- class Yop_Poll_Config {
3
- protected $config;
4
-
5
- public function __construct( array $config ) {
6
- $this->config = $config;
7
- }
8
-
9
- public function __get( $name ) {
10
- $value = false;
11
- if ( array_key_exists( $name, $this->config ) ) {
12
- $value = $this->config[$name];
13
- }
14
- return $value;
15
- }
16
- }
17
  class Yop_Poll_Config {
18
  protected $config;
19
  public function __construct( array $config ) {
20
  $this->config = $config;
21
  }
22
  public function __get( $name ) {
23
  $value = false;
24
  if ( array_key_exists( $name, $this->config ) ) {
25
  $value = $this->config[ $name ];
26
  }
27
  return $value;
28
  }
29
  public function __set( $name, $value ) {
30
  $this->config[ $name ] = $value;
31
  }
32
  }
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
  }
inc/db_schema.php CHANGED
@@ -1,356 +1,685 @@
1
  <?php
2
- class Yop_Poll_DbSchema
3
- {
4
- /**
5
- * creating all poll tables
6
- * @static
7
- *
8
- */
9
- public static function create_poll_database_tables() {
10
- global $wpdb;
11
- global $current_user;
12
-
13
- Yop_Poll_DbSchema::create_polls_table();
14
- Yop_Poll_DbSchema::create_polls_templates_table();
15
- Yop_Poll_DbSchema::create_poll_answers_table();
16
- Yop_Poll_DbSchema::create_poll_custom_fields_table();
17
- Yop_Poll_DbSchema::create_poll_meta_table();
18
- Yop_Poll_DbSchema::create_poll_answer_meta_table();
19
- Yop_Poll_DbSchema::create_poll_logs_table();
20
- Yop_Poll_DbSchema::create_poll_voters_table();
21
- Yop_Poll_DbSchema::create_poll_bans_table();
22
- Yop_Poll_DbSchema::create_poll_votes_custom_fields_table();
23
- Yop_Poll_DbSchema::create_poll_facebook_users_table();
24
-
25
- $optin_box_modal_options = array(
26
- 'show' => 'yes',
27
- 'last_show_date' => Yop_Poll_Model::get_mysql_curent_date(),
28
- 'modal_had_submit' => 'no',
29
- 'sidebar_had_submit' => 'no',
30
- );
31
 
32
- $pro_options = array(
33
- 'pro_key' => '',
34
- 'pro_api_key' => '',
35
- 'pro_api_server_url' => 'http://www.yop-poll.com/pro',
36
- 'pro_user' => 'no'
37
- );
38
 
39
- $sitename = strtolower( $_SERVER['SERVER_NAME'] );
40
- if ( substr( $sitename, 0, 4 ) == 'www.' ) {
41
- $sitename = substr( $sitename, 4 );
42
- }
43
 
44
- $default_options = array(
45
- 'poll_name_html_tags' => 'yes',
46
- 'poll_question_html_tags' => 'yes',
47
- 'poll_answer_html_tags' => 'yes',
48
- 'poll_custom_field_html_tags' => 'yes',
49
- 'create_poll_page' => 'yes',
50
- 'auto_generate_poll_page' => 'no',
51
- 'has_auto_generate_poll_page' => 'no',
52
- 'poll_page_url' => '',
53
- 'allow_other_answers' => 'yes',
54
- 'other_answers_label' => 'Other',
55
- 'display_other_answers_values' => 'no',
56
- 'allow_multiple_answers' => 'no',
57
- 'allow_multiple_answers_number' => 1,
58
- 'allow_multiple_answers_min_number' => 1,
59
- 'display_answers' => 'vertical',
60
- 'display_answers_tabulated_cols' => 1,
61
- 'display_results' => 'vertical',
62
- 'display_results_tabulated_cols' => 1,
63
- 'is_default_answer' => 'no',
64
- 'use_template_bar' => 'yes',
65
- 'bar_background' => 'FBD55E',
66
- 'bar_height' => 10,
67
- 'bar_border_color' => 'EDB918',
68
- 'bar_border_width' => 1,
69
- 'bar_border_style' => 'solid',
70
- 'sorting_answers' => 'exact',
71
- 'sorting_answers_direction' => 'asc',
72
- 'sorting_results' => 'exact',
73
- 'sorting_results_direction' => 'asc',
74
- 'start_date' => Yop_Poll_Model::get_mysql_curent_date(),
75
- 'end_date' => '9999-12-31 23:59:59',
76
- 'never_expire' => 'yes',
77
- 'view_results' => 'after',
78
- 'answer_result_label' => '- %POLL-ANSWER-RESULT-PERCENTAGES% ( %POLL-ANSWER-RESULT-VOTES% )',
79
- 'view_results_type' => 'votes-number',
80
- 'view_results_start_date' => '',
81
- 'view_results_link' => 'yes',
82
- 'view_back_to_vote_link' => 'yes',
83
- 'singular_answer_result_votes_number_label' => 'vote',
84
- 'plural_answer_result_votes_number_label' => 'votes',
85
- 'vote_button_label' => 'Vote',
86
- 'view_results_link_label' => 'View Results',
87
- 'view_back_to_vote_link_label' => 'Back To Vote',
88
- 'view_total_votes_label' => 'Total Votes %POLL-TOTAL-VOTES%',
89
- 'view_total_answers_label' => 'Total Answers %POLL-TOTAL-ANSWERS%',
90
- 'view_total_voters_label' => 'Total Answers %POLL-TOTAL-VOTERS%',
91
- 'view_total_answers' => 'yes',
92
- 'view_total_voters' => 'yes',
93
- 'view_total_votes' => 'yes',
94
- 'view_poll_archive_link' => 'yes',
95
- 'view_poll_archive_link_label' => 'View Poll Archive',
96
- 'poll_archive_url' => home_url().'/yop-poll-archive',
97
- 'vote_permisions' => 'guest-registered',
98
- 'vote_permisions_facebook' => 'no',
99
- 'vote_permisions_facebook_label' => 'Vote as Facebook User',
100
- 'vote_permisions_wordpress' => 'no',
101
- 'vote_permisions_wordpress_label' => 'Vote as Wordpress User',
102
- 'vote_permisions_anonymous' => 'no',
103
- 'vote_permisions_anonymous_label' => 'Vote as Anonymous User',
104
- 'blocking_voters' => 'dont-block',
105
- 'blocking_voters_interval_value' => 30,
106
- 'blocking_voters_interval_unit' => 'days',
107
- 'template' => '1',
108
- 'widget_template' => '1',
109
- 'template_width' => '200px',
110
- 'widget_template_width' => '200px',
111
- 'show_in_archive' => 'yes',
112
- 'archive_order' => '1',
113
- 'archive_polls_per_page' => '5',
114
- 'percentages_decimals' => '0',
115
- 'use_default_loading_image' => 'yes',
116
- 'loading_image_url' => '',
117
- 'use_captcha' => 'no',
118
- 'share_after_vote' => 'no',
119
- 'share_picture' => '',
120
- 'share_name' => '',
121
- 'share_caption' => '',
122
- 'share_description' => '',
123
- 'redirect_after_vote' => 'no',
124
- 'redirect_after_vote_url' => '',
125
- 'limit_number_of_votes_per_user' => 'no',
126
- 'number_of_votes_per_user' => 1,
127
- 'message_after_vote' => 'Thank you for your vote!',
128
- 'start_scheduler' => 'no',
129
- 'schedule_reset_poll_stats' => 'no',
130
- 'schedule_reset_poll_date' => current_time( 'timestamp' ),
131
- 'schedule_reset_poll_recurring_value' => 9999,
132
- 'schedule_reset_poll_recurring_unit' => 'day',
133
- 'view_results_permissions' => 'guest-registered',
134
- 'date_format' => 'd/m/Y H:i:s',
135
- 'add_other_answers_to_default_answers' => 'no',
136
- 'send_email_notifications' => 'no',
137
- 'email_notifications_from_name' => 'Yop Poll',
138
- 'email_notifications_from_email' => 'yop-poll@' . $sitename,
139
- 'email_notifications_recipients' => '',
140
- 'email_notifications_subject' => 'New Vote',
141
- 'email_notifications_body' => '<p>A new vote was registered on [VOTE_DATE] for [POLL_NAME]</p>
142
- <p>Vote Details:</p>
143
- <p><b>Question:</b> [QUESTION]</p>
144
- <p><b>Answers:</b> <br />[ANSWERS]</p>
145
- <p><b>Custom Fields:</b> <br />[CUSTOM_FIELDS]</p>
146
- <p><b>Vote ID:</b> <br />[VOTE_ID]</p>',
147
- );
148
 
149
- if ( ! get_option( "yop_poll_version" ) ) {
 
150
 
151
- $poll_archive_page = get_page_by_path('yop-poll-archive', ARRAY_A );
152
- if ( ! $poll_archive_page ) {
153
- $_p = array();
154
- $_p['post_title'] = 'Yop Poll Archive';
155
- $_p['post_content'] = "[yop_poll_archive]";
156
- $_p['post_status'] = 'publish';
157
- $_p['post_type'] = 'page';
158
- $_p['comment_status'] = 'open';
159
- $_p['ping_status'] = 'open';
160
- $_p['post_category'] = array(1); // the default 'Uncategorised'
161
 
162
- $poll_archive_page_id = wp_insert_post( $_p );
163
 
164
- }
165
- else {
166
- $poll_archive_page_id = $poll_archive_page['ID'];
167
- }
168
 
169
- $default_options['poll_archive_url'] = get_permalink( $poll_archive_page_id );
170
-
171
- //addind default options
172
- update_option( 'yop_poll_options', $default_options );
173
- update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
174
- update_option( 'yop_poll_pro_options', $pro_options );
175
-
176
- wp_get_current_user();
177
- //adding default poll
178
- $poll_author = $current_user->ID > 0 ? $current_user->ID : 0;
179
- $wpdb->query(
180
- "
181
- INSERT INTO `". $wpdb->yop_polls . "` (`poll_author`, `name`, `question`, `start_date`, `end_date`, `total_votes`, `total_answers`, `status`, `date_added`, `last_modified`, `show_in_archive`) VALUES
182
- (". $poll_author .", 'Default Yop Poll', 'How is my plugin?', '".current_time( 'mysql' )."', '9999-12-31 23:59:59', 0, 0, 'open', '".current_time( 'mysql' )."', '".current_time( 'mysql' )."', '".$default_options['show_in_archive']."')
183
- "
184
- );
185
- $poll_id = $wpdb->insert_id;
186
- $wpdb->query(
187
- "
188
- INSERT INTO `". $wpdb->yop_poll_answers . "` (`poll_id`, `answer`, `type`, `votes`, `status`) VALUES
189
- (" . $poll_id . ", 'Good', 'default', 0, 'active'),
190
- (" . $poll_id . ", 'Very Good', 'default', 0, 'active'),
191
- (" . $poll_id . ", 'Bad', 'default', 0, 'active'),
192
- (" . $poll_id . ", 'Other', 'other', 0, 'active')
193
- "
194
- );
195
 
196
- $templates = array( 'White', 'Grey', 'Dark', 'Blue v1', 'Blue v2', 'Blue v3', 'Red v1', 'Red v2', 'Red v3', 'Green v1', 'Green v2', 'Green v3', 'Orange v1', 'Orange v2', 'Orange v3' );
197
- foreach( $templates as $template ) {
198
- $is_template_in_database = self::is_template_in_database( $template );
199
- if ( $is_template_in_database )
200
- self::add_update_templates_in_database( 'update', $template );
201
- else
202
- self::add_update_templates_in_database( 'add', $template );
203
- }
204
 
205
- update_option( "yop_poll_first_install_date", Yop_Poll_Model::get_mysql_curent_date() );
206
- update_option( "yop_poll_admin_notices_donate", 'yes' );
207
- }
208
 
209
- update_option( "yop_poll_version", $wpdb->yop_poll_version );
210
- }
211
 
212
- public static function is_template_in_database( $template_name ) {
213
- global $wpdb;
214
- $is_template = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM ". $wpdb->yop_poll_templates . " WHERE name = %s LIMIT 0, 1", $template_name ) );
215
- return $is_template;
216
- }
217
 
218
- public static function add_update_templates_in_database( $action = 'add', $template_name ) {
219
- global $wpdb;
220
- global $current_user;
221
- wp_get_current_user();
222
- if ( 'add' == $action ) {
223
- $sql = "INSERT INTO `" . $wpdb->yop_poll_templates . "` SET ";
224
- $sql .= $wpdb ->prepare( "`name` = %s, ", $template_name );
225
- $sql .= $wpdb ->prepare( "`template_author` = %d, ", ( $current_user->ID > 0 ) ? $current_user->ID : 0 );
226
- }
227
- else
228
- $sql = "UPDATE `" . $wpdb->yop_poll_templates . "` SET ";
229
-
230
- $before_vote_template = <<<NOWDOC
231
- <div id="yop-poll-name-%POLL-ID%" class="yop-poll-name">%POLL-NAME%</div>
232
- <div id="yop-poll-question-%POLL-ID%" class="yop-poll-question">%POLL-QUESTION%</div>
233
- <div id="yop-poll-answers-%POLL-ID%" class="yop-poll-answers">
234
- <ul>
235
- [ANSWER_CONTAINER]
236
- <li class="yop-poll-li-answer-%POLL-ID%">
237
- %POLL-ANSWER-CHECK-INPUT%
238
- %POLL-ANSWER-LABEL%
239
- <span class="yop-poll-results-text-%POLL-ID%">%POLL-ANSWER-RESULT-LABEL%</span>
240
- %POLL-ANSWER-RESULT-BAR%
241
- </li>
242
- [/ANSWER_CONTAINER]
243
- [OTHER_ANSWER_CONTAINER]
244
- <li class="yop-poll-li-answer-%POLL-ID%">
245
- %POLL-OTHER-ANSWER-CHECK-INPUT%
246
- %POLL-OTHER-ANSWER-LABEL%
247
- <span class="yop-poll-results-text-%POLL-ID%">%POLL-ANSWER-RESULT-LABEL%</span>
248
- %POLL-OTHER-ANSWER-TEXT-INPUT%
249
- %POLL-ANSWER-RESULT-BAR%
250
- </li>
251
- [/OTHER_ANSWER_CONTAINER]
252
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  </div>
254
- <div id="yop-poll-custom-%POLL-ID%">
255
- <ul>
256
- [CUSTOM_FIELD_CONTAINER]
257
- <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>
258
- [/CUSTOM_FIELD_CONTAINER]
259
- </ul>
260
- </div>
261
  [CAPTCHA_CONTAINER]
262
- <div id="yop-poll-captcha-%POLL-ID%">
263
- <div class="yop-poll-captcha-image-div" id="yop-poll-captcha-image-div-%POLL-ID%">
264
- %CAPTCHA-IMAGE%
265
- <div class="yop-poll-captcha-helpers-div" id="yop-poll-captcha-helpers-div-%POLL-ID%">
266
  %RELOAD-CAPTCHA-IMAGE%
267
  </div>
268
- <div class="yop_poll_clear"></div>
269
  </div>
270
  %CAPTCHA-LABEL%
271
- <div class="yop-poll-captcha-input-div" id="yop-poll-captcha-input-div-%POLL-ID%">%CAPTCHA-INPUT%</div>
272
  </div>
273
  [/CAPTCHA_CONTAINER]
274
- <div id="yop-poll-vote-%POLL-ID%" class="yop-poll-footer">
275
  <div>%POLL-VOTE-BUTTON%</div>
276
- <div id="yop-poll-results-%POLL-ID%">%POLL-VIEW-RESULT-LINK%</div>
277
- <div>%POLL-TOTAL-ANSWERS%</div> <div>%POLL-TOTAL-VOTES%</div>
278
  </div>
279
  NOWDOC;
280
- $before_vote_template = addslashes($before_vote_template);
281
-
282
- $after_vote_template = <<<NOWDOC
283
- <div id="yop-poll-name-%POLL-ID%" class="yop-poll-name">%POLL-NAME%</div>
284
- <div id="yop-poll-question-%POLL-ID%" class="yop-poll-question">%POLL-QUESTION%</div>
285
- <div id="yop-poll-answers-%POLL-ID%" class="yop-poll-answers">
286
- <ul>
287
- [ANSWER_RESULT_CONTAINER]
288
- <li class="yop-poll-li-result-%POLL-ID%">
289
- <label class="pds-feedback-label-%POLL-ID%">
290
- <span class="pds-answer-text-%POLL-ID%">%POLL-ANSWER-LABEL%</span>
291
- <span class="pds-feedback-result-%POLL-ID%">
292
- <span class="pds-feedback-per-%POLL-ID%"> %POLL-ANSWER-RESULT-LABEL%</span>
293
- </span>
294
- </label>
295
- <div>
296
- %POLL-ANSWER-RESULT-BAR%
297
- </div>
298
- </li>
299
- [/ANSWER_RESULT_CONTAINER]
300
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  </div>
302
- <div id="yop-poll-vote-%POLL-ID%" class="yop-poll-footer">
303
- <div>%POLL-TOTAL-ANSWERS%</div>
304
- <div>%POLL-TOTAL-VOTES%</div>
305
- <div id="yop-poll-back-%POLL-ID%">%POLL-BACK-TO-VOTE-LINK%</div>
 
 
306
  </div>
307
  NOWDOC;
308
- $after_vote_template = addslashes($after_vote_template);
309
 
310
- $before_start_date_template = <<<NOWDOC
311
  This poll is about to<br>
312
- start at %POLL-START-DATE%<br>
313
- and finish at %POLL-END-DATE%<br>
314
  NOWDOC;
315
- $before_start_date_template = addslashes($before_start_date_template);
316
 
317
- $after_end_date_template = <<<NOWDOC
318
  This poll is closed!
319
  Poll activity: <br>
320
- start_date %POLL-START-DATE%<br>
321
- end_date %POLL-END-DATE%<br>
322
 
323
  Poll Results:
324
- <div id="yop-poll-question-%POLL-ID%" class="yop-poll-question">%POLL-QUESTION%</div>
325
- <div id="yop-poll-answers-1" class="yop-poll-answers">
326
- <ul>
327
- [ANSWER_RESULT_CONTAINER]
328
- <li class="yop-poll-li-result-%POLL-ID%">
329
- <label class="pds-feedback-label">
330
- <span class="pds-answer-text">%POLL-ANSWER-LABEL%</span>
331
- <span class="pds-feedback-result">
332
- <span class="pds-feedback-per"> %POLL-ANSWER-RESULT-LABEL%</span>
 
 
 
 
 
 
 
 
 
 
 
333
  </span>
334
- </label>
335
- <span class="pds-clear" style="display: block;clear: both;height:1px;line-height:1px;"> </span>
336
- %POLL-ANSWER-RESULT-BAR%
337
- </li>
338
- [/ANSWER_RESULT_CONTAINER]
339
- </ul>
 
 
 
 
 
 
340
  </div>
341
- %POLL-VOTE-BUTTON%
342
  NOWDOC;
343
- $after_end_date_template = addslashes($after_end_date_template);
344
 
345
- $js = <<<NOWDOC
346
  function stripBorder_%POLL-ID%(object) {
347
  object.each(function() {
348
  if( parseInt(jQuery(this).width() ) > 0) {
349
- jQuery(this).width(
350
- parseInt(
351
- jQuery(this).width() ) -
352
- parseInt(jQuery(this).css("border-left-width")) -
353
- parseInt(jQuery(this).css("border-right-width"))
354
  );
355
  }
356
  else {
@@ -360,26 +689,26 @@ function stripBorder_%POLL-ID%(object) {
360
  });
361
  }
362
  function stripPadding_%POLL-ID%(object) {
363
- object.each(function() {
364
- jQuery(this).width(
365
- parseInt( jQuery(this).width() ) -
366
- parseInt(jQuery(this).css("padding-left")) -
367
- parseInt(jQuery(this).css("padding-left"))
368
  );
369
  });
370
  }
371
 
372
  function strip_results_%POLL-ID%() {
373
- stripPadding_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%") );
374
  stripBorder_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%") );
375
  }
376
 
377
  jQuery(document).ready(function(e) {
378
- if(typeof window.strip_results_%POLL-ID% == "function")
379
  strip_results_%POLL-ID%();
380
- if(typeof window.tabulate_answers_%POLL-ID% == "function")
381
  tabulate_answers_%POLL-ID%();
382
- if(typeof window.tabulate_results_%POLL-ID% == "function")
383
  tabulate_results_%POLL-ID%();
384
  });
385
 
@@ -388,9 +717,33 @@ function equalWidth_%POLL-ID%(obj, cols, findWidest ) {
388
  if ( findWidest ) {
389
  obj.each(function() {
390
  var thisWidth = jQuery(this).width();
391
- width = parseInt(thisWidth / cols);
392
- jQuery(this).width(width);
393
- jQuery(this).css("float", "left");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  });
395
  }
396
  else {
@@ -398,23 +751,24 @@ function equalWidth_%POLL-ID%(obj, cols, findWidest ) {
398
  obj.each(function() {
399
  var thisWidth = jQuery(this).width();
400
  if(thisWidth > widest) {
401
- widest = thisWidth;
402
- }
403
  });
404
- width = parseInt( widest / cols);
405
- obj.width(width);
406
- obj.css("float", "left");
407
- }
408
  }
409
 
410
  function tabulate_answers_%POLL-ID%() {
 
411
  equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%"), %ANSWERS-TABULATED-COLS% );
412
- //equalWidth_%POLL-ID%( jQuery(\"#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div \"), %ANSWERS-TABULATED-COLS%, true );
413
  }
414
 
415
  function tabulate_results_%POLL-ID%() {
416
- equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%"), %RESULTS-TABULATED-COLS% );
417
- //equalWidth_%POLL-ID%( jQuery(\"#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div \"), %RESULTS-TABULATED-COLS%, true );
418
  }
419
 
420
  jQuery(document).ready(function(){
@@ -425,327 +779,2664 @@ function runOnPollStateChange_%POLL-ID%() {
425
 
426
  };
427
  NOWDOC;
428
- $js = addslashes($js);
 
429
 
430
- $sql .= "`before_vote_template` = '$before_vote_template',
431
- `after_vote_template` = '$after_vote_template',
432
- `before_start_date_template` = '$before_start_date_template',
433
- `after_end_date_template` = '$after_end_date_template',";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
 
435
- switch ( $template_name ) {
436
- case 'White': { //White
437
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:10px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#555; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#555; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
438
- break;
439
- }
440
- case 'Grey': {//Grey
441
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#eee;\r\n padding:10px;\r\n color:#000;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#000; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#000; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
442
- break;
443
- }
444
- case 'Dark': { //Dark
445
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#555;\r\n padding:10px;\r\n color:#fff;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#333333; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
446
- break;
447
- }
448
- case 'Blue v1': {//Blue v1
449
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#327BD6;\r\n padding:10px;\r\n color:#fff;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
450
- break;
451
- }
452
- case 'Blue v2': {//Blue v2
453
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:0px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-weight:bold;\r\n background:#327BD6;\r\n color:#fff;\r\n padding:5px;\r\n text-align:center;\r\n font-size:12px;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#327BD6; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#327BD6; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
454
- break;
455
- }
456
- case 'Blue v3': {//Blue v3
457
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:10px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n border:5px solid #327BD6;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#327BD6; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#327BD6; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
458
- break;
459
- }
460
- case 'Red v1': { //Red v1
461
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#B70004;\r\n padding:10px;\r\n color:#fff;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
462
- break;
463
- }
464
- case 'Red v2': {//Red v2
465
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:0px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-weight:bold;\r\n background:#B70004;\r\n color:#fff;\r\n padding:5px;\r\n text-align:center;\r\n font-size:12px;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#B70004; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#B70004; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
466
- break;
467
- }
468
- case 'Red v3': {//Red v3
469
- $sql .= "`css`= '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:10px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n border:5px solid #B70004;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#B70004; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#B70004; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
470
- break;
471
- }
472
- case 'Green v1': { //Green v1
473
- $sql .= "`css`= '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#3F8B43;\r\n padding:10px;\r\n color:#fff;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:00FF00;\r\n}',";
474
- break;
475
- }
476
- case 'Green v2': { //Green v2
477
- $sql .= "`css`= '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:0px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-weight:bold;\r\n background:#3F8B43;\r\n color:#fff;\r\n padding:5px;\r\n text-align:center;\r\n font-size:12px;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#3F8B43; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#3F8B43; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
478
- break;
479
- }
480
- case 'Green v3': { //Green v3
481
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:10px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n border:5px solid #3F8B43;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#3F8B43; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#3F8B43; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n} \r\n jQuery(document).ready(function(){ \r\n runOnPollStateChange_%POLL-ID%(); \r\n }); \r\n function runOnPollStateChange_%POLL-ID%() {};',";
482
- break;
483
- }
484
- case 'Orange v1':{ //Orange v1
485
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#FB6911;\r\n padding:10px;\r\n color:#fff;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#fff; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
486
- break;
487
- }
488
- case 'Orange v2':{ //Orange v2
489
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:0px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-weight:bold;\r\n background:#FB6911;\r\n color:#fff;\r\n padding:5px;\r\n text-align:center;\r\n font-size:12px;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#FB6911; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#FB6911; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
490
- break;
491
- }
492
- case 'Orange v3':{ //Orange v3
493
- $sql .= "`css` = '#yop-poll-container-%POLL-ID% {\r\n width:%POLL-WIDTH%;\r\n background:#fff;\r\n padding:10px;\r\n color:#555;\r\n overflow:hidden;\r\n font-size:12px;\r\n border:5px solid #FB6911;\r\n}\r\n#yop-poll-name-%POLL-ID% {\r\n font-size:14px;\r\n font-weight:bold;\r\n}\r\n\r\n#yop-poll-question-%POLL-ID% {\r\n font-size:14px;\r\n margin:5px 0px;\r\n}\r\n#yop-poll-answers-%POLL-ID% { }\r\n#yop-poll-answers-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li { \r\n font-style:normal;\r\n margin:0px 0px 10px 0px;\r\n padding:0px;\r\n font-size:12px;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li input { \r\n margin:0px; \r\n float:none;\r\n}\r\n#yop-poll-answers-%POLL-ID% ul li label { \r\n margin:0px; \r\n font-style:normal; \r\n font-weight:normal; \r\n font-size:12px; \r\n float:none;\r\n}\r\n.yop-poll-results-%POLL-ID% {\r\n font-size: 12px;\r\n font-style: italic;\r\n font-weight: normal;\r\n margin-left: 15px;\r\n}\r\n\r\n#yop-poll-custom-%POLL-ID% { }\r\n#yop-poll-custom-%POLL-ID% ul {\r\n list-style: none outside none;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n#yop-poll-custom-%POLL-ID% ul li { \r\n padding:0px;\r\n margin:0px; \r\n font-size:14px;\r\n}\r\n#yop-poll-container-%POLL-ID% input[type=\'text\'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; }\r\n\r\n#yop-poll-captcha-input-div-%POLL-ID% {\r\nmargin-top:5px;\r\n}\r\n#yop-poll-captcha-helpers-div-%POLL-ID% {\r\nwidth:30px;\r\nfloat:left;\r\nmargin-left:5px;\r\nheight:0px;\r\n}\r\n\r\n#yop-poll-captcha-helpers-div-%POLL-ID% img {\r\nmargin-bottom:2px;\r\n}\r\n\r\n#yop-poll-captcha-image-div-%POLL-ID% {\r\nmargin-bottom:5px;\r\n}\r\n\r\n#yop_poll_captcha_image_%POLL-ID% {\r\nfloat:left;\r\n}\r\n\r\n.yop_poll_clear {\r\nclear:both;\r\n}\r\n\r\n#yop-poll-vote-%POLL-ID% {\r\n\r\n}\r\n.yop-poll-results-bar-%POLL-ID% { background:#f5f5f5; height:10px; }\r\n.yop-poll-results-bar-%POLL-ID% div { background:#555; height:10px; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button { float:left; }\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {\r\n float: right;\r\n margin-bottom: 20px;\r\n margin-top: -20px;\r\n width: auto;\r\n}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a { color:#FB6911; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a { color:#FB6911; text-decoration:underline; font-size:12px;}\r\n#yop-poll-vote-%POLL-ID% div { float:left; width:100%; }\r\n\r\n#yop-poll-container-error-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:red;\r\n text-transform:lowercase;\r\n}\r\n\r\n#yop-poll-container-success-%POLL-ID% {\r\n font-size:12px;\r\n font-style:italic;\r\n color:green;\r\n}',";
494
- break;
495
- }
496
- }
497
 
498
- $sql .= "`js` = '$js',
499
- `last_modified` = '".current_time( 'mysql' )."'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
 
 
 
 
 
 
 
 
 
 
 
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
 
503
- if ( 'add' == $action ) {
504
- $sql .= ", ";
505
- if ( 'White' == $template_name )
506
- $sql .= "`status` = 'default', ";
507
- else
508
- $sql .= "`status` = 'other', ";
509
- $sql .= "`date_added` = '".current_time( 'mysql' )."' ";
510
- }
511
- else
512
- $sql .= $wpdb->prepare( ' WHERE name = %s', $template_name );
513
-
514
- $wpdb->query( $sql );
515
- }
516
 
517
- /**
518
- * Creating polls table
519
- * @static
520
- *
521
- */
522
- public static function create_polls_table() {
523
- global $wpdb;
524
- $create_poll_table_sql = "CREATE TABLE " . $wpdb->yop_polls . " (
525
- id int(11) NOT NULL AUTO_INCREMENT,
526
- poll_author bigint(20) NOT NULL DEFAULT '0',
527
- name varchar(255) NOT NULL,
528
- question text NOT NULL,
529
- start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
530
- end_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
531
- total_votes int(11) NOT NULL,
532
- total_answers int(11) NOT NULL,
533
- status varchar(255) NOT NULL,
534
- last_modified datetime NOT NULL,
535
- date_added datetime NOT NULL,
536
- show_in_archive ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'yes',
537
- archive_order INT NOT NULL DEFAULT '1',
538
- PRIMARY KEY (id)) CHARSET=".self::getCharset()." ;";
539
-
540
- dbDelta( $create_poll_table_sql );
541
- }
542
 
543
- public static function create_polls_templates_table() {
544
- global $wpdb;
545
- $create_poll_table_sql = "CREATE TABLE " . $wpdb->yop_poll_templates . " (
546
- id int(11) NOT NULL AUTO_INCREMENT,
547
- template_author bigint(20) NOT NULL DEFAULT '0',
548
- name varchar(255) NOT NULL,
549
- before_vote_template text NOT NULL,
550
- after_vote_template text NOT NULL,
551
- before_start_date_template text NOT NULL,
552
- after_end_date_template text NOT NULL,
553
- css text NOT NULL,
554
- js text NOT NULL,
555
- status varchar(255) NOT NULL,
556
- last_modified datetime NOT NULL,
557
- date_added datetime NOT NULL,
558
- PRIMARY KEY (id)) CHARSET=".self::getCharset()." ;";
559
-
560
- dbDelta( $create_poll_table_sql );
561
- }
562
 
563
- /**
564
- * creating polls_answers table
565
- * @static
566
- *
567
- */
568
- public static function create_poll_answers_table() {
569
- global $wpdb;
570
- $create_poll_answers_table_sql = "CREATE TABLE " .$wpdb->yop_poll_answers . " (
571
- id int(11) NOT NULL AUTO_INCREMENT,
572
- poll_id int(11) NOT NULL,
573
- answer varchar(255) NOT NULL,
574
- type ENUM( 'default', 'other' ) NOT NULL DEFAULT 'default',
575
- votes int(11) NOT NULL,
576
- status varchar(255) NOT NULL,
577
- PRIMARY KEY (id),
578
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
579
-
580
- dbDelta( $create_poll_answers_table_sql );
581
- }
582
 
583
- /**
584
- * creating polls_custom_fields table
585
- * @static
586
- *
587
- */
588
- public static function create_poll_custom_fields_table() {
589
- global $wpdb;
590
- $create_poll_answers_table_sql = "CREATE TABLE " . $wpdb->yop_poll_custom_fields . " (
591
- id int(11) NOT NULL AUTO_INCREMENT,
592
- poll_id int(11) NOT NULL,
593
- custom_field varchar(255) NOT NULL,
594
- required ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'no',
595
- status varchar(255) NOT NULL,
596
- PRIMARY KEY (id),
597
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
598
-
599
- dbDelta( $create_poll_answers_table_sql );
600
- }
 
 
 
 
 
 
 
 
 
 
 
601
 
602
- /**
603
- * creating poll meta table
604
- * @static
605
- *
606
- */
607
- public static function create_poll_meta_table() {
608
- global $wpdb;
609
- $create_poll_meta_table_sql = "CREATE TABLE " . $wpdb->yop_pollmeta . " (
610
- meta_id int(11) NOT NULL AUTO_INCREMENT,
611
- yop_poll_id int(11) NOT NULL,
612
- meta_key varchar(255) NOT NULL,
613
- meta_value longtext NOT NULL,
614
- PRIMARY KEY (meta_id),
615
- KEY yop_poll_id (yop_poll_id)) CHARSET=".self::getCharset()." ;";
616
-
617
- dbDelta( $create_poll_meta_table_sql );
618
- }
619
 
620
- /**
621
- * creating poll answer meta table
622
- * @static
623
- *
624
- */
625
- public static function create_poll_answer_meta_table() {
626
- global $wpdb;
627
- $create_poll_answer_meta_table_sql = "CREATE TABLE " . $wpdb->yop_poll_answermeta . " (
628
- meta_id int(11) NOT NULL AUTO_INCREMENT,
629
- yop_poll_answer_id int(11) NOT NULL,
630
- meta_key varchar(255) NOT NULL,
631
- meta_value longtext NOT NULL,
632
- PRIMARY KEY (meta_id),
633
- KEY yop_poll_answer_id (yop_poll_answer_id)) CHARSET=".self::getCharset()." ;";
634
-
635
- dbDelta( $create_poll_answer_meta_table_sql );
636
- }
 
 
 
 
 
 
 
637
 
638
- /**
639
- * creating poll logs table
640
- * @static
641
- *
642
- */
643
- public static function create_poll_logs_table() {
644
- global $wpdb;
645
- $create_poll_logs_table_sql = "CREATE TABLE " . $wpdb->yop_poll_logs . " (
646
- id int(11) NOT NULL AUTO_INCREMENT,
647
- poll_id int(11) NOT NULL,
648
- vote_id varchar(255) NOT NULL,
649
- answer_id int(11) NOT NULL,
650
- ip varchar(100) NOT NULL,
651
- user_id int(11) NOT NULL,
652
- user_type ENUM( 'facebook', 'wordpress', 'anonymous', 'default' ) NOT NULL DEFAULT 'default',
653
- http_referer varchar(255) NOT NULL,
654
- tr_id varchar(255) NOT NULL,
655
- other_answer_value text NOT NULL,
656
- host varchar(200) NOT NULL,
657
- vote_date datetime NOT NULL,
658
- PRIMARY KEY (id),
659
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
660
-
661
- dbDelta( $create_poll_logs_table_sql );
662
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
 
664
- /**
665
- * creating poll voters table
666
- * @static
667
- *
668
- */
669
- public static function create_poll_voters_table() {
670
- global $wpdb;
671
- $create_poll_voters_table_sql = "CREATE TABLE " . $wpdb->yop_poll_voters . " (
672
- id int(11) NOT NULL AUTO_INCREMENT,
673
- poll_id int(11) NOT NULL,
674
- user_id int(11) NOT NULL,
675
- user_type ENUM( 'facebook', 'wordpress', 'anonymous', 'default' ) NOT NULL DEFAULT 'default',
676
- PRIMARY KEY (id),
677
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
678
-
679
- dbDelta( $create_poll_voters_table_sql );
680
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
 
682
- /**
683
- * creating poll bans table
684
- * @static
685
- *
686
- */
687
- public static function create_poll_bans_table() {
688
- global $wpdb;
689
- $create_poll_bans_table_sql = "CREATE TABLE " . $wpdb->yop_poll_bans . " (
690
- id int(11) NOT NULL AUTO_INCREMENT,
691
- poll_id int(11) NOT NULL,
692
- type varchar(255) NOT NULL,
693
- value varchar(255) NOT NULL,
694
- PRIMARY KEY (id),
695
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
696
-
697
- dbDelta( $create_poll_bans_table_sql );
698
- }
699
 
700
- /**
701
- * creating poll votes custom_fields
702
- * @static
703
- *
704
- */
705
- public static function create_poll_votes_custom_fields_table() {
706
- global $wpdb;
707
- $create_poll_votes_custom_fields_table_sql = "CREATE TABLE " . $wpdb->yop_poll_votes_custom_fields . " (
708
- id int(11) NOT NULL AUTO_INCREMENT,
709
- poll_id int(11) NOT NULL,
710
- vote_id varchar(255) NOT NULL,
711
- custom_field_id int(11) NOT NULL,
712
- user_id int(11) NOT NULL,
713
- user_type ENUM( 'facebook', 'wordpress', 'anonymous', 'default' ) NOT NULL DEFAULT 'default',
714
- custom_field_value text NOT NULL,
715
- tr_id varchar(255) NOT NULL,
716
- vote_date datetime NOT NULL,
717
- PRIMARY KEY (id),
718
- KEY poll_id (poll_id)) CHARSET=".self::getCharset()." ;";
719
-
720
- dbDelta( $create_poll_votes_custom_fields_table_sql );
721
- }
722
 
723
- /**
724
- * Creating polls table
725
- * @static
726
- *
727
- */
728
- public static function create_poll_facebook_users_table() {
729
- global $wpdb;
730
- $create_poll_table_sql = "CREATE TABLE " . $wpdb->yop_poll_facebook_users . " (
731
- id int(11) NOT NULL AUTO_INCREMENT,
732
- fb_id varchar(255) NOT NULL,
733
- name varchar(255) NOT NULL,
734
- first_name varchar(255) NOT NULL,
735
- last_name varchar(255) NOT NULL,
736
- username varchar(255) NOT NULL,
737
- email varchar(255) NOT NULL,
738
- gender varchar(255) NOT NULL,
739
- date_added datetime NOT NULL,
740
- PRIMARY KEY (id)) CHARSET=".self::getCharset()." ;";
741
-
742
- dbDelta( $create_poll_table_sql );
743
- }
744
 
745
- public static function getCharset() {
746
- if ( defined( 'DB_CHARSET' ) )
747
- return DB_CHARSET;
748
- else
749
- return 'utf8';
750
- }
751
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ class Yop_Poll_DbSchema {
 
 
 
 
 
4
 
5
+ public static function install_database() {
 
 
 
6
 
7
+ self::create_poll_database_tables();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ self::add_defaults_to_database();
10
+ }
11
 
12
+ public static function create_poll_database_tables() {
 
 
 
 
 
 
 
 
 
13
 
14
+ self::create_polls_table();
15
 
16
+ self::create_poll_logs_table();
 
 
 
17
 
18
+ self::create_poll_meta_table();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ self::create_poll_questions_table();
 
 
 
 
 
 
 
21
 
22
+ self::create_poll_question_meta_table();
 
 
23
 
24
+ self::create_poll_answers_table();
 
25
 
26
+ self::create_poll_votes_custom_fields_table();
 
 
 
 
27
 
28
+ self::create_poll_answer_meta_table();
29
+
30
+ self::create_poll_bans_table();
31
+
32
+ self::create_poll_results_table();
33
+
34
+ self:: create_polls_templates_table();
35
+
36
+ self::create_poll_custom_fields_table();
37
+
38
+
39
+
40
+ }
41
+
42
+ public static function add_defaults_to_database() {
43
+
44
+
45
+ //Add default templates
46
+ $version = get_option( "yop_poll_version" );
47
+
48
+ if(!isset($version)||version_compare($version, YOP_POLL_VERSION, '<')) {
49
+ $templates = array(
50
+ 'White',
51
+ 'Grey',
52
+ 'Dark',
53
+ 'Blue v1',
54
+ 'Blue v2',
55
+ 'Blue v3',
56
+ 'Red v1',
57
+ 'Red v2',
58
+ 'Red v3',
59
+ 'Green v1',
60
+ 'Green v2',
61
+ 'Green v3',
62
+ 'Orange v1',
63
+ 'Orange v2',
64
+ 'Orange v3'
65
+
66
+ );
67
+ foreach( $templates as $template ) {
68
+ $is_template_in_database = self::is_template_in_database( $template );
69
+ if( $is_template_in_database ) {
70
+ self::add_update_templates_in_database( 'update', $template );
71
+ }
72
+ else {
73
+ self::add_update_templates_in_database( 'add', $template );
74
+ }
75
+ }
76
+
77
+
78
+ update_option( 'yop_poll_options', yop_poll_default_options() );
79
+ update_option( "yop_poll_version", YOP_POLL_VERSION );
80
+ }
81
+
82
+ }
83
+
84
+ public static function is_template_in_database( $template_name ) {
85
+ global $wpdb;
86
+ $is_template = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM " . $wpdb->yop_poll_templates . " WHERE name = %s LIMIT 0, 1", $template_name ) );
87
+ return $is_template;
88
+ }
89
+
90
+ public static function delete_database_tables() {
91
+
92
+ $GLOBALS['wpdb']->query(
93
+
94
+ "DROP TABLE
95
+
96
+ `{$GLOBALS['wpdb']->prefix}yop_polls`,
97
+
98
+ `{$GLOBALS['wpdb']->prefix}yop_pollmeta`,
99
+
100
+ `{$GLOBALS['wpdb']->prefix}yop_poll_questions`,
101
+
102
+ `{$GLOBALS['wpdb']->prefix}yop_poll_questionmeta`,
103
+
104
+ `{$GLOBALS['wpdb']->prefix}yop_poll_logs`,
105
+
106
+ `{$GLOBALS['wpdb']->prefix}yop_poll_answers`,
107
+
108
+ `{$GLOBALS['wpdb']->prefix}yop_poll_answermeta`,
109
+
110
+ `{$GLOBALS['wpdb']->prefix}yop_poll_custom_fields`"
111
+
112
+ );
113
+
114
+ }
115
+ public static function delete_database_tables_2() {
116
+
117
+ $delete=$GLOBALS['wpdb']->query(
118
+
119
+ "DROP TABLE
120
+
121
+ `{$GLOBALS['wpdb']->prefix}yop2_polls`,
122
+
123
+ `{$GLOBALS['wpdb']->prefix}yop2_pollmeta`,
124
+
125
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_questions`,
126
+
127
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_questionmeta`,
128
+
129
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_logs`,
130
+
131
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_answers`,
132
+
133
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_answermeta`,
134
+
135
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_custom_fields`,
136
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_votes_custom_fields`,
137
+
138
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_results`,
139
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_templates`,
140
+ `{$GLOBALS['wpdb']->prefix}yop2_poll_bans`"
141
+
142
+ );
143
+
144
+
145
+ }
146
+
147
+ /**
148
+ * Creating polls table
149
+ *
150
+ * @static
151
+ *
152
+
153
+ */
154
+ public static function create_polls_table() {
155
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
156
+ if ( !isset($optin_box_modal_options)||$optin_box_modal_options['show']=="" ){
157
+ $optin_box_modal_options = array(
158
+ 'modal_had_submit' => 'no',
159
+ 'sidebar_had_submit' => 'no',
160
+ 'show' => 'yes',
161
+ );
162
+ update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
163
+ }
164
+
165
+ $create_poll_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_polls . " (
166
+
167
+ ID int(11) NOT NULL AUTO_INCREMENT,
168
+
169
+ poll_title text NOT NULL,
170
+
171
+ poll_name varchar(255) NOT NULL,
172
+
173
+ poll_author bigint(20) NOT NULL DEFAULT '0',
174
+
175
+ poll_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
176
+
177
+ poll_status varchar(20) NOT NULL,
178
+
179
+ poll_modified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
180
+
181
+ poll_type varchar(20) NOT NULL,
182
+
183
+ poll_start_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
184
+
185
+ poll_end_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
186
+
187
+ poll_total_votes int(11) NOT NULL,
188
+
189
+ PRIMARY KEY (ID)) CHARSET=" . self::getCharset() . " ;";
190
+
191
+
192
+ dbDelta( $create_poll_table_sql );
193
+
194
+ }
195
+
196
+ /**
197
+ * Creating polls questions table
198
+ *
199
+ * @static
200
+ *
201
+
202
+ */
203
+ public static function create_poll_bans_table() {
204
+
205
+ $create_poll_bans_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_poll_bans . " (
206
+ id int(11) NOT NULL AUTO_INCREMENT,
207
+ poll_id int(11) NOT NULL,
208
+ type varchar(255) NOT NULL,
209
+ value varchar(255) NOT NULL,
210
+ period int(11) NOT NULL,
211
+ unit ENUM('hours','days','weeks','months'),
212
+ PRIMARY KEY (id),
213
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
214
+
215
+ dbDelta( $create_poll_bans_table_sql );
216
+ }
217
+
218
+ public static function create_poll_questions_table() {
219
+
220
+ $create_poll_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_poll_questions . " (
221
+
222
+ ID int(11) NOT NULL AUTO_INCREMENT,
223
+
224
+ poll_id int(11) NOT NULL,
225
+
226
+ question text NOT NULL,
227
+
228
+ type text NOT NULL,
229
+
230
+ question_author bigint(20) NOT NULL DEFAULT '0',
231
+
232
+ question_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
233
+
234
+ question_status varchar(20) NOT NULL,
235
+
236
+ question_modified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
237
+
238
+ poll_order INT NOT NULL DEFAULT '0',
239
+
240
+ PRIMARY KEY (ID),
241
+
242
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
243
+
244
+
245
+ dbDelta( $create_poll_table_sql );
246
+
247
+ }
248
+
249
+ /**
250
+ * Creating polls answers table
251
+ *
252
+ * @static
253
+ *
254
+
255
+ */
256
+ public static function create_poll_answers_table() {
257
+
258
+ $create_poll_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_poll_answers . " (
259
+
260
+ ID int(11) NOT NULL AUTO_INCREMENT,
261
+
262
+ poll_id int(11) NOT NULL,
263
+
264
+ question_id int(11) NOT NULL,
265
+
266
+ answer text NOT NULL,
267
+
268
+ description varchar(255) DEFAULT '',
269
+
270
+ type varchar(255) NOT NULL DEFAULT 'default',
271
+
272
+ answer_author bigint(20) NOT NULL DEFAULT '0',
273
+
274
+ answer_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
275
+
276
+ answer_status varchar(20) NOT NULL,
277
+
278
+ answer_modified datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
279
+
280
+ question_order INT NOT NULL DEFAULT '0',
281
+
282
+ votes INT( 4 ) NOT NULL DEFAULT 0,
283
+
284
+ PRIMARY KEY (ID),
285
+
286
+ KEY poll_id (poll_id),
287
+
288
+ KEY question_id (question_id)) CHARSET=" . self::getCharset() . " ;";
289
+
290
+
291
+ dbDelta( $create_poll_table_sql );
292
+
293
+ }
294
+
295
+ /**
296
+ * creating poll meta table
297
+ *
298
+ * @static
299
+ *
300
+
301
+ */
302
+
303
+ public static function create_poll_meta_table() {
304
+
305
+ $create_poll_meta_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_pollmeta . " (
306
+
307
+ meta_id int(11) NOT NULL AUTO_INCREMENT,
308
+
309
+ yop_poll_id int(11) NOT NULL,
310
+
311
+ meta_key varchar(255) NOT NULL,
312
+
313
+ meta_value longtext NOT NULL,
314
+
315
+ PRIMARY KEY (meta_id),
316
+
317
+ KEY yop_poll_id (yop_poll_id)) CHARSET=" . self::getCharset() . " ;";
318
+
319
+
320
+ dbDelta( $create_poll_meta_table_sql );
321
+
322
+ }
323
+
324
+ /**
325
+ * creating polls_custom_fields table
326
+ *
327
+ * @static
328
+ *
329
+ */
330
+ public static function create_poll_custom_fields_table() {
331
+ global $wpdb;
332
+ $create_poll_answers_table_sql = "CREATE TABLE " . $wpdb->yop_poll_custom_fields . " (
333
+ ID int(11) NOT NULL AUTO_INCREMENT,
334
+ poll_id int(11) NOT NULL,
335
+ question_id int(11) NOT NULL,
336
+ custom_field varchar(255) NOT NULL,
337
+ required ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'no',
338
+ status varchar(255) NOT NULL,
339
+ PRIMARY KEY (id),
340
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
341
+
342
+ dbDelta( $create_poll_answers_table_sql );
343
+ }
344
+
345
+ /**
346
+ * creating poll question meta table
347
+ *
348
+ * @static
349
+ *
350
+
351
+ */
352
+
353
+ public static function create_poll_question_meta_table() {
354
+
355
+ $create_poll_question_meta_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_poll_questionmeta . " (
356
+
357
+ meta_id int(11) NOT NULL AUTO_INCREMENT,
358
+
359
+ yop_poll_question_id int(11) NOT NULL,
360
+
361
+ meta_key varchar(255) NOT NULL,
362
+
363
+ meta_value longtext NOT NULL,
364
+
365
+ PRIMARY KEY (meta_id),
366
+
367
+ KEY yop_poll_question_id (yop_poll_question_id)) CHARSET=" . self::getCharset() . " ;";
368
+
369
+
370
+ dbDelta( $create_poll_question_meta_table_sql );
371
+
372
+ }
373
+
374
+ public static function create_poll_votes_custom_fields_table() {
375
+ global $wpdb;
376
+ $create_poll_votes_custom_fields_table_sql = "CREATE TABLE " . $wpdb->yop_poll_votes_custom_fields . " (
377
+ ID int(11) NOT NULL AUTO_INCREMENT,
378
+ poll_id int(11) NOT NULL,
379
+ question_id int(11) NOT NULL,
380
+ vote_id varchar(255) NOT NULL,
381
+ custom_field_id int(11) NOT NULL,
382
+ user_id int(11) NOT NULL,
383
+ user_type ENUM( 'facebook', 'wordpress', 'anonymous', 'default' ) NOT NULL DEFAULT 'default',
384
+ custom_field_value text NOT NULL,
385
+ tr_id varchar(255) NOT NULL,
386
+ vote_date datetime NOT NULL,
387
+ PRIMARY KEY (id),
388
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
389
+
390
+ dbDelta( $create_poll_votes_custom_fields_table_sql );
391
+ }
392
+
393
+ public static function create_poll_logs_table() {
394
+ global $wpdb;
395
+
396
+ $create_poll_logs_table_sql = "CREATE TABLE " . $wpdb->yop_poll_logs . " (
397
+ ID int(11) NOT NULL AUTO_INCREMENT,
398
+ poll_id int(11) NOT NULL,
399
+ vote_id varchar(255) NOT NULL,
400
+ ip varchar(100) NOT NULL,
401
+ user_id varchar(25) DEFAULT NULL,
402
+ user_type ENUM('facebook','wordpress','anonymous','google','default' ) NOT NULL DEFAULT 'default',
403
+ tr_id varchar(255) DEFAULT NULL,
404
+ vote_details longtext DEFAULT NULL,
405
+ user_details longtext DEFAULT NULL,
406
+ vote_date datetime NOT NULL,
407
+ message text DEFAULT NULL,
408
+ PRIMARY KEY (ID),
409
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
410
+ dbDelta( $create_poll_logs_table_sql );
411
+
412
+ }
413
+
414
+ public static function create_poll_results_table() {
415
+ global $wpdb;
416
+ $create_poll_results_table_sql = "CREATE TABLE " . $wpdb->yop_poll_results . " (
417
+ ID int(11) NOT NULL AUTO_INCREMENT,
418
+ poll_id int(11) NOT NULL,
419
+ vote_id varchar(256) NOT NULL,
420
+ ip varchar(100) NOT NULL,
421
+ country varchar(100) NOT NULL,
422
+ user_id varchar(25) DEFAULT NULL,
423
+ user_type ENUM('facebook','google','admin','wordpress','anonymous','default' ) NOT NULL DEFAULT 'default',
424
+ tr_id varchar(256) DEFAULT NULL,
425
+ result_details longtext DEFAULT NULL,
426
+ user_details longtext DEFAULT NULL,
427
+ vote_date datetime NOT NULL,
428
+ PRIMARY KEY (ID),
429
+ KEY poll_id (poll_id)) CHARSET=" . self::getCharset() . " ;";
430
+ dbDelta( $create_poll_results_table_sql );
431
+ }
432
+
433
+ /**
434
+ * creating poll answer meta table
435
+ *
436
+ * @static
437
+ *
438
+
439
+ */
440
+ public static function create_poll_answer_meta_table() {
441
+
442
+ $create_poll_answer_meta_table_sql = "CREATE TABLE " . $GLOBALS['wpdb']->yop_poll_answermeta . " (
443
+
444
+ meta_id int(11) NOT NULL AUTO_INCREMENT,
445
+
446
+ yop_poll_answer_id int(11) NOT NULL,
447
+
448
+ meta_key varchar(255) NOT NULL,
449
+
450
+ meta_value longtext NOT NULL,
451
+
452
+ PRIMARY KEY (meta_id),
453
+
454
+ KEY yop_poll_answer_id (yop_poll_answer_id)) CHARSET=" . self::getCharset() . " ;";
455
+
456
+
457
+ dbDelta( $create_poll_answer_meta_table_sql );
458
+
459
+ }
460
+
461
+ /**
462
+ * creating poll templates table
463
+ *
464
+ * @static
465
+ *
466
+
467
+ */
468
+ public static function create_polls_templates_table() {
469
+ global $wpdb;
470
+ $create_poll_table_sql = "CREATE TABLE " . $wpdb->yop_poll_templates . " (
471
+ id int(11) NOT NULL AUTO_INCREMENT,
472
+ template_author bigint(20) NOT NULL DEFAULT '0',
473
+ name varchar(255) NOT NULL,
474
+ before_vote_template text NOT NULL,
475
+ after_vote_template text NOT NULL,
476
+ before_start_date_template text NOT NULL,
477
+ after_end_date_template text NOT NULL,
478
+ css text NOT NULL,
479
+ js text NOT NULL,
480
+ status varchar(255) NOT NULL,
481
+ last_modified datetime NOT NULL,
482
+ date_added datetime NOT NULL,
483
+ PRIMARY KEY (id)) CHARSET=" . self::getCharset() . " ;";
484
+
485
+ dbDelta( $create_poll_table_sql );
486
+ }
487
+ /**
488
+ * creating poll poll_votes cutom field table
489
+ *
490
+ * @static
491
+ *
492
+
493
+ */
494
+
495
+
496
+ /**
497
+ * add default templates in database
498
+ */
499
+ public static function add_update_templates_in_database( $action = 'add', $template_name ) {
500
+ global $wpdb;
501
+ global $current_user;
502
+ wp_get_current_user();
503
+ if( 'add' == $action ) {
504
+ $sql = "INSERT INTO `" . $wpdb->yop_poll_templates . "` SET ";
505
+ $sql .= $wpdb->prepare( "`name` = %s, ", $template_name );
506
+ $sql .= $wpdb->prepare( "`template_author` = %d, ", ( $current_user->ID > 0 ) ? $current_user->ID : 0 );
507
+ }
508
+ else {
509
+ $sql = "UPDATE `" . $wpdb->yop_poll_templates . "` SET ";
510
+ }
511
+
512
+ $before_vote_template = <<<NOWDOC
513
+ <div id = "yop-poll-questions-container-%POLL-ID%">
514
+ [QUESTION_CONTAINER]
515
+ <div id = "yop-poll-question-container-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-question-container-%POLL-ID%">
516
+ <div id = "yop-poll-question-%POLL-ID%-%QUESTION-ID%"
517
+ class = "yop-poll-question-%POLL-ID%">%POLL-QUESTION%</div>
518
+ <div id = "yop-poll-answers-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-answers-%POLL-ID%">
519
+ <ul>
520
+ [ANSWER_CONTAINER]
521
+ <li id = "yop-poll-li-answer-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-li-answer-%POLL-ID%">
522
+ %POLL-ANSWER-CHECK-INPUT% %POLL-ANSWER-LABEL%
523
+ [ANSWER_DESCRIPTION_CONTAINER]
524
+ <span class = "yop-poll-description-%POLL-ID%">%ANSWER-DESCRIPTION%</span>
525
+ [/ANSWER_DESCRIPTION_CONTAINER]
526
+
527
+ [ANSWER_RESULT_CONTAINER]
528
+ <span class = "yop-poll-results-text-%POLL-ID%-%QUESTION-ID%">%POLL-ANSWER-RESULT-LABEL%</span>
529
+ %POLL-ANSWER-RESULT-BAR%
530
+ [/ANSWER_RESULT_CONTAINER]
531
+ </li>
532
+ [/ANSWER_CONTAINER]
533
+ [OTHER_ANSWER_CONTAINER]
534
+ <li id = "yop-poll-li-answer-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-li-answer-%POLL-ID%">
535
+ %POLL-OTHER-ANSWER-CHECK-INPUT%
536
+ %POLL-OTHER-ANSWER-LABEL%
537
+ <span id = "yop-poll-results-text-%POLL-ID%-%QUESTION-ID%"
538
+ class = "yop-poll-results-text-%POLL-ID%">%POLL-ANSWER-RESULT-LABEL%</span>
539
+ %POLL-OTHER-ANSWER-TEXT-INPUT%
540
+ %POLL-ANSWER-RESULT-BAR%
541
+ </li>
542
+ [/OTHER_ANSWER_CONTAINER]
543
+ </ul>
544
+ </div>
545
+ <div id = "yop-poll-customs-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-customs-%POLL-ID%">
546
+ <ul>
547
+ [CUSTOM_FIELD_CONTAINER]
548
+ <li id = "yop-poll-li-custom-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-li-custom-%POLL-ID%">
549
+ %POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%
550
+ </li>
551
+ [/CUSTOM_FIELD_CONTAINER]
552
+ </ul>
553
+ </div>
554
+ </div>
555
+ <div class = "yop-poll-clear-%POLL-ID%"></div>
556
+ [/QUESTION_CONTAINER]
557
  </div>
 
 
 
 
 
 
 
558
  [CAPTCHA_CONTAINER]
559
+ <div id = "yop-poll-captcha-%POLL-ID%">
560
+ <div class = "yop-poll-captcha-image-div" id = "yop-poll-captcha-image-div-%POLL-ID%">
561
+ %CAPTCHA-IMAGE%
562
+ <div class = "yop-poll-captcha-helpers-div" id = "yop-poll-captcha-helpers-div-%POLL-ID%">
563
  %RELOAD-CAPTCHA-IMAGE%
564
  </div>
565
+ <div class = "yop-poll-clear-%POLL-ID%"></div>
566
  </div>
567
  %CAPTCHA-LABEL%
568
+ <div class = "yop-poll-captcha-input-div" id = "yop-poll-captcha-input-div-%POLL-ID%">%CAPTCHA-INPUT%</div>
569
  </div>
570
  [/CAPTCHA_CONTAINER]
571
+ <div id = "yop-poll-vote-%POLL-ID%" class = "yop-poll-footer">
572
  <div>%POLL-VOTE-BUTTON%</div>
573
+ <div id = "yop-poll-results-%POLL-ID%">%POLL-VIEW-RESULT-LINK%</div>
574
+ <div>%POLL-TOTAL-ANSWERS-LABEL%</div> <div>%POLL-TOTAL-VOTES-LABEL%</div>
575
  </div>
576
  NOWDOC;
577
+
578
+ $after_vote_template = <<<NOWDOC
579
+ <div id = "yop-poll-questions-container-%POLL-ID%" class = "yop-poll-questions-container-%POLL-ID%">
580
+ [QUESTION_CONTAINER]
581
+ <div id = "yop-poll-question-container-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-question-container-%POLL-ID%">
582
+ <div id = "yop-poll-question-%POLL-ID%-%QUESTION-ID%"
583
+ class = "yop-poll-question-%POLL-ID%">%POLL-QUESTION%</div>
584
+ <div id = "yop-poll-answers-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-answers-%POLL-ID%">
585
+ <ul>
586
+ [ANSWER_RESULT_CONTAINER]
587
+ <li id = "yop-poll-li-result-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-li-result-%POLL-ID%">
588
+ <label id = "pds-feedback-label-%POLL-ID%-%QUESTION-ID%" class = "pds-feedback-label-%POLL-ID%">
589
+ [ANSWER_DESCRIPTION_CONTAINER]
590
+ <span class = "yop-poll-description-%POLL-ID%">%ANSWER-DESCRIPTION%</span>
591
+ [/ANSWER_DESCRIPTION_CONTAINER]
592
+ <span id = "pds-answer-text-%POLL-ID%-%QUESTION-ID%" class = "pds-answer-text-%POLL-ID%">
593
+ %POLL-ANSWER-LABEL%
594
+ </span>
595
+ <span id = "pds-feedback-result-%POLL-ID%-%QUESTION-ID%"
596
+ class = "pds-feedback-result-%POLL-ID%">
597
+ <span id = "pds-feedback-per-%POLL-ID%-%QUESTION-ID%" class = "pds-feedback-per-%POLL-ID%">
598
+ %POLL-ANSWER-RESULT-LABEL%
599
+ </span>
600
+ </span>
601
+ </label>
602
+ <div>
603
+ %POLL-ANSWER-RESULT-BAR%
604
+ </div>
605
+ </li>
606
+ [/ANSWER_RESULT_CONTAINER]
607
+ </ul>
608
+ </div>
609
+ </div>
610
+ <div class = "yop-poll-clear-%POLL-ID%"></div>
611
+ [/QUESTION_CONTAINER]
612
  </div>
613
+ <div id = "yop-poll-vote-%POLL-ID%" class = "yop-poll-footer">
614
+ <div>%POLL-TOTAL-ANSWERS-LABEL%</div>
615
+ <div>%POLL-TOTAL-VOTES-LABEL%</div>
616
+ <div id = "yop-poll-back-%POLL-ID%">%POLL-BACK-TO-VOTE-LINK%</div>
617
+ <div id = "yop-poll-archive-%POLL-ID%">%POLL-VIEW-ARCHIVE-LINK%</div>
618
+ %SHARE-BUTTON%
619
  </div>
620
  NOWDOC;
621
+ $after_vote_template = addslashes( $after_vote_template );
622
 
623
+ $before_start_date_template = <<<NOWDOC
624
  This poll is about to<br>
625
+ start on %POLL-START-DATE%<br>
626
+ and will end on %POLL-END-DATE%<br>
627
  NOWDOC;
628
+ $before_start_date_template = addslashes( $before_start_date_template );
629
 
630
+ $after_end_date_template = <<<NOWDOC
631
  This poll is closed!
632
  Poll activity: <br>
633
+ Start date %POLL-START-DATE%<br>
634
+ End date %POLL-END-DATE%<br>
635
 
636
  Poll Results:
637
+ <div id="yop-poll-questions-container-%POLL-ID%" class="yop-poll-questions-container-%POLL-ID%">
638
+ [QUESTION_CONTAINER]
639
+ <div id = "yop-poll-question-container-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-question-container-%POLL-ID%">
640
+ <div id = "yop-poll-question-%POLL-ID%-%QUESTION-ID%"
641
+ class = "yop-poll-question-%POLL-ID%">%POLL-QUESTION%</div>
642
+ <div id = "yop-poll-answers-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-answers-%POLL-ID%">
643
+ <ul>
644
+ [ANSWER_RESULT_CONTAINER]
645
+ <li id = "yop-poll-li-result-%POLL-ID%-%QUESTION-ID%" class = "yop-poll-li-result-%POLL-ID%">
646
+ <label id = "pds-feedback-label-%POLL-ID%-%QUESTION-ID%" class = "pds-feedback-label-%POLL-ID%">
647
+ [ANSWER_DESCRIPTION_CONTAINER]
648
+ <span class = "yop-poll-description-%POLL-ID%">%ANSWER-DESCRIPTION%</span>
649
+ [/ANSWER_DESCRIPTION_CONTAINER]
650
+ <span id = "pds-answer-text-%POLL-ID%-%QUESTION-ID%" class = "pds-answer-text-%POLL-ID%">
651
+ %POLL-ANSWER-LABEL%
652
+ </span>
653
+ <span id = "pds-feedback-result-%POLL-ID%-%QUESTION-ID%"
654
+ class = "pds-feedback-result-%POLL-ID%">
655
+ <span id = "pds-feedback-per-%POLL-ID%-%QUESTION-ID%" class = "pds-feedback-per-%POLL-ID%">
656
+ %POLL-ANSWER-RESULT-LABEL%
657
  </span>
658
+ </span>
659
+ </label>
660
+ <div>
661
+ %POLL-ANSWER-RESULT-BAR%
662
+ </div>
663
+ </li>
664
+ [/ANSWER_RESULT_CONTAINER]
665
+ </ul>
666
+ </div>
667
+ </div>
668
+ <div class = "yop-poll-clear-%POLL-ID%"></div>
669
+ [/QUESTION_CONTAINER]
670
  </div>
 
671
  NOWDOC;
672
+ $after_end_date_template = addslashes( $after_end_date_template );
673
 
674
+ $js = <<<NOWDOC
675
  function stripBorder_%POLL-ID%(object) {
676
  object.each(function() {
677
  if( parseInt(jQuery(this).width() ) > 0) {
678
+ jQuery(this).width(
679
+ parseInt(
680
+ jQuery(this).width() ) -
681
+ parseInt(jQuery(this).css("border-left-width")) -
682
+ parseInt(jQuery(this).css("border-right-width"))
683
  );
684
  }
685
  else {
689
  });
690
  }
691
  function stripPadding_%POLL-ID%(object) {
692
+ object.each(function() {
693
+ jQuery(this).width(
694
+ parseInt( jQuery(this).width() ) -
695
+ parseInt(jQuery(this).css("padding-left")) -
696
+ parseInt(jQuery(this).css("padding-left"))
697
  );
698
  });
699
  }
700
 
701
  function strip_results_%POLL-ID%() {
702
+ stripPadding_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%") );
703
  stripBorder_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%") );
704
  }
705
 
706
  jQuery(document).ready(function(e) {
707
+ if(typeof window.strip_results_%POLL-ID% == "function")
708
  strip_results_%POLL-ID%();
709
+ if(typeof window.tabulate_answers_%POLL-ID% == "function")
710
  tabulate_answers_%POLL-ID%();
711
+ if(typeof window.tabulate_results_%POLL-ID% == "function")
712
  tabulate_results_%POLL-ID%();
713
  });
714
 
717
  if ( findWidest ) {
718
  obj.each(function() {
719
  var thisWidth = jQuery(this).width();
720
+ width = parseInt(thisWidth / cols);
721
+ jQuery(this).width(width);
722
+ jQuery(this).css("float", "left");
723
+ });
724
+ }
725
+ else {
726
+ var widest = 0;
727
+ obj.each(function() {
728
+ var thisWidth = jQuery(this).width();
729
+ if(thisWidth > widest) {
730
+ widest = thisWidth;
731
+ }
732
+ });
733
+ width = parseInt( %POLL-WIDTH% / cols[0]);
734
+ obj.width(width-20);
735
+ obj.css("float", "left");
736
+ }
737
+ }
738
+
739
+ function equalWidth2_%POLL-ID%(obj, cols, findWidest ) {
740
+ findWidest = typeof findWidest !== "undefined" ? findWidest : false;
741
+ if ( findWidest ) {
742
+ obj.each(function() {
743
+ var thisWidth = jQuery(this).width();
744
+ width = parseInt(thisWidth / cols);
745
+ jQuery(this).width(width);
746
+ jQuery(this).css("float", "left");
747
  });
748
  }
749
  else {
751
  obj.each(function() {
752
  var thisWidth = jQuery(this).width();
753
  if(thisWidth > widest) {
754
+ widest = thisWidth;
755
+ }
756
  });
757
+ width = parseInt( %POLL-WIDTH% / cols[1]);
758
+ obj.width(width-20);
759
+ obj.css("float", "left");
760
+ }
761
  }
762
 
763
  function tabulate_answers_%POLL-ID%() {
764
+
765
  equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%"), %ANSWERS-TABULATED-COLS% );
766
+ //equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %ANSWERS-TABULATED-COLS%, true );
767
  }
768
 
769
  function tabulate_results_%POLL-ID%() {
770
+ equalWidth2_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%"), %RESULTS-TABULATED-COLS% );
771
+ //equalWidth_%POLL-ID%( jQuery("#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID% .yop-poll-results-bar-%POLL-ID% div "), %RESULTS-TABULATED-COLS%, true );
772
  }
773
 
774
  jQuery(document).ready(function(){
779
 
780
  };
781
  NOWDOC;
782
+ $js = addslashes( $js );
783
+ $css = "";
784
 
785
+ switch( $template_name ) {
786
+ case 'White':
787
+ { //White
788
+ $css = <<<NOWDOC
789
+ #yop-poll-container-%POLL-ID% {
790
+ width: %POLL-WIDTH%;
791
+ background:#fff;
792
+ padding:10px;
793
+ color:#555;
794
+ overflow:hidden;
795
+ font-size:12px;
796
+ }
797
+ #yop-poll-container-%POLL-ID% input[type='text'] {
798
+ margin:0px 0px 5px 0px;
799
+ padding:2%;
800
+ width:96%;
801
+ text-indent:2%;
802
+ font-size:12px;
803
+ }
804
 
805
+ .yop-poll-name-%POLL-ID% {
806
+ font-size:14px;
807
+ font-weight:bold;
808
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
809
 
810
+ #yop-poll-questions-container-%POLL-ID% {
811
+ font-size:14px;
812
+ margin:5px 0px;
813
+ }
814
+ .yop-poll-question-container-%POLL-ID% {
815
+ padding: 2px;
816
+ }
817
+ .yop-poll-question-%POLL-ID% {
818
+ font-style: italic;
819
+ text-align: center;
820
+ margin-bottom: 21px;
821
+ margin-top: -10px;
822
+ width: 100%;
823
+ }
824
+ .yop-poll-answers-%POLL-ID% { }
825
+ .yop-poll-answers-%POLL-ID% ul {
826
+ list-style: none outside none;
827
+ margin: 0;
828
+ padding: 0;
829
+ }
830
+ .yop-poll-li-answer-%POLL-ID% {
831
+ font-style:normal;
832
+ margin:0px 0px 10px 0px;
833
+ padding:0px;
834
+ font-size:12px;
835
+ margin-bottom:20px;
836
+ margin-bottom:20px;
837
+ }
838
+ .yop-poll-li-answer-%POLL-ID% input {
839
+ margin:0px;
840
+ float:none;
841
+ }
842
+ .yop-poll-li-answer-%POLL-ID% label {
843
+ margin:0px;
844
+ font-style:normal;
845
+ font-weight:normal;
846
+ font-size:12px;
847
+ float:none;
848
+ }
849
+ .yop-poll-results-%POLL-ID% {
850
+ font-size: 12px;
851
+ font-style: italic;
852
+ font-weight: normal;
853
+ margin-left: 15px;
854
+ }
855
 
856
+ .yop-poll-customs-%POLL-ID% { }
857
+ .yop-poll-customs-%POLL-ID% ul {
858
+ list-style: none outside none;
859
+ margin: 0;
860
+ padding: 0;
861
+ }
862
+ .yop-poll-li-custom-%POLL-ID% {
863
+ padding:0px;
864
+ margin:0px;
865
+ font-size:14px;
866
+ }
867
 
868
+ /* Start CAPTCHA div style*/
869
+ #yop-poll-captcha-input-div-%POLL-ID% {
870
+ margin-top:5px;
871
+ }
872
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
873
+ width:30px;
874
+ float:left;
875
+ margin-left:5px;
876
+ height:0px;
877
+ }
878
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
879
+ margin-bottom:2px;
880
+ }
881
+ #yop-poll-captcha-image-div-%POLL-ID% {
882
+ margin-bottom:5px;
883
+ }
884
+ #yop_poll_captcha_image_%POLL-ID% {
885
+ float:left;
886
+ }
887
+ /* End CAPTCHA div style*/
888
 
889
+ .yop-poll-clear-%POLL-ID% {
890
+ clear:both;
891
+ }
 
 
 
 
 
 
 
 
 
 
892
 
893
+ #yop-poll-vote-%POLL-ID% {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
 
895
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
896
 
897
+ /* Start Result bar*/
898
+ .yop-poll-results-bar-%POLL-ID% {
899
+ background:#f5f5f5;
900
+ height:10px;
901
+ }
902
+ .yop-poll-results-bar-%POLL-ID% div {
903
+ background:#555;
904
+ height:10px;
905
+ }
906
+ /* End Result bar*/
 
 
 
 
 
 
 
 
 
907
 
908
+ /* Start Vote Button*/
909
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
910
+ float:left;
911
+ }
912
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
913
+ float: right;
914
+ margin-bottom: 20px;
915
+ margin-top: -20px;
916
+ width: auto;
917
+ }
918
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
919
+ color:#555;
920
+ text-decoration:underline;
921
+ font-size:12px;
922
+ }
923
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
924
+ color:#555;
925
+ text-decoration:underline;
926
+ font-size:12px;
927
+ }#yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
928
+ color:#555;
929
+ text-decoration:underline;
930
+ font-size:12px;
931
+ }
932
+ #yop-poll-vote-%POLL-ID% div {
933
+ float:left;
934
+ width:100%;
935
+ }
936
+ /* End Vote Button*/
937
 
938
+ /* Start Messages*/
939
+ #yop-poll-container-error-%POLL-ID% {
940
+ font-size:12px;
941
+ font-style:italic;
942
+ color:red;
943
+ text-transform:lowercase;
944
+ margin-bottom:20px;
945
+ text-align:center;
946
+ }
947
+ #yop-poll-container-success-%POLL-ID% {
948
+ font-size:12px;
949
+ font-style:italic;
950
+ color:green;
951
+ margin-bottom:20px;
952
+ text-align:center;
953
+ }
954
+ /* End Messages*/
955
 
956
+ .yop-poll-clear-%POLL-ID% {
957
+ clear: both;
958
+ }
959
+ NOWDOC;
960
+ break;
961
+ }
962
+ case 'Grey':
963
+ { //Grey
964
+ $css = <<<NOWDOC
965
+ #yop-poll-container-%POLL-ID% {
966
+ width: %POLL-WIDTH%;
967
+ background:#eee;
968
+ padding:10px;
969
+ color:#000;
970
+ overflow:hidden;
971
+ font-size:12px;
972
+ }
973
+ #yop-poll-container-%POLL-ID% input[type='text'] {
974
+ margin:0px 0px 5px 0px;
975
+ padding:2%;
976
+ width:96%;
977
+ text-indent:2%;
978
+ font-size:12px;
979
+ }
980
 
981
+ .yop-poll-name-%POLL-ID% {
982
+ font-size:14px;
983
+ font-weight:bold;
984
+ }
985
+
986
+ #yop-poll-questions-container-%POLL-ID% {
987
+ font-size:14px;
988
+ margin:5px 0px;
989
+ }
990
+ .yop-poll-question-container-%POLL-ID% {
991
+ padding: 2px;
992
+ }
993
+ .yop-poll-question-%POLL-ID% {
994
+ margin-bottom: 21px;
995
+ margin-top: -10px;
996
+ font-style: italic;
997
+ text-align: center;
998
+ width: 100%;
999
+ }
1000
+ .yop-poll-answers-%POLL-ID% { }
1001
+ .yop-poll-answers-%POLL-ID% ul {
1002
+ list-style: none outside none;
1003
+ margin: 0;
1004
+ padding: 0;
1005
+ }
1006
+ .yop-poll-li-answer-%POLL-ID% {
1007
+ font-style:normal;
1008
+ margin:0px 0px 10px 0px;
1009
+ padding:0px;
1010
+ font-size:12px;
1011
+ margin-bottom:20px;
1012
+ }
1013
+ .yop-poll-li-answer-%POLL-ID% input {
1014
+ margin:0px;
1015
+ float:none;
1016
+ }
1017
+ .yop-poll-li-answer-%POLL-ID% label {
1018
+ margin:0px;
1019
+ font-style:normal;
1020
+ font-weight:normal;
1021
+ font-size:12px;
1022
+ float:none;
1023
+ }
1024
+ .yop-poll-results-%POLL-ID% {
1025
+ font-size: 12px;
1026
+ font-style: italic;
1027
+ font-weight: normal;
1028
+ margin-left: 15px;
1029
+ }
1030
+
1031
+ .yop-poll-customs-%POLL-ID% { }
1032
+ .yop-poll-customs-%POLL-ID% ul {
1033
+ list-style: none outside none;
1034
+ margin: 0;
1035
+ padding: 0;
1036
+ }
1037
+ .yop-poll-li-custom-%POLL-ID% {
1038
+ padding:0px;
1039
+ margin:0px;
1040
+ font-size:14px;
1041
+ }
1042
+
1043
+ /* Start CAPTCHA div style*/
1044
+ #yop-poll-captcha-input-div-%POLL-ID% {
1045
+ margin-top:5px;
1046
+ }
1047
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1048
+ width:30px;
1049
+ float:left;
1050
+ margin-left:5px;
1051
+ height:0px;
1052
+ }
1053
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1054
+ margin-bottom:2px;
1055
+ }
1056
+ #yop-poll-captcha-image-div-%POLL-ID% {
1057
+ margin-bottom:5px;
1058
+ }
1059
+ #yop_poll_captcha_image_%POLL-ID% {
1060
+ float:left;
1061
+ }
1062
+ /* End CAPTCHA div style*/
1063
+
1064
+ .yop-poll-clear-%POLL-ID% {
1065
+ clear:both;
1066
+ }
1067
+
1068
+ #yop-poll-vote-%POLL-ID% {
1069
+
1070
+ }
1071
+
1072
+ /* Start Result bar*/
1073
+ .yop-poll-results-bar-%POLL-ID% {
1074
+ background:#f5f5f5;
1075
+ height:10px;
1076
+ }
1077
+ .yop-poll-results-bar-%POLL-ID% div {
1078
+ background:#555;
1079
+ height:10px;
1080
+ }
1081
+ /* End Result bar*/
1082
+
1083
+ /* Start Vote Button*/
1084
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1085
+ float:left;
1086
+ }
1087
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1088
+ float: right;
1089
+ margin-bottom: 20px;
1090
+ margin-top: -20px;
1091
+ width: auto;
1092
+ }
1093
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1094
+ color:#000;
1095
+ text-decoration:underline;
1096
+ font-size:12px;
1097
+ }
1098
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1099
+ color:#000;
1100
+ text-decoration:underline;
1101
+ font-size:12px;
1102
+ }#yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1103
+ color:#000;
1104
+ text-decoration:underline;
1105
+ font-size:12px;
1106
+ }
1107
+ #yop-poll-vote-%POLL-ID% div {
1108
+ float:left;
1109
+ width:100%;
1110
+ }
1111
+ /* End Vote Button*/
1112
+
1113
+ /* Start Messages*/
1114
+ #yop-poll-container-error-%POLL-ID% {
1115
+ font-size:12px;
1116
+ font-style:italic;
1117
+ color:red;
1118
+ text-transform:lowercase;
1119
+ margin-bottom:20px;
1120
+ text-align:center;
1121
+ margin-bottom:20px;
1122
+ text-align:center;
1123
+ }
1124
+ #yop-poll-container-success-%POLL-ID% {
1125
+ font-size:12px;
1126
+ font-style:italic;
1127
+ color:green;
1128
+ margin-bottom:20px;
1129
+ text-align:center;
1130
+ }
1131
+ /* End Messages*/
1132
+ NOWDOC;
1133
+ break;
1134
+ }
1135
+ case 'Dark':
1136
+ { //Dark
1137
+ $css = <<<NOWDOC
1138
+ #yop-poll-container-%POLL-ID% {
1139
+ width: %POLL-WIDTH%;
1140
+ background:#555;
1141
+ padding:10px;
1142
+ color:#fff;
1143
+ overflow:hidden;
1144
+ font-size:12px;
1145
+ }
1146
+ #yop-poll-container-%POLL-ID% input[type='text'] {
1147
+ margin:0px 0px 5px 0px;
1148
+ padding:2%;
1149
+ width:96%;
1150
+ text-indent:2%;
1151
+ font-size:12px;
1152
+ }
1153
+
1154
+ .yop-poll-name-%POLL-ID% {
1155
+ font-size:14px;
1156
+ font-weight:bold;
1157
+ }
1158
+
1159
+ #yop-poll-questions-container-%POLL-ID% {
1160
+ font-size:14px;
1161
+ margin:5px 0px;
1162
+ }
1163
+ .yop-poll-question-container-%POLL-ID% {
1164
+ padding: 2px;
1165
+ }
1166
+ .yop-poll-question-%POLL-ID% {
1167
+ margin-bottom: 21px;
1168
+ margin-top: -10px;
1169
+ font-style: italic;
1170
+ text-align: center;
1171
+ width: 100%;
1172
+ }
1173
+ .yop-poll-answers-%POLL-ID% { }
1174
+ .yop-poll-answers-%POLL-ID% ul {
1175
+ list-style: none outside none;
1176
+ margin: 0;
1177
+ padding: 0;
1178
+ }
1179
+ .yop-poll-li-answer-%POLL-ID% {
1180
+ font-style:normal;
1181
+ margin:0px 0px 10px 0px;
1182
+ padding:0px;
1183
+ font-size:12px;
1184
+ margin-bottom:20px;
1185
+ }
1186
+ .yop-poll-li-answer-%POLL-ID% input {
1187
+ margin:0px;
1188
+ float:none;
1189
+ }
1190
+ .yop-poll-li-answer-%POLL-ID% label {
1191
+ margin:0px;
1192
+ font-style:normal;
1193
+ font-weight:normal;
1194
+ font-size:12px;
1195
+ float:none;
1196
+ }
1197
+ .yop-poll-results-%POLL-ID% {
1198
+ font-size: 12px;
1199
+ font-style: italic;
1200
+ font-weight: normal;
1201
+ margin-left: 15px;
1202
+ }
1203
+
1204
+ .yop-poll-customs-%POLL-ID% { }
1205
+ .yop-poll-customs-%POLL-ID% ul {
1206
+ list-style: none outside none;
1207
+ margin: 0;
1208
+ padding: 0;
1209
+ }
1210
+ .yop-poll-li-custom-%POLL-ID% {
1211
+ padding:0px;
1212
+ margin:0px;
1213
+ font-size:14px;
1214
+ }
1215
+
1216
+ /* Start CAPTCHA div style*/
1217
+ #yop-poll-captcha-input-div-%POLL-ID% {
1218
+ margin-top:5px;
1219
+ }
1220
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1221
+ width:30px;
1222
+ float:left;
1223
+ margin-left:5px;
1224
+ height:0px;
1225
+ }
1226
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1227
+ margin-bottom:2px;
1228
+ }
1229
+ #yop-poll-captcha-image-div-%POLL-ID% {
1230
+ margin-bottom:5px;
1231
+ }
1232
+ #yop_poll_captcha_image_%POLL-ID% {
1233
+ float:left;
1234
+ }
1235
+ /* End CAPTCHA div style*/
1236
+
1237
+ .yop-poll-clear-%POLL-ID% {
1238
+ clear:both;
1239
+ }
1240
+
1241
+ #yop-poll-vote-%POLL-ID% {
1242
+
1243
+ }
1244
+
1245
+ /* Start Result bar*/
1246
+ .yop-poll-results-bar-%POLL-ID% {
1247
+ background:#f5f5f5;
1248
+ height:10px;
1249
+ }
1250
+ .yop-poll-results-bar-%POLL-ID% div {
1251
+ background:#333333;
1252
+ height:10px;
1253
+ }
1254
+ /* End Result bar*/
1255
+
1256
+ /* Start Vote Button*/
1257
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1258
+ float:left;
1259
+ }
1260
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1261
+ float: right;
1262
+ margin-bottom: 20px;
1263
+ margin-top: -20px;
1264
+ width: auto;
1265
+ }
1266
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1267
+ color:#fff;
1268
+ text-decoration:underline;
1269
+ font-size:12px;
1270
+ }
1271
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1272
+ color:#fff;
1273
+ text-decoration:underline;
1274
+ font-size:12px;
1275
+ }#yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1276
+ color:#fff;
1277
+ text-decoration:underline;
1278
+ font-size:12px;
1279
+ }
1280
+ #yop-poll-vote-%POLL-ID% div {
1281
+ float:left;
1282
+ width:100%;
1283
+ }
1284
+ /* End Vote Button*/
1285
+
1286
+ /* Start Messages*/
1287
+ #yop-poll-container-error-%POLL-ID% {
1288
+ font-size:12px;
1289
+ font-style:italic;
1290
+ color:red;
1291
+ text-transform:lowercase;
1292
+ margin-bottom:20px;
1293
+ text-align:center;
1294
+ }
1295
+ #yop-poll-container-success-%POLL-ID% {
1296
+ font-size:12px;
1297
+ font-style:italic;
1298
+ color:green;
1299
+ margin-bottom:20px;
1300
+ text-align:center;
1301
+ }
1302
+ /* End Messages*/
1303
+ NOWDOC;
1304
+ break;
1305
+ }
1306
+ case 'Blue v1':
1307
+ { //Blue v1
1308
+ $css = <<<NOWDOC
1309
+ #yop-poll-container-%POLL-ID% {
1310
+ width: %POLL-WIDTH%;
1311
+ background:#327BD6;
1312
+ padding:10px;
1313
+ color:#fff;
1314
+ overflow:hidden;
1315
+ font-size:12px;
1316
+ }
1317
+ #yop-poll-container-%POLL-ID% input[type='text'] {
1318
+ margin:0px 0px 5px 0px;
1319
+ padding:2%;
1320
+ width:96%;
1321
+ text-indent:2%;
1322
+ font-size:12px;
1323
+ }
1324
+
1325
+ .yop-poll-name-%POLL-ID% {
1326
+ font-size:14px;
1327
+ font-weight:bold;
1328
+ }
1329
+
1330
+ #yop-poll-questions-container-%POLL-ID% {
1331
+ font-size:14px;
1332
+ margin:5px 0px;
1333
+ }
1334
+ .yop-poll-question-container-%POLL-ID% {
1335
+ padding: 2px;
1336
+ }
1337
+ .yop-poll-question-%POLL-ID% {
1338
+ margin-bottom: 21px;
1339
+ margin-top: -10px;
1340
+ font-style: italic;
1341
+ text-align: center;
1342
+ width: 100%;
1343
+ }
1344
+ .yop-poll-answers-%POLL-ID% { }
1345
+ .yop-poll-answers-%POLL-ID% ul {
1346
+ list-style: none outside none;
1347
+ margin: 0;
1348
+ padding: 0;
1349
+ }
1350
+ .yop-poll-li-answer-%POLL-ID% {
1351
+ font-style:normal;
1352
+ margin:0px 0px 10px 0px;
1353
+ padding:0px;
1354
+ font-size:12px;
1355
+ margin-bottom:20px;
1356
+ }
1357
+ .yop-poll-li-answer-%POLL-ID% input {
1358
+ margin:0px;
1359
+ float:none;
1360
+ }
1361
+ .yop-poll-li-answer-%POLL-ID% label {
1362
+ margin:0px;
1363
+ font-style:normal;
1364
+ font-weight:normal;
1365
+ font-size:12px;
1366
+ float:none;
1367
+ }
1368
+ .yop-poll-results-%POLL-ID% {
1369
+ font-size: 12px;
1370
+ font-style: italic;
1371
+ font-weight: normal;
1372
+ margin-left: 15px;
1373
+ }
1374
+
1375
+ .yop-poll-customs-%POLL-ID% { }
1376
+ .yop-poll-customs-%POLL-ID% ul {
1377
+ list-style: none outside none;
1378
+ margin: 0;
1379
+ padding: 0;
1380
+ }
1381
+ .yop-poll-li-custom-%POLL-ID% {
1382
+ padding:0px;
1383
+ margin:0px;
1384
+ font-size:14px;
1385
+ }
1386
+
1387
+ /* Start CAPTCHA div style*/
1388
+ #yop-poll-captcha-input-div-%POLL-ID% {
1389
+ margin-top:5px;
1390
+ }
1391
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1392
+ width:30px;
1393
+ float:left;
1394
+ margin-left:5px;
1395
+ height:0px;
1396
+ }
1397
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1398
+ margin-bottom:2px;
1399
+ }
1400
+ #yop-poll-captcha-image-div-%POLL-ID% {
1401
+ margin-bottom:5px;
1402
+ }
1403
+ #yop_poll_captcha_image_%POLL-ID% {
1404
+ float:left;
1405
+ }
1406
+ /* End CAPTCHA div style*/
1407
+
1408
+ .yop-poll-clear-%POLL-ID% {
1409
+ clear:both;
1410
+ }
1411
+
1412
+ #yop-poll-vote-%POLL-ID% {
1413
+
1414
+ }
1415
+
1416
+ /* Start Result bar*/
1417
+ .yop-poll-results-bar-%POLL-ID% {
1418
+ background:#f5f5f5;
1419
+ height:10px;
1420
+ }
1421
+ .yop-poll-results-bar-%POLL-ID% div {
1422
+ background:#555;
1423
+ height:10px;
1424
+ }
1425
+ /* End Result bar*/
1426
+
1427
+ /* Start Vote Button*/
1428
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1429
+ float:left;
1430
+ }
1431
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1432
+ float: right;
1433
+ margin-bottom: 20px;
1434
+ margin-top: -20px;
1435
+ width: auto;
1436
+ }
1437
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1438
+ color:#fff;
1439
+ text-decoration:underline;
1440
+ font-size:12px;
1441
+ }
1442
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1443
+ color:#fff;
1444
+ text-decoration:underline;
1445
+ font-size:12px;
1446
+ }
1447
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1448
+ color:#fff;
1449
+ text-decoration:underline;
1450
+ font-size:12px;
1451
+ }
1452
+ #yop-poll-vote-%POLL-ID% div {
1453
+ float:left;
1454
+ width:100%;
1455
+ }
1456
+ /* End Vote Button*/
1457
+
1458
+ /* Start Messages*/
1459
+ #yop-poll-container-error-%POLL-ID% {
1460
+ font-size:12px;
1461
+ font-style:italic;
1462
+ color:red;
1463
+ text-transform:lowercase;
1464
+ margin-bottom:20px;
1465
+ text-align:center;
1466
+ }
1467
+ #yop-poll-container-success-%POLL-ID% {
1468
+ font-size:12px;
1469
+ font-style:italic;
1470
+ color:green;
1471
+ margin-bottom:20px;
1472
+ text-align:center;
1473
+ }
1474
+ /* End Messages*/
1475
+ NOWDOC;
1476
+ break;
1477
+ }
1478
+ case 'Blue v2':
1479
+ { //Blue v2
1480
+ $css = <<<NOWDOC
1481
+ #yop-poll-container-%POLL-ID% {
1482
+ width: %POLL-WIDTH%;
1483
+ background:#fff;
1484
+ padding:10px;
1485
+ color:#555;
1486
+ overflow:hidden;
1487
+ font-size:12px;
1488
+ }
1489
+ #yop-poll-container-%POLL-ID% input[type='text'] {
1490
+ margin:0px 0px 5px 0px;
1491
+ padding:2%;
1492
+ width:96%;
1493
+ text-indent:2%;
1494
+ font-size:12px;
1495
+ }
1496
+
1497
+ .yop-poll-name-%POLL-ID% {
1498
+ font-weight:bold;
1499
+ background:#327BD6;
1500
+ color:#fff;
1501
+ padding:5px;
1502
+ text-align:center;
1503
+ font-size:12px;
1504
+ }
1505
+
1506
+ #yop-poll-questions-container-%POLL-ID% {
1507
+ font-size:14px;
1508
+ margin:5px 0px;
1509
+ }
1510
+ .yop-poll-question-container-%POLL-ID% {
1511
+ padding: 2px;
1512
+ }
1513
+ .yop-poll-question-%POLL-ID% {
1514
+ background:#327BD6;
1515
+ color:#fff;
1516
+ margin-bottom: 21px;
1517
+ margin-top: -10px;
1518
+ font-style: italic;
1519
+ text-align: center;
1520
+ width: 100%;
1521
+ padding:5px;
1522
+ }
1523
+ .yop-poll-answers-%POLL-ID% { }
1524
+ .yop-poll-answers-%POLL-ID% ul {
1525
+ list-style: none outside none;
1526
+ margin: 0;
1527
+ padding: 0;
1528
+ }
1529
+ .yop-poll-li-answer-%POLL-ID% {
1530
+ font-style:normal;
1531
+ margin:0px 0px 10px 0px;
1532
+ padding:0px;
1533
+ font-size:12px;
1534
+ margin-bottom:20px;
1535
+ }
1536
+ .yop-poll-li-answer-%POLL-ID% input {
1537
+ margin:0px;
1538
+ float:none;
1539
+ }
1540
+ .yop-poll-li-answer-%POLL-ID% label {
1541
+ margin:0px;
1542
+ font-style:normal;
1543
+ font-weight:normal;
1544
+ font-size:12px;
1545
+ float:none;
1546
+ }
1547
+ .yop-poll-results-%POLL-ID% {
1548
+ font-size: 12px;
1549
+ font-style: italic;
1550
+ font-weight: normal;
1551
+ margin-left: 15px;
1552
+ }
1553
+
1554
+ .yop-poll-customs-%POLL-ID% { }
1555
+ .yop-poll-customs-%POLL-ID% ul {
1556
+ list-style: none outside none;
1557
+ margin: 0;
1558
+ padding: 0;
1559
+ }
1560
+ .yop-poll-li-custom-%POLL-ID% {
1561
+ padding:0px;
1562
+ margin:0px;
1563
+ font-size:14px;
1564
+ }
1565
+
1566
+ /* Start CAPTCHA div style*/
1567
+ #yop-poll-captcha-input-div-%POLL-ID% {
1568
+ margin-top:5px;
1569
+ }
1570
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1571
+ width:30px;
1572
+ float:left;
1573
+ margin-left:5px;
1574
+ height:0px;
1575
+ }
1576
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1577
+ margin-bottom:2px;
1578
+ }
1579
+ #yop-poll-captcha-image-div-%POLL-ID% {
1580
+ margin-bottom:5px;
1581
+ }
1582
+ #yop_poll_captcha_image_%POLL-ID% {
1583
+ float:left;
1584
+ }
1585
+ /* End CAPTCHA div style*/
1586
+
1587
+ .yop-poll-clear-%POLL-ID% {
1588
+ clear:both;
1589
+ }
1590
+
1591
+ #yop-poll-vote-%POLL-ID% {
1592
+
1593
+ }
1594
+
1595
+ /* Start Result bar*/
1596
+ .yop-poll-results-bar-%POLL-ID% {
1597
+ background:#f5f5f5;
1598
+ height:10px;
1599
+ }
1600
+ .yop-poll-results-bar-%POLL-ID% div {
1601
+ background:#555;
1602
+ height:10px;
1603
+ }
1604
+ /* End Result bar*/
1605
+
1606
+ /* Start Vote Button*/
1607
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1608
+ float:left;
1609
+ }
1610
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1611
+ float: right;
1612
+ margin-bottom: 20px;
1613
+ margin-top: -20px;
1614
+ width: auto;
1615
+ }
1616
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1617
+ color:#fff;
1618
+ text-decoration:underline;
1619
+ font-size:12px;
1620
+ }
1621
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1622
+ color:#555;
1623
+ text-decoration:underline;
1624
+ font-size:12px;
1625
+ }
1626
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1627
+ color:#555;
1628
+ text-decoration:underline;
1629
+ font-size:12px;
1630
+ }
1631
+ #yop-poll-vote-%POLL-ID% div {
1632
+ float:left;
1633
+ width:100%;
1634
+ }
1635
+ /* End Vote Button*/
1636
+
1637
+ /* Start Messages*/
1638
+ #yop-poll-container-error-%POLL-ID% {
1639
+ font-size:12px;
1640
+ font-style:italic;
1641
+ color:red;
1642
+ text-transform:lowercase;
1643
+ margin-bottom:20px;
1644
+ text-align:center;
1645
+ }
1646
+ #yop-poll-container-success-%POLL-ID% {
1647
+ font-size:12px;
1648
+ font-style:italic;
1649
+ color:green;
1650
+ margin-bottom:20px;
1651
+ text-align:center;
1652
+ }
1653
+ /* End Messages*/
1654
+ NOWDOC;
1655
+ break;
1656
+ }
1657
+ case 'Blue v3':
1658
+ { //Blue v3
1659
+ $css = <<<NOWDOC
1660
+ #yop-poll-container-%POLL-ID% {
1661
+ width: %POLL-WIDTH%;
1662
+ background:#fff;
1663
+ padding:10px;
1664
+ color:#555;
1665
+ overflow:hidden;
1666
+ font-size:12px;
1667
+ border: 5px solid #327BD6;
1668
+ }
1669
+ #yop-poll-container-%POLL-ID% input[type='text'] {
1670
+ margin:0px 0px 5px 0px;
1671
+ padding:2%;
1672
+ width:96%;
1673
+ text-indent:2%;
1674
+ font-size:12px;
1675
+ }
1676
+
1677
+ .yop-poll-name-%POLL-ID% {
1678
+ font-size:14px;
1679
+ font-weight:bold;
1680
+ }
1681
+
1682
+ #yop-poll-questions-container-%POLL-ID% {
1683
+ font-size:14px;
1684
+ margin:5px 0px;
1685
+ }
1686
+ .yop-poll-question-container-%POLL-ID% {
1687
+ padding: 2px;
1688
+ }
1689
+ .yop-poll-question-%POLL-ID% {
1690
+ margin-bottom: 21px;
1691
+ margin-top: -10px;
1692
+ font-style: italic;
1693
+ text-align: center;
1694
+ width: 100%;
1695
+ }
1696
+ .yop-poll-answers-%POLL-ID% { }
1697
+ .yop-poll-answers-%POLL-ID% ul {
1698
+ list-style: none outside none;
1699
+ margin: 0;
1700
+ padding: 0;
1701
+ }
1702
+ .yop-poll-li-answer-%POLL-ID% {
1703
+ font-style:normal;
1704
+ margin:0px 0px 10px 0px;
1705
+ padding:0px;
1706
+ font-size:12px;
1707
+ margin-bottom:20px;
1708
+ }
1709
+ .yop-poll-li-answer-%POLL-ID% input {
1710
+ margin:0px;
1711
+ float:none;
1712
+ }
1713
+ .yop-poll-li-answer-%POLL-ID% label {
1714
+ margin:0px;
1715
+ font-style:normal;
1716
+ font-weight:normal;
1717
+ font-size:12px;
1718
+ float:none;
1719
+ }
1720
+ .yop-poll-results-%POLL-ID% {
1721
+ font-size: 12px;
1722
+ font-style: italic;
1723
+ font-weight: normal;
1724
+ margin-left: 15px;
1725
+ }
1726
+
1727
+ .yop-poll-customs-%POLL-ID% { }
1728
+ .yop-poll-customs-%POLL-ID% ul {
1729
+ list-style: none outside none;
1730
+ margin: 0;
1731
+ padding: 0;
1732
+ }
1733
+ .yop-poll-li-custom-%POLL-ID% {
1734
+ padding:0px;
1735
+ margin:0px;
1736
+ font-size:14px;
1737
+ }
1738
+
1739
+ /* Start CAPTCHA div style*/
1740
+ #yop-poll-captcha-input-div-%POLL-ID% {
1741
+ margin-top:5px;
1742
+ }
1743
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1744
+ width:30px;
1745
+ float:left;
1746
+ margin-left:5px;
1747
+ height:0px;
1748
+ }
1749
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1750
+ margin-bottom:2px;
1751
+ }
1752
+ #yop-poll-captcha-image-div-%POLL-ID% {
1753
+ margin-bottom:5px;
1754
+ }
1755
+ #yop_poll_captcha_image_%POLL-ID% {
1756
+ float:left;
1757
+ }
1758
+ /* End CAPTCHA div style*/
1759
+
1760
+ .yop-poll-clear-%POLL-ID% {
1761
+ clear:both;
1762
+ }
1763
+
1764
+ #yop-poll-vote-%POLL-ID% {
1765
+
1766
+ }
1767
+
1768
+ /* Start Result bar*/
1769
+ .yop-poll-results-bar-%POLL-ID% {
1770
+ background:#f5f5f5;
1771
+ height:10px;
1772
+ }
1773
+ .yop-poll-results-bar-%POLL-ID% div {
1774
+ background:#555;
1775
+ height:10px;
1776
+ }
1777
+ /* End Result bar*/
1778
+
1779
+ /* Start Vote Button*/
1780
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1781
+ float:left;
1782
+ }
1783
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1784
+ float: right;
1785
+ margin-bottom: 20px;
1786
+ margin-top: -20px;
1787
+ width: auto;
1788
+ }
1789
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1790
+ color:#555;
1791
+ text-decoration:underline;
1792
+ font-size:12px;
1793
+ }
1794
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1795
+ color:#555;
1796
+ text-decoration:underline;
1797
+ font-size:12px;
1798
+ }
1799
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1800
+ color:#555;
1801
+ text-decoration:underline;
1802
+ font-size:12px;
1803
+ }
1804
+ #yop-poll-vote-%POLL-ID% div {
1805
+ float:left;
1806
+ width:100%;
1807
+ }
1808
+ /* End Vote Button*/
1809
+
1810
+ /* Start Messages*/
1811
+ #yop-poll-container-error-%POLL-ID% {
1812
+ font-size:12px;
1813
+ font-style:italic;
1814
+ color:red;
1815
+ text-transform:lowercase;
1816
+ margin-bottom:20px;
1817
+ text-align:center;
1818
+ }
1819
+ #yop-poll-container-success-%POLL-ID% {
1820
+ font-size:12px;
1821
+ font-style:italic;
1822
+ color:green;
1823
+ margin-bottom:20px;
1824
+ text-align:center;
1825
+ }
1826
+ /* End Messages*/
1827
+ NOWDOC;
1828
+ break;
1829
+ }
1830
+ case 'Red v1':
1831
+ { //Red v1
1832
+ $css = <<<NOWDOC
1833
+ #yop-poll-container-%POLL-ID% {
1834
+ width: %POLL-WIDTH%;
1835
+ background:#B70004;
1836
+ padding:10px;
1837
+ color:#fff;
1838
+ overflow:hidden;
1839
+ font-size:12px;
1840
+ }
1841
+ #yop-poll-container-%POLL-ID% input[type='text'] {
1842
+ margin:0px 0px 5px 0px;
1843
+ padding:2%;
1844
+ width:96%;
1845
+ text-indent:2%;
1846
+ font-size:12px;
1847
+ }
1848
+
1849
+ .yop-poll-name-%POLL-ID% {
1850
+ font-size:14px;
1851
+ font-weight:bold;
1852
+ }
1853
+
1854
+ #yop-poll-questions-container-%POLL-ID% {
1855
+ font-size:14px;
1856
+ margin:5px 0px;
1857
+ }
1858
+ .yop-poll-question-container-%POLL-ID% {
1859
+ padding: 2px;
1860
+ }
1861
+ .yop-poll-question-%POLL-ID% {
1862
+ margin-bottom: 21px;
1863
+ margin-top: -10px;
1864
+ font-style: italic;
1865
+ text-align: center;
1866
+ width: 100%;
1867
+ }
1868
+ .yop-poll-answers-%POLL-ID% { }
1869
+ .yop-poll-answers-%POLL-ID% ul {
1870
+ list-style: none outside none;
1871
+ margin: 0;
1872
+ padding: 0;
1873
+ }
1874
+ .yop-poll-li-answer-%POLL-ID% {
1875
+ font-style:normal;
1876
+ margin:0px 0px 10px 0px;
1877
+ padding:0px;
1878
+ font-size:12px;
1879
+ margin-bottom:20px;
1880
+ }
1881
+ .yop-poll-li-answer-%POLL-ID% input {
1882
+ margin:0px;
1883
+ float:none;
1884
+ }
1885
+ .yop-poll-li-answer-%POLL-ID% label {
1886
+ margin:0px;
1887
+ font-style:normal;
1888
+ font-weight:normal;
1889
+ font-size:12px;
1890
+ float:none;
1891
+ }
1892
+ .yop-poll-results-%POLL-ID% {
1893
+ font-size: 12px;
1894
+ font-style: italic;
1895
+ font-weight: normal;
1896
+ margin-left: 15px;
1897
+ }
1898
+
1899
+ .yop-poll-customs-%POLL-ID% { }
1900
+ .yop-poll-customs-%POLL-ID% ul {
1901
+ list-style: none outside none;
1902
+ margin: 0;
1903
+ padding: 0;
1904
+ }
1905
+ .yop-poll-li-custom-%POLL-ID% {
1906
+ padding:0px;
1907
+ margin:0px;
1908
+ font-size:14px;
1909
+ }
1910
+
1911
+ /* Start CAPTCHA div style*/
1912
+ #yop-poll-captcha-input-div-%POLL-ID% {
1913
+ margin-top:5px;
1914
+ }
1915
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
1916
+ width:30px;
1917
+ float:left;
1918
+ margin-left:5px;
1919
+ height:0px;
1920
+ }
1921
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
1922
+ margin-bottom:2px;
1923
+ }
1924
+ #yop-poll-captcha-image-div-%POLL-ID% {
1925
+ margin-bottom:5px;
1926
+ }
1927
+ #yop_poll_captcha_image_%POLL-ID% {
1928
+ float:left;
1929
+ }
1930
+ /* End CAPTCHA div style*/
1931
+
1932
+ .yop-poll-clear-%POLL-ID% {
1933
+ clear:both;
1934
+ }
1935
+
1936
+ #yop-poll-vote-%POLL-ID% {
1937
+
1938
+ }
1939
+
1940
+ /* Start Result bar*/
1941
+ .yop-poll-results-bar-%POLL-ID% {
1942
+ background:#f5f5f5;
1943
+ height:10px;
1944
+ }
1945
+ .yop-poll-results-bar-%POLL-ID% div {
1946
+ background:#555;
1947
+ height:10px;
1948
+ }
1949
+ /* End Result bar*/
1950
+
1951
+ /* Start Vote Button*/
1952
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
1953
+ float:left;
1954
+ }
1955
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
1956
+ float: right;
1957
+ margin-bottom: 20px;
1958
+ margin-top: -20px;
1959
+ width: auto;
1960
+ }
1961
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
1962
+ color:#fff;
1963
+ text-decoration:underline;
1964
+ font-size:12px;
1965
+ }
1966
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
1967
+ color:#fff;
1968
+ text-decoration:underline;
1969
+ font-size:12px;
1970
+ }
1971
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
1972
+ color:#fff;
1973
+ text-decoration:underline;
1974
+ font-size:12px;
1975
+ }
1976
+ #yop-poll-vote-%POLL-ID% div {
1977
+ float:left;
1978
+ width:100%;
1979
+ }
1980
+ /* End Vote Button*/
1981
+
1982
+ /* Start Messages*/
1983
+ #yop-poll-container-error-%POLL-ID% {
1984
+ font-size:12px;
1985
+ font-style:italic;
1986
+ color:red;
1987
+ text-transform:lowercase;
1988
+ margin-bottom:20px;
1989
+ text-align:center;
1990
+ }
1991
+ #yop-poll-container-success-%POLL-ID% {
1992
+ font-size:12px;
1993
+ font-style:italic;
1994
+ color:green;
1995
+ margin-bottom:20px;
1996
+ text-align:center;
1997
+ }
1998
+ /* End Messages*/
1999
+ NOWDOC;
2000
+ break;
2001
+ }
2002
+ case 'Red v2':
2003
+ { //Red v2
2004
+ $css = <<<NOWDOC
2005
+ #yop-poll-container-%POLL-ID% {
2006
+ width: %POLL-WIDTH%;
2007
+ background:#fff;
2008
+ padding:0px;
2009
+ color:#555;
2010
+ overflow:hidden;
2011
+ font-size:12px;
2012
+ }
2013
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2014
+ margin:0px 0px 5px 0px;
2015
+ padding:2%;
2016
+ width:96%;
2017
+ text-indent:2%;
2018
+ font-size:12px;
2019
+ }
2020
+
2021
+ .yop-poll-name-%POLL-ID% {
2022
+ font-weight:bold;
2023
+ background:#B70004;
2024
+ color:#fff;
2025
+ padding:5px;
2026
+ text-align:center;
2027
+ font-size:12px;
2028
+ }
2029
+
2030
+ #yop-poll-questions-container-%POLL-ID% {
2031
+ font-size:14px;
2032
+ margin:5px 0px;
2033
+ }
2034
+ .yop-poll-question-container-%POLL-ID% {
2035
+ padding: 2px;
2036
+ }
2037
+ .yop-poll-question-%POLL-ID% {
2038
+ margin-bottom: 21px;
2039
+ background:#B70004;
2040
+ color:#fff;
2041
+ margin-top: -10px;
2042
+ font-style: italic;
2043
+ text-align: center;
2044
+ width: 100%;
2045
+ padding:5px;
2046
+ }
2047
+ .yop-poll-answers-%POLL-ID% { }
2048
+ .yop-poll-answers-%POLL-ID% ul {
2049
+ list-style: none outside none;
2050
+ margin: 0;
2051
+ padding: 0;
2052
+ }
2053
+ .yop-poll-li-answer-%POLL-ID% {
2054
+ font-style:normal;
2055
+ margin:0px 0px 10px 0px;
2056
+ padding:0px;
2057
+ font-size:12px;
2058
+ margin-bottom:20px;
2059
+ }
2060
+ .yop-poll-li-answer-%POLL-ID% input {
2061
+ margin:0px;
2062
+ float:none;
2063
+ }
2064
+ .yop-poll-li-answer-%POLL-ID% label {
2065
+ margin:0px;
2066
+ font-style:normal;
2067
+ font-weight:normal;
2068
+ font-size:12px;
2069
+ float:none;
2070
+ }
2071
+ .yop-poll-results-%POLL-ID% {
2072
+ font-size: 12px;
2073
+ font-style: italic;
2074
+ font-weight: normal;
2075
+ margin-left: 15px;
2076
+ }
2077
+
2078
+ .yop-poll-customs-%POLL-ID% { }
2079
+ .yop-poll-customs-%POLL-ID% ul {
2080
+ list-style: none outside none;
2081
+ margin: 0;
2082
+ padding: 0;
2083
+ }
2084
+ .yop-poll-li-custom-%POLL-ID% {
2085
+ padding:0px;
2086
+ margin:0px;
2087
+ font-size:14px;
2088
+ }
2089
+
2090
+ /* Start CAPTCHA div style*/
2091
+ #yop-poll-captcha-input-div-%POLL-ID% {
2092
+ margin-top:5px;
2093
+ }
2094
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2095
+ width:30px;
2096
+ float:left;
2097
+ margin-left:5px;
2098
+ height:0px;
2099
+ }
2100
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2101
+ margin-bottom:2px;
2102
+ }
2103
+ #yop-poll-captcha-image-div-%POLL-ID% {
2104
+ margin-bottom:5px;
2105
+ }
2106
+ #yop_poll_captcha_image_%POLL-ID% {
2107
+ float:left;
2108
+ }
2109
+ /* End CAPTCHA div style*/
2110
+
2111
+ .yop-poll-clear-%POLL-ID% {
2112
+ clear:both;
2113
+ }
2114
+
2115
+ #yop-poll-vote-%POLL-ID% {}
2116
+
2117
+ /* Start Result bar*/
2118
+ .yop-poll-results-bar-%POLL-ID% {
2119
+ background:#f5f5f5;
2120
+ height:10px;
2121
+ }
2122
+ .yop-poll-results-bar-%POLL-ID% div {
2123
+ background:#555;
2124
+ }
2125
+ /* End Result bar*/
2126
+
2127
+ /* Start Vote Button*/
2128
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2129
+ float:left;
2130
+ }
2131
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2132
+ float: right;
2133
+ margin-bottom: 20px;
2134
+ margin-top: -20px;
2135
+ width: auto;
2136
+ }
2137
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
2138
+ color:#B70004;
2139
+ text-decoration:underline;
2140
+ font-size:12px;
2141
+ }
2142
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
2143
+ color:#B70004;
2144
+ text-decoration:underline;
2145
+ font-size:12px;
2146
+ }
2147
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
2148
+ color:#B70004;
2149
+ text-decoration:underline;
2150
+ font-size:12px;
2151
+ }
2152
+ #yop-poll-vote-%POLL-ID% div {
2153
+ float:left;
2154
+ width:100%;
2155
+ }
2156
+ /* End Vote Button*/
2157
+
2158
+ /* Start Messages*/
2159
+ #yop-poll-container-error-%POLL-ID% {
2160
+ font-size:12px;
2161
+ font-style:italic;
2162
+ color:red;
2163
+ text-transform: capitalize;
2164
+ margin-bottom:20px;
2165
+ text-align:center;
2166
+ }
2167
+ #yop-poll-container-success-%POLL-ID% {
2168
+ font-size:12px;
2169
+ font-style:italic;
2170
+ color:green;
2171
+ margin-bottom:20px;
2172
+ text-align:center;
2173
+ }
2174
+ /* End Messages*/
2175
+ NOWDOC;
2176
+ break;
2177
+ }
2178
+ case 'Red v3':
2179
+ { //Red v3
2180
+ $css = <<<NOWDOC
2181
+ #yop-poll-container-%POLL-ID% {
2182
+ width: %POLL-WIDTH%;
2183
+ background:#fff;
2184
+ padding:10px;
2185
+ color:#555;
2186
+ overflow:hidden;
2187
+ font-size:12px;
2188
+ border:5px solid #B70004;
2189
+ }
2190
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2191
+ margin:0px 0px 5px 0px;
2192
+ padding:2%;
2193
+ width:96%;
2194
+ text-indent:2%;
2195
+ font-size:12px;
2196
+ }
2197
+
2198
+ .yop-poll-name-%POLL-ID% {
2199
+ font-weight:bold;
2200
+ font-size:14px;
2201
+ }
2202
+
2203
+ #yop-poll-questions-container-%POLL-ID% {
2204
+ font-size:14px;
2205
+ margin:5px 0px;
2206
+ }
2207
+ .yop-poll-question-container-%POLL-ID% {
2208
+ padding: 2px;
2209
+ }
2210
+ .yop-poll-question-%POLL-ID% {
2211
+ margin-bottom: 21px;
2212
+ margin-top: -10px;
2213
+ font-style: italic;
2214
+ text-align: center;
2215
+ width: 100%;
2216
+ }
2217
+ .yop-poll-answers-%POLL-ID% { }
2218
+ .yop-poll-answers-%POLL-ID% ul {
2219
+ list-style: none outside none;
2220
+ margin: 0;
2221
+ padding: 0;
2222
+ }
2223
+ .yop-poll-li-answer-%POLL-ID% {
2224
+ font-style:normal;
2225
+ margin:0px 0px 10px 0px;
2226
+ padding:0px;
2227
+ font-size:12px;
2228
+ margin-bottom:20px;
2229
+ }
2230
+ .yop-poll-li-answer-%POLL-ID% input {
2231
+ margin:0px;
2232
+ float:none;
2233
+ }
2234
+ .yop-poll-li-answer-%POLL-ID% label {
2235
+ margin:0px;
2236
+ font-style:normal;
2237
+ font-weight:normal;
2238
+ font-size:12px;
2239
+ float:none;
2240
+ }
2241
+ .yop-poll-results-%POLL-ID% {
2242
+ font-size: 12px;
2243
+ font-style: italic;
2244
+ font-weight: normal;
2245
+ margin-left: 15px;
2246
+ }
2247
+
2248
+ .yop-poll-customs-%POLL-ID% { }
2249
+ .yop-poll-customs-%POLL-ID% ul {
2250
+ list-style: none outside none;
2251
+ margin: 0;
2252
+ padding: 0;
2253
+ }
2254
+ .yop-poll-li-custom-%POLL-ID% {
2255
+ padding:0px;
2256
+ margin:0px;
2257
+ font-size:14px;
2258
+ }
2259
+
2260
+ /* Start CAPTCHA div style*/
2261
+ #yop-poll-captcha-input-div-%POLL-ID% {
2262
+ margin-top:5px;
2263
+ }
2264
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2265
+ width:30px;
2266
+ float:left;
2267
+ margin-left:5px;
2268
+ height:0px;
2269
+ }
2270
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2271
+ margin-bottom:2px;
2272
+ }
2273
+ #yop-poll-captcha-image-div-%POLL-ID% {
2274
+ margin-bottom:5px;
2275
+ }
2276
+ #yop_poll_captcha_image_%POLL-ID% {
2277
+ float:left;
2278
+ }
2279
+ /* End CAPTCHA div style*/
2280
+
2281
+ .yop-poll-clear-%POLL-ID% {
2282
+ clear:both;
2283
+ }
2284
+
2285
+ #yop-poll-vote-%POLL-ID% {
2286
+
2287
+ }
2288
+
2289
+ /* Start Result bar*/
2290
+ .yop-poll-results-bar-%POLL-ID% {
2291
+ background:#f5f5f5;
2292
+ height:10px;
2293
+ }
2294
+ .yop-poll-results-bar-%POLL-ID% div {
2295
+ background:#555;
2296
+ }
2297
+ /* End Result bar*/
2298
+
2299
+ /* Start Vote Button*/
2300
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2301
+ float:left;
2302
+ }
2303
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2304
+ float: right;
2305
+ margin-bottom: 20px;
2306
+ margin-top: -20px;
2307
+ width: auto;
2308
+ }
2309
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
2310
+ color:#B70004;
2311
+ text-decoration:underline;
2312
+ font-size:12px;
2313
+ }
2314
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
2315
+ color:#B70004;
2316
+ text-decoration:underline;
2317
+ font-size:12px;
2318
+ }
2319
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
2320
+ color:#B70004;
2321
+ text-decoration:underline;
2322
+ font-size:12px;
2323
+ }
2324
+ #yop-poll-vote-%POLL-ID% div {
2325
+ float:left;
2326
+ width:100%;
2327
+ }
2328
+ /* End Vote Button*/
2329
+
2330
+ /* Start Messages*/
2331
+ #yop-poll-container-error-%POLL-ID% {
2332
+ font-size:12px;
2333
+ font-style:italic;
2334
+ color:red;
2335
+ text-transform: capitalize;
2336
+ margin-bottom:20px;
2337
+ text-align:center;
2338
+ }
2339
+ #yop-poll-container-success-%POLL-ID% {
2340
+ font-size:12px;
2341
+ font-style:italic;
2342
+ color:green;
2343
+ margin-bottom:20px;
2344
+ text-align:center;
2345
+ }
2346
+ /* End Messages*/
2347
+ NOWDOC;
2348
+ break;
2349
+ }
2350
+ case 'Green v1':
2351
+ { //Green v1
2352
+ $css = <<<NOWDOC
2353
+ #yop-poll-container-%POLL-ID% {
2354
+ width:%POLL-WIDTH%;
2355
+ background:#3F8B43;
2356
+ padding:10px;
2357
+ color:#fff;
2358
+ overflow:hidden;
2359
+ font-size:12px;
2360
+ }
2361
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2362
+ margin:0px 0px 5px 0px;
2363
+ padding:2%;
2364
+ width:96%;
2365
+ text-indent:2%;
2366
+ font-size:12px;
2367
+ }
2368
+
2369
+ .yop-poll-name-%POLL-ID% {
2370
+ font-size:14px;
2371
+ font-weight:bold;
2372
+ }
2373
 
2374
+ #yop-poll-questions-container-%POLL-ID% {
2375
+ font-size:14px;
2376
+ margin:5px 0px;
2377
+ }
2378
+ .yop-poll-question-container-%POLL-ID% {
2379
+ padding: 2px;
2380
+ }
2381
+ .yop-poll-question-%POLL-ID% {
2382
+ margin-bottom: 21px;
2383
+ margin-top: -10px;
2384
+ font-style: italic;
2385
+ text-align: center;
2386
+ width: 100%;
2387
+ }
2388
+ .yop-poll-answers-%POLL-ID% { }
2389
+ .yop-poll-answers-%POLL-ID% ul {
2390
+ list-style: none outside none;
2391
+ margin: 0;
2392
+ padding: 0;
2393
+ }
2394
+ .yop-poll-li-answer-%POLL-ID% {
2395
+ font-style:normal;
2396
+ margin:0px 0px 10px 0px;
2397
+ padding:0px;
2398
+ font-size:12px;
2399
+ margin-bottom:20px;
2400
+ }
2401
+ .yop-poll-li-answer-%POLL-ID% input {
2402
+ margin:0px;
2403
+ float:none;
2404
+ }
2405
+ .yop-poll-li-answer-%POLL-ID% label {
2406
+ margin:0px;
2407
+ font-style:normal;
2408
+ font-weight:normal;
2409
+ font-size:12px;
2410
+ float:none;
2411
+ }
2412
+ .yop-poll-results-%POLL-ID% {
2413
+ font-size: 12px;
2414
+ font-style: italic;
2415
+ font-weight: normal;
2416
+ margin-left: 15px;
2417
+ }
2418
 
2419
+ .yop-poll-customs-%POLL-ID% { }
2420
+ .yop-poll-customs-%POLL-ID% ul {
2421
+ list-style: none outside none;
2422
+ margin: 0;
2423
+ padding: 0;
2424
+ }
2425
+ .yop-poll-li-custom-%POLL-ID% {
2426
+ padding:0px;
2427
+ margin:0px;
2428
+ font-size:14px;
2429
+ }
 
 
 
 
 
 
2430
 
2431
+ /* Start CAPTCHA div style*/
2432
+ #yop-poll-captcha-input-div-%POLL-ID% {
2433
+ margin-top:5px;
2434
+ }
2435
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2436
+ width:30px;
2437
+ float:left;
2438
+ margin-left:5px;
2439
+ height:0px;
2440
+ }
2441
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2442
+ margin-bottom:2px;
2443
+ }
2444
+ #yop-poll-captcha-image-div-%POLL-ID% {
2445
+ margin-bottom:5px;
2446
+ }
2447
+ #yop_poll_captcha_image_%POLL-ID% {
2448
+ float:left;
2449
+ }
2450
+ /* End CAPTCHA div style*/
 
 
2451
 
2452
+ .yop-poll-clear-%POLL-ID% {
2453
+ clear:both;
2454
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2455
 
2456
+ #yop-poll-vote-%POLL-ID% {
2457
+
2458
+ }
2459
+
2460
+ /* Start Result bar*/
2461
+ .yop-poll-results-bar-%POLL-ID% {
2462
+ background:#f5f5f5;
2463
+ height:10px;
2464
+ }
2465
+ .yop-poll-results-bar-%POLL-ID% div {
2466
+ background:#555;
2467
+ }
2468
+ /* End Result bar*/
2469
+
2470
+ /* Start Vote Button*/
2471
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2472
+ float:left;
2473
+ }
2474
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2475
+ float: right;
2476
+ margin-bottom: 20px;
2477
+ margin-top: -20px;
2478
+ width: auto;
2479
+ }
2480
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
2481
+ color:#fff;
2482
+ text-decoration:underline;
2483
+ font-size:12px;
2484
+ }
2485
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
2486
+ color:#fff;
2487
+ text-decoration:underline;
2488
+ font-size:12px;
2489
+ }
2490
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
2491
+ color:#fff;
2492
+ text-decoration:underline;
2493
+ font-size:12px;
2494
+ }
2495
+ #yop-poll-vote-%POLL-ID% div {
2496
+ float:left;
2497
+ width:100%;
2498
+ }
2499
+ /* End Vote Button*/
2500
+
2501
+ /* Start Messages*/
2502
+ #yop-poll-container-error-%POLL-ID% {
2503
+ font-size:12px;
2504
+ font-style:italic;
2505
+ color:red;
2506
+ text-transform:capitalize;
2507
+ margin-bottom:20px;
2508
+ text-align:center;
2509
+ }
2510
+ #yop-poll-container-success-%POLL-ID% {
2511
+ font-size:12px;
2512
+ font-style:italic;
2513
+ color:green;
2514
+ margin-bottom:20px;
2515
+ text-align:center;
2516
+ }
2517
+ /* End Messages*/
2518
+ NOWDOC;
2519
+ break;
2520
+ }
2521
+ case 'Green v2':
2522
+ { //Green v2
2523
+ $css = <<<NOWDOC
2524
+ #yop-poll-container-%POLL-ID% {
2525
+ width:%POLL-WIDTH%;
2526
+ background:#fff;
2527
+ padding:0px;
2528
+ color:#555;
2529
+ overflow:hidden;
2530
+ font-size:12px;
2531
+ }
2532
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2533
+ margin:0px 0px 5px 0px;
2534
+ padding:2%;
2535
+ width:96%;
2536
+ text-indent:2%;
2537
+ font-size:12px;
2538
+ }
2539
+
2540
+ .yop-poll-name-%POLL-ID% {
2541
+ font-weight:bold;
2542
+ background:#3F8B43;
2543
+ color:#fff;
2544
+ padding:5px;
2545
+ text-align:center;
2546
+ font-size:12px;
2547
+ }
2548
+
2549
+ #yop-poll-questions-container-%POLL-ID% {
2550
+ font-size:14px;
2551
+ margin:5px 0px;
2552
+ }
2553
+ .yop-poll-question-container-%POLL-ID% {
2554
+ padding: 2px;
2555
+ }
2556
+ .yop-poll-question-%POLL-ID% {
2557
+ margin-bottom: 21px;
2558
+ margin-top: -10px;
2559
+ font-style: italic;
2560
+ text-align: center;
2561
+ width: 100%;
2562
+ background:#3F8B43;
2563
+ color:#fff;
2564
+ padding:5px;
2565
+ }
2566
+ .yop-poll-answers-%POLL-ID% { }
2567
+ .yop-poll-answers-%POLL-ID% ul {
2568
+ list-style: none outside none;
2569
+ margin: 0;
2570
+ padding: 0;
2571
+ }
2572
+ .yop-poll-li-answer-%POLL-ID% {
2573
+ font-style:normal;
2574
+ margin:0px 0px 10px 0px;
2575
+ padding:0px;
2576
+ font-size:12px;
2577
+ margin-bottom:20px;
2578
+ }
2579
+ .yop-poll-li-answer-%POLL-ID% input {
2580
+ margin:0px;
2581
+ float:none;
2582
+ }
2583
+ .yop-poll-li-answer-%POLL-ID% label {
2584
+ margin:0px;
2585
+ font-style:normal;
2586
+ font-weight:normal;
2587
+ font-size:12px;
2588
+ float:none;
2589
+ }
2590
+ .yop-poll-results-%POLL-ID% {
2591
+ font-size: 12px;
2592
+ font-style: italic;
2593
+ font-weight: normal;
2594
+ margin-left: 15px;
2595
+ }
2596
+
2597
+ .yop-poll-customs-%POLL-ID% { }
2598
+ .yop-poll-customs-%POLL-ID% ul {
2599
+ list-style: none outside none;
2600
+ margin: 0;
2601
+ padding: 0;
2602
+ }
2603
+ .yop-poll-li-custom-%POLL-ID% {
2604
+ padding:0px;
2605
+ margin:0px;
2606
+ font-size:14px;
2607
+ }
2608
+
2609
+ /* Start CAPTCHA div style*/
2610
+ #yop-poll-captcha-input-div-%POLL-ID% {
2611
+ margin-top:5px;
2612
+ }
2613
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2614
+ width:30px;
2615
+ float:left;
2616
+ margin-left:5px;
2617
+ height:0px;
2618
+ }
2619
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2620
+ margin-bottom:2px;
2621
+ }
2622
+ #yop-poll-captcha-image-div-%POLL-ID% {
2623
+ margin-bottom:5px;
2624
+ }
2625
+ #yop_poll_captcha_image_%POLL-ID% {
2626
+ float:left;
2627
+ }
2628
+ /* End CAPTCHA div style*/
2629
+
2630
+ .yop-poll-clear-%POLL-ID% {
2631
+ clear:both;
2632
+ }
2633
+
2634
+ #yop-poll-vote-%POLL-ID% {
2635
+
2636
+ }
2637
+
2638
+ /* Start Result bar*/
2639
+ .yop-poll-results-bar-%POLL-ID% {
2640
+ background:#f5f5f5;
2641
+ height:10px;
2642
+ }
2643
+ .yop-poll-results-bar-%POLL-ID% div {
2644
+ background:#555;
2645
+ }
2646
+ /* End Result bar*/
2647
+
2648
+ /* Start Vote Button*/
2649
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2650
+ float:left;
2651
+ }
2652
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2653
+ float: right;
2654
+ margin-bottom: 20px;
2655
+ margin-top: -20px;
2656
+ width: auto;
2657
+ }
2658
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
2659
+ color:#3F8B43;
2660
+ text-decoration:underline;
2661
+ font-size:12px;
2662
+ }
2663
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
2664
+ color:#3F8B43;
2665
+ text-decoration:underline;
2666
+ font-size:12px;
2667
+ }
2668
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
2669
+ color:#3F8B43;
2670
+ text-decoration:underline;
2671
+ font-size:12px;
2672
+ }
2673
+ #yop-poll-vote-%POLL-ID% div {
2674
+ float:left;
2675
+ width:100%;
2676
+ }
2677
+ /* End Vote Button*/
2678
+
2679
+ /* Start Messages*/
2680
+ #yop-poll-container-error-%POLL-ID% {
2681
+ font-size:12px;
2682
+ font-style:italic;
2683
+ color:red;
2684
+ text-transform:capitalize;
2685
+ margin-bottom:20px;
2686
+ text-align:center;
2687
+ }
2688
+ #yop-poll-container-success-%POLL-ID% {
2689
+ font-size:12px;
2690
+ font-style:italic;
2691
+ color:green;
2692
+ text-transform:capitalize;
2693
+ margin-bottom:20px;
2694
+ text-align:center;
2695
+ }
2696
+ /* End Messages*/
2697
+ NOWDOC;
2698
+ break;
2699
+ }
2700
+ case 'Green v3':
2701
+ { //Green v3
2702
+ $css = <<<NOWDOC
2703
+ #yop-poll-container-%POLL-ID% {
2704
+ width:%POLL-WIDTH%;
2705
+ background:#fff;
2706
+ padding:10px;
2707
+ color:#555;
2708
+ overflow:hidden;
2709
+ font-size:12px;
2710
+ border:5px solid #3F8B43;
2711
+ }
2712
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2713
+ margin:0px 0px 5px 0px;
2714
+ padding:2%;
2715
+ width:96%;
2716
+ text-indent:2%;
2717
+ font-size:12px;
2718
+ }
2719
+
2720
+ .yop-poll-name-%POLL-ID% {
2721
+ font-weight:bold;
2722
+ font-size:14x;
2723
+ }
2724
+
2725
+ #yop-poll-questions-container-%POLL-ID% {
2726
+ font-size:14px;
2727
+ margin:5px 0px;
2728
+ }
2729
+ .yop-poll-question-container-%POLL-ID% {
2730
+ padding: 2px;
2731
+ }
2732
+ .yop-poll-question-%POLL-ID% {
2733
+ margin-bottom: 21px;
2734
+ margin-top: -10px;
2735
+ font-style: italic;
2736
+ text-align: center;
2737
+ width: 100%;
2738
+ }
2739
+ .yop-poll-answers-%POLL-ID% { }
2740
+ .yop-poll-answers-%POLL-ID% ul {
2741
+ list-style: none outside none;
2742
+ margin: 0;
2743
+ padding: 0;
2744
+ }
2745
+ .yop-poll-li-answer-%POLL-ID% {
2746
+ font-style:normal;
2747
+ margin:0px 0px 10px 0px;
2748
+ padding:0px;
2749
+ font-size:12px;
2750
+ margin-bottom:20px;
2751
+ }
2752
+ .yop-poll-li-answer-%POLL-ID% input {
2753
+ margin:0px;
2754
+ float:none;
2755
+ }
2756
+ .yop-poll-li-answer-%POLL-ID% label {
2757
+ margin:0px;
2758
+ font-style:normal;
2759
+ font-weight:normal;
2760
+ font-size:12px;
2761
+ float:none;
2762
+ }
2763
+ .yop-poll-results-%POLL-ID% {
2764
+ font-size: 12px;
2765
+ font-style: italic;
2766
+ font-weight: normal;
2767
+ margin-left: 15px;
2768
+ }
2769
+
2770
+ .yop-poll-customs-%POLL-ID% { }
2771
+ .yop-poll-customs-%POLL-ID% ul {
2772
+ list-style: none outside none;
2773
+ margin: 0;
2774
+ padding: 0;
2775
+ }
2776
+ .yop-poll-li-custom-%POLL-ID% {
2777
+ padding:0px;
2778
+ margin:0px;
2779
+ font-size:14px;
2780
+ }
2781
+
2782
+ /* Start CAPTCHA div style*/
2783
+ #yop-poll-captcha-input-div-%POLL-ID% {
2784
+ margin-top:5px;
2785
+ }
2786
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2787
+ width:30px;
2788
+ float:left;
2789
+ margin-left:5px;
2790
+ height:0px;
2791
+ }
2792
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2793
+ margin-bottom:2px;
2794
+ }
2795
+ #yop-poll-captcha-image-div-%POLL-ID% {
2796
+ margin-bottom:5px;
2797
+ }
2798
+ #yop_poll_captcha_image_%POLL-ID% {
2799
+ float:left;
2800
+ }
2801
+ /* End CAPTCHA div style*/
2802
+
2803
+ .yop-poll-clear-%POLL-ID% {
2804
+ clear:both;
2805
+ }
2806
+
2807
+ #yop-poll-vote-%POLL-ID% {
2808
+
2809
+ }
2810
+
2811
+ /* Start Result bar*/
2812
+ .yop-poll-results-bar-%POLL-ID% {
2813
+ background:#f5f5f5;
2814
+ height:10px;
2815
+ }
2816
+ .yop-poll-results-bar-%POLL-ID% div {
2817
+ background:#555;
2818
+ }
2819
+ /* End Result bar*/
2820
+
2821
+ /* Start Vote Button*/
2822
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2823
+ float:left;
2824
+ }
2825
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2826
+ float: right;
2827
+ margin-bottom: 20px;
2828
+ margin-top: -20px;
2829
+ width: auto;
2830
+ }
2831
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
2832
+ color:#3F8B43;
2833
+ text-decoration:underline;
2834
+ font-size:12px;
2835
+ }
2836
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
2837
+ color:#3F8B43;
2838
+ text-decoration:underline;
2839
+ font-size:12px;
2840
+ }
2841
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
2842
+ color:#3F8B43;
2843
+ text-decoration:underline;
2844
+ font-size:12px;
2845
+ }
2846
+ #yop-poll-vote-%POLL-ID% div {
2847
+ float:left;
2848
+ width:100%;
2849
+ }
2850
+ /* End Vote Button*/
2851
+
2852
+ /* Start Messages*/
2853
+ #yop-poll-container-error-%POLL-ID% {
2854
+ font-size:12px;
2855
+ font-style:italic;
2856
+ color:red;
2857
+ text-transform:capitalize;
2858
+ margin-bottom:20px;
2859
+ text-align:center;
2860
+ }
2861
+ #yop-poll-container-success-%POLL-ID% {
2862
+ font-size:12px;
2863
+ font-style:italic;
2864
+ color:green;
2865
+ text-transform:capitalize;
2866
+ margin-bottom:20px;
2867
+ text-align:center;
2868
+ }
2869
+ /* End Messages*/
2870
+ NOWDOC;
2871
+ break;
2872
+ }
2873
+ case 'Orange v1':
2874
+ { //Orange v1
2875
+ $css = <<<NOWDOC
2876
+ #yop-poll-container-%POLL-ID% {
2877
+ width:%POLL-WIDTH%;
2878
+ background:#FB6911;
2879
+ padding:10px;
2880
+ color:#fff;
2881
+ overflow:hidden;
2882
+ font-size:12px;
2883
+ }
2884
+ #yop-poll-container-%POLL-ID% input[type='text'] {
2885
+ margin:0px 0px 5px 0px;
2886
+ padding:2%;
2887
+ width:96%;
2888
+ text-indent:2%;
2889
+ font-size:12px;
2890
+ }
2891
+
2892
+ .yop-poll-name-%POLL-ID% {
2893
+ font-size:14px;
2894
+ font-weight:bold;
2895
+ }
2896
+
2897
+ #yop-poll-questions-container-%POLL-ID% {
2898
+ font-size:14px;
2899
+ margin:5px 0px;
2900
+ }
2901
+ .yop-poll-question-container-%POLL-ID% {
2902
+ padding: 2px;
2903
+ }
2904
+ .yop-poll-question-%POLL-ID% {
2905
+ margin-bottom: 21px;
2906
+ margin-top: -10px;
2907
+ font-style: italic;
2908
+ text-align: center;
2909
+ width: 100%;
2910
+ }
2911
+ .yop-poll-answers-%POLL-ID% { }
2912
+ .yop-poll-answers-%POLL-ID% ul {
2913
+ list-style: none outside none;
2914
+ margin: 0;
2915
+ padding: 0;
2916
+ }
2917
+ .yop-poll-li-answer-%POLL-ID% {
2918
+ font-style:normal;
2919
+ margin:0px 0px 10px 0px;
2920
+ padding:0px;
2921
+ font-size:12px;
2922
+ margin-bottom:20px;
2923
+ }
2924
+ .yop-poll-li-answer-%POLL-ID% input {
2925
+ margin:0px;
2926
+ float:none;
2927
+ }
2928
+ .yop-poll-li-answer-%POLL-ID% label {
2929
+ margin:0px;
2930
+ font-style:normal;
2931
+ font-weight:normal;
2932
+ font-size:12px;
2933
+ float:none;
2934
+ }
2935
+ .yop-poll-results-%POLL-ID% {
2936
+ font-size: 12px;
2937
+ font-style: italic;
2938
+ font-weight: normal;
2939
+ margin-left: 15px;
2940
+ }
2941
+
2942
+ .yop-poll-customs-%POLL-ID% { }
2943
+ .yop-poll-customs-%POLL-ID% ul {
2944
+ list-style: none outside none;
2945
+ margin: 0;
2946
+ padding: 0;
2947
+ }
2948
+ .yop-poll-li-custom-%POLL-ID% {
2949
+ padding:0px;
2950
+ margin:0px;
2951
+ font-size:14px;
2952
+ }
2953
+
2954
+ /* Start CAPTCHA div style*/
2955
+ #yop-poll-captcha-input-div-%POLL-ID% {
2956
+ margin-top:5px;
2957
+ }
2958
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
2959
+ width:30px;
2960
+ float:left;
2961
+ margin-left:5px;
2962
+ height:0px;
2963
+ }
2964
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
2965
+ margin-bottom:2px;
2966
+ }
2967
+ #yop-poll-captcha-image-div-%POLL-ID% {
2968
+ margin-bottom:5px;
2969
+ }
2970
+ #yop_poll_captcha_image_%POLL-ID% {
2971
+ float:left;
2972
+ }
2973
+ /* End CAPTCHA div style*/
2974
+
2975
+ .yop-poll-clear-%POLL-ID% {
2976
+ clear:both;
2977
+ }
2978
+
2979
+ #yop-poll-vote-%POLL-ID% {
2980
+
2981
+ }
2982
+
2983
+ /* Start Result bar*/
2984
+ .yop-poll-results-bar-%POLL-ID% {
2985
+ background:#f5f5f5;
2986
+ height:10px;
2987
+ }
2988
+ .yop-poll-results-bar-%POLL-ID% div {
2989
+ background:#555;
2990
+ }
2991
+ /* End Result bar*/
2992
+
2993
+ /* Start Vote Button*/
2994
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
2995
+ float:left;
2996
+ }
2997
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
2998
+ float: right;
2999
+ margin-bottom: 20px;
3000
+ margin-top: -20px;
3001
+ width: auto;
3002
+ }
3003
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
3004
+ color:#fff;
3005
+ text-decoration:underline;
3006
+ font-size:12px;
3007
+ }
3008
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
3009
+ color:#fff;
3010
+ text-decoration:underline;
3011
+ font-size:12px;
3012
+ }
3013
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
3014
+ color:#fff;
3015
+ text-decoration:underline;
3016
+ font-size:12px;
3017
+ }
3018
+ #yop-poll-vote-%POLL-ID% div {
3019
+ float:left;
3020
+ width:100%;
3021
+ }
3022
+ /* End Vote Button*/
3023
+
3024
+ /* Start Messages*/
3025
+ #yop-poll-container-error-%POLL-ID% {
3026
+ font-size:12px;
3027
+ font-style:italic;
3028
+ color:red;
3029
+ text-transform:capitalize;
3030
+ margin-bottom:20px;
3031
+ text-align:center;
3032
+ }
3033
+ #yop-poll-container-success-%POLL-ID% {
3034
+ font-size:12px;
3035
+ font-style:italic;
3036
+ color:green;
3037
+ text-transform:capitalize;
3038
+ margin-bottom:20px;
3039
+ text-align:center;
3040
+ }
3041
+ /* End Messages*/
3042
+ NOWDOC;
3043
+ break;
3044
+ }
3045
+ case 'Orange v2':
3046
+ { //Orange v2
3047
+ $css = <<<NOWDOC
3048
+ #yop-poll-container-%POLL-ID% {
3049
+ width:%POLL-WIDTH%;
3050
+ background:#fff;
3051
+ padding:0px;
3052
+ color:#555;
3053
+ overflow:hidden;
3054
+ font-size:12px;;
3055
+ }
3056
+ #yop-poll-container-%POLL-ID% input[type='text'] {
3057
+ margin:0px 0px 5px 0px;
3058
+ padding:2%;
3059
+ width:96%;
3060
+ text-indent:2%;
3061
+ font-size:12px;
3062
+ }
3063
+
3064
+ .yop-poll-name-%POLL-ID% {
3065
+ font-weight:bold;
3066
+ background:#FB6911;
3067
+ color:#fff;
3068
+ padding:5px;
3069
+ text-align:center;
3070
+ font-size:12px;
3071
+ }
3072
+
3073
+ #yop-poll-questions-container-%POLL-ID% {
3074
+ font-size:14px;
3075
+ margin:5px 0px;
3076
+ }
3077
+ .yop-poll-question-container-%POLL-ID% {
3078
+ padding: 2px;
3079
+ }
3080
+ .yop-poll-question-%POLL-ID% {
3081
+ margin-bottom: 21px;
3082
+ margin-top: -10px;
3083
+ font-style: italic;
3084
+ text-align: center;
3085
+ width: 100%;
3086
+ background:#FB6911;
3087
+ color:#fff;
3088
+ padding:5px;
3089
+ }
3090
+ .yop-poll-answers-%POLL-ID% { }
3091
+ .yop-poll-answers-%POLL-ID% ul {
3092
+ list-style: none outside none;
3093
+ margin: 0;
3094
+ padding: 0;
3095
+ }
3096
+ .yop-poll-li-answer-%POLL-ID% {
3097
+ font-style:normal;
3098
+ margin:0px 0px 10px 0px;
3099
+ padding:0px;
3100
+ font-size:12px;
3101
+ margin-bottom:20px;
3102
+ }
3103
+ .yop-poll-li-answer-%POLL-ID% input {
3104
+ margin:0px;
3105
+ float:none;
3106
+ }
3107
+ .yop-poll-li-answer-%POLL-ID% label {
3108
+ margin:0px;
3109
+ font-style:normal;
3110
+ font-weight:normal;
3111
+ font-size:12px;
3112
+ float:none;
3113
+ }
3114
+ .yop-poll-results-%POLL-ID% {
3115
+ font-size: 12px;
3116
+ font-style: italic;
3117
+ font-weight: normal;
3118
+ margin-left: 15px;
3119
+ }
3120
+
3121
+ .yop-poll-customs-%POLL-ID% { }
3122
+ .yop-poll-customs-%POLL-ID% ul {
3123
+ list-style: none outside none;
3124
+ margin: 0;
3125
+ padding: 0;
3126
+ }
3127
+ .yop-poll-li-custom-%POLL-ID% {
3128
+ padding:0px;
3129
+ margin:0px;
3130
+ font-size:14px;
3131
+ }
3132
+
3133
+ /* Start CAPTCHA div style*/
3134
+ #yop-poll-captcha-input-div-%POLL-ID% {
3135
+ margin-top:5px;
3136
+ }
3137
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
3138
+ width:30px;
3139
+ float:left;
3140
+ margin-left:5px;
3141
+ height:0px;
3142
+ }
3143
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
3144
+ margin-bottom:2px;
3145
+ }
3146
+ #yop-poll-captcha-image-div-%POLL-ID% {
3147
+ margin-bottom:5px;
3148
+ }
3149
+ #yop_poll_captcha_image_%POLL-ID% {
3150
+ float:left;
3151
+ }
3152
+ /* End CAPTCHA div style*/
3153
+
3154
+ .yop-poll-clear-%POLL-ID% {
3155
+ clear:both;
3156
+ }
3157
+
3158
+ #yop-poll-vote-%POLL-ID% {
3159
+
3160
+ }
3161
+
3162
+ /* Start Result bar*/
3163
+ .yop-poll-results-bar-%POLL-ID% {
3164
+ background:#f5f5f5;
3165
+ height:10px;
3166
+ }
3167
+ .yop-poll-results-bar-%POLL-ID% div {
3168
+ background:#555;
3169
+ }
3170
+ /* End Result bar*/
3171
+
3172
+ /* Start Vote Button*/
3173
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
3174
+ float:left;
3175
+ }
3176
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
3177
+ float: right;
3178
+ margin-bottom: 20px;
3179
+ margin-top: -20px;
3180
+ width: auto;
3181
+ }
3182
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
3183
+ color:#FB6911;
3184
+ text-decoration:underline;
3185
+ font-size:12px;
3186
+ }
3187
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
3188
+ color:#FB6911;
3189
+ text-decoration:underline;
3190
+ font-size:12px;
3191
+ }
3192
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
3193
+ color:#FB6911;
3194
+ text-decoration:underline;
3195
+ font-size:12px;
3196
+ }
3197
+ #yop-poll-vote-%POLL-ID% div {
3198
+ float:left;
3199
+ width:100%;
3200
+ }
3201
+ /* End Vote Button*/
3202
+
3203
+ /* Start Messages*/
3204
+ #yop-poll-container-error-%POLL-ID% {
3205
+ font-size:12px;
3206
+ font-style:italic;
3207
+ color:red;
3208
+ text-transform:capitalize;
3209
+ margin-bottom:20px;
3210
+ text-align:center;
3211
+ }
3212
+ #yop-poll-container-success-%POLL-ID% {
3213
+ font-size:12px;
3214
+ font-style:italic;
3215
+ color:green;
3216
+ text-transform:capitalize;
3217
+ margin-bottom:20px;
3218
+ text-align:center;
3219
+ }
3220
+ /* End Messages*/
3221
+ NOWDOC;
3222
+ break;
3223
+ }
3224
+
3225
+
3226
+
3227
+
3228
+
3229
+
3230
+
3231
+ case 'Orange v3':
3232
+ { //Orange v3
3233
+ $css = <<<NOWDOC
3234
+ #yop-poll-container-%POLL-ID% {
3235
+ width:%POLL-WIDTH%;
3236
+ background:#fff;
3237
+ padding:10px;
3238
+ color:#555;
3239
+ overflow:hidden;
3240
+ font-size:12px;
3241
+ border:5px solid #FB6911;
3242
+ }
3243
+ #yop-poll-container-%POLL-ID% input[type='text'] {
3244
+ margin:0px 0px 5px 0px;
3245
+ padding:2%;
3246
+ width:96%;
3247
+ text-indent:2%;
3248
+ font-size:12px;
3249
+ }
3250
+
3251
+ .yop-poll-name-%POLL-ID% {
3252
+ font-weight:bold;
3253
+ font-size:14x;
3254
+ }
3255
+
3256
+ #yop-poll-questions-container-%POLL-ID% {
3257
+ font-size:14px;
3258
+ margin:5px 0px;
3259
+ }
3260
+ .yop-poll-question-container-%POLL-ID% {
3261
+ padding: 2px;
3262
+ }
3263
+ .yop-poll-question-%POLL-ID% {
3264
+ margin-bottom: 21px;
3265
+ margin-top: -10px;
3266
+ font-style: italic;
3267
+ text-align: center;
3268
+ width: 100%;
3269
+ }
3270
+ .yop-poll-answers-%POLL-ID% { }
3271
+ .yop-poll-answers-%POLL-ID% ul {
3272
+ list-style: none outside none;
3273
+ margin: 0;
3274
+ padding: 0;
3275
+ }
3276
+ .yop-poll-li-answer-%POLL-ID% {
3277
+ font-style:normal;
3278
+ margin:0px 0px 10px 0px;
3279
+ padding:0px;
3280
+ font-size:12px;
3281
+ margin-bottom:20px;
3282
+ }
3283
+ .yop-poll-li-answer-%POLL-ID% input {
3284
+ margin:0px;
3285
+ float:none;
3286
+ }
3287
+ .yop-poll-li-answer-%POLL-ID% label {
3288
+ margin:0px;
3289
+ font-style:normal;
3290
+ font-weight:normal;
3291
+ font-size:12px;
3292
+ float:none;
3293
+ }
3294
+ .yop-poll-results-%POLL-ID% {
3295
+ font-size: 12px;
3296
+ font-style: italic;
3297
+ font-weight: normal;
3298
+ margin-left: 15px;
3299
+ }
3300
+
3301
+ .yop-poll-customs-%POLL-ID% { }
3302
+ .yop-poll-customs-%POLL-ID% ul {
3303
+ list-style: none outside none;
3304
+ margin: 0;
3305
+ padding: 0;
3306
+ }
3307
+ .yop-poll-li-custom-%POLL-ID% {
3308
+ padding:0px;
3309
+ margin:0px;
3310
+ font-size:14px;
3311
+ }
3312
+
3313
+ /* Start CAPTCHA div style*/
3314
+ #yop-poll-captcha-input-div-%POLL-ID% {
3315
+ margin-top:5px;
3316
+ }
3317
+ #yop-poll-captcha-helpers-div-%POLL-ID% {
3318
+ width:30px;
3319
+ float:left;
3320
+ margin-left:5px;
3321
+ height:0px;
3322
+ }
3323
+ #yop-poll-captcha-helpers-div-%POLL-ID% img {
3324
+ margin-bottom:2px;
3325
+ }
3326
+ #yop-poll-captcha-image-div-%POLL-ID% {
3327
+ margin-bottom:5px;
3328
+ }
3329
+ #yop_poll_captcha_image_%POLL-ID% {
3330
+ float:left;
3331
+ }
3332
+ /* End CAPTCHA div style*/
3333
+
3334
+ .yop-poll-clear-%POLL-ID% {
3335
+ clear:both;
3336
+ }
3337
+
3338
+ #yop-poll-vote-%POLL-ID% {
3339
+
3340
+ }
3341
+
3342
+ /* Start Result bar*/
3343
+ .yop-poll-results-bar-%POLL-ID% {
3344
+ background:#f5f5f5;
3345
+ height:10px;
3346
+ }
3347
+ .yop-poll-results-bar-%POLL-ID% div {
3348
+ background:#555;
3349
+ }
3350
+ /* End Result bar*/
3351
+
3352
+ /* Start Vote Button*/
3353
+ #yop-poll-vote-%POLL-ID% div#yop-poll-vote-%POLL-ID% button {
3354
+ float:left;
3355
+ }
3356
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% {
3357
+ float: right;
3358
+ margin-bottom: 20px;
3359
+ margin-top: -20px;
3360
+ width: auto;
3361
+ }
3362
+ #yop-poll-vote-%POLL-ID% div#yop-poll-results-%POLL-ID% a {
3363
+ color:#FB6911;
3364
+ text-decoration:underline;
3365
+ font-size:12px;
3366
+ }
3367
+ #yop-poll-vote-%POLL-ID% div#yop-poll-back-%POLL-ID% a {
3368
+ color:#FB6911;
3369
+ text-decoration:underline;
3370
+ font-size:12px;
3371
+ }
3372
+ #yop-poll-vote-%POLL-ID% div#yop-poll-archive-%POLL-ID% a {
3373
+ color:#FB6911;
3374
+ text-decoration:underline;
3375
+ font-size:12px;
3376
+ }
3377
+ #yop-poll-vote-%POLL-ID% div {
3378
+ float:left;
3379
+ width:100%;
3380
+ }
3381
+ /* End Vote Button*/
3382
+
3383
+ /* Start Messages*/
3384
+ #yop-poll-container-error-%POLL-ID% {
3385
+ font-size:12px;
3386
+ font-style:italic;
3387
+ color:red;
3388
+ text-transform:capitalize;
3389
+ margin-bottom:20px;
3390
+ text-align:center;
3391
+ }
3392
+ #yop-poll-container-success-%POLL-ID% {
3393
+ font-size:12px;
3394
+ font-style:italic;
3395
+ color:green;
3396
+ text-transform:capitalize;
3397
+ margin-bottom:20px;
3398
+ text-align:center;
3399
+ }
3400
+ /* End Messages*/
3401
+ NOWDOC;
3402
+ break;
3403
+ }
3404
+ }
3405
+
3406
+ $css.= "#yop-poll-container-%POLL-ID% img {
3407
+ max-width: %POLL-WIDTH%;
3408
+ }";
3409
+ $css = addslashes($css);
3410
+ $before_vote_template = addslashes( $before_vote_template );
3411
+
3412
+ $sql .= "`before_vote_template` = '{$before_vote_template}',
3413
+ `after_vote_template` = '{$after_vote_template}',
3414
+ `before_start_date_template` = '{$before_start_date_template}',
3415
+ `after_end_date_template` = '{$after_end_date_template}',
3416
+ `js` = '$js',
3417
+ `css` = '{$css}',
3418
+ `last_modified` = '" . current_time( 'mysql' ) . "'";
3419
+
3420
+
3421
+ if( 'add' == $action ) {
3422
+ $sql .= ", ";
3423
+ $sql .= "`status` = 'default', ";
3424
+
3425
+ $sql .= "`date_added` = '" . current_time( 'mysql' ) . "' ";
3426
+ }
3427
+ else {
3428
+ $sql .= $wpdb->prepare( ' WHERE name = %s', $template_name );
3429
+ }
3430
+ $wpdb->query( $sql );
3431
+ }
3432
+
3433
+ public static function getCharset() {
3434
+ if( defined( 'DB_CHARSET' ) ) {
3435
+ return DB_CHARSET;
3436
+ }
3437
+ else {
3438
+ return 'utf8';
3439
+ }
3440
+
3441
+ }
3442
+ }
inc/facebook_connect_model.php DELETED
@@ -1,78 +0,0 @@
1
- <?php
2
- class Yop_Poll_Facebook_Connect_Model {
3
- public $facebook_app_available = false;
4
- protected static $_instance = NULL;
5
- private $facebok_user = NULL;
6
- private $facebook_credentials = NULL;
7
-
8
- var $error = NULL;
9
-
10
- public static function getInstance( ) {
11
- if ( !isset( self::$_instance ) )
12
- self::$_instance = new Yop_Poll_Facebook_Connect_Model( );
13
- return self::$_instance;
14
- }
15
-
16
- public function Yop_Poll_Facebook_Connect_Model( ) {
17
- self::$_instance = $this;
18
- }
19
-
20
- private function load_facebook_credentials( $test = false ) {
21
- $this->facebook_credentials = get_option( 'yop_poll_facebook_credentials', false );
22
- if ( $test ) {
23
- $result = $this->curl_get( $this->facebook_credentials['connect_url'] );
24
- $temp = parse_json( $result );
25
- if ( 'true' === $temp['success'] ) {
26
-
27
- }
28
- else {
29
- $this->error = __( 'Sorry! Connection with server failed!', 'yop_poll' );
30
- return false;
31
- }
32
- }
33
- }
34
-
35
- private function test_conection() {
36
-
37
- }
38
-
39
- private function curl_post( $url, array $post = NULL, array $options = array() ) {
40
- $defaults = array(
41
- CURLOPT_POST => 1,
42
- CURLOPT_HEADER => 0,
43
- CURLOPT_URL => $url,
44
- CURLOPT_FRESH_CONNECT => 1,
45
- CURLOPT_RETURNTRANSFER => 1,
46
- CURLOPT_FORBID_REUSE => 1,
47
- CURLOPT_TIMEOUT => 4,
48
- CURLOPT_POSTFIELDS => http_build_query($post)
49
- );
50
-
51
- $ch = curl_init();
52
- curl_setopt_array($ch, ( $options + $defaults ) );
53
- if( ! $result = curl_exec( $ch ) ) {
54
- $this->error = curl_error( $ch );
55
- return false;
56
- }
57
- curl_close( $ch );
58
- return $result;
59
- }
60
-
61
- private function curl_get( $url, array $get = NULL, array $options = array()) {
62
- $defaults = array(
63
- CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
64
- CURLOPT_HEADER => 0,
65
- CURLOPT_RETURNTRANSFER => TRUE,
66
- CURLOPT_TIMEOUT => 4
67
- );
68
-
69
- $ch = curl_init();
70
- curl_setopt_array( $ch, ( $options + $defaults ) );
71
- if( ! $result = curl_exec( $ch ) ) {
72
- $this->error = curl_error( $ch );
73
- return false;
74
- }
75
- curl_close($ch);
76
- return $result;
77
- }
78
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/import_admin.php ADDED
@@ -0,0 +1,1017 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
4
+
5
+ private static $_instance = NULL;
6
+
7
+
8
+
9
+ protected function __construct() {
10
+
11
+ parent::__construct( 'imports' );
12
+
13
+ }
14
+
15
+
16
+
17
+ public static function get_instance() {
18
+
19
+ if ( self::$_instance == NULL ){
20
+
21
+ $class = __CLASS__;
22
+
23
+ self::$_instance = new $class;
24
+
25
+ }
26
+
27
+ return self::$_instance;
28
+
29
+ }
30
+
31
+
32
+
33
+ public function manage_imports() {
34
+
35
+ switch ( $GLOBALS['page'] ) {
36
+
37
+ default:
38
+
39
+ $this->manage_options();
40
+
41
+ break;
42
+
43
+ }
44
+
45
+
46
+
47
+ }
48
+
49
+ public function manage_load_imports() {
50
+
51
+ wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
52
+
53
+ wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
54
+
55
+ }
56
+
57
+
58
+
59
+ private function manage_options() {
60
+
61
+ global $page, $action, $message;
62
+ switch ( $action ) {
63
+
64
+
65
+
66
+ case 'import-all':
67
+
68
+ {
69
+
70
+ $this->import_wp_polls();
71
+
72
+
73
+ break;
74
+
75
+ }
76
+
77
+ case 'import':
78
+
79
+ {
80
+
81
+ $this->import_wp_poll();
82
+
83
+ break;
84
+
85
+ }
86
+
87
+ default:
88
+
89
+ {
90
+ self:: view_wp_polls();
91
+
92
+ }
93
+
94
+
95
+
96
+
97
+
98
+ }
99
+
100
+
101
+
102
+ }
103
+
104
+ private function import_wp_poll() {
105
+
106
+
107
+ if ( !current_user_can( 'edit_own_yop_polls' ) && ( !current_user_can( 'edit_yop_polls' )) ){
108
+
109
+ wp_die( __yop_poll( 'You are not allowed to edit this item.' ) );
110
+
111
+ }
112
+
113
+ else
114
+
115
+ if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
116
+
117
+ if (isset ($_REQUEST['id']))
118
+
119
+ {
120
+
121
+ self::import_wp_poll_fom_db($_REQUEST['id']);
122
+
123
+ }
124
+
125
+ else if ( isset ( $_REQUEST ['yoppollwppollcheck'] ) ){
126
+
127
+ $wp_poll = ( array )$_REQUEST ['yoppollwppollcheck'];
128
+
129
+ foreach ( $wp_poll as $wp_id ) {
130
+
131
+ $wp_id = ( int )$wp_id ;
132
+
133
+ $message = self::import_wp_poll_fom_db($wp_id);
134
+
135
+ }
136
+
137
+ }
138
+
139
+ }
140
+
141
+ else {
142
+
143
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
144
+
145
+ }
146
+
147
+ self:: view_wp_polls();
148
+
149
+ }
150
+
151
+ private function import_wp_poll_fom_db($id)
152
+
153
+ { self::activation_hook();
154
+ $current_date= date('Y/m/d H:i:s');
155
+
156
+ $wp_polls=self::get_wp_poll_search_by_id($id );
157
+ global $message;
158
+
159
+
160
+ foreach ($wp_polls as $wp_poll)
161
+
162
+ {
163
+ $poll = new YOP_POLL_Poll_Model(0);
164
+
165
+ $answers= self::get_wp_poll_answers_from_db_by_id($wp_poll['pollq_id']);
166
+
167
+ $poll->poll_title=$wp_poll['pollq_question'];
168
+
169
+ $poll->poll_name=$wp_poll['pollq_question'];
170
+
171
+ $poll->poll_author=get_current_user_id();
172
+
173
+ $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
174
+ if($wp_poll['pollq_multiple']>0){
175
+ $poll->allow_multiple_answers="yes";
176
+ $poll->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
177
+
178
+ }
179
+
180
+ if($wp_poll['pollq_expiry']!="")
181
+
182
+ $poll->poll_end_date= date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
183
+
184
+ else
185
+
186
+ $poll->poll_end_date="01-01-2038 23:59:59";
187
+
188
+ $poll->poll_status="active";
189
+
190
+ $poll->poll_date=$current_date;
191
+
192
+ $poll->poll_modified=$current_date;
193
+
194
+ $poll->poll_total_votes=$wp_poll['pollq_totalvotes'];
195
+
196
+ $question= new YOP_POLL_Question_Model();
197
+
198
+
199
+
200
+ $poll_id=$poll->save();
201
+
202
+
203
+
204
+ $question->poll_id=$poll_id;
205
+
206
+ $question->question=$wp_poll['pollq_question'];
207
+
208
+ $question->question_status="active";
209
+
210
+ $question->type="text";
211
+ if($wp_poll['pollq_multiple']>0){
212
+ $question->allow_multiple_answers="yes";
213
+ $question->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
214
+
215
+ }
216
+
217
+ $question->question_author=get_current_user_id();
218
+
219
+ $question->poll_order=1;
220
+
221
+ $question->question_date =$current_date;
222
+
223
+ $question->question_modified=$current_date;
224
+
225
+
226
+
227
+ $question->save();
228
+
229
+
230
+
231
+ foreach($answers as $answer){
232
+
233
+
234
+
235
+ $poll_answer =new YOP_POLL_Answer_Model();
236
+
237
+ $poll_answer->poll_id=$poll_id;
238
+
239
+ $poll_answer->question_id=$question->ID;
240
+
241
+ $poll_answer->answer=$answer['polla_answers'];
242
+
243
+ $poll_answer->answer_status="active";
244
+
245
+ $poll_answer->type="text";
246
+
247
+ $poll_answer->question_order=1;
248
+
249
+ $poll_answer->answer_author=get_current_user_id();
250
+
251
+ $poll_answer->votes=$answer['polla_votes'];
252
+
253
+ $poll_answer->answer_date=$current_date;
254
+
255
+ $poll_answer->answer_modified=$current_date;
256
+
257
+
258
+
259
+ $poll_answer->save();
260
+
261
+ unset($log_details);
262
+
263
+ $log_details= self::get_log_from_db_by_poll_id($wp_poll['pollq_id'],$answer['polla_aid']);
264
+
265
+ foreach($log_details as $log)
266
+
267
+ {
268
+
269
+ $arg['poll_id']=$poll->ID;
270
+
271
+ $arg['ip']=$log['pollip_ip'];
272
+
273
+ if($log['pollip_user']=='Guest'){
274
+
275
+ $arg['user_type']='anonymous';
276
+
277
+ }else
278
+
279
+ $arg['user_type']="wordpress";
280
+
281
+ $arg['user_id']=$log['pollip_userid'];
282
+
283
+ $arg['vote_date']=$log['pollip_timestamp'];
284
+
285
+ $a = self::get_answer_from_db_by_id($log['pollip_aid']);
286
+
287
+ $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
288
+
289
+ $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
290
+
291
+ $q = self::get_question_from_db_by_id($log['pollip_qid']);
292
+
293
+ $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
294
+
295
+ $arg['vote_details']=json_encode($arg[1]);
296
+
297
+ $this->insert_log_in_db($arg);
298
+
299
+
300
+ unset($arg);
301
+
302
+ }
303
+
304
+ }
305
+
306
+
307
+
308
+ }
309
+ if($poll_id){
310
+ $message['success']="Poll imported!" ;
311
+ }
312
+ else
313
+ $message['error']="Could not import ban from database! Please try again!" ;
314
+
315
+ }
316
+
317
+
318
+
319
+ private function import_wp_polls()
320
+
321
+ { self::activation_hook();
322
+
323
+ if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
324
+
325
+ if(current_user_can('import_wp_polls')){
326
+
327
+ $current_date= date('Y/m/d H:i:s');
328
+
329
+ $wp_polls=self::get_wp_polls_from_db();
330
+
331
+ foreach ($wp_polls as $wp_poll)
332
+
333
+ {
334
+
335
+ $poll = new YOP_POLL_Poll_Model(0);
336
+
337
+ $answers = self::get_wp_poll_answers_from_db_by_id($wp_poll->pollq_id);
338
+
339
+ $poll->poll_title =$wp_poll->pollq_question;
340
+
341
+ $poll->poll_name =$wp_poll->pollq_question;
342
+
343
+ $poll->poll_author =get_current_user_id();
344
+
345
+ $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
346
+
347
+ if($wp_poll['pollq_expiry']!="")
348
+
349
+ $poll->poll_end_date = date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
350
+
351
+ else
352
+
353
+ $poll->poll_end_date ="01-01-2038 23:59:59";
354
+
355
+ $poll->poll_status ="active";
356
+
357
+ $poll->poll_date =$current_date;
358
+
359
+ $poll->poll_modified =$current_date;
360
+
361
+ $poll->poll_total_votes =$wp_poll->pollq_totalvotes;
362
+
363
+ $question = new YOP_POLL_Question_Model();
364
+
365
+
366
+
367
+ $poll_id=$poll->save();
368
+
369
+
370
+
371
+ $question->poll_d =$poll_id;
372
+
373
+ $question->question =$wp_poll->pollq_question;
374
+
375
+ $question->question_status ="active";
376
+
377
+ $question->question_author =get_current_user_id();
378
+
379
+ $question->poll_order =1;
380
+
381
+ $question->question_date =$current_date;
382
+
383
+ $question->question_modified =$current_date;
384
+
385
+
386
+
387
+ $question->save();
388
+
389
+
390
+
391
+ foreach($answers as $answer){
392
+
393
+ $poll_answer =new YOP_POLL_Answer_Model();
394
+
395
+ $poll_answer->poll_id =$poll_id;
396
+
397
+ $poll_answer->question_id =$question->ID;
398
+
399
+ $poll_answer->answer =$answer['polla_answers'];
400
+
401
+ $poll_answer->answer_status ="active";
402
+
403
+ $poll_answer->question_order =1;
404
+
405
+ $poll_answer->answer_author =get_current_user_id();
406
+
407
+ $poll_answer->votes =$answer['polla_votes'];
408
+
409
+ $poll_answer->answer_date =$current_date;
410
+
411
+ $poll_answer->answer_modified =$current_date;
412
+
413
+
414
+
415
+ $poll_answer->save();
416
+
417
+ unset($log_details);
418
+
419
+ $log_details= self::get_log_from_db_by_poll_id($wp_poll->pollq_id,$answer['polla_aid']);
420
+
421
+ foreach($log_details as $log)
422
+
423
+ {
424
+
425
+ $arg['poll_id'] =$poll->ID;
426
+
427
+ $arg['ip'] =$log['pollip_ip'];
428
+
429
+ if($log['pollip_user']=='Guest'){
430
+
431
+ $arg['user_type']='anonymous';
432
+
433
+ }else
434
+
435
+ $arg['user_type'] ="wordpress";
436
+
437
+ $arg['user_id'] =$log['pollip_userid'];
438
+
439
+ $arg['vote_date'] =$log['pollip_timestamp'];
440
+
441
+ $a =self::get_answer_from_db_by_id($log['pollip_aid']);
442
+
443
+ $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
444
+
445
+ $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
446
+
447
+ $q = self::get_question_from_db_by_id($log['pollip_qid']);
448
+
449
+ $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
450
+
451
+ $arg['vote_details'] =json_encode($arg[1]);
452
+
453
+ $message=$this->insert_log_in_db($arg);
454
+
455
+
456
+ if($message['error']!=""|| $message['success']!="")
457
+
458
+ $data['message']=$message;
459
+
460
+
461
+ unset($arg);
462
+
463
+ }
464
+
465
+ }
466
+
467
+ }
468
+
469
+ }
470
+
471
+ else
472
+
473
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
474
+
475
+ }
476
+
477
+ else {
478
+
479
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
480
+
481
+ }
482
+
483
+
484
+
485
+ $data['title']='Import Polls from Wp-Poll';
486
+
487
+
488
+
489
+ $this->display('imports.html',$data);
490
+
491
+ }
492
+
493
+ public function get_wp_polls_from_db(){
494
+
495
+
496
+
497
+ global $wpdb;
498
+
499
+ return $wpdb->get_results($wpdb->prepare( "
500
+
501
+ SELECT *
502
+
503
+ FROM " . $wpdb->pollsq . "
504
+
505
+ WHERE 1=1 ORDER BY pollq_id
506
+
507
+ "));
508
+
509
+ }
510
+
511
+
512
+
513
+ public function get_wp_poll_answers_from_db_by_id($poll_id)
514
+
515
+ { global $wpdb;
516
+
517
+ return $wpdb->get_results($wpdb->prepare( "
518
+
519
+ SELECT *
520
+
521
+ FROM " . $wpdb->pollsa . "
522
+
523
+ WHERE polla_qid = %d
524
+
525
+ ", $poll_id . '%' ),ARRAY_A);
526
+
527
+
528
+
529
+ }
530
+
531
+
532
+
533
+ public function get_log_from_db_by_poll_id($poll_id,$a_id)
534
+
535
+ {global $wpdb;
536
+
537
+ return $wpdb->get_results($wpdb->prepare( "
538
+
539
+ SELECT *
540
+
541
+ FROM " . $wpdb->pollsip . "
542
+
543
+ WHERE pollip_qid = %d AND pollip_aid =%d
544
+
545
+ ", $poll_id ,$a_id . '%' ),ARRAY_A);
546
+
547
+
548
+
549
+ }
550
+
551
+
552
+
553
+ public function get_answer_from_db_by_id($poll_id)
554
+
555
+ {global $wpdb;
556
+
557
+ return $wpdb->get_results($wpdb->prepare( "
558
+
559
+ SELECT *
560
+
561
+ FROM " . $wpdb->pollsa . "
562
+
563
+ WHERE polla_aid = %d
564
+
565
+ ", $poll_id . '%' ),ARRAY_A);
566
+
567
+
568
+
569
+ }
570
+
571
+ public function get_question_from_db_by_id($poll_id)
572
+
573
+ {global $wpdb;
574
+
575
+ return $wpdb->get_results($wpdb->prepare( "
576
+
577
+ SELECT *
578
+
579
+ FROM " . $wpdb->pollsq . "
580
+
581
+ WHERE pollq_id = %d
582
+
583
+ ", $poll_id . '%' ),ARRAY_A);
584
+
585
+
586
+
587
+ }
588
+
589
+ public function insert_log_in_db( $log ){
590
+
591
+ global $wpdb;
592
+
593
+
594
+
595
+ $response['success'] = "";
596
+
597
+ $response['error'] = "";
598
+
599
+ define( 'DIEONDBERROR', true );
600
+
601
+
602
+
603
+ $sql = $wpdb->query( $wpdb->prepare( "
604
+
605
+ INSERT INTO {$wpdb->yop_poll_logs} (
606
+
607
+ poll_id,
608
+
609
+ ip,
610
+
611
+ user_id,
612
+
613
+ user_type,
614
+
615
+ vote_details,
616
+
617
+ vote_date
618
+
619
+ ) VALUES ( %d, %s, %d, %s, %s, %s )",
620
+
621
+ $log['poll_id'],
622
+
623
+ $log['ip'],
624
+
625
+ $log['user_id'],
626
+
627
+ $log['user_type'],
628
+
629
+ $log['vote_details'],
630
+
631
+ $log['vote_date']
632
+
633
+ ));
634
+
635
+ if ( $sql ){
636
+
637
+ $response['success'] = __yop_poll( 'Polls imported!' );
638
+
639
+ $response['insert_id'] = $wpdb->insert_id;
640
+
641
+ }
642
+
643
+ else {
644
+
645
+ $response['error'] = __yop_poll( 'Could not import polls into database!' );
646
+
647
+ }
648
+
649
+ return $response;
650
+
651
+
652
+
653
+
654
+
655
+ }
656
+
657
+ private function view_wp_polls(){
658
+
659
+ $data['REQUEST'] = $_REQUEST;
660
+
661
+ $voter['poll_id']=7;
662
+
663
+ $voter['user_id']=1;
664
+
665
+ $voter['user_type']="wordpress";
666
+
667
+ global $wpdb, $message;
668
+
669
+ global $page, $action, $orderby, $order, $current_user;
670
+
671
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'pollq_question' : $GLOBALS['orderby'];
672
+
673
+ $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
674
+
675
+ $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
676
+
677
+ $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
678
+
679
+ $order_fields = array( 'pollq_question', 'pollq_totalvoters' );
680
+
681
+
682
+
683
+ $data['orderby'] = ( empty ( $data['REQUEST']['orderby'] ) ) ? 'pollq_question' : $data['REQUEST']['orderby'];
684
+
685
+ $data['order'] = ( empty ( $data['REQUEST']['order'] ) ) ? 'desc' : $data['REQUEST']['order'];
686
+
687
+ $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
688
+
689
+ $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
690
+
691
+ $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
692
+
693
+ $data['search'] = array( 'fields' => array( 'pollq_question' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
694
+
695
+ $data['wp_polls'] = self::get_wp_poll_search( $data['orderby'], $data['order'], $data['search'], $data['page_no'], $data['per_page'] );
696
+ if(!empty($data['wp_polls']))
697
+ foreach($data['wp_polls']as &$wp_poll)
698
+
699
+ {
700
+
701
+ $wp_poll['pollq_timestamp']=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
702
+
703
+ $wp_poll['pollq_expiry']=date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
704
+
705
+
706
+
707
+ }
708
+
709
+ $data['total_wp_polls'] = self::count_wp_search( $data['orderby'], $data['order'], $data['search'] );
710
+
711
+ $data['total_polls'] = $data['total_wp_polls'][0]['poll_no'];
712
+
713
+ $data['message'] = array( 'error' => $message['error'], 'success' => $message['success'] );
714
+
715
+ if ( intval( $data['page_no'] ) > intval( $data['total_polls'] ) ){
716
+
717
+ $data['page_no'] = 1;
718
+
719
+ }
720
+
721
+ $args = array(
722
+
723
+ 'base' => remove_query_arg(
724
+
725
+ 'page_no',
726
+
727
+ $_SERVER ['REQUEST_URI'] ) . '%_%',
728
+
729
+ 'format' => '&page_no=%#%',
730
+
731
+ 'current' => max( 1, $data['page_no'] ),
732
+
733
+ 'total' => ceil( $data['total_wp_polls'][0]['poll_no'] / $data['per_page'] ),
734
+
735
+ 'prev_next' => true,
736
+
737
+ 'prev_text' => __( '&laquo;' ),
738
+
739
+ 'next_text' => __( '&raquo;' )
740
+
741
+ );
742
+
743
+
744
+
745
+ $data['pagination'] = paginate_links( $args );
746
+
747
+
748
+
749
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
750
+
751
+ $data['request']['uri'] = $_SERVER["REQUEST_URI"];
752
+
753
+
754
+
755
+ $data['title']='Import Polls from Wp-Poll';
756
+
757
+ $this->display('imports.html',$data);
758
+
759
+ }
760
+
761
+ public static function get_wp_poll_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ), $offset = 0 , $per_page = 100 ,$poll_id = NULL ) {
762
+
763
+ global $wpdb;
764
+ if($wpdb->get_var("SHOW TABLES LIKE '$wpdb->pollsq'") == $wpdb->pollsq) {
765
+ $sql = "SELECT * FROM " . $wpdb->pollsq;
766
+
767
+
768
+
769
+ $sql_search = '';
770
+
771
+ if ( $poll_id ){
772
+
773
+ $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
774
+
775
+ }
776
+
777
+
778
+
779
+
780
+
781
+ if ( count( $search['fields'] ) > 0 ){
782
+
783
+
784
+
785
+ $sql_search .= ' WHERE (';
786
+
787
+
788
+
789
+ foreach ( $search['fields'] as $field ) {
790
+
791
+ $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
792
+
793
+ }
794
+
795
+ $sql_search = trim( $sql_search, 'OR' );
796
+
797
+ $sql_search .= ' ) ';
798
+
799
+ }
800
+
801
+ $sql .= $sql_search;
802
+
803
+ $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
804
+
805
+ $sql .= $sql_order_by;
806
+
807
+ $sql .= $wpdb->prepare( ' LIMIT %d, %d', (($offset-1) * $per_page), $per_page );
808
+
809
+ return $wpdb->get_results( $sql, ARRAY_A );
810
+ }
811
+ }
812
+
813
+ public static function get_wp_poll_search_by_id($poll_id = NULL ) {
814
+
815
+ global $wpdb;
816
+
817
+ $sql = "SELECT * FROM " . $wpdb->pollsq;
818
+
819
+
820
+
821
+ $sql_search = '';
822
+
823
+ if ( $poll_id ){
824
+
825
+ $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
826
+
827
+ }
828
+
829
+
830
+
831
+
832
+
833
+ $sql .= $sql_search;
834
+
835
+
836
+
837
+ return $wpdb->get_results( $sql, ARRAY_A );
838
+
839
+ }
840
+
841
+ public static function count_wp_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ) ) {
842
+
843
+ global $wpdb;
844
+ if($wpdb->get_var("SHOW TABLES LIKE '$wpdb->pollsq'") == $wpdb->pollsq) {
845
+ $sql = "SELECT COUNT(*) AS poll_no FROM " . $wpdb->pollsq;
846
+
847
+ $sql_search = '';
848
+
849
+ if ( count( $search['fields'] ) > 0 ){
850
+
851
+
852
+
853
+ $sql_search .= ' WHERE (';
854
+
855
+
856
+
857
+ foreach ( $search['fields'] as $field ) {
858
+
859
+ $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
860
+
861
+ }
862
+
863
+ $sql_search = trim( $sql_search, 'OR' );
864
+
865
+ $sql_search .= ' ) ';
866
+
867
+ }
868
+
869
+ $sql .= $sql_search;
870
+ yop_poll_dump($sql);
871
+
872
+ $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
873
+
874
+ $sql .= $sql_order_by;
875
+
876
+ return $wpdb->get_results( $sql, ARRAY_A );
877
+ }
878
+ }
879
+
880
+
881
+
882
+ public function yop_poll_get_polls_meta_from_db(){
883
+
884
+ global $wpdb;
885
+
886
+ $result = $wpdb->get_results( "
887
+
888
+ SELECT *
889
+
890
+ FROM wp_yop_pollmeta ORDER BY yop_poll_id ASC
891
+
892
+ ", ARRAY_A );
893
+
894
+ return $result;
895
+
896
+
897
+
898
+ }
899
+
900
+ public function yop_poll_get_polls_from_db(){
901
+
902
+ global $wpdb;
903
+
904
+ $result = $wpdb->get_results( ( "
905
+
906
+ SELECT *
907
+
908
+ FROM ".$wpdb->prefix."yop_polls ORDER BY id ASC
909
+
910
+ "), ARRAY_A );
911
+
912
+ return $result;
913
+
914
+
915
+
916
+ }
917
+
918
+
919
+
920
+
921
+ public function yop_poll_get_answers_meta_from_db() {
922
+ global $wpdb;
923
+
924
+ $result = $wpdb->get_results( "
925
+ SELECT *
926
+ FROM " . $wpdb->prefix . "yop_poll_answermeta
927
+
928
+ " , ARRAY_A );
929
+ return $result;
930
+
931
+ }
932
+
933
+ public function yop_poll_get_templates_from_db() {
934
+ global $wpdb;
935
+ $result = $wpdb->get_results( "
936
+ SELECT *
937
+ FROM " . $wpdb->prefix . "yop_poll_templates
938
+ " , ARRAY_A );
939
+ return $result;
940
+ }
941
+
942
+ public function yop_poll_get_custom_fields_from_db() {
943
+ global $wpdb;
944
+ $result = $wpdb->get_results("
945
+ SELECT *
946
+ FROM " . $wpdb->prefix . "yop_poll_custom_fields ORDER BY poll_id ASC
947
+ " , ARRAY_A );
948
+ return $result;
949
+ }
950
+
951
+ public function yop_poll_get_custom_fields_votes_from_db() {
952
+ global $wpdb;
953
+ $result = $wpdb->get_results( "
954
+ SELECT *
955
+ FROM " . $wpdb->prefix . "yop_poll_votes_custom_fields
956
+ " , ARRAY_A );
957
+ return $result;
958
+ }
959
+
960
+ public function yop_poll_get_bans_from_db() {
961
+ global $wpdb;
962
+ $result = $wpdb->get_results( "
963
+ SELECT *
964
+ FROM " . $wpdb->prefix . "yop_poll_bans ORDER BY poll_id ASC
965
+ " , ARRAY_A );
966
+ return $result;
967
+ }
968
+
969
+ public function yop_poll_get_answers_from_db() {
970
+ global $wpdb;
971
+ $result = $wpdb->get_results( "
972
+ SELECT *
973
+ FROM " . $wpdb->prefix . "yop_poll_answers ORDER BY poll_id ASC
974
+ ", ARRAY_A );
975
+ return $result;
976
+ }
977
+
978
+ public function yop_poll_get_logs_from_db() {
979
+ global $wpdb;
980
+ $result = $wpdb->get_results( ( "
981
+ SELECT *
982
+ FROM " . $wpdb->prefix . "yop_poll_logs WHERE ID>%d
983
+ " ), ARRAY_A );
984
+ return $result;
985
+ }
986
+
987
+ private static function insert_ban_in_db( $ban ) {
988
+ global $wpdb;
989
+ $sql = $wpdb->query( $wpdb->prepare( "
990
+ INSERT INTO $wpdb->yop_poll_bans
991
+ ( poll_id,type,value,period ,unit)
992
+ VALUES(%d,%s,%s,%d,%s)
993
+ ", $ban['poll_id'], $ban['type'], $ban['value'], intval( $ban['period'] ), $ban['unit'] ) );
994
+ return $wpdb->get_results( $sql );
995
+ }
996
+ private function save_poll_order( $poll, $poll_order ) {
997
+ $poll_archive_order = get_option( 'yop_poll_archive_order', array() );
998
+ if( $poll_archive_order == "" ) {
999
+ $poll_archive_order = array();
1000
+ }if( trim( $poll_order ) <= 0 ) {
1001
+ $poll_order = 1;
1002
+ }
1003
+ $key = array_search( $poll, $poll_archive_order );
1004
+ if( $key !== false ) {
1005
+ unset( $poll_archive_order[$key] );
1006
+ }
1007
+ if( $poll_order > count( $poll_archive_order ) ) {
1008
+ array_push( $poll_archive_order, $poll );
1009
+ }
1010
+ else {
1011
+ array_splice( $poll_archive_order, trim( $poll_order ) - 1, 0, array( $poll ) );
1012
+ }
1013
+ update_option( 'yop_poll_archive_order', $poll_archive_order );
1014
+ }
1015
+
1016
+
1017
+ }
inc/logs_admin.php ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class YOP_POLL_Logs_Admin extends YOP_POLL_Abstract_Admin{
4
+ private static $_instance = NULL;
5
+
6
+ protected function __construct() {
7
+ parent::__construct( 'logs' );
8
+ }
9
+
10
+ public static function get_instance() {
11
+ if ( self::$_instance == NULL ){
12
+ $class = __CLASS__;
13
+ self::$_instance = new $class;
14
+ }
15
+ return self::$_instance;
16
+ }
17
+
18
+ public function manage_logs() {
19
+
20
+ switch ( $GLOBALS['page'] ) {
21
+ default:
22
+ $this->manage_options();
23
+ break;
24
+ }
25
+
26
+ }
27
+
28
+ public function admin_loader() {
29
+
30
+ }
31
+
32
+
33
+ public function manage_load_logs() {
34
+
35
+ wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
36
+ wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
37
+
38
+ if(isset($_REQUEST['a']))
39
+ {if($_REQUEST['a']=="Export")
40
+ self::export_logs();
41
+
42
+ }
43
+
44
+ }
45
+
46
+ private function manage_options() {
47
+ global $page, $action, $message;
48
+ switch ( $action ) {
49
+
50
+ case 'delete_group':
51
+ {
52
+ $message = $this->delete_logs();
53
+ break;
54
+ }
55
+ }
56
+
57
+
58
+ $this->view_logs();
59
+ }
60
+ public function export_logs(){
61
+ global $wpdb, $page, $action, $orderby, $order, $current_user,$message;
62
+ $data['title'] = __yop_poll( "Logs" );
63
+ $data['request'] = $_REQUEST;
64
+ $data['s'] =( isset ( $_REQUEST ['s'] ) ? intval( $_REQUEST ['s'] ) :"" );
65
+ $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
66
+ $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
67
+ $data['order'] = isset ( $_REQUEST ['order'] ) ? ( int )$_REQUEST ['order'] : 'ASC';
68
+ $order_fields = array( 'vote_id','vote_date' );
69
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'vote_id' : $GLOBALS['orderby'];
70
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'name' : $GLOBALS['orderby'];
71
+ $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
72
+
73
+ $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
74
+ $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
75
+ $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
76
+ $data['poll_id'] = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
77
+ $args['limit'] = ( ($data['page_no'] )-1) * $data['per_page'] . ', ' . $data['per_page'];
78
+ $data['log_sdate'] = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
79
+ $data['log_edate'] = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
80
+ $data['group_by'] = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
81
+ $data['message']= $message ;
82
+ $filters = array();
83
+ $filters[] = array( 'field' => 'poll_id', 'value' => '0', 'operator' => '=' );
84
+
85
+ if ( $_REQUEST ['export']!="all" )
86
+ {
87
+ $filters = array();
88
+ $filters[] = array( 'field' => 'poll_id', 'value' => '0', 'operator' => '=' );
89
+ if($data['log_sdate']!=""&&$data['log_edate']!="")
90
+ $poll_id= self::get_poll_id_by_start_date_end_date($data['log_sdate'],$data['log_edate']);
91
+ else
92
+ if($data['log_sdate']!="")
93
+ $poll_id=self::get_poll_id_by_start_date_end_date($data['log_sdate']);
94
+ else
95
+ $poll_id= self::get_poll_id_by_start_date_end_date("0000-00-00",$data['log_edate']);
96
+ if(isset($_REQUEST['s'])){
97
+ $poll_id=self::get_poll_id_by_name($_REQUEST['s']);
98
+
99
+ }
100
+
101
+ if(isset($data['poll_id']))
102
+ $filters[0]['value']=$_REQUEST['poll_id'];
103
+ if($_REQUEST['s']!=""||$data['log_sdate']!=""||$data['log_edate']!=""){
104
+
105
+ $args = array(
106
+ 'search' => array( 'fields' => array( 'poll_id' ), 'value' => isset ( $poll_id ) ? $poll_id : '' ), 'orderby' => $orderby, 'order' => $order );
107
+
108
+ }
109
+
110
+ else
111
+ $args = array(
112
+ 'filters' => $filters,'orderby' => $orderby, 'order' => $order);
113
+
114
+ $args['limit']= ( $data['page_no'] - 1 ) * $data['per_page'] .',' .$data['per_page'];
115
+
116
+ $data['logs']=self::get_polls_logs_filter_search($args);
117
+ }
118
+ else
119
+ $data['logs']=self::get_polls_logs_filter_search("ID");
120
+
121
+ foreach ($data['logs'] as &$user_detail){
122
+ if($user_detail['user_type']!="anonymous")
123
+ {
124
+ if($user_detail['user_type']=="wordpress"){
125
+ $details=self::get_polls_user_details_from_db($user_detail['user_id']);
126
+ $user_detail['user_nicename']=$details[0]['user_nicename'];
127
+ $user_detail['user_email']=$details[0]['user_email'];
128
+ }
129
+ else{
130
+ $user_detail['user_nicename']="";
131
+ $user_detail['user_email']="";
132
+ $user_details=json_decode($user_detail['user_details']);
133
+ $detail=$user_details->user;
134
+ $user_detail['user_nicename'].=$detail->user_name;
135
+ $user_detail['user_email'].=$detail->user_email;}
136
+
137
+ }else{
138
+ $user_detail['user_nicename']="";
139
+ $user_detail['user_email']="";
140
+ }
141
+ $user_detail['answer']="";
142
+ $vote_details=json_decode($user_detail['vote_details']);
143
+ foreach ($vote_details as $question)
144
+ foreach($question->a as $answers)
145
+ $user_detail['answer'].=$answers."\n";
146
+ $detail=self::get_poll_name_from_db($user_detail['poll_id']);
147
+ $user_detail['name']= $detail[0]->poll_name;
148
+
149
+ }
150
+ $args['return_fields']= 'COUNT(*) as total_logs';
151
+ $args['limit']="";
152
+ $data['yop_polls'] =self::get_yop_polls_filter_search( 'id', 'asc' );
153
+ $total_logs=self::get_polls_logs_filter_search($args);
154
+ if ( isset ( $_REQUEST ['export'] ) ) {
155
+ global $wpdb;
156
+ $csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
157
+ $csv_header_array = array( __( '#', 'yop_poll' ), __( 'Vote ID', 'yop_poll' ), __( 'POLL Name', 'yop_poll' ), __( 'Answer', 'yop_poll' ), __( 'User Type', 'yop_poll' ), __( 'User', 'yop_poll' ), __( 'User Email', 'yop_poll' ), __( 'Tracking ID', 'yop_poll' ), __( 'IP', 'yop_poll' ), __( 'Vote Date', 'yop_poll' ) );
158
+ header("Content-Type: text/csv");
159
+ header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
160
+ header("Content-Transfer-Encoding: binary\n");
161
+ header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
162
+ ob_start();
163
+ $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
164
+
165
+ if ( !fputcsv( $f, $csv_header_array ) ) _e( "Can't write header!", 'yop_poll' );
166
+
167
+ if ( count( $data['logs'] ) > 0 ){
168
+ $index = 1;
169
+ foreach ( $data['logs'] as $log ) {
170
+ $logs_data = array( $index, $log ['vote_id'], stripslashes( $log ['name'] ), ( 'Other' == $log ['answer'] ) ? 'Other - ' . stripslashes( $log ['other_answer_value'] ) : stripslashes( $log ['answer'] ), stripslashes( $log ['user_type'] ), stripslashes( $log ['user_nicename'] ), stripslashes( $log ['user_email'] ), stripslashes( $log ['tr_id'] ), stripslashes( $log ['ip'] ), stripslashes( $log['vote_date'] ) );
171
+ if ( !fputcsv( $f, $logs_data ) ) _e( "Can't write header!", 'yop_poll' );
172
+ $index++;
173
+ }
174
+ }
175
+
176
+ fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
177
+ $csvStr = ob_get_contents();
178
+ ob_end_clean();
179
+
180
+ echo $csvStr;
181
+ exit ();
182
+
183
+
184
+ }
185
+
186
+
187
+
188
+ }
189
+ private function view_logs(){
190
+ $time_format="H:i:s";
191
+ $options = get_option('yop_poll_options' );
192
+ if($options['date_format']=="UE")
193
+ $date_format="d-m-Y"; else{
194
+ $date_format="m-d-Y";
195
+ }
196
+ $data['date_format']=$date_format.' '.$time_format;
197
+ global $wpdb, $page, $action, $orderby, $order, $current_use,$message;
198
+ $data['title'] = __yop_poll( "Logs" );
199
+ $data['request'] = $_REQUEST;
200
+ $data['s'] =( isset ( $_REQUEST ['s'] ) ? intval( $_REQUEST ['s'] ) :"" );
201
+ $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
202
+ $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
203
+ $data['order'] = isset ( $_REQUEST ['order'] ) ? ( int )$_REQUEST ['order'] : 'ASC';
204
+ $order_fields = array( 'vote_id','vote_date' );
205
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'vote_id' : $GLOBALS['orderby'];
206
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'name' : $GLOBALS['orderby'];
207
+ $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
208
+
209
+ $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
210
+ $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
211
+ $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
212
+ $data['poll_id'] = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
213
+ $args['limit'] = ( ($data['page_no'] )-1) * $data['per_page'] . ', ' . $data['per_page'];
214
+ $data['log_sdate'] = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
215
+ $data['log_edate'] = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
216
+ $data['group_by'] = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
217
+ $order_fields = array( 'ID', 'poll_id', 'vote_id', 'ip', 'user_id','tr_id','vote_details','user_details','vote_date' );
218
+ $data['message']= $message ;
219
+ $filters = array();
220
+ $filters[] = array( 'field' => 'poll_id', 'value' => '0', 'operator' => '=' );
221
+ if($data['log_sdate']!=""&&$data['log_edate']!="")
222
+ $poll_id= self::get_poll_id_by_start_date_end_date($data['log_sdate'],$data['log_edate']);
223
+ else
224
+ if($data['log_sdate']!="")
225
+ $poll_id=self::get_poll_id_by_start_date_end_date($data['log_sdate']);
226
+ else
227
+ $poll_id= self::get_poll_id_by_start_date_end_date("0000-00-00",$data['log_edate']);
228
+ if(isset($_REQUEST['s'])){
229
+ $poll_id=self::get_poll_id_by_name($_REQUEST['s']);
230
+
231
+ }
232
+
233
+ if(isset($data['poll_id']))
234
+ $filters[0]['value']=$_REQUEST['poll_id'];
235
+ if($_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 );
239
+
240
+ }
241
+ else
242
+ $args = array(
243
+ 'filters' => $filters,'orderby' => $data['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'] );
247
+ if ( intval( $data['page_no'] ) > intval( $data['total_logs_pages'] ) )
248
+ $data['page_no'] = 1;
249
+ $args['limit']= ( $data['page_no'] - 1 ) * $data['per_page'] .',' .$data['per_page'];
250
+ $data['logs']=self::get_polls_logs_filter_search($args);
251
+
252
+ foreach ($data['logs'] as &$user_detail){
253
+ if($user_detail['user_type']!="anonymous")
254
+ {
255
+ if($user_detail['user_type']=="wordpress"){
256
+ $details=self::get_polls_user_details_from_db($user_detail['user_id']);
257
+ $user_detail['user_nicename']=$details[0]['user_nicename'];
258
+ $user_detail['user_email']=$details[0]['user_email'];
259
+ }
260
+ else{
261
+ $user_detail['user_nicename']="";
262
+ $user_detail['user_email']="";
263
+ $user_details=json_decode($user_detail['user_details']);
264
+ $detail=$user_details->user;
265
+ $user_detail['user_nicename'].=$detail->user_name;
266
+ $user_detail['user_email'].=$detail->user_email;}
267
+
268
+
269
+ }
270
+ else{
271
+ $user_detail['user_nicename']="";
272
+ $user_details=json_decode($user_detail['user_details']);
273
+ if(isset($user_details['email']))
274
+ $user_detail['user_email']=$user_details['email'];
275
+ }
276
+ $user_detail['answer']="";
277
+ $vote_details=json_decode($user_detail['vote_details']);
278
+ if(isset($vote_details))
279
+ foreach ($vote_details as $question){
280
+ $user_detail['answer'].= $question->question;
281
+ $user_detail['answer'].=": ";
282
+ foreach($question->answers as $answers){
283
+ $user_detail['answer'].=$answers;
284
+ $user_detail['answer'].=', ';
285
+ }
286
+ nl2br($user_detail['answer'].'\r\n',true);
287
+ nl2br($user_detail['answer'].'\r\n',true);
288
+ }
289
+ $detail=self::get_poll_name_from_db($user_detail['poll_id']);
290
+ $user_detail['name']= $detail[0]->poll_name;
291
+
292
+ }
293
+
294
+ $args['return_fields']= 'COUNT(*) as total_logs';
295
+ $args['limit']="";
296
+ $data['yop_polls'] =self::get_yop_polls_filter_search( 'id', 'asc' );
297
+
298
+ $total_logs=self::get_polls_logs_filter_search($args);
299
+
300
+
301
+
302
+ $data['total_logs']= $total_logs[0]['total_logs'];
303
+ $data['total_logs_pages'] = ceil( $total_logs[0]['total_logs'] / $data['per_page'] );
304
+ if ( intval( $data['page_no'] ) > intval( $data['total_logs_pages'] ) )
305
+ $data['page_no'] = 1;
306
+
307
+ $paginate_args = array( 'base' => remove_query_arg( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%', 'format' => '&page_no=%#%', 'total' => $data['total_logs_pages'], 'current' => max( 1, $data['page_no'] ), 'prev_next' => true, 'prev_text' => __( '&laquo; Previous' ), 'next_text' => __( 'Next &raquo;' ) );
308
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
309
+ $data['pagination'] = paginate_links( $paginate_args );
310
+ $this->display('logs.html',$data);
311
+ }
312
+
313
+ public static function get_yop_polls_filter_search( $orderby = 'id', $order = 'desc', $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' ), $search = array( 'fields' => array(), 'value' => NULL ) ) {
314
+ global $wpdb;
315
+ $sql = "SELECT * FROM " . $wpdb->yop_polls;
316
+ $sql_filter = '';
317
+ $sql_search = '';
318
+ if ( $filter['field'] && $filter['value'] ){
319
+ $sql_filter .= $wpdb->prepare( ' `' . esc_attr( $filter['field'] ) . '` ' . esc_attr( $filter['operator'] ) . ' %s ', esc_attr( $filter['value'] ) );
320
+ }
321
+ if ( count( $search['fields'] ) > 0 ){
322
+ if ( $filter['field'] && $filter['value'] ) $sql_search = ' AND ';
323
+ $sql_search .= ' ( ';
324
+ foreach ( $search['fields'] as $field ) {
325
+ $sql_search .= $wpdb->prepare( ' `' . esc_attr( $field ) . '` like \'%%%s%%\' OR', $search['value'] );
326
+ }
327
+ $sql_search = trim( $sql_search, 'OR' );
328
+ $sql_search .= ' ) ';
329
+ }
330
+ if ( ( $filter['field'] && $filter['value'] ) || count( $search['fields'] ) > 0 ) $sql .= ' WHERE ' . $sql_filter . $sql_search;
331
+ $sql .= ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order );
332
+ return $wpdb->get_results( $sql, ARRAY_A );
333
+ }
334
+
335
+ private function delete_logs(){
336
+ global $message;
337
+ $message['success'] = "";
338
+ $message['error'] = "";
339
+ if( check_admin_referer('yop-poll-logs','yop-poll-log') ) {
340
+ if ( isset ( $_REQUEST ['yoppolllogscheck'] ) ){
341
+ $bulklogs = ( array )$_REQUEST ['yoppolllogscheck'];
342
+ foreach ( $bulklogs as $log_id ) {
343
+ $log_id = ( int )$log_id;
344
+ $message = self::delete_log_from_db( $log_id );
345
+ }
346
+ return $message;
347
+ }
348
+
349
+ else {
350
+
351
+ if ( isset ( $_REQUEST ['id'] ) ){
352
+ return self::delete_log_from_db( $_REQUEST['id'] );
353
+ }
354
+ }
355
+
356
+
357
+ return $message;
358
+ }
359
+ else {
360
+ wp_die( __yop_poll('You do not have enough permission to delete a log'));
361
+
362
+ }
363
+ }
364
+ private function delete_log_from_db( $log_id ) {
365
+ global $wpdb;
366
+ $response['success'] = "";
367
+ $response['error'] = "";
368
+
369
+ if ( current_user_can( 'delete_yop_polls_logs' ) ){
370
+ $sql = $wpdb->query( $wpdb->prepare( "
371
+ DELETE FROM $wpdb->yop_poll_logs
372
+ WHERE id = %d",
373
+ $log_id ) );
374
+ if ( $sql ){
375
+ $response['success'] = __yop_poll( 'Log deleted' );
376
+
377
+ }
378
+
379
+ else {
380
+ $response['error'] = __yop_poll( 'Could not delete log from database! Please try again!' );
381
+ }
382
+ }
383
+ else {
384
+ $response['error'] = __yop_poll( 'You do not have enough permission to delete a log!' );
385
+ }
386
+
387
+
388
+
389
+ return $response;
390
+
391
+
392
+ }
393
+
394
+ public static function get_polls_logs_filter_search( $args ) {
395
+ $return_fields = '*';
396
+ $filters = NULL;
397
+ $search = NULL;
398
+ $orderby = 'ID';
399
+ $order = 'ASC';
400
+ $limit = NULL;
401
+ if ( isset( $args['return_fields'] ) ){
402
+ $return_fields = trim( $args['return_fields'], ',' );
403
+ }
404
+ if ( isset( $args['filters'] ) ){
405
+ $filters = $args['filters'];
406
+ }
407
+ if ( isset( $args['search'] ) ){
408
+ $search = $args['search'];
409
+ }
410
+ if ( isset( $args['orderby'] ) ){
411
+ $orderby = $args['orderby'];
412
+ }
413
+ if ( isset( $args['order'] ) ){
414
+ if ( in_array( strtoupper( $args['order'] ), array( 'ASC', 'DESC' ) ) ){
415
+ $order = $args['order'];
416
+ }
417
+ }
418
+ if ( isset( $args['limit'] ) ){
419
+ $limit = $args['limit'];
420
+ }
421
+
422
+ $sql = 'SELECT ' . $return_fields . ' FROM ' . $GLOBALS['wpdb']->yop_poll_logs . ' WHERE 1=1 ';
423
+ $sql_filter = '';
424
+
425
+ if ( count( $filters)>0 ){
426
+ foreach ( $filters as $filter ) {
427
+ if($filter['value']>0)
428
+ $sql_filter .= ' AND ' . $GLOBALS['wpdb']->prepare( ' `' . esc_attr( $filter['field'] ) . '` ' . $filter['operator'] . ' %s ', esc_attr( $filter['value'] ) ) . ' ';
429
+
430
+ }
431
+ }
432
+
433
+ $sql_search = '';
434
+ if ( count( $search['fields'] ) > 0 ){
435
+ foreach ( $search['value'] as $field ) {
436
+ $sql_search .= $