YOP Poll - Version 4.9.1

Version Description

  • Fixed issue with Template preview not working in IE8
  • Fixed issue with wpautop filter
  • Redefined admin area allowed tags: a(href, title, target), img( src, title), br
  • Fixed issue with Other answers
Download this release

Release Info

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

Code changes from version 4.9 to 4.9.1

css/yop-poll-donate.css ADDED
@@ -0,0 +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
+ }
css/yop-poll-optin1.css ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,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: 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
+ }
fonts/Lato-Bla.ttf ADDED
Binary file
fonts/Lato-BlaIta.ttf ADDED
Binary file
fonts/Lato-Bol.ttf ADDED
Binary file
fonts/Lato-BolIta.ttf ADDED
Binary file
fonts/Lato-Hai.ttf ADDED
Binary file
fonts/Lato-HaiIta.ttf ADDED
Binary file
fonts/Lato-Lig.ttf ADDED
Binary file
fonts/Lato-LigIta.ttf ADDED
Binary file
fonts/Lato-Reg.ttf ADDED
Binary file
fonts/Lato-RegIta.ttf ADDED
Binary file
fonts/fontomas-webfont.eot ADDED
Binary file
fonts/fontomas-webfont.svg ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <metadata>
5
+ This is a custom SVG webfont generated by Font Squirrel.
6
+ </metadata>
7
+ <defs>
8
+ <font id="FontomasCustomRegular" horiz-adv-x="1024" >
9
+ <font-face units-per-em="2048" ascent="1536" descent="-512" />
10
+ <missing-glyph horiz-adv-x="500" />
11
+ <glyph unicode="e" d="M31 102v1004l1030 -483l1018 481v-1002h-2048zM31 1389v249h2048v-249l-1020 -484z" />
12
+ <glyph unicode="p" d="M31 102l780 781q-12 63 -12 116q0 264 187.5 451.5t452.5 187.5t452.5 -187t187.5 -452.5t-187.5 -453t-453.5 -187.5q-51 0 -115 13l-12 -13v-256h-256v-256h-256v-256h-768v512zM1311 998.5q0 -52.5 37.5 -90.5t91 -38t90.5 38t37 90.5t-37 90t-90.5 37.5t-91 -37.5 t-37.5 -90z" />
13
+ <glyph unicode="u" d="M207 -90q0 45 112.5 111.5t305.5 138.5q193 68 264.5 139.5t71.5 196.5q0 33 -12.5 55t-30 36.5t-37 55.5t-31.5 102q-4 20 -14.5 29.5t-22.5 15t-24.5 14.5t-21.5 37.5t-15 76.5q0 31 10 52t20 27l11 7q-20 102 -29 180q0 7 -1 13q0 28 7 61q8 42 34.5 92.5t70 90.5 t120 67.5t174.5 27.5q100 0 178 -27.5t122 -67.5t71 -90.5t35 -92.5q5 -28 5 -51q0 -12 -1 -23q-8 -78 -29 -180q37 -16 37 -86q-2 -47 -12 -76t-21.5 -38t-23.5 -14.5t-22.5 -14.5t-14.5 -30q-10 -61 -30.5 -102t-37 -55.5t-30 -37t-13.5 -54.5q0 -125 72 -197t260 -139 q195 -72 306.5 -138.5t111.5 -111.5v-217h-963h-962v217z" />
14
+ <glyph unicode="&#x2000;" horiz-adv-x="819" />
15
+ <glyph unicode="&#x2001;" horiz-adv-x="1638" />
16
+ <glyph unicode="&#x2002;" horiz-adv-x="819" />
17
+ <glyph unicode="&#x2003;" horiz-adv-x="1638" />
18
+ <glyph unicode="&#x2004;" horiz-adv-x="544" />
19
+ <glyph unicode="&#x2005;" horiz-adv-x="409" />
20
+ <glyph unicode="&#x2006;" horiz-adv-x="272" />
21
+ <glyph unicode="&#x2007;" horiz-adv-x="272" />
22
+ <glyph unicode="&#x2008;" horiz-adv-x="204" />
23
+ <glyph unicode="&#x2009;" horiz-adv-x="327" />
24
+ <glyph unicode="&#x200a;" horiz-adv-x="90" />
25
+ <glyph unicode="&#x2013;" d="M205 512v205h614v-205h-614z" />
26
+ <glyph unicode="&#x2014;" horiz-adv-x="2048" d="M205 512v205h1638v-205h-1638z" />
27
+ <glyph unicode="&#x202f;" horiz-adv-x="327" />
28
+ <glyph unicode="&#x205f;" horiz-adv-x="409" />
29
+ <glyph unicode="&#xe000;" horiz-adv-x="500" d="M0 0v0v0v0v0z" />
30
+ </font>
31
+ </defs></svg>
fonts/fontomas-webfont.ttf ADDED
Binary file
fonts/fontomas-webfont.woff ADDED
Binary file
inc/admin.php CHANGED
@@ -1,31 +1,28 @@
1
  <?php
2
- class Yop_Poll_Admin extends Yop_Poll_Plugin {
 
3
  protected function init() {
4
- $this->add_action ( 'init', 'admin_loader' );
5
- $this->add_action ( 'admin_notices', 'popup_bar' );
6
- $this->add_action ( 'admin_init', 'popup_bar_operations' );
7
- $this->add_action ( 'admin_enqueue_scripts', 'my_yop_poll_button' );
8
- $this->add_action ( 'wpmu_new_blog', 'new_blog', 10, 6 );
9
- $this->add_action ( 'delete_blog', 'delete_blog', 10, 2 );
10
- register_activation_hook ( $this->_config->plugin_file, array (
11
- $this,
12
- 'yop_poll_activate'
13
- ) );
14
- register_deactivation_hook ( $this->_config->plugin_file, array (
15
- $this,
16
- 'yop_poll_deactivate'
17
- ) );
18
- register_uninstall_hook ( $this->_config->plugin_file, 'yop_poll_uninstall' );
19
- $this->add_action ( 'admin_enqueue_scripts', 'load_editor_functions' );
20
- $this->add_action ( 'plugins_loaded', 'db_update' );
21
  }
22
- function new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
 
23
  global $wpdb;
24
- if (! function_exists ( 'is_plugin_active_for_network' ))
25
- require_once (ABSPATH . '/wp-admin/includes/plugin.php');
26
- if (is_plugin_active_for_network ( 'yop-poll/yop_poll.php' )) {
 
27
  $old_blog = $wpdb->blogid;
28
- switch_to_blog ( $blog_id );
29
  $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
30
  $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
31
  $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';
@@ -37,105 +34,100 @@
37
  $wpdb->yop_poll_bans = $wpdb->prefix . 'yop_poll_bans';
38
  $wpdb->yop_poll_votes_custom_fields = $wpdb->prefix . 'yop_poll_votes_custom_fields';
39
  $wpdb->yop_poll_facebook_users = $wpdb->prefix . 'yop_poll_facebook_users';
40
- $this->activate ( NULL );
41
- switch_to_blog ( $old_blog );
42
  }
43
  }
44
- function delete_blog($blog_id) {
 
45
  global $wpdb;
46
  $old_blog = $wpdb->blogid;
47
- switch_to_blog ( $blog_id );
48
- $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`" );
49
- switch_to_blog ( $old_blog );
50
  }
51
 
52
- function yop_poll_network_propagate($pfunction, $networkwide) {
53
  global $wpdb;
54
 
55
- if (function_exists ( 'is_multisite' ) && is_multisite ()) {
56
  // check if it is a network activation - if so, run the activation function
57
  // for each blog id
58
- if ($networkwide) {
59
  $old_blog = $wpdb->blogid;
60
  // Get all blog ids
61
- $blogids = $wpdb->get_col ( "SELECT blog_id FROM {$wpdb->blogs}" );
62
  foreach ( $blogids as $blog_id ) {
63
- switch_to_blog ( $blog_id );
64
- $wpdb->yop_polls = $wpdb->prefix . 'yop_polls';
65
- $wpdb->yop_poll_answers = $wpdb->prefix . 'yop_poll_answers';
66
- $wpdb->yop_poll_templates = $wpdb->prefix . 'yop_poll_templates';
67
- $wpdb->yop_poll_custom_fields = $wpdb->prefix . 'yop_poll_custom_fields';
68
- $wpdb->yop_pollmeta = $wpdb->prefix . 'yop_pollmeta';
69
- $wpdb->yop_poll_answermeta = $wpdb->prefix . 'yop_poll_answermeta';
70
- $wpdb->yop_poll_logs = $wpdb->prefix . 'yop_poll_logs';
71
- $wpdb->yop_poll_voters = $wpdb->prefix . 'yop_poll_voters';
72
- $wpdb->yop_poll_bans = $wpdb->prefix . 'yop_poll_bans';
73
  $wpdb->yop_poll_votes_custom_fields = $wpdb->prefix . 'yop_poll_votes_custom_fields';
74
- $wpdb->yop_poll_facebook_users = $wpdb->prefix . 'yop_poll_facebook_users';
75
- call_user_func ( array (
76
- $this,
77
- $pfunction
78
- ), $networkwide );
79
  }
80
- switch_to_blog ( $old_blog );
81
  return;
82
  }
83
  }
84
- call_user_func ( array (
85
- $this,
86
- $pfunction
87
- ), $networkwide );
88
  }
89
 
90
- function yop_poll_activate($networkwide) {
91
- $this->yop_poll_network_propagate ( 'activate', $networkwide );
92
  }
93
 
94
- function yop_poll_deactivate($networkwide) {
95
- $this->yop_poll_network_propagate ( 'deactivate', $networkwide );
96
  }
97
 
98
  public function db_update() {
99
  global $wpdb;
100
  global $current_user;
101
 
102
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
103
- $installed_version = get_option ( "yop_poll_version" );
104
 
105
  // update for version 1.5
106
- if (version_compare ( $installed_version, '1.5', '<=' )) {
107
- $default_options = get_option ( 'yop_poll_options' );
108
- if (! isset ( $default_options ['vote_button_label'] )) {
109
  $default_options ['vote_button_label'] = 'Vote';
110
  }
111
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
112
- update_option ( 'yop_poll_options', $default_options );
113
  }
114
 
115
  // update for version 1.6
116
- if (version_compare ( $installed_version, '1.6', '<=' )) {
117
- $default_options = get_option ( 'yop_poll_options' );
118
- if (! isset ( $default_options ['display_other_answers_values'] )) {
119
  $default_options ['display_other_answers_values'] = 'no';
120
  }
121
- if (! isset ( $default_options ['percentages_decimals'] )) {
122
  $default_options ['percentages_decimals'] = '0';
123
  }
124
- if (! isset ( $default_options ['plural_answer_result_votes_number_label'] )) {
125
  $default_options ['singular_answer_result_votes_number_label'] = 'vote';
126
  }
127
- if (! isset ( $default_options ['plural_answer_result_votes_number_label'] )) {
128
  $default_options ['plural_answer_result_votes_number_label'] = 'votes';
129
  }
130
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
131
- update_option ( 'yop_poll_options', $default_options );
132
  }
133
 
134
  // update for version 2.0
135
- if (version_compare ( $installed_version, '2.0', '<=' )) {
136
- $wpdb->query ( 'ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `total_votes` `total_answers` INT( 11 ) NOT NULL ' );
137
- $wpdb->query ( 'ALTER TABLE `' . $wpdb->yop_polls . '` CHANGE `total_voters` `total_votes` INT( 11 ) NOT NULL ' );
138
- $wpdb->query ( "
139
  UPDATE " . $wpdb->yop_poll_templates . "
140
  SET
141
  before_vote_template = REPLACE( before_vote_template, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
@@ -145,314 +137,314 @@
145
  css = REPLACE( css, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS'),
146
  js = REPLACE( js, 'POLL-TOTAL-VOTERS', 'POLL-TOTAL-ANSWERS')
147
  " );
148
- $default_options = get_option ( 'yop_poll_options' );
149
- if (! isset ( $default_options ['view_total_answers'] )) {
150
  $default_options ['view_total_answers'] = $default_options ['view_total_voters'];
151
  }
152
- if (! isset ( $default_options ['view_total_answers_label'] )) {
153
  $default_options ['view_total_answers_label'] = 'Total Answers %POLL-TOTAL-ANSWERS%';
154
  }
155
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
156
- update_option ( 'yop_poll_options', $default_options );
157
  }
158
 
159
  // update for version 3.2
160
- if (version_compare ( $installed_version, '3.2', '<=' )) {
161
- $wpdb->query ( "
162
  UPDATE " . $wpdb->yop_poll_templates . "
163
  SET
164
  js = REPLACE( js, 'findWidest = false ) {\r\n', 'findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n ')
165
  " );
166
 
167
- $default_options = get_option ( 'yop_poll_options' );
168
- if (! isset ( $default_options ['auto_generate_poll_page'] )) {
169
  $default_options ['auto_generate_poll_page'] = 'no';
170
  }
171
- if (! isset ( $default_options ['has_auto_generate_poll_page'] )) {
172
  $default_options ['has_auto_generate_poll_page'] = 'no';
173
  }
174
- update_option ( 'yop_poll_options', $default_options );
175
 
176
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
177
  }
178
 
179
  // update for version 3.3
180
- if (version_compare ( $installed_version, '3.3', '<=' )) {
181
- $yop_poll_first_install_date = get_option ( 'yop_poll_first_install_date' );
182
- if (! $yop_poll_first_install_date) {
183
- $oldest_yop_poll = Yop_Poll_Model::get_oldest_poll_from_database ();
184
- update_option ( "yop_poll_first_install_date", $oldest_yop_poll ['date_added'] );
185
  }
186
- $yop_poll_admin_notices_donate = get_option ( 'yop_poll_admin_notices_donate' );
187
- if (! $yop_poll_admin_notices_donate) {
188
- update_option ( "yop_poll_admin_notices_donate", 'yes' );
189
  }
190
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
191
  }
192
 
193
  // update for version 3.7
194
- if (version_compare ( $installed_version, '3.7', '<=' )) {
195
- $default_options = get_option ( 'yop_poll_options' );
196
- if (! isset ( $default_options ['poll_name_html_tags'] )) {
197
  $default_options ['poll_name_html_tags'] = 'no';
198
  }
199
- if (! isset ( $default_options ['poll_question_html_tags'] )) {
200
  $default_options ['poll_question_html_tags'] = 'no';
201
  }
202
- if (! isset ( $default_options ['poll_answer_html_tags'] )) {
203
  $default_options ['poll_answer_html_tags'] = 'no';
204
  }
205
- if (! isset ( $default_options ['poll_custom_field_html_tags'] )) {
206
  $default_options ['poll_custom_field_html_tags'] = 'no';
207
  }
208
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
209
- update_option ( 'yop_poll_options', $default_options );
210
  }
211
 
212
- if (version_compare ( $installed_version, '3.9', '<=' )) {
213
- require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
214
- require_once (YOP_POLL_INC . '/' . 'db_schema.php');
215
- Yop_Poll_DbSchema::create_polls_table ();
216
- Yop_Poll_DbSchema::create_polls_templates_table ();
217
 
218
- wp_get_current_user ();
219
- if ($current_user->ID > 0) {
220
- $wpdb->query ( "UPDATE " . $wpdb->yop_polls . " SET poll_author = " . $current_user->ID . " WHERE poll_author = 0" );
221
- $wpdb->query ( "UPDATE " . $wpdb->yop_poll_templates . " SET template_author = " . $current_user->ID . " WHERE template_author = 0" );
222
  }
223
 
224
- $default_options = get_option ( 'yop_poll_options' );
225
- if (! isset ( $default_options ['use_default_loading_image'] )) {
226
  $default_options ['use_default_loading_image'] = 'yes';
227
  }
228
- if (! isset ( $default_options ['loading_image_url'] )) {
229
  $default_options ['loading_image_url'] = '';
230
  }
231
- update_option ( 'yop_poll_options', $default_options );
232
 
233
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
234
  }
235
 
236
- if (version_compare ( $installed_version, '4.1', '<=' )) {
237
 
238
- $this->update_to_4_2 ();
239
- $default_options = get_option ( 'yop_poll_options' );
240
- if (! isset ( $default_options ['use_captcha'] )) {
241
  $default_options ['use_captcha'] = 'no';
242
  }
243
 
244
- update_option ( 'yop_poll_options', $default_options );
245
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
246
  }
247
 
248
- if (version_compare ( $installed_version, '4.2', '<=' ) ) {
249
 
250
- require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
251
- require_once (YOP_POLL_INC . '/' . 'db_schema.php');
252
- Yop_Poll_DbSchema::create_poll_facebook_users_table ();
253
- Yop_Poll_DbSchema::create_poll_logs_table ();
254
- Yop_Poll_DbSchema::create_poll_votes_custom_fields_table ();
255
 
256
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
257
- if (! isset ( $optin_box_modal_options ['show'] )) {
258
  $optin_box_modal_options ['show'] = 'yes';
259
  }
260
- if (! isset ( $optin_box_modal_options ['last_show_date'] )) {
261
- $optin_box_modal_options ['last_show_date'] = Yop_Poll_Model::get_mysql_curent_date ();
262
  }
263
- if (! isset ( $optin_box_modal_options ['modal_had_submit'] )) {
264
  $optin_box_modal_options ['modal_had_submit'] = 'no';
265
  }
266
- if (! isset ( $optin_box_modal_options ['sidebar_had_submit'] )) {
267
  $optin_box_modal_options ['sidebar_had_submit'] = 'no';
268
  }
269
- update_option ( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
270
 
271
- $pro_options = get_option ( 'yop_poll_pro_options' );
272
- if (! isset ( $pro_options ['pro_key'] )) {
273
  $pro_options ['pro_key'] = '';
274
  }
275
- if (! isset ( $pro_options ['pro_api_key'] )) {
276
  $pro_options ['pro_api_key'] = '';
277
  }
278
- if (! isset ( $pro_options ['pro_api_server_url'] )) {
279
  $pro_options ['pro_api_server_url'] = 'http://www.yop-poll.com/pro';
280
  }
281
- if (! isset ( $pro_options ['pro_user'] )) {
282
  $pro_options ['pro_user'] = 'no';
283
  }
284
 
285
- $default_options = get_option ( 'yop_poll_options' );
286
- if (! isset ( $default_options ['vote_permisions_facebook'] )) {
287
  $default_options ['vote_permisions_facebook'] = 'no';
288
  }
289
- if (! isset ( $default_options ['vote_permisions_facebook_label'] )) {
290
  $default_options ['vote_permisions_facebook_label'] = 'Vote as Facebook User';
291
  }
292
- if (! isset ( $default_options ['vote_permisions_wordpress'] )) {
293
  $default_options ['vote_permisions_wordpress'] = 'no';
294
  }
295
- if (! isset ( $default_options ['vote_permisions_wordpress_label'] )) {
296
  $default_options ['vote_permisions_wordpress_label'] = 'Vote as Wordpress User';
297
  }
298
- if (! isset ( $default_options ['vote_permisions_anonymous'] )) {
299
  $default_options ['vote_permisions_anonymous'] = 'no';
300
  }
301
- if (! isset ( $default_options ['vote_permisions_anonymous_label'] )) {
302
  $default_options ['vote_permisions_anonymous_label'] = 'Vote as Anonymous User';
303
  }
304
 
305
- if (! isset ( $default_options ['share_after_vote'] )) {
306
  $default_options ['share_after_vote'] = 'no';
307
- }
308
- if (! isset ( $default_options ['share_picture'] )) {
309
  $default_options ['share_picture'] = '';
310
  }
311
- if (! isset ( $default_options ['share_name'] )) {
312
  $default_options ['share_name'] = '';
313
  }
314
- if (! isset ( $default_options ['share_caption'] )) {
315
  $default_options ['share_caption'] = '';
316
  }
317
- if (! isset ( $default_options ['share_description'] )) {
318
  $default_options ['share_description'] = '';
319
  }
320
- if (! isset ( $default_options ['redirect_after_vote'] )) {
321
  $default_options ['redirect_after_vote'] = 'no';
322
  }
323
- if (! isset ( $default_options ['redirect_after_vote_url'] )) {
324
  $default_options ['redirect_after_vote_url'] = '';
325
  }
326
- if (! isset ( $default_options ['allow_multiple_answers_min_number'] )) {
327
  $default_options ['allow_multiple_answers_min_number'] = '1';
328
  }
329
- if (! isset ( $default_options ['is_default_answer'] )) {
330
  $default_options ['is_default_answer'] = 'no';
331
  }
332
- if (! isset ( $default_options ['template_width'] )) {
333
  $default_options ['template_width'] = '200px';
334
  }
335
- if (! isset ( $default_options ['widget_template'] )) {
336
  $default_options ['widget_template'] = $default_options['template'];
337
- }
338
- if (! isset ( $default_options ['widget_template_width'] )) {
339
  $default_options ['widget_template_width'] = '200px';
340
  }
341
 
342
- $wpdb->query ( "
343
  UPDATE " . $wpdb->yop_poll_templates . "
344
  SET
345
  css = REPLACE( css, 'width:200px;', 'width:%POLL-WIDTH%;')
346
- " );
347
 
348
- update_option ( 'yop_poll_options', $default_options );
349
 
350
- update_option ( 'yop_poll_pro_options', $pro_options );
351
 
352
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
353
  }
354
 
355
- if (version_compare ( $installed_version, '4.3', '<=' ) ) {
356
- require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
357
- require_once (YOP_POLL_INC . '/' . 'db_schema.php');
358
- Yop_Poll_DbSchema::create_poll_voters_table ();
359
 
360
- $wpdb->query ( "
361
  UPDATE " . $wpdb->yop_poll_templates . "
362
  SET
363
  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}' )
364
- WHERE
365
  css NOT LIKE '%#yop-poll-container-success-%'
366
  " );
367
 
368
- $default_options = get_option ( 'yop_poll_options' );
369
 
370
- if (! isset ( $default_options ['limit_number_of_votes_per_user'] )) {
371
  $default_options ['limit_number_of_votes_per_user'] = 'no';
372
  }
373
 
374
- if (! isset ( $default_options ['number_of_votes_per_user'] )) {
375
  $default_options ['number_of_votes_per_user'] = 1;
376
  }
377
 
378
- if (! isset ( $default_options ['message_after_vote'] )) {
379
  $default_options ['message_after_vote'] = 'Thank you for your vote!';
380
  }
381
 
382
- if (! isset ( $default_options ['start_scheduler'] )) {
383
  $default_options ['start_scheduler'] = 'no';
384
  }
385
- if (! isset ( $default_options ['schedule_reset_poll_stats'] )) {
386
  $default_options ['schedule_reset_poll_stats'] = 'no';
387
  }
388
- if (! isset ( $default_options ['schedule_reset_poll_date'] )) {
389
  $default_options ['schedule_reset_poll_date'] = current_time( 'timestamp' );
390
  }
391
- if (! isset ( $default_options ['schedule_reset_poll_recurring_value'] )) {
392
  $default_options ['schedule_reset_poll_recurring_value'] = '9999';
393
  }
394
- if (! isset ( $default_options ['schedule_reset_poll_recurring_unit'] )) {
395
  $default_options ['schedule_reset_poll_recurring_unit'] = 'DAY';
396
  }
397
 
398
- update_option ( 'yop_poll_options', $default_options );
399
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
400
  }
401
 
402
- if (version_compare ( $installed_version, '4.4', '<=' ) ) {
403
- require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
404
- require_once (YOP_POLL_INC . '/' . 'db_schema.php');
405
- Yop_Poll_DbSchema::create_poll_logs_table ();
406
- Yop_Poll_DbSchema::create_poll_votes_custom_fields_table ();
407
 
408
- $default_options = get_option ( 'yop_poll_options' );
409
 
410
- if (! isset ( $default_options ['view_results_permissions'] )) {
411
  $default_options ['view_results_permissions'] = 'guest-registered';
412
  }
413
 
414
- if (! isset ( $default_options ['date_format'] )) {
415
  $default_options ['date_format'] = 'd/m/Y H:i:s';
416
  }
417
 
418
- if (! isset ( $default_options ['add_other_answers_to_default_answers'] )) {
419
  $default_options ['add_other_answers_to_default_answers'] = 'no';
420
  }
421
 
422
- update_option ( 'yop_poll_options', $default_options );
423
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
424
  }
425
 
426
- if (version_compare ( $installed_version, '4.5', '<=' ) ) {
427
 
428
- $default_options = get_option ( 'yop_poll_options' );
429
 
430
- if (! isset ( $default_options ['send_email_notifications'] )) {
431
  $default_options ['send_email_notifications'] = 'no';
432
  }
433
 
434
- if (! isset ( $default_options ['email_notifications_from_name'] )) {
435
  $default_options ['email_notifications_from_name'] = 'Yop Poll';
436
  }
437
 
438
  $sitename = strtolower( $_SERVER['SERVER_NAME'] );
439
- if ( substr( $sitename, 0, 4 ) == 'www.' ) {
440
  $sitename = substr( $sitename, 4 );
441
  }
442
 
443
- if (! isset ( $default_options ['email_notifications_from_email'] )) {
444
- $default_options ['email_notifications_from_email'] = 'yop-poll@'.$sitename;
445
  }
446
 
447
- if (! isset ( $default_options ['email_notifications_recipients'] )) {
448
  $default_options ['email_notifications_recipients'] = '';
449
  }
450
 
451
- if (! isset ( $default_options ['email_notifications_subject'] )) {
452
  $default_options ['email_notifications_subject'] = 'New Vote';
453
  }
454
 
455
- if (! isset ( $default_options ['email_notifications_body'] )) {
456
  $default_options ['email_notifications_body'] = '<p>A new vote was registered on [VOTE_DATE] for [POLL_NAME]</p>
457
  <p>Vote Details:</p>
458
  <p><b>Question:</b> [QUESTION]</p>
@@ -461,41 +453,45 @@
461
  <p><b>Vote ID:</b> <br />[VOTE_ID]</p>';
462
  }
463
 
464
- update_option ( 'yop_poll_options', $default_options );
465
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
466
  }
467
 
468
- if (version_compare ( $installed_version, '4.7', '<=' ) ) {
469
  $this->update_to_4_8();
470
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
471
  }
472
 
473
- if (version_compare ( $installed_version, '4.8', '<=' ) ) {
474
  $this->update_to_4_9();
475
- update_option ( "yop_poll_version", $wpdb->yop_poll_version );
476
  }
477
 
 
 
 
 
478
  }
479
 
480
  public function update_to_4_2() {
481
  global $wpdb;
482
 
483
- $saved_templates = $wpdb->get_results ( "
484
  SELECT id FROM " . $wpdb->yop_poll_templates . "
485
  WHERE
486
  before_vote_template LIKE '%<div id=\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">%' AND
487
  before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
488
  ", ARRAY_A );
489
 
490
- $updated_templates = $wpdb->get_results ( "
491
  SELECT id FROM " . $wpdb->yop_poll_templates . "
492
  WHERE
493
  before_vote_template LIKE '%<div id=\\\\\\\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\\\\\\\" . '"' . " class=\\\\\\\\" . '"' . "yop-poll-footer\\\\\\\\" . '"' . ">%' AND
494
  before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
495
  ", ARRAY_A );
496
- if (count ( $saved_templates ) > 0) {
497
  foreach ( $saved_templates as $template ) {
498
- $wpdb->query ( "
499
  UPDATE " . $wpdb->yop_poll_templates . " SET
500
  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\\" . '"' . ">')
501
  WHERE
@@ -504,9 +500,9 @@
504
  " );
505
  }
506
  }
507
- if (count ( $updated_templates ) > 0) {
508
  foreach ( $updated_templates as $template ) {
509
- $wpdb->query ( "
510
  UPDATE " . $wpdb->yop_poll_templates . " SET
511
  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\\" . '"' . ">')
512
  WHERE
@@ -516,16 +512,16 @@
516
  }
517
  }
518
 
519
- $css_templates = $wpdb->get_results ( "
520
  SELECT id FROM " . $wpdb->yop_poll_templates . "
521
  WHERE
522
  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
523
  css NOT LIKE '%yop-poll-captcha%'
524
  ", ARRAY_A );
525
 
526
- if (count ( $css_templates ) > 0) {
527
  foreach ( $css_templates as $template ) {
528
- $wpdb->query ( "
529
  UPDATE " . $wpdb->yop_poll_templates . " SET
530
  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')
531
  WHERE
@@ -535,16 +531,16 @@
535
  }
536
  }
537
 
538
- $css_templates_1 = $wpdb->get_results ( "
539
  SELECT id FROM " . $wpdb->yop_poll_templates . "
540
  WHERE
541
  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
542
  css NOT LIKE '%yop-poll-captcha%'
543
  ", ARRAY_A );
544
 
545
- if (count ( $css_templates_1 ) > 0) {
546
  foreach ( $css_templates_1 as $template ) {
547
- $wpdb->query ( "
548
  UPDATE " . $wpdb->yop_poll_templates . " SET
549
  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')
550
  WHERE
@@ -554,9 +550,10 @@
554
  }
555
  }
556
  }
 
557
  public function update_to_4_8() {
558
  global $wpdb;
559
- $sql = <<<EOT
560
  UPDATE $wpdb->yop_poll_templates
561
  SET
562
  js = CONCAT( js, '
@@ -564,452 +561,346 @@
564
  runOnPollStateChange_%POLL-ID%();
565
  });
566
 
567
- function runOnPollStateChange_%POLL-ID%() {};'
568
  )
569
  WHERE js NOT LIKE '%runOnPollStateChange_%'
570
  EOT;
571
- $updated_templates = $wpdb->query($sql);
572
  }
 
573
  public function update_to_4_9() {
574
  global $wpdb;
575
- $sql =<<<EOT
576
- UPDATE $wpdb->yop_poll_templates
577
- SET `before_vote_template` =
578
- REPLACE( `before_vote_template` ,
579
- '<div id="yop-poll-answers-%POLL-ID"',
580
- '<div id="yop-poll-answers-%POLL-ID%"' )
581
- WHERE `before_vote_template` LIKE '%<div id="yop-poll-answers-%POLL-ID"%
582
  EOT;
583
- $wpdb->query($sql);
584
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
  public function admin_loader() {
586
  // $this->add_action ( 'network_admin_menu', 'admin_menu', 1 );
587
- $this->add_action ( 'admin_init', 'yop_poll_options_admin_init', 1 );
588
- $this->add_action ( 'admin_menu', 'admin_menu', 1 );
589
- $this->add_action ( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
590
- $this->add_action ( 'wp_ajax_yop_poll_preview_template', 'ajax_preview_template', 1 );
591
- $this->add_action ( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
592
- $this->add_action ( 'wp_ajax_yop_poll_edit_add_new_poll', 'ajax_edit_add_new_poll', 1 );
593
- $this->add_action ( 'wp_ajax_yop_poll_edit_add_new_poll_template', 'ajax_edit_add_new_poll_template', 1 );
594
- $this->add_action ( 'wp_ajax_yop_poll_reset_poll_template', 'ajax_reset_poll_template', 1 );
595
- $this->add_action ( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
596
- $this->add_action ( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
597
- $this->add_action ( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
598
- $this->add_action ( 'wp_ajax_yop_poll_show_change_votes_number_answer', 'ajax_show_change_votes_number_answer', 1 );
599
- $this->add_action ( 'wp_ajax_yop_poll_do_change_votes_number_answer', 'ajax_do_change_votes_number_answer', 1 );
600
 
601
- $this->add_action ( 'wp_ajax_yop_poll_show_change_total_number_poll', 'ajax_show_change_total_number_poll', 1 );
602
- $this->add_action ( 'wp_ajax_yop_poll_do_change_total_number_poll', 'ajax_do_change_total_number_poll', 1 );
603
 
604
- $this->add_action ( 'wp_ajax_yop_poll_show_change_poll_author', 'ajax_show_change_poll_author', 1 );
605
- $this->add_action ( 'wp_ajax_yop_poll_do_change_poll_author', 'ajax_do_change_poll_author', 1 );
606
 
607
- $this->add_action ( 'wp_ajax_yop_poll_show_change_template_author', 'ajax_show_change_template_author', 1 );
608
- $this->add_action ( 'wp_ajax_yop_poll_do_change_template_author', 'ajax_do_change_template_author', 1 );
609
 
610
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
611
- $this->add_action ( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
612
 
613
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
614
- $this->add_action ( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
615
 
616
- $this->add_action ( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
617
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
618
 
619
- $this->add_action ( 'wp_ajax_yop_poll_load_css', 'yop_poll_load_css', 1 );
620
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_load_css', 'yop_poll_load_css', 1 );
621
 
622
- $this->add_action ( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
623
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
624
 
625
- $this->add_action ( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
626
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
627
 
628
- $this->add_action ( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
629
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
630
 
631
- $this->add_action ( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
632
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
633
 
634
- $this->add_action ( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
635
- $this->add_action ( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
636
  }
637
 
638
  /**
639
  * this file is executed on activation
640
  * it creates the database and adds some data to database's table
641
  */
642
- public function activate($networkwide) {
643
  global $wp_version;
644
- if (! version_compare ( $wp_version, YOP_POLL_WP_VERSION, '>=' )) {
645
- $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' ) );
646
 
647
  // die & print error message & code - for admins only!
648
- if (isset ( $error ) && is_wp_error ( $error ) && current_user_can ( 'manage_options' ))
649
- wp_die ( $error->get_error_message (), $error->get_error_data () );
650
- } else {
651
- if (! extension_loaded ( 'json' )) {
652
- $error = new WP_Error ( 'Wordpress_json_error', __ ( 'You need the json php extension for this plugin', 'yop_poll' ), __ ( 'Error: Wordpress Extension Problem', 'yop_poll' ) );
 
 
653
 
654
  // die & print error message & code - for admins only!
655
- if (isset ( $error ) && is_wp_error ( $error ) && current_user_can ( 'manage_options' ))
656
- wp_die ( $error->get_error_message (), $error->get_error_data () );
 
657
  }
658
  // including upgrade.php for using dbDelta()
659
- require_once (ABSPATH . 'wp-admin/includes/upgrade.php');
660
  // including db_schema class file
661
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
662
- require_once (YOP_POLL_INC . '/' . 'db_schema.php');
663
  // create tables
664
- Yop_Poll_DbSchema::create_poll_database_tables ();
665
  }
666
  }
667
- public function deactivate($networkwide) {
 
668
  /*
669
  * 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`");
670
  */
671
- $poll_archive_page = get_page_by_path ( 'yop-poll-archive', ARRAY_A );
672
- if ($poll_archive_page) {
673
  $poll_archive_page_id = $poll_archive_page ['ID'];
674
- wp_delete_post ( $poll_archive_page_id, true );
675
  }
676
- $schedule_timestamp = wp_next_scheduled( 'yop_poll_hourly_event', array() );
677
- if ( $schedule_timestamp ) {
678
  wp_unschedule_event( $schedule_timestamp, 'yop_poll_hourly_event', array() );
679
  }
680
  }
681
 
682
  public function admin_menu() {
683
- if (is_admin () && $this->current_user_can ( 'edit_own_polls' )) {
684
- if (function_exists ( 'add_menu_page' )) {
685
- if ($this->current_user_can ( 'edit_own_polls' ))
686
- $page = add_menu_page ( __ ( 'Yop Poll', 'yop_poll' ), __ ( 'Yop Poll', 'yop_poll' ), 'read', 'yop-polls', array (
687
- $this,
688
- 'manage_pages'
689
- ), "{$this->_config->plugin_url}/images/yop-poll-admin-menu-icon16.png", '28.734' );
690
- }
691
- if ($this->current_user_can ( 'edit_own_polls' ))
692
- add_action ( "load-$page", array (
693
- &$this,
694
- 'manage_pages_load'
695
- ) );
696
- if (function_exists ( 'add_submenu_page' )) {
697
-
698
- if ($this->current_user_can ( 'edit_own_polls' )) {
699
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'All Polls', 'yop_poll' ), __ ( 'All Polls', 'yop_poll' ), 'read', 'yop-polls', array (
700
- &$this,
701
- 'manage_pages'
702
- ) );
703
- add_action ( "load-$subpage", array (
704
- &$this,
705
- 'manage_pages_load'
706
- ) );
707
- }
708
- if ($this->current_user_can ( 'edit_own_polls' )) {
709
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Add New', 'yop_poll' ), __ ( 'Add New', 'yop_poll' ), 'read', 'yop-polls-add-new', array (
710
- &$this,
711
- 'manage_pages'
712
- ) );
713
- add_action ( "load-$subpage", array (
714
- &$this,
715
- 'manage_pages_load'
716
- ) );
717
- }
718
- if ($this->current_user_can ( 'manage_polls_options' )) {
719
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Options', 'yop_poll' ), __ ( 'Options', 'yop_poll' ), 'read', 'yop-polls-options', array (
720
- &$this,
721
- 'manage_pages'
722
- ) );
723
- add_action ( "load-$subpage", array (
724
- &$this,
725
- 'manage_pages_load'
726
- ) );
727
- }
728
- if ($this->current_user_can ( 'edit_own_polls_templates' )) {
729
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Templates', 'yop_poll' ), __ ( 'Templates', 'yop_poll' ), 'read', 'yop-polls-templates', array (
730
- &$this,
731
- 'manage_pages'
732
- ) );
733
- add_action ( "load-$subpage", array (
734
- &$this,
735
- 'manage_pages_load'
736
- ) );
737
- }
738
- if ($this->current_user_can ( 'view_own_polls_logs' )) {
739
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Logs', 'yop_poll' ), __ ( 'Logs', 'yop_poll' ), 'read', 'yop-polls-logs', array (
740
- &$this,
741
- 'manage_pages'
742
- ) );
743
- add_action ( "load-$subpage", array (
744
- &$this,
745
- 'manage_pages_load'
746
- ) );
747
- }
748
- if ($this->current_user_can ( 'manage_polls_bans' )) {
749
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Bans', 'yop_poll' ), __ ( 'Bans', 'yop_poll' ), 'read', 'yop-polls-bans', array (
750
- &$this,
751
- 'manage_pages'
752
- ) );
753
- add_action ( "load-$subpage", array (
754
- &$this,
755
- 'manage_pages_load'
756
- ) );
757
- }
758
- if ($this->current_user_can ( 'become_pro' )) {
759
- $subpage = add_submenu_page ( 'yop-polls', __ ( 'Become Pro', 'yop_poll' ), __ ( 'Become Pro', 'yop_poll' ), 'read', 'yop-polls-become-pro', array (
760
- &$this,
761
- 'manage_pages'
762
- ) );
763
- add_action ( "load-$subpage", array (
764
- &$this,
765
- 'manage_pages_load'
766
- ) );
767
  }
768
  }
769
  }
770
  }
 
771
  public function manage_pages() {
772
  global $page, $action;
773
- switch ($page) {
774
  case 'yop-polls' :
775
- if ('custom-fields' == $action) {
776
- $this->view_poll_custom_fields ();
777
  break;
778
  }
779
- if ('results' == $action) {
780
- $this->view_poll_results ();
781
  break;
782
- } elseif ('edit' == $action) {
783
- } else {
784
- $this->view_all_polls ();
 
 
785
  break;
786
  }
787
  case 'yop-polls-add-new' :
788
- $this->view_add_edit_new_poll ();
789
  break;
790
  case 'yop-polls-options' :
791
- $this->view_yop_poll_options ();
792
  break;
793
  case 'yop-polls-logs' :
794
- $this->view_yop_poll_logs ();
795
  break;
796
  case 'yop-polls-bans' :
797
- $this->view_yop_poll_bans ();
798
  break;
799
  case 'yop-polls-become-pro' :
800
- $this->view_yop_poll_become_pro ();
801
  break;
802
  case 'yop-polls-templates' :
803
- if ('add-new' == $action || 'edit' == $action) {
804
- $this->view_add_edit_poll_template ();
805
- } else {
806
- $this->view_yop_poll_templates ();
 
807
  }
808
  break;
809
  default :
810
- $this->view_all_polls ();
811
  }
812
  }
 
813
  public function manage_pages_load() {
814
- wp_reset_vars ( array (
815
- 'page',
816
- 'action',
817
- 'orderby',
818
- 'order'
819
- ) );
820
  global $page, $action, $orderby, $order, $yop_poll_add_new_config;
821
- $default_options = get_option ( 'yop_poll_options', array () );
822
 
823
- wp_enqueue_style ( 'yop-poll-admin', "{$this->_config->plugin_url}/css/yop-poll-admin.css", array (), $this->_config->version );
824
- $answers_number = $this->_config->min_number_of_answers + 1; // total +1
825
  $customfields_number = $this->_config->min_number_of_customfields + 1; // total +1
826
 
827
- wp_enqueue_script('yop-poll-admin', "{$this->_config->plugin_url}/js/yop-poll-admin.js", array (
828
- 'jquery'
829
- ), $this->_config->version, true );
830
-
831
- switch ($page) {
832
  case 'yop-polls' :
833
- if ('results' == $action) {
834
- wp_enqueue_style ( 'yop-poll-admin-results', "{$this->_config->plugin_url}/css/yop-poll-admin-results.css", array (), $this->_config->version );
835
- wp_enqueue_style ( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array (), $this->_config->version );
836
- wp_enqueue_style ( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array (), $this->_config->version );
837
- wp_enqueue_script ( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array (
838
- 'jquery',
839
- 'jquery-ui-datepicker',
840
- 'jquery-ui-slider'
841
- ), $this->_config->version, true );
842
- wp_enqueue_style ( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/css/yop-poll-admin-custom-fields.css", array (), $this->_config->version );
843
- wp_enqueue_script ( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/js/yop-poll-admin-custom-fields.js", array (
844
- 'jquery',
845
- 'yop-poll-jquery-ui-timepicker'
846
- ), $this->_config->version, true );
847
- $this->yop_poll_custom_fields_results_operations ();
848
  break;
849
  }
850
- if ('custom-fields' == $action) {
851
- wp_enqueue_style ( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array (), $this->_config->version );
852
- wp_enqueue_style ( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array (), $this->_config->version );
853
- wp_enqueue_script ( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array (
854
- 'jquery',
855
- 'jquery-ui-datepicker',
856
- 'jquery-ui-slider'
857
- ), $this->_config->version, true );
858
- wp_enqueue_style ( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/css/yop-poll-admin-custom-fields.css", array (), $this->_config->version );
859
- wp_enqueue_script ( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/js/yop-poll-admin-custom-fields.js", array (
860
- 'jquery',
861
- 'yop-poll-jquery-ui-timepicker'
862
- ), $this->_config->version, true );
863
- $this->yop_poll_custom_fields_operations ();
864
  break;
865
- }
866
- elseif ('edit' == $action) {
867
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
868
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
869
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
870
- $answers = Yop_Poll_Model::get_poll_answers ( $poll_id );
871
- $answers_number = count ( $answers ) + 1; // total +1
872
- $custom_fields = Yop_Poll_Model::get_poll_customfields ( $poll_id );
873
- $customfields_number = count ( $custom_fields ) + 1; // total +1
874
- }
 
875
  else {
876
- $this->view_all_polls_operations ();
877
- wp_enqueue_script ( 'link' );
878
- wp_enqueue_script ( 'xfn' );
879
- wp_enqueue_script ( 'yop-poll-optin-form', "http://app.getresponse.com/view_webform.js?wid=394041&mg_param1=1", NULL, $this->_config->version, true );
880
- $this->load_optin_box ();
881
  break;
882
  }
883
 
884
  case 'yop-polls-add-new' :
885
- $yop_poll_add_new_config = array (
886
- 'ajax' => array (
887
- 'url' => admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ),
888
- 'action' => 'yop_poll_edit_add_new_poll',
889
- 'beforeSendMessage' => __ ( 'Please wait a moment while we process your request...', 'yop_poll' ),
890
- 'errorMessage' => __ ( 'An error has occured...', 'yop_poll' )
891
- ),
892
- 'text_answer' => __ ( 'Answer', 'yop_poll' ),
893
- 'text_customfield' => __ ( 'Custom Text Field', 'yop_poll' ),
894
- 'text_requiered_customfield' => __ ( 'Required', 'yop_poll' ),
895
- 'text_remove_answer' => __ ( 'Remove', 'yop_poll' ),
896
- 'text_remove_customfield' => __ ( 'Remove', 'yop_poll' ),
897
- 'text_customize_answer' => __ ( 'More Options', 'yop_poll' ),
898
- 'text_change_votes_number_answer' => __ ( 'Change Number Of Votes', 'yop_poll' ),
899
- 'text_change_votes_number_poll' => __ ( 'Change Number Of Total Votes', 'yop_poll' ),
900
- 'text_change_answers_number_poll' => __ ( 'Change Number Of Total Answers', 'yop_poll' ),
901
- 'plugin_url' => $this->_config->plugin_url,
902
- 'default_number_of_answers' => $answers_number,
903
- 'default_number_of_customfields' => $customfields_number,
904
- '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>',
905
- 'text_poll_bar_style' => array (
906
- 'use_template_bar_label' => __ ( 'Use Template Result Bar', 'yop_poll' ),
907
- 'use_template_bar_yes_label' => __ ( 'Yes', 'yop_poll' ),
908
- 'use_template_bar_no_label' => __ ( 'No', 'yop_poll' ),
909
- 'poll_bar_style_label' => __ ( 'Yop Poll Bar Style', 'yop_poll' ),
910
- 'poll_bar_preview_label' => __ ( 'Yop Poll Bar Preview', 'yop_poll' ),
911
- 'poll_bar_style_background_label' => __ ( 'Background Color', 'yop_poll' ),
912
- 'poll_bar_style_height_label' => __ ( 'Height', 'yop_poll' ),
913
- 'poll_bar_style_border_color_label' => __ ( 'Border Color', 'yop_poll' ),
914
- 'poll_bar_style_border_width_label' => __ ( 'Border Width', 'yop_poll' ),
915
- 'poll_bar_style_border_style_label' => __ ( 'Border Style', 'yop_poll' )
916
- ),
917
- 'poll_bar_default_options' => array (
918
- 'use_template_bar' => isset ( $default_options ['use_template_bar'] ) ? $default_options ['use_template_bar'] : 'yes',
919
- 'height' => isset ( $default_options ['bar_height'] ) ? $default_options ['bar_height'] : 10,
920
- 'background_color' => isset ( $default_options ['bar_background'] ) ? $default_options ['bar_background'] : 'd8e1eb',
921
- 'border' => isset ( $default_options ['bar_border_style'] ) ? $default_options ['bar_border_style'] : 'solid',
922
- 'border_width' => isset ( $default_options ['bar_border_width'] ) ? $default_options ['bar_border_width'] : 1,
923
- 'border_color' => isset ( $default_options ['bar_border_color'] ) ? $default_options ['bar_border_color'] : 'c8c8c8'
924
- )
925
- );
926
- wp_enqueue_style ( 'yop-poll-admin-add-new', "{$this->_config->plugin_url}/css/yop-poll-admin-add-new.css", array (), $this->_config->version );
927
- wp_enqueue_style ( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array (), $this->_config->version );
928
- wp_enqueue_style ( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array (), $this->_config->version );
929
-
930
- wp_enqueue_script ( 'yop-poll-admin-add-new', "{$this->_config->plugin_url}/js/yop-poll-admin-add-new.js", array (
931
- 'jquery',
932
- 'yop-poll-jquery-ui-timepicker'
933
- ), $this->_config->version, true );
934
- wp_enqueue_script ( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array (
935
- 'jquery',
936
- 'jquery-ui-datepicker',
937
- 'jquery-ui-slider'
938
- ), $this->_config->version, true );
939
- wp_enqueue_script ( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array (
940
- 'jquery'
941
- ), $this->_config->version, true );
942
- wp_enqueue_style ( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array (), $this->_config->version );
943
- wp_localize_script ( 'yop-poll-admin-add-new', 'yop_poll_add_new_config', $yop_poll_add_new_config );
944
- wp_enqueue_script ( 'link' );
945
- wp_enqueue_script ( 'xfn' );
946
  break;
947
  case 'yop-polls-logs' :
948
- wp_enqueue_style ( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array (), $this->_config->version );
949
- wp_enqueue_style ( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array (), $this->_config->version );
950
- wp_enqueue_script ( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array (
951
- 'jquery',
952
- 'jquery-ui-datepicker',
953
- 'jquery-ui-slider'
954
- ), $this->_config->version, true );
955
- wp_enqueue_script ( 'yop-poll-admin-logs', "{$this->_config->plugin_url}/js/yop-poll-admin-logs.js", array (
956
- 'jquery',
957
- 'yop-poll-jquery-ui-timepicker'
958
- ), $this->_config->version, true );
959
- $this->view_yop_poll_logs_operations ();
960
  break;
961
  case 'yop-polls-bans' :
962
- wp_enqueue_script ( 'yop-poll-admin-bans', "{$this->_config->plugin_url}/js/yop-poll-admin-bans.js", array (
963
- 'jquery'
964
- ), $this->_config->version, true );
965
- $this->view_yop_poll_bans_operations ();
966
  break;
967
  case 'yop-polls-options' :
968
- wp_enqueue_style ( 'yop-poll-admin-options', "{$this->_config->plugin_url}/css/yop-poll-admin-options.css", array (), $this->_config->version );
969
- wp_enqueue_style ( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array (), $this->_config->version );
970
- wp_enqueue_style ( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array (), $this->_config->version );
971
- wp_enqueue_script ( 'yop-poll-admin-options', "{$this->_config->plugin_url}/js/yop-poll-admin-options.js", array (
972
- 'jquery',
973
- 'yop-poll-jquery-ui-timepicker'
974
- ), $this->_config->version, true );
975
- wp_enqueue_script ( 'yop-poll-jquery-ui-timepicker', "{$this->_config->plugin_url}/js/jquery-ui-timepicker-addon.js", array (
976
- 'jquery',
977
- 'jquery-ui-datepicker',
978
- 'jquery-ui-slider'
979
- ), $this->_config->version, true );
980
- wp_enqueue_script ( 'link' );
981
- wp_enqueue_script ( 'xfn' );
982
  break;
983
  case 'yop-polls-templates' :
984
- add_filter ( 'user_can_richedit', create_function ( '$a', 'return false;' ), 1 );
985
- wp_enqueue_script ( array (
986
- 'editor',
987
- 'thickbox'
988
- ) );
989
- wp_enqueue_style ( 'thickbox' );
990
- wp_enqueue_script ( 'yop-poll-admin-templates', "{$this->_config->plugin_url}/js/yop-poll-admin-templates.js", array (
991
- 'jquery'
992
- ), $this->_config->version, true );
993
- $yop_poll_add_new_template_config = array (
994
- 'ajax' => array (
995
- 'url' => admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ),
996
- 'action' => 'yop_poll_edit_add_new_poll_template',
997
- 'reset_action' => 'yop_poll_reset_poll_template',
998
- 'beforeSendMessage' => __ ( 'Please wait a moment while we process your request...', 'yop_poll' ),
999
- 'errorMessage' => __ ( 'An error has occured...', 'yop_poll' )
1000
- )
1001
- );
1002
- wp_enqueue_script ( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array (
1003
- 'jquery'
1004
- ), $this->_config->version, true );
1005
- wp_enqueue_style ( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array (), $this->_config->version );
1006
- wp_localize_script ( 'yop-poll-admin-templates', 'yop_poll_add_new_template_config', $yop_poll_add_new_template_config );
1007
- $this->view_yop_poll_templates_operations ();
1008
  break;
1009
  default :
1010
- $this->view_all_polls_operations ();
1011
  break;
1012
  }
 
1013
  }
1014
 
1015
  /**
@@ -1017,365 +908,311 @@ EOT;
1017
  */
1018
  public function view_yop_poll_logs_operations() {
1019
  global $page, $action, $order, $orderby, $current_user;
1020
- if ('-1' != $action && isset ( $_REQUEST ['yoppolllogscheck'] )) {
1021
- if ('delete' == $action) {
1022
- check_admin_referer ( 'yop-poll-logs' );
1023
- $bulklogs = ( array ) $_REQUEST ['yoppolllogscheck'];
1024
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1025
  $total_deleted = 0;
1026
  foreach ( $bulklogs as $log_id ) {
1027
- $log_id = ( int ) $log_id;
1028
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id ( 'poll_id', $log_id );
1029
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
1030
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1031
- Yop_Poll_Model::delete_poll_log_from_db ( $log_id );
1032
- else
1033
- $total_deleted ++;
1034
- }
1035
- wp_redirect ( add_query_arg ( 'deleted', count ( $bulklogs ) - $total_deleted, remove_query_arg ( array (
1036
- '_wp_http_referer',
1037
- '_wpnonce',
1038
- 'action',
1039
- 'yoppolllogscheck'
1040
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1041
  exit ();
1042
  }
1043
 
1044
- if ('delete_group' == $action) {
1045
- check_admin_referer ( 'yop-poll-logs' );
1046
- $bulklogs = ( array ) $_REQUEST ['yoppolllogscheck'];
1047
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1048
  $total_deleted_group = 0;
1049
  foreach ( $bulklogs as $vote_id ) {
1050
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id ( 'poll_id', $vote_id );
1051
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
1052
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1053
- Yop_Poll_Model::delete_group_poll_log_from_db ( $vote_id );
1054
- else
1055
- $total_deleted_group ++;
1056
- }
1057
- wp_redirect ( add_query_arg ( 'deleted', count ( $bulklogs ) - $total_deleted_group, remove_query_arg ( array (
1058
- '_wp_http_referer',
1059
- '_wpnonce',
1060
- 'action',
1061
- 'yoppolllogscheck'
1062
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1063
  exit ();
1064
  }
1065
- } elseif ('-1' != $action && isset ( $_REQUEST ['id'] )) {
1066
- if ('delete' == $action) {
1067
- check_admin_referer ( 'yop-poll-logs-delete' );
1068
- $log_id = ( int ) $_REQUEST ['id'];
1069
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1070
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id ( 'poll_id', $log_id );
1071
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
1072
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1073
- Yop_Poll_Model::delete_poll_log_from_db ( $log_id );
1074
- else
1075
- wp_die ( __ ( 'You are not allowed to delete this item.', 'yop_poll' ) );
1076
- wp_redirect ( add_query_arg ( 'deleted', 1, remove_query_arg ( array (
1077
- '_wpnonce',
1078
- 'id',
1079
- 'action'
1080
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1081
  exit ();
1082
  }
1083
- if ('delete_group' == $action) {
1084
- check_admin_referer ( 'yop-poll-logs-delete' );
1085
  $vote_id = $_REQUEST ['id'];
1086
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1087
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id ( 'poll_id', $vote_id );
1088
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
1089
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1090
- Yop_Poll_Model::delete_group_poll_log_from_db ( $vote_id );
1091
- else
1092
- wp_die ( __ ( 'You are not allowed to delete this item.', 'yop_poll' ) );
1093
- wp_redirect ( add_query_arg ( 'deleted', 1, remove_query_arg ( array (
1094
- '_wpnonce',
1095
- 'id',
1096
- 'action'
1097
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1098
  exit ();
1099
  }
1100
- } elseif (isset ( $_REQUEST ['export'] )) {
 
1101
  global $wpdb;
1102
- if ( isset( $_REQUEST ['a'] ) && __ ( 'Export', 'yop_poll' ) == $_REQUEST ['a'] ) {
1103
- check_admin_referer ( 'yop-poll-logs' );
1104
- $per_page = (isset ( $_GET ['per_page'] ) ? intval ( $_GET ['per_page'] ) : 100);
1105
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int ) $_REQUEST ['page_no'] : 1;
1106
- $orderby = (empty ( $orderby )) ? 'name' : $orderby;
1107
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int ) $_REQUEST ['poll_id'] : NULL;
1108
- $log_sdate = (isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '');
1109
- $log_edate = (isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '');
1110
- $group_by = (isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote');
1111
-
1112
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1113
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
1114
- if ($this->current_user_can ( 'view_own_polls_logs' ) && $poll_id) {
1115
- if ($poll_author != $current_user->ID && ! $this->current_user_can ( 'view_polls_logs' ))
1116
- wp_die ( __ ( 'You are not allowed to access this section.', 'yop_poll' ) );
1117
- } elseif (! $this->current_user_can ( 'view_polls_logs' )) {
1118
- wp_die ( __ ( 'You are not allowed to access this section.', 'yop_poll' ) );
1119
- }
1120
-
1121
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( 'id', 'asc' );
1122
- if ($group_by == 'vote')
1123
- $search = array (
1124
- 'fields' => array (
1125
- 'name',
1126
- 'ip',
1127
- 'user_nicename',
1128
- 'user_email',
1129
- 'user_from',
1130
- 'tr_id'
1131
- ),
1132
- 'value' => isset ( $_REQUEST ['s'] ) ? trim ( $_REQUEST ['s'] ) : ''
1133
- );
1134
- else
1135
- $search = array (
1136
- 'fields' => array (
1137
- 'name',
1138
- 'answer',
1139
- 'ip',
1140
- 'other_answer_value',
1141
- 'user_nicename',
1142
- 'user_from',
1143
- 'user_email',
1144
- 'tr_id'
1145
- ),
1146
- 'value' => isset ( $_REQUEST ['s'] ) ? trim ( $_REQUEST ['s'] ) : ''
1147
- );
1148
- $filter = array (
1149
- 'field' => NULL,
1150
- 'value' => NULL,
1151
- 'operator' => '='
1152
- );
1153
- if ('all' == $_REQUEST ['export'])
1154
- if ($group_by == 'vote')
1155
- $logs = Yop_Poll_Model::get_group_logs_filter_search ( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1156
- else
1157
- $logs = Yop_Poll_Model::get_logs_filter_search ( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1158
- if ('page' == $_REQUEST ['export'])
1159
- if ($group_by == 'vote')
1160
- $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 );
1161
- else
1162
- $logs = Yop_Poll_Model::get_logs_filter_search ( $orderby, $order, $search, $poll_id, ($page_no - 1) * $per_page, $per_page, $log_sdate, $log_edate );
1163
-
1164
- $csv_file_name = 'logs_export.' . date ( 'YmdHis' ) . '.csv';
1165
- $csv_header_array = array (
1166
- __ ( '#', 'yop_poll' ),
1167
- __ ( 'Vote ID', 'yop_poll' ),
1168
- __ ( 'POLL Name', 'yop_poll' ),
1169
- __ ( 'Answer', 'yop_poll' ),
1170
- __ ( 'User Type', 'yop_poll' ),
1171
- __ ( 'User', 'yop_poll' ),
1172
- __ ( 'User Email', 'yop_poll' ),
1173
- __ ( 'Tracking ID', 'yop_poll' ),
1174
- __ ( 'IP', 'yop_poll' ),
1175
- __ ( 'Vote Date', 'yop_poll' )
1176
- );
1177
-
1178
- header ( 'Content-type: application/csv' );
1179
- header ( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1180
- ob_start ();
1181
- $f = fopen ( 'php://output', 'w' ) or show_error ( __ ( "Can't open php://output!", 'yop_poll' ) );
1182
-
1183
- if (! fputcsv ( $f, $csv_header_array ))
1184
- _e ( "Can't write header!", 'yop_poll' );
1185
-
1186
- if (count ( $logs ) > 0) {
1187
  $index = 1;
1188
  foreach ( $logs as $log ) {
1189
- $logs_data = array (
1190
- $index,
1191
- $log ['vote_id'],
1192
- stripslashes ( $log ['name'] ),
1193
- ('Other' == $log ['answer']) ? 'Other - ' . stripslashes ( $log ['other_answer_value'] ) : stripslashes ( $log ['answer'] ),
1194
- stripslashes ( $log ['user_from'] ),
1195
- stripslashes ( $log ['user_nicename'] ),
1196
- stripslashes ( $log ['user_email'] ),
1197
- stripslashes ( $log ['tr_id'] ),
1198
- stripslashes ( $log ['ip'] ),
1199
- stripslashes ( $log ['vote_date'] )
1200
- );
1201
- if (! fputcsv ( $f, $logs_data ))
1202
- _e ( "Can't write header!", 'yop_poll' );
1203
- $index ++;
1204
  }
1205
  }
1206
 
1207
- fclose ( $f ) or show_error ( __ ( "Can't close php://output!", 'yop_poll' ) );
1208
- $csvStr = ob_get_contents ();
1209
- ob_end_clean ();
1210
 
1211
  echo $csvStr;
1212
  exit ();
1213
  }
1214
 
1215
- wp_safe_redirect ( remove_query_arg ( array (
1216
- '_wp_http_referer',
1217
- '_wpnonce',
1218
- 'export',
1219
- 'a'
1220
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1221
  exit ();
1222
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1223
- wp_safe_redirect ( remove_query_arg ( array (
1224
- '_wp_http_referer',
1225
- '_wpnonce'
1226
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1227
  exit ();
1228
  }
1229
  }
 
1230
  public function yop_poll_custom_fields_operations() {
1231
  global $page, $action;
1232
- if (isset ( $_REQUEST ['export'] )) {
1233
- check_admin_referer ( 'yop-poll-custom-fields' );
1234
- if ('' != $_REQUEST ['export']) {
1235
- $per_page = (isset ( $_GET ['per_page'] ) ? intval ( $_GET ['per_page'] ) : 100);
1236
- $page_no = (isset ( $_REQUEST ['page_no'] ) ? ( int ) $_REQUEST ['page_no'] : 1);
1237
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
1238
- $sdate = (isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '');
1239
- $edate = (isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '');
1240
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1241
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id ( $poll_id );
1242
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields ( $poll_id );
1243
- $custom_fields_number = count ( $poll_custom_fields );
1244
- $column_custom_fields_ids = array ();
1245
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs ( $poll_id, $sdate, $edate );
1246
- $total_custom_fields_logs_pages = ceil ( $total_custom_fields_logs / $per_page );
1247
- if (intval ( $page_no ) > intval ( $total_custom_fields_logs_pages ))
1248
  $page_no = 1;
 
1249
 
1250
- if ('all' == $_REQUEST ['export'])
1251
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs ( $poll_id, 'vote_id', 'asc', 0, 99999999, $sdate, $edate );
1252
- if ('page' == $_REQUEST ['export'])
1253
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs ( $poll_id, 'vote_id', 'asc', ($page_no - 1) * $per_page, $per_page, $sdate, $edate );
 
 
1254
 
1255
- $csv_file_name = 'custom_fields_export.' . date ( 'YmdHis' ) . '.csv';
1256
- $csv_header_array = array (
1257
- __ ( '#', 'yop_poll' )
1258
- );
1259
  foreach ( $poll_custom_fields as $custom_field ) {
1260
  $column_custom_fields_ids [] = $custom_field ['id'];
1261
- $csv_header_array [] = ucfirst ( $custom_field ['custom_field'] );
1262
  }
1263
- $csv_header_array [] = __ ( 'Vote Date', 'yop_poll' );
1264
 
1265
- header ( 'Content-type: application/csv' );
1266
- header ( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1267
- ob_start ();
1268
- $f = fopen ( 'php://output', 'w' ) or show_error ( __ ( "Can't open php://output!", 'yop_poll' ) );
1269
  $n = 0;
1270
- if (isset ( $csv_header_array ))
1271
- if (! fputcsv ( $f, $csv_header_array ))
1272
- _e ( "Can't write header!", 'yop_poll' );
 
 
1273
 
1274
- if (count ( $custom_fields_logs ) > 0) {
1275
  $index = 1;
1276
  foreach ( $custom_fields_logs as $logs ) {
1277
- $column_custom_fields_values = array (
1278
- $index
1279
- );
1280
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
1281
- $vote_log_values = array ();
1282
- $vote_logs = explode ( '<#!,>', $logs ['vote_log'] );
1283
- if (count ( $vote_logs ) > 0) {
1284
  foreach ( $vote_logs as $vote_log ) {
1285
- $temp = explode ( '<#!->', $vote_log );
1286
- $vote_log_values [$temp [1]] = stripslashes ( $temp [0] );
1287
  }
1288
  }
1289
  $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
1290
  }
1291
  $column_custom_fields_values [] = $logs ['vote_date'];
1292
- if (! fputcsv ( $f, $column_custom_fields_values ))
1293
- _e ( "Can't write record!", 'yop_poll' );
1294
- $index ++;
 
1295
  }
1296
  }
1297
- fclose ( $f ) or show_error ( __ ( "Can't close php://output!", 'yop_poll' ) );
1298
- $csvStr = ob_get_contents ();
1299
- ob_end_clean ();
1300
 
1301
  echo $csvStr;
1302
  exit ();
1303
  }
1304
- wp_safe_redirect ( remove_query_arg ( array (
1305
- '_wp_http_referer',
1306
- '_wpnonce',
1307
- 'export',
1308
- 'a'
1309
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1310
  exit ();
1311
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1312
- wp_safe_redirect ( remove_query_arg ( array (
1313
- '_wp_http_referer',
1314
- '_wpnonce',
1315
- 'a'
1316
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1317
  exit ();
1318
  }
1319
  }
 
1320
  public function yop_poll_custom_fields_results_operations() {
1321
  global $page, $action;
1322
- if (isset ( $_REQUEST ['export'] )) {
1323
- check_admin_referer ( 'yop-poll-custom-fields' );
1324
- if (__ ( 'Export', 'yop_poll' ) == $_REQUEST ['a']) {
1325
- $cf_per_page = (isset ( $_GET ['cf_per_page'] ) ? intval ( $_GET ['cf_per_page'] ) : 100);
1326
- $cf_page_no = (isset ( $_REQUEST ['cf_page_no'] ) ? ( int ) $_REQUEST ['cf_page_no'] : 1);
1327
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
1328
- $cf_sdate = (isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '');
1329
- $cf_edate = (isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '');
1330
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1331
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id ( $poll_id );
1332
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields ( $poll_id );
1333
- $custom_fields_number = count ( $poll_custom_fields );
1334
- $column_custom_fields_ids = array ();
1335
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs ( $poll_id, $cf_sdate, $cf_edate );
1336
- $total_custom_fields_logs_pages = ceil ( $total_custom_fields_logs / $cf_per_page );
1337
- if (intval ( $cf_page_no ) > intval ( $total_custom_fields_logs_pages ))
1338
  $cf_page_no = 1;
 
1339
 
1340
- if ('all' == $_REQUEST ['export'])
1341
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs ( $poll_id, 'vote_id', 'asc', 0, 99999999, $cf_sdate, $cf_edate );
1342
- if ('page' == $_REQUEST ['export'])
1343
- $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 );
 
 
1344
 
1345
- $csv_file_name = 'custom_fields_export.' . date ( 'YmdHis' ) . '.csv';
1346
- $csv_header_array = array (
1347
- __ ( '#', 'yop_poll' )
1348
- );
1349
  foreach ( $poll_custom_fields as $custom_field ) {
1350
  $column_custom_fields_ids [] = $custom_field ['id'];
1351
- $csv_header_array [] = ucfirst ( $custom_field ['custom_field'] );
1352
  }
1353
- $csv_header_array [] = __ ( 'Vote ID', 'yop_poll' );
1354
- $csv_header_array [] = __ ( 'Traking ID', 'yop_poll' );
1355
- $csv_header_array [] = __ ( 'Vote Date', 'yop_poll' );
1356
-
1357
- header ( 'Content-type: application/csv' );
1358
- header ( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1359
- ob_start ();
1360
- $f = fopen ( 'php://output', 'w' ) or show_error ( __ ( "Can't open php://output!", 'yop_poll' ) );
1361
  $n = 0;
1362
- if (isset ( $csv_header_array ))
1363
- if (! fputcsv ( $f, $csv_header_array ))
1364
- _e ( "Can't write header!", 'yop_poll' );
 
 
1365
 
1366
- if (count ( $custom_fields_logs ) > 0) {
1367
  $index = 1;
1368
  foreach ( $custom_fields_logs as $logs ) {
1369
- $column_custom_fields_values = array (
1370
- $index
1371
- );
1372
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
1373
- $vote_log_values = array ();
1374
- $vote_logs = explode ( '<#!,>', $logs ['vote_log'] );
1375
- if (count ( $vote_logs ) > 0) {
1376
  foreach ( $vote_logs as $vote_log ) {
1377
- $temp = explode ( '<#!->', $vote_log );
1378
- $vote_log_values [$temp [1]] = stripslashes ( $temp [0] );
1379
  }
1380
  }
1381
  $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
@@ -1383,332 +1220,287 @@ EOT;
1383
  $column_custom_fields_values [] = $logs ['vote_id'];
1384
  $column_custom_fields_values [] = $logs ['tr_id'];
1385
  $column_custom_fields_values [] = $logs ['vote_date'];
1386
- if (! fputcsv ( $f, $column_custom_fields_values ))
1387
- _e ( "Can't write record!", 'yop_poll' );
1388
- $index ++;
 
1389
  }
1390
  }
1391
- fclose ( $f ) or show_error ( __ ( "Can't close php://output!", 'yop_poll' ) );
1392
- $csvStr = ob_get_contents ();
1393
- ob_end_clean ();
1394
 
1395
  echo $csvStr;
1396
  exit ();
1397
  }
1398
- wp_safe_redirect ( remove_query_arg ( array (
1399
- '_wp_http_referer',
1400
- '_wpnonce',
1401
- 'export',
1402
- 'a'
1403
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1404
  exit ();
1405
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1406
- wp_safe_redirect ( remove_query_arg ( array (
1407
- '_wp_http_referer',
1408
- '_wpnonce',
1409
- 'a'
1410
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1411
  exit ();
1412
  }
1413
  }
 
1414
  public function view_yop_poll_bans_operations() {
1415
  global $page, $action;
1416
- if ('-1' != $action && isset ( $_REQUEST ['yoppollbanscheck'] )) {
1417
- if ('delete' == $action) {
1418
- check_admin_referer ( 'yop-poll-bans' );
1419
- $bulkbans = ( array ) $_REQUEST ['yoppollbanscheck'];
1420
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1421
  foreach ( $bulkbans as $ban_id ) {
1422
- $ban_id = ( int ) $ban_id;
1423
- Yop_Poll_Model::delete_poll_ban_from_db ( $ban_id );
1424
- }
1425
- wp_redirect ( add_query_arg ( 'deleted', count ( $bulkbans ), remove_query_arg ( array (
1426
- '_wp_http_referer',
1427
- '_wpnonce',
1428
- 'yoppollbanscheck'
1429
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1430
  exit ();
1431
  }
1432
- } elseif ('-1' != $action && isset ( $_REQUEST ['id'] )) {
1433
- if ('delete' == $action) {
1434
- check_admin_referer ( 'yop-poll-bans-delete' );
1435
- $ban_id = ( int ) $_REQUEST ['id'];
1436
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1437
- Yop_Poll_Model::delete_poll_ban_from_db ( $ban_id );
1438
- wp_redirect ( add_query_arg ( 'deleted', 1, remove_query_arg ( array (
1439
- '_wpnonce',
1440
- 'id',
1441
- 'action'
1442
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1443
  exit ();
1444
  }
1445
- } elseif ('add-ban' == $action) {
1446
- check_admin_referer ( 'yop-poll-add-ban' );
1447
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1448
- $bans = Yop_Poll_Model::add_bans ( $_REQUEST );
1449
- if ($bans ['error'] != '') {
1450
- wp_redirect ( add_query_arg ( 'bans-error', urlencode ( $bans ['error'] ), remove_query_arg ( array (
1451
- '_wpnonce',
1452
- 'id',
1453
- 'action'
1454
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1455
  exit ();
1456
- } else {
1457
- wp_redirect ( add_query_arg ( 'bans-added', urlencode ( ( int ) $bans ['success'] ), remove_query_arg ( array (
1458
- '_wpnonce',
1459
- 'id',
1460
- 'action'
1461
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1462
  exit ();
1463
  }
1464
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1465
- wp_safe_redirect ( remove_query_arg ( array (
1466
- '_wp_http_referer',
1467
- '_wpnonce'
1468
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1469
  exit ();
1470
  }
1471
  }
 
1472
  public function view_yop_poll_templates_operations() {
1473
  global $page, $action, $yop_poll_add_new_config, $current_user;
1474
- if ('-1' != $action && isset ( $_REQUEST ['templatecheck'] )) {
1475
- if ('delete' == $action) {
1476
- check_admin_referer ( 'yop-poll-templates' );
1477
- $bulktemplates = ( array ) $_REQUEST ['templatecheck'];
1478
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1479
  $total_deleted = 0;
1480
  foreach ( $bulktemplates as $template_id ) {
1481
- $template_id = ( int ) $template_id;
1482
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id ( 'template_author', $template_id );
1483
- if (($this->current_user_can ( 'delete_own_polls_templates' ) && $template_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_templates' )))
1484
- Yop_Poll_Model::delete_poll_template_from_db ( $template_id );
1485
- else
1486
- $total_deleted ++;
 
 
1487
  }
1488
- wp_redirect ( add_query_arg ( 'deleted', count ( $bulktemplates ) - $total_deleted, remove_query_arg ( array (
1489
- '_wp_http_referer',
1490
- '_wpnonce',
1491
- 'templatecheck'
1492
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1493
  exit ();
1494
  }
1495
- if ('clone' == $action) {
1496
- check_admin_referer ( 'yop-poll-templates' );
1497
- $bulktemplates = ( array ) $_REQUEST ['templatecheck'];
1498
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1499
  $total_cloned = 0;
1500
  foreach ( $bulktemplates as $template_id ) {
1501
- $template_id = ( int ) $template_id;
1502
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id ( 'template_author', $template_id );
1503
- if (($this->current_user_can ( 'clone_own_polls_templates' ) && $template_author == $current_user->ID) || ($this->current_user_can ( 'clone_polls_templates' )))
1504
- Yop_Poll_Model::clone_poll_template ( $template_id );
1505
- else
1506
- $total_cloned ++;
 
 
1507
  }
1508
- wp_redirect ( add_query_arg ( 'cloned', count ( $bulktemplates ) - $total_cloned, remove_query_arg ( array (
1509
- '_wp_http_referer',
1510
- '_wpnonce',
1511
- 'templatecheck'
1512
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1513
  exit ();
1514
  }
1515
- } elseif ('-1' != $action && isset ( $_REQUEST ['id'] )) {
1516
- if ('delete' == $action) {
1517
- check_admin_referer ( 'yop-poll-templates' );
1518
- $template_id = ( int ) $_REQUEST ['id'];
1519
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1520
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id ( 'template_author', $template_id );
1521
- if (($this->current_user_can ( 'delete_own_polls_templates' ) && $template_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_templates' )))
1522
- Yop_Poll_Model::delete_poll_template_from_db ( $template_id );
1523
- else
1524
- wp_die ( __ ( 'You are not allowed to delete this item.', 'yop_poll' ) );
1525
- wp_redirect ( add_query_arg ( 'deleted', 1, remove_query_arg ( array (
1526
- '_wpnonce',
1527
- 'id',
1528
- 'action'
1529
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1530
  exit ();
1531
  }
1532
- if ('clone' == $action) {
1533
- check_admin_referer ( 'yop-poll-templates' );
1534
- $template_id = ( int ) $_REQUEST ['id'];
1535
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1536
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id ( 'template_author', $template_id );
1537
- if (($this->current_user_can ( 'clone_own_polls_templates' ) && $template_author == $current_user->ID) || ($this->current_user_can ( 'clone_polls_templates' )))
1538
- Yop_Poll_Model::clone_poll_template ( $template_id );
1539
- else
1540
- wp_die ( __ ( 'You are not allowed to clone this item.', 'yop_poll' ) );
1541
- wp_redirect ( add_query_arg ( 'cloned', 1, remove_query_arg ( array (
1542
- '_wpnonce',
1543
- 'id',
1544
- 'action'
1545
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1546
  exit ();
1547
  }
1548
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1549
- wp_safe_redirect ( remove_query_arg ( array (
1550
- '_wp_http_referer',
1551
- '_wpnonce'
1552
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1553
  exit ();
1554
  }
1555
  }
 
1556
  public function view_all_polls_operations() {
1557
  global $page, $action, $yop_poll_add_new_config, $current_user;
1558
- if ('-1' != $action && isset ( $_REQUEST ['yoppollcheck'] )) {
1559
- if ('delete' == $action) {
1560
- check_admin_referer ( 'yop-poll-view' );
1561
- $bulkyoppolls = ( array ) $_REQUEST ['yoppollcheck'];
1562
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1563
  $total_undeleted = 0;
1564
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1565
- $yoppoll_id = ( int ) $yoppoll_id;
1566
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1567
- if (($this->current_user_can ( 'delete_own_polls' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls' )))
1568
- Yop_Poll_Model::delete_poll_from_db ( $yoppoll_id );
1569
- else
1570
- $total_undeleted ++;
 
 
1571
  }
1572
- wp_redirect ( add_query_arg ( 'deleted', count ( $bulkyoppolls ) - $total_undeleted, remove_query_arg ( array (
1573
- '_wp_http_referer',
1574
- '_wpnonce',
1575
- 'yoppollcheck'
1576
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1577
  exit ();
1578
  }
1579
- if ('clone' == $action) {
1580
- check_admin_referer ( 'yop-poll-view' );
1581
- $bulkyoppolls = ( array ) $_REQUEST ['yoppollcheck'];
1582
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1583
  $total_uncloned = 0;
1584
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1585
- $yoppoll_id = ( int ) $yoppoll_id;
1586
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1587
- if (($this->current_user_can ( 'clone_own_polls' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'clone_polls' )))
1588
- Yop_Poll_Model::clone_poll ( $yoppoll_id );
1589
- else
1590
- $total_uncloned ++;
 
 
1591
  }
1592
- wp_redirect ( add_query_arg ( 'cloned', count ( $bulkyoppolls ) - $total_uncloned, remove_query_arg ( array (
1593
- '_wp_http_referer',
1594
- '_wpnonce',
1595
- 'yoppollcheck'
1596
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1597
  exit ();
1598
  }
1599
- if ('reset_votes' == $action) {
1600
- check_admin_referer ( 'yop-poll-view' );
1601
- $bulkyoppolls = ( array ) $_REQUEST ['yoppollcheck'];
1602
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1603
  $total_unreseted = 0;
1604
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1605
- $yoppoll_id = ( int ) $yoppoll_id;
1606
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1607
- if (($this->current_user_can ( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'reset_polls_stats' )))
1608
- Yop_Poll_Model::reset_votes_for_poll ( $yoppoll_id );
1609
- else
1610
- $total_unreseted ++;
 
 
1611
  }
1612
- wp_redirect ( add_query_arg ( 'reseted_votes', count ( $bulkyoppolls ) - $total_unreseted, remove_query_arg ( array (
1613
- '_wp_http_referer',
1614
- '_wpnonce',
1615
- 'yoppollcheck'
1616
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1617
  exit ();
1618
  }
1619
- if ('delete_logs' == $action) {
1620
- check_admin_referer ( 'yop-poll-view' );
1621
- $bulkyoppolls = ( array ) $_REQUEST ['yoppollcheck'];
1622
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1623
  $total_undeleted_logs = 0;
1624
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1625
- $yoppoll_id = ( int ) $yoppoll_id;
1626
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1627
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1628
- Yop_Poll_Model::delete_all_poll_logs ( $yoppoll_id );
1629
- else
1630
- $total_undeleted_logs ++;
 
 
1631
  }
1632
- wp_redirect ( add_query_arg ( 'deleted_logs', count ( $bulkyoppolls ) - $total_undeleted_logs, remove_query_arg ( array (
1633
- '_wp_http_referer',
1634
- '_wpnonce',
1635
- 'yoppollcheck'
1636
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1637
  exit ();
1638
  }
1639
- } elseif ('-1' != $action && isset ( $_REQUEST ['id'] )) {
1640
- if ('delete' == $action) {
1641
- check_admin_referer ( 'yop-poll-delete' );
1642
- $yoppoll_id = ( int ) $_REQUEST ['id'];
1643
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1644
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1645
- if (($this->current_user_can ( 'delete_own_polls' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls' )))
1646
- Yop_Poll_Model::delete_poll_from_db ( $yoppoll_id );
1647
- else
1648
- wp_die ( __ ( 'You are not allowed to delete this item.', 'yop_poll' ) );
1649
- wp_redirect ( add_query_arg ( 'deleted', 1, remove_query_arg ( array (
1650
- '_wpnonce',
1651
- 'id',
1652
- 'action'
1653
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1654
  exit ();
1655
  }
1656
 
1657
- if ('clone' == $action) {
1658
- check_admin_referer ( 'yop-poll-clone' );
1659
- $yoppoll_id = ( int ) $_REQUEST ['id'];
1660
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1661
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1662
- if (($this->current_user_can ( 'clone_own_polls' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'clone_polls' )))
1663
- Yop_Poll_Model::clone_poll ( $yoppoll_id );
1664
- else
1665
- wp_die ( __ ( 'You are not allowed to clone this item.', 'yop_poll' ) );
1666
- wp_redirect ( add_query_arg ( 'cloned', 1, remove_query_arg ( array (
1667
- '_wpnonce',
1668
- 'id',
1669
- 'action'
1670
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1671
  exit ();
1672
  }
1673
 
1674
- if ('reset_votes' == $action) {
1675
- check_admin_referer ( 'yop-poll-reset-votes' );
1676
- $yoppoll_id = ( int ) $_REQUEST ['id'];
1677
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1678
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1679
- if (($this->current_user_can ( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'reset_polls_stats' )))
1680
- Yop_Poll_Model::reset_votes_for_poll ( $yoppoll_id );
1681
- else
1682
- wp_die ( __ ( 'You are not allowed to reset stats for this item.', 'yop_poll' ) );
1683
- wp_redirect ( add_query_arg ( 'reseted_votes', 1, remove_query_arg ( array (
1684
- '_wpnonce',
1685
- 'id',
1686
- 'action'
1687
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1688
  exit ();
1689
  }
1690
 
1691
- if ('delete_logs' == $action) {
1692
- check_admin_referer ( 'yop-poll-delete-logs' );
1693
- $yoppoll_id = ( int ) $_REQUEST ['id'];
1694
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1695
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $yoppoll_id );
1696
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' )))
1697
- Yop_Poll_Model::delete_all_poll_logs ( $yoppoll_id );
1698
- else
1699
- wp_die ( __ ( 'You are not allowed to delete logs for this item.', 'yop_poll' ) );
1700
- wp_redirect ( add_query_arg ( 'deleted_logs', 1, remove_query_arg ( array (
1701
- '_wpnonce',
1702
- 'id',
1703
- 'action'
1704
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) ) );
1705
  exit ();
1706
  }
1707
- } elseif (! empty ( $_GET ['_wp_http_referer'] )) {
1708
- wp_safe_redirect ( remove_query_arg ( array (
1709
- '_wp_http_referer',
1710
- '_wpnonce'
1711
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ) );
1712
  exit ();
1713
  }
1714
  }
@@ -1722,90 +1514,43 @@ EOT;
1722
  */
1723
  public function view_all_polls() {
1724
  global $page, $action, $orderby, $order, $current_user;
1725
- $orderby = (empty ( $orderby )) ? 'name' : $orderby;
1726
- $order_direction = array (
1727
- 'id' => 'asc',
1728
- 'name' => 'asc',
1729
- 'question' => 'asc',
1730
- 'start_date' => 'asc',
1731
- 'end_date' => 'asc',
1732
- 'total_votes' => 'asc',
1733
- 'total_answers' => 'asc'
1734
- );
1735
- $order_direction [$orderby] = ('desc' == $order) ? 'asc' : 'desc';
1736
-
1737
- $order_direction_reverse = array (
1738
- 'id' => 'desc',
1739
- 'name' => 'desc',
1740
- 'question' => 'desc',
1741
- 'start_date' => 'desc',
1742
- 'end_date' => 'desc',
1743
- 'total_votes' => 'desc',
1744
- 'total_answers' => 'desc'
1745
- );
1746
- $order_direction_reverse [$orderby] = ('desc' == $order) ? 'desc' : 'asc';
1747
-
1748
- $order_sortable = array (
1749
- 'id' => 'sortable',
1750
- 'name' => 'sortable',
1751
- 'question' => 'sortable',
1752
- 'start_date' => 'sortable',
1753
- 'end_date' => 'sortable',
1754
- 'total_votes' => 'sortable',
1755
- 'total_answers' => 'sortable'
1756
- );
1757
  $order_sortable [$orderby] = 'sorted';
1758
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
1759
- $filter = array (
1760
- 'field' => NULL,
1761
- 'value' => NULL,
1762
- 'operator' => '='
1763
- );
1764
- if (isset ( $_REQUEST ['filters'] )) {
1765
- switch ($_REQUEST ['filters']) {
1766
  case 'started' :
1767
- $filter = array (
1768
- 'field' => 'start_date',
1769
- 'value' => YOP_POLL_MODEL::get_mysql_curent_date (),
1770
- 'operator' => '<='
1771
- );
1772
  break;
1773
  case 'not_started' :
1774
- $filter = array (
1775
- 'field' => 'start_date',
1776
- 'value' => YOP_POLL_MODEL::get_mysql_curent_date (),
1777
- 'operator' => '>='
1778
- );
1779
  break;
1780
  case 'never_expire' :
1781
- $filter = array (
1782
- 'field' => 'end_date',
1783
- 'value' => '9999-12-31 23:59:59',
1784
- 'operator' => '='
1785
- );
1786
  break;
1787
  case 'expired' :
1788
- $filter = array (
1789
- 'field' => 'end_date',
1790
- 'value' => YOP_POLL_MODEL::get_mysql_curent_date (),
1791
- 'operator' => '<='
1792
- );
1793
  break;
1794
  }
1795
  }
1796
- $search = array (
1797
- 'fields' => array (
1798
- 'name',
1799
- 'question'
1800
- ),
1801
- 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : ''
1802
  );
1803
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( $orderby, $order, $filter, $search );
1804
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
1805
- $optin_box_modal_query = admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') );
1806
- $optin_box_modal_query = add_query_arg ( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
1807
  ?>
1808
- <?php if ( $optin_box_modal_options['show'] == 'yes' ) { ?>
1809
  <a id="yop-poll-show-modal-box"
1810
  href="<?php echo $optin_box_modal_query; ?>" style="display: none;"></a>
1811
  <?php } ?>
@@ -1818,48 +1563,40 @@ EOT;
1818
  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>
1819
  </h2>
1820
  <?php
1821
- if (isset ( $_REQUEST ['deleted'] )) {
1822
  echo '<div id="message" class="updated"><p>';
1823
- $deleted = ( int ) $_REQUEST ['deleted'];
1824
- printf ( _n ( '%s Poll deleted.', '%s Polls deleted.', $deleted ), $deleted );
1825
  echo '</p></div>';
1826
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
1827
- 'deleted'
1828
- ), $_SERVER ['REQUEST_URI'] );
1829
  }
1830
  ?>
1831
  <?php
1832
- if (isset ( $_REQUEST ['cloned'] )) {
1833
  echo '<div id="message" class="updated"><p>';
1834
- $cloned = ( int ) $_REQUEST ['cloned'];
1835
- printf ( _n ( '%s Poll cloned.', '%s Polls cloned.', $cloned ), $cloned );
1836
  echo '</p></div>';
1837
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
1838
- 'cloned'
1839
- ), $_SERVER ['REQUEST_URI'] );
1840
  }
1841
  ?>
1842
  <?php
1843
- if (isset ( $_REQUEST ['reseted_votes'] )) {
1844
  echo '<div id="message" class="updated"><p>';
1845
- $reseted_votes = ( int ) $_REQUEST ['reseted_votes'];
1846
- printf ( _n ( 'Vote reseted for %s Poll.', 'Votes reseted for %s Poll.', $reseted_votes ), $reseted_votes );
1847
  echo '</p></div>';
1848
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
1849
- 'reseted_votes'
1850
- ), $_SERVER ['REQUEST_URI'] );
1851
  }
1852
  ?>
1853
 
1854
  <?php
1855
- if (isset ( $_REQUEST ['deleted_logs'] )) {
1856
  echo '<div id="message" class="updated"><p>';
1857
- $deleted_logs = ( int ) $_REQUEST ['deleted_logs'];
1858
- printf ( _n ( 'Log deleted for %s Poll.', 'Log deleted for %s Polls.', $deleted_logs ), $deleted_logs );
1859
  echo '</p></div>';
1860
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
1861
- 'deleted_logs'
1862
- ), $_SERVER ['REQUEST_URI'] );
1863
  }
1864
  ?>
1865
 
@@ -1868,16 +1605,16 @@ EOT;
1868
  <form action="" method="get">
1869
  <div id="post-body-content">
1870
  <?php wp_nonce_field( 'yop-poll-view' ); ?>
1871
- <input type="hidden" name="order" value="<?php echo $order ?>" />
1872
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>" />
1873
- <input type="hidden" name="page" value="yop-polls" />
1874
  <p class="search-box">
1875
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
1876
  <input id="yop-poll-search-input" type="search"
1877
- value="<?php if( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
1878
- name="s" /> <input id="search-submit" class="button"
1879
  type="submit" value="<?php _e( 'Search Polls', 'yop_poll' ); ?>"
1880
- name="" />
1881
  </p>
1882
  <div class="tablenav top">
1883
  <div class="alignleft actions">
@@ -1887,7 +1624,8 @@ EOT;
1887
  <option value="clone"><?php _e( 'Clone', 'yop_poll' ); ?></option>
1888
  <option value="reset_votes"><?php _e( 'Reset Votes', 'yop_poll' ); ?></option>
1889
  <option value="delete_logs"><?php _e( 'Delete Logs', 'yop_poll' ); ?></option>
1890
- </select> <input type="submit"
 
1891
  value="<?php _e( 'Apply', 'yop_poll' ); ?>"
1892
  class="button-secondary action" id="doaction" name="">
1893
  </div>
@@ -1895,18 +1633,19 @@ EOT;
1895
  <select name="filters">
1896
  <option value="0"><?php _e( 'View All Polls', 'yop_poll' ); ?></option>
1897
  <option
1898
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'never_expire' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : ''?>
1899
  value="never_expire"><?php _e( 'No end date', 'yop_poll' ); ?></option>
1900
  <option
1901
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'expired' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : ''?>
1902
  value="expired"><?php _e( 'Expired', 'yop_poll' ); ?></option>
1903
  <option
1904
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : ''?>
1905
  value="started"><?php _e( 'Started', 'yop_poll' ); ?></option>
1906
  <option
1907
- <?php echo isset( $_REQUEST['filters'] ) ? ( 'not_started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : ''?>
1908
  value="not_started"><?php _e( 'Not Started', 'yop_poll' ); ?></option>
1909
- </select> <input type="submit"
 
1910
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
1911
  class="button-secondary" id="post-query-submit" name="">
1912
  </div>
@@ -1916,135 +1655,118 @@ EOT;
1916
  <thead>
1917
  <tr>
1918
  <th id="cb" class="manage-column column-cb check-column"
1919
- style="width: 2%;" scope="col"><input type="checkbox"></th>
1920
- <th id="id"
1921
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
1922
- style="width: 5%" scope="col"><a
1923
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
1924
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
1925
- class="sorting-indicator"></span>
1926
- </a></th>
1927
  <th id="name"
1928
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
1929
  style="width: 30%" scope="col"><a
1930
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
1931
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
1932
  class="sorting-indicator"></span>
1933
  </a></th>
1934
  <th id="total_votes"
1935
- class="manage-column <?php echo $order_sortable[ 'total_votes' ] ?> <?php echo $order_direction_reverse[ 'total_votes' ] ?>"
1936
  style="width: 6%" scope="col"><a
1937
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction[ 'total_votes' ] ) ) ); ?>">
1938
  <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
1939
  class="sorting-indicator"></span>
1940
  </a></th>
1941
  <th id="total_answers"
1942
- class="manage-column <?php echo $order_sortable[ 'total_answers' ] ?> <?php echo $order_direction_reverse[ 'total_answers' ] ?>"
1943
  style="width: 7%" scope="col"><a
1944
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction[ 'total_answers' ] ) ) ); ?>">
1945
  <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
1946
  class="sorting-indicator"></span>
1947
  </a></th>
1948
  <th id="question"
1949
- class="manage-column <?php echo $order_sortable[ 'question' ] ?> <?php echo $order_direction_reverse[ 'question' ] ?>"
1950
  style="width: 24%" scope="col"><a
1951
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction[ 'question' ] ) ) ); ?>">
1952
  <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
1953
  class="sorting-indicator"></span>
1954
  </a></th>
1955
- <th id="poll_author" class="manage-column" style="width: 5%"
1956
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
1957
  <th id="start-date"
1958
- class="manage-column <?php echo $order_sortable[ 'start_date' ] ?> <?php echo $order_direction_reverse[ 'start_date' ] ?>"
1959
  style="width: 10%" scope="col"><a
1960
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction[ 'start_date' ] ) ) ); ?>">
1961
  <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
1962
  class="sorting-indicator"></span>
1963
  </a></th>
1964
  <th id="end-date"
1965
- class="manage-column <?php echo $order_sortable[ 'end_date' ] ?> <?php echo $order_direction_reverse[ 'end_date' ] ?>"
1966
  style="width: 10%" scope="col"><a
1967
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction[ 'end_date' ] ) ) ); ?>">
1968
  <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
1969
  class="sorting-indicator"></span>
1970
  </a></th>
1971
  </tr>
1972
  </thead>
1973
  <?php
1974
- if (count ( $yop_polls ) > 0) {
1975
  foreach ( $yop_polls as $yop_poll ) {
1976
  ?>
1977
  <tbody id="the-list">
1978
  <tr valign="middle" class="alternate"
1979
  id="yop-poll-<?php echo $yop_poll['id']; ?>">
1980
  <th class="check-column" scope="row">
1981
- <?php if ( ( $this->current_user_can( 'delete_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'delete_polls' ) ) ) { ?>
1982
  <input type="checkbox"
1983
  value="<?php echo $yop_poll['id']; ?>" name="yoppollcheck[]">
1984
  <?php } ?>
1985
  </th>
1986
  <td><strong>
1987
- <?php if ( ( $this->current_user_can( 'edit_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls' ) ) ) { ?>
1988
- <a title="<?php echo $yop_poll['id']; ?>"
1989
- href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"
1990
- class="row-title">
1991
- <?php }?>
1992
- <?php echo $yop_poll['id']; ?>
1993
- <?php if ( ( $this->current_user_can( 'edit_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls' ) ) ) { ?>
1994
- </a>
1995
- <?php } ?></strong><br></td>
1996
- <td><strong>
1997
- <?php if ( ( $this->current_user_can( 'edit_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls' ) ) ) { ?>
1998
  <a
1999
  title="<?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>"
2000
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"
2001
  class="row-title">
2002
  <?php } ?>
2003
  <?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>
2004
- <?php if ( ( $this->current_user_can( 'edit_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls' ) ) ) { ?>
2005
  </a>
2006
  <?php } ?>
2007
  </strong><br>
2008
  <div class="row-actions">
2009
- <?php if ( ( $this->current_user_can( 'edit_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls' ) ) ) { ?>
2010
  <span class="edit"><a
2011
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
2012
  | </span>
2013
  <?php } ?>
2014
- <?php if ( ( $this->current_user_can( 'view_own_polls_logs') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'view_polls_logs' ) ) ) { ?>
2015
  <span class="edit"><a
2016
  href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-logs', 'poll_id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Logs', 'yop_poll' ) ?></a>
2017
  | </span>
2018
  <?php } ?>
2019
- <?php if ( ( $this->current_user_can( 'delete_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'delete_polls' ) ) ) { ?>
2020
  <span class="delete"><a
2021
- 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;"
2022
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete' ); ?>"
2023
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a>
2024
  | </span>
2025
  <?php } ?>
2026
- <?php if ( ( $this->current_user_can( 'clone_own_polls') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'clone_polls' ) ) ) { ?>
2027
  <span class="clone"><a
2028
- 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;"
2029
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $yop_poll['id'] ) ), 'yop-poll-clone' ); ?>"
2030
  class="submitclone"><?php _e( 'Clone', 'yop_poll' ) ?></a> |
2031
  </span>
2032
  <?php } ?>
2033
- <?php if ( ( $this->current_user_can( 'view_own_polls_results') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'view_polls_results' ) ) ) { ?>
2034
  <span class="results"><a
2035
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'results', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Results', 'yop_poll' ) ?></a>
2036
  | </span>
2037
  <?php } ?>
2038
- <?php if ( ( $this->current_user_can( 'reset_own_polls_stats') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'reset_polls_stats' ) ) ) { ?>
2039
  <span class="delete"><a
2040
- 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;"
2041
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'reset_votes', 'id' => $yop_poll['id'] ) ), 'yop-poll-reset-votes' ); ?>"
2042
  class="submitresetvotes"><?php _e( 'Reset Stats', 'yop_poll' ) ?></a>
2043
  | </span>
2044
  <?php } ?>
2045
- <?php if ( ( $this->current_user_can( 'delete_own_polls_logs') && $yop_poll['poll_author'] == $current_user->ID ) || ($this->current_user_can( 'delete_polls_logs' ) ) ) { ?>
2046
  <span class="delete"><a
2047
- 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;"
2048
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_logs', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete-logs' ); ?>"
2049
  class="submitresetvotes"><?php _e( 'Delete Logs', 'yop_poll' ) ?></a></span>
2050
  <?php } ?>
@@ -2060,11 +1782,13 @@ EOT;
2060
  </td>
2061
  <td>
2062
  <?php
2063
- $user_info = get_userdata ( $yop_poll ['poll_author'] );
2064
- if ($user_info)
2065
- echo esc_html ( stripslashes ( $user_info->user_login ) );
2066
- else
 
2067
  echo '';
 
2068
  ?>
2069
  </td>
2070
  <td>
@@ -2072,21 +1796,24 @@ EOT;
2072
  </td>
2073
  <td>
2074
  <?php
2075
- if (YOP_POLL_MODEL::get_mysql_curent_date () > $yop_poll ['end_date'])
2076
  echo '<font style="color:#CC0000;"><b>';
2077
- echo ('9999-12-31 23:59:59' == $yop_poll ['end_date']) ? __ ( 'No end date', 'yop_poll' ) : esc_html ( stripslashes ( $yop_poll ['end_date'] ) );
2078
- if (YOP_POLL_MODEL::get_mysql_curent_date () > $yop_poll ['end_date'])
2079
- echo '</b></font>'?>
 
 
2080
  </td>
2081
  </tr>
2082
  </tbody>
2083
  <?php
2084
  }
2085
- } else {
 
2086
  ?>
2087
  <tbody id="the-list">
2088
  <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
2089
- <th colspan="9">
2090
  <?php _e( 'No poll found!', 'yop_poll' ); ?>
2091
  </th>
2092
  </tr>
@@ -2099,54 +1826,47 @@ EOT;
2099
  <tr>
2100
  <th id="cb" class="manage-column column-cb check-column"
2101
  style="" scope="col"><input type="checkbox"></th>
2102
- <th id="id"
2103
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
2104
- style="" scope="col"><a
2105
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
2106
- <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2107
- class="sorting-indicator"></span>
2108
- </a></th>
2109
  <th id="name"
2110
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
2111
  style="" scope="col"><a
2112
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
2113
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2114
  class="sorting-indicator"></span>
2115
  </a></th>
2116
  <th id="total_votes"
2117
- class="manage-column <?php echo $order_sortable[ 'total_votes' ] ?> <?php echo $order_direction_reverse[ 'total_votes' ] ?>"
2118
  style="" scope="col"><a
2119
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction[ 'total_votes' ] ) ) ); ?>">
2120
  <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
2121
  class="sorting-indicator"></span>
2122
  </a></th>
2123
  <th id="total_answers"
2124
- class="manage-column <?php echo $order_sortable[ 'total_answers' ] ?> <?php echo $order_direction_reverse[ 'total_answers' ] ?>"
2125
  style="" scope="col"><a
2126
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction[ 'total_answers' ] ) ) ); ?>">
2127
  <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
2128
  class="sorting-indicator"></span>
2129
  </a></th>
2130
  <th id="question"
2131
- class="manage-column <?php echo $order_sortable[ 'question' ] ?> <?php echo $order_direction_reverse[ 'question' ] ?>"
2132
  style="" scope="col"><a
2133
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction[ 'question' ] ) ) ); ?>">
2134
  <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
2135
  class="sorting-indicator"></span>
2136
  </a></th>
2137
  <th id="poll_author" class="manage-column" style="width: 5%"
2138
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2139
  <th id="start-date"
2140
- class="manage-column <?php echo $order_sortable[ 'start_date' ] ?> <?php echo $order_direction_reverse[ 'start_date' ] ?>"
2141
  style="" scope="col"><a
2142
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction[ 'start_date' ] ) ) ); ?>">
2143
  <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
2144
  class="sorting-indicator"></span>
2145
  </a></th>
2146
  <th id="end-date"
2147
- class="manage-column <?php echo $order_sortable[ 'end_date' ] ?> <?php echo $order_direction_reverse[ 'end_date' ] ?>"
2148
  style="" scope="col"><a
2149
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction[ 'end_date' ] ) ) ); ?>">
2150
  <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
2151
  class="sorting-indicator"></span>
2152
  </a></th>
@@ -2162,74 +1882,59 @@ EOT;
2162
  </div>
2163
  <?php
2164
  }
 
2165
  public function view_poll_results() {
2166
  global $page, $action, $current_user;
2167
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
2168
- $results_order_by = (isset ( $_GET ['results_order_by'] ) ? $_GET ['results_order_by'] : 'id');
2169
- $results_order = (isset ( $_GET ['results_order'] ) ? $_GET ['results_order'] : 'ASC');
2170
- $soav = (isset ( $_GET ['soav'] ) ? $_GET ['soav'] : 'no');
2171
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
2172
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
2173
- if ((! $this->current_user_can ( 'view_own_polls_results' ) || $poll_author != $current_user->ID) && (! $this->current_user_can ( 'view_polls_results' )))
2174
- wp_die ( __ ( 'You are not allowed to view results for this item.', 'yop_poll' ) );
2175
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id ( $poll_id );
2176
- if ( 'yes' == $soav )
2177
- $display_other_answers_values = true;
2178
- else
2179
- $display_other_answers_values = false;
2180
- $poll_answers = YOP_POLL_MODEL::get_poll_answers ( $poll_id, array (
2181
- 'default',
2182
- 'other'
2183
- ), $results_order_by, $results_order, $display_other_answers_values );
2184
- $poll_other_answer = YOP_POLL_MODEL::get_poll_answers ( $poll_id, array (
2185
- 'other'
2186
- ) );
2187
 
2188
  // other-answers
2189
- $oa_per_page = (isset ( $_GET ['oa_per_page'] ) ? intval ( $_GET ['oa_per_page'] ) : 100);
2190
- $oa_page_no = (isset ( $_REQUEST ['oa_page_no'] ) ? ( int ) $_REQUEST ['oa_page_no'] : 1);
2191
- $total_logs_other_answers = count ( YOP_POLL_MODEL::get_other_answers_votes ( isset ( $poll_other_answer [0] ['id'] ) ? $poll_other_answer [0] ['id'] : 0 ) );
2192
- $total_logs_other_answers_pages = ceil ( $total_logs_other_answers / $oa_per_page );
2193
- if (intval ( $oa_page_no ) > intval ( $total_logs_other_answers_pages ))
2194
  $oa_page_no = 1;
2195
- $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 );
2196
-
2197
- $oa_args = array (
2198
- 'base' => remove_query_arg ( 'oa_page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
2199
- 'format' => '&oa_page_no=%#%',
2200
- 'total' => $total_logs_other_answers_pages,
2201
- 'current' => max ( 1, $oa_page_no ),
2202
- 'prev_next' => True,
2203
- 'prev_text' => __ ( '&laquo; Previous' ),
2204
- 'next_text' => __ ( 'Next &raquo;' )
2205
- );
2206
- $oa_pagination = paginate_links ( $oa_args );
2207
  // other-answers
2208
 
2209
  // custom-fields
2210
- $cf_per_page = (isset ( $_GET ['cf_per_page'] ) ? intval ( $_GET ['cf_per_page'] ) : 100);
2211
- $cf_page_no = (isset ( $_REQUEST ['cf_page_no'] ) ? ( int ) $_REQUEST ['cf_page_no'] : 1);
2212
- $cf_sdate = (isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '');
2213
- $cf_edate = (isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '');
2214
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields ( $poll_id );
2215
- $custom_fields_number = count ( $poll_custom_fields );
2216
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs ( $poll_id, $cf_sdate, $cf_edate );
2217
- $total_custom_fields_logs_pages = ceil ( $total_custom_fields_logs / $cf_per_page );
2218
- if (intval ( $cf_page_no ) > intval ( $total_custom_fields_logs_pages ))
2219
  $cf_page_no = 1;
2220
- $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 );
2221
-
2222
- $column_custom_fields_ids = array ();
2223
- $cf_args = array (
2224
- 'base' => remove_query_arg ( 'cf_page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
2225
- 'format' => '&cf_page_no=%#%',
2226
- 'total' => $total_custom_fields_logs_pages,
2227
- 'current' => max ( 1, $cf_page_no ),
2228
- 'prev_next' => True,
2229
- 'prev_text' => __ ( '&laquo; Previous' ),
2230
- 'next_text' => __ ( 'Next &raquo;' )
2231
- );
2232
- $cf_pagination = paginate_links ( $cf_args );
2233
  // custom-fields
2234
  ?>
2235
  <div class="wrap">
@@ -2238,42 +1943,42 @@ EOT;
2238
 
2239
  </div>
2240
  <h2><?php _e( 'Yop Poll Results', 'yop_poll' ); ?><a class="add-new-h2"
2241
- 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>
2242
  </h2>
2243
  <?php
2244
- if ($poll_details) {
2245
  ?>
2246
- <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) )?></h3>
2247
- <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) )?></h4>
2248
  <form method="get">
2249
- <input type="hidden" name="page" value="yop-polls" />
2250
- <input type="hidden" name="action" value="results" />
2251
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>" />
2252
  <input type="hidden" name="oa_page_no"
2253
- value="<?php echo $oa_page_no; ?>" />
2254
  <input type="hidden" name="cf_page_no"
2255
- value="<?php echo $cf_page_no; ?>" />
2256
  <input type="hidden" name="oa_per_page"
2257
- value="<?php echo $oa_per_page; ?>" />
2258
 
2259
  <div class="tablenav top">
2260
  <div class="alignleft actions">
2261
  <div style="display:inline; float:left; margin:7px;"><?php _e( 'Order By', 'yop_poll' ); ?></div>
2262
  <select name="results_order_by">
2263
- <option <?php selected( $results_order_by, 'id') ?> value="id"><?php _e( 'Answer ID', 'yop_poll' ); ?></option>
2264
- <option <?php selected( $results_order_by, 'answer') ?> value="answer"><?php _e( 'Answer Value', 'yop_poll' ); ?></option>
2265
- <option <?php selected( $results_order_by, 'votes') ?> value="votes"><?php _e( 'Votes', 'yop_poll' ); ?></option>
2266
  </select>
2267
  <select name="results_order">
2268
- <option <?php selected( $results_order, 'ASC') ?> value="ASC"><?php _e( 'ASC', 'yop_poll' ); ?></option>
2269
- <option <?php selected( $results_order, 'DESC') ?> value="DESC"><?php _e( 'DESC', 'yop_poll' ); ?></option>
2270
- </select>
2271
  &nbsp;| &nbsp;
2272
- <input type="checkbox" value="yes" <?php checked( $soav, 'yes' ); ?> name="soav" id="yop-poll-show_other_answers_values" />
2273
  <label for="yop-poll-show_other_answers_values"><?php _e( 'Show Other Answers Values', 'yop_poll' ); ?></label>
2274
  <input type="submit"
2275
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2276
- class="button-secondary action" id="doaction" name="a">
2277
  </div>
2278
  <br class="clear">
2279
  </div>
@@ -2289,7 +1994,7 @@ EOT;
2289
  </thead>
2290
  <tbody>
2291
  <?php
2292
- if (count ( $poll_answers ) > 0) {
2293
  foreach ( $poll_answers as $answer ) {
2294
  ?>
2295
  <tr>
@@ -2301,7 +2006,8 @@ EOT;
2301
  </tr>
2302
  <?php
2303
  }
2304
- } else {
 
2305
  ?>
2306
  <tr>
2307
  <th colspan="4"><?php _e( 'No answers defined!', 'yop_poll' ); ?></th>
@@ -2315,25 +2021,27 @@ EOT;
2315
  <div style="width: 30%; float: left;">
2316
  <h3><?php _e( 'Poll Other Answers', 'yop_poll' ); ?></h3>
2317
  <form method="get">
2318
- <input type="hidden" name="page" value="yop-polls" />
2319
- <input type="hidden" name="action" value="results" />
2320
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>" />
2321
  <input type="hidden" name="cf_page_no"
2322
- value="<?php echo $cf_page_no; ?>" />
2323
  <input type="hidden" name="oa_page_no"
2324
- value="<?php echo $oa_page_no; ?>" />
2325
  <input type="hidden" name="cf_per_page"
2326
- value="<?php echo $cf_per_page; ?>" />
2327
- <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>" />
2328
- <input type="hidden" name="results_order" value="<?php echo $results_order; ?>" />
2329
- <input type="hidden" name="soav" value="<?php echo $soav; ?>" />
2330
  <div class="tablenav top">
2331
  <div class="tablenav-pages one-page">
2332
- <label for="yop-poll-oa-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>:</label><input
 
2333
  id="yop-poll-oa-items-per-page" type="text" name="oa_per_page"
2334
- value="<?php echo $oa_per_page; ?>" /> <input name="a"
2335
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit" />&nbsp;&nbsp;<span
2336
- class="displaying-num"><?php echo count( $logs_other_answers ); ?> / <?php echo $total_logs_other_answers; ?> items</span>
 
2337
  <?php print $oa_pagination; ?>
2338
  </div>
2339
  <br class="clear">
@@ -2347,7 +2055,7 @@ EOT;
2347
  </thead>
2348
  <tbody>
2349
  <?php
2350
- if (count ( $logs_other_answers ) > 0) {
2351
  foreach ( $logs_other_answers as $answer ) {
2352
  ?>
2353
  <tr>
@@ -2356,7 +2064,8 @@ EOT;
2356
  </tr>
2357
  <?php
2358
  }
2359
- } else {
 
2360
  ?>
2361
  <tr>
2362
  <td colspan="2"><?php _e( 'No other answers defined!', 'yop_poll' ); ?></td>
@@ -2378,18 +2087,18 @@ EOT;
2378
  <h3><?php _e( 'Custom Fields', 'yop_poll' ); ?></h3>
2379
  <form method="get">
2380
  <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2381
- <input type="hidden" name="page" value="yop-polls" />
2382
- <input type="hidden" name="action" value="results" />
2383
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>" />
2384
  <input type="hidden" name="oa_page_no"
2385
- value="<?php echo $oa_page_no; ?>" />
2386
  <input type="hidden" name="cf_page_no"
2387
- value="<?php echo $cf_page_no; ?>" />
2388
  <input type="hidden" name="oa_per_page"
2389
- value="<?php echo $oa_per_page; ?>" />
2390
- <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>" />
2391
- <input type="hidden" name="results_order" value="<?php echo $results_order; ?>" />
2392
- <input type="hidden" name="soav" value="<?php echo $soav; ?>" />
2393
 
2394
  <div class="tablenav top">
2395
  <div class="alignleft actions">
@@ -2400,21 +2109,25 @@ EOT;
2400
  value="<?php _e( 'Export', 'yop_poll' ); ?>"
2401
  class="button-secondary action" id="doaction" name="a">
2402
  &nbsp;&nbsp;&nbsp; <label
2403
- for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>:</label>
 
2404
  <input id="yop-poll-custom-field-start-date-input" type="text"
2405
- name="cf_sdate" value="<?php echo $cf_sdate; ?>" />&nbsp;&nbsp; <label
2406
- for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>:</label>
 
2407
  <input id="yop-poll-custom-field-end-date-input" type="text"
2408
- name="cf_edate" value="<?php echo $cf_edate; ?>" />&nbsp;&nbsp; <input
2409
  value="<?php _e( 'Filter', 'yop_poll' ); ?>" type="submit"
2410
- name="a" />
2411
  </div>
2412
  <div class="tablenav-pages one-page">
2413
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>:</label><input
 
2414
  id="yop-poll-items-per-page" type="text" name="cf_per_page"
2415
- value="<?php echo $cf_per_page; ?>" /> <input name="a"
2416
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit" />&nbsp;&nbsp;<span
2417
- class="displaying-num"><?php echo count( $custom_fields_logs ); ?> / <?php echo $total_custom_fields_logs; ?> items</span>
 
2418
  <?php print $cf_pagination; ?>
2419
  </div>
2420
  <br class="clear">
@@ -2427,7 +2140,7 @@ EOT;
2427
  foreach ( $poll_custom_fields as $custom_field ) {
2428
  $column_custom_fields_ids [] = $custom_field ['id'];
2429
  ?>
2430
- <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>
2431
  <?php
2432
  }
2433
  ?>
@@ -2441,24 +2154,24 @@ EOT;
2441
  </thead>
2442
  <tbody>
2443
  <?php
2444
- if (count ( $custom_fields_logs ) > 0) {
2445
- $index = ($cf_page_no - 1) * $cf_per_page + 1;
2446
  foreach ( $custom_fields_logs as $logs ) {
2447
  ?>
2448
  <tr>
2449
  <td><?php echo $index; ?></td>
2450
  <?php
2451
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
2452
- $vote_log_values = array ();
2453
- $vote_logs = explode ( '<#!,>', $logs ['vote_log'] );
2454
- if (count ( $vote_logs ) > 0) {
2455
  foreach ( $vote_logs as $vote_log ) {
2456
- $temp = explode ( '<#!->', $vote_log );
2457
- $vote_log_values [$temp [1]] = stripslashes ( $temp [0] );
2458
  }
2459
  }
2460
  ?>
2461
- <td><?php echo isset( $vote_log_values[ $custom_field_id ] ) ? $vote_log_values[ $custom_field_id ] : ''; ?></td>
2462
  <?php
2463
  }
2464
  ?>
@@ -2467,7 +2180,7 @@ EOT;
2467
  <td><?php echo $logs['vote_date']; ?></td>
2468
  </tr>
2469
  <?php
2470
- $index ++;
2471
  }
2472
  }
2473
  ?>
@@ -2484,43 +2197,36 @@ EOT;
2484
  <div style="clear: both;"></div>
2485
  </div>
2486
  <?php
2487
- } else {
 
2488
  ?>
2489
- <h3><?php _e( 'Your poll doesn`t exist!', 'yop_poll' );?></h3>
2490
  <?php
2491
  }
2492
  }
 
2493
  public function view_poll_custom_fields() {
2494
  global $page, $action;
2495
- $per_page = (isset ( $_GET ['per_page'] ) ? intval ( $_GET ['per_page'] ) : 100);
2496
- $page_no = (isset ( $_REQUEST ['page_no'] ) ? ( int ) $_REQUEST ['page_no'] : 1);
2497
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
2498
- $sdate = (isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '');
2499
- $edate = (isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '');
2500
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
2501
- $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id ( $poll_id );
2502
- $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields ( $poll_id );
2503
- $custom_fields_number = count ( $poll_custom_fields );
2504
- $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs ( $poll_id, $sdate, $edate );
2505
- $total_custom_fields_logs_pages = ceil ( $total_custom_fields_logs / $per_page );
2506
- if (intval ( $page_no ) > intval ( $total_custom_fields_logs_pages ))
2507
  $page_no = 1;
2508
- $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs ( $poll_id, 'vote_id', 'asc', ($page_no - 1) * $per_page, $per_page, $sdate, $edate );
2509
-
2510
- $column_custom_fields_ids = array ();
2511
- $args = array (
2512
- 'base' => remove_query_arg ( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
2513
- 'format' => '&page_no=%#%',
2514
- 'total' => $total_custom_fields_logs_pages,
2515
- 'current' => max ( 1, $page_no ),
2516
- 'prev_next' => True,
2517
- 'prev_text' => __ ( '&laquo; Previous' ),
2518
- 'next_text' => __ ( 'Next &raquo;' )
2519
- );
2520
- $pagination = paginate_links ( $args );
2521
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
2522
- 'action'
2523
- ), $_SERVER ['REQUEST_URI'] );
2524
  ?>
2525
  <div class="wrap">
2526
  <div class="icon32 icon32-yop-poll">
@@ -2528,37 +2234,39 @@ EOT;
2528
 
2529
  </div>
2530
  <h2><?php _e( 'Custom Fields', 'yop_poll' ); ?><a class="add-new-h2"
2531
- 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>
2532
  </h2>
2533
  <?php
2534
- if ($poll_details) {
2535
- if ($poll_custom_fields) {
2536
  ?>
2537
- <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) )?></h3>
2538
- <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) )?></h4>
2539
  <form method="get">
2540
  <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2541
- <input type="hidden" name="page" value="yop-polls" />
2542
- <input type="hidden" name="action" value="custom-fields" />
2543
- <input type="hidden" name="id" value="<?php echo $poll_id; ?>" />
2544
- <input type="hidden" name="page_no" value="<?php echo $page_no; ?>" />
2545
  <table cellspacing="5" align=" center">
2546
  <tbody>
2547
  <tr>
2548
- <th><label for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>:</label>
 
2549
  </th>
2550
  <td><input id="yop-poll-custom-field-start-date-input" type="text"
2551
- name="sdate" value="<?php echo $sdate; ?>" /></td>
2552
  </tr>
2553
  <tr>
2554
- <th><label for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>:</label>
 
2555
  </th>
2556
  <td><input id="yop-poll-custom-field-end-date-input" type="text"
2557
- name="edate" value="<?php echo $edate; ?>" /></td>
2558
  </tr>
2559
  <tr>
2560
  <th colspan="2"><input value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2561
- type="submit" name="a" /></th>
2562
  </tr>
2563
  </tbody>
2564
  </table>
@@ -2573,11 +2281,13 @@ EOT;
2573
  class="button-secondary action" id="doaction" name="a">
2574
  </div>
2575
  <div class="tablenav-pages one-page">
2576
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>:</label><input
 
2577
  id="yop-poll-items-per-page" type="text" name="per_page"
2578
- value="<?php echo $per_page; ?>" /> <input name="a"
2579
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit" />&nbsp;&nbsp;<span
2580
- class="displaying-num"><?php echo count( $custom_fields_logs ); ?> / <?php echo $total_custom_fields_logs; ?> items</span>
 
2581
  <?php print $pagination; ?>
2582
  </div>
2583
  <br class="clear">
@@ -2590,7 +2300,7 @@ EOT;
2590
  foreach ( $poll_custom_fields as $custom_field ) {
2591
  $column_custom_fields_ids [] = $custom_field ['id'];
2592
  ?>
2593
- <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>
2594
  <?php
2595
  }
2596
  ?>
@@ -2600,31 +2310,31 @@ EOT;
2600
  </thead>
2601
  <tbody>
2602
  <?php
2603
- if (count ( $custom_fields_logs ) > 0) {
2604
- $index = ($page_no - 1) * $per_page + 1;
2605
  foreach ( $custom_fields_logs as $logs ) {
2606
  ?>
2607
  <tr>
2608
  <td><?php echo $index; ?></td>
2609
  <?php
2610
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
2611
- $vote_log_values = array ();
2612
- $vote_logs = explode ( '<#!,>', $logs ['vote_log'] );
2613
- if (count ( $vote_logs ) > 0) {
2614
  foreach ( $vote_logs as $vote_log ) {
2615
- $temp = explode ( '<#!->', $vote_log );
2616
- $vote_log_values [$temp [1]] = stripslashes ( $temp [0] );
2617
  }
2618
  }
2619
  ?>
2620
- <td><?php echo isset( $vote_log_values[ $custom_field_id ] ) ? $vote_log_values[ $custom_field_id ] : ''; ?></td>
2621
  <?php
2622
  }
2623
  ?>
2624
  <td><?php echo $logs['vote_date']; ?></td>
2625
  </tr>
2626
  <?php
2627
- $index ++;
2628
  }
2629
  }
2630
  ?>
@@ -2639,50 +2349,35 @@ EOT;
2639
  </form>
2640
  </div>
2641
  <?php
2642
- } else {
 
2643
  ?>
2644
- <h3><?php _e( 'This poll doesn\'t have set custom fields!', 'yop_poll' );?></h3>
2645
  <?php
2646
  }
2647
- } else {
 
2648
  ?>
2649
- <h3><?php _e( 'Your Poll doesn`t exist!', 'yop_poll' );?></h3>
2650
  <?php
2651
  }
2652
  }
 
2653
  public function view_yop_poll_templates() {
2654
  global $page, $action, $orderby, $order, $current_user;
2655
- $orderby = (empty ( $orderby )) ? 'last_modified' : $orderby;
2656
- $order = (empty ( $order )) ? 'desc' : $order;
2657
- $order_direction = array (
2658
- 'id' => 'asc',
2659
- 'name' => 'asc',
2660
- 'last_modified' => 'desc'
2661
- );
2662
- $order_direction [$orderby] = ('desc' == $order) ? 'asc' : 'desc';
2663
 
2664
- $order_direction_reverse = array (
2665
- 'id' => 'desc',
2666
- 'name' => 'desc',
2667
- 'last_modified' => 'desc'
2668
- );
2669
- $order_direction_reverse [$orderby] = ('desc' == $order) ? 'desc' : 'asc';
2670
 
2671
- $order_sortable = array (
2672
- 'id' => 'sortable',
2673
- 'name' => 'sortable',
2674
- 'last_modified' => 'sortable'
2675
- );
2676
  $order_sortable [$orderby] = 'sorted';
2677
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
2678
- $search = array (
2679
- 'fields' => array (
2680
- 'name',
2681
- 'last_modified'
2682
- ),
2683
- 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : ''
2684
- );
2685
- $yop_poll_templates = Yop_Poll_Model::get_yop_poll_templates_search ( $orderby, $order, $search );
2686
  ?>
2687
  <div class="wrap">
2688
  <div class="icon32 icon32-yop-poll">
@@ -2694,38 +2389,34 @@ EOT;
2694
  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>
2695
  </h2>
2696
  <?php
2697
- if (isset ( $_REQUEST ['deleted'] )) {
2698
  echo '<div id="message" class="updated"><p>';
2699
- $deleted = ( int ) $_REQUEST ['deleted'];
2700
- printf ( _n ( '%s Poll template deleted.', '%s Poll templates deleted.', $deleted ), $deleted );
2701
  echo '</p></div>';
2702
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
2703
- 'deleted'
2704
- ), $_SERVER ['REQUEST_URI'] );
2705
  }
2706
  ?>
2707
  <?php
2708
- if (isset ( $_REQUEST ['cloned'] )) {
2709
  echo '<div id="message" class="updated"><p>';
2710
- $cloned = ( int ) $_REQUEST ['cloned'];
2711
- printf ( _n ( '%s Poll template cloned.', '%s Poll templates cloned.', $cloned ), $cloned );
2712
  echo '</p></div>';
2713
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
2714
- 'cloned'
2715
- ), $_SERVER ['REQUEST_URI'] );
2716
  }
2717
  ?>
2718
  <form action="" method="get">
2719
  <?php wp_nonce_field( 'yop-poll-templates' ); ?>
2720
- <input type="hidden" name="order" value="<?php echo $order ?>" />
2721
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>" />
2722
- <input type="hidden" name="page" value="yop-polls-templates" />
2723
  <p class="search-box">
2724
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
2725
  <input id="yop-poll-search-input" type="search"
2726
- value="<?php if( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
2727
- name="s" /> <input id="search-submit" class="button" type="submit"
2728
- value="<?php _e( 'Search Polls', 'yop_poll' ); ?>" name="" />
2729
  </p>
2730
  <div class="tablenav top">
2731
  <div class="alignleft actions">
@@ -2745,92 +2436,94 @@ EOT;
2745
  <th id="cb" class="manage-column column-cb check-column"
2746
  scope="col" style="width: 2%;"><input type="checkbox"></th>
2747
  <th id="id"
2748
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
2749
  style="width: 10%;" scope="col"><a
2750
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
2751
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2752
  class="sorting-indicator"></span>
2753
  </a></th>
2754
  <th id="name"
2755
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
2756
  style="width: 38%;" scope="col"><a
2757
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
2758
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2759
  class="sorting-indicator"></span>
2760
  </a></th>
2761
  <th id="template_author" class="manage-column" style="width: 10%;"
2762
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2763
  <th id="last_modified"
2764
- class="manage-column <?php echo $order_sortable[ 'last_modified' ] ?> <?php echo $order_direction_reverse[ 'last_modified' ] ?>"
2765
  style="width: 40%;" scope="col"><a
2766
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction[ 'last_modified' ] ) ) ); ?>">
2767
  <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2768
  class="sorting-indicator"></span>
2769
  </a></th>
2770
  </tr>
2771
  </thead>
2772
  <?php
2773
- if (count ( $yop_poll_templates ) > 0) {
2774
  foreach ( $yop_poll_templates as $template ) {
2775
  ?>
2776
  <tbody id="the-list">
2777
  <tr valign="middle" class="alternate"
2778
  id="yop-poll-<?php echo $template['id']; ?>">
2779
  <th class="check-column" scope="row">
2780
- <?php if ( ( $this->current_user_can( 'delete_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'delete_polls_templates' ) ) ) { ?>
2781
  <input type="checkbox" value="<?php echo $template['id']; ?>"
2782
  name="templatecheck[]">
2783
  <?php } ?>
2784
  </th>
2785
  <td><strong>
2786
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls_templates' ) ) ) { ?>
2787
  <a title="<?php echo $template['id']; ?>"
2788
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2789
  class="row-title">
2790
  <?php } ?>
2791
  <?php echo $template['id']; ?>
2792
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls_templates' ) ) ) { ?>
2793
  </a>
2794
  <?php } ?>
2795
  </strong><br>
2796
  <div class="row-actions">
2797
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls_templates' ) ) ) { ?>
2798
  <span class="edit"><a
2799
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
2800
  | </span>
2801
  <?php } ?>
2802
- <?php if ( ( $this->current_user_can( 'delete_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'delete_polls_templates' ) ) ) { ?>
2803
  <span class="delete"><a
2804
- 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;"
2805
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2806
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a> | </span>
2807
  <?php } ?>
2808
- <?php if ( ( $this->current_user_can( 'clone_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'clone_polls_templates' ) ) ) { ?>
2809
  <span class="clone"><a
2810
- 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;"
2811
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2812
  class="submitdelete"><?php _e( 'Clone', 'yop_poll' ) ?></a></span>
2813
  <?php } ?>
2814
  </div></td>
2815
  <td><strong>
2816
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls_templates' ) ) ) { ?>
2817
  <a
2818
  title="<?php echo esc_html( stripslashes( $template['name'] ) ); ?>"
2819
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2820
  class="row-title">
2821
  <?php } ?>
2822
  <?php echo esc_html( stripslashes( $template['name'] ) ); ?>
2823
- <?php if ( ( $this->current_user_can( 'edit_own_polls_templates') && $template['template_author'] == $current_user->ID ) || ($this->current_user_can( 'edit_polls_templates' ) ) ) { ?>
2824
  </a>
2825
  <?php } ?>
2826
  </strong><br></td>
2827
  <td>
2828
  <?php
2829
- $user_info = get_userdata ( $template ['template_author'] );
2830
- if ($user_info)
2831
- echo esc_html ( stripslashes ( $user_info->user_login ) );
2832
- else
 
2833
  echo '';
 
2834
  ?>
2835
  </td>
2836
  <td>
@@ -2840,16 +2533,17 @@ EOT;
2840
  </tbody>
2841
  <?php
2842
  }
2843
- } else {
 
2844
  ?>
2845
  <tbody id="the-list">
2846
  <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
2847
  <td id="empty-set" colspan="5">
2848
- <h3 style="margin-bottom: 0px;"><?php _e(" You haven't used our template editor to create any yop poll templates!", 'yop_poll' ); ?> </h3>
2849
  <p style="margin-bottom: 20px;"><?php _e( "Please create your poll template first.", 'yop_poll' ); ?></p>
2850
  <a class="button-primary"
2851
  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>
2852
- <br /> <br />
2853
  </td>
2854
  </tr>
2855
  </tbody>
@@ -2862,25 +2556,25 @@ EOT;
2862
  <th id="cb" class="manage-column column-cb check-column" style=""
2863
  scope="col"><input type="checkbox"></th>
2864
  <th id="id"
2865
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
2866
  style="" scope="col"><a
2867
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
2868
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2869
  class="sorting-indicator"></span>
2870
  </a></th>
2871
  <th id="name"
2872
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
2873
  style="" scope="col"><a
2874
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
2875
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2876
  class="sorting-indicator"></span>
2877
  </a></th>
2878
  <th id="template_author" class="manage-column" style="width: 10%;"
2879
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2880
  <th id="question"
2881
- class="manage-column <?php echo $order_sortable[ 'last_modified' ] ?> <?php echo $order_direction_reverse[ 'last_modified' ] ?>"
2882
  style="" scope="col"><a
2883
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction[ 'last_modified' ] ) ) ); ?>">
2884
  <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2885
  class="sorting-indicator"></span>
2886
  </a></th>
@@ -2891,121 +2585,65 @@ EOT;
2891
  </div>
2892
  <?php
2893
  }
 
2894
  public function view_yop_poll_logs() {
2895
  global $wpdb, $page, $action, $orderby, $order, $current_user;
2896
- $per_page = (isset ( $_GET ['per_page'] ) ? intval ( $_GET ['per_page'] ) : 100);
2897
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int ) $_REQUEST ['page_no'] : 1;
2898
- $orderby = (empty ( $orderby )) ? 'name' : $orderby;
2899
- $order_direction = array (
2900
- 'vote_id' => 'asc',
2901
- 'name' => 'asc',
2902
- 'answer' => 'asc',
2903
- 'user_nicename' => 'asc',
2904
- 'user_email' => 'asc',
2905
- 'user_from' => 'asc',
2906
- 'tr_id' => 'asc',
2907
- 'ip' => 'asc',
2908
- 'vote_date' => 'asc'
2909
- );
2910
- $order_direction [$orderby] = ('desc' == $order) ? 'asc' : 'desc';
2911
-
2912
- $order_direction_reverse = array (
2913
- 'vote_id' => 'desc',
2914
- 'name' => 'desc',
2915
- 'answer' => 'desc',
2916
- 'user_nicename' => 'desc',
2917
- 'user_email' => 'desc',
2918
- 'user_from' => 'desc',
2919
- 'tr_id' => 'desc',
2920
- 'ip' => 'desc',
2921
- 'vote_date' => 'desc'
2922
- );
2923
- $order_direction_reverse [$orderby] = ('desc' == $order) ? 'desc' : 'asc';
2924
-
2925
- $order_sortable = array (
2926
- 'vote_id' => 'sortable',
2927
- 'name' => 'sortable',
2928
- 'answer' => 'sortable',
2929
- 'user_nicename' => 'sortable',
2930
- 'user_email' => 'sortable',
2931
- 'user_from' => 'sortable',
2932
- 'tr_id' => 'sortable',
2933
- 'ip' => 'sortable',
2934
- 'vote_date' => 'sortable'
2935
- );
2936
  $order_sortable [$orderby] = 'sorted';
2937
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int ) $_REQUEST ['poll_id'] : NULL;
2938
-
2939
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
2940
-
2941
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
2942
- if ($this->current_user_can ( 'view_own_polls_logs' ) && $poll_id) {
2943
- if ($poll_author != $current_user->ID && ! $this->current_user_can ( 'view_polls_logs' ))
2944
- wp_die ( __ ( 'You are not allowed to access this section.', 'yop_poll' ) );
2945
- } elseif (! $this->current_user_can ( 'view_polls_logs' )) {
2946
- wp_die ( __ ( 'You are not allowed to access this section.', 'yop_poll' ) );
2947
- }
2948
- $log_sdate = (isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '');
2949
- $log_edate = (isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '');
2950
- $group_by = (isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote');
2951
-
2952
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( 'id', 'asc' );
2953
- if ($group_by == 'vote')
2954
- $search = array (
2955
- 'fields' => array (
2956
- 'name',
2957
- 'ip',
2958
- 'user_nicename',
2959
- 'user_email',
2960
- 'user_from',
2961
- 'tr_id'
2962
- ),
2963
- 'value' => isset ( $_REQUEST ['s'] ) ? trim ( $_REQUEST ['s'] ) : ''
2964
- );
2965
- else
2966
- $search = array (
2967
- 'fields' => array (
2968
- 'name',
2969
- 'answer',
2970
- 'ip',
2971
- 'other_answer_value',
2972
- 'user_nicename',
2973
- 'user_from',
2974
- 'tr_id',
2975
- 'user_email'
2976
- ),
2977
- 'value' => isset ( $_REQUEST ['s'] ) ? trim ( $_REQUEST ['s'] ) : ''
2978
- );
2979
- $filter = array (
2980
- 'field' => NULL,
2981
- 'value' => NULL,
2982
- 'operator' => '='
2983
- );
2984
- if ($group_by == 'vote')
2985
- $total_logs = Yop_Poll_Model::get_total_group_logs_filter_search ( $search, $poll_id, $log_sdate, $log_edate );
2986
- else
2987
- $total_logs = Yop_Poll_Model::get_total_logs_filter_search ( $search, $poll_id, $log_sdate, $log_edate );
2988
- $total_logs_pages = ceil ( $total_logs / $per_page );
2989
- if (intval ( $page_no ) > intval ( $total_logs_pages ))
2990
  $page_no = 1;
2991
- if ($group_by == 'vote')
2992
- $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 );
2993
- else
2994
- $logs = Yop_Poll_Model::get_logs_filter_search ( $orderby, $order, $search, $poll_id, ($page_no - 1) * $per_page, $per_page, $log_sdate, $log_edate );
2995
-
2996
- $args = array (
2997
- 'base' => remove_query_arg ( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
2998
- 'format' => '&page_no=%#%',
2999
- 'total' => $total_logs_pages,
3000
- 'current' => max ( 1, $page_no ),
3001
- 'prev_next' => True,
3002
- 'prev_text' => __ ( '&laquo; Previous' ),
3003
- 'next_text' => __ ( 'Next &raquo;' )
3004
- );
3005
- $pagination = paginate_links ( $args );
3006
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3007
- 'action'
3008
- ), $_SERVER ['REQUEST_URI'] );
3009
  ?>
3010
  <div class="wrap">
3011
  <div class="icon32 icon32-yop-poll">
@@ -3014,27 +2652,25 @@ EOT;
3014
  </div>
3015
  <h2><?php _e( 'Yop Poll Logs', 'yop_poll' ); ?></h2>
3016
  <?php
3017
- if (isset ( $_REQUEST ['deleted'] )) {
3018
  echo '<div id="message" class="updated"><p>';
3019
- $deleted = ( int ) $_REQUEST ['deleted'];
3020
- printf ( _n ( '%s Poll Log deleted.', '%s Poll Logs deleted.', $deleted ), $deleted );
3021
  echo '</p></div>';
3022
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3023
- 'deleted'
3024
- ), $_SERVER ['REQUEST_URI'] );
3025
  }
3026
  ?>
3027
  <form method="get">
3028
  <?php wp_nonce_field( 'yop-poll-logs' ); ?>
3029
- <input type="hidden" name="order" value="<?php echo $order ?>" />
3030
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>" />
3031
- <input type="hidden" name="page" value="yop-polls-logs" />
3032
  <p class="search-box">
3033
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Logs', 'yop_poll' ) ?></label>
3034
  <input id="yop-poll-search-input" type="search"
3035
- value="<?php if( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
3036
- name="s" /> <input id="search-submit" class="button" type="submit"
3037
- value="<?php _e( 'Search Poll Logs', 'yop_poll' ); ?>" name="" />
3038
  </p>
3039
  <div class="tablenav top">
3040
  <div class="alignleft actions">
@@ -3044,18 +2680,19 @@ EOT;
3044
  <option <?php echo selected( $group_by, 'vote' ); ?> value="vote"><?php _e( 'Group Logs By Vote', 'yop_poll' ); ?></option>
3045
  </select> <input type="submit"
3046
  value="<?php _e( 'Group', 'yop_poll' ); ?>"
3047
- class="button-secondary action" id="doaction" name="" />
3048
  </div>
3049
  </div>
3050
  <div class="tablenav top">
3051
  <div class="alignleft actions">
3052
  <select name="action">
3053
  <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
3054
- <?php if ( $group_by == 'vote') { ?>
3055
  <option value="delete_group"><?php _e( 'Delete', 'yop_poll' ); ?></option>
3056
  <?php
3057
 
3058
- } else {
 
3059
  ?>
3060
  <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
3061
  <?php } ?>
@@ -3067,7 +2704,7 @@ EOT;
3067
  <select name="poll_id">
3068
  <option value=""><?php _e( 'All Logs', 'yop_poll' ); ?></option>
3069
  <?php
3070
- if (count ( $yop_polls ) > 0) {
3071
  foreach ( $yop_polls as $yop_poll ) {
3072
  ?>
3073
  <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
@@ -3076,12 +2713,13 @@ EOT;
3076
  }
3077
  }
3078
  ?>
3079
- </select> <label for="yop-poll-logs-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>:</label>
 
3080
  <input id="yop-poll-logs-start-date-input" type="text"
3081
- name="log_sdate" value="<?php echo $log_sdate; ?>" />&nbsp;&nbsp; <label
3082
  for="yop-poll-logs-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>:</label>
3083
  <input id="yop-poll-logs-end-date-input" type="text"
3084
- name="log_edate" value="<?php echo $log_edate; ?>" />&nbsp;&nbsp; <input
3085
  type="submit" value="<?php _e( 'Filter', 'yop_poll' ); ?>"
3086
  class="button-secondary" id="post-query-submit" name="">&nbsp;|&nbsp;
3087
  </div>
@@ -3096,11 +2734,13 @@ EOT;
3096
 
3097
  </div>
3098
  <div class="tablenav-pages one-page">
3099
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>:</label>
 
3100
  <input id="yop-poll-items-per-page" type="text" name="per_page"
3101
- value="<?php echo $per_page; ?>" /> <input name="a"
3102
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit" />&nbsp;&nbsp;
3103
- <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?> logs</span>
 
3104
  <?php print $pagination; ?>
3105
  </div>
3106
  <br class="clear">
@@ -3111,65 +2751,65 @@ EOT;
3111
  <th id="cb" class="manage-column column-cb check-column"
3112
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3113
  <th id="id"
3114
- class="manage-column <?php echo $order_sortable[ 'vote_id' ] ?> <?php echo $order_direction_reverse[ 'vote_id' ] ?>"
3115
  style="width: 10%" scope="col"><a
3116
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction[ 'vote_id' ] ) ) ); ?>">
3117
  <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
3118
  class="sorting-indicator"></span>
3119
  </a></th>
3120
  <th id="name"
3121
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
3122
  style="width: 20%" scope="col"><a
3123
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
3124
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3125
  class="sorting-indicator"></span>
3126
  </a></th>
3127
  <th id="total_votes"
3128
- class="manage-column <?php echo $order_sortable[ 'answer' ] ?> <?php echo $order_direction_reverse[ 'answer' ] ?>"
3129
  style="width: 18%" scope="col"><a
3130
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction[ 'answer' ] ) ) ); ?>">
3131
  <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
3132
  class="sorting-indicator"></span>
3133
  </a></th>
3134
  <th id="user_from"
3135
- class="manage-column <?php echo $order_sortable[ 'user_from' ] ?> <?php echo $order_direction_reverse[ 'user_from' ] ?>"
3136
  style="width: 10%" scope="col"><a
3137
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction[ 'user_from' ] ) ) ); ?>">
3138
  <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
3139
  class="sorting-indicator"></span>
3140
  </a></th>
3141
  <th id="user_nicename"
3142
- class="manage-column <?php echo $order_sortable[ 'user_nicename' ] ?> <?php echo $order_direction_reverse[ 'user_nicename' ] ?>"
3143
  style="width: 10%" scope="col"><a
3144
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction[ 'user_nicename' ] ) ) ); ?>">
3145
  <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
3146
  class="sorting-indicator"></span>
3147
  </a></th>
3148
  <th id="user_email"
3149
- class="manage-column <?php echo $order_sortable[ 'user_email' ] ?> <?php echo $order_direction_reverse[ 'user_email' ] ?>"
3150
  style="width: 10%" scope="col"><a
3151
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction[ 'user_email' ] ) ) ); ?>">
3152
  <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
3153
  class="sorting-indicator"></span>
3154
  </a></th>
3155
  <th id="tr_id"
3156
- class="manage-column <?php echo $order_sortable[ 'tr_id' ] ?> <?php echo $order_direction_reverse[ 'tr_id' ] ?>"
3157
  style="width: 5%" scope="col"><a
3158
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction[ 'tr_id' ] ) ) ); ?>">
3159
  <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
3160
  class="sorting-indicator"></span>
3161
  </a></th>
3162
  <th id="ip"
3163
- class="manage-column <?php echo $order_sortable[ 'ip' ] ?> <?php echo $order_direction_reverse[ 'ip' ] ?>"
3164
  style="width: 5%" scope="col"><a
3165
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction[ 'ip' ] ) ) ); ?>">
3166
  <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
3167
  class="sorting-indicator"></span>
3168
  </a></th>
3169
  <th id="vote_date"
3170
- class="manage-column <?php echo $order_sortable[ 'vote_date' ] ?> <?php echo $order_direction_reverse[ 'vote_date' ] ?>"
3171
  style="width: 10%" scope="col"><a
3172
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction[ 'vote_date' ] ) ) ); ?>">
3173
  <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
3174
  class="sorting-indicator"></span>
3175
  </a></th>
@@ -3180,95 +2820,96 @@ EOT;
3180
  <th id="footer_cb" class="manage-column column-cb check-column"
3181
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3182
  <th id="id"
3183
- class="manage-column <?php echo $order_sortable[ 'vote_id' ] ?> <?php echo $order_direction_reverse[ 'vote_id' ] ?>"
3184
  style="width: 10%" scope="col"><a
3185
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction[ 'vote_id' ] ) ) ); ?>">
3186
  <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
3187
  class="sorting-indicator"></span>
3188
  </a></th>
3189
  <th id="footer_name"
3190
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
3191
  style="width: 20%" scope="col"><a
3192
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
3193
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3194
  class="sorting-indicator"></span>
3195
  </a></th>
3196
  <th id="footer_answer"
3197
- class="manage-column <?php echo $order_sortable[ 'answer' ] ?> <?php echo $order_direction_reverse[ 'answer' ] ?>"
3198
  style="width: 18%" scope="col"><a
3199
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction[ 'answer' ] ) ) ); ?>">
3200
  <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
3201
  class="sorting-indicator"></span>
3202
  </a></th>
3203
  <th id="footer_user_from"
3204
- class="manage-column <?php echo $order_sortable[ 'user_from' ] ?> <?php echo $order_direction_reverse[ 'user_from' ] ?>"
3205
  style="width: 10%" scope="col"><a
3206
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction[ 'user_from' ] ) ) ); ?>">
3207
  <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
3208
  class="sorting-indicator"></span>
3209
  </a></th>
3210
  <th id="footer_user_nicename"
3211
- class="manage-column <?php echo $order_sortable[ 'user_nicename' ] ?> <?php echo $order_direction_reverse[ 'user_nicename' ] ?>"
3212
  style="width: 10%" scope="col"><a
3213
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction[ 'user_nicename' ] ) ) ); ?>">
3214
  <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
3215
  class="sorting-indicator"></span>
3216
  </a></th>
3217
  <th id="footer_user_email"
3218
- class="manage-column <?php echo $order_sortable[ 'user_email' ] ?> <?php echo $order_direction_reverse[ 'user_email' ] ?>"
3219
  style="width: 10%" scope="col"><a
3220
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction[ 'user_email' ] ) ) ); ?>">
3221
  <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
3222
  class="sorting-indicator"></span>
3223
  </a></th>
3224
  <th id="footer_tr_id"
3225
- class="manage-column <?php echo $order_sortable[ 'tr_id' ] ?> <?php echo $order_direction_reverse[ 'tr_id' ] ?>"
3226
  style="width: 5%" scope="col"><a
3227
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction[ 'tr_id' ] ) ) ); ?>">
3228
  <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
3229
  class="sorting-indicator"></span>
3230
  </a></th>
3231
  <th id="footer_ip"
3232
- class="manage-column <?php echo $order_sortable[ 'ip' ] ?> <?php echo $order_direction_reverse[ 'ip' ] ?>"
3233
  style="width: 5%" scope="col"><a
3234
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction[ 'ip' ] ) ) ); ?>">
3235
  <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
3236
  class="sorting-indicator"></span>
3237
  </a></th>
3238
  <th id="footer_vote_date"
3239
- class="manage-column <?php echo $order_sortable[ 'vote_date' ] ?> <?php echo $order_direction_reverse[ 'vote_date' ] ?>"
3240
  style="width: 10%" scope="col"><a
3241
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction[ 'vote_date' ] ) ) ); ?>">
3242
  <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
3243
  class="sorting-indicator"></span>
3244
  </a></th>
3245
  </tr>
3246
  </tfoot>
3247
  <?php
3248
- if (count ( $logs ) > 0) {
3249
  foreach ( $logs as $log ) {
3250
  ?>
3251
  <tbody id="the-list">
3252
  <tr valign="middle" class="alternate"
3253
  id="yop-poll-log<?php echo $log['id']; ?>">
3254
  <th class="check-column" scope="row">
3255
- <?php if ( $group_by == 'vote') { ?>
3256
  <?php
3257
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id ( 'poll_id', $log ['vote_id'] );
3258
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
3259
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' ))) {
3260
  ?>
3261
  <input type="checkbox"
3262
  value="<?php echo $log['vote_id']; ?>" name="yoppolllogscheck[]">
3263
  <?php } ?>
3264
  <?php
3265
 
3266
- } else {
 
3267
  ?>
3268
  <?php
3269
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id ( 'poll_id', $log ['id'] );
3270
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
3271
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' ))) {
3272
  ?>
3273
  <input type="checkbox" value="<?php echo $log['id']; ?>"
3274
  name="yoppolllogscheck[]">
@@ -3276,37 +2917,43 @@ EOT;
3276
  <?php } ?>
3277
  </th>
3278
  <td><strong><?php echo $log['vote_id']; ?></strong><br></td>
3279
- <td><strong><?php if ( $log['name'] != '' ) echo esc_html( stripslashes( $log['name'] ) ); else { echo esc_html( stripslashes( Yop_Poll_Model::get_poll_field_from_database_by_id ( 'name', $poll_id ) ) ); } ?></strong><br>
 
 
 
 
 
3280
  <div class="row-actions">
3281
- <?php if ( $group_by == 'vote') { ?>
3282
  <?php
3283
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id ( 'poll_id', $log ['vote_id'] );
3284
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
3285
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' ))) {
3286
  ?>
3287
  <span class="delete"><a
3288
- 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;"
3289
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_group', 'id' => $log['vote_id'] ) ), 'yop-poll-logs-delete' ); ?>"
3290
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
3291
  <?php } ?>
3292
  <?php
3293
 
3294
- } else {
 
3295
  ?>
3296
  <?php
3297
- $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id ( 'poll_id', $log ['id'] );
3298
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
3299
- if (($this->current_user_can ( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID) || ($this->current_user_can ( 'delete_polls_logs' ))) {
3300
  ?>
3301
  <span class="delete"><a
3302
- 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;"
3303
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $log['id'] ) ), 'yop-poll-logs-delete' ); ?>"
3304
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
3305
  <?php } ?>
3306
  <?php } ?>
3307
  </div></td>
3308
  <td>
3309
- <?php echo ( 'Other' == $log['answer'] )? 'Other - '.esc_html( stripslashes( $log['other_answer_value'] ) ) : esc_html( stripslashes( $log['answer'] ) ) ; ?>
3310
  </td>
3311
  <td>
3312
  <?php echo esc_html( stripslashes( $log['user_from'] ) ); ?>
@@ -3335,7 +2982,8 @@ EOT;
3335
  </table>
3336
  <div class="tablenav bottom">
3337
  <div class="tablenav-pages one-page">
3338
- <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?> logs</span>
 
3339
  <?php print $pagination; ?>
3340
  </div>
3341
  </div>
@@ -3343,63 +2991,35 @@ EOT;
3343
  </div>
3344
  <?php
3345
  }
 
3346
  public function view_yop_poll_bans() {
3347
  global $wpdb, $page, $action, $orderby, $order;
3348
- $per_page = (isset ( $_GET ['per_page'] ) ? intval ( $_GET ['per_page'] ) : 100);
3349
- $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int ) $_REQUEST ['page_no'] : 1;
3350
- $orderby = (empty ( $orderby )) ? 'name' : $orderby;
3351
- $order_direction = array (
3352
- 'id' => 'asc',
3353
- 'name' => 'asc',
3354
- 'type' => 'asc',
3355
- 'value' => 'asc'
3356
- );
3357
- $order_direction [$orderby] = ('desc' == $order) ? 'asc' : 'desc';
3358
 
3359
- $order_direction_reverse = array (
3360
- 'id' => 'desc',
3361
- 'name' => 'desc',
3362
- 'type' => 'desc',
3363
- 'value' => 'desc'
3364
- );
3365
- $order_direction_reverse [$orderby] = ('desc' == $order) ? 'desc' : 'asc';
3366
 
3367
- $order_sortable = array (
3368
- 'id' => 'sortable',
3369
- 'name' => 'sortable',
3370
- 'type' => 'sortable',
3371
- 'value' => 'sortable'
3372
- );
3373
  $order_sortable [$orderby] = 'sorted';
3374
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int ) $_REQUEST ['poll_id'] : NULL;
3375
- $type = isset ( $_REQUEST ['type'] ) ? $_REQUEST ['type'] : NULL;
3376
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
3377
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( 'id', 'asc' );
3378
- $search = array (
3379
- 'fields' => array (
3380
- $wpdb->yop_poll_bans . '.value'
3381
- ),
3382
- 'value' => isset ( $_REQUEST ['s'] ) ? trim ( $_REQUEST ['s'] ) : ''
3383
- );
3384
- $total_bans = count ( Yop_Poll_Model::get_bans_filter_search ( $orderby, $order, $search, $type, $poll_id ) );
3385
- $total_bans_pages = ceil ( $total_bans / $per_page );
3386
- if (intval ( $page_no ) > intval ( $total_bans_pages ))
3387
  $page_no = 1;
3388
- $bans = Yop_Poll_Model::get_bans_filter_search ( $orderby, $order, $search, $type, $poll_id, ($page_no - 1) * $per_page, $per_page );
3389
-
3390
- $args = array (
3391
- 'base' => remove_query_arg ( 'page_no', $_SERVER ['REQUEST_URI'] ) . '%_%',
3392
- 'format' => '&page_no=%#%',
3393
- 'total' => $total_bans_pages,
3394
- 'current' => max ( 1, $page_no ),
3395
- 'prev_next' => True,
3396
- 'prev_text' => __ ( '&laquo; Previous' ),
3397
- 'next_text' => __ ( 'Next &raquo;' )
3398
- );
3399
- $pagination = paginate_links ( $args );
3400
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3401
- 'action'
3402
- ), $_SERVER ['REQUEST_URI'] );
3403
  ?>
3404
  <div class="wrap">
3405
  <div class="icon32 icon32-yop-poll">
@@ -3411,42 +3031,36 @@ EOT;
3411
  id="yop-poll-add-new-ban"><?php _e( 'Add New', 'yop_poll' ); ?></a>
3412
  </h2>
3413
  <?php
3414
- if (isset ( $_REQUEST ['deleted'] )) {
3415
  echo '<div id="message" class="updated"><p>';
3416
- $deleted = ( int ) $_REQUEST ['deleted'];
3417
- printf ( _n ( '%s Poll Ban deleted!', '%s Poll Bans deleted!', $deleted ), $deleted );
3418
  echo '</p></div>';
3419
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3420
- 'deleted'
3421
- ), $_SERVER ['REQUEST_URI'] );
3422
  }
3423
  ?>
3424
  <?php
3425
- if (isset ( $_REQUEST ['bans-added'] )) {
3426
  echo '<div id="message" class="updated"><p>';
3427
- $added = ( int ) $_REQUEST ['bans-added'];
3428
- printf ( _n ( '%s Poll Ban added!', '%s Poll Bans added!', $added ), $added );
3429
  echo '</p></div>';
3430
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3431
- 'bans-added'
3432
- ), $_SERVER ['REQUEST_URI'] );
3433
  }
3434
  ?>
3435
  <?php
3436
- if (isset ( $_REQUEST ['bans-error'] )) {
3437
  echo '<div id="message" class="error"><p>';
3438
  print $_REQUEST ['bans-error'];
3439
  echo '</p></div>';
3440
- $_SERVER ['REQUEST_URI'] = remove_query_arg ( array (
3441
- 'bans-error'
3442
- ), $_SERVER ['REQUEST_URI'] );
3443
  }
3444
  ?>
3445
  <div id='yop-poll-add-ban-div' style="display: none;">
3446
  <p><?php _e( 'Ban IP, Username or Email', 'yop_poll' ); ?></p>
3447
  <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
3448
- <input type="hidden" name="page" value="yop-polls-bans" />
3449
- <input type="hidden" name="action" value="add-ban" />
3450
  <?php wp_nonce_field( 'yop-poll-add-ban' ); ?>
3451
  <table class="form-table">
3452
  <tbody>
@@ -3456,7 +3070,7 @@ EOT;
3456
  <td><select id="ban-poll-id" name="ban_poll_id">
3457
  <option value="0"><?php _e( 'Bans For All Polls', 'yop_poll' ); ?></option>
3458
  <?php
3459
- if (count ( $yop_polls ) > 0) {
3460
  foreach ( $yop_polls as $yop_poll ) {
3461
  ?>
3462
  <option value="<?php echo $yop_poll['id'] ?>"><?php echo $yop_poll['name'] ?></option>
@@ -3476,34 +3090,35 @@ EOT;
3476
  <option value="email"><?php _e( 'Email', 'yop_poll' ); ?></option></td>
3477
  </tr>
3478
  <tr class="form-field form-required">
3479
- <th scope="row"><label for="yop-poll-ban-value"><?php _e( 'Value', 'yop_poll' ); ?> <span
3480
- class="description">(required)</span><br> <small><i><?php _e( 'One Value Per Line', 'yop_poll'); ?></i></small></label></th>
 
3481
  <td><textarea rows="5" cols="20" id="yop-poll-ban-value"
3482
  name="ban_value"></textarea></td>
3483
  </tr>
3484
  </tbody>
3485
  </table>
3486
  <p class="submit">
3487
- <input type="submit" value="<?php _e( 'Add Ban', 'yop_poll');?> "
3488
  class="button-primary"> <input id="yop-poll-add-ban-close"
3489
- type="button" value="<?php _e( 'Close', 'yop_poll');?> "
3490
  class="button-primary">
3491
 
3492
  </p>
3493
  </form>
3494
  </div>
3495
- <br />
3496
  <form method="get">
3497
  <?php wp_nonce_field( 'yop-poll-bans' ); ?>
3498
- <input type="hidden" name="order" value="<?php echo $order ?>" />
3499
- <input type="hidden" name="orderby" value="<?php echo $orderby ?>" />
3500
- <input type="hidden" name="page" value="yop-polls-bans" />
3501
  <p class="search-box">
3502
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Bans', 'yop_poll' ) ?></label>
3503
  <input id="yop-poll-search-input" type="search"
3504
- value="<?php if( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
3505
- name="s" /> <input id="search-submit" class="button" type="submit"
3506
- value="<?php _e( 'Search Poll Bans', 'yop_poll' ); ?>" name="" />
3507
  </p>
3508
  <div class="tablenav top">
3509
  <div class="alignleft actions">
@@ -3518,7 +3133,7 @@ EOT;
3518
  <select name="poll_id">
3519
  <option value=""><?php _e( 'All Polls', 'yop_poll' ); ?></option>
3520
  <?php
3521
- if (count ( $yop_polls ) > 0) {
3522
  foreach ( $yop_polls as $yop_poll ) {
3523
  ?>
3524
  <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
@@ -3532,19 +3147,21 @@ EOT;
3532
  <div class="alignleft actions">
3533
  <select name="type">
3534
  <option value=""><?php _e( 'All Ban Types', 'yop_poll' ); ?></option>
3535
- <option <?php echo selected('ip', $type); ?> value="ip"><?php _e( 'IP', 'yop_poll' ); ?></option>
3536
- <option <?php echo selected('username', $type); ?> value="username"><?php _e( 'Username', 'yop_poll' ); ?></option>
3537
- <option <?php echo selected('email', $type); ?> value="email"><?php _e( 'Email', 'yop_poll' ); ?></option>
3538
  </select> <input type="submit"
3539
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
3540
  class="button-secondary" id="post-query-submit" name="">
3541
  </div>
3542
  <div class="tablenav-pages one-page">
3543
- <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>:</label>
 
3544
  <input id="yop-poll-items-per-page" type="text" name="per_page"
3545
- value="<?php echo $per_page; ?>" /> <input name="a"
3546
- value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit" />&nbsp;&nbsp;
3547
- <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans; _e('Bans', 'yop_poll')?> </span>
 
3548
  <?php print $pagination; ?>
3549
  </div>
3550
  <br class="clear">
@@ -3555,30 +3172,30 @@ EOT;
3555
  <th id="cb" class="manage-column column-cb check-column"
3556
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3557
  <th id="id"
3558
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
3559
  style="width: 5%" scope="col"><a
3560
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
3561
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3562
  class="sorting-indicator"></span>
3563
  </a></th>
3564
  <th id="name"
3565
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
3566
  style="width: 25%" scope="col"><a
3567
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
3568
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3569
  class="sorting-indicator"></span>
3570
  </a></th>
3571
  <th id="type"
3572
- class="manage-column <?php echo $order_sortable[ 'type' ] ?> <?php echo $order_direction_reverse[ 'type' ] ?>"
3573
  style="width: 25%" scope="col"><a
3574
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction[ 'type' ] ) ) ); ?>">
3575
  <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3576
  class="sorting-indicator"></span>
3577
  </a></th>
3578
  <th id="value"
3579
- class="manage-column <?php echo $order_sortable[ 'value' ] ?> <?php echo $order_direction_reverse[ 'value' ] ?>"
3580
  style="width: 15%" scope="col"><a
3581
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction[ 'value' ] ) ) ); ?>">
3582
  <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3583
  class="sorting-indicator"></span>
3584
  </a></th>
@@ -3589,37 +3206,37 @@ EOT;
3589
  <th id="cb" class="manage-column column-cb check-column"
3590
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3591
  <th id="id"
3592
- class="manage-column <?php echo $order_sortable[ 'id' ] ?> <?php echo $order_direction_reverse[ 'id' ] ?>"
3593
  style="width: 5%" scope="col"><a
3594
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction[ 'id' ] ) ) ); ?>">
3595
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3596
  class="sorting-indicator"></span>
3597
  </a></th>
3598
  <th id="name"
3599
- class="manage-column <?php echo $order_sortable[ 'name' ] ?> <?php echo $order_direction_reverse[ 'name' ] ?>"
3600
  style="width: 25%" scope="col"><a
3601
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction[ 'name' ] ) ) ); ?>">
3602
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3603
  class="sorting-indicator"></span>
3604
  </a></th>
3605
  <th id="type"
3606
- class="manage-column <?php echo $order_sortable[ 'type' ] ?> <?php echo $order_direction_reverse[ 'type' ] ?>"
3607
  style="width: 25%" scope="col"><a
3608
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction[ 'type' ] ) ) ); ?>">
3609
  <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3610
  class="sorting-indicator"></span>
3611
  </a></th>
3612
  <th id="value"
3613
- class="manage-column <?php echo $order_sortable[ 'value' ] ?> <?php echo $order_direction_reverse[ 'value' ] ?>"
3614
  style="width: 15%" scope="col"><a
3615
- href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction[ 'value' ] ) ) ); ?>">
3616
  <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3617
  class="sorting-indicator"></span>
3618
  </a></th>
3619
  </tr>
3620
  </tfoot>
3621
  <?php
3622
- if (count ( $bans ) > 0) {
3623
  foreach ( $bans as $ban ) {
3624
  ?>
3625
  <tbody id="the-list">
@@ -3631,7 +3248,7 @@ EOT;
3631
  <td><strong><?php echo esc_html( stripslashes( $ban['name'] ) ); ?></strong><br>
3632
  <div class="row-actions">
3633
  <span class="delete"><a
3634
- 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;"
3635
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $ban['id'] ) ), 'yop-poll-bans-delete' ); ?>"
3636
  class="submitdelete"><?php _e( 'Remove', 'yop_poll' ) ?></a></span>
3637
  </div></td>
@@ -3650,7 +3267,8 @@ EOT;
3650
  </table>
3651
  <div class="tablenav bottom">
3652
  <div class="tablenav-pages one-page">
3653
- <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans; _e('Bans', 'yop_poll')?> </span>
 
3654
  <?php print $pagination; ?>
3655
  </div>
3656
  </div>
@@ -3658,10 +3276,11 @@ EOT;
3658
  </div>
3659
  <?php
3660
  }
 
3661
  public function view_yop_poll_become_pro() {
3662
  global $wpdb, $page, $action;
3663
- require_once (ABSPATH . '/wp-admin/options-head.php');
3664
- $pro_options = get_option ( 'yop_poll_pro_options', array () );
3665
  ?>
3666
  <div class="wrap">
3667
  <div class="icon32 icon32-yop-poll">
@@ -3671,7 +3290,7 @@ EOT;
3671
  <h2><?php _e( 'Become Pro', 'yop_poll' ); ?></h2>
3672
  <div id="message"></div>
3673
  <form action="options.php" method="post">
3674
- <?php settings_fields('yop_poll_pro_options'); ?>
3675
  <table class="form-table">
3676
  <tbody>
3677
  <tr valign="top">
@@ -3687,1214 +3306,1167 @@ EOT;
3687
  </div>
3688
  <?php
3689
  }
 
3690
  public function yop_poll_options_admin_init() {
3691
- register_setting ( 'yop_poll_options', 'yop_poll_options', array (
3692
- &$this,
3693
- 'yop_poll_options_validate'
3694
- ) );
3695
- register_setting ( 'yop_poll_pro_options', 'yop_poll_pro_options', array (
3696
- &$this,
3697
- 'yop_poll_pro_options_validate'
3698
- ) );
3699
  }
3700
 
3701
- public function yop_poll_pro_options_validate($input) {
3702
- $pro_options = get_option ( 'yop_poll_pro_options', array () );
3703
- $newinput = $pro_options;
3704
- $errors = '';
3705
- $updated = '';
3706
  $message_delimiter = '<br>';
3707
  // set api key
3708
- if (isset ( $input ['pro_key'] )) {
3709
- if ($input ['pro_key'] != '') {
3710
- require_once ($this->_config->plugin_inc_dir . '/pro_member_model.php');
3711
- $yop_poll_pro_member = Yop_Poll_Pro_Member_Model::getInstance ();
3712
- if ( $yop_poll_pro_member->register_pro_member ( $input ['pro_key'] ) ) {
3713
- $newinput ['pro_key'] = trim ( $input ['pro_key'] );
3714
- $newinput ['pro_api_key'] = $yop_poll_pro_member->api_return_data['apy_key'];
3715
- $newinput ['pro_user'] = 'yes';
3716
- $updated .= __ ( 'Your Pro Key Saved!', 'yop_poll' ) . $message_delimiter;
3717
  }
3718
  else {
3719
- $newinput ['pro_key'] = trim ( $input ['pro_key'] );
3720
- $newinput ['pro_api_key'] = '';
3721
- $newinput ['pro_user'] = 'no';
3722
- $errors .= __ ( 'Pro Key Error: ', 'yop_poll' ) . $yop_poll_pro_member->error . $message_delimiter;
3723
  }
3724
  }
3725
  else {
3726
- $newinput ['pro_key'] = $pro_options ['pro_key'];
3727
- $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3728
- $newinput ['pro_user'] = $pro_options ['pro_user'];
3729
- $errors .= __ ( 'Pro Key Is Empty!', 'yop_poll' ) . $message_delimiter;
3730
  }
3731
  }
3732
  else {
3733
- $newinput ['pro_key'] = $pro_options ['pro_key'];
3734
- $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3735
- $newinput ['pro_user'] = $pro_options ['pro_user'];
3736
- $errors .= __ ( 'An Error Has Occured!', 'yop_poll' ) . $message_delimiter;
3737
  }
3738
 
3739
- if ('' != $errors)
3740
- add_settings_error ( 'general', 'yop-poll-errors', $errors, 'error' );
3741
- if ('' != $updated)
3742
- add_settings_error ( 'general', 'yop-poll-updates', $updated, 'updated' );
3743
 
3744
  return $newinput;
3745
  }
3746
- public function yop_poll_options_validate($input) {
3747
- $default_options = get_option ( 'yop_poll_options', array () );
3748
- $newinput = $default_options;
3749
- $errors = '';
3750
- $updated = '';
 
3751
  $message_delimiter = '<br>';
3752
- if ($this->current_user_can ( 'manage_polls_options' )) {
3753
  // allow_other_answers
3754
- if (isset ( $input ['allow_other_answers'] )) {
3755
- if (in_array ( $input ['allow_other_answers'], array (
3756
- 'yes',
3757
- 'no'
3758
- ) )) {
3759
- if ($default_options ['allow_other_answers'] != trim ( $input ['allow_other_answers'] )) {
3760
- $newinput ['allow_other_answers'] = trim ( $input ['allow_other_answers'] );
3761
- $updated .= __ ( 'Option "Allow Other Answer" Updated!', 'yop_poll' ) . $message_delimiter;
3762
  }
3763
- } else {
 
3764
  $newinput ['allow_other_answers'] = $default_options ['allow_other_answers'];
3765
- $errors .= __ ( 'Option "Allow Other Answer" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3766
- }
3767
 
3768
- if ('yes' == $input ['allow_other_answers']) {
3769
  // other_answers_label
3770
- if (isset ( $input ['other_answers_label'] )) {
3771
- if ($default_options ['other_answers_label'] != trim ( $input ['other_answers_label'] )) {
3772
- $newinput ['other_answers_label'] = trim ( $input ['other_answers_label'] );
3773
- $updated .= __ ( 'Option "Other Answer Label" Updated!', 'yop_poll' ) . $message_delimiter;
3774
  }
3775
  }
3776
 
3777
  //add_other_answers_to_default_answers
3778
 
3779
- if (isset ( $input ['add_other_answers_to_default_answers'] )) {
3780
- if (in_array ( $input ['add_other_answers_to_default_answers'], array (
3781
- 'yes',
3782
- 'no'
3783
- ) )) {
3784
- if ($default_options ['add_other_answers_to_default_answers'] != trim ( $input ['add_other_answers_to_default_answers'] )) {
3785
- $newinput ['add_other_answers_to_default_answers'] = trim ( $input ['add_other_answers_to_default_answers'] );
3786
- $updated .= __ ( 'Option "Add the values submitted in \'Other\' as answers" Updated!', 'yop_poll' ) . $message_delimiter;
3787
  }
3788
- } else {
 
3789
  $newinput ['add_other_answers_to_default_answers'] = $default_options ['add_other_answers_to_default_answers'];
3790
- $errors .= __ ( 'Option "Add the values submitted in \'Other\' as answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3791
  }
3792
  }
3793
 
3794
- if (isset ( $input ['display_other_answers_values'] )) {
3795
- if (in_array ( $input ['display_other_answers_values'], array (
3796
- 'yes',
3797
- 'no'
3798
- ) )) {
3799
- if ($default_options ['display_other_answers_values'] != trim ( $input ['display_other_answers_values'] )) {
3800
- $newinput ['display_other_answers_values'] = trim ( $input ['display_other_answers_values'] );
3801
- $updated .= __ ( 'Option "Display Other Answers Values" Updated!', 'yop_poll' ) . $message_delimiter;
3802
  }
3803
- } else {
 
3804
  $newinput ['display_other_answers_values'] = $default_options ['display_other_answers_values'];
3805
- $errors .= __ ( 'Option "Display Other Answers Values" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3806
  }
3807
  }
3808
  }
3809
  }
3810
 
3811
  // allow_multiple_answers
3812
- if (isset ( $input ['allow_multiple_answers'] )) {
3813
- if (in_array ( $input ['allow_multiple_answers'], array (
3814
- 'yes',
3815
- 'no'
3816
- ) )) {
3817
- if ($default_options ['allow_multiple_answers'] != trim ( $input ['allow_multiple_answers'] )) {
3818
- $newinput ['allow_multiple_answers'] = trim ( $input ['allow_multiple_answers'] );
3819
- $updated .= __ ( 'Option "Allow Multiple Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3820
  }
3821
 
3822
  // allow_multiple_answers_number
3823
- if ('yes' == $input ['allow_multiple_answers']) {
3824
- if (isset ( $input ['allow_multiple_answers_number'] )) {
3825
- if (ctype_digit ( $input ['allow_multiple_answers_number'] )) {
3826
- if ($default_options ['allow_multiple_answers_number'] != trim ( $input ['allow_multiple_answers_number'] )) {
3827
- $newinput ['allow_multiple_answers_number'] = trim ( $input ['allow_multiple_answers_number'] );
3828
- $updated .= __ ( 'Option "Max Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3829
  }
3830
- } else {
 
3831
  $newinput ['allow_multiple_answers_number'] = $default_options ['allow_multiple_answers_number'];
3832
- $errors .= __ ( 'Option "Max Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3833
  }
3834
  }
3835
- if (isset ( $input ['allow_multiple_answers_min_number'] )) {
3836
- if (ctype_digit ( $input ['allow_multiple_answers_min_number'] )) {
3837
- if ($default_options ['allow_multiple_answers_min_number'] != trim ( $input ['allow_multiple_answers_min_number'] )) {
3838
- $newinput ['allow_multiple_answers_min_number'] = trim ( $input ['allow_multiple_answers_min_number'] );
3839
- $updated .= __ ( 'Option "Min Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3840
  }
3841
- } else {
 
3842
  $newinput ['allow_multiple_answers_min_number'] = $default_options ['allow_multiple_answers_min_number'];
3843
- $errors .= __ ( 'Option "Min Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3844
  }
3845
  }
3846
  }
3847
- } else {
 
3848
  $newinput ['allow_multiple_answers'] = $default_options ['allow_multiple_answers'];
3849
- $errors .= __ ( 'Option "Allow Multiple Answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3850
  }
3851
  }
3852
 
3853
- if (isset ( $input ['use_captcha'] )) {
3854
- if (in_array ( $input ['use_captcha'], array (
3855
- 'yes',
3856
- 'no'
3857
- ) )) {
3858
- if ($default_options ['use_captcha'] != trim ( $input ['use_captcha'] )) {
3859
- $newinput ['use_captcha'] = trim ( $input ['use_captcha'] );
3860
- $updated .= __ ( 'Option "Use CAPTCHA" Updated!', 'yop_poll' ) . $message_delimiter;
3861
  }
3862
- } else {
 
3863
  $newinput ['use_captcha'] = $default_options ['use_captcha'];
3864
- $errors .= __ ( 'Option "Use CAPTCHA" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3865
  }
3866
  }
3867
 
3868
  // display_answers
3869
- if (isset ( $input ['display_answers'] )) {
3870
- if (in_array ( $input ['display_answers'], array (
3871
- 'vertical',
3872
- 'orizontal',
3873
- 'tabulated'
3874
- ) )) {
3875
- if ($default_options ['display_answers'] != trim ( $input ['display_answers'] )) {
3876
- $newinput ['display_answers'] = trim ( $input ['display_answers'] );
3877
- $updated .= __ ( 'Option "Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3878
  }
3879
 
3880
- if ('tabulated' == $input ['display_answers']) {
3881
  // display_answers_tabulated_cols
3882
- if (isset ( $input ['display_answers_tabulated_cols'] )) {
3883
- if (ctype_digit ( $input ['display_answers_tabulated_cols'] )) {
3884
- if ($default_options ['display_answers_tabulated_cols'] != trim ( $input ['display_answers_tabulated_cols'] )) {
3885
- $newinput ['display_answers_tabulated_cols'] = trim ( $input ['display_answers_tabulated_cols'] );
3886
- $updated .= __ ( 'Option "Columns for Tabulated Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3887
  }
3888
- } else {
 
3889
  $newinput ['display_answers_tabulated_cols'] = $default_options ['display_answers_tabulated_cols'];
3890
- $errors .= __ ( 'Option "Columns for Tabulated Display Answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3891
  }
3892
  }
3893
  }
3894
- } else {
 
3895
  $newinput ['display_answers'] = $default_options ['display_answers'];
3896
- $errors .= __ ( 'Option "Display Answers" Not Updated! you must choose between \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3897
  }
3898
  }
3899
 
3900
  // display_results
3901
- if (isset ( $input ['display_results'] )) {
3902
- if (in_array ( $input ['display_results'], array (
3903
- 'vertical',
3904
- 'orizontal',
3905
- 'tabulated'
3906
- ) )) {
3907
- if ($default_options ['display_results'] != trim ( $input ['display_results'] )) {
3908
- $newinput ['display_results'] = trim ( $input ['display_results'] );
3909
- $updated .= __ ( 'Option "Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
3910
  }
3911
 
3912
- if ('tabulated' == $input ['display_results']) {
3913
  // display_results_tabulated_cols
3914
- if (isset ( $input ['display_results_tabulated_cols'] )) {
3915
- if (ctype_digit ( $input ['display_results_tabulated_cols'] )) {
3916
- if ($default_options ['display_results_tabulated_cols'] != trim ( $input ['display_results_tabulated_cols'] )) {
3917
- $newinput ['display_results_tabulated_cols'] = trim ( $input ['display_results_tabulated_cols'] );
3918
- $updated .= __ ( 'Option "Columns for Tabulated Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
3919
  }
3920
- } else {
 
3921
  $newinput ['display_results_tabulated_cols'] = $default_options ['display_results_tabulated_cols'];
3922
- $errors .= __ ( 'Option "Columns for Tabulated Display Results" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3923
  }
3924
  }
3925
  }
3926
- } else {
 
3927
  $newinput ['display_results'] = $default_options ['display_results'];
3928
- $errors .= __ ( 'Option "Display Results" Not Updated! Choose the display layout: \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3929
  }
3930
  }
3931
  //template_width
3932
- if (isset ( $input ['template_width'] )) {
3933
- if ('' != trim ( $input ['template_width'] )) {
3934
- if ($default_options ['template_width'] != trim ( $input ['template_width'] )) {
3935
- $newinput ['template_width'] = trim ( $input ['template_width'] );
3936
- $updated .= __ ( 'Option "Poll Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3937
  }
3938
- } else {
 
3939
  $newinput ['template_width'] = $default_options ['template_width'];
3940
- $errors .= __ ( 'Option "Poll Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3941
  }
3942
  }
3943
 
3944
  //widget_template_width
3945
- if (isset ( $input ['widget_template_width'] )) {
3946
- if ('' != trim ( $input ['widget_template_width'] )) {
3947
- if ($default_options ['widget_template_width'] != trim ( $input ['widget_template_width'] )) {
3948
- $newinput ['widget_template_width'] = trim ( $input ['widget_template_width'] );
3949
- $updated .= __ ( 'Option "Widget Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3950
  }
3951
- } else {
 
3952
  $newinput ['widget_template_width'] = $default_options ['widget_template_width'];
3953
- $errors .= __ ( 'Option "Widget Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3954
  }
3955
  }
3956
 
3957
  // use_template_bar
3958
- if (isset ( $input ['use_template_bar'] )) {
3959
- if (in_array ( $input ['use_template_bar'], array (
3960
- 'yes',
3961
- 'no'
3962
- ) )) {
3963
- if ($default_options ['use_template_bar'] != trim ( $input ['use_template_bar'] )) {
3964
- $newinput ['use_template_bar'] = trim ( $input ['use_template_bar'] );
3965
- $updated .= __ ( 'Option "Use Template Result Bar" Updated!', 'yop_poll' ) . $message_delimiter;
3966
  }
3967
 
3968
- if ('no' == $input ['use_template_bar']) {
3969
  // bar_background
3970
- if (isset ( $input ['bar_background'] )) {
3971
- if (ctype_alnum ( $input ['bar_background'] )) {
3972
- if ($default_options ['bar_background'] != trim ( $input ['bar_background'] )) {
3973
- $newinput ['bar_background'] = trim ( $input ['bar_background'] );
3974
- $updated .= __ ( 'Option "Result Bar Background Color" Updated!', 'yop_poll' ) . $message_delimiter;
3975
  }
3976
- } else {
 
3977
  $newinput ['bar_background'] = $default_options ['bar_background'];
3978
- $errors .= __ ( 'Option "Result Bar Background Color" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
3979
  }
3980
  }
3981
 
3982
  // bar_height
3983
- if (isset ( $input ['bar_height'] )) {
3984
- if (ctype_digit ( $input ['bar_height'] )) {
3985
- if ($default_options ['bar_height'] != trim ( $input ['bar_height'] )) {
3986
- $newinput ['bar_height'] = trim ( $input ['bar_height'] );
3987
- $updated .= __ ( 'Option "Result Bar Height" Updated!', 'yop_poll' ) . $message_delimiter;
3988
  }
3989
- } else {
 
3990
  $newinput ['bar_height'] = $default_options ['bar_height'];
3991
- $errors .= __ ( 'Option "Result Bar Height" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3992
  }
3993
  }
3994
 
3995
  // bar_border_color
3996
- if (isset ( $input ['bar_border_color'] )) {
3997
- if (ctype_alnum ( $input ['bar_border_color'] )) {
3998
- if ($default_options ['bar_border_color'] != trim ( $input ['bar_border_color'] )) {
3999
- $newinput ['bar_border_color'] = trim ( $input ['bar_border_color'] );
4000
- $updated .= __ ( 'Option "Result Bar Border Color" Updated!', 'yop_poll' ) . $message_delimiter;
4001
  }
4002
- } else {
 
4003
  $newinput ['bar_border_color'] = $default_options ['bar_border_color'];
4004
- $errors .= __ ( 'Option "Result Bar Border Color" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4005
  }
4006
  }
4007
 
4008
  // bar_border_width
4009
- if (isset ( $input ['bar_border_width'] )) {
4010
- if (ctype_digit ( $input ['bar_border_width'] )) {
4011
- if ($default_options ['bar_border_width'] != trim ( $input ['bar_border_width'] )) {
4012
- $newinput ['bar_border_width'] = trim ( $input ['bar_border_width'] );
4013
- $updated .= __ ( 'Option "Result Bar Border Width" Updated!', 'yop_poll' ) . $message_delimiter;
4014
  }
4015
- } else {
 
4016
  $newinput ['bar_border_width'] = $default_options ['bar_border_width'];
4017
- $errors .= __ ( 'Option "Result Bar Border Width" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4018
  }
4019
  }
4020
 
4021
  // bar_border_style
4022
- if (isset ( $input ['bar_border_style'] )) {
4023
- if (ctype_alpha ( $input ['bar_border_style'] )) {
4024
- if ($default_options ['bar_border_style'] != trim ( $input ['bar_border_style'] )) {
4025
- $newinput ['bar_border_style'] = trim ( $input ['bar_border_style'] );
4026
- $updated .= __ ( 'Option "Result Bar Border Style" Updated!', 'yop_poll' ) . $message_delimiter;
4027
  }
4028
- } else {
 
4029
  $newinput ['bar_border_style'] = $default_options ['bar_border_style'];
4030
- $errors .= __ ( 'Option "Result Bar Border Style" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
4031
  }
4032
  }
4033
  }
4034
- } else {
 
4035
  $newinput ['use_template_bar'] = $default_options ['use_template_bar'];
4036
- $errors .= __ ( 'Option "Use Template Result Bar" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
4037
  }
4038
  }
4039
 
4040
  // sorting_answers
4041
- if (isset ( $input ['sorting_answers'] )) {
4042
- if (in_array ( $input ['sorting_answers'], array (
4043
- 'exact',
4044
- 'alphabetical',
4045
- 'random',
4046
- 'votes'
4047
- ) )) {
4048
- if ($default_options ['sorting_answers'] != trim ( $input ['sorting_answers'] )) {
4049
- $newinput ['sorting_answers'] = trim ( $input ['sorting_answers'] );
4050
- $updated .= __ ( 'Option "Sort Answers" Updated!', 'yop_poll' ) . $message_delimiter;
4051
  }
4052
 
4053
  // sorting_answers_direction
4054
- if (isset ( $input ['sorting_answers_direction'] )) {
4055
- if (in_array ( $input ['sorting_answers_direction'], array (
4056
- 'asc',
4057
- 'desc'
4058
- ) )) {
4059
- if ($default_options ['sorting_answers_direction'] != trim ( $input ['sorting_answers_direction'] )) {
4060
- $newinput ['sorting_answers_direction'] = trim ( $input ['sorting_answers_direction'] );
4061
- $updated .= __ ( 'Option "Sort Answers Direction" Updated!', 'yop_poll' ) . $message_delimiter;
4062
  }
4063
- } else {
 
4064
  $newinput ['sorting_answers_direction'] = $default_options ['sorting_answers_direction'];
4065
- $errors .= __ ( 'Option "Sort Answers Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
4066
  }
4067
  }
4068
- } else {
 
4069
  $newinput ['sorting_answers'] = $default_options ['sorting_answers'];
4070
- $errors .= __ ( 'Option "Sort Answers" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
4071
  }
4072
  }
4073
 
4074
  // sorting_results
4075
- if (isset ( $input ['sorting_answers'] )) {
4076
- if (in_array ( $input ['sorting_results'], array (
4077
- 'exact',
4078
- 'alphabetical',
4079
- 'random',
4080
- 'votes'
4081
- ) )) {
4082
- if ($default_options ['sorting_results'] != trim ( $input ['sorting_results'] )) {
4083
- $newinput ['sorting_results'] = trim ( $input ['sorting_results'] );
4084
- $updated .= __ ( 'Option "Sort Results" Updated!', 'yop_poll' ) . $message_delimiter;
4085
  }
4086
 
4087
  // sorting_results_direction
4088
- if (isset ( $input ['sorting_results_direction'] )) {
4089
- if (in_array ( $input ['sorting_results_direction'], array (
4090
- 'asc',
4091
- 'desc'
4092
- ) )) {
4093
- if ($default_options ['sorting_results_direction'] != trim ( $input ['sorting_results_direction'] )) {
4094
- $newinput ['sorting_results_direction'] = trim ( $input ['sorting_results_direction'] );
4095
- $updated .= __ ( 'Option "Sort Results Direction" Updated!', 'yop_poll' ) . $message_delimiter;
4096
  }
4097
- } else {
 
4098
  $newinput ['sorting_results_direction'] = $default_options ['sorting_results_direction'];
4099
- $errors .= __ ( 'Option "Sort Results Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
4100
  }
4101
  }
4102
- } else {
 
4103
  $newinput ['sorting_results'] = $default_options ['sorting_results'];
4104
- $errors .= __ ( 'Option "Sort Results" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
4105
  }
4106
  }
4107
 
4108
  // start_date
4109
- if (isset ( $input ['start_date'] )) {
4110
- if ('' != trim ( $input ['start_date'] )) {
4111
- if ($default_options ['start_date'] != trim ( $input ['start_date'] )) {
4112
- $newinput ['start_date'] = trim ( $input ['start_date'] );
4113
- $updated .= __ ( 'Option "Poll Start Date" Updated!', 'yop_poll' ) . $message_delimiter;
4114
  }
4115
- } else {
 
4116
  $newinput ['start_date'] = $default_options ['start_date'];
4117
- $errors .= __ ( 'Option "Poll Start Date" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4118
  }
4119
  }
4120
 
4121
  // never_expire
4122
- if ( ! isset ( $input ['never_expire'] ) ) {
4123
  $input ['never_expire'] = 'no';
4124
  }
4125
- if ('yes' == $input ['never_expire']) {
4126
- if ($default_options ['never_expire'] != trim ( $input ['never_expire'] )) {
4127
- $newinput ['never_expire'] = trim ( $input ['never_expire'] );
4128
- $newinput ['end_date'] = '9999-12-31 23:59:59';
4129
- $updated .= __ ( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
4130
  }
4131
- }
4132
  else {
4133
- if (isset ( $input ['end_date'] )) {
4134
- if ('' != $input ['end_date']) {
4135
- if ($default_options ['end_date'] != trim ( $input ['end_date'] )) {
4136
- $newinput ['end_date'] = $input ['end_date'];
4137
  $newinput ['never_expire'] = 'no';
4138
- $updated .= __ ( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
4139
  }
4140
- } else {
4141
- $errors .= __ ( 'Option "Poll End Date" Not Updated! The field is empty! ', 'yop_poll' ) . $message_delimiter;
 
4142
  }
4143
  }
4144
  }
4145
 
4146
  // view_results
4147
- if (isset ( $input ['view_results'] )) {
4148
- if (in_array ( $input ['view_results'], array (
4149
- 'before',
4150
- 'after',
4151
- 'after-poll-end-date',
4152
- 'never',
4153
- 'custom-date'
4154
- ) )) {
4155
- if ($default_options ['view_results'] != trim ( $input ['view_results'] )) {
4156
- $newinput ['view_results'] = trim ( $input ['view_results'] );
4157
- $updated .= __ ( 'Option "View Results" Updated!', 'yop_poll' ) . $message_delimiter;
4158
  }
4159
 
4160
- if ('custom-date' == $newinput ['view_results']) {
4161
  // view_results_start_date
4162
- if (isset ( $input ['view_results_start_date'] )) {
4163
- if ($default_options ['view_results_start_date'] != trim ( $input ['view_results_start_date'] )) {
4164
  $newinput ['view_results_start_date'] = $input ['view_results_start_date'];
4165
- $updated .= __ ( 'Option "View Results Custom Date" Updated!', 'yop_poll' ) . $message_delimiter;
4166
  }
4167
  }
4168
  }
4169
- } else {
 
4170
  $newinput ['view_results'] = $default_options ['view_results'];
4171
- $errors .= __ ( 'Option "View Results" Not Updated! Please choose between: \'Before\', \'After\', \'After Poll End Date\', \'Never\' or \'Custom Date\'', 'yop_poll' ) . $message_delimiter;
4172
  }
4173
  }
4174
 
4175
  // vote_permisions
4176
- if (isset ( $input ['view_results_permissions'] )) {
4177
- if (in_array ( $input ['view_results_permissions'], array (
4178
- 'quest-only',
4179
- 'registered-only',
4180
- 'guest-registered'
4181
- ) )) {
4182
- if ($default_options ['view_results_permissions'] != trim ( $input ['view_results_permissions'] )) {
4183
- $newinput ['view_results_permissions'] = trim ( $input ['view_results_permissions'] );
4184
- $updated .= __ ( 'Option "View Results Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
4185
  }
4186
- } else {
 
4187
  $newinput ['view_results_permissions'] = $default_options ['view_results_permissions'];
4188
- $errors .= __ ( 'Option "View Results Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
4189
  }
4190
  }
4191
 
4192
  // view_results_type
4193
- if (isset ( $input ['view_results_type'] )) {
4194
- if (in_array ( $input ['view_results_type'], array (
4195
- 'votes-number',
4196
- 'percentages',
4197
- 'votes-number-and-percentages'
4198
- ) )) {
4199
- if ($default_options ['view_results_type'] != trim ( $input ['view_results_type'] )) {
4200
- $newinput ['view_results_type'] = trim ( $input ['view_results_type'] );
4201
- $updated .= __ ( 'Option "View Results Type" Updated!', 'yop_poll' ) . $message_delimiter;
4202
  }
4203
- } else {
 
4204
  $newinput ['view_results_type'] = $default_options ['view_results_type'];
4205
- $errors .= __ ( 'Option "View Results Type" Not Updated! Please choose between: \'Votes number\', \'Percentages\' or \'Votes number and percentages\' ', 'yop_poll' ) . $message_delimiter;
4206
  }
4207
  }
4208
 
4209
  // answer_result_label
4210
- if (isset ( $input ['answer_result_label'] )) {
4211
- if ('votes-number' == $input ['view_results_type']) {
4212
- if (stripos ( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false) {
4213
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
4214
- $errors .= __ ( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES%!', 'yop_poll' ) . $message_delimiter;
4215
- } else {
4216
- if ($default_options ['answer_result_label'] != trim ( $input ['answer_result_label'] )) {
4217
- $newinput ['answer_result_label'] = trim ( $input ['answer_result_label'] );
4218
- $updated .= __ ( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
 
4219
  }
4220
  }
4221
  }
4222
 
4223
- if ('percentages' == $input ['view_results_type']) {
4224
- if (stripos ( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false) {
4225
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
4226
- $errors .= __ ( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
4227
- } else {
4228
- if ($default_options ['answer_result_label'] != trim ( $input ['answer_result_label'] )) {
4229
- $newinput ['answer_result_label'] = trim ( $input ['answer_result_label'] );
4230
- $updated .= __ ( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
 
4231
  }
4232
  }
4233
  }
4234
 
4235
- if ('votes-number-and-percentages' == $input ['view_results_type']) {
4236
- if (stripos ( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false) {
4237
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
4238
- $errors .= __ ( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
4239
- } elseif (stripos ( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false) {
 
4240
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
4241
- $errors .= __ ( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
4242
- } else {
4243
- if ($default_options ['answer_result_label'] != trim ( $input ['answer_result_label'] )) {
4244
- $newinput ['answer_result_label'] = trim ( $input ['answer_result_label'] );
4245
- $updated .= __ ( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
 
4246
  }
4247
  }
4248
  }
4249
  }
4250
 
4251
  // singular_answer_result_votes_number_label
4252
- if (isset ( $input ['singular_answer_result_votes_number_label'] )) {
4253
- if ('' != $input ['singular_answer_result_votes_number_label']) {
4254
- if ($default_options ['singular_answer_result_votes_number_label'] != trim ( $input ['singular_answer_result_votes_number_label'] )) {
4255
- $newinput ['singular_answer_result_votes_number_label'] = trim ( $input ['singular_answer_result_votes_number_label'] );
4256
- $updated .= __ ( 'Option "Poll Answer Result Votes Number Singular Label" Updated!', 'yop_poll' ) . $message_delimiter;
4257
  }
4258
- } else {
 
4259
  $newinput ['singular_answer_result_votes_number_label'] = $default_options ['singular_answer_result_votes_number_label'];
4260
- $errors .= __ ( 'Option "Poll Answer Result Votes Number Singular Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4261
  }
4262
  }
4263
 
4264
  // plural_answer_result_votes_number_label
4265
- if (isset ( $input ['plural_answer_result_votes_number_label'] )) {
4266
- if ('' != $input ['singular_answer_result_votes_number_label']) {
4267
- if ($default_options ['plural_answer_result_votes_number_label'] != trim ( $input ['plural_answer_result_votes_number_label'] )) {
4268
- $newinput ['plural_answer_result_votes_number_label'] = trim ( $input ['plural_answer_result_votes_number_label'] );
4269
- $updated .= __ ( 'Option "Poll Answer Result Votes Number Plural Label" Updated!', 'yop_poll' ) . $message_delimiter;
4270
  }
4271
- } else {
 
4272
  $newinput ['plural_answer_result_votes_number_label'] = $default_options ['plural_answer_result_votes_number_label'];
4273
- $errors .= __ ( 'Option "Poll Answer Result Votes Number Plural Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4274
  }
4275
  }
4276
 
4277
  // vote_button_label
4278
- if (isset ( $input ['vote_button_label'] )) {
4279
- if ('' != $input ['vote_button_label']) {
4280
- if ($default_options ['vote_button_label'] != trim ( $input ['vote_button_label'] )) {
4281
- $newinput ['vote_button_label'] = trim ( $input ['vote_button_label'] );
4282
- $updated .= __ ( 'Option "Vote Button Label" Updated!', 'yop_poll' ) . $message_delimiter;
4283
  }
4284
- } else {
 
4285
  $newinput ['vote_button_label'] = $default_options ['vote_button_label'];
4286
- $errors .= __ ( 'Option "Vote Button Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4287
  }
4288
  }
4289
 
4290
  // view_results_link
4291
- if (isset ( $input ['view_results_link'] )) {
4292
- if (in_array ( $input ['view_results_link'], array (
4293
- 'yes',
4294
- 'no'
4295
- ) )) {
4296
- if ($default_options ['view_results_link'] != trim ( $input ['view_results_link'] )) {
4297
- $newinput ['view_results_link'] = trim ( $input ['view_results_link'] );
4298
- $updated .= __ ( 'Option "View Results Link" Updated!', 'yop_poll' ) . $message_delimiter;
4299
  }
4300
 
4301
- if ('yes' == $input ['view_results_link']) {
4302
  // view_results_link_label
4303
- if (isset ( $input ['view_results_link_label'] )) {
4304
- if ('' != $input ['view_results_link_label']) {
4305
- if ($default_options ['view_results_link_label'] != trim ( $input ['view_results_link_label'] )) {
4306
- $newinput ['view_results_link_label'] = trim ( $input ['view_results_link_label'] );
4307
- $updated .= __ ( 'Option "View Results Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
4308
  }
4309
- } else {
 
4310
  $newinput ['view_results_link_label'] = $default_options ['view_results_link_label'];
4311
- $errors .= __ ( 'Option "View Results Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4312
  }
4313
  }
4314
  }
4315
- } else {
 
4316
  $newinput ['view_results_link'] = $default_options ['view_results_link'];
4317
- $errors .= __ ( 'Option "View Results Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4318
  }
4319
  }
4320
 
4321
  // view_back_to_vote_link
4322
- if (isset ( $input ['view_back_to_vote_link'] )) {
4323
- if (in_array ( $input ['view_back_to_vote_link'], array (
4324
- 'yes',
4325
- 'no'
4326
- ) )) {
4327
- if ($default_options ['view_back_to_vote_link'] != trim ( $input ['view_back_to_vote_link'] )) {
4328
- $newinput ['view_back_to_vote_link'] = trim ( $input ['view_back_to_vote_link'] );
4329
- $updated .= __ ( 'Option "View Back To Vote Link" Updated!', 'yop_poll' ) . $message_delimiter;
4330
  }
4331
 
4332
- if ('yes' == $input ['view_back_to_vote_link']) {
4333
  // view_results_link_label
4334
- if (isset ( $input ['view_back_to_vote_link_label'] )) {
4335
- if ('' != $input ['view_back_to_vote_link_label']) {
4336
- if ($default_options ['view_back_to_vote_link_label'] != trim ( $input ['view_back_to_vote_link_label'] )) {
4337
- $newinput ['view_back_to_vote_link_label'] = trim ( $input ['view_back_to_vote_link_label'] );
4338
- $updated .= __ ( 'Option "View Back to Vote Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
4339
  }
4340
- } else {
 
4341
  $newinput ['view_back_to_vote_link_label'] = $default_options ['view_back_to_vote_link_label'];
4342
- $errors .= __ ( 'Option "View Back to Vote Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4343
  }
4344
  }
4345
  }
4346
- } else {
 
4347
  $newinput ['view_back_to_vote_link'] = $default_options ['view_back_to_vote_link'];
4348
- $errors .= __ ( 'Option "View Back to Vote Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4349
  }
4350
  }
4351
 
4352
  // view_total_votes
4353
- if (isset ( $input ['view_total_votes'] )) {
4354
- if (in_array ( $input ['view_total_votes'], array (
4355
- 'yes',
4356
- 'no'
4357
- ) )) {
4358
- if ($default_options ['view_total_votes'] != trim ( $input ['view_total_votes'] )) {
4359
- $newinput ['view_total_votes'] = trim ( $input ['view_total_votes'] );
4360
- $updated .= __ ( 'Option "View Total Votes" Updated!', 'yop_poll' ) . $message_delimiter;
4361
  }
4362
 
4363
  // view_total_votes
4364
- if ('yes' == $input ['view_total_votes']) {
4365
- if (isset ( $input ['view_total_votes_label'] )) {
4366
- if (stripos ( $input ['view_total_votes_label'], '%POLL-TOTAL-VOTES%' ) === false) {
4367
  $newinput ['view_total_votes_label'] = $default_options ['view_total_votes_label'];
4368
- $errors .= __ ( 'You must use %POLL-TOTAL-VOTES% to define your Total Votes label!', 'yop_poll' ) . $message_delimiter;
4369
- } else {
4370
- if ($default_options ['view_total_votes_label'] != trim ( $input ['view_total_votes_label'] )) {
4371
- $newinput ['view_total_votes_label'] = trim ( $input ['view_total_votes_label'] );
4372
- $updated .= __ ( 'Option "View Total Votes Label" Updated!', 'yop_poll' ) . $message_delimiter;
 
4373
  }
4374
  }
4375
  }
4376
  }
4377
- } else {
 
4378
  $newinput ['view_total_votes'] = $default_options ['view_total_votes'];
4379
- $errors .= __ ( 'Option "View Total Votes" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4380
  }
4381
  }
4382
 
4383
  // view_total_answers
4384
- if (isset ( $input ['view_total_answers'] )) {
4385
- if (in_array ( $input ['view_total_answers'], array (
4386
- 'yes',
4387
- 'no'
4388
- ) )) {
4389
- if ($default_options ['view_total_answers'] != trim ( $input ['view_total_answers'] )) {
4390
- $newinput ['view_total_answers'] = trim ( $input ['view_total_answers'] );
4391
- $updated .= __ ( 'Option "View Total Answers" Updated!', 'yop_poll' ) . $message_delimiter;
4392
  }
4393
 
4394
  // view_total_answers
4395
- if ('yes' == $input ['view_total_answers']) {
4396
- if (isset ( $input ['view_total_answers_label'] )) {
4397
- if (stripos ( $input ['view_total_answers_label'], '%POLL-TOTAL-ANSWERS%' ) === false) {
4398
  $newinput ['view_total_answers_label'] = $default_options ['view_total_answers_label'];
4399
- $errors .= __ ( 'You must use %POLL-TOTAL-ANSWERS% to define your Total Answers label!', 'yop_poll' ) . $message_delimiter;
4400
- } else {
4401
- if ($default_options ['view_total_answers_label'] != trim ( $input ['view_total_answers_label'] )) {
4402
- $newinput ['view_total_answers_label'] = trim ( $input ['view_total_answers_label'] );
4403
- $updated .= __ ( 'Option "View Total Answers Label" Updated!', 'yop_poll' ) . $message_delimiter;
 
4404
  }
4405
  }
4406
  }
4407
  }
4408
- } else {
 
4409
  $newinput ['view_total_answers'] = $default_options ['view_total_answers'];
4410
- $errors .= __ ( 'Option "View Total Answers" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4411
  }
4412
  }
4413
 
4414
- if (isset ( $input ['message_after_vote'] )) {
4415
- if ($default_options ['message_after_vote'] != trim ( $input ['message_after_vote'] )) {
4416
- $newinput ['message_after_vote'] = trim ( $input ['message_after_vote'] );
4417
- $updated .= __ ( 'Option "Message After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4418
  }
4419
  }
4420
 
4421
  // use_default_loading_image
4422
- if (isset ( $input ['use_default_loading_image'] )) {
4423
- if (in_array ( $input ['use_default_loading_image'], array (
4424
- 'yes',
4425
- 'no'
4426
- ) )) {
4427
- if ($default_options ['use_default_loading_image'] != trim ( $input ['use_default_loading_image'] )) {
4428
- $newinput ['use_default_loading_image'] = trim ( $input ['use_default_loading_image'] );
4429
- $updated .= __ ( 'Option "Use Default Loading Image" Updated!', 'yop_poll' ) . $message_delimiter;
4430
  }
4431
 
4432
- if ('no' == $input ['use_default_loading_image']) {
4433
- if (isset ( $input ['loading_image_url'] )) {
4434
- if (stripos ( $input ['loading_image_url'], 'http' ) === false) {
4435
  $newinput ['loading_image_url'] = $default_options ['loading_image_url'];
4436
- $errors .= __ ( 'You must use a url like "http://.." to define your Loading Image Url!', 'yop_poll' ) . $message_delimiter;
4437
- } else {
4438
- if ($default_options ['loading_image_url'] != trim ( $input ['loading_image_url'] )) {
4439
- $newinput ['loading_image_url'] = trim ( $input ['loading_image_url'] );
4440
- $updated .= __ ( 'Option "Loading Image Url" Updated!', 'yop_poll' ) . $message_delimiter;
 
4441
  }
4442
  }
4443
  }
4444
  }
4445
- } else {
 
4446
  $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4447
- $errors .= __ ( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4448
  }
4449
  }
4450
 
4451
  // vote_permisions
4452
- if (isset ( $input ['vote_permisions'] )) {
4453
- if (in_array ( $input ['vote_permisions'], array (
4454
- 'quest-only',
4455
- 'registered-only',
4456
- 'guest-registered'
4457
- ) )) {
4458
- if ($default_options ['vote_permisions'] != trim ( $input ['vote_permisions'] )) {
4459
- $newinput ['vote_permisions'] = trim ( $input ['vote_permisions'] );
4460
- $updated .= __ ( 'Option "Vote Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
4461
  }
4462
 
4463
- if (in_array ( $input ['vote_permisions'], array (
4464
- 'registered-only',
4465
- 'guest-registered'
4466
- ) )) {
4467
 
4468
- if ( isset( $input['vote_permisions_facebook'] ) && in_array( $input['vote_permisions_facebook'], array( 'yes', 'no' ) ) ) {
4469
- if ( $default_options ['vote_permisions_facebook'] != trim ( $input ['vote_permisions_facebook'] ) ) {
4470
- $newinput ['vote_permisions_facebook'] = trim ( $input ['vote_permisions_facebook'] );
4471
- $updated .= __ ( 'Option "Vote as Facebook User" Updated!', 'yop_poll' ) . $message_delimiter;
4472
  }
4473
- if ( 'yes' == $input['vote_permisions_facebook'] ) {
4474
- if ( $default_options ['vote_permisions_facebook_label'] != trim ( $input ['vote_permisions_facebook_label'] ) ) {
4475
- $newinput ['vote_permisions_facebook_label'] = trim ( $input ['vote_permisions_facebook_label'] );
4476
- $updated .= __ ( 'Option "Vote as Facebook User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4477
- }
4478
  }
4479
  }
4480
- if ( isset( $input['vote_permisions_wordpress'] ) && in_array( $input['vote_permisions_wordpress'], array( 'yes', 'no' ) ) ) {
4481
- if ( $default_options ['vote_permisions_wordpress'] != trim ( $input ['vote_permisions_wordpress'] ) ) {
4482
- $newinput ['vote_permisions_wordpress'] = trim ( $input ['vote_permisions_wordpress'] );
4483
- $updated .= __ ( 'Option "Vote as Wordpress User" Updated!', 'yop_poll' ) . $message_delimiter;
4484
  }
4485
 
4486
- if ( 'yes' == $input['vote_permisions_wordpress'] ) {
4487
- if ( $default_options ['vote_permisions_wordpress_label'] != trim ( $input ['vote_permisions_wordpress_label'] ) ) {
4488
- $newinput ['vote_permisions_wordpress_label'] = trim ( $input ['vote_permisions_wordpress_label'] );
4489
- $updated .= __ ( 'Option "Vote as Wordpress User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4490
- }
4491
  }
4492
  }
4493
- if ( isset( $input['vote_permisions_anonymous'] ) && in_array( $input['vote_permisions_anonymous'], array( 'yes', 'no' ) ) ) {
4494
- if ( $default_options ['vote_permisions_anonymous'] != trim ( $input ['vote_permisions_anonymous'] ) ) {
4495
- $newinput ['vote_permisions_anonymous'] = trim ( $input ['vote_permisions_anonymous'] );
4496
- $updated .= __ ( 'Option "Vote as Anonymous User" Updated!', 'yop_poll' ) . $message_delimiter;
4497
  }
4498
 
4499
- if ( 'yes' == $input['vote_permisions_anonymous'] ) {
4500
- if ( $default_options ['vote_permisions_anonymous_label'] != trim ( $input ['vote_permisions_anonymous_label'] ) ) {
4501
- $newinput ['vote_permisions_anonymous_label'] = trim ( $input ['vote_permisions_anonymous_label'] );
4502
- $updated .= __ ( 'Option "Vote as Anonymous User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4503
- }
4504
  }
4505
  }
4506
  }
4507
- } else {
 
4508
  $newinput ['vote_permisions'] = $default_options ['vote_permisions'];
4509
- $errors .= __ ( 'Option "Vote Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
4510
  }
4511
  }
4512
 
4513
  // blocking_voters
4514
- if (isset ( $input ['blocking_voters'] )) {
4515
- if (in_array ( $input ['blocking_voters'], array (
4516
- 'dont-block',
4517
- 'cookie',
4518
- 'ip',
4519
- 'username',
4520
- 'cookie-ip'
4521
- ) )) {
4522
- if ($default_options ['blocking_voters'] != trim ( $input ['blocking_voters'] )) {
4523
- $newinput ['blocking_voters'] = trim ( $input ['blocking_voters'] );
4524
- $updated .= __ ( 'Option "Blocking Voters" Updated!', 'yop_poll' ) . $message_delimiter;
4525
  }
4526
 
4527
- if ('dont-block' != $newinput ['blocking_voters']) {
4528
  // blocking_voters_interval_value
4529
- if (isset ( $input ['blocking_voters_interval_value'] )) {
4530
- if (ctype_digit ( $input ['blocking_voters_interval_value'] )) {
4531
- if ($default_options ['blocking_voters_interval_value'] != trim ( $input ['blocking_voters_interval_value'] )) {
4532
- $newinput ['blocking_voters_interval_value'] = trim ( $input ['blocking_voters_interval_value'] );
4533
- $updated .= __ ( 'Option "Blocking Voters Interval Value" Updated!', 'yop_poll' ) . $message_delimiter;
4534
  }
4535
- } else {
 
4536
  $newinput ['blocking_voters_interval_value'] = $default_options ['blocking_voters_interval_value'];
4537
- $errors .= __ ( 'Option "Blocking Voters Interval Value" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4538
  }
4539
  }
4540
 
4541
  // blocking_voters_interval_unit
4542
- if (isset ( $input ['blocking_voters_interval_unit'] )) {
4543
- if (in_array ( $input ['blocking_voters_interval_unit'], array (
4544
- 'seconds',
4545
- 'minutes',
4546
- 'hours',
4547
- 'days'
4548
- ) )) {
4549
- if ($default_options ['blocking_voters_interval_unit'] != trim ( $input ['blocking_voters_interval_unit'] )) {
4550
- $newinput ['blocking_voters_interval_unit'] = trim ( $input ['blocking_voters_interval_unit'] );
4551
- $updated .= __ ( 'Option "Blocking Voters Interval Unit" Updated!', 'yop_poll' ) . $message_delimiter;
4552
  }
4553
- } else {
 
4554
  $newinput ['blocking_voters_interval_unit'] = $default_options ['blocking_voters_interval_unit'];
4555
- $errors .= __ ( 'Option "Blocking Voters Interval Unit" Not Updated! Please choose between \'Seconds\', \'Minutes\', \'Hours\' or \'Days\'', 'yop_poll' ) . $message_delimiter;
4556
  }
4557
  }
4558
  }
4559
- } else {
 
4560
  $newinput ['blocking_voters'] = $default_options ['blocking_voters'];
4561
- $errors .= __ ( 'Option "Blocking Voters" Not Updated! Please choose between: \'Don`t Block\', \'Cookie\', \'Ip\', \'Username\', \'Cookie and Ip\'', 'yop_poll' ) . $message_delimiter;
4562
  }
4563
  }
4564
 
4565
  // limit_number_of_votes_per_user
4566
- if (isset ( $input ['limit_number_of_votes_per_user'] )) {
4567
- if (in_array ( $input ['limit_number_of_votes_per_user'], array (
4568
- 'yes',
4569
- 'no'
4570
- ) )) {
4571
- if ($default_options ['limit_number_of_votes_per_user'] != trim ( $input ['limit_number_of_votes_per_user'] )) {
4572
- $newinput ['limit_number_of_votes_per_user'] = trim ( $input ['limit_number_of_votes_per_user'] );
4573
- $updated .= __ ( 'Option "Limit Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
4574
  }
4575
 
4576
- if ('yes' == $input ['limit_number_of_votes_per_user']) {
4577
- if (isset ( $input ['number_of_votes_per_user'] )) {
4578
- if (intval ( $input ['number_of_votes_per_user'] ) <= 0 ) {
4579
  $newinput ['number_of_votes_per_user'] = $default_options ['number_of_votes_per_user'];
4580
- $errors .= __ ( '"Number of Votes per User" must be a number > 0 !', 'yop_poll' ) . $message_delimiter;
4581
- } else {
4582
- if ($default_options ['number_of_votes_per_user'] != $input ['number_of_votes_per_user'] ) {
4583
- $newinput ['number_of_votes_per_user'] = trim ( $input ['number_of_votes_per_user'] );
4584
- $updated .= __ ( 'Option "Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
 
4585
  }
4586
  }
4587
  }
4588
  }
4589
- } else {
 
4590
  $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4591
- $errors .= __ ( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4592
  }
4593
  }
4594
 
4595
  // percentages_decimals
4596
- if (isset ( $input ['percentages_decimals'] )) {
4597
- if (ctype_digit ( $input ['percentages_decimals'] )) {
4598
- if ($default_options ['percentages_decimals'] != trim ( $input ['percentages_decimals'] )) {
4599
- $newinput ['percentages_decimals'] = trim ( $input ['percentages_decimals'] );
4600
- $updated .= __ ( 'Option "Percentages Decimals" Updated!', 'yop_poll' ) . $message_delimiter;
4601
  }
4602
- } else {
 
4603
  $newinput ['percentages_decimals'] = $default_options ['percentages_decimals'];
4604
- $errors .= __ ( 'Option "Percentages Decimals" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4605
  }
4606
  }
4607
 
4608
  // redirect_after_vote
4609
- if (isset ( $input ['redirect_after_vote'] )) {
4610
- if (in_array ( $input ['redirect_after_vote'], array (
4611
- 'yes',
4612
- 'no'
4613
- ) )) {
4614
- if ($default_options ['redirect_after_vote'] != trim ( $input ['redirect_after_vote'] )) {
4615
- $newinput ['redirect_after_vote'] = trim ( $input ['redirect_after_vote'] );
4616
- $updated .= __ ( 'Option "Redirect After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4617
  }
4618
 
4619
- if ('yes' == $input ['redirect_after_vote']) {
4620
  // archive_order
4621
- if (isset ( $input ['redirect_after_vote_url'] )) {
4622
- if ( '' != $input ['redirect_after_vote_url'] ) {
4623
- if ($default_options ['redirect_after_vote_url'] != trim ( $input ['redirect_after_vote_url'] )) {
4624
- $newinput ['redirect_after_vote_url'] = trim ( $input ['redirect_after_vote_url'] );
4625
- $updated .= __ ( 'Option "Redirect After Vote Url" Updated!', 'yop_poll' ) . $message_delimiter;
4626
  }
4627
- } else {
 
4628
  $newinput ['redirect_after_vote_url'] = $default_options ['redirect_after_vote_url'];
4629
- $errors .= __ ( 'Option "Redirect After Vote Url" Not Updated! Please fill in an url!', 'yop_poll' ) . $message_delimiter;
4630
  }
4631
  }
4632
  }
4633
- } else {
 
4634
  $newinput ['redirect_after_vote'] = $default_options ['redirect_after_vote'];
4635
- $errors .= __ ( 'Option ""Redirect After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4636
  }
4637
  }
4638
 
4639
  // date_format
4640
- if (isset ( $input ['date_format'] )) {
4641
- if ($default_options ['date_format'] != trim ( $input ['date_format'] )) {
4642
- $newinput ['date_format'] = trim ( $input ['date_format'] );
4643
- $updated .= __ ( 'Option "Poll Date Format" Updated!', 'yop_poll' ) . $message_delimiter;
4644
  }
4645
  }
4646
 
4647
  // view_poll_archive_link
4648
- if (isset ( $input ['view_poll_archive_link'] )) {
4649
- if (in_array ( $input ['view_poll_archive_link'], array (
4650
- 'yes',
4651
- 'no'
4652
- ) )) {
4653
- if ($default_options ['view_poll_archive_link'] != trim ( $input ['view_poll_archive_link'] )) {
4654
- $newinput ['view_poll_archive_link'] = trim ( $input ['view_poll_archive_link'] );
4655
- $updated .= __ ( 'Option "View Poll Archive Link" Updated!', 'yop_poll' ) . $message_delimiter;
4656
  }
4657
 
4658
- if ('yes' == $input ['view_poll_archive_link']) {
4659
  // view_results_link_label
4660
- if (isset ( $input ['view_poll_archive_link_label'] )) {
4661
- if ('' != $input ['view_poll_archive_link_label']) {
4662
- if ($default_options ['view_poll_archive_link_label'] != trim ( $input ['view_poll_archive_link_label'] )) {
4663
- $newinput ['view_poll_archive_link_label'] = trim ( $input ['view_poll_archive_link_label'] );
4664
- $updated .= __ ( 'Option "View Poll Archive Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
4665
  }
4666
- } else {
 
4667
  $newinput ['view_poll_archive_link_label'] = $default_options ['view_poll_archive_link_label'];
4668
- $errors .= __ ( 'Option "View Poll Archive Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4669
  }
4670
  }
4671
 
4672
- if (isset ( $input ['poll_archive_url'] )) {
4673
- if ('' != $input ['poll_archive_url']) {
4674
- if ($default_options ['poll_archive_url'] != trim ( $input ['poll_archive_url'] )) {
4675
- $newinput ['poll_archive_url'] = trim ( $input ['poll_archive_url'] );
4676
- $updated .= __ ( 'Option "Poll Archive URL" Updated!', 'yop_poll' ) . $message_delimiter;
4677
  }
4678
- } else {
 
4679
  $newinput ['poll_archive_url'] = $default_options ['poll_archive_url'];
4680
- $errors .= __ ( 'Option "Poll Archive URL" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4681
  }
4682
  }
4683
  }
4684
- } else {
 
4685
  $newinput ['view_poll_archive_link'] = $default_options ['view_poll_archive_link'];
4686
- $errors .= __ ( 'Option "View Poll Archive Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4687
  }
4688
  }
4689
 
4690
  // show_in_archive
4691
- if (isset ( $input ['show_in_archive'] )) {
4692
- if (in_array ( $input ['show_in_archive'], array (
4693
- 'yes',
4694
- 'no'
4695
- ) )) {
4696
- if ($default_options ['show_in_archive'] != trim ( $input ['show_in_archive'] )) {
4697
- $newinput ['show_in_archive'] = trim ( $input ['show_in_archive'] );
4698
- $updated .= __ ( 'Option "Show Poll in Arhive" Updated!', 'yop_poll' ) . $message_delimiter;
4699
  }
4700
 
4701
- if ('yes' == $input ['show_in_archive']) {
4702
  // archive_order
4703
- if (isset ( $input ['archive_order'] )) {
4704
- if (ctype_digit ( $input ['archive_order'] )) {
4705
- if ($default_options ['archive_order'] != trim ( $input ['archive_order'] )) {
4706
- $newinput ['archive_order'] = trim ( $input ['archive_order'] );
4707
- $updated .= __ ( 'Option "Archive Order" Updated!', 'yop_poll' ) . $message_delimiter;
4708
  }
4709
- } else {
 
4710
  $newinput ['archive_order'] = $default_options ['archive_order'];
4711
- $errors .= __ ( 'Option "Archive Order" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4712
  }
4713
  }
4714
  }
4715
- } else {
 
4716
  $newinput ['show_in_archive'] = $default_options ['show_in_archive'];
4717
- $errors .= __ ( 'Option "Show Poll in Archive" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4718
  }
4719
  }
4720
 
4721
  // send_email_notifications
4722
- if (isset ( $input ['send_email_notifications'] )) {
4723
- if (in_array ( $input ['send_email_notifications'], array (
4724
- 'yes',
4725
- 'no'
4726
- ) )) {
4727
- if ($default_options ['send_email_notifications'] != trim ( $input ['send_email_notifications'] )) {
4728
- $newinput ['send_email_notifications'] = trim ( $input ['send_email_notifications'] );
4729
- $updated .= __ ( 'Option "Send Email Notifications" Updated!', 'yop_poll' ) . $message_delimiter;
4730
  }
4731
 
4732
- if ('yes' == $input ['send_email_notifications']) {
4733
  // email_notifications_from_name
4734
- if (isset ( $input ['email_notifications_from_name'] )) {
4735
- if ( '' != $input ['email_notifications_from_name'] ) {
4736
- if ($default_options ['email_notifications_from_name'] != trim ( $input ['email_notifications_from_name'] )) {
4737
- $newinput ['email_notifications_from_name'] = trim ( $input ['email_notifications_from_name'] );
4738
- $updated .= __ ( 'Option "Notifications From Name" Updated!', 'yop_poll' ) . $message_delimiter;
4739
  }
4740
- } else {
 
4741
  $newinput ['email_notifications_from_name'] = $default_options ['email_notifications_from_name'];
4742
- $errors .= __ ( 'Option "Notifications From Name" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4743
  }
4744
  }
4745
 
4746
  // email_notifications_from_email
4747
- if (isset ( $input ['email_notifications_from_email'] )) {
4748
- if ( '' != $input ['email_notifications_from_email'] ) {
4749
- if ($default_options ['email_notifications_from_email'] != trim ( $input ['email_notifications_from_email'] )) {
4750
- $newinput ['email_notifications_from_email'] = trim ( $input ['email_notifications_from_email'] );
4751
- $updated .= __ ( 'Option "Notifications From Email" Updated!', 'yop_poll' ) . $message_delimiter;
4752
  }
4753
- } else {
 
4754
  $newinput ['email_notifications_from_email'] = $default_options ['email_notifications_from_email'];
4755
- $errors .= __ ( 'Option "Notifications From Email" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4756
  }
4757
  }
4758
 
4759
  // email_notifications_recipients
4760
- if (isset ( $input ['email_notifications_recipients'] )) {
4761
- if ( '' != $input ['email_notifications_recipients'] ) {
4762
- if ($default_options ['email_notifications_recipients'] != trim ( $input ['email_notifications_recipients'] )) {
4763
- $newinput ['email_notifications_recipients'] = trim ( $input ['email_notifications_recipients'] );
4764
- $updated .= __ ( 'Option "Email Notifications Recipients" Updated!', 'yop_poll' ) . $message_delimiter;
4765
  }
4766
- } else {
 
4767
  $newinput ['email_notifications_recipients'] = $default_options ['email_notifications_recipients'];
4768
- $errors .= __ ( 'Option "Email Notifications Recipients" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4769
  }
4770
  }
4771
 
4772
  // email_notifications_subject
4773
- if (isset ( $input ['email_notifications_subject'] )) {
4774
- if ( '' != $input ['email_notifications_subject'] ) {
4775
- if ($default_options ['email_notifications_subject'] != trim ( $input ['email_notifications_subject'] )) {
4776
- $newinput ['email_notifications_subject'] = trim ( $input ['email_notifications_subject'] );
4777
- $updated .= __ ( 'Option "Email Notifications Subject" Updated!', 'yop_poll' ) . $message_delimiter;
4778
  }
4779
- } else {
 
4780
  $newinput ['email_notifications_subject'] = $default_options ['email_notifications_subject'];
4781
- $errors .= __ ( 'Option "Email Notifications Subject" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4782
  }
4783
  }
4784
 
4785
  // email_notifications_subject
4786
- if (isset ( $input ['email_notifications_body'] )) {
4787
- if ( '' != $input ['email_notifications_body'] ) {
4788
- if ($default_options ['email_notifications_body'] != trim ( $input ['email_notifications_body'] )) {
4789
- $newinput ['email_notifications_body'] = trim ( $input ['email_notifications_body'] );
4790
- $updated .= __ ( 'Option "Email Notifications Body" Updated!', 'yop_poll' ) . $message_delimiter;
4791
  }
4792
- } else {
 
4793
  $newinput ['email_notifications_body'] = $default_options ['email_notifications_body'];
4794
- $errors .= __ ( 'Option "Email Notifications Body" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4795
  }
4796
  }
4797
  }
4798
- } else {
 
4799
  $newinput ['send_email_notifications'] = $default_options ['send_email_notifications'];
4800
- $errors .= __ ( 'Option "Send Email Notifications" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4801
  }
4802
  }
4803
 
4804
  // archive_polls_per_page
4805
- if (isset ( $input ['archive_polls_per_page'] )) {
4806
- if (ctype_digit ( $input ['archive_polls_per_page'] )) {
4807
- if ($default_options ['archive_polls_per_page'] != trim ( $input ['archive_polls_per_page'] )) {
4808
- $newinput ['archive_polls_per_page'] = trim ( $input ['archive_polls_per_page'] );
4809
- $updated .= __ ( 'Option "Archive Polls Per Page', 'yop_poll' ) . $message_delimiter;
4810
  }
4811
- } else {
 
4812
  $newinput ['archive_polls_per_page'] = $default_options ['archive_polls_per_page'];
4813
- $errors .= __ ( 'Option "Archive Polls Per Page" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4814
  }
4815
  }
4816
 
4817
  //share after vote
4818
- if ( isset ( $input ['share_after_vote'] ) ) {
4819
- if (in_array ( $input ['share_after_vote'], array (
4820
- 'yes',
4821
- 'no'
4822
- ) )) {
4823
- if ($default_options ['share_after_vote'] != trim ( $input ['share_after_vote'] )) {
4824
- $newinput ['share_after_vote'] = trim ( $input ['share_after_vote'] );
4825
- $updated .= __ ( 'Option "Share After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4826
  }
4827
 
4828
- if ('yes' == $input ['share_after_vote']) {
4829
  // share_name
4830
- if (isset ( $input ['share_name'] ) ) {
4831
- if ($default_options ['share_name'] != trim ( $input ['share_name'] )) {
4832
- $newinput ['share_name'] = trim ( $input ['share_name'] );
4833
- $updated .= __ ( 'Option "Share Name" Updated!', 'yop_poll' ) . $message_delimiter;
4834
  }
4835
  }
4836
  // share_caption
4837
- if (isset ( $input ['share_caption'] ) ) {
4838
- if ($default_options ['share_caption'] != trim ( $input ['share_caption'] )) {
4839
- $newinput ['share_caption'] = trim ( $input ['share_caption'] );
4840
- $updated .= __ ( 'Option "Share Caption" Updated!', 'yop_poll' ) . $message_delimiter;
4841
  }
4842
  }
4843
  // share_description
4844
- if (isset ( $input ['share_description'] ) ) {
4845
- if ($default_options ['share_description'] != trim ( $input ['share_description'] )) {
4846
- $newinput ['share_description'] = trim ( $input ['share_description'] );
4847
- $updated .= __ ( 'Option "Share Description" Updated!', 'yop_poll' ) . $message_delimiter;
4848
  }
4849
  }
4850
  // share_picture
4851
- if (isset ( $input ['share_picture'] ) ) {
4852
- if ($default_options ['share_picture'] != trim ( $input ['share_picture'] )) {
4853
- $newinput ['share_picture'] = trim ( $input ['share_picture'] );
4854
- $updated .= __ ( 'Option "Share Picture" Updated!', 'yop_poll' ) . $message_delimiter;
4855
  }
4856
  }
4857
- }
4858
  }
4859
  else {
4860
  $newinput ['share_after_vote'] = $default_options ['share_after_vote'];
4861
- $errors .= __ ( 'Option "Share After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4862
- }
4863
  }
4864
 
4865
  //start_scheduler
4866
- if ( isset ( $input ['start_scheduler'] ) ) {
4867
- if (in_array ( $input ['start_scheduler'], array (
4868
- 'yes',
4869
- 'no'
4870
- ) )) {
4871
- if ($default_options ['start_scheduler'] != trim ( $input ['start_scheduler'] )) {
4872
- $newinput ['start_scheduler'] = trim ( $input ['start_scheduler'] );
4873
- $updated .= __ ( 'Option "Start Scheduler" Updated!', 'yop_poll' ) . $message_delimiter;
4874
- }
4875
  }
4876
  else {
4877
  $newinput ['start_scheduler'] = $default_options ['start_scheduler'];
4878
- $errors .= __ ( 'Option "Start Scheduler" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4879
- }
4880
  }
4881
  }
4882
  else {
4883
- $errors .= __ ( 'Bad Request!', 'yop_poll' ) . $message_delimiter;
4884
  }
4885
 
4886
- if ('' != $errors)
4887
- add_settings_error ( 'general', 'yop-poll-errors', $errors, 'error' );
4888
- if ('' != $updated)
4889
- add_settings_error ( 'general', 'yop-poll-updates', $updated, 'updated' );
4890
 
4891
  return $newinput;
4892
  }
 
4893
  public function view_yop_poll_options() {
4894
- require_once (ABSPATH . '/wp-admin/options-head.php');
4895
  global $page;
4896
- $default_options = get_option ( 'yop_poll_options', array () );
4897
- $pro_options = get_option ( 'yop_poll_pro_options' );
4898
  ?>
4899
  <div class="wrap">
4900
  <div class="icon32 icon32-yop-poll">
@@ -4903,17 +4475,17 @@ EOT;
4903
  </div>
4904
  <h2><?php _e( 'Yop Poll Options', 'yop_poll' ); ?></h2>
4905
  <div id="message"></div>
4906
- <br />
4907
 
4908
  <form action="options.php" method="post">
4909
  <div id="poststuff">
4910
  <div id="post-body" class="metabox-holder columns-2">
4911
  <div id="post-body-content">
4912
- <?php settings_fields('yop_poll_options'); ?>
4913
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
4914
  <div class="postbox" id="yop-poll-advanced-options-div1">
4915
  <div title="Click to toggle" class="handlediv">
4916
- <br />
4917
  </div>
4918
  <h3 class="hndle">
4919
  <span><?php _e( 'Answers options', 'yop_poll' ); ?></span>
@@ -4927,60 +4499,61 @@ EOT;
4927
  </th>
4928
  <td><label for="yop-poll-allow-other-answers-no"><input
4929
  id="yop-poll-allow-other-answers-no"
4930
- <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4931
  type="radio" name="yop_poll_options[allow_other_answers]"
4932
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4933
  for="yop-poll-allow-other-answers-yes"><input
4934
  id="yop-poll-allow-other-answers-yes"
4935
- <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4936
  type="radio" name="yop_poll_options[allow_other_answers]"
4937
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4938
  </tr>
4939
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4940
  <th>
4941
  <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
4942
  </th>
4943
  <td><input id="yop-poll-other-answers-label" type="text"
4944
  name="yop_poll_options[other_answers_label]"
4945
- value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>" />
4946
  <input type="hidden"
4947
  name="yop_poll_options[other_answers_id]"
4948
- value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>" />
4949
  </td>
4950
  </tr>
4951
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4952
  <th>
4953
- <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>:<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>
 
4954
  </th>
4955
  <td>
4956
  <label for="yop-poll-add-other-answers-to-default-answers-no"><input
4957
  id="yop-poll-add-other-answers-to-default-answers-no"
4958
- <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4959
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4960
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4961
  for="yop-poll-add-other-answers-to-default-answers-yes"><input
4962
  id="yop-poll-add-other-answers-to-default-answers-yes"
4963
- <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4964
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4965
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4966
  </td>
4967
  </tr>
4968
- <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4969
  <th>
4970
  <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
4971
  </th>
4972
  <td><label for="yop-poll-display-other-answers-values-no"><input
4973
  id="yop-poll-display-other-answers-values-no"
4974
- <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4975
  type="radio"
4976
  name="yop_poll_options[display_other_answers_values]"
4977
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4978
  for="yop-poll-display-other-answers-values-yes"><input
4979
  id="yop-poll-display-other-answers-values-yes"
4980
- <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4981
  type="radio"
4982
  name="yop_poll_options[display_other_answers_values]"
4983
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4984
  </tr>
4985
  <tr>
4986
  <th>
@@ -4988,35 +4561,35 @@ EOT;
4988
  </th>
4989
  <td><label for="yop-poll-allow-multiple-answers-no"><input
4990
  id="yop-poll-allow-multiple-answers-no"
4991
- <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
4992
  type="radio"
4993
- name="yop_poll_options[allow_multiple_answers]" value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label>
4994
  <label for="yop-poll-allow-multiple-answers-yes"><input
4995
  id="yop-poll-allow-multiple-answers-yes"
4996
- <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
4997
  type="radio"
4998
- name="yop_poll_options[allow_multiple_answers]" value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4999
 
5000
  </td>
5001
  </tr>
5002
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
5003
  <th>
5004
  <?php _e( 'Max Number of allowed answers', 'yop_poll' ); ?>:
5005
  </th>
5006
  <td><input id="yop-poll-allow-multiple-answers-number"
5007
  type="text"
5008
  name="yop_poll_options[allow_multiple_answers_number]"
5009
- value="<?php echo $default_options['allow_multiple_answers_number']; ?>" />
5010
  </td>
5011
  </tr>
5012
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
5013
  <th>
5014
  <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
5015
  </th>
5016
  <td><input id="yop-poll-allow-multiple-answers-min-number"
5017
  type="text"
5018
  name="yop_poll_options[allow_multiple_answers_min_number]"
5019
- value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>" />
5020
  </td>
5021
  </tr>
5022
  </tbody>
@@ -5025,7 +4598,7 @@ EOT;
5025
  </div>
5026
  <div class="postbox" id="yop-poll-advanced-options-div2">
5027
  <div title="Click to toggle" class="handlediv">
5028
- <br />
5029
  </div>
5030
  <h3 class="hndle">
5031
  <span><?php _e( 'Display Options', 'yop_poll' ); ?></span>
@@ -5039,14 +4612,14 @@ EOT;
5039
  </th>
5040
  <td><label for="yop-poll-use-captcha-no"><input
5041
  id="yop-poll-use-captcha-no"
5042
- <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
5043
  type="radio" name="yop_poll_options[use_captcha]"
5044
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
5045
  for="yop-poll-use-captcha-yes"><input
5046
  id="yop-poll-use-captcha-yes"
5047
- <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
5048
  type="radio" name="yop_poll_options[use_captcha]"
5049
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
5050
  </tr>
5051
  <tr>
5052
  <th>
@@ -5054,29 +4627,29 @@ EOT;
5054
  </th>
5055
  <td><label for="yop-poll-display-answers-vertical"><input
5056
  id="yop-poll-display-answers-vertical"
5057
- <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
5058
  type="radio" name="yop_poll_options[display_answers]"
5059
- value="vertical" /> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
5060
  <label for="yop-poll-display-answers-orizontal"><input
5061
  id="yop-poll-display-answers-orizontal"
5062
- <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
5063
  type="radio" name="yop_poll_options[display_answers]"
5064
- value="orizontal" /> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
5065
  <label for="yop-poll-display-answers-tabulated"><input
5066
  id="yop-poll-display-answers-tabulated"
5067
- <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
5068
  type="radio" name="yop_poll_options[display_answers]"
5069
- value="tabulated" /> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
5070
  </td>
5071
  </tr>
5072
- <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
5073
  <th>
5074
  <?php _e( 'Columns', 'yop_poll' ); ?>:
5075
  </th>
5076
  <td><input id="yop-poll-display-answers-tabulated-cols"
5077
  type="text"
5078
  name="yop_poll_options[display_answers_tabulated_cols]"
5079
- value="<?php echo $default_options['display_answers_tabulated_cols']; ?>" />
5080
  </td>
5081
  </tr>
5082
  <tr>
@@ -5085,29 +4658,29 @@ EOT;
5085
  </th>
5086
  <td><label for="yop-poll-display-results-vertical"><input
5087
  id="yop-poll-display-results-vertical"
5088
- <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
5089
  type="radio" name="yop_poll_options[display_results]"
5090
  value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
5091
  <label for="yop-poll-display-results-orizontal"><input
5092
  id="yop-poll-display-results-orizontal"
5093
- <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
5094
  type="radio" name="yop_poll_options[display_results]"
5095
  value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
5096
  <label for="yop-poll-display-results-tabulated"><input
5097
  id="yop-poll-display-results-tabulated"
5098
- <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
5099
  type="radio" name="yop_poll_options[display_results]"
5100
  value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
5101
  </td>
5102
  </tr>
5103
- <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
5104
  <th>
5105
  <?php _e( 'Columns', 'yop_poll' ); ?>:
5106
  </th>
5107
  <td><input id="yop-poll-display-results-tabulated-cols"
5108
  type="text"
5109
  name="yop_poll_options[display_results_tabulated_cols]"
5110
- value="<?php echo $default_options['display_results_tabulated_cols']; ?>" />
5111
  </td>
5112
  </tr>
5113
  <tr>
@@ -5117,7 +4690,7 @@ EOT;
5117
  <td><input id="yop-poll-template-width"
5118
  type="text"
5119
  name="yop_poll_options[template_width]"
5120
- value="<?php echo $default_options['template_width']; ?>" />
5121
  </td>
5122
  </tr>
5123
  <tr>
@@ -5127,7 +4700,7 @@ EOT;
5127
  <td><input id="yop-poll-widget-template-width"
5128
  type="text"
5129
  name="yop_poll_options[widget_template_width]"
5130
- value="<?php echo $default_options['widget_template_width']; ?>" />
5131
  </td>
5132
  </tr>
5133
  </tbody>
@@ -5136,7 +4709,7 @@ EOT;
5136
  </div>
5137
  <div class="postbox" id="yop-poll-advanced-options-div3">
5138
  <div title="Click to toggle" class="handlediv">
5139
- <br />
5140
  </div>
5141
  <h3 class="hndle">
5142
  <span><?php _e( 'Poll Bar Style', 'yop_poll' ); ?></span>
@@ -5150,55 +4723,55 @@ EOT;
5150
  </th>
5151
  <td><label for="yop-poll-use-template-bar-no"><input
5152
  id="yop-poll-use-template-bar-no"
5153
- <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
5154
  type="radio" name="yop_poll_options[use_template_bar]"
5155
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
5156
  for="yop-poll-use-template-bar-yes"><input
5157
  id="yop-poll-use-template-bar-yes"
5158
- <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
5159
  type="radio" name="yop_poll_options[use_template_bar]"
5160
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
5161
  </tr>
5162
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5163
- <th><label for="yop-poll-bar-background"><?php _e ( 'Background Color', 'yop_poll' ); ?></label>
5164
  </th>
5165
  <td>#<input class="yop-small-input"
5166
  id="yop-poll-bar-background"
5167
  value="<?php echo $default_options['bar_background']; ?>"
5168
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
5169
- type="text" name="yop_poll_options[bar_background]" />
5170
  </td>
5171
  </tr>
5172
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5173
- <th><label for="yop-poll-bar-height"><?php _e ( 'Height', 'yop_poll' ); ?></label>
5174
  </th>
5175
  <td><input class="yop-small-input" id="yop-poll-bar-height"
5176
  value="<?php echo $default_options['bar_height']; ?>"
5177
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
5178
- type="text" name="yop_poll_options[bar_height]" /> px</td>
5179
  </tr>
5180
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5181
- <th><label for="yop-poll-bar-border-color"><?php _e ( 'Border Color', 'yop_poll' ) ?></label>
5182
  </th>
5183
  <td>#<input class="yop-small-input"
5184
  id="yop-poll-bar-border-color"
5185
  value="<?php echo $default_options['bar_border_color']; ?>"
5186
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
5187
- type="text" name="yop_poll_options[bar_border_color]" />
5188
  </td>
5189
  </tr>
5190
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5191
- <th><label for="yop-poll-bar-border-width"><?php _e ( 'Border Width', 'yop_poll' ); ?></label>
5192
  </th>
5193
  <td><input class="yop-small-input"
5194
  id="yop-poll-bar-border-width"
5195
  value="<?php echo $default_options['bar_border_width']; ?>"
5196
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
5197
- type="text" name="yop_poll_options[bar_border_width]" /> px
5198
  </td>
5199
  </tr>
5200
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5201
- <th><label for="yop-poll-bar-border-style"><?php _e ( 'Border Style', 'yop_poll' ); ?></label>
5202
  </th>
5203
  <td><select id="yop-poll-bar-border-style"
5204
  onchange="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-style', this.value)"
@@ -5214,14 +4787,18 @@ EOT;
5214
  value="dotted">Dotted</option>
5215
  </select></td>
5216
  </tr>
5217
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
5218
- <th><label><?php _e ( 'Yop Poll Bar Preview', 'yop_poll' ); ?></label>
5219
  </th>
5220
  <td>
5221
- <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>px; background-color:#<?php
 
5222
 
5223
  echo $default_options ['bar_background'];
5224
- ?>; border-style: <?php echo $default_options['bar_border_style']; ?>; border-width: <?php echo $default_options['bar_border_width']; ?>px; border-color: #<?php
 
 
 
5225
 
5226
  echo $default_options ['bar_border_color'];
5227
  ?>;"></div>
@@ -5233,7 +4810,7 @@ EOT;
5233
  </div>
5234
  <div class="postbox" id="yop-poll-advanced-options-div4">
5235
  <div title="Click to toggle" class="handlediv">
5236
- <br />
5237
  </div>
5238
  <h3 class="hndle">
5239
  <span><?php _e( 'Sorting Answers &amp; Results', 'yop_poll' ); ?></span>
@@ -5245,22 +4822,22 @@ EOT;
5245
  <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
5246
  <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
5247
  id="yop_poll_sorting_answers_exact"
5248
- <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
5249
  type="radio" name="yop_poll_options[sorting_answers]"
5250
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
5251
  <label for="yop_poll_sorting_answers_alphabetical"><input
5252
  id="yop_poll_sorting_answers_alphabetical"
5253
- <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
5254
  type="radio" name="yop_poll_options[sorting_answers]"
5255
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
5256
  <label for="yop_poll_sorting_answers_random"><input
5257
  id="yop_poll_sorting_answers_random"
5258
- <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
5259
  type="radio" name="yop_poll_options[sorting_answers]"
5260
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
5261
  <label for="yop_poll_sorting_answers_votes"><input
5262
  id="yop_poll_sorting_answers_votes"
5263
- <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
5264
  type="radio" name="yop_poll_options[sorting_answers]"
5265
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
5266
  </td>
@@ -5271,13 +4848,13 @@ EOT;
5271
  </th>
5272
  <td><label for="yop_poll_sorting_answers_asc"><input
5273
  id="yop_poll_sorting_answers_asc"
5274
- <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
5275
  type="radio"
5276
  name="yop_poll_options[sorting_answers_direction]"
5277
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
5278
  <label for="yop_poll_sorting_answers_desc"><input
5279
  id="yop_poll_sorting_answers_desc"
5280
- <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
5281
  type="radio"
5282
  name="yop_poll_options[sorting_answers_direction]"
5283
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
@@ -5287,22 +4864,22 @@ EOT;
5287
  <th><?php _e( 'Sorting Results', 'yop_poll' ); ?>:</th>
5288
  <td valign="top"><label for="yop_poll_sorting_results_exact"><input
5289
  id="yop_poll_sorting_results_exact"
5290
- <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
5291
  type="radio" name="yop_poll_options[sorting_results]"
5292
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
5293
  <label for="yop_poll_sorting_results_alphabetical"><input
5294
  id="yop_poll_sorting_results_alphabetical"
5295
- <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
5296
  type="radio" name="yop_poll_options[sorting_results]"
5297
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
5298
  <label for="yop_poll_sorting_results_random"><input
5299
  id="yop_poll_sorting_results_random"
5300
- <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
5301
  type="radio" name="yop_poll_options[sorting_results]"
5302
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
5303
  <label for="yop_poll_sorting_results_votes"><input
5304
  id="yop_poll_sorting_results_votes"
5305
- <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
5306
  type="radio" name="yop_poll_options[sorting_results]"
5307
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
5308
  </td>
@@ -5313,13 +4890,13 @@ EOT;
5313
  </th>
5314
  <td><label for="yop_poll_sorting_results_asc"><input
5315
  id="yop_poll_sorting_results_asc"
5316
- <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
5317
  type="radio"
5318
  name="yop_poll_options[sorting_results_direction]"
5319
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
5320
  <label for="yop_poll_sorting_results_desc"><input
5321
  id="yop_poll_sorting_results_desc"
5322
- <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
5323
  type="radio"
5324
  name="yop_poll_options[sorting_results_direction]"
5325
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
@@ -5331,7 +4908,7 @@ EOT;
5331
  </div>
5332
  <div class="postbox" id="yop-poll-advanced-options-div5">
5333
  <div title="Click to toggle" class="handlediv">
5334
- <br />
5335
  </div>
5336
  <h3 class="hndle">
5337
  <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
@@ -5340,21 +4917,25 @@ EOT;
5340
  <table cellspacing="0" class="links-table">
5341
  <tbody>
5342
  <tr>
5343
- <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>:</label><br><font size="0">(<?php _e('Current Server Time', 'yop_poll'); echo ': ' . current_time( 'mysql' ); ?>)</font>
 
 
5344
  </th>
5345
  <td><input id="yop-poll-start-date-input" type="text"
5346
  name="yop_poll_options[start_date]"
5347
- value="<?php echo '' == $default_options['start_date'] ? current_time('mysql') : $default_options['start_date']; ?>" />
5348
  </td>
5349
  </tr>
5350
  <tr>
5351
- <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>:</label><br><font size="0">(<?php _e('Current Server Time', 'yop_poll'); echo ': ' . current_time( 'mysql' ); ?>)</font>
 
 
5352
  </th>
5353
- <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']; ?>" />
5354
  <label for="yop-poll-never-expire"><input type="checkbox"
5355
- <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
5356
  id="yop-poll-never-expire"
5357
- name="yop_poll_options[never_expire]" value="yes" /> <?php _e( 'No End Date', 'yop_poll'); ?></label>
5358
  </td>
5359
  </tr>
5360
  </tbody>
@@ -5363,7 +4944,7 @@ EOT;
5363
  </div>
5364
  <div class="postbox" id="yop-poll-advanced-options-div6">
5365
  <div title="Click to toggle" class="handlediv">
5366
- <br />
5367
  </div>
5368
  <h3 class="hndle">
5369
  <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
@@ -5377,32 +4958,33 @@ EOT;
5377
  </th>
5378
  <td><label for="yop-poll-view-results-before-vote"><input
5379
  class="yop-poll-view-results-hide-custom"
5380
- <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
5381
  id="yop-poll-view-results-before-vote" type="radio"
5382
- value="before" name="yop_poll_options[view_results]" /> <?php _e( 'Before Vote' , 'yop_poll'); ?></label>
5383
  <label for="yop-poll-view-results-after-vote"><input
5384
  class="yop-poll-view-results-hide-custom"
5385
- <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
5386
  id="yop-poll-view-results-after-vote" type="radio"
5387
- value="after" name="yop_poll_options[view_results]" /> <?php _e( 'After Vote' , 'yop_poll'); ?></label>
5388
  <label for="yop-poll-view-results-after-poll-end-date"><input
5389
  class="yop-poll-view-results-hide-custom"
5390
- <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
5391
  id="yop-poll-view-results-after-poll-end-date" type="radio"
5392
  value="after-poll-end-date"
5393
- name="yop_poll_options[view_results]" /> <?php _e( 'After Poll End Date' , 'yop_poll'); ?></label>
5394
  <label for="yop-poll-view-results-never"><input
5395
  class="yop-poll-view-results-hide-custom"
5396
- <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
5397
  id="yop-poll-view-results-never" type="radio" value="never"
5398
- name="yop_poll_options[view_results]" /> <?php _e( 'Never' , 'yop_poll'); ?></label>
5399
  <label for="yop-poll-view-results-custom"><input
5400
  class="yop-poll-view-results-show-custom"
5401
- <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
5402
  id="yop-poll-view-results-custom" type="radio"
5403
- value="custom-date" name="yop_poll_options[view_results]" /> <?php _e( 'Custom Date' , 'yop_poll'); ?></label>
5404
- <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
5405
- <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' ); ?>:</label>
 
5406
  <input id="yop-poll-view-results-start-date" type="text"
5407
  name="yop_poll_options[view_results_start_date]"
5408
  value="<?php echo $default_options['view_results_start_date']; ?>">
@@ -5414,19 +4996,19 @@ EOT;
5414
  </th>
5415
  <td><label for="yop-poll-view-results-permissions-quest-only"><input
5416
  id="yop-poll-view-results-permissions-quest-only"
5417
- <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5418
  type="radio" value="quest-only"
5419
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Guest Only' , 'yop_poll'); ?></label>
5420
  <label for="yop-poll-view-results-permissions-registered-only"><input
5421
  id="yop-poll-view-results-permissions-registered-only"
5422
- <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5423
  type="radio" value="registered-only"
5424
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Registered Users Only' , 'yop_poll'); ?></label>
5425
  <label for="yop-poll-view-results-permissions-guest-registered"><input
5426
  id="yop-poll-view-results-permissions-guest-registered"
5427
- <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5428
  type="radio" value="guest-registered"
5429
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Guest &amp; Registered Users' , 'yop_poll'); ?></label>
5430
  </td>
5431
  </tr>
5432
  <tr>
@@ -5435,35 +5017,36 @@ EOT;
5435
  </th>
5436
  <td><label for="yop-poll-view-results-votes-number"><input
5437
  id="yop-poll-view-results-votes-number"
5438
- <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5439
  type="radio" value="votes-number"
5440
- name="yop_poll_options[view_results_type]" /> <?php _e( 'By Votes Number' , 'yop_poll'); ?></label>
5441
  <label for="yop-poll-view-results-percentages"><input
5442
  id="yop-poll-view-results-percentages"
5443
- <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5444
  type="radio" value="percentages"
5445
- name="yop_poll_options[view_results_type]" /> <?php _e( 'Percentages' , 'yop_poll'); ?></label>
5446
  <label
5447
  for="yop-poll-view-results-votes-number-and-percentages"><input
5448
  id="yop-poll-view-results-votes-number-and-percentages"
5449
- <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5450
  type="radio" value="votes-number-and-percentages"
5451
- name="yop_poll_options[view_results_type]" /> <?php _e( 'by Votes Number and Percentages' , 'yop_poll'); ?></label>
5452
  </td>
5453
  </tr>
5454
  <tr>
5455
  <th>
5456
- <?php _e( 'Poll Answer Result Label', 'yop_poll'); ?>:
5457
  </th>
5458
  <td><input id="yop-poll-answer-result-label" type="text"
5459
  name="yop_poll_options[answer_result_label]"
5460
- value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>" />
5461
- <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>
5462
  </td>
5463
  </tr>
5464
  <tr>
5465
  <th>
5466
- <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>:
 
5467
  </th>
5468
  <td>
5469
  <?php _e( 'Singular', 'yop_poll' ); ?>
@@ -5471,13 +5054,13 @@ EOT;
5471
  id="yop-poll-singular-answer-result-votes-number-label"
5472
  type="text"
5473
  name="yop_poll_options[singular_answer_result_votes_number_label]"
5474
- value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>" />
5475
  <?php _e( 'Plural', 'yop_poll' ); ?>
5476
  <input
5477
  id="yop-poll-plural-answer-result-votes-number-label"
5478
  type="text"
5479
  name="yop_poll_options[plural_answer_result_votes_number_label]"
5480
- value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>" />
5481
 
5482
  </td>
5483
  </tr>
@@ -5487,7 +5070,7 @@ EOT;
5487
  </th>
5488
  <td><input id="yop-poll-vote-button-label" type="text"
5489
  name="yop_poll_options[vote_button_label]"
5490
- value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>" />
5491
  </td>
5492
  </tr>
5493
  <tr>
@@ -5495,22 +5078,22 @@ EOT;
5495
  <?php _e( 'View Results Link', 'yop_poll' ); ?>:
5496
  </th>
5497
  <td><label for="yop-poll-view-results-link-yes"><input
5498
- <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5499
  id="yop-poll-view-results-link-yes" type="radio"
5500
- value="yes" name="yop_poll_options[view_results_link]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5501
  <label for="yop-poll-view-results-link-no"><input
5502
- <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5503
  id="yop-poll-view-results-link-no" type="radio" value="no"
5504
- name="yop_poll_options[view_results_link]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5505
  </td>
5506
  </tr>
5507
- <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
5508
  <th>
5509
  <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
5510
  </th>
5511
  <td><input id="yop-poll-view-results-link-label" type="text"
5512
  name="yop_poll_options[view_results_link_label]"
5513
- value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>" />
5514
  </td>
5515
  </tr>
5516
  <tr>
@@ -5518,23 +5101,23 @@ EOT;
5518
  <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
5519
  </th>
5520
  <td><label for="yop-poll-view-back-to-vote-link-yes"><input
5521
- <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5522
  id="yop-poll-view-back-to-vote-link-yes" type="radio"
5523
- value="yes" name="yop_poll_options[view_back_to_vote_link]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5524
  <label for="yop-poll-view-back-to-vote-link-no"><input
5525
- <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5526
  id="yop-poll-view-back-to-vote-link-no" type="radio"
5527
- value="no" name="yop_poll_options[view_back_to_vote_link]" /><?php _e( 'No' , 'yop_poll'); ?></label>
5528
  </td>
5529
  </tr>
5530
- <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;' : ''; ?>">
5531
  <th>
5532
  <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
5533
  </th>
5534
  <td><input id="yop-poll-view-back-to-vote-link-label"
5535
  type="text"
5536
  name="yop_poll_options[view_back_to_vote_link_label]"
5537
- value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>" />
5538
  </td>
5539
  </tr>
5540
  <tr>
@@ -5542,22 +5125,22 @@ EOT;
5542
  <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
5543
  </th>
5544
  <td><label for="yop-poll-view-total-votes-yes"><input
5545
- <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5546
  id="yop-poll-view-total-votes-yes" type="radio" value="yes"
5547
- name="yop_poll_options[view_total_votes]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5548
  <label for="yop-poll-view-total-votes-no"><input
5549
- <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5550
  id="yop-poll-view-total-votes-no" type="radio" value="no"
5551
- name="yop_poll_options[view_total_votes]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5552
  </td>
5553
  </tr>
5554
- <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
5555
  <th>
5556
  <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
5557
  </th>
5558
  <td><input id="yop-poll-view-total-votes-label" type="text"
5559
  name="yop_poll_options[view_total_votes_label]"
5560
- value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>" />
5561
  </td>
5562
  </tr>
5563
  <tr>
@@ -5565,22 +5148,22 @@ EOT;
5565
  <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
5566
  </th>
5567
  <td><label for="yop-poll-view-total-answers-yes"><input
5568
- <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5569
  id="yop-poll-view-total-answers-yes" type="radio"
5570
- value="yes" name="yop_poll_options[view_total_answers]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5571
  <label for="yop-poll-view-total-answers-no"><input
5572
- <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5573
  id="yop-poll-view-total-answers-no" type="radio" value="no"
5574
- name="yop_poll_options[view_total_answers]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5575
  </td>
5576
  </tr>
5577
- <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
5578
  <th>
5579
  <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
5580
  </th>
5581
  <td><input id="yop-poll-view-total-answers-label" type="text"
5582
  name="yop_poll_options[view_total_answers_label]"
5583
- value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>" />
5584
  </td>
5585
  </tr>
5586
  <tr>
@@ -5589,15 +5172,16 @@ EOT;
5589
  </th>
5590
  <td><input id="yop-poll-message-after-vote" type="text"
5591
  name="yop_poll_options[message_after_vote]"
5592
- value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>" />
5593
  </td>
5594
  </tr>
5595
  <tr>
5596
- <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>:</label>
 
5597
  </th>
5598
  <td><input id="yop-poll-page-url" type="text"
5599
  name="yop_poll_options[poll_page_url]"
5600
- value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>" />
5601
  </td>
5602
  </tr>
5603
  </tbody>
@@ -5606,7 +5190,7 @@ EOT;
5606
  </div>
5607
  <div class="postbox" id="yop-poll-advanced-options-div7">
5608
  <div title="Click to toggle" class="handlediv">
5609
- <br />
5610
  </div>
5611
  <h3 class="hndle">
5612
  <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
@@ -5620,96 +5204,104 @@ EOT;
5620
  </th>
5621
  <td><label for="yop-poll-vote-permisions-quest-only"><input
5622
  id="yop-poll-vote-permisions-quest-only"
5623
- <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5624
  type="radio" value="quest-only"
5625
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Guest Only' , 'yop_poll'); ?></label>
5626
  <label for="yop-poll-vote-permisions-registered-only"><input
5627
  id="yop-poll-vote-permisions-registered-only"
5628
- <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5629
  type="radio" value="registered-only"
5630
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Registered Users Only' , 'yop_poll'); ?></label>
5631
  <label for="yop-poll-vote-permisions-guest-registered"><input
5632
  id="yop-poll-vote-permisions-guest-registered"
5633
- <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5634
  type="radio" value="guest-registered"
5635
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Guest &amp; Registered Users' , 'yop_poll'); ?></label>
5636
  </td>
5637
  </tr>
5638
- <?php if ( false ) { ?>
5639
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5640
  <th>
5641
  <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
5642
- <?php if ( $pro_options['pro_user'] == 'no' ) { ?>
5643
- <br/><font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll'); ?>)</font>
 
5644
  <?php } ?></label>
5645
  </th>
5646
  <td><label for="yop-poll-vote-permisions-facebook-yes"><input
5647
- <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5648
  id="yop-poll-vote-permisions-facebook-yes" type="radio"
5649
- value="yes" name="yop_poll_options[vote_permisions_facebook]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5650
  <label for="yop-poll-vote-permisions-facebook-no"><input
5651
- <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5652
  id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
5653
- name="yop_poll_options[vote_permisions_facebook]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5654
  </td>
5655
  </tr>
5656
 
5657
- <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;' : ''; ?>">
5658
  <th>
5659
- <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>:
 
5660
  </th>
5661
  <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
5662
  name="yop_poll_options[vote_permisions_facebook_label]"
5663
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>" />
5664
  </td>
5665
  </tr>
5666
- <?php } ?>
5667
 
5668
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5669
  <th>
5670
- <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?><br><font size="0">(<?php _e('Will force users to login into your blog', 'yop_poll'); ?>)</font>:
 
 
5671
  </th>
5672
  <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
5673
- <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5674
  id="yop-poll-vote-permisions-wordpress-yes" type="radio"
5675
- value="yes" name="yop_poll_options[vote_permisions_wordpress]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5676
  <label for="yop-poll-vote-permisions-wordpress-no"><input
5677
- <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5678
  id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
5679
- name="yop_poll_options[vote_permisions_wordpress]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5680
  </td>
5681
  </tr>
5682
- <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;' : ''; ?>">
5683
  <th>
5684
- <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>:
 
5685
  </th>
5686
  <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
5687
  name="yop_poll_options[vote_permisions_wordpress_label]"
5688
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>" />
5689
  </td>
5690
- </tr>
5691
 
5692
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5693
  <th>
5694
- <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?><br><font size="0">(<?php _e('Logged users will be treated as anonymous', 'yop_poll'); ?>)</font>:
 
 
5695
  </th>
5696
  <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
5697
- <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5698
  id="yop-poll-vote-permisions-anonymous-yes" type="radio"
5699
- value="yes" name="yop_poll_options[vote_permisions_anonymous]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5700
  <label for="yop-poll-vote-permisions-anonymous-no"><input
5701
- <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5702
  id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
5703
- name="yop_poll_options[vote_permisions_anonymous]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5704
  </td>
5705
- </tr>
5706
- <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;' : ''; ?>">
5707
  <th>
5708
- <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>:
 
5709
  </th>
5710
  <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
5711
  name="yop_poll_options[vote_permisions_anonymous_label]"
5712
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>" />
5713
  </td>
5714
  </tr>
5715
 
@@ -5719,67 +5311,69 @@ EOT;
5719
  </th>
5720
  <td><label for="yop-poll-blocking-voters-dont-block"><input
5721
  class="yop-poll-blocking-voters-hide-interval"
5722
- <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5723
  id="yop-poll-blocking-voters-dont-block" type="radio"
5724
- value="dont-block" name="yop_poll_options[blocking_voters]" /> <?php _e( 'Dont`t Block' , 'yop_poll'); ?></label>
5725
  <label for="yop-poll-blocking-voters-cookie"><input
5726
  class="yop-poll-blocking-voters-show-interval"
5727
- <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5728
  id="yop-poll-blocking-voters-cookie" type="radio"
5729
- value="cookie" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Cookie' , 'yop_poll'); ?></label>
5730
  <label for="yop-poll-blocking-voters-ip"><input
5731
  class="yop-poll-blocking-voters-show-interval"
5732
- <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5733
  id="yop-poll-blocking-voters-ip" type="radio" value="ip"
5734
- name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Ip' , 'yop_poll'); ?></label>
5735
  <label for="yop-poll-blocking-voters-username"><input
5736
  class="yop-poll-blocking-voters-show-interval"
5737
- <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5738
  id="yop-poll-blocking-voters-username" type="radio"
5739
- value="username" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Username' , 'yop_poll'); ?></label>
5740
  <label for="yop-poll-blocking-voters-cookie-ip"><input
5741
  class="yop-poll-blocking-voters-show-interval"
5742
- <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5743
  id="yop-poll-blocking-voters-cookie-ip" type="radio"
5744
- value="cookie-ip" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Cookie &amp; Ip' , 'yop_poll'); ?></label>
5745
  </td>
5746
  </tr>
5747
- <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
5748
  <th>
5749
  <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
5750
  </th>
5751
  <td><input type="text"
5752
  name="yop_poll_options[blocking_voters_interval_value]"
5753
  id="yop-poll-blocking-voters-interval-value"
5754
- value="<?php echo $default_options['blocking_voters_interval_value']; ?>" />
5755
  <select id="yop-poll-blocking-voters-interval-unit"
5756
  name="yop_poll_options[blocking_voters_interval_unit]">
5757
  <option
5758
- <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5759
  value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
5760
  <option
5761
- <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5762
  value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
5763
  <option
5764
- <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5765
  value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
5766
  <option
5767
- <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5768
  value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
5769
  </select></td>
5770
  </tr>
5771
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
5772
  <th>
5773
- <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>:<br><font size="0">(<?php _e('Only for logged users', 'yop_poll'); ?>)</font>
 
 
5774
  </th>
5775
  <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
5776
- <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5777
  id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
5778
- value="yes" name="yop_poll_options[limit_number_of_votes_per_user]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5779
  <label for="yop-poll-limit-number-of-votes-per-user-no"><input
5780
- <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5781
  id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
5782
- name="yop_poll_options[limit_number_of_votes_per_user]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5783
  </td>
5784
  </tr>
5785
  <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;' : '' ?>">
@@ -5788,7 +5382,7 @@ EOT;
5788
  </th>
5789
  <td><input id="yop-poll-number-of-votes-per-user" type="text"
5790
  name="yop_poll_options[number_of_votes_per_user]"
5791
- value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>" />
5792
  </td>
5793
  </tr>
5794
  <tr>
@@ -5797,7 +5391,7 @@ EOT;
5797
  </th>
5798
  <td><input id="yop-poll-percentages-decimals" type="text"
5799
  name="yop_poll_options[percentages_decimals]"
5800
- value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>" />
5801
  </td>
5802
  </tr>
5803
  <tr>
@@ -5805,24 +5399,24 @@ EOT;
5805
  <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
5806
  </th>
5807
  <td><label for="yop-poll-use-default-loading-image-yes"><input
5808
- <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5809
  id="yop-poll-use-default-loading-image-yes" type="radio"
5810
  value="yes"
5811
- name="yop_poll_options[use_default_loading_image]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5812
  <label for="yop-poll-use-default-loading-image-no"><input
5813
- <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5814
  id="yop-poll-use-default-loading-image-no" type="radio"
5815
  value="no"
5816
- name="yop_poll_options[use_default_loading_image]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5817
  </td>
5818
  </tr>
5819
- <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;' : ''; ?>">
5820
  <th>
5821
  <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
5822
  </th>
5823
  <td><input id="yop-poll-loading-image-url" type="text"
5824
  name="yop_poll_options[loading_image_url]"
5825
- value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>" />
5826
  </td>
5827
  </tr>
5828
 
@@ -5831,33 +5425,35 @@ EOT;
5831
  <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
5832
  </th>
5833
  <td><label for="yop-poll-redirect-after-vote-yes"><input
5834
- <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5835
  id="yop-poll-redirect-after-vote-yes" type="radio"
5836
  value="yes"
5837
- name="yop_poll_options[redirect_after_vote]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5838
  <label for="yop-poll-redirect-after-vote-no"><input
5839
- <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5840
  id="yop-poll-redirect-after-vote-no" type="radio"
5841
  value="no"
5842
- name="yop_poll_options[redirect_after_vote]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5843
  </td>
5844
  </tr>
5845
- <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
5846
  <th>
5847
  <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
5848
  </th>
5849
  <td><input id="yop-poll-redirect-after-vote-url" type="text"
5850
  name="yop_poll_options[redirect_after_vote_url]"
5851
- value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>" />
5852
  </td>
5853
  </tr>
5854
  <tr>
5855
  <th>
5856
- <?php _e( 'Poll Date Format', 'yop_poll' ); ?>: <br /><font size="0"><?php _e('Check', 'yop_popll') ?> <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e('documentation', 'yop_popll') ?></a></font>
 
 
5857
  </th>
5858
  <td><input id="yop-poll-date-format" type="text"
5859
  name="yop_poll_options[date_format]"
5860
- value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>" />
5861
  </td>
5862
  </tr>
5863
  </tbody>
@@ -5866,7 +5462,7 @@ EOT;
5866
  </div>
5867
  <div class="postbox" id="yop-poll-advanced-options-div8">
5868
  <div title="Click to toggle" class="handlediv">
5869
- <br />
5870
  </div>
5871
  <h3 class="hndle">
5872
  <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
@@ -5881,32 +5477,32 @@ EOT;
5881
  <td><input
5882
  <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
5883
  id="yop-poll-view-poll-archive-link-yes" type="radio"
5884
- value="yes" name="yop_poll_options[view_poll_archive_link]" /><label
5885
- for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
5886
  <input
5887
  <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
5888
  id="yop-poll-view-poll-archive-link-no" type="radio"
5889
- value="no" name="yop_poll_options[view_poll_archive_link]" /><label
5890
- for="yop-poll-view-poll-archive-link-no"><?php _e( 'No' , 'yop_poll'); ?></label>
5891
  </td>
5892
  </tr>
5893
- <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;' : ''; ?>">
5894
  <th>
5895
  <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
5896
  </th>
5897
  <td><input id="yop-poll-view-poll-archive-link-label"
5898
  type="text"
5899
  name="yop_poll_options[view_poll_archive_link_label]"
5900
- value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>" />
5901
  </td>
5902
  </tr>
5903
- <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
5904
  <th>
5905
  <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
5906
  </th>
5907
  <td><input id="yop-poll-poll-archive-url" type="text"
5908
  name="yop_poll_options[poll_archive_url]"
5909
- value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>" />
5910
  </td>
5911
  </tr>
5912
  <tr>
@@ -5916,20 +5512,20 @@ EOT;
5916
  <td><label for="yop-poll-show-in-archive-yes"><input
5917
  <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
5918
  id="yop-poll-show-in-archive-yes" type="radio" value="yes"
5919
- name="yop_poll_options[show_in_archive]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
5920
  <label for="yop-poll-show-in-archive-no"><input
5921
  <?php checked( 'no', $default_options['show_in_archive'] ); ?>
5922
  id="yop-poll-show-in-archive-no" type="radio" value="no"
5923
- name="yop_poll_options[show_in_archive]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
5924
  </td>
5925
  </tr>
5926
- <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
5927
  <th>
5928
  <?php _e( 'Archive Order', 'yop_poll' ); ?>:
5929
  </th>
5930
  <td><input id="yop-poll-show-in-archive-order" type="text"
5931
  name="yop_poll_options[archive_order]"
5932
- value="<?php echo $default_options['archive_order']; ?>" />
5933
  </td>
5934
  </tr>
5935
  <tr>
@@ -5938,7 +5534,7 @@ EOT;
5938
  </th>
5939
  <td><input id="yop-poll-archive-polls-per-page" type="text"
5940
  name="yop_poll_options[archive_polls_per_page]"
5941
- value="<?php echo $default_options['archive_polls_per_page']; ?>" />
5942
  </td>
5943
  </tr>
5944
 
@@ -5948,7 +5544,7 @@ EOT;
5948
 
5949
  <div class="postbox" id="yop-poll-advanced-options-div8">
5950
  <div title="Click to toggle" class="handlediv">
5951
- <br />
5952
  </div>
5953
  <h3 class="hndle">
5954
  <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
@@ -5962,15 +5558,15 @@ EOT;
5962
  </th>
5963
  <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
5964
  id="yop-poll-send-email-notifications-yes" type="radio"
5965
- value="yes" name="yop_poll_options[send_email_notifications]" /><label
5966
- for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
5967
  <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
5968
  id="yop-poll-send-email-notifications-no" type="radio"
5969
- value="no" name="yop_poll_options[send_email_notifications]" /><label
5970
- for="yop-poll-send-email-notifications-no"><?php _e( 'No' , 'yop_poll'); ?></label>
5971
  </td>
5972
  </tr>
5973
- <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;' : ''; ?>">
5974
  <th>
5975
  <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
5976
  </th>
@@ -5978,10 +5574,10 @@ EOT;
5978
  <input id="yop-poll-email-notifications-from-name"
5979
  type="text"
5980
  name="yop_poll_options[email_notifications_from_name]"
5981
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>" />
5982
  </td>
5983
  </tr>
5984
- <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;' : ''; ?>">
5985
  <th>
5986
  <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
5987
  </th>
@@ -5989,21 +5585,22 @@ EOT;
5989
  <input id="yop-poll-email-notifications-from-email"
5990
  type="text"
5991
  name="yop_poll_options[email_notifications_from_email]"
5992
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>" />
5993
  </td>
5994
  </tr>
5995
- <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;' : ''; ?>">
5996
  <th>
5997
- <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>:<br><font size="0"><?php _e('Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll') ?></font>
 
5998
  </th>
5999
  <td valign="top">
6000
  <input id="yop-poll-email-notifications-recipients"
6001
  type="text"
6002
  name="yop_poll_options[email_notifications_recipients]"
6003
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>" />
6004
  </td>
6005
  </tr>
6006
- <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;' : ''; ?>">
6007
  <th>
6008
  <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
6009
  </th>
@@ -6015,7 +5612,7 @@ EOT;
6015
  />
6016
  </td>
6017
  </tr>
6018
- <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;' : ''; ?>">
6019
  <th>
6020
  <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
6021
  </th>
@@ -6028,15 +5625,16 @@ EOT;
6028
  </div>
6029
  </div>
6030
 
6031
- <?php if ( false ) { ?>
6032
  <div class="postbox" id="yop-poll-advanced-options-div9">
6033
  <div title="Click to toggle" class="handlediv">
6034
- <br />
6035
  </div>
6036
  <h3 class="hndle">
6037
  <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
6038
- <?php if ( $pro_options['pro_user'] == 'no' ) { ?>
6039
- <font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll'); ?>)</font>
 
6040
  <?php } ?>
6041
  </span>
6042
  </h3>
@@ -6050,55 +5648,55 @@ EOT;
6050
  <td><input
6051
  <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
6052
  id="yop-poll-share-after-vote-yes" type="radio"
6053
- value="yes" name="yop_poll_options[share_after_vote]" /><label
6054
- for="yop-poll-share-after-vote-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
6055
  <input
6056
  <?php checked( 'no', $default_options['share_after_vote'] ); ?>
6057
  id="yop-poll-share-after-vote-no" type="radio"
6058
- value="no" name="yop_poll_options[share_after_vote]" /><label
6059
- for="yop-poll-share-after-vote-no"><?php _e( 'No' , 'yop_poll'); ?></label>
6060
  </td>
6061
  </tr>
6062
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
6063
  <th>
6064
  <?php _e( 'Share Name', 'yop_poll' ); ?>:
6065
  </th>
6066
  <td><input id="yop-poll-share-name"
6067
  type="text"
6068
  name="yop_poll_options[share_name]"
6069
- value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>" />
6070
  </td>
6071
- </tr>
6072
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
6073
  <th>
6074
  <?php _e( 'Share Caption', 'yop_poll' ); ?>:
6075
  </th>
6076
  <td><input id="yop-poll-share-caption"
6077
  type="text"
6078
  name="yop_poll_options[share_caption]"
6079
- value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>" />
6080
  </td>
6081
  </tr>
6082
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
6083
  <th>
6084
  <?php _e( 'Share Description', 'yop_poll' ); ?>:
6085
  </th>
6086
  <td><input id="yop-poll-share-description"
6087
  type="text"
6088
  name="yop_poll_options[share_description]"
6089
- value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>" />
6090
  </td>
6091
- </tr>
6092
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
6093
  <th>
6094
  <?php _e( 'Share Picture', 'yop_poll' ); ?>:
6095
  </th>
6096
  <td><input id="yop-poll-share-picture"
6097
  type="text"
6098
  name="yop_poll_options[share_picture]"
6099
- value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>" />
6100
  </td>
6101
- </tr>
6102
 
6103
  </table>
6104
  </div>
@@ -6106,17 +5704,17 @@ EOT;
6106
  <?php } ?>
6107
  </div>
6108
  <input name="Submit" class="button-primary" type="submit"
6109
- value="<?php _e('Save Changes', 'yop_poll'); ?>" />
6110
  </div>
6111
 
6112
  <div class="postbox-container" id="postbox-container-1">
6113
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
6114
  <div class="postbox " id="linksubmitdiv">
6115
  <div title="Click to toggle" class="handlediv">
6116
- <br />
6117
  </div>
6118
  <h3 class="hndle">
6119
- <span><?php _e( 'Save Changes', 'yop_poll'); ?></span>
6120
  </h3>
6121
  <div class="inside">
6122
  <div id="submitlink" class="submitbox">
@@ -6125,7 +5723,7 @@ EOT;
6125
 
6126
  <div id="publishing-action">
6127
  <input name="Submit" class="button-primary" type="submit"
6128
- value="<?php _e('Save Changes', 'yop_poll'); ?>" />
6129
  </div>
6130
  <div class="clear"></div>
6131
  </div>
@@ -6142,36 +5740,35 @@ EOT;
6142
 
6143
  <?php
6144
  }
 
6145
  public function view_add_edit_new_poll() {
6146
  global $yop_poll_add_new_config, $action, $current_user;
6147
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
6148
- $yop_poll_model = new Yop_Poll_Model ();
6149
- $page_name = __ ( 'Add New Yop Poll', 'yop_poll' );
6150
- $action_type = 'add-new';
6151
- $poll_id = '';
6152
- $default_options = get_option ( 'yop_poll_options', array () );
6153
- if ('edit' == $action) {
6154
- $poll_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
6155
- $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id ( 'poll_author', $poll_id );
6156
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_author != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' )))
6157
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
6158
- $yop_poll_model = new Yop_Poll_Model ( $poll_id );
6159
- $answers = Yop_Poll_Model::get_poll_answers ( $poll_id );
6160
- $other_answer = Yop_Poll_Model::get_poll_answers ( $poll_id, array (
6161
- 'other'
6162
- ) );
6163
- $custom_fields = Yop_Poll_Model::get_poll_customfields ( $poll_id );
6164
- $page_name = __ ( 'Edit Poll', 'yop_poll' );
6165
- $action_type = 'edit';
6166
- $poll_default_options = get_yop_poll_meta ( $poll_id, 'options', true );
6167
  foreach ( $default_options as $option_name => $option_value ) {
6168
- if (isset ( $poll_default_options [$option_name] )) {
6169
  $default_options [$option_name] = $poll_default_options [$option_name];
6170
  }
6171
  }
6172
  }
6173
- $current_poll = $yop_poll_model->get_current_poll ();
6174
- $answers_number = $yop_poll_add_new_config ['default_number_of_answers'];
6175
  $customfields_number = $yop_poll_add_new_config ['default_number_of_customfields'];
6176
  ?>
6177
  <div class="wrap">
@@ -6179,14 +5776,14 @@ EOT;
6179
  <br>
6180
 
6181
  </div>
6182
- <h2><?php print $page_name; ?><?php if( 'edit' == $action ): ?><a
6183
  class="add-new-h2"
6184
  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>
6185
  <div id="message"></div>
6186
  <form method="post" name="yop_poll_edit_add_new_form"
6187
  id="yop-poll-edit-add-new-form">
6188
  <?php wp_nonce_field( 'yop-poll-edit-add-new' ); ?>
6189
- <span <?php if ( 'edit' != $action ) { ?> style="display: none;"
6190
  <?php } ?>> Shortcode: <input id="yop_poll_shortcode" type="text"
6191
  value='[yop_poll id="<?php echo $current_poll['id']; ?>"]'
6192
  readonly="readonly">
@@ -6201,7 +5798,7 @@ EOT;
6201
  <div class="inside">
6202
  <input type="text" id="yop-poll-name"
6203
  value="<?php echo esc_html( stripslashes( $current_poll['name'] ) ); ?>"
6204
- tabindex="1" name="yop_poll_name" size="30" />
6205
  <p><?php _e( 'Example: Test Poll', 'yop_poll' ); ?></p>
6206
  </div>
6207
  </div>
@@ -6212,7 +5809,7 @@ EOT;
6212
  <div class="inside">
6213
  <input type="text" id="yop-poll-question"
6214
  value="<?php echo esc_html( stripslashes( $current_poll['question'] ) ); ?>"
6215
- tabindex="1" name="yop_poll_question" size="30" />
6216
  <p><?php _e( 'Example: How is my plugin?', 'yop_poll' ); ?></p>
6217
  </div>
6218
  </div>
@@ -6225,9 +5822,11 @@ EOT;
6225
  id='yop-poll-answer-table'>
6226
  <tbody>
6227
  <?php
6228
- for($answer_id = 1; $answer_id < $answers_number; $answer_id ++) {
6229
- if (isset ( $answers [$answer_id - 1] )) {
6230
- $answer_options = get_yop_poll_answer_meta ( $answers [$answer_id - 1] ['id'], 'options' );
 
 
6231
  }
6232
  ?>
6233
  <tr class="yop_poll_tr_answer"
@@ -6235,28 +5834,28 @@ EOT;
6235
  <th scope="row"><label class="yop_poll_answer_label"
6236
  for="yop-poll-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_answer']; ?> <?php echo $answer_id ?></label></th>
6237
  <td><input type="hidden"
6238
- value="<?php echo isset( $answers[ $answer_id - 1 ]['id'] )? $answers[ $answer_id - 1 ]['id'] : ''; ?>"
6239
- name="yop_poll_answer_ids[answer<?php echo $answer_id ?>]" />
6240
  <input type="text"
6241
- value="<?php echo isset( $answers[ $answer_id - 1 ]['answer'] )? esc_html( stripslashes( $answers[ $answer_id - 1 ]['answer'] ) ) : ''; ?>"
6242
  id="yop-poll-answer<?php echo $answer_id ?>"
6243
- name="yop_poll_answer[answer<?php echo $answer_id ?>]" /></td>
6244
  <td align="right">
6245
- <?php if ( 'edit' == $action ) {?>
6246
  <input type="button"
6247
- value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $answers[ $answer_id - 1 ]['votes'] ?>)"
6248
  onclick="yop_poll_show_change_votes_number_answer(<?php echo $answers [$answer_id - 1] ['id'] ?>); return false;"
6249
- class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $answers [$answer_id - 1] ['id'] ?>" />
6250
  <?php } ?>
6251
  <input type="button"
6252
- value="<?php echo $yop_poll_add_new_config['text_customize_answer']; ?>"
6253
  onclick="yop_poll_toogle_customize_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
6254
- class="button" />
6255
  <input
6256
  onclick="yop_poll_remove_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
6257
  type="button"
6258
- value="<?php echo $yop_poll_add_new_config['text_remove_answer'];?>"
6259
- class="button" /></td>
6260
  </tr>
6261
  <tr class="yop_poll_tr_customize_answer"
6262
  id="yop_poll_tr_customize_answer<?php echo $answer_id ?>"
@@ -6266,21 +5865,22 @@ EOT;
6266
  <tbody>
6267
  <tr>
6268
  <th>
6269
- <?php echo $yop_poll_add_new_config['text_is_default_answer']; ?>:
 
6270
  </th>
6271
  <td valign="top"><input
6272
  id="yop-poll-is-default-answer-no-<?php echo $answer_id ?>"
6273
  <?php echo checked( 'no', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
6274
  type="radio"
6275
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
6276
- value="no" /> <label
6277
  for="yop-poll-id-default-answer-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
6278
  <input
6279
  id="yop-poll-is-default-answer-yes-<?php echo $answer_id ?>"
6280
  <?php echo checked( 'yes', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
6281
  type="radio"
6282
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
6283
- value="yes" /> <label
6284
  for="yop-poll-id-default-answer-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
6285
  </td>
6286
  </tr>
@@ -6290,7 +5890,8 @@ EOT;
6290
  <tbody>
6291
  <tr>
6292
  <th>
6293
- <?php echo $yop_poll_add_new_config['text_poll_bar_style']['use_template_bar_label']; ?>:
 
6294
  </th>
6295
  <td><input
6296
  onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').show();"
@@ -6298,7 +5899,7 @@ EOT;
6298
  <?php echo checked( 'no', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
6299
  type="radio"
6300
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
6301
- value="no" /> <label
6302
  for="yop-poll-answer-use-template-bar-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
6303
  <input
6304
  onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').hide();"
@@ -6306,13 +5907,13 @@ EOT;
6306
  <?php echo checked( 'yes', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
6307
  type="radio"
6308
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
6309
- value="yes" /> <label
6310
  for="yop-poll-answer-use-template-bar-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
6311
  </td>
6312
  </tr>
6313
  </tbody>
6314
  </table>
6315
- <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;' : '' ); ?>">
6316
  <tbody>
6317
  <tr>
6318
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_label']; ?></label>
@@ -6330,7 +5931,7 @@ EOT;
6330
  value="<?php echo isset ( $answer_options[0]['bar_background'] ) ? $answer_options[0]['bar_background'] : $default_options['bar_background']; ?>"
6331
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'background-color', '#' + this.value)"
6332
  type="text"
6333
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_background]" />
6334
  </td>
6335
  </tr>
6336
  <tr>
@@ -6342,7 +5943,7 @@ EOT;
6342
  value="<?php echo isset ( $answer_options[0]['bar_height'] ) ? $answer_options[0]['bar_height'] : $default_options['bar_height']; ?>"
6343
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'height', this.value + 'px')"
6344
  type="text"
6345
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_height]" />
6346
  px</td>
6347
  </tr>
6348
  <tr>
@@ -6354,7 +5955,7 @@ EOT;
6354
  value="<?php echo isset ( $answer_options[0]['bar_border_color'] ) ? $answer_options[0]['bar_border_color'] : $default_options['bar_border_color']; ?>"
6355
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-color', '#' + this.value )"
6356
  type="text"
6357
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_color]" />
6358
  </td>
6359
  </tr>
6360
  <tr>
@@ -6366,7 +5967,7 @@ EOT;
6366
  value="<?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>"
6367
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-width', this.value + 'px')"
6368
  type="text"
6369
- name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_width]" />
6370
  px</td>
6371
  </tr>
6372
  <tr>
@@ -6396,10 +5997,14 @@ EOT;
6396
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
6397
  </th>
6398
  <td>
6399
- <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']; ?>px; background-color:#<?php
 
6400
 
6401
  echo isset ( $answer_options [0] ['bar_background'] ) ? $answer_options [0] ['bar_background'] : $default_options ['bar_background'];
6402
- ?>; border-style: <?php echo isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style']; ?>; border-width: <?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>px; border-color: #<?php
 
 
 
6403
 
6404
  echo isset ( $answer_options [0] ['bar_border_color'] ) ? $answer_options [0] ['bar_border_color'] : $default_options ['bar_border_color'];
6405
  ?>;"></div>
@@ -6427,83 +6032,85 @@ EOT;
6427
  </th>
6428
  <td><label for="yop-poll-allow-other-answers-no"><input
6429
  id="yop-poll-allow-other-answers-no"
6430
- <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6431
  type="radio" name="yop_poll_options[allow_other_answers]"
6432
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6433
  for="yop-poll-allow-other-answers-yes"><input
6434
  id="yop-poll-allow-other-answers-yes"
6435
- <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6436
  type="radio" name="yop_poll_options[allow_other_answers]"
6437
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6438
- <?php if ( 'edit' == $action ) {?>
6439
  <input type="button"
6440
- value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $other_answer[0]['votes'] ?>)"
6441
  onclick="yop_poll_show_change_votes_number_answer(<?php echo $other_answer[0] ['id'] ?>); return false;"
6442
- class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $other_answer[0] ['id'] ?>" />
6443
  <?php } ?>
6444
  </td>
6445
  </tr>
6446
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6447
  <th>
6448
  <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
6449
  </th>
6450
  <td><input id="yop-poll-other-answers-label" type="text"
6451
  name="yop_poll_options[other_answers_label]"
6452
- value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>" />
6453
  <input type="hidden"
6454
  name="yop_poll_options[other_answers_id]"
6455
- value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>" />
6456
  </td>
6457
  </tr>
6458
- <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6459
  <th>
6460
- <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>:<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>
 
6461
  </th>
6462
  <td>
6463
  <label for="yop-poll-add-other-answers-to-default-answers-no"><input
6464
  id="yop-poll-add-other-answers-to-default-answers-no"
6465
- <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6466
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6467
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6468
  for="yop-poll-add-other-answers-to-default-answers-yes"><input
6469
  id="yop-poll-add-other-answers-to-default-answers-yes"
6470
- <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6471
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6472
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6473
  </td>
6474
  </tr>
6475
- <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6476
  <th>
6477
  <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
6478
  </th>
6479
  <td><label for="yop-poll-display-other-answers-values-no"><input
6480
  id="yop-poll-display-other-answers-values-no"
6481
- <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6482
  type="radio"
6483
  name="yop_poll_options[display_other_answers_values]"
6484
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6485
  for="yop-poll-display-other-answers-values-yes"><input
6486
  id="yop-poll-display-other-answers-values-yes"
6487
- <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6488
  type="radio"
6489
  name="yop_poll_options[display_other_answers_values]"
6490
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6491
  </tr>
6492
- <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;' : ''; ?>">
6493
  <th>
6494
- <?php _e( 'Make "Other answer" default answer ', 'yop_poll' ); ?>:<br>
6495
- <font size="0"><?php _e('"Other Answer" will be autoselected', 'yop_poll' ); ?></font>
 
6496
  </th>
6497
  <td><label for="yop-poll-is-default-other-answers-no"><input
6498
  id="yop-poll-is-default-other-answers-no"
6499
- <?php echo $default_options['is_default_answer'] == 'no' ? 'checked="checked"' : ''; ?>
6500
  type="radio" name="yop_poll_options[is_default_answer]"
6501
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6502
  for="yop-poll-is-default-other-answers-yes"><input
6503
  id="yop-poll-is-default-other-answers-yes"
6504
- <?php echo $default_options['is_default_answer'] == 'yes' ? 'checked="checked"' : ''; ?>
6505
  type="radio" name="yop_poll_options[is_default_answer]"
6506
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6507
  </tr>
6508
  <tr>
6509
  <th>
@@ -6511,33 +6118,33 @@ EOT;
6511
  </th>
6512
  <td><label for="yop-poll-allow-multiple-answers-no"><input
6513
  id="yop-poll-allow-multiple-answers-no"
6514
- <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
6515
  type="radio" name="yop_poll_options[allow_multiple_answers]"
6516
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6517
  for="yop-poll-allow-multiple-answers-yes"><input
6518
  id="yop-poll-allow-multiple-answers-yes"
6519
- <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
6520
  type="radio" name="yop_poll_options[allow_multiple_answers]"
6521
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6522
  </tr>
6523
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6524
  <th>
6525
  <?php _e( 'Number of allowed answers', 'yop_poll' ); ?>:
6526
  </th>
6527
  <td><input id="yop-poll-allow-multiple-answers-number"
6528
  type="text"
6529
  name="yop_poll_options[allow_multiple_answers_number]"
6530
- value="<?php echo $default_options['allow_multiple_answers_number']; ?>" />
6531
  </td>
6532
  </tr>
6533
- <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6534
  <th>
6535
  <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
6536
  </th>
6537
  <td><input id="yop-poll-allow-multiple-answers-min-number"
6538
  type="text"
6539
  name="yop_poll_options[allow_multiple_answers_min_number]"
6540
- value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>" />
6541
  </td>
6542
  </tr>
6543
  <tr>
@@ -6546,29 +6153,29 @@ EOT;
6546
  </th>
6547
  <td><label for="yop-poll-display-answers-vertical"><input
6548
  id="yop-poll-display-answers-vertical"
6549
- <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
6550
  type="radio" name="yop_poll_options[display_answers]"
6551
- value="vertical" /> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6552
  <label for="yop-poll-display-answers-orizontal"><input
6553
  id="yop-poll-display-answers-orizontal"
6554
- <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6555
  type="radio" name="yop_poll_options[display_answers]"
6556
- value="orizontal" /> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6557
  <label for="yop-poll-display-answers-tabulated"><input
6558
  id="yop-poll-display-answers-tabulated"
6559
- <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6560
  type="radio" name="yop_poll_options[display_answers]"
6561
- value="tabulated" /> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6562
  </td>
6563
  </tr>
6564
- <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
6565
  <th>
6566
  <?php _e( 'Columns', 'yop_poll' ); ?>:
6567
  </th>
6568
  <td><input id="yop-poll-display-answers-tabulated-cols"
6569
  type="text"
6570
  name="yop_poll_options[display_answers_tabulated_cols]"
6571
- value="<?php echo $default_options['display_answers_tabulated_cols']; ?>" />
6572
  </td>
6573
  </tr>
6574
  <tr>
@@ -6577,29 +6184,29 @@ EOT;
6577
  </th>
6578
  <td><label for="yop-poll-display-results-vertical"><input
6579
  id="yop-poll-display-results-vertical"
6580
- <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
6581
  type="radio" name="yop_poll_options[display_results]"
6582
  value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6583
  <label for="yop-poll-display-results-orizontal"><input
6584
  id="yop-poll-display-results-orizontal"
6585
- <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6586
  type="radio" name="yop_poll_options[display_results]"
6587
  value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6588
  <label for="yop-poll-display-results-tabulated"><input
6589
  id="yop-poll-display-results-tabulated"
6590
- <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6591
  type="radio" name="yop_poll_options[display_results]"
6592
  value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6593
  </td>
6594
  </tr>
6595
- <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
6596
  <th>
6597
  <?php _e( 'Columns', 'yop_poll' ); ?>:
6598
  </th>
6599
  <td><input id="yop-poll-display-results-tabulated-cols"
6600
  type="text"
6601
  name="yop_poll_options[display_results_tabulated_cols]"
6602
- value="<?php echo $default_options['display_results_tabulated_cols']; ?>" />
6603
  </td>
6604
  </tr>
6605
  <tr>
@@ -6608,53 +6215,53 @@ EOT;
6608
  </th>
6609
  <td><label for="yop-poll-use-template-bar-no"><input
6610
  id="yop-poll-use-template-bar-no"
6611
- <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6612
  type="radio" name="yop_poll_options[use_template_bar]"
6613
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6614
  for="yop-poll-use-template-bar-yes"><input
6615
  id="yop-poll-use-template-bar-yes"
6616
- <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6617
  type="radio" name="yop_poll_options[use_template_bar]"
6618
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6619
  </tr>
6620
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6621
  <th><label for="yop-poll-bar-background"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_background_label']; ?></label>
6622
  </th>
6623
  <td>#<input class="yop-small-input"
6624
  id="yop-poll-bar-background"
6625
  value="<?php echo $default_options['bar_background']; ?>"
6626
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
6627
- type="text" name="yop_poll_options[bar_background]" />
6628
  </td>
6629
  </tr>
6630
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6631
  <th><label for="yop-poll-bar-height"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_height_label']; ?></label>
6632
  </th>
6633
  <td><input class="yop-small-input" id="yop-poll-bar-height"
6634
  value="<?php echo $default_options['bar_height']; ?>"
6635
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
6636
- type="text" name="yop_poll_options[bar_height]" /> px</td>
6637
  </tr>
6638
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6639
  <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>
6640
  </th>
6641
  <td>#<input class="yop-small-input"
6642
  id="yop-poll-bar-border-color"
6643
  value="<?php echo $default_options['bar_border_color']; ?>"
6644
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
6645
- type="text" name="yop_poll_options[bar_border_color]" />
6646
  </td>
6647
  </tr>
6648
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6649
  <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>
6650
  </th>
6651
  <td><input class="yop-small-input"
6652
  id="yop-poll-bar-border-width"
6653
  value="<?php echo $default_options['bar_border_width']; ?>"
6654
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
6655
- type="text" name="yop_poll_options[bar_border_width]" /> px</td>
6656
  </tr>
6657
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6658
  <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>
6659
  </th>
6660
  <td><select id="yop-poll-bar-border-style"
@@ -6671,14 +6278,19 @@ EOT;
6671
  value="dotted">Dotted</option>
6672
  </select></td>
6673
  </tr>
6674
- <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
 
6675
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
6676
  </th>
6677
  <td>
6678
- <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>px; background-color:#<?php
 
6679
 
6680
  echo $default_options ['bar_background'];
6681
- ?>; border-style: <?php echo $default_options['bar_border_style']; ?>; border-width: <?php echo $default_options['bar_border_width']; ?>px; border-color: #<?php
 
 
 
6682
 
6683
  echo $default_options ['bar_border_color'];
6684
  ?>;"></div>
@@ -6688,22 +6300,22 @@ EOT;
6688
  <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
6689
  <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
6690
  id="yop_poll_sorting_answers_exact"
6691
- <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
6692
  type="radio" name="yop_poll_options[sorting_answers]"
6693
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6694
  <label for="yop_poll_sorting_answers_alphabetical"><input
6695
  id="yop_poll_sorting_answers_alphabetical"
6696
- <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6697
  type="radio" name="yop_poll_options[sorting_answers]"
6698
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6699
  <label for="yop_poll_sorting_answers_random"><input
6700
  id="yop_poll_sorting_answers_random"
6701
- <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
6702
  type="radio" name="yop_poll_options[sorting_answers]"
6703
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6704
  <label for="yop_poll_sorting_answers_votes"><input
6705
  id="yop_poll_sorting_answers_votes"
6706
- <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
6707
  type="radio" name="yop_poll_options[sorting_answers]"
6708
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6709
  </td>
@@ -6714,13 +6326,13 @@ EOT;
6714
  </th>
6715
  <td><label for="yop_poll_sorting_answers_asc"><input
6716
  id="yop_poll_sorting_answers_asc"
6717
- <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6718
  type="radio"
6719
  name="yop_poll_options[sorting_answers_direction]"
6720
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6721
  <label for="yop_poll_sorting_answers_desc"><input
6722
  id="yop_poll_sorting_answers_desc"
6723
- <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6724
  type="radio"
6725
  name="yop_poll_options[sorting_answers_direction]"
6726
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
@@ -6730,22 +6342,22 @@ EOT;
6730
  <th><?php _e( 'Sorting Results in', 'yop_poll' ); ?>:</th>
6731
  <td valign="top"><label for="yop_poll_sorting_results_exact"><input
6732
  id="yop_poll_sorting_results_exact"
6733
- <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
6734
  type="radio" name="yop_poll_options[sorting_results]"
6735
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6736
  <label for="yop_poll_sorting_results_alphabetical"><input
6737
  id="yop_poll_sorting_results_alphabetical"
6738
- <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6739
  type="radio" name="yop_poll_options[sorting_results]"
6740
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6741
  <label for="yop_poll_sorting_results_random"><input
6742
  id="yop_poll_sorting_results_random"
6743
- <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
6744
  type="radio" name="yop_poll_options[sorting_results]"
6745
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6746
  <label for="yop_poll_sorting_results_votes"><input
6747
  id="yop_poll_sorting_results_votes"
6748
- <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
6749
  type="radio" name="yop_poll_options[sorting_results]"
6750
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6751
  </td>
@@ -6756,13 +6368,13 @@ EOT;
6756
  </th>
6757
  <td><label for="yop_poll_sorting_results_asc"><input
6758
  id="yop_poll_sorting_results_asc"
6759
- <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6760
  type="radio"
6761
  name="yop_poll_options[sorting_results_direction]"
6762
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6763
  <label for="yop_poll_sorting_results_desc"><input
6764
  id="yop_poll_sorting_results_desc"
6765
- <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6766
  type="radio"
6767
  name="yop_poll_options[sorting_results_direction]"
6768
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
@@ -6782,8 +6394,8 @@ EOT;
6782
  id='yop-poll-customfields-table'>
6783
  <tbody>
6784
  <?php
6785
- for($custom_field_id = 1; $custom_field_id < $customfields_number; $custom_field_id ++) {
6786
- if (isset ( $custom_fields [$custom_field_id - 1] ['id'] )) {
6787
  ?>
6788
  <tr class="yop_poll_tr_customfields"
6789
  id="yop_poll_tr_customfield<?php echo $custom_field_id; ?>">
@@ -6791,17 +6403,18 @@ EOT;
6791
  for="yop_poll_customfield<?php echo $custom_field_id; ?>"><?php echo $yop_poll_add_new_config['text_customfield'] ?> <?php echo $custom_field_id ?></label>
6792
  </th>
6793
  <td><input type="hidden"
6794
- value="<?php echo isset( $custom_fields[ $custom_field_id - 1 ]['id'] )? $custom_fields[ $custom_field_id - 1 ]['id'] : ''; ?>"
6795
- name="yop_poll_customfield_ids[customfield<?php echo $custom_field_id ?>]" />
6796
  <input type="text"
6797
- value="<?php echo isset( $custom_fields[ $custom_field_id - 1 ]['custom_field'] )? $custom_fields[ $custom_field_id - 1 ]['custom_field'] : ''; ?>"
6798
  id="yop-poll-customfield<?php echo $custom_field_id ?>"
6799
- name="yop_poll_customfield[customfield<?php echo $custom_field_id ?>]" />
6800
  <input value="yes"
6801
- <?php if ( isset ($custom_fields[ $custom_field_id - 1 ]['required'] ) ) echo ('yes' == $custom_fields[ $custom_field_id - 1 ]['required'] )? 'checked="checked"' : ''; ?>
 
6802
  id="yop-poll-customfield-required-<?php echo $custom_field_id ?>"
6803
  type="checkbox"
6804
- name="yop_poll_customfield_required[customfield<?php echo $custom_field_id ?>]" />
6805
  <label
6806
  for="yop-poll-customfield-required-<?php echo $custom_field_id ?>"><?php echo $yop_poll_add_new_config['text_requiered_customfield'] ?></label>
6807
  </td>
@@ -6809,7 +6422,7 @@ EOT;
6809
  onclick="yop_poll_remove_customfield( '#yop-poll-customfields-table', <?php echo $custom_field_id ?> ); return false;"
6810
  type="button"
6811
  value="<?php echo $yop_poll_add_new_config['text_remove_customfield']; ?>"
6812
- class="button" /></td>
6813
  </tr>
6814
  <?php
6815
  }
@@ -6825,7 +6438,7 @@ EOT;
6825
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
6826
  <div class="postbox" id="yop-poll-advanced-options-div">
6827
  <div title="Click to toggle" class="handlediv">
6828
- <br />
6829
  </div>
6830
  <h3 class="hndle">
6831
  <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
@@ -6834,21 +6447,25 @@ EOT;
6834
  <table cellspacing="0" class="links-table">
6835
  <tbody>
6836
  <tr>
6837
- <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>:</label><br><font size="0">(<?php _e('Current Server Time', 'yop_poll'); echo ': ' . current_time( 'mysql' ); ?>)</font>
 
 
6838
  </th>
6839
  <td><input id="yop-poll-start-date-input" type="text"
6840
  name="yop_poll_options[start_date]"
6841
- value="<?php echo '' == $default_options['start_date'] ? current_time('mysql') : $default_options['start_date']; ?>" />
6842
  </td>
6843
  </tr>
6844
  <tr>
6845
- <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>:</label><br><font size="0">(<?php _e('Current Server Time', 'yop_poll'); echo ': ' . current_time( 'mysql' ); ?>)</font>
 
 
6846
  </th>
6847
- <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']; ?>" />
6848
  <label for="yop-poll-never-expire"><input type="checkbox"
6849
- <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
6850
  id="yop-poll-never-expire"
6851
- name="yop_poll_options[never_expire]" value="yes" /> <?php _e( 'No end date', 'yop_poll'); ?></label>
6852
  </td>
6853
  </tr>
6854
  </tbody>
@@ -6857,7 +6474,7 @@ EOT;
6857
  </div>
6858
  <div class="postbox" id="yop-poll-advanced-options-div">
6859
  <div title="Click to toggle" class="handlediv">
6860
- <br />
6861
  </div>
6862
  <h3 class="hndle">
6863
  <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
@@ -6871,32 +6488,33 @@ EOT;
6871
  </th>
6872
  <td><label for="yop-poll-view-results-before-vote"><input
6873
  class="yop-poll-view-results-hide-custom"
6874
- <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6875
  id="yop-poll-view-results-before-vote" type="radio"
6876
- value="before" name="yop_poll_options[view_results]" /> <?php _e( 'Before Vote' , 'yop_poll'); ?></label>
6877
  <label for="yop-poll-view-results-after-vote"><input
6878
  class="yop-poll-view-results-hide-custom"
6879
- <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6880
  id="yop-poll-view-results-after-vote" type="radio"
6881
- value="after" name="yop_poll_options[view_results]" /> <?php _e( 'After Vote' , 'yop_poll'); ?></label>
6882
  <label for="yop-poll-view-results-after-poll-end-date"><input
6883
  class="yop-poll-view-results-hide-custom"
6884
- <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6885
  id="yop-poll-view-results-after-poll-end-date" type="radio"
6886
  value="after-poll-end-date"
6887
- name="yop_poll_options[view_results]" /> <?php _e( 'After Poll End Date' , 'yop_poll'); ?></label>
6888
  <label for="yop-poll-view-results-never"><input
6889
  class="yop-poll-view-results-hide-custom"
6890
- <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6891
  id="yop-poll-view-results-never" type="radio" value="never"
6892
- name="yop_poll_options[view_results]" /> <?php _e( 'Never' , 'yop_poll'); ?></label>
6893
  <label for="yop-poll-view-results-custom"><input
6894
  class="yop-poll-view-results-show-custom"
6895
- <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6896
  id="yop-poll-view-results-custom" type="radio"
6897
- value="custom-date" name="yop_poll_options[view_results]" /> <?php _e( 'Custom Date' , 'yop_poll'); ?></label>
6898
- <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
6899
- <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' ); ?>:</label>
 
6900
  <input id="yop-poll-view-results-start-date" type="text"
6901
  name="yop_poll_options[view_results_start_date]"
6902
  value="<?php echo $default_options['view_results_start_date']; ?>">
@@ -6908,19 +6526,19 @@ EOT;
6908
  </th>
6909
  <td><label for="yop-poll-view-results-permissions-quest-only"><input
6910
  id="yop-poll-view-results-permissions-quest-only"
6911
- <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6912
  type="radio" value="quest-only"
6913
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Guest Only' , 'yop_poll'); ?></label>
6914
  <label for="yop-poll-view-results-permissions-registered-only"><input
6915
  id="yop-poll-view-results-permissions-registered-only"
6916
- <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6917
  type="radio" value="registered-only"
6918
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Registered Users Only' , 'yop_poll'); ?></label>
6919
  <label for="yop-poll-view-results-permissions-guest-registered"><input
6920
  id="yop-poll-view-results-permissions-guest-registered"
6921
- <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6922
  type="radio" value="guest-registered"
6923
- name="yop_poll_options[view_results_permissions]" /> <?php _e( 'Guest &amp; Registered Users' , 'yop_poll'); ?></label>
6924
  </td>
6925
  </tr>
6926
  <tr>
@@ -6929,35 +6547,36 @@ EOT;
6929
  </th>
6930
  <td><label for="yop-poll-view-results-votes-number"><input
6931
  id="yop-poll-view-results-votes-number"
6932
- <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6933
  type="radio" value="votes-number"
6934
- name="yop_poll_options[view_results_type]" /> <?php _e( 'By Votes Number' , 'yop_poll'); ?></label>
6935
  <label for="yop-poll-view-results-percentages"><input
6936
  id="yop-poll-view-results-percentages"
6937
- <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6938
  type="radio" value="percentages"
6939
- name="yop_poll_options[view_results_type]" /> <?php _e( 'Percentages' , 'yop_poll'); ?></label>
6940
  <label
6941
  for="yop-poll-view-results-votes-number-and-percentages"><input
6942
  id="yop-poll-view-results-votes-number-and-percentages"
6943
- <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6944
  type="radio" value="votes-number-and-percentages"
6945
- name="yop_poll_options[view_results_type]" /> <?php _e( 'by Votes Number and Percentages' , 'yop_poll'); ?></label>
6946
  </td>
6947
  </tr>
6948
  <tr>
6949
  <th>
6950
- <?php _e( 'Poll Answer Result Label', 'yop_poll'); ?>:
6951
  </th>
6952
  <td><input id="yop-poll-answer-result-label" type="text"
6953
  name="yop_poll_options[answer_result_label]"
6954
- value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>" />
6955
- <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>
6956
  </td>
6957
  </tr>
6958
  <tr>
6959
  <th>
6960
- <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>:
 
6961
  </th>
6962
  <td>
6963
  <?php _e( 'Singular', 'yop_poll' ); ?>
@@ -6965,13 +6584,13 @@ EOT;
6965
  id="yop-poll-singular-answer-result-votes-number-label"
6966
  type="text"
6967
  name="yop_poll_options[singular_answer_result_votes_number_label]"
6968
- value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>" />
6969
  <?php _e( 'Plural', 'yop_poll' ); ?>
6970
  <input
6971
  id="yop-poll-plural-answer-result-votes-number-label"
6972
  type="text"
6973
  name="yop_poll_options[plural_answer_result_votes_number_label]"
6974
- value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>" />
6975
 
6976
  </td>
6977
  </tr>
@@ -6981,7 +6600,7 @@ EOT;
6981
  </th>
6982
  <td><input id="yop-poll-vote-button-label" type="text"
6983
  name="yop_poll_options[vote_button_label]"
6984
- value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>" />
6985
  </td>
6986
  </tr>
6987
  <tr>
@@ -6989,22 +6608,22 @@ EOT;
6989
  <?php _e( 'View Results Link', 'yop_poll' ); ?>:
6990
  </th>
6991
  <td><label for="yop-poll-view-results-link-yes"><input
6992
- <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6993
  id="yop-poll-view-results-link-yes" type="radio"
6994
- value="yes" name="yop_poll_options[view_results_link]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
6995
  <label for="yop-poll-view-results-link-no"><input
6996
- <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6997
  id="yop-poll-view-results-link-no" type="radio" value="no"
6998
- name="yop_poll_options[view_results_link]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
6999
  </td>
7000
  </tr>
7001
- <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
7002
  <th>
7003
  <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
7004
  </th>
7005
  <td><input id="yop-poll-view-results-link-label" type="text"
7006
  name="yop_poll_options[view_results_link_label]"
7007
- value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>" />
7008
  </td>
7009
  </tr>
7010
  <tr>
@@ -7012,23 +6631,23 @@ EOT;
7012
  <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
7013
  </th>
7014
  <td><label for="yop-poll-view-back-to-vote-link-yes"><input
7015
- <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
7016
  id="yop-poll-view-back-to-vote-link-yes" type="radio"
7017
- value="yes" name="yop_poll_options[view_back_to_vote_link]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7018
  <label for="yop-poll-view-back-to-vote-link-no"><input
7019
- <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
7020
  id="yop-poll-view-back-to-vote-link-no" type="radio"
7021
- value="no" name="yop_poll_options[view_back_to_vote_link]" /><?php _e( 'No' , 'yop_poll'); ?></label>
7022
  </td>
7023
  </tr>
7024
- <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;' : ''; ?>">
7025
  <th>
7026
  <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
7027
  </th>
7028
  <td><input id="yop-poll-view-back-to-vote-link-label"
7029
  type="text"
7030
  name="yop_poll_options[view_back_to_vote_link_label]"
7031
- value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>" />
7032
  </td>
7033
  </tr>
7034
  <tr>
@@ -7036,22 +6655,22 @@ EOT;
7036
  <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
7037
  </th>
7038
  <td><label for="yop-poll-view-total-votes-yes"><input
7039
- <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
7040
  id="yop-poll-view-total-votes-yes" type="radio" value="yes"
7041
- name="yop_poll_options[view_total_votes]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7042
  <label for="yop-poll-view-total-votes-no"><input
7043
- <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
7044
  id="yop-poll-view-total-votes-no" type="radio" value="no"
7045
- name="yop_poll_options[view_total_votes]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7046
  </td>
7047
  </tr>
7048
- <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
7049
  <th>
7050
  <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
7051
  </th>
7052
  <td><input id="yop-poll-view-total-votes-label" type="text"
7053
  name="yop_poll_options[view_total_votes_label]"
7054
- value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>" />
7055
  </td>
7056
  </tr>
7057
  <tr>
@@ -7059,22 +6678,22 @@ EOT;
7059
  <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
7060
  </th>
7061
  <td><label for="yop-poll-view-total-answers-yes"><input
7062
- <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
7063
  id="yop-poll-view-total-answers-yes" type="radio"
7064
- value="yes" name="yop_poll_options[view_total_answers]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7065
  <label for="yop-poll-view-total-answers-no"><input
7066
- <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
7067
  id="yop-poll-view-total-answers-no" type="radio" value="no"
7068
- name="yop_poll_options[view_total_answers]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7069
  </td>
7070
  </tr>
7071
- <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
7072
  <th>
7073
  <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
7074
  </th>
7075
  <td><input id="yop-poll-view-total-answers-label" type="text"
7076
  name="yop_poll_options[view_total_answers_label]"
7077
- value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>" />
7078
  </td>
7079
  </tr>
7080
  <tr>
@@ -7083,10 +6702,10 @@ EOT;
7083
  </th>
7084
  <td><input id="yop-poll-message-after-vote" type="text"
7085
  name="yop_poll_options[message_after_vote]"
7086
- value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>" />
7087
  </td>
7088
  </tr>
7089
- <?php if( 'no' == $default_options['has_auto_generate_poll_page'] ) { ?>
7090
  <tr>
7091
  <th>
7092
  <?php _e( 'Auto Generate Poll Page ', 'yop_poll' ); ?>:
@@ -7094,22 +6713,23 @@ EOT;
7094
  <td><input
7095
  <?php checked( 'yes', $default_options['auto_generate_poll_page'] ); ?>
7096
  id="yop-poll-auto-generate-poll-page-yes" type="radio"
7097
- value="yes" name="yop_poll_options[auto_generate_poll_page]" /><label
7098
- for="yop-poll-auto-generate-poll-page-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
7099
  <input
7100
  <?php checked( 'no', $default_options['auto_generate_poll_page'] ); ?>
7101
  id="yop-poll-auto-generate-poll-page-no" type="radio"
7102
- value="no" name="yop_poll_options[auto_generate_poll_page]" /><label
7103
- for="yop-poll-auto-generate-poll-page-no"><?php _e( 'No' , 'yop_poll'); ?></label>
7104
  </td>
7105
  </tr>
7106
  <?php } ?>
7107
  <tr>
7108
- <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>:</label>
 
7109
  </th>
7110
  <td><input id="yop-poll-page-url" type="text"
7111
  name="yop_poll_options[poll_page_url]"
7112
- value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>" />
7113
  </td>
7114
  </tr>
7115
  </tbody>
@@ -7117,9 +6737,7 @@ EOT;
7117
  </div>
7118
  </div>
7119
  <div class="postbox" id="yop-poll-advanced-options-div">
7120
- <div title="Click to toggle" class="handlediv">
7121
- <br />
7122
- </div>
7123
  <h3 class="hndle">
7124
  <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
7125
  </h3>
@@ -7132,14 +6750,14 @@ EOT;
7132
  </th>
7133
  <td><label for="yop-poll-use-captcha-no"><input
7134
  id="yop-poll-use-captcha-no"
7135
- <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
7136
  type="radio" name="yop_poll_options[use_captcha]"
7137
- value="no" /> <?php _e( 'No', 'yop_poll' ); ?></label> <label
7138
  for="yop-poll-use-captcha-yes"><input
7139
  id="yop-poll-use-captcha-yes"
7140
- <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
7141
  type="radio" name="yop_poll_options[use_captcha]"
7142
- value="yes" /> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
7143
  </tr>
7144
  <tr>
7145
  <th>
@@ -7147,95 +6765,103 @@ EOT;
7147
  </th>
7148
  <td><label for="yop-poll-vote-permisions-quest-only"><input
7149
  id="yop-poll-vote-permisions-quest-only"
7150
- <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
7151
  type="radio" value="quest-only"
7152
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Guest Only' , 'yop_poll'); ?></label>
7153
  <label for="yop-poll-vote-permisions-registered-only"><input
7154
  id="yop-poll-vote-permisions-registered-only"
7155
- <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
7156
  type="radio" value="registered-only"
7157
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Registered Users Only' , 'yop_poll'); ?></label>
7158
  <label for="yop-poll-vote-permisions-guest-registered"><input
7159
  id="yop-poll-vote-permisions-guest-registered"
7160
- <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
7161
  type="radio" value="guest-registered"
7162
- name="yop_poll_options[vote_permisions]" /> <?php _e( 'Guest &amp; Registered Users' , 'yop_poll'); ?></label>
7163
  </td>
7164
  </tr>
7165
- <?php if ( false ) { ?>
7166
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
7167
  <th>
7168
  <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
7169
- <?php if ( $pro_options['pro_user'] == 'no' ) { ?>
7170
- <br/><font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll'); ?>)</font>
 
7171
  <?php } ?></label>
7172
  </th>
7173
  <td><label for="yop-poll-vote-permisions-facebook-yes"><input
7174
- <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
7175
  id="yop-poll-vote-permisions-facebook-yes" type="radio"
7176
- value="yes" name="yop_poll_options[vote_permisions_facebook]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7177
  <label for="yop-poll-vote-permisions-facebook-no"><input
7178
- <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
7179
  id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
7180
- name="yop_poll_options[vote_permisions_facebook]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7181
  </td>
7182
  </tr>
7183
- <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;' : ''; ?>">
7184
  <th>
7185
- <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>:
 
7186
  </th>
7187
  <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
7188
  name="yop_poll_options[vote_permisions_facebook_label]"
7189
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>" />
7190
  </td>
7191
  </tr>
7192
- <?php } ?>
7193
 
7194
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
7195
  <th>
7196
- <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?><br><font size="0"> (<?php _e('Will force users to login into your blog', 'yop_poll'); ?>)</font>:
 
 
7197
  </th>
7198
  <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
7199
- <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
7200
  id="yop-poll-vote-permisions-wordpress-yes" type="radio"
7201
- value="yes" name="yop_poll_options[vote_permisions_wordpress]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7202
  <label for="yop-poll-vote-permisions-wordpress-no"><input
7203
- <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
7204
  id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
7205
- name="yop_poll_options[vote_permisions_wordpress]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7206
  </td>
7207
  </tr>
7208
- <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;' : ''; ?>">
7209
  <th>
7210
- <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>:
 
7211
  </th>
7212
  <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
7213
  name="yop_poll_options[vote_permisions_wordpress_label]"
7214
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>" />
7215
  </td>
7216
- </tr>
7217
 
7218
- <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
7219
  <th>
7220
- <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?><br><font size="0">(<?php _e('Logged users will be treated as anonymous', 'yop_poll'); ?>)</font>:
 
 
7221
  </th>
7222
  <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
7223
- <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
7224
  id="yop-poll-vote-permisions-anonymous-yes" type="radio"
7225
- value="yes" name="yop_poll_options[vote_permisions_anonymous]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7226
  <label for="yop-poll-vote-permisions-anonymous-no"><input
7227
- <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
7228
  id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
7229
- name="yop_poll_options[vote_permisions_anonymous]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7230
  </td>
7231
- </tr>
7232
- <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;' : ''; ?>">
7233
  <th>
7234
- <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>:
 
7235
  </th>
7236
  <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
7237
  name="yop_poll_options[vote_permisions_anonymous_label]"
7238
- value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>" />
7239
  </td>
7240
  </tr>
7241
 
@@ -7245,67 +6871,69 @@ EOT;
7245
  </th>
7246
  <td><label for="yop-poll-blocking-voters-dont-block"><input
7247
  class="yop-poll-blocking-voters-hide-interval"
7248
- <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
7249
  id="yop-poll-blocking-voters-dont-block" type="radio"
7250
- value="dont-block" name="yop_poll_options[blocking_voters]" /> <?php _e( 'Dont`t Block' , 'yop_poll'); ?></label>
7251
  <label for="yop-poll-blocking-voters-cookie"><input
7252
  class="yop-poll-blocking-voters-show-interval"
7253
- <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
7254
  id="yop-poll-blocking-voters-cookie" type="radio"
7255
- value="cookie" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Cookie' , 'yop_poll'); ?></label>
7256
  <label for="yop-poll-blocking-voters-ip"><input
7257
  class="yop-poll-blocking-voters-show-interval"
7258
- <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
7259
  id="yop-poll-blocking-voters-ip" type="radio" value="ip"
7260
- name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Ip' , 'yop_poll'); ?></label>
7261
  <label for="yop-poll-blocking-voters-username"><input
7262
  class="yop-poll-blocking-voters-show-interval"
7263
- <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
7264
  id="yop-poll-blocking-voters-username" type="radio"
7265
- value="username" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Username' , 'yop_poll'); ?></label>
7266
  <label for="yop-poll-blocking-voters-cookie-ip"><input
7267
  class="yop-poll-blocking-voters-show-interval"
7268
- <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
7269
  id="yop-poll-blocking-voters-cookie-ip" type="radio"
7270
- value="cookie-ip" name="yop_poll_options[blocking_voters]" /> <?php _e( 'By Cookie &amp; Ip' , 'yop_poll'); ?></label>
7271
  </td>
7272
  </tr>
7273
- <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
7274
  <th>
7275
  <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
7276
  </th>
7277
  <td><input type="text"
7278
  name="yop_poll_options[blocking_voters_interval_value]"
7279
  id="yop-poll-blocking-voters-interval-value"
7280
- value="<?php echo $default_options['blocking_voters_interval_value']; ?>" />
7281
  <select id="yop-poll-blocking-voters-interval-unit"
7282
  name="yop_poll_options[blocking_voters_interval_unit]">
7283
  <option
7284
- <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
7285
  value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
7286
  <option
7287
- <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
7288
  value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
7289
  <option
7290
- <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
7291
  value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
7292
  <option
7293
- <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
7294
  value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
7295
  </select></td>
7296
  </tr>
7297
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
7298
  <th>
7299
- <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>:<br><font size="0">(<?php _e('Only for logged users', 'yop_poll'); ?>)</font>
 
 
7300
  </th>
7301
  <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
7302
- <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
7303
  id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
7304
- value="yes" name="yop_poll_options[limit_number_of_votes_per_user]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7305
  <label for="yop-poll-limit-number-of-votes-per-user-no"><input
7306
- <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
7307
  id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
7308
- name="yop_poll_options[limit_number_of_votes_per_user]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7309
  </td>
7310
  </tr>
7311
  <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;' : '' ?>">
@@ -7314,25 +6942,26 @@ EOT;
7314
  </th>
7315
  <td><input id="yop-poll-number-of-votes-per-user" type="text"
7316
  name="yop_poll_options[number_of_votes_per_user]"
7317
- value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>" />
7318
  </td>
7319
  </tr>
7320
  <tr>
7321
  <th><?php _e( 'Poll Template ', 'yop_poll' ); ?>:</th>
7322
  <td>
7323
  <?php
7324
- $templates = YOP_POLL_MODEL::get_yop_poll_templates_search ( 'id', 'asc' );
7325
  ?>
7326
  <select class="yop-poll-template" id="yop-poll-template"
7327
  name="yop_poll_options[template]"
7328
  onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_page_template', 1);">
7329
- <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
7330
  <?php
7331
- if (count ( $templates ) > 0) {
7332
  foreach ( $templates as $template ) {
7333
  ?>
7334
  <option
7335
- <?php if($default_options['template'] == $template['id'] ) echo 'selected="selected"'?>
 
7336
  value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
7337
  <?php
7338
  }
@@ -7340,9 +6969,9 @@ EOT;
7340
  ?>
7341
  </select>
7342
  <div id="yop_poll_preview_page_template" style="position: relative; float: right;">
7343
- <?php
7344
- if( ($default_options['template']) )
7345
- print(Yop_Poll_Model::return_template_preview_html( $default_options['template'], 1 ));
7346
  ?>
7347
  </div>
7348
  </td>
@@ -7355,25 +6984,26 @@ EOT;
7355
  type="text"
7356
  name="yop_poll_options[template_width]"
7357
  style="width: 50%;"
7358
- value="<?php echo $default_options['template_width']; ?>" />
7359
  </td>
7360
  </tr>
7361
  <tr>
7362
  <th><?php _e( 'Widget Template ', 'yop_poll' ); ?>:</th>
7363
  <td>
7364
  <?php
7365
- $templates = YOP_POLL_MODEL::get_yop_poll_templates_search ( 'id', 'asc' );
7366
  ?>
7367
  <select class="yop-poll-widget-template" id="yop-poll-widget-template"
7368
  name="yop_poll_options[widget_template]"
7369
  onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_widget_template', 2);">
7370
- <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
7371
  <?php
7372
- if (count ( $templates ) > 0) {
7373
  foreach ( $templates as $template ) {
7374
  ?>
7375
  <option
7376
- <?php if($default_options['widget_template'] == $template['id'] ) echo 'selected="selected"'?>
 
7377
  value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
7378
  <?php
7379
  }
@@ -7381,9 +7011,9 @@ EOT;
7381
  ?>
7382
  </select>
7383
  <div id="yop_poll_preview_widget_template" style="position: relative; float: right;">
7384
- <?php
7385
- if( ($default_options['widget_template']) )
7386
- print(Yop_Poll_Model::return_template_preview_html( $default_options['widget_template'], 2 ));
7387
  ?>
7388
  </div>
7389
  </td>
@@ -7396,7 +7026,7 @@ EOT;
7396
  type="text"
7397
  name="yop_poll_options[widget_template_width]"
7398
  style="width: 50%;"
7399
- value="<?php echo $default_options['widget_template_width']; ?>" />
7400
  </td>
7401
  </tr>
7402
  <tr>
@@ -7405,7 +7035,7 @@ EOT;
7405
  </th>
7406
  <td><input id="yop-poll-percentages-decimals" type="text"
7407
  name="yop_poll_options[percentages_decimals]"
7408
- value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>" />
7409
  </td>
7410
  </tr>
7411
  <tr>
@@ -7413,24 +7043,24 @@ EOT;
7413
  <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
7414
  </th>
7415
  <td><label for="yop-poll-use-default-loading-image-yes"><input
7416
- <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7417
  id="yop-poll-use-default-loading-image-yes" type="radio"
7418
  value="yes"
7419
- name="yop_poll_options[use_default_loading_image]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7420
  <label for="yop-poll-use-default-loading-image-no"><input
7421
- <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7422
  id="yop-poll-use-default-loading-image-no" type="radio"
7423
  value="no"
7424
- name="yop_poll_options[use_default_loading_image]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7425
  </td>
7426
  </tr>
7427
- <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;' : ''; ?>">
7428
  <th>
7429
  <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
7430
  </th>
7431
  <td><input id="yop-poll-loading-image-url" type="text"
7432
  name="yop_poll_options[loading_image_url]"
7433
- value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>" />
7434
  </td>
7435
  </tr>
7436
 
@@ -7439,24 +7069,24 @@ EOT;
7439
  <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
7440
  </th>
7441
  <td><label for="yop-poll-redirect-after-vote-yes"><input
7442
- <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7443
  id="yop-poll-redirect-after-vote-yes" type="radio"
7444
  value="yes"
7445
- name="yop_poll_options[redirect_after_vote]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7446
  <label for="yop-poll-redirect-after-vote-no"><input
7447
- <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7448
  id="yop-poll-redirect-after-vote-no" type="radio"
7449
  value="no"
7450
- name="yop_poll_options[redirect_after_vote]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7451
  </td>
7452
  </tr>
7453
- <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
7454
  <th>
7455
  <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
7456
  </th>
7457
  <td><input id="yop-poll-redirect-after-vote-url" type="text"
7458
  name="yop_poll_options[redirect_after_vote_url]"
7459
- value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>" />
7460
  </td>
7461
  </tr>
7462
 
@@ -7465,33 +7095,35 @@ EOT;
7465
  <?php _e( 'Reset Poll Stats Automatically', 'yop_poll' ); ?>:
7466
  </th>
7467
  <td><label for="yop-poll-schedule-reset-poll-stats-yes"><input
7468
- <?php echo 'yes' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7469
  id="yop-poll-schedule-reset-poll-stats-yes" type="radio"
7470
  value="yes"
7471
- name="yop_poll_options[schedule_reset_poll_stats]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7472
  <label for="yop-poll-schedule-reset-poll-stats-no"><input
7473
- <?php echo 'no' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7474
  id="yop-poll-schedule-reset-poll-stats-no" type="radio"
7475
  value="no"
7476
- name="yop_poll_options[schedule_reset_poll_stats]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7477
  </td>
7478
  </tr>
7479
- <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;' : ''; ?>">
7480
  <th>
7481
- <?php _e( 'Reset Stats Date', 'yop_poll' ); ?>:<br><font size="0">(<?php _e('Current Server Time', 'yop_poll'); echo ': ' . current_time( 'mysql' ); ?>)</font>
 
 
7482
  </th>
7483
  <td><input id="yop-poll-schedule-reset-poll-stats-date" type="text"
7484
  name="yop_poll_options[schedule_reset_poll_date]"
7485
- value="<?php echo date( 'Y-m-d H:i:s', $default_options['schedule_reset_poll_date'] ); ?>" />
7486
  </td>
7487
  </tr>
7488
- <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;' : ''; ?>">
7489
  <th>
7490
  <?php _e( 'Reset Stats Every', 'yop_poll' ); ?>:
7491
  </th>
7492
  <td><input style="width:20%" id="yop-poll-schedule-reset-poll-stats-recurring-value" type="text"
7493
  name="yop_poll_options[schedule_reset_poll_recurring_value]"
7494
- value="<?php echo esc_html( stripslashes( $default_options['schedule_reset_poll_recurring_value'] ) ); ?>" />
7495
  <select name="yop_poll_options[schedule_reset_poll_recurring_unit]">
7496
  <option value="hour" <?php echo selected( 'hour', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>HOURS</option>
7497
  <option value="day" <?php echo selected( 'day', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>DAYS</option>
@@ -7500,11 +7132,13 @@ EOT;
7500
  </tr>
7501
  <tr>
7502
  <th>
7503
- <?php _e( 'Poll Date Format', 'yop_poll' ); ?>: <br /><font size="0"><?php _e('Check', 'yop_popll') ?> <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e('documentation', 'yop_popll') ?></a></font>
 
 
7504
  </th>
7505
  <td><input id="yop-poll-date-format" type="text"
7506
  name="yop_poll_options[date_format]"
7507
- value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>" />
7508
  </td>
7509
  </tr>
7510
  </tbody>
@@ -7513,7 +7147,7 @@ EOT;
7513
  </div>
7514
  <div class="postbox" id="yop-poll-advanced-options-div">
7515
  <div title="Click to toggle" class="handlediv">
7516
- <br />
7517
  </div>
7518
  <h3 class="hndle">
7519
  <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
@@ -7528,32 +7162,32 @@ EOT;
7528
  <td><input
7529
  <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
7530
  id="yop-poll-view-poll-archive-link-yes" type="radio"
7531
- value="yes" name="yop_poll_options[view_poll_archive_link]" /><label
7532
- for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
7533
  <input
7534
  <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
7535
  id="yop-poll-view-poll-archive-link-no" type="radio"
7536
- value="no" name="yop_poll_options[view_poll_archive_link]" /><label
7537
- for="yop-poll-view-poll-archive-link-no"><?php _e( 'No' , 'yop_poll'); ?></label>
7538
  </td>
7539
  </tr>
7540
- <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;' : ''; ?>">
7541
  <th>
7542
  <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
7543
  </th>
7544
  <td><input id="yop-poll-view-poll-archive-link-label"
7545
  type="text"
7546
  name="yop_poll_options[view_poll_archive_link_label]"
7547
- value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>" />
7548
  </td>
7549
  </tr>
7550
- <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
7551
  <th>
7552
  <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
7553
  </th>
7554
  <td><input id="yop-poll-poll-archive-url" type="text"
7555
  name="yop_poll_options[poll_archive_url]"
7556
- value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>" />
7557
  </td>
7558
  </tr>
7559
  <tr>
@@ -7563,20 +7197,20 @@ EOT;
7563
  <td><label for="yop-poll-show-in-archive-yes"><input
7564
  <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
7565
  id="yop-poll-show-in-archive-yes" type="radio" value="yes"
7566
- name="yop_poll_options[show_in_archive]" /> <?php _e( 'Yes' , 'yop_poll'); ?></label>
7567
  <label for="yop-poll-show-in-archive-no"><input
7568
  <?php checked( 'no', $default_options['show_in_archive'] ); ?>
7569
  id="yop-poll-show-in-archive-no" type="radio" value="no"
7570
- name="yop_poll_options[show_in_archive]" /> <?php _e( 'No' , 'yop_poll'); ?></label>
7571
  </td>
7572
  </tr>
7573
- <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
7574
  <th>
7575
  <?php _e( 'Archive Order', 'yop_poll' ); ?>:
7576
  </th>
7577
  <td><input id="yop-poll-show-in-archive-order" type="text"
7578
  name="yop_poll_options[archive_order]"
7579
- value="<?php echo esc_html( stripslashes( $default_options['archive_order'] ) ); ?>" />
7580
  </td>
7581
  </tr>
7582
 
@@ -7585,7 +7219,7 @@ EOT;
7585
  </div>
7586
  <div class="postbox" id="yop-poll-advanced-options-div8">
7587
  <div title="Click to toggle" class="handlediv">
7588
- <br />
7589
  </div>
7590
  <h3 class="hndle">
7591
  <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
@@ -7599,15 +7233,15 @@ EOT;
7599
  </th>
7600
  <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
7601
  id="yop-poll-send-email-notifications-yes" type="radio"
7602
- value="yes" name="yop_poll_options[send_email_notifications]" /><label
7603
- for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
7604
  <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
7605
  id="yop-poll-send-email-notifications-no" type="radio"
7606
- value="no" name="yop_poll_options[send_email_notifications]" /><label
7607
- for="yop-poll-send-email-notifications-no"><?php _e( 'No' , 'yop_poll'); ?></label>
7608
  </td>
7609
  </tr>
7610
- <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;' : ''; ?>">
7611
  <th>
7612
  <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
7613
  </th>
@@ -7615,10 +7249,10 @@ EOT;
7615
  <input id="yop-poll-email-notifications-from-name"
7616
  type="text"
7617
  name="yop_poll_options[email_notifications_from_name]"
7618
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>" />
7619
  </td>
7620
  </tr>
7621
- <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;' : ''; ?>">
7622
  <th>
7623
  <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
7624
  </th>
@@ -7626,21 +7260,22 @@ EOT;
7626
  <input id="yop-poll-email-notifications-from-email"
7627
  type="text"
7628
  name="yop_poll_options[email_notifications_from_email]"
7629
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>" />
7630
  </td>
7631
  </tr>
7632
- <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;' : ''; ?>">
7633
  <th>
7634
- <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>:<br><font size="0"><?php _e('Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll') ?></font>
 
7635
  </th>
7636
  <td valign="top">
7637
  <input id="yop-poll-email-notifications-recipients"
7638
  type="text"
7639
  name="yop_poll_options[email_notifications_recipients]"
7640
- value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>" />
7641
  </td>
7642
  </tr>
7643
- <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;' : ''; ?>">
7644
  <th>
7645
  <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
7646
  </th>
@@ -7652,7 +7287,7 @@ EOT;
7652
  />
7653
  </td>
7654
  </tr>
7655
- <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;' : ''; ?>">
7656
  <th>
7657
  <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
7658
  </th>
@@ -7664,15 +7299,15 @@ EOT;
7664
  </table>
7665
  </div>
7666
  </div>
7667
- <?php if ( false ) { ?>
7668
  <div class="postbox" id="yop-poll-advanced-options-div9">
7669
  <div title="Click to toggle" class="handlediv">
7670
- <br />
7671
  </div>
7672
  <h3 class="hndle">
7673
  <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
7674
- <?php if ( $pro_options['pro_user'] == 'no' ) { ?>
7675
- <font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll'); ?>)</font>
7676
  <?php } ?>
7677
  </span>
7678
  </h3>
@@ -7686,55 +7321,55 @@ EOT;
7686
  <td><input
7687
  <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
7688
  id="yop-poll-share-after-vote-yes" type="radio"
7689
- value="yes" name="yop_poll_options[share_after_vote]" /><label
7690
- for="yop-poll-share-after-vote-yes"><?php _e( 'Yes' , 'yop_poll'); ?></label>
7691
  <input
7692
  <?php checked( 'no', $default_options['share_after_vote'] ); ?>
7693
  id="yop-poll-share-after-vote-no" type="radio"
7694
- value="no" name="yop_poll_options[share_after_vote]" /><label
7695
- for="yop-poll-share-after-vote-no"><?php _e( 'No' , 'yop_poll'); ?></label>
7696
  </td>
7697
  </tr>
7698
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7699
  <th>
7700
  <?php _e( 'Share Name', 'yop_poll' ); ?>:
7701
  </th>
7702
  <td><input id="yop-poll-share-name"
7703
  type="text"
7704
  name="yop_poll_options[share_name]"
7705
- value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>" />
7706
  </td>
7707
- </tr>
7708
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7709
  <th>
7710
  <?php _e( 'Share Caption', 'yop_poll' ); ?>:
7711
  </th>
7712
  <td><input id="yop-poll-share-caption"
7713
  type="text"
7714
  name="yop_poll_options[share_caption]"
7715
- value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>" />
7716
  </td>
7717
  </tr>
7718
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7719
  <th>
7720
  <?php _e( 'Share Description', 'yop_poll' ); ?>:
7721
  </th>
7722
  <td><input id="yop-poll-share-description"
7723
  type="text"
7724
  name="yop_poll_options[share_description]"
7725
- value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>" />
7726
  </td>
7727
- </tr>
7728
- <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7729
  <th>
7730
  <?php _e( 'Share Picture', 'yop_poll' ); ?>:
7731
  </th>
7732
  <td><input id="yop-poll-share-picture"
7733
  type="text"
7734
  name="yop_poll_options[share_picture]"
7735
- value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>" />
7736
  </td>
7737
- </tr>
7738
 
7739
  </table>
7740
  </div>
@@ -7742,18 +7377,18 @@ EOT;
7742
  <?php } ?>
7743
  </div>
7744
  <input type="hidden" value="<?php echo $poll_id ?>"
7745
- name="yop_poll_id" id="yop-poll-edit-add-new-form-poll-id" /> <input
7746
  type="hidden" value="<?php echo $action_type ?>"
7747
- name="action_type" id="yop-poll-edit-add-new-form-action-type" />
7748
  <input type="button" accesskey="p" class="button-primary"
7749
  value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7750
- id="yop-poll-edit-add-new-form-submit" />
7751
  </div>
7752
  <div class="postbox-container" id="postbox-container-1">
7753
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
7754
  <div class="postbox " id="linksubmitdiv">
7755
  <div title="Click to toggle" class="handlediv">
7756
- <br />
7757
  </div>
7758
  <h3 class="hndle">
7759
  <span><?php _e( 'Save', 'yop_poll' ); ?></span>
@@ -7764,7 +7399,7 @@ EOT;
7764
  <div id="publishing-action">
7765
  <input type="button" accesskey="p" class="button-primary"
7766
  value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7767
- id="yop-poll-edit-add-new-form-submit1" />
7768
  </div>
7769
  <div class="clear"></div>
7770
  </div>
@@ -7775,7 +7410,7 @@ EOT;
7775
  <?php if ( 'edit' == $action ) : ?>
7776
  <div id="submitdiv" class="postbox ">
7777
  <div title="Click to toggle" class="handlediv">
7778
- <br />
7779
  </div>
7780
  <h3 class="hndle">
7781
  <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
@@ -7785,25 +7420,29 @@ EOT;
7785
  <div id="minor-publishing">
7786
  <div id="misc-publishing-actions">
7787
  <div class="misc-pub-section">
7788
- <label for="post_status"><?php _e('Poll Author', 'yop_poll') ?>:</label>
7789
- <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'] ); echo $poll_author->user_nicename; ?></b></span>
 
 
7790
  <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>
7791
  </div>
7792
  </div>
7793
  <div id="misc-publishing-actions">
7794
  <div class="misc-pub-section">
7795
- <label for="post_status"><?php _e('Total Votes', 'yop_poll') ?>:</label>
 
7796
  <span id="yop-poll-change-no-votes-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_votes'] ?></b></span>
7797
  <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>
7798
  </div>
7799
  </div>
7800
  <div id="misc-publishing-actions">
7801
  <div class="misc-pub-section">
7802
- <label for="post_status"><?php _e('Total Answers', 'yop_poll') ?>:</label>
 
7803
  <span id="yop-poll-change-no-answers-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_answers'] ?></b></span>
7804
  <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>
7805
  </div>
7806
- </div>
7807
  </div>
7808
  <div class="clear"></div>
7809
  </div>
@@ -7819,28 +7458,29 @@ EOT;
7819
  </div>
7820
  <?php
7821
  }
 
7822
  public function view_add_edit_poll_template() {
7823
  global $action, $current_user;
7824
- $page_name = __ ( 'Add New Poll Template', 'yop_poll' );
7825
  $action_type = 'add-new';
7826
  $template_id = '';
7827
- if ('edit' == $action) {
7828
- $template_id = (isset ( $_GET ['id'] ) ? intval ( $_GET ['id'] ) : 0);
7829
- $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id ( 'template_author', $template_id );
7830
- if ((! $this->current_user_can ( 'edit_own_polls_templates' ) || $template_author != $current_user->ID) && (! $this->current_user_can ( 'edit_polls_templates' )))
7831
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
7832
- $page_name = __ ( 'Edit Poll Template', 'yop_poll' );
7833
  $action_type = 'edit';
7834
  }
7835
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
7836
- $current_template = YOP_POLL_MODEL::get_poll_template_from_database_by_id ( $template_id );
7837
  ?>
7838
  <div class="wrap">
7839
  <div class="icon32 icon32-yop-poll">
7840
  <br>
7841
 
7842
  </div>
7843
- <h2><?php print $page_name; ?><?php if( 'edit' == $action ): ?><a
7844
  class="add-new-h2"
7845
  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>
7846
  <div id="message"></div>
@@ -7857,7 +7497,7 @@ EOT;
7857
  <div class="inside">
7858
  <input type="text" id="yop-poll-template-name"
7859
  value="<?php echo esc_html( stripslashes( $current_template['name'] ) ); ?>"
7860
- tabindex="1" name="yop_poll_template_name" size="30" />
7861
  <p><?php _e( 'Example: Test Poll Template', 'yop_poll' ); ?></p>
7862
  </div>
7863
  </div>
@@ -7866,7 +7506,7 @@ EOT;
7866
  <label for="yop-poll-before_vote-template-input"><?php _e( 'Template Before Vote', 'yop_poll' ); ?></label>
7867
  </h3>
7868
  <div class="inside">
7869
- <?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 )); ?>
7870
  </div>
7871
  </div>
7872
  <div class="stuffbox" id="yop-poll-after-vote-template-div">
@@ -7874,7 +7514,7 @@ EOT;
7874
  <label for="yop-poll-after-vote-template-input"><?php _e( 'Template After Vote', 'yop_poll' ); ?></label>
7875
  </h3>
7876
  <div class="inside">
7877
- <?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 )); ?>
7878
  </div>
7879
  </div>
7880
  <div class="postbox" id="yop-poll-template-before-start-date-div">
@@ -7887,7 +7527,7 @@ EOT;
7887
  <label for="yop-poll-template-before-start-date-input"><?php _e( 'Template Before Start Date', 'yop_poll' ); ?></label>
7888
  </h3>
7889
  <div class="inside">
7890
- <?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 )); ?>
7891
  </div>
7892
  </div>
7893
  <div class="postbox" id="yop-poll-template-after-end-date-div">
@@ -7900,7 +7540,7 @@ EOT;
7900
  <label for="yop-poll-template-after-end-date-input"><?php _e( 'Template After End Date', 'yop_poll' ); ?></label>
7901
  </h3>
7902
  <div class="inside">
7903
- <?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 )); ?>
7904
  </div>
7905
  </div>
7906
  <div class="postbox" id="yop-poll-template-css-div">
@@ -7913,7 +7553,7 @@ EOT;
7913
  <label for="yop-poll-template-css-input"><?php _e( 'Css', 'yop_poll' ); ?></label>
7914
  </h3>
7915
  <div class="inside">
7916
- <?php wp_editor( stripslashes( $current_template['css'] ), 'yop-poll-template-css-input', array( 'textarea_name' => 'yop_poll_template_css', 'teeny' => true, 'media_buttons' => false )); ?>
7917
  </div>
7918
  </div>
7919
  <div class="postbox" id="yop-poll-template-js-div">
@@ -7926,25 +7566,25 @@ EOT;
7926
  <label for="yop-poll-template-js-input"><?php _e( 'JavaScript', 'yop_poll' ); ?></label>
7927
  </h3>
7928
  <div class="inside">
7929
- <?php wp_editor( stripslashes( $current_template['js'] ), 'yop-poll-template-js-input', array( 'textarea_name' => 'yop_poll_template_js', 'teeny' => true, 'media_buttons' => false )); ?>
7930
  </div>
7931
  </div>
7932
 
7933
  <input type="hidden" value="<?php echo $current_template['id']; ?>"
7934
  name="template_id"
7935
- id="yop-poll-edit-add-new-template-form-template-id" /> <input
7936
  type="hidden" value="<?php echo $action_type ?>"
7937
  name="action_type"
7938
- id="yop-poll-edit-add-new-template-form-action-type" /> <input
7939
  type="button" class="button-primary"
7940
- value="<?php _e('Save Poll Template', 'yop_poll' ) ?>"
7941
- id="yop-poll-edit-add-new-template-form-save" />
7942
  </div>
7943
  <div class="postbox-container" id="postbox-container-1">
7944
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
7945
  <div class="postbox " id="linksubmitdiv">
7946
  <div title="Click to toggle" class="handlediv">
7947
- <br />
7948
  </div>
7949
  <h3 class="hndle">
7950
  <span><?php _e( 'Save', 'yop_poll' ); ?></span>
@@ -7955,7 +7595,7 @@ EOT;
7955
  <div id="publishing-action">
7956
  <input type="button" accesskey="p" class="button-primary"
7957
  value="<?php _e( 'Save Poll Template', 'yop_poll' ); ?>"
7958
- id="yop-poll-edit-add-new-template-form-save1" />
7959
  </div>
7960
  <div class="clear"></div>
7961
  </div>
@@ -7964,11 +7604,11 @@ EOT;
7964
  </div>
7965
  </div>
7966
  <?php
7967
- if ('edit' == $action) {
7968
  ?>
7969
  <div id="submitdiv" class="postbox ">
7970
  <div title="Click to toggle" class="handlediv">
7971
- <br />
7972
  </div>
7973
  <h3 class="hndle">
7974
  <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
@@ -7978,11 +7618,13 @@ EOT;
7978
  <div id="minor-publishing">
7979
  <div id="misc-publishing-actions">
7980
  <div class="misc-pub-section">
7981
- <label for="post_status"><?php _e('Template Author', 'yop_poll') ?>:</label>
7982
- <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'] ); echo $template_author->user_nicename; ?></b></span>
 
 
7983
  <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>
7984
  </div>
7985
- </div>
7986
  </div>
7987
  <div class="clear"></div>
7988
  </div>
@@ -7990,27 +7632,28 @@ EOT;
7990
  <div id="minor-publishing">
7991
  <div id="misc-publishing-actions">
7992
  <div class="misc-pub-section">
7993
- <p><?php _e( 'Select Template For Reset', 'yop_poll') ?>:</p>
 
7994
  <select name="yop_poll_reset_template_id"
7995
  id="yop-poll-reset-template-id">
7996
- <option <?php selected('White', $current_template['name'] ); ?> value="1"><?php _e( 'White', 'yop_poll') ?></option>
7997
- <option <?php selected('Grey', $current_template['name'] ); ?> value="2"><?php _e( 'Grey', 'yop_poll') ?></option>
7998
- <option <?php selected('Dark', $current_template['name'] ); ?> value="3"><?php _e( 'Dark', 'yop_poll') ?></option>
7999
- <option <?php selected('Blue v1', $current_template['name'] ); ?> value="4"><?php _e( 'Blue v1', 'yop_poll') ?></option>
8000
- <option <?php selected('Blue v2', $current_template['name'] ); ?> value="5"><?php _e( 'Blue v2', 'yop_poll') ?></option>
8001
- <option <?php selected('Blue v3', $current_template['name'] ); ?> value="6"><?php _e( 'Blue v3', 'yop_poll') ?></option>
8002
- <option <?php selected('Red v1', $current_template['name'] ); ?> value="7"><?php _e( 'Red v1', 'yop_poll') ?></option>
8003
- <option <?php selected('Red v2', $current_template['name'] ); ?> value="8"><?php _e( 'Red v2', 'yop_poll') ?></option>
8004
- <option <?php selected('Red v3', $current_template['name'] ); ?> value="9"><?php _e( 'Red v3', 'yop_poll') ?></option>
8005
- <option <?php selected('Green v1', $current_template['name'] ); ?> value="10"><?php _e( 'Green v1', 'yop_poll') ?></option>
8006
- <option <?php selected('Green v2', $current_template['name'] ); ?> value="11"><?php _e( 'Green v2', 'yop_poll') ?></option>
8007
- <option <?php selected('Green v3', $current_template['name'] ); ?> value="12"><?php _e( 'Green v3', 'yop_poll') ?></option>
8008
- <option <?php selected('Orange v1', $current_template['name'] ); ?> value="13"><?php _e( 'Orange v1', 'yop_poll') ?></option>
8009
- <option <?php selected('Orange v2', $current_template['name'] ); ?> value="14"><?php _e( 'Orange v2', 'yop_poll') ?></option>
8010
- <option <?php selected('Orange v3', $current_template['name'] ); ?> value="15"><?php _e( 'Orange v3', 'yop_poll') ?></option>
8011
  </select>
8012
- </div>
8013
- </div>
8014
  </div>
8015
  <div class="clear"></div>
8016
  </div>
@@ -8019,7 +7662,7 @@ EOT;
8019
  <div id="publishing-action">
8020
  <input type="button" accesskey="r" class="button-primary"
8021
  value="<?php _e( 'Reset Poll Template', 'yop_poll' ); ?>"
8022
- 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() }" />
8023
  </div>
8024
  <div class="clear"></div>
8025
  </div>
@@ -8047,265 +7690,277 @@ EOT;
8047
  * Start Ajax section
8048
  */
8049
  function ajax_edit_add_new_poll() {
8050
- if (is_admin ()) {
8051
  global $wpdb, $current_user;
8052
- check_ajax_referer ( 'yop-poll-edit-add-new' );
8053
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
 
8054
  $yop_poll_model = new Yop_Poll_Model ();
8055
- if ('add-new' == $_REQUEST ['action_type']) {
8056
- if ((! $this->current_user_can ( 'edit_own_polls' )) && (! $this->current_user_can ( 'edit_polls' )))
8057
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8058
  else {
8059
- $yop_poll_id = $yop_poll_model->add_poll_to_database ( $_REQUEST, $this->_config );
8060
- if ($yop_poll_id) {
8061
- _e ( 'Poll successfully added!', 'yop_poll' );
8062
- } else {
 
8063
  echo $yop_poll_model->error;
8064
  }
8065
  }
8066
  }
8067
- if ('edit' == $_REQUEST ['action_type']) {
8068
- if (ctype_digit ( $_REQUEST ['yop_poll_id'] )) {
8069
- $poll_details = Yop_Poll_Model::get_poll_from_database_by_id( $_REQUEST ['yop_poll_id'] );
8070
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' )))
8071
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8072
  else {
8073
- $yop_poll_id = $yop_poll_model->edit_poll_in_database ( $_REQUEST, $this->_config );
8074
- if ($yop_poll_id)
8075
- _e ( 'Poll successfully Edited!', 'yop_poll' );
8076
  else
8077
  echo $yop_poll_model->error;
8078
  }
8079
- } else
8080
- _e ( 'We\'re unable to update your poll!', 'yop_poll' );
 
8081
  }
8082
  unset ( $yop_poll_model );
8083
  }
8084
  die ();
8085
  }
 
8086
  function ajax_edit_add_new_poll_template() {
8087
- if (is_admin ()) {
8088
  global $wpdb, $current_user;
8089
- check_ajax_referer ( 'yop-poll-edit-add-new-template' );
8090
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8091
  $yop_poll_model = new Yop_Poll_Model ();
8092
- if ('add-new' == $_REQUEST ['action_type']) {
8093
- if ((! $this->current_user_can ( 'edit_own_polls_templates' )) && (! $this->current_user_can ( 'edit_polls_templates' )))
8094
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8095
  else {
8096
- $yop_poll_template_id = $yop_poll_model->add_poll_template_to_database ( $_REQUEST, $this->_config );
8097
- if ($yop_poll_template_id) {
8098
- _e ( 'Poll template successfully added!', 'yop_poll' );
8099
- } else {
 
8100
  echo $yop_poll_model->error;
8101
  }
8102
  }
8103
  }
8104
- if ('edit' == $_REQUEST ['action_type']) {
8105
- if (ctype_digit ( $_REQUEST ['template_id'] )) {
8106
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
8107
- if ((! $this->current_user_can ( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls_templates' )))
8108
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8109
  else {
8110
- $yop_poll_template_id = $yop_poll_model->edit_poll_template_in_database ( $_REQUEST, $this->_config );
8111
- if ($yop_poll_template_id) {
8112
- _e ( 'Poll Template successfully Edited!', 'yop_poll' );
8113
- } else {
 
8114
  echo $yop_poll_model->error;
8115
  }
8116
  }
8117
- } else
8118
- _e ( 'We\'re unable to update your poll template!', 'yop_poll' );
 
8119
  }
8120
  unset ( $yop_poll_model );
8121
  }
8122
  die ();
8123
  }
 
8124
  function ajax_reset_poll_template() {
8125
- if (is_admin ()) {
8126
  global $wpdb, $current_user;
8127
- check_ajax_referer ( 'yop-poll-edit-add-new-template' );
8128
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8129
  $yop_poll_model = new Yop_Poll_Model ();
8130
- if ('edit' == $_REQUEST ['action_type']) {
8131
- if (ctype_digit ( $_REQUEST ['template_id'] )) {
8132
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
8133
- if ((! $this->current_user_can ( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls_templates' )))
8134
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8135
  else {
8136
- $yop_poll_template_id = $yop_poll_model->reset_poll_template ( $_REQUEST, $this->_config );
8137
- if ($yop_poll_template_id) {
8138
- _e ( 'Poll Template Successfully Reseted!', 'yop_poll' );
8139
- } else {
 
8140
  echo $yop_poll_model->error;
8141
  }
8142
  }
8143
- } else
8144
- _e ( 'We\'re unable to reset your poll template!', 'yop_poll' );
 
8145
  }
8146
  unset ( $yop_poll_model );
8147
  }
8148
  die ();
8149
  }
 
8150
  public function yop_poll_do_vote() {
8151
- $error = '';
8152
  $success = '';
8153
  $message = '';
8154
- if (is_admin ()) {
8155
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8156
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8157
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
8158
- if ($poll_id) {
8159
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8160
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8161
  $yop_poll_model->set_unique_id( $unique_id );
8162
- $poll_html = $yop_poll_model->register_vote ( $_REQUEST );
8163
- if ($poll_html) {
8164
  $message = $poll_html;
8165
- $success = $yop_poll_model->success;
8166
- } else {
 
8167
  $error = $yop_poll_model->error;
8168
  }
8169
  unset ( $yop_poll_model );
8170
- } else {
8171
- $error = __ ( 'Invalid Request! Try later!', 'yop_poll' );
 
8172
  }
8173
  }
8174
- print '[ajax-response]' . json_encode ( array (
8175
- 'error' => $error,
8176
- 'success' => $success,
8177
- 'message' => $message
8178
- ) ) . '[/ajax-response]';
8179
  die ();
8180
  }
 
8181
  public function yop_poll_view_results() {
8182
- $error = '';
8183
  $success = '';
8184
  $message = '';
8185
- if (is_admin ()) {
8186
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
8187
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
8188
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
8189
- $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
8190
- if ($poll_id) {
8191
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8192
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8193
  $yop_poll_model->set_unique_id( $unique_id );
8194
  $yop_poll_model->vote = true;
8195
- $poll_html = do_shortcode ( $yop_poll_model->return_poll_html ( array( 'tr_id' => $tr_id, 'location' => $location )) );
8196
- if ($poll_html) {
8197
  $message = $poll_html;
8198
  $success = $yop_poll_model->success;
8199
- } else {
 
8200
  $error = $yop_poll_model->error;
8201
  }
8202
  unset ( $yop_poll_model );
8203
- } else {
8204
- $error = __ ( 'Invalid Request! Try later!', 'yop_poll' );
 
8205
  }
8206
  }
8207
- print '[ajax-response]' . json_encode ( array (
8208
- 'error' => $error,
8209
- 'success' => $success,
8210
- 'message' => $message
8211
- ) ) . '[/ajax-response]';
8212
  die ();
8213
  }
 
8214
  public function yop_poll_back_to_vote() {
8215
- $error = '';
8216
  $success = '';
8217
  $message = '';
8218
- if (is_admin ()) {
8219
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
8220
- $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
8221
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
8222
- $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
8223
- if ($poll_id) {
8224
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8225
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8226
  $yop_poll_model->set_unique_id( $unique_id );
8227
- $poll_html = do_shortcode ( $yop_poll_model->return_poll_html ( array( 'tr_id' => $tr_id, 'location' => $location ) ) );
8228
- if ($poll_html) {
8229
  $message = $poll_html;
8230
  $success = $yop_poll_model->success;
8231
- } else {
 
8232
  $error = $yop_poll_model->error;
8233
  }
8234
  unset ( $yop_poll_model );
8235
- } else {
8236
- $error = __ ( 'Invalid Request! Try later!', 'yop_poll' );
 
8237
  }
8238
  }
8239
- print '[ajax-response]' . json_encode ( array (
8240
- 'error' => $error,
8241
- 'success' => $success,
8242
- 'message' => $message
8243
- ) ) . '[/ajax-response]';
8244
  die ();
8245
  }
 
8246
  public function yop_poll_load_css() {
8247
- header ( 'Content-Type: text/css' );
8248
  // check_ajax_referer('yop-poll-public-css');
8249
- if (is_admin ()) {
8250
- $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
8251
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
8252
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8253
- if ($poll_id) {
8254
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8255
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8256
  $yop_poll_model->set_unique_id( $unique_id );
8257
- $poll_css = $yop_poll_model->return_poll_css ( array( 'location' => $location ) );
8258
  print $poll_css;
8259
  unset ( $yop_poll_model );
8260
  }
8261
  }
8262
  die ();
8263
  }
8264
- public function yop_poll_load_js() {
8265
- header ( 'Content-Type: text/javascript' );
 
8266
  // check_ajax_referer('yop-poll-public-js');
8267
- if (is_admin ()) {
8268
- $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
8269
- $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
8270
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8271
- if ($poll_id) {
8272
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8273
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8274
  $yop_poll_model->set_unique_id( $unique_id );
8275
- $poll_js = $yop_poll_model->return_poll_js ( array( 'location' => $location ) );
8276
  print $poll_js;
8277
  unset ( $yop_poll_model );
8278
  }
8279
  }
8280
  die ();
8281
  }
 
8282
  public function ajax_get_polls_for_editor() {
8283
- check_ajax_referer ( 'yop-poll-editor' );
8284
- if ( is_admin () ) {
8285
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8286
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( 'id', 'asc' );
8287
  ?>
8288
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
8289
  <html xmlns="http://www.w3.org/1999/xhtml">
8290
  <head>
8291
- <title><?php _e('Insert Poll', 'yop_poll'); ?></title>
8292
  <script type="text/javascript"
8293
  src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
8294
  <script type="text/javascript">
8295
  function insertYopPollTinyMce( poll_id, tr_id ) {
8296
- tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
8297
  if ( isNaN( poll_id ) ) {
8298
  alert( '<?php _e( 'Error: Invalid Yop Poll!\n\nPlease choose the poll again:\n\n', 'yop_poll' ) ?>' );
8299
  }
8300
  else {
8301
  if ( poll_id != null && poll_id != '' ) {
8302
- if ( tr_id != '' )
8303
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, '[yop_poll id="'+poll_id+'" tr_id="'+tr_id+'"]' );
8304
- else
8305
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, '[yop_poll id="'+poll_id+'"]' );
 
 
8306
  }
8307
  else {
8308
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, '[yop_poll]' );
8309
  }
8310
  tinyMCEPopup.close();
8311
  }
@@ -8320,7 +7975,7 @@ EOT;
8320
  <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
8321
  <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
8322
  <?php
8323
- if (count ( $yop_polls ) > 0) {
8324
  foreach ( $yop_polls as $yop_poll ) {
8325
  ?>
8326
  <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
@@ -8330,19 +7985,19 @@ EOT;
8330
  ?>
8331
  </select>
8332
  </label>
8333
- <br />
8334
  <label for="yop-poll-tr-id-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span><br>
8335
- <input class="widefat" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog" />
8336
  </label>
8337
 
8338
 
8339
  <center> <input type="button" class="button-primary"
8340
  value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
8341
- onclick=" insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value );" /></center>
8342
- <br />
8343
  <center> <input type="button" class="button-primary"
8344
  value="<?php _e( 'Close', 'yop_poll' ); ?>"
8345
- onclick="tinyMCEPopup.close();" /></center>
8346
  </p>
8347
  </body>
8348
  </html>
@@ -8350,25 +8005,27 @@ EOT;
8350
  }
8351
  die ();
8352
  }
 
8353
  public function ajax_preview_template() {
8354
- if( true/*check_ajax_referer( 'yop-poll-edit-add-new' )*/ ) {
8355
- if( is_admin() ) {
8356
  $template_id = trim( $_POST['template_id'] );
8357
  $loc = trim( $_POST['loc'] );
8358
  require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8359
  $yop_poll_model = new Yop_Poll_Model();
8360
- $template = $yop_poll_model->return_template_preview_html( $template_id, $loc );
8361
  print $template;
8362
  unset( $yop_poll_model );
8363
  }
8364
  }
8365
  die();
8366
  }
 
8367
  public function ajax_get_polls_for_html_editor() {
8368
- check_ajax_referer ( 'yop-poll-html-editor' );
8369
- if (is_admin ()) {
8370
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8371
- $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search ( 'id', 'asc' );
8372
  ?>
8373
  <p style="text-align: center;">
8374
  <label for="yop-poll-id-html-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
@@ -8378,7 +8035,7 @@ EOT;
8378
  <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
8379
  <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
8380
  <?php
8381
- if (count ( $yop_polls ) > 0) {
8382
  foreach ( $yop_polls as $yop_poll ) {
8383
  ?>
8384
  <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
@@ -8386,99 +8043,109 @@ EOT;
8386
  }
8387
  }
8388
  ?>
8389
- </select>
8390
  </label>
8391
- <br /><br />
8392
  <label for="yop-poll-tr-id-html-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span>
8393
- <input type="text" name="yop_poll_tr_id" id="yop-poll-tr-id-html-dialog" class="widefat" value=""/>
8394
- </label>
8395
 
8396
- <br /> <br /> <input type="button" class=""
8397
  value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
8398
- onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value );" />
8399
- <br /> <br /> <input type="button" class=""
8400
- value="<?php _e( 'Close', 'yop_poll' ); ?>" onclick="tb_remove();" />
8401
  </p>
8402
 
8403
  <?php
8404
  }
8405
  die ();
8406
  }
 
8407
  public function ajax_show_captcha() {
8408
- if (is_admin ()) {
8409
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8410
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8411
- if ($poll_id) {
8412
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8413
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8414
  $yop_poll_model->set_unique_id( $unique_id );
8415
  $poll_options = $yop_poll_model->poll_options;
8416
- if ('yes' == $poll_options ['use_captcha']) {
8417
- require_once ($this->_config->plugin_inc_dir . '/securimage.php');
8418
- $img = new Yop_Poll_Securimage ();
8419
- $img->ttf_file = $this->_config->plugin_path . 'captcha/AHGBold.ttf';
8420
- $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8421
  $img->image_height = 60;
8422
- $img->image_width = intval ( $img->image_height * M_E );
8423
- $img->text_color = new Yop_Poll_Securimage_Color ( rand ( 0, 255 ), rand ( 0, 255 ), rand ( 0, 255 ) );
8424
- $img->show ();
8425
- }
8426
- } else
8427
- wp_die ( 'Invalid Poll' );
8428
- } else
8429
- wp_die ( 'captcha error' );
 
 
8430
  die ();
8431
  }
 
8432
  public function ajax_play_captcha() {
8433
- if (is_admin ()) {
8434
- $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8435
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8436
- if ($poll_id) {
8437
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8438
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8439
- $poll_options = $yop_poll_model->poll_options;
8440
- if ('yes' == $poll_options ['use_captcha']) {
8441
- require_once ($this->_config->plugin_inc_dir . '/securimage.php');
8442
- $img = new Yop_Poll_Securimage ();
8443
- $img->audio_path = $this->_config->plugin_path . 'captcha/audio/';
8444
  $img->audio_noise_path = $this->_config->plugin_path . 'captcha/audio/noise/';
8445
- $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8446
 
8447
- $img->outputAudioFile ();
8448
  }
8449
- } else
8450
- wp_die ( 'Invalid Poll' );
8451
- } else
8452
- wp_die ( 'captcha error' );
 
 
8453
  die ();
8454
  }
 
8455
  public function ajax_show_optin_box_modal() {
8456
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8457
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
8458
- $optin_box_modal_options ['show'] = 'no'; //restore to no
8459
- $optin_box_modal_options ['last_show_date'] = Yop_Poll_Model::get_mysql_curent_date ();
8460
- update_option ( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8461
  ?>
8462
  <?php
8463
- $this->yop_poll_optin_form1 ();
8464
  ?>
8465
  <?php
8466
  die ();
8467
  }
 
8468
  public function ajax_modal_option_signup() {
8469
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8470
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
8471
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
8472
- update_option ( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8473
  die ();
8474
  }
 
8475
  public function ajax_sidebar_option_signup() {
8476
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8477
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
8478
  $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
8479
- update_option ( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8480
  die ();
8481
  }
 
8482
  public function ajax_is_wordpress_user() {
8483
  global $current_user;
8484
  if ( $current_user->ID > 0 )
@@ -8486,43 +8153,32 @@ EOT;
8486
  else
8487
  print '[response]false[/response]';
8488
  die();
8489
- }
 
8490
  public static function base64_decode( $str ) {
8491
- $str = str_replace( '-', '/', $str );
8492
- $str = str_replace( '_', '+', $str );
8493
  return base64_decode( $str );
8494
  }
 
8495
  public function ajax_set_wordpress_vote() {
8496
 
8497
- $poll_id = self::base64_decode( $_GET['poll_id'] );
8498
- $unique_id = self::base64_decode( $_GET['unique_id'] );
8499
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8500
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8501
 
8502
- $answers = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'default', 'other') );
8503
- $yop_poll_answers = array();
8504
- if ( count( $answers ) > 0 ) {
8505
  foreach ( $answers as $answer ) {
8506
- $yop_poll_answers[] = array( 'id' => $answer['id'], 'value' => html_entity_decode( (string) $answer['answer'], ENT_QUOTES, 'UTF-8'), 'type' => $answer['type'] );
8507
  }
8508
  }
8509
 
8510
- $public_config = array(
8511
- 'poll_options' => array(
8512
- 'share_after_vote' => $yop_poll_model->poll_options['share_after_vote'],
8513
- 'share_name' => html_entity_decode( (string) $yop_poll_model->poll_options['share_name'], ENT_QUOTES, 'UTF-8'),
8514
- 'share_caption' => html_entity_decode( (string) $yop_poll_model->poll_options['share_caption'], ENT_QUOTES, 'UTF-8'),
8515
- 'share_description' => html_entity_decode( (string) $yop_poll_model->poll_options['share_description'], ENT_QUOTES, 'UTF-8'),
8516
- 'share_picture' => html_entity_decode( (string) $yop_poll_model->poll_options['share_picture'], ENT_QUOTES, 'UTF-8'),
8517
- 'share_question' => html_entity_decode( (string) $yop_poll_model->poll['question'], ENT_QUOTES, 'UTF-8'),
8518
- 'share_poll_name' => html_entity_decode( (string) $yop_poll_model->poll['name'], ENT_QUOTES, 'UTF-8'),
8519
- 'share_link' => $yop_poll_model->poll_options['poll_page_url'] == '' ? site_url() : $yop_poll_model->poll_options['poll_page_url'],
8520
- 'answers' => $yop_poll_answers,
8521
- 'redirect_after_vote' => html_entity_decode( (string) $yop_poll_model->poll['redirect_after_vote'], ENT_QUOTES, 'UTF-8'),
8522
- 'redirect_after_vote_url' => html_entity_decode( (string) $yop_poll_model->poll['redirect_after_vote_url'], ENT_QUOTES, 'UTF-8'),
8523
 
8524
- )
8525
- );
8526
 
8527
  ?>
8528
  <!DOCTYPE html>
@@ -8532,240 +8188,243 @@ EOT;
8532
  <script type="text/javascript">
8533
 
8534
  function close_window() {
8535
- var yop_poll_various_config = new Object();
8536
- yop_poll_various_config.poll_id = '<?php echo self::base64_decode( $_GET['poll_id'] ) ?>';
8537
- yop_poll_various_config.unique_id = '<?php echo self::base64_decode( $_GET['unique_id'] ) ?>';
8538
- yop_poll_various_config.poll_location = '<?php echo self::base64_decode( $_GET['poll_location'] ) ?>';
8539
- yop_poll_various_config.is_modal = <?php echo self::base64_decode( $_GET['is_modal'] ) == 'true' ? 'true' : 'false'; ?>;
8540
- yop_poll_various_config.vote_loading_image_target = '<?php echo self::base64_decode( $_GET['vote_loading_image_target'] ) ?>';
8541
- yop_poll_various_config.vote_loading_image_id = '<?php echo self::base64_decode( $_GET['vote_loading_image_id'] ) ?>';
8542
- yop_poll_various_config.vote_type = '<?php echo self::base64_decode( $_GET['vote_type'] ) ?>';
8543
- yop_poll_various_config.facebook_user_details = '<?php echo isset( $_GET['facebook_user_details'] ) ? $_GET['facebook_user_details'] : '' ?>';
8544
- yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? $_GET['facebook_error'] : '' ?>';
8545
- yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
8546
- 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' ) ?>' );
8547
  result = window.opener.yop_poll_do_vote( yop_poll_various_config );
8548
- if ( result )
8549
  window.close();
 
8550
  }
8551
  </script>
8552
  </head>
8553
  <body onload="close_window()">
8554
- <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>
8555
  </div>
8556
  </body>
8557
  </html>
8558
  <?php
8559
  die();
8560
  }
 
8561
  public function ajax_do_change_votes_number_answer() {
8562
  global $current_user;
8563
- $answer_id = intval( $_POST['yop_poll_answer_id'] );
8564
- $votes_number = intval( $_POST['yop_poll_answer_votes'] );
8565
- $change_to_all = $_POST['yop_poll_change_to_all_poll_answers'];
8566
- $according_to_logs = $_POST['yop_poll_update_answers_with_logs'];
8567
- $response = NULL;
8568
 
8569
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8570
- $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8571
 
8572
  $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8573
- $poll_details = $yop_poll_model->get_current_poll ();
8574
 
8575
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' ))) {
8576
- $response = __ ( 'You are not allowed to edit this item.', 'yop_poll' );
8577
  }
8578
  else {
8579
- if ( ! wp_verify_nonce( $_POST[ 'yop-poll-nonce-change-votes-number-answer-'.$answer_id ], 'yop_poll-change-votes-number-answer-action-'.$answer_id ) ) {
8580
- $response = __ ( 'Bad Request!', 'yop_poll' );
8581
  }
8582
  else {
8583
- if ( 'yes' == $according_to_logs ) {
8584
- if ( 'yes' == $change_to_all ) {
8585
- $poll_answers = YOP_POLL_MODEL::get_poll_answers ( $answer_details['poll_id'], array (
8586
- 'default',
8587
- 'other'
8588
- ) );
8589
- if ( count( $poll_answers) > 0 )
8590
- foreach( $poll_answers as $answer ) {
8591
  Yop_Poll_Model::update_answer_field( $answer['id'], array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer['id'] ), 'type' => '%d' ) );
8592
  }
8593
  }
8594
  else
8595
  Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer_id ), 'type' => '%d' ) );
8596
- $response = __( 'Success', 'yop_poll' );
8597
  }
8598
  else {
8599
  if ( intval( $votes_number ) < 0 )
8600
- $response = __('Invalid Number Of Votes','yop_poll').'!';
8601
  else {
8602
  if ( 'yes' == $change_to_all )
8603
  Yop_Poll_Model::update_all_poll_answers_field( $answer_details['poll_id'], array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8604
  else
8605
  Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8606
- $response = __( 'Success', 'yop_poll' );
8607
  }
8608
  }
8609
  }
8610
  }
8611
- print '[response]'.$response.'[/response]';
8612
  die();
8613
  }
 
8614
  public function ajax_do_change_total_number_poll() {
8615
  global $current_user;
8616
- $poll_id = intval( $_POST['yop_poll_id'] );
8617
- $total_votes = intval( $_POST['yop_poll_total_votes'] );
8618
- $total_answers = intval( $_POST['yop_poll_total_answers'] );
8619
- $type = $_POST['yop_poll_type'];
8620
- $change_to_all = $_POST['yop_poll_change_to_all'];
8621
- $according_to_logs = $_POST['yop_poll_update_poll_with_logs'];
8622
- $according_to_answers = $_POST['yop_poll_update_poll_with_answers'];
8623
- $response = NULL;
8624
 
8625
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8626
- $poll_details = $yop_poll_model->get_current_poll ();
8627
 
8628
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' ))) {
8629
- $response = __ ( 'You are not allowed to edit this item.', 'yop_poll' );
8630
  }
8631
  else {
8632
- if ( ! wp_verify_nonce( $_POST[ 'yop-poll-nonce-change-total-number-poll-'.$poll_id ], 'yop_poll-change-total-number-poll-action-'.$poll_id ) ) {
8633
- $response = __ ( 'Bad Request!', 'yop_poll' );
8634
  }
8635
  else {
8636
- if ( 'yes' == $according_to_logs ) {
8637
- if ( 'votes' == $type ) {
8638
- if ( 'yes' == $change_to_all ) {
8639
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8640
- if ( count( $all_polls ) > 0 ) {
8641
- foreach( $all_polls as $poll )
8642
- 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' ) );
8643
  }
8644
  }
8645
  else {
8646
  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' ) );
8647
  }
8648
  }
8649
- if ( 'answers' == $type ) {
8650
- if ( 'yes' == $change_to_all ) {
8651
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8652
- if ( count( $all_polls ) > 0 ) {
8653
- foreach( $all_polls as $poll )
8654
- 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' ) );
8655
  }
8656
  }
8657
  else {
8658
  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' ) );
8659
  }
8660
  }
8661
- $response = __( 'Success', 'yop_poll' );
8662
  }
8663
  elseif ( 'yes' == $according_to_answers ) {
8664
- if ( 'votes' == $type ) {
8665
- if ( 'yes' == $change_to_all ) {
8666
- $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8667
- if ( count( $all_polls ) > 0 ) {
8668
- foreach( $all_polls as $poll )
8669
- 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' ) );
8670
  }
8671
  }
8672
  else {
8673
  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' ) );
8674
  }
8675
  }
8676
- $response = __( 'Success', 'yop_poll' );
8677
  }
8678
  else {
8679
  if ( intval( $total_votes ) < 0 && $type == 'votes' )
8680
- $response = __('Invalid Number Of Total Votes','yop_poll').'!';
8681
  if ( intval( $total_answers ) < 0 && $type == 'answers' )
8682
- $response = __('Invalid Number Of Total Answers','yop_poll').'!';
8683
  else {
8684
- if ( 'votes' == $type ) {
8685
  if ( 'yes' == $change_to_all )
8686
  Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8687
  else
8688
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8689
  }
8690
- if ( 'answers' == $type ) {
8691
  if ( 'yes' == $change_to_all )
8692
  Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8693
  else
8694
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8695
  }
8696
- $response = __( 'Success', 'yop_poll' );
8697
  }
8698
  }
8699
  }
8700
  }
8701
- print '[response]'.$response.'[/response]';
8702
  die();
8703
  }
 
8704
  public function ajax_do_change_poll_author() {
8705
  global $current_user;
8706
- $poll_id = intval( $_POST['yop_poll_id'] );
8707
- $poll_author = intval( $_POST['yop_poll_author'] );
8708
- $response = NULL;
8709
 
8710
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8711
- $poll_details = $yop_poll_model->get_current_poll ();
8712
 
8713
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' ))) {
8714
- $response = __ ( 'You are not allowed to edit this item.', 'yop_poll' );
8715
  }
8716
  else {
8717
- if ( ! wp_verify_nonce( $_POST[ 'yop-poll-nonce-change-poll-author-'.$poll_id ], 'yop_poll-change-poll-author-action-'.$poll_id ) ) {
8718
- $response = __ ( 'Bad Request!', 'yop_poll' );
8719
  }
8720
  else {
8721
  if ( intval( $poll_author ) <= 0 )
8722
- $response = __('Invalid Poll Author','yop_poll').'!';
8723
  else {
8724
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'poll_author', 'value' => $poll_author, 'type' => '%d' ) );
8725
- $response = __( 'Success', 'yop_poll' );
8726
  }
8727
  }
8728
  }
8729
- print '[response]'.$response.'[/response]';
8730
  die();
8731
  }
 
8732
  public function ajax_do_change_template_author() {
8733
  global $current_user;
8734
- $template_id = intval( $_POST['yop_poll_template_id'] );
8735
- $template_author = intval( $_POST['yop_poll_template_author'] );
8736
- $response = NULL;
8737
 
8738
- $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $template_id );
8739
 
8740
- if ((! $this->current_user_can ( 'edit_own_polls_templates' ) || $template_details ['template_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls_templates' ))) {
8741
- $response = __ ( 'You are not allowed to edit this item.', 'yop_poll' );
8742
  }
8743
  else {
8744
- if ( ! wp_verify_nonce( $_POST[ 'yop-poll-nonce-change-poll-template-author-'.$template_id ], 'yop_poll-change-poll-template-author-action-'.$template_id ) ) {
8745
- $response = __ ( 'Bad Request!', 'yop_poll' );
8746
  }
8747
  else {
8748
  if ( intval( $template_author ) <= 0 )
8749
- $response = __('Invalid Template Author','yop_poll').'!';
8750
  else {
8751
  Yop_Poll_Model::update_template_field( $template_id, array( 'name' => 'template_author', 'value' => $template_author, 'type' => '%d' ) );
8752
- $response = __( 'Success', 'yop_poll' );
8753
  }
8754
  }
8755
  }
8756
- print '[response]'.$response.'[/response]';
8757
  die();
8758
  }
 
8759
  public function ajax_show_change_votes_number_answer() {
8760
  global $current_user;
8761
- $answer_id = intval( $_GET['answer_id'] );
8762
 
8763
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8764
- $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8765
  $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8766
- $poll_details = $yop_poll_model->get_current_poll ();
8767
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' )))
8768
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8769
  ?>
8770
  <div id="yop-poll-change-votes">
8771
  <form id="yop-poll-change-answer-no-votes-form">
@@ -8775,47 +8434,49 @@ EOT;
8775
  <tr><td colspan="2" align="center" id="yop-poll-change-no-votes-error" class="error-message"></td></tr>
8776
  <tr id="yop-poll-manual-change-no-votes">
8777
  <td>
8778
- <label class="yop_poll_answer_no_votes_label" for="yop-poll-answer-no-votes"><?php _e('New Number Of Votes', 'yop_poll');?>:</label></td>
 
8779
  <td>
8780
- <input id="yop-poll-answer-no-votes" type="text" value="<?php echo $answer_details['votes']; ?>" name="yop_poll_answer_votes" />
8781
  </td>
8782
  </tr>
8783
  <tr>
8784
  <td colspan="2">
8785
- <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();" />
8786
- <label for="yop-poll-update-answers-with-logs"><?php _e('Update According To Logs', 'yop_poll');?></label>
8787
  </td>
8788
  </tr>
8789
  <tr>
8790
  <td colspan="2">
8791
- <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' ); ?>');" />
8792
- <label for="yop-poll-change-to-all-poll-answers"><?php _e('Change To All Poll Answers', 'yop_poll');?></label>
8793
  </td>
8794
  </tr>
8795
  <tr>
8796
  <td colspan="2" align="center">
8797
- <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']; ?>' )" />
8798
- <input type="hidden" name="yop_poll_answer_id" value="<?php echo $answer_details['id']; ?>" />
8799
  </td>
8800
  </tr>
8801
  </tbody>
8802
  </table>
8803
- <?php wp_nonce_field( 'yop_poll-change-votes-number-answer-action-'.$answer_id, 'yop-poll-nonce-change-votes-number-answer-'.$answer_id, false ); ?>
8804
  </form>
8805
  </div>
8806
  <?php
8807
  die();
8808
  }
 
8809
  public function ajax_show_change_total_number_poll() {
8810
  global $current_user;
8811
- $poll_id = intval( $_GET['poll_id'] );
8812
- $type = $_GET['type'];
8813
 
8814
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8815
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8816
- $poll_details = $yop_poll_model->get_current_poll ();
8817
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' )))
8818
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8819
  ?>
8820
  <div id="yop-poll-change-total">
8821
  <form id="yop-poll-change-poll-total-no-form">
@@ -8823,69 +8484,72 @@ EOT;
8823
  <tbody>
8824
  <tr><td colspan="2" align="center"><b><?php echo $poll_details['name']; ?></b></td></tr>
8825
  <tr><td colspan="2" align="center" id="yop-poll-change-total-no-error" class="error-message"></td></tr>
8826
- <?php if ( 'votes' == $type ) { ?>
8827
  <tr id="yop-poll-manual-change-no-votes">
8828
  <td>
8829
- <label class="yop_poll_total_votes_label" for="yop-poll-total-votes"><?php _e('New Number Of Poll Total Votes', 'yop_poll');?>:</label></td>
 
8830
  <td>
8831
- <input id="yop-poll-total-votes" type="text" value="<?php echo $poll_details['total_votes']; ?>" name="yop_poll_total_votes" />
8832
  </td>
8833
  </tr>
8834
  <?php } ?>
8835
- <?php if ( 'answers' == $type ) { ?>
8836
  <tr id="yop-poll-manual-change-no-votes">
8837
  <td>
8838
- <label class="yop_poll_total_answers_label" for="yop-poll-total-answers"><?php _e('New Number Of Poll Total Answers', 'yop_poll');?>:</label></td>
 
8839
  <td>
8840
- <input id="yop-poll-total-answers" type="text" value="<?php echo $poll_details['total_answers']; ?>" name="yop_poll_total_answers" />
8841
  </td>
8842
  </tr>
8843
  <?php } ?>
8844
  <tr>
8845
  <td colspan="2">
8846
- <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();} " />
8847
- <label for="yop-poll-update-poll-with-logs"><?php _e('Update According To Logs', 'yop_poll');?></label>
8848
  </td>
8849
  </tr>
8850
- <?php if ( 'votes' == $type ) { ?>
8851
  <tr>
8852
  <td colspan="2">
8853
- <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(); }" />
8854
- <label for="yop-poll-update-poll-with-answers"><?php _e('Update According To Answers', 'yop_poll');?></label>
8855
  </td>
8856
  </tr>
8857
  <?php } ?>
8858
  <tr>
8859
  <td colspan="2">
8860
- <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' ); ?>');" />
8861
- <label for="yop-poll-change-to-all"><?php _e('Change To All Polls', 'yop_poll');?></label>
8862
  </td>
8863
  </tr>
8864
  <tr>
8865
  <td colspan="2" align="center">
8866
- <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; ?>')" />
8867
- <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>" />
8868
- <input type="hidden" name="yop_poll_type" value="<?php echo $type; ?>" />
8869
  </td>
8870
  </tr>
8871
  </tbody>
8872
  </table>
8873
- <?php wp_nonce_field( 'yop_poll-change-total-number-poll-action-'.$poll_id, 'yop-poll-nonce-change-total-number-poll-'.$poll_id, false ); ?>
8874
  </form>
8875
  </div>
8876
  <?php
8877
  die();
8878
  }
 
8879
  public function ajax_show_change_poll_author() {
8880
  global $current_user;
8881
- $poll_id = intval( $_GET['poll_id'] );
8882
 
8883
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8884
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8885
- $poll_details = $yop_poll_model->get_current_poll ();
8886
- $poll_author = get_user_by( 'id', $poll_details ['poll_author'] );
8887
- if ((! $this->current_user_can ( 'edit_own_polls' ) || $poll_author->ID != $current_user->ID) && (! $this->current_user_can ( 'edit_polls' )))
8888
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8889
  ?>
8890
  <div id="yop-poll-change-poll-author">
8891
  <form id="yop-poll-change-poll-author-form">
@@ -8895,15 +8559,16 @@ EOT;
8895
  <tr><td colspan="2" align="center" id="yop-poll-change-poll-author-error" class="error-message"></td></tr>
8896
  <tr id="yop-poll-manual-change-no-votes">
8897
  <td>
8898
- <label class="yop_poll_total_votes_label" for="yop-poll-author"><?php _e('New Poll Author', 'yop_poll');?>:</label></td>
 
8899
  <td>
8900
  <?php
8901
- $blogusers = get_users('blog_id='.$GLOBALS['blog_id'].'&orderby=nicename&order=ASC');
8902
  ?>
8903
  <select id="yop-poll-author-select" name="yop_poll_author">
8904
- <?php
8905
- foreach ($blogusers as $user) {
8906
- echo '<option '.selected( $poll_author->ID, $user->ID, false ).' value="'.$user->ID.'">' . $user->user_nicename . '</option>';
8907
  }
8908
  ?>
8909
  </select>
@@ -8911,27 +8576,28 @@ EOT;
8911
  </tr>
8912
  <tr>
8913
  <td colspan="2" align="center">
8914
- <input type="button" class="button-primary" value="<?php _e('Save', 'yop_poll') ?>" onclick="yop_poll_do_change_poll_author( '<?php echo $poll_details['id']; ?>')" />
8915
- <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>" />
8916
  </td>
8917
  </tr>
8918
  </tbody>
8919
  </table>
8920
- <?php wp_nonce_field( 'yop_poll-change-poll-author-action-'.$poll_id, 'yop-poll-nonce-change-poll-author-'.$poll_id, false ); ?>
8921
  </form>
8922
  </div>
8923
  <?php
8924
  die();
8925
  }
 
8926
  public function ajax_show_change_template_author() {
8927
  global $current_user;
8928
- $template_id = intval( $_GET['template_id'] );
8929
 
8930
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
8931
- $template_details = YOP_POLL_MODEL::get_poll_template_from_database_by_id ( $template_id );
8932
- $template_author = get_user_by( 'id', $template_details ['template_author'] );
8933
- if ((! $this->current_user_can ( 'edit_own_polls_templates' ) || $template_author->ID != $current_user->ID) && (! $this->current_user_can ( 'edit_polls_templates' )))
8934
- wp_die ( __ ( 'You are not allowed to edit this item.', 'yop_poll' ) );
8935
  ?>
8936
  <div id="yop-poll-change-template-author">
8937
  <form id="yop-poll-change-template-author-form">
@@ -8941,15 +8607,16 @@ EOT;
8941
  <tr><td colspan="2" align="center" id="yop-poll-change-template-author-error" class="error-message"></td></tr>
8942
  <tr>
8943
  <td>
8944
- <label for="yop-template-author"><?php _e('New Template Author', 'yop_poll');?>:</label></td>
 
8945
  <td>
8946
  <?php
8947
- $blogusers = get_users('blog_id='.$GLOBALS['blog_id'].'&orderby=nicename&order=ASC');
8948
  ?>
8949
  <select id="yop-poll-template-author-select" name="yop_poll_template_author">
8950
- <?php
8951
- foreach ($blogusers as $user) {
8952
- echo '<option '.selected( $template_author->ID, $user->ID, false ).' value="'.$user->ID.'">' . $user->user_nicename . '</option>';
8953
  }
8954
  ?>
8955
  </select>
@@ -8957,13 +8624,13 @@ EOT;
8957
  </tr>
8958
  <tr>
8959
  <td colspan="2" align="center">
8960
- <input type="button" class="button-primary" value="<?php _e('Save', 'yop_poll') ?>" onclick="yop_poll_do_change_template_author( '<?php echo $template_details['id']; ?>')" />
8961
- <input type="hidden" name="yop_poll_template_id" value="<?php echo $template_details['id']; ?>" />
8962
  </td>
8963
  </tr>
8964
  </tbody>
8965
  </table>
8966
- <?php wp_nonce_field( 'yop_poll-change-poll-template-author-action-'.$template_id, 'yop-poll-nonce-change-poll-template-author-'.$template_id, false ); ?>
8967
  </form>
8968
  </div>
8969
  <?php
@@ -8973,114 +8640,82 @@ EOT;
8973
  * End Ajax section
8974
  */
8975
 
8976
- /* start timymce */
8977
- function load_editor_functions($hook) {
8978
  global $post;
8979
 
8980
- if ($hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php') {
8981
- $yop_poll_editor_config = array (
8982
- 'dialog_url' => wp_nonce_url ( admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ) . '?action=yop_poll_editor', 'yop-poll-editor' ),
8983
- 'dialog_html_url' => wp_nonce_url ( admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ) . '?action=yop_poll_html_editor', 'yop-poll-html-editor' ),
8984
- 'name' => __ ( 'Yop Poll', 'yop_poll' ),
8985
- 'title' => __ ( 'Insert Poll', 'yop_poll' ),
8986
- 'prompt_insert_poll_id' => __ ( 'Please insert the poll ID:\n\n', 'yop_poll' ),
8987
- 'prompt_insert_again_poll_id' => __ ( 'Error: Poll Id must be numeric!\n\nPlease insert the poll ID Again:\n\n', 'yop_poll' )
8988
- );
8989
- wp_enqueue_style ( 'thickbox' );
8990
- wp_enqueue_script ( 'thickbox' );
8991
- wp_enqueue_script ( 'yop-poll-editor-functions', "{$this->_config->plugin_url}/tinymce/yop-poll-editor-functions.js", 'jquery', $this->_config->version, true );
8992
- wp_localize_script ( 'yop-poll-editor-functions', 'yop_poll_editor_config', $yop_poll_editor_config );
8993
  }
8994
  }
8995
- function register_button($buttons) {
8996
- array_push ( $buttons, "separator", "yoppoll" );
 
8997
  return $buttons;
8998
  }
8999
- function add_plugin($plugin_array) {
 
9000
  $plugin_array ['yoppoll'] = "{$this->_config->plugin_url}/tinymce/yop-poll-editor.js";
9001
  return $plugin_array;
9002
  }
9003
- function my_yop_poll_button($hook) {
9004
- if ($hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php') {
9005
- if (! current_user_can ( 'edit_posts' ) && ! current_user_can ( 'edit_pages' )) {
 
9006
  return;
9007
  }
9008
 
9009
- if (get_user_option ( 'rich_editing' ) == 'true') {
9010
- add_filter ( 'mce_external_plugins', array (
9011
- &$this,
9012
- 'add_plugin'
9013
- ) );
9014
- add_filter ( 'mce_buttons', array (
9015
- &$this,
9016
- 'register_button'
9017
- ) );
9018
  }
9019
  }
9020
  }
9021
- /* end tinymce */
 
 
9022
 
9023
  /*START donate*/
9024
  private function yop_poll_donate() {
9025
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
 
9026
  ?>
9027
  <div class="postbox-container side" id="postbox-container-1">
9028
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
9029
- <div class="postbox " id="linksubmitdiv">
9030
- <div title="Click to toggle" class="handlediv">
9031
- <br />
 
9032
  </div>
9033
- <h3 class="hndle">
9034
- <span><?php _e( 'Support This Plugin', 'yop_poll' ); ?></span>
9035
- </h3>
9036
  <div class="inside">
9037
- <b><?php _e( 'Have you found this plugin useful? Please help support it\'s continued development with a donation', 'yop_poll' ); ?>!</b><br />
9038
- <div style="background-image: url(<?php echo $this->_config->plugin_url ?>/images/donate-button-bg.png); background-repeat: no-repeat; width:109px; height: 35px; text-align:center; padding-top:9px;margin:auto;">
9039
- <a href="http://www.yop-poll.com/thankyou/don.php" style="font-weight:bold; font-size:13px; text-decoration:none; color:#000000; padding: 9px 31px; text-shadow: 1px 1px 0 #F6B835;"
9040
- target="_blank" ><?php _e( 'Donate', 'yop_poll' ); ?>
9041
- </a>
9042
- </div>
9043
- <br /> <b><?php _e( 'Short on funds?', 'yop_poll' ); ?></b>
9044
- <ul id="donate_ul">
9045
- <li><a target="_blank"
9046
- href="http://wordpress.org/extend/plugins/yop-poll/"><b><?php _e( 'Rate YOP POLL 5&#9733;\'s on WordPress.org', 'yop_poll' ); ?></b></a>
9047
- </li>
9048
- <li><b><?php _e( 'Talk about it on your site and link back to the', 'yop_poll' ); ?></b>
9049
- <a target="_blank"
9050
- href="http://wordpress.org/extend/plugins/yop-poll/"><b><?php _e( 'plugin page', 'yop_poll' ); ?>.</b></a>
9051
- </li>
9052
- <li><a target="_blank"
9053
- href="http://twitter.com/home?status=I+use+YOP+POLL+for+WordPress+and+you+should+too+-+http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fyop-poll%2F"><b><?php _e( 'Tweet about it', 'yop_poll' ); ?>.</b></a>
9054
- </li>
9055
- </ul>
9056
- </div>
9057
- </div>
9058
-
9059
- <div class="postbox " id="linksubmitdiv1">
9060
- <div title="Click to toggle" class="handlediv">
9061
- <br />
9062
- </div>
9063
- <h3 class="hndle">
9064
- <span><?php _e( 'Need Help?', 'yop_poll' ); ?></span>
9065
- </h3>
9066
- <div class="inside">
9067
- <b><?php _e( 'If you need help getting this plugin or have found a bug please visit the ', 'yop_poll' ); ?><a
9068
- href="http://wordpress.org/support/plugin/yop-poll" target="_blank"><?php _e( 'support forums', 'yop_poll' ); ?></a>!</b>
9069
  </div>
9070
  </div>
9071
 
9072
  <?php
9073
- include_once (ABSPATH . WPINC . '/feed.php');
9074
- $feed = fetch_feed ( 'http://yop-poll.com/feed/' );
9075
- if ( ! is_wp_error( $feed ) )
9076
- $feeditems = $feed->get_items ( 0, $feed->get_item_quantity ( 5 ) );
9077
  ?>
9078
  <?php
9079
- if ($feeditems) {
9080
  ?>
9081
  <div class="postbox " id="linksubmitdiv2">
9082
  <div title="Click to toggle" class="handlediv">
9083
- <br />
9084
  </div>
9085
  <h3 class="hndle">
9086
  <span><?php _e( 'The Latest About Yop Poll', 'yop_poll' ); ?></span>
@@ -9089,7 +8724,7 @@ EOT;
9089
  <ul id="news_ul">
9090
  <?php
9091
  foreach ( $feeditems as $item ) {
9092
- $url = preg_replace ( '/#.*/', '', esc_url ( $item->get_permalink (), $protocolls = null, 'display' ) );
9093
  ?>
9094
  <li><a href="<?php echo $url ?>" target="_blank"><b><?php echo esc_html( $item->get_title() ); ?></b></a></li>
9095
  <?php
@@ -9102,11 +8737,11 @@ EOT;
9102
  }
9103
  ?>
9104
  <?php
9105
- if ($optin_box_modal_options ['show'] == 'no') {
9106
- if ($optin_box_modal_options ['sidebar_had_submit'] == 'no') {
9107
- if ($optin_box_modal_options ['modal_had_submit'] == 'no') {
9108
  ?>
9109
- <?php $this->yop_poll_optin_form2()?>
9110
  <?php
9111
  }
9112
  }
@@ -9116,6 +8751,7 @@ EOT;
9116
  </div>
9117
  <?php
9118
  }
 
9119
  private function yop_poll_optin_form() {
9120
  ?>
9121
  <style type="text/css">
@@ -9124,8 +8760,7 @@ EOT;
9124
  background: #FFF !important;
9125
  }
9126
 
9127
- #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
9128
- {
9129
  margin-left: 0 !important;
9130
  margin-right: 0 !important;
9131
  margin-top: 0 !important;
@@ -9138,8 +8773,7 @@ EOT;
9138
  background-image: none !important;
9139
  }
9140
 
9141
- #WFItem394041 div,#WFItem394041 dl,#WFItem394041 dt,#WFItem394041 dd,#WFItem394041 ul,#WFItem394041 ol,#WFItem394041 li,#WFItem394041 h1,#WFItem394041 h2
9142
- {
9143
  border: none !important;
9144
  background: none !important;
9145
  float: none !important;
@@ -9155,12 +8789,11 @@ EOT;
9155
  border-spacing: 0 !important;
9156
  }
9157
 
9158
- #WFItem394041 fieldset,#WFItem394041 img {
9159
  border: 0 !important;
9160
  }
9161
 
9162
- #WFItem394041 address,#WFItem394041 caption,#WFItem394041 cite,#WFItem394041 code,#WFItem394041 dfn,#WFItem394041 em,#WFItem394041 th,#WFItem394041 var
9163
- {
9164
  font-style: normal !important;
9165
  font-weight: normal !important;
9166
  }
@@ -9180,21 +8813,20 @@ EOT;
9180
  list-style: none !important;
9181
  }
9182
 
9183
- caption,#WFItem394041 th {
9184
  text-align: left !important;
9185
  }
9186
 
9187
- #WFItem394041 h1,#WFItem394041 h2,#WFItem394041 h3,#WFItem394041 h4,#WFItem394041 h5,#WFItem394041 h6
9188
- {
9189
  font-size: 100% !important;
9190
  font-weight: normal !important;
9191
  }
9192
 
9193
- #WFItem394041 q:before,#WFItem394041 q:after {
9194
  content: " " !important;
9195
  }
9196
 
9197
- #WFItem394041 abbr,#WFItem394041 acronym {
9198
  border: 0 !important;
9199
  font-variant: normal !important;
9200
  }
@@ -9207,7 +8839,7 @@ EOT;
9207
  vertical-align: text-bottom !important;
9208
  }
9209
 
9210
- #WFItem394041 input,#WFItem394041 textarea,#WFItem394041 select {
9211
  font-family: inherit !important;
9212
  font-size: inherit !important;
9213
  font-weight: inherit !important;
@@ -9215,7 +8847,7 @@ EOT;
9215
  line-height: auto !important;
9216
  }
9217
 
9218
- #WFItem394041 input,#WFItem394041 textarea,#WFItem394041 select {
9219
  *font-size: 100% !important;
9220
  }
9221
 
@@ -9242,9 +8874,7 @@ EOT;
9242
  }
9243
 
9244
  #WFWrapper .close {
9245
- background:
9246
- url(https://app.getresponse.com/images/common/highslide/close.png)
9247
- repeat scroll 0 0 transparent !important;
9248
  cursor: pointer !important;
9249
  height: 30px !important;
9250
  position: absolute !important;
@@ -9255,9 +8885,7 @@ EOT;
9255
  }
9256
 
9257
  #wfCloseX {
9258
- background:
9259
- url(https://app.getresponse.com/images/common/highslide/close.png)
9260
- repeat scroll 0 0 transparent !important;
9261
  cursor: pointer !important;
9262
  height: 30px !important;
9263
  position: absolute !important;
@@ -9277,7 +8905,7 @@ EOT;
9277
  zoom: 1 !important;
9278
  }
9279
 
9280
- #WFItem394041 *:first-child+html .clearfix {
9281
  zoom: 1 !important;
9282
  }
9283
 
@@ -9341,8 +8969,7 @@ EOT;
9341
  margin-left: 25px !important;
9342
  }
9343
 
9344
- #WFItem394041 .actTinyMceElBodyContent ol ul,#WFItem394041 .actTinyMceElBodyContent ul ol,#WFItem394041 .actTinyMceElBodyContent ul ul,#WFItem394041 .actTinyMceElBodyContent ol ol
9345
- {
9346
  margin-top: 0 !important;
9347
  margin-bottom: 0 !important;
9348
  }
@@ -9480,9 +9107,7 @@ EOT;
9480
  font-style: normal !important;
9481
  text-decoration: none !important;
9482
  background-color: #0DBAFF !important;
9483
- background-image:
9484
- url(https://app.getresponse.com/images/core/webforms/gradient_top.png)
9485
- !important;
9486
  border-width: 0px !important;
9487
  border-color: #000000 !important;
9488
  border-style: none !important;
@@ -9504,7 +9129,8 @@ EOT;
9504
  border-bottom-right-radius: 8px !important;
9505
  }
9506
 
9507
- #WFItem394041 .wf-button:hover { !important;
 
9508
 
9509
  }
9510
 
@@ -9535,9 +9161,7 @@ EOT;
9535
 
9536
  #WFItem394041 .wf-privacyico {
9537
  padding: 4px 0 0 20px !important;
9538
- background:
9539
- url(https://app.getresponse.com/images/core/webforms/lock.png)
9540
- no-repeat left center !important;
9541
  }
9542
 
9543
  #WFItem394041 .wf-counter {
@@ -9617,9 +9241,7 @@ EOT;
9617
  position: relative !important;
9618
  top: 3px !important;
9619
  margin-left: 3px !important;
9620
- background:
9621
- url(https://app.getresponse.com/images/core/webforms/captchaico.png)
9622
- no-repeat 0 -32px !important;
9623
  }
9624
 
9625
  #WFItem394041 .wf-rc-audio {
@@ -9631,9 +9253,7 @@ EOT;
9631
  position: relative !important;
9632
  top: 3px !important;
9633
  margin-left: 3px !important;
9634
- background:
9635
- url(https://app.getresponse.com/images/core/webforms/captchaico.png)
9636
- no-repeat 0 0 !important;
9637
  }
9638
 
9639
  #WFItem394041 .wf-rc-image {
@@ -9645,9 +9265,7 @@ EOT;
9645
  position: relative !important;
9646
  top: 3px !important;
9647
  margin-left: 3px !important;
9648
- background:
9649
- url(https://app.getresponse.com/images/core/webforms/captchaico.png)
9650
- no-repeat 0 -16px !important;
9651
  }
9652
 
9653
  #WFItem394041 #recaptcha_image {
@@ -9716,7 +9334,7 @@ EOT;
9716
  <em class="clearfix clearer"></em>
9717
  </div>
9718
  </div>
9719
- <input type="hidden" name="webform_id" value="394041" />
9720
  </form>
9721
  </div>
9722
  <?php
@@ -9724,69 +9342,186 @@ EOT;
9724
 
9725
  private function yop_poll_optin_form1() {
9726
  ?>
9727
- <style type="text/css">
9728
- #WFItem394041 {
9729
- background: url("<?php echo $this->_config->plugin_url ?>/images/optin-no-title.png") no-repeat scroll 0 0 transparent;
9730
- /*height: 200px;*/
9731
- overflow: hidden;
9732
- padding: 37px 33px 0 33px;
9733
- width: 242px;
9734
- }
9735
- #WFItem394041 p {text-align:center;margin:-23px -20px 29px -47px;font-size:13px;}
9736
- #WFItem394041 p a {color:#555;display:inline-block;margin:40px 0px;}
9737
- #WFItem394041 input[type="text"]{
9738
- background: none repeat scroll 0 0 transparent;
9739
- border: 0 none;
9740
- float: left;
9741
- padding: 11px 15px;
9742
- width: 225px;
9743
- color:#999;
9744
- }
9745
- #WFItem394041 [type="submit"] {
9746
- background: none repeat scroll 0 0 transparent;
9747
- border: 0 none;
9748
- cursor: pointer;
9749
- margin: 6px 0 0 -13px;
9750
- padding: 11px 12px;
9751
- text-indent: -999px;
9752
- width: 240px;
9753
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9754
  </style>
9755
- <div id="WFItem394041" class="wf-formTpl">
 
9756
  <form accept-charset="utf-8"
9757
- action="https://app.getresponse.com/add_contact_webform.html"
9758
- method="post" target="_top">
9759
  <div class="box">
9760
  <div id="WFIcenter" class="wf-body">
9761
  <ul class="wf-sortable" id="wf-sort-id">
9762
  <li>
9763
- <p><b><?php _e('Want to receive YOP Poll User\'s Guide?', 'yop_poll'); ?><br><?php _e('Sign up below!', 'yop_poll'); ?></b></p>
9764
- </li>
 
9765
  <li class="wf-email" rel="undefined"
9766
- style="display: block !important;">
9767
  <div class="wf-contbox">
9768
  <div class="wf-inputpos">
9769
- <input type="text" class="wf-input wf-req wf-valid__email"
9770
- name="email" placeholder="<?php _e('Email', 'yop_poll'); ?>"></input>
 
9771
  </div>
9772
  <em class="clearfix clearer"></em>
9773
  </div>
9774
  </li>
9775
  <li class="wf-submit" rel="undefined"
9776
- style="display: block !important;">
9777
  <div class="wf-contbox">
9778
  <div class="wf-inputpos">
9779
- <input type="submit" value="<?php _e('Sign Up!', 'yop_poll'); ?>" class="wf-button" name="submit"></input>
9780
  </div>
9781
  <em class="clearfix clearer"></em>
9782
  </div>
9783
  </li>
9784
  <li class="wf-captcha" rel="undefined"
9785
- style="display: none !important;">
9786
- <div wf-captchaerror="<?php _e('Incorrect please try again', 'yop_poll'); ?>"
9787
- wf-captchasound="<?php _e('Enter the numbers you hear:', 'yop_poll'); ?>"
9788
- wf-captchaword="<?php _e('Enter the words above:', 'yop_poll'); ?>"
9789
- class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9790
  </li>
9791
  </ul>
9792
  </div>
@@ -9795,77 +9530,60 @@ EOT;
9795
  <em class="clearfix clearer"></em>
9796
  </div>
9797
  </div>
9798
- <input type="hidden" name="webform_id" value="394041" />
9799
  </form>
9800
  </div>
9801
  <?php
9802
  }
9803
 
9804
  private function yop_poll_optin_form2() {
 
9805
  ?>
9806
- <style type="text/css">
9807
- #WFItem394041 {
9808
- background: url("<?php echo $this->_config->plugin_url ?>/images/optin-sidebar-no-title.png") no-repeat scroll 0 0 transparent;
9809
- height: 200px;
9810
- overflow: hidden;
9811
- padding: 37px 33px 0 33px;
9812
- width: 242px;
9813
- }
9814
- #WFItem394041 p {text-align:center;margin:-23px -20px 29px -47px;font-size:13px;}
9815
- #WFItem394041 p a {color:#555;display:inline-block;margin:40px 0px;}
9816
- #WFItem394041 input[type="text"]{
9817
- background: none repeat scroll 0 0 transparent;
9818
- border: 0 none;
9819
- float: left;
9820
- padding: 11px 15px;
9821
- width: 225px;
9822
- color:#999;
9823
- }
9824
- #WFItem394041 [type="submit"] {
9825
- background: none repeat scroll 0 0 transparent;
9826
- border: 0 none;
9827
- cursor: pointer;
9828
- margin: 6px 0 0 -13px;
9829
- padding: 11px 12px;
9830
- text-indent: -999px;
9831
- width: 240px;
9832
- }
9833
- </style>
9834
- <div id="WFItem394041" class="wf-formTpl">
9835
  <form accept-charset="utf-8"
9836
- action="https://app.getresponse.com/add_contact_webform.html"
9837
- method="post" target="_top">
9838
  <div class="box">
9839
  <div id="WFIcenter" class="wf-body">
9840
  <ul class="wf-sortable" id="wf-sort-id">
9841
  <li>
9842
- <p><b><?php _e('Want to receive YOP Poll User\'s Guide?', 'yop_poll'); ?><br><?php _e('Sign up below!', 'yop_poll'); ?></b></p>
9843
- </li>
 
 
 
 
 
9844
  <li class="wf-email" rel="undefined"
9845
- style="display: block !important;">
9846
  <div class="wf-contbox">
9847
  <div class="wf-inputpos">
9848
- <input type="text" class="wf-input wf-req wf-valid__email"
9849
- name="email" placeholder="<?php _e('Email', 'yop_poll'); ?>"></input>
 
9850
  </div>
9851
  <em class="clearfix clearer"></em>
9852
  </div>
9853
  </li>
9854
  <li class="wf-submit" rel="undefined"
9855
- style="display: block !important;">
9856
  <div class="wf-contbox">
9857
  <div class="wf-inputpos">
9858
- <input type="submit" value="<?php _e('Sign Up!', 'yop_poll'); ?>" class="wf-button" name="submit"></input>
9859
  </div>
9860
  <em class="clearfix clearer"></em>
9861
  </div>
9862
  </li>
9863
  <li class="wf-captcha" rel="undefined"
9864
- style="display: none !important;">
9865
- <div wf-captchaerror="<?php _e('Incorrect please try again', 'yop_poll'); ?>"
9866
- wf-captchasound="<?php _e('Enter the numbers you hear:', 'yop_poll'); ?>"
9867
- wf-captchaword="<?php _e('Enter the words above:', 'yop_poll'); ?>"
9868
- class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9869
  </li>
9870
  </ul>
9871
  </div>
@@ -9874,284 +9592,156 @@ EOT;
9874
  <em class="clearfix clearer"></em>
9875
  </div>
9876
  </div>
9877
- <input type="hidden" name="webform_id" value="394041" />
9878
  </form>
9879
  </div>
9880
  <?php
9881
  }
9882
 
9883
-
9884
  public function load_optin_box() {
9885
- $optin_box_modal_options = get_option ( 'yop_poll_optin_box_modal_options' );
9886
- if ($optin_box_modal_options ['show'] == 'yes') {
9887
- wp_enqueue_script ( 'yop-poll-modal-box-js', "{$this->_config->plugin_url}/modal/js/jquery.modalbox-1.5.0-min.js", array (
9888
- 'jquery'
9889
- ), $this->_config->version, true );
9890
- wp_enqueue_script ( 'yop-poll-modal-functions', "{$this->_config->plugin_url}/js/yop-poll-modal-functions.js", array (
9891
- 'jquery',
9892
- 'yop-poll-modal-box-js'
9893
- ), $this->_config->version, true );
9894
- $yop_poll_modal_functions_config = array (
9895
- 'ajax' => array (
9896
- 'url' => admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ),
9897
- 'action' => 'yop_poll_modal_option_signup'
9898
- )
9899
- );
9900
- wp_localize_script ( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
9901
- wp_enqueue_style ( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-basic.css", array (), $this->_config->version );
9902
- } elseif ($optin_box_modal_options ['sidebar_had_submit'] == 'no') {
9903
- wp_enqueue_script ( 'yop-poll-sidebar-option-functions', "{$this->_config->plugin_url}/js/yop-poll-sidebar-optin-functions.js", array (
9904
- 'jquery'
9905
- ), $this->_config->version, true );
9906
- $yop_poll_sidebar_functions_config = array (
9907
- 'ajax' => array (
9908
- 'url' => admin_url ( 'admin-ajax.php', (is_ssl () ? 'https' : 'http') ),
9909
- 'action' => 'yop_poll_sidebar_option_signup'
9910
- )
9911
- );
9912
- wp_localize_script ( 'yop-poll-sidebar-option-functions', 'yop_poll_sidebar_functions_config', $yop_poll_sidebar_functions_config );
9913
  }
9914
  }
 
9915
  public function popup_bar() {
9916
- require_once ($this->_config->plugin_inc_dir . '/yop_poll_model.php');
9917
- $date_30_days_before = Yop_Poll_Model::get_mysql_custom_date ( - 30, 'DAY' );
9918
- $yop_poll_first_install_date = get_option ( 'yop_poll_first_install_date' );
9919
- $yop_poll_admin_notices_donate = get_option ( 'yop_poll_admin_notices_donate' );
9920
- if ($date_30_days_before >= $yop_poll_first_install_date) {
9921
- if ('yes' == $yop_poll_admin_notices_donate) {
9922
  ?>
9923
- <div class="updated">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9924
  <p>
9925
  <?php _e( 'It looks like you\'ve been enjoying YOP POLL Plugin for at least 30 days.', 'yop_poll' ); ?>
9926
  <?php _e( 'Would you consider a small donation to help support continued development of the plugin?', 'yop_poll' ); ?>
9927
  </p>
9928
  <p>
9929
- <input type="button" class="button "
9930
  value="<?php _e( 'Support This Plugin', 'yop_poll' ) ?>"
9931
- onclick="document.location.href='<?php echo esc_url( add_query_arg( array( 'yop_poll_support_plugin' => 'yes', '_wpnonce' => wp_create_nonce('yop_poll_donate_addmin_notices') ) ) ); ?>'" />
9932
- <input type="button" class="button "
9933
- value="<?php _e( 'Rate it 5&#9733;\'s', 'yop_poll') ?>"
9934
- onclick="document.location.href='<?php echo esc_url( add_query_arg( array( 'yop_poll_rate_plugin' => 'yes', '_wpnonce' => wp_create_nonce('yop_poll_donate_addmin_notices') ) ) ); ?>'" />
9935
- <input type="button" class="button "
9936
  value="<?php _e( 'Tell Your Followers', 'yop_poll' ) ?>"
9937
- onclick="document.location.href='<?php echo esc_url( add_query_arg( array( 'yop_poll_tell_followers' => 'yes', '_wpnonce' => wp_create_nonce('yop_poll_donate_addmin_notices') ) ) ); ?>'" />
9938
- <input type="button" class="button "
9939
  value="<?php _e( 'Don\'t Bug Me Again', 'yop_poll' ) ?>"
9940
- 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') ) ) ); ?>'" />
9941
  </p>
9942
  </div>
9943
  <?php
9944
  }
9945
  }
9946
  }
 
9947
  public function popup_bar_operations() {
9948
- 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' )) {
9949
- update_option ( "yop_poll_admin_notices_donate", 'no' );
9950
- $this->remove_action ( 'admin_notices', 'popup_bar' );
9951
 
9952
- if (isset ( $_GET ['yop_poll_support_plugin'] )) {
9953
- if ('yes' == $_GET ['yop_poll_support_plugin']) {
9954
- wp_redirect ( 'http://www.yop-poll.com/thankyou/don.php', '302' );
9955
  }
9956
  }
9957
 
9958
- if (isset ( $_GET ['yop_poll_rate_plugin'] )) {
9959
- if ('yes' == $_GET ['yop_poll_rate_plugin']) {
9960
- wp_redirect ( 'http://wordpress.org/extend/plugins/yop-poll/', '302' );
9961
  }
9962
  }
9963
 
9964
- if (isset ( $_GET ['yop_poll_tell_followers'] )) {
9965
- if ('yes' == $_GET ['yop_poll_tell_followers']) {
9966
- 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' );
9967
  }
9968
  }
9969
 
9970
- if (isset ( $_GET ['yop_poll_do_not_bug'] )) {
9971
- if ('yes' == $_GET ['yop_poll_do_not_bug']) {
9972
- wp_redirect ( remove_query_arg ( array (
9973
- 'yop_poll_do_not_bug',
9974
- '_wpnonce',
9975
- 'yop_poll_tell_followers',
9976
- 'yop_poll_rate_plugin',
9977
- 'yop_poll_support_plugin'
9978
- ), stripslashes ( $_SERVER ['REQUEST_URI'] ) ), '302' );
9979
  }
9980
  }
9981
  }
9982
  }
9983
 
9984
  /* END donate */
9985
- private function current_user_can($capability = '') {
9986
  global $current_user;
9987
- get_currentuserinfo ();
9988
  $user_roles = $current_user->roles;
9989
- $user_role = array_shift ( $user_roles );
9990
 
9991
- $capabilities_roles = array (
9992
- 'manage_polls_options' => array (
9993
- 'administrator' => true,
9994
- 'editor' => true,
9995
- 'author' => false,
9996
- 'contributor' => false,
9997
- 'subscriber' => false
9998
- ),
9999
- 'manage_polls_bans' => array (
10000
- 'administrator' => true,
10001
- 'editor' => false,
10002
- 'author' => false,
10003
- 'contributor' => false,
10004
- 'subscriber' => false
10005
- ),
10006
- 'delete_polls' => array (
10007
- 'administrator' => true,
10008
- 'editor' => false,
10009
- 'author' => false,
10010
- 'contributor' => false,
10011
- 'subscriber' => false
10012
- ),
10013
- 'delete_own_polls' => array (
10014
- 'administrator' => true,
10015
- 'editor' => true,
10016
- 'author' => true,
10017
- 'contributor' => false,
10018
- 'subscriber' => false
10019
- ),
10020
- 'edit_polls' => array (
10021
- 'administrator' => true,
10022
- 'editor' => true,
10023
- 'author' => false,
10024
- 'contributor' => false,
10025
- 'subscriber' => false
10026
- ),
10027
- 'edit_own_polls' => array (
10028
  'administrator' => true,
10029
- 'editor' => true,
10030
- 'author' => true,
10031
- 'contributor' => false,
10032
- 'subscriber' => false
10033
- ),
10034
- 'clone_polls' => array (
10035
  'administrator' => true,
10036
- 'editor' => true,
10037
- 'author' => false,
10038
- 'contributor' => false,
10039
- 'subscriber' => false
10040
- ),
10041
- 'clone_own_polls' => array (
10042
- 'administrator' => true,
10043
- 'editor' => true,
10044
- 'author' => true,
10045
- 'contributor' => false,
10046
- 'subscriber' => false
10047
- ),
10048
- 'view_polls_logs' => array (
10049
- 'administrator' => true,
10050
- 'editor' => true,
10051
- 'author' => false,
10052
- 'contributor' => false,
10053
- 'subscriber' => false
10054
- ),
10055
- 'view_own_polls_logs' => array (
10056
- 'administrator' => true,
10057
- 'editor' => true,
10058
- 'author' => true,
10059
- 'contributor' => false,
10060
- 'subscriber' => false
10061
- ),
10062
- 'view_polls_results' => array (
10063
- 'administrator' => true,
10064
- 'editor' => true,
10065
- 'author' => false,
10066
- 'contributor' => false,
10067
- 'subscriber' => false
10068
- ),
10069
- 'view_own_polls_results' => array (
10070
- 'administrator' => true,
10071
- 'editor' => true,
10072
- 'author' => true,
10073
- 'contributor' => false,
10074
- 'subscriber' => false
10075
- ),
10076
- 'reset_polls_stats' => array (
10077
- 'administrator' => true,
10078
- 'editor' => true,
10079
- 'author' => false,
10080
- 'contributor' => false,
10081
- 'subscriber' => false
10082
- ),
10083
- 'reset_own_polls_stats' => array (
10084
- 'administrator' => true,
10085
- 'editor' => true,
10086
- 'author' => true,
10087
- 'contributor' => false,
10088
- 'subscriber' => false
10089
- ),
10090
- 'delete_polls_logs' => array (
10091
- 'administrator' => true,
10092
- 'editor' => true,
10093
- 'author' => false,
10094
- 'contributor' => false,
10095
- 'subscriber' => false
10096
- ),
10097
- 'delete_own_polls_logs' => array (
10098
- 'administrator' => true,
10099
- 'editor' => true,
10100
- 'author' => true,
10101
- 'contributor' => false,
10102
- 'subscriber' => false
10103
- ),
10104
- 'edit_polls_templates' => array (
10105
- 'administrator' => true,
10106
- 'editor' => true,
10107
- 'author' => false,
10108
- 'contributor' => false,
10109
- 'subscriber' => false
10110
- ),
10111
- 'edit_own_polls_templates' => array (
10112
- 'administrator' => true,
10113
- 'editor' => true,
10114
- 'author' => true,
10115
- 'contributor' => false,
10116
- 'subscriber' => false
10117
- ),
10118
- 'delete_polls_templates' => array (
10119
- 'administrator' => true,
10120
- 'editor' => true,
10121
- 'author' => false,
10122
- 'contributor' => false,
10123
- 'subscriber' => false
10124
- ),
10125
- 'delete_own_polls_templates' => array (
10126
- 'administrator' => true,
10127
- 'editor' => true,
10128
- 'author' => true,
10129
- 'contributor' => false,
10130
- 'subscriber' => false
10131
- ),
10132
- 'clone_polls_templates' => array (
10133
- 'administrator' => true,
10134
- 'editor' => true,
10135
- 'author' => false,
10136
- 'contributor' => false,
10137
- 'subscriber' => false
10138
- ),
10139
- 'clone_own_polls_templates' => array (
10140
- 'administrator' => true,
10141
- 'editor' => true,
10142
- 'author' => true,
10143
- 'contributor' => false,
10144
- 'subscriber' => false
10145
- ),
10146
- 'become_pro' => array (
10147
- 'administrator' => false,
10148
- 'editor' => false,
10149
- 'author' => false,
10150
- 'contributor' => false,
10151
- 'subscriber' => false
10152
- )
10153
- );
10154
- if (isset ( $capabilities_roles [$capability] [$user_role] ))
10155
  return $capabilities_roles [$capability] [$user_role];
10156
  return false;
10157
  }
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';
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'),
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>
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
 
476
  public function update_to_4_2() {
477
  global $wpdb;
478
 
479
+ $saved_templates = $wpdb->get_results( "
480
  SELECT id FROM " . $wpdb->yop_poll_templates . "
481
  WHERE
482
  before_vote_template LIKE '%<div id=\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">%' AND
483
  before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
484
  ", ARRAY_A );
485
 
486
+ $updated_templates = $wpdb->get_results( "
487
  SELECT id FROM " . $wpdb->yop_poll_templates . "
488
  WHERE
489
  before_vote_template LIKE '%<div id=\\\\\\\\" . '"' . "yop-poll-vote-\%POLL-ID\%\\\\\\\\" . '"' . " class=\\\\\\\\" . '"' . "yop-poll-footer\\\\\\\\" . '"' . ">%' AND
490
  before_vote_template NOT LIKE '%[CAPTCHA_CONTAINER]%'
491
  ", ARRAY_A );
492
+ if ( count( $saved_templates ) > 0 ){
493
  foreach ( $saved_templates as $template ) {
494
+ $wpdb->query( "
495
  UPDATE " . $wpdb->yop_poll_templates . " SET
496
  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\\" . '"' . ">')
497
  WHERE
500
  " );
501
  }
502
  }
503
+ if ( count( $updated_templates ) > 0 ){
504
  foreach ( $updated_templates as $template ) {
505
+ $wpdb->query( "
506
  UPDATE " . $wpdb->yop_poll_templates . " SET
507
  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\\" . '"' . ">')
508
  WHERE
512
  }
513
  }
514
 
515
+ $css_templates = $wpdb->get_results( "
516
  SELECT id FROM " . $wpdb->yop_poll_templates . "
517
  WHERE
518
  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
519
  css NOT LIKE '%yop-poll-captcha%'
520
  ", ARRAY_A );
521
 
522
+ if ( count( $css_templates ) > 0 ){
523
  foreach ( $css_templates as $template ) {
524
+ $wpdb->query( "
525
  UPDATE " . $wpdb->yop_poll_templates . " SET
526
  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')
527
  WHERE
531
  }
532
  }
533
 
534
+ $css_templates_1 = $wpdb->get_results( "
535
  SELECT id FROM " . $wpdb->yop_poll_templates . "
536
  WHERE
537
  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
538
  css NOT LIKE '%yop-poll-captcha%'
539
  ", ARRAY_A );
540
 
541
+ if ( count( $css_templates_1 ) > 0 ){
542
  foreach ( $css_templates_1 as $template ) {
543
+ $wpdb->query( "
544
  UPDATE " . $wpdb->yop_poll_templates . " SET
545
  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')
546
  WHERE
550
  }
551
  }
552
  }
553
+
554
  public function update_to_4_8() {
555
  global $wpdb;
556
+ $sql = <<<EOT
557
  UPDATE $wpdb->yop_poll_templates
558
  SET
559
  js = CONCAT( js, '
561
  runOnPollStateChange_%POLL-ID%();
562
  });
563
 
564
+ function runOnPollStateChange_%POLL-ID%() {};'
565
  )
566
  WHERE js NOT LIKE '%runOnPollStateChange_%'
567
  EOT;
568
+ $updated_templates = $wpdb->query( $sql );
569
  }
570
+
571
  public function update_to_4_9() {
572
  global $wpdb;
573
+ $sql = <<<EOT
574
+ UPDATE $wpdb->yop_poll_templates
575
+ SET `before_vote_template` =
576
+ REPLACE( `before_vote_template` ,
577
+ '<div id="yop-poll-answers-%POLL-ID"',
578
+ '<div id="yop-poll-answers-%POLL-ID%"' )
579
+ WHERE `before_vote_template` LIKE '%<div id="yop-poll-answers-%POLL-ID"%'
580
  EOT;
581
+ $wpdb->query( $sql );
582
  }
583
+
584
+ public function update_to_4_9_1() {
585
+ global $wpdb;
586
+ $sql = <<<EOT
587
+ UPDATE $wpdb->yop_poll_templates
588
+ SET `before_vote_template` =
589
+ REPLACE( `before_vote_template` ,
590
+ '<div id="yop-poll-answers-%POLL-ID"',
591
+ '<div id="yop-poll-answers-%POLL-ID%"' )
592
+ WHERE `before_vote_template` LIKE '%<div id="yop-poll-answers-\%POLL-ID"%'
593
+ EOT;
594
+ $wpdb->query( $sql );
595
+
596
+ $sql = <<<EOT
597
+ UPDATE $wpdb->yop_poll_templates
598
+ SET `before_vote_template` =
599
+ REPLACE( `before_vote_template` ,
600
+ '<li class="yop-poll-li-answer-%POLL-ID"',
601
+ '<li class="yop-poll-li-answer-%POLL-ID%"' )
602
+ WHERE `before_vote_template` LIKE '%<li class="yop-poll-li-answer-\%POLL-ID"%'
603
+ EOT;
604
+ $wpdb->query( $sql );
605
+ }
606
+
607
  public function admin_loader() {
608
  // $this->add_action ( 'network_admin_menu', 'admin_menu', 1 );
609
+ $this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
610
+ $this->add_action( 'admin_menu', 'admin_menu', 1 );
611
+ $this->add_action( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
612
+ $this->add_action( 'wp_ajax_yop_poll_preview_template', 'ajax_preview_template', 1 );
613
+ $this->add_action( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
614
+ $this->add_action( 'wp_ajax_yop_poll_edit_add_new_poll', 'ajax_edit_add_new_poll', 1 );
615
+ $this->add_action( 'wp_ajax_yop_poll_edit_add_new_poll_template', 'ajax_edit_add_new_poll_template', 1 );
616
+ $this->add_action( 'wp_ajax_yop_poll_reset_poll_template', 'ajax_reset_poll_template', 1 );
617
+ $this->add_action( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
618
+ $this->add_action( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
619
+ $this->add_action( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
620
+ $this->add_action( 'wp_ajax_yop_poll_show_change_votes_number_answer', 'ajax_show_change_votes_number_answer', 1 );
621
+ $this->add_action( 'wp_ajax_yop_poll_do_change_votes_number_answer', 'ajax_do_change_votes_number_answer', 1 );
622
 
623
+ $this->add_action( 'wp_ajax_yop_poll_show_change_total_number_poll', 'ajax_show_change_total_number_poll', 1 );
624
+ $this->add_action( 'wp_ajax_yop_poll_do_change_total_number_poll', 'ajax_do_change_total_number_poll', 1 );
625
 
626
+ $this->add_action( 'wp_ajax_yop_poll_show_change_poll_author', 'ajax_show_change_poll_author', 1 );
627
+ $this->add_action( 'wp_ajax_yop_poll_do_change_poll_author', 'ajax_do_change_poll_author', 1 );
628
 
629
+ $this->add_action( 'wp_ajax_yop_poll_show_change_template_author', 'ajax_show_change_template_author', 1 );
630
+ $this->add_action( 'wp_ajax_yop_poll_do_change_template_author', 'ajax_do_change_template_author', 1 );
631
 
632
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
633
+ $this->add_action( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
634
 
635
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
636
+ $this->add_action( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
637
 
638
+ $this->add_action( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
639
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
640
 
641
+ $this->add_action( 'wp_ajax_yop_poll_load_css', 'yop_poll_load_css', 1 );
642
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_load_css', 'yop_poll_load_css', 1 );
643
 
644
+ $this->add_action( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
645
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
646
 
647
+ $this->add_action( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
648
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
649
 
650
+ $this->add_action( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
651
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
652
 
653
+ $this->add_action( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
654
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
655
 
656
+ $this->add_action( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
657
+ $this->add_action( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
658
  }
659
 
660
  /**
661
  * this file is executed on activation
662
  * it creates the database and adds some data to database's table
663
  */
664
+ public function activate( $networkwide ) {
665
  global $wp_version;
666
+ if ( !version_compare( $wp_version, YOP_POLL_WP_VERSION, '>=' ) ){
667
+ $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' ) );
668
 
669
  // die & print error message & code - for admins only!
670
+ if ( isset ( $error ) && is_wp_error( $error ) && current_user_can( 'manage_options' ) ){
671
+ wp_die( $error->get_error_message(), $error->get_error_data() );
672
+ }
673
+ }
674
+ else {
675
+ if ( !extension_loaded( 'json' ) ){
676
+ $error = new WP_Error ( 'Wordpress_json_error', __( 'You need the json php extension for this plugin', 'yop_poll' ), __( 'Error: Wordpress Extension 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
  // including upgrade.php for using dbDelta()
684
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
685
  // including db_schema class file
686
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
687
+ require_once( YOP_POLL_INC . '/' . 'db_schema.php' );
688
  // create tables
689
+ Yop_Poll_DbSchema::create_poll_database_tables();
690
  }
691
  }
692
+
693
+ public function deactivate( $networkwide ) {
694
  /*
695
  * 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`");
696
  */
697
+ $poll_archive_page = get_page_by_path( 'yop-poll-archive', ARRAY_A );
698
+ if ( $poll_archive_page ){
699
  $poll_archive_page_id = $poll_archive_page ['ID'];
700
+ wp_delete_post( $poll_archive_page_id, true );
701
  }
702
+ $schedule_timestamp = wp_next_scheduled( 'yop_poll_hourly_event', array() );
703
+ if ( $schedule_timestamp ){
704
  wp_unschedule_event( $schedule_timestamp, 'yop_poll_hourly_event', array() );
705
  }
706
  }
707
 
708
  public function admin_menu() {
709
+ if ( is_admin() && $this->current_user_can( 'edit_own_polls' ) ){
710
+ if ( function_exists( 'add_menu_page' ) ){
711
+ if ( $this->current_user_can( 'edit_own_polls' ) ){
712
+ $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' );
713
+ }
714
+ }
715
+ if ( $this->current_user_can( 'edit_own_polls' ) ){
716
+ add_action( "load-$page", array( &$this, 'manage_pages_load' ) );
717
+ }
718
+ if ( function_exists( 'add_submenu_page' ) ){
719
+
720
+ if ( $this->current_user_can( 'edit_own_polls' ) ){
721
+ $subpage = add_submenu_page( 'yop-polls', __( 'All Polls', 'yop_poll' ), __( 'All Polls', 'yop_poll' ), 'read', 'yop-polls', array( &$this, 'manage_pages' ) );
722
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
723
+ }
724
+ if ( $this->current_user_can( 'edit_own_polls' ) ){
725
+ $subpage = add_submenu_page( 'yop-polls', __( 'Add New', 'yop_poll' ), __( 'Add New', 'yop_poll' ), 'read', 'yop-polls-add-new', array( &$this, 'manage_pages' ) );
726
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
727
+ }
728
+ if ( $this->current_user_can( 'manage_polls_options' ) ){
729
+ $subpage = add_submenu_page( 'yop-polls', __( 'Options', 'yop_poll' ), __( 'Options', 'yop_poll' ), 'read', 'yop-polls-options', array( &$this, 'manage_pages' ) );
730
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
731
+ }
732
+ if ( $this->current_user_can( 'edit_own_polls_templates' ) ){
733
+ $subpage = add_submenu_page( 'yop-polls', __( 'Templates', 'yop_poll' ), __( 'Templates', 'yop_poll' ), 'read', 'yop-polls-templates', array( &$this, 'manage_pages' ) );
734
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
735
+ }
736
+ if ( $this->current_user_can( 'view_own_polls_logs' ) ){
737
+ $subpage = add_submenu_page( 'yop-polls', __( 'Logs', 'yop_poll' ), __( 'Logs', 'yop_poll' ), 'read', 'yop-polls-logs', array( &$this, 'manage_pages' ) );
738
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
739
+ }
740
+ if ( $this->current_user_can( 'manage_polls_bans' ) ){
741
+ $subpage = add_submenu_page( 'yop-polls', __( 'Bans', 'yop_poll' ), __( 'Bans', 'yop_poll' ), 'read', 'yop-polls-bans', array( &$this, 'manage_pages' ) );
742
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
743
+ }
744
+ if ( $this->current_user_can( 'become_pro' ) ){
745
+ $subpage = add_submenu_page( 'yop-polls', __( 'Become Pro', 'yop_poll' ), __( 'Become Pro', 'yop_poll' ), 'read', 'yop-polls-become-pro', array( &$this, 'manage_pages' ) );
746
+ add_action( "load-$subpage", array( &$this, 'manage_pages_load' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
747
  }
748
  }
749
  }
750
  }
751
+
752
  public function manage_pages() {
753
  global $page, $action;
754
+ switch ( $page ) {
755
  case 'yop-polls' :
756
+ if ( 'custom-fields' == $action ){
757
+ $this->view_poll_custom_fields();
758
  break;
759
  }
760
+ if ( 'results' == $action ){
761
+ $this->view_poll_results();
762
  break;
763
+ }
764
+ elseif ( 'edit' == $action ) {
765
+ }
766
+ else {
767
+ $this->view_all_polls();
768
  break;
769
  }
770
  case 'yop-polls-add-new' :
771
+ $this->view_add_edit_new_poll();
772
  break;
773
  case 'yop-polls-options' :
774
+ $this->view_yop_poll_options();
775
  break;
776
  case 'yop-polls-logs' :
777
+ $this->view_yop_poll_logs();
778
  break;
779
  case 'yop-polls-bans' :
780
+ $this->view_yop_poll_bans();
781
  break;
782
  case 'yop-polls-become-pro' :
783
+ $this->view_yop_poll_become_pro();
784
  break;
785
  case 'yop-polls-templates' :
786
+ if ( 'add-new' == $action || 'edit' == $action ){
787
+ $this->view_add_edit_poll_template();
788
+ }
789
+ else {
790
+ $this->view_yop_poll_templates();
791
  }
792
  break;
793
  default :
794
+ $this->view_all_polls();
795
  }
796
  }
797
+
798
  public function manage_pages_load() {
799
+ wp_reset_vars( array( 'page', 'action', 'orderby', 'order' ) );
 
 
 
 
 
800
  global $page, $action, $orderby, $order, $yop_poll_add_new_config;
801
+ $default_options = get_option( 'yop_poll_options', array() );
802
 
803
+ wp_enqueue_style( 'yop-poll-admin', "{$this->_config->plugin_url}/css/yop-poll-admin.css", array(), $this->_config->version );
804
+ $answers_number = $this->_config->min_number_of_answers + 1; // total +1
805
  $customfields_number = $this->_config->min_number_of_customfields + 1; // total +1
806
 
807
+ wp_enqueue_script( 'yop-poll-admin', "{$this->_config->plugin_url}/js/yop-poll-admin.js", array( 'jquery' ), $this->_config->version, true );
808
+ $doScroll = 0;
809
+ switch ( $page ) {
 
 
810
  case 'yop-polls' :
811
+ if ( 'results' == $action ){
812
+ wp_enqueue_style( 'yop-poll-admin-results', "{$this->_config->plugin_url}/css/yop-poll-admin-results.css", array(), $this->_config->version );
813
+ wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
814
+ wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
815
+ 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 );
816
+ wp_enqueue_style( 'yop-poll-admin-custom-fields', "{$this->_config->plugin_url}/css/yop-poll-admin-custom-fields.css", array(), $this->_config->version );
817
+ 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 );
818
+ $this->yop_poll_custom_fields_results_operations();
 
 
 
 
 
 
 
819
  break;
820
  }
821
+ if ( 'custom-fields' == $action ){
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_operations();
 
 
 
 
 
 
 
828
  break;
829
+ }
830
+ elseif ( 'edit' == $action ) {
831
+ $doScroll = 1;
832
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
833
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
834
+ $yop_poll_model = new Yop_Poll_Model ( $poll_id );
835
+ $answers = Yop_Poll_Model::get_poll_answers( $poll_id );
836
+ $answers_number = count( $answers ) + 1; // total +1
837
+ $custom_fields = Yop_Poll_Model::get_poll_customfields( $poll_id );
838
+ $customfields_number = count( $custom_fields ) + 1; // total +1
839
+ }
840
  else {
841
+ $this->view_all_polls_operations();
842
+ wp_enqueue_script( 'link' );
843
+ wp_enqueue_script( 'xfn' );
844
+ wp_enqueue_script( 'yop-poll-optin-form', "http://app.getresponse.com/view_webform.js?wid=394041&mg_param1=1", NULL, $this->_config->version, true );
845
+ $this->load_optin_box();
846
  break;
847
  }
848
 
849
  case 'yop-polls-add-new' :
850
+ $doScroll = 1;
851
+ $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' ) );
852
+ wp_enqueue_style( 'yop-poll-admin-add-new', "{$this->_config->plugin_url}/css/yop-poll-admin-add-new.css", array(), $this->_config->version );
853
+ wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
854
+ wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
855
+
856
+ 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 );
857
+ 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 );
858
+ 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 );
859
+ wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array(), $this->_config->version );
860
+ wp_localize_script( 'yop-poll-admin-add-new', 'yop_poll_add_new_config', $yop_poll_add_new_config );
861
+ wp_enqueue_script( 'link' );
862
+ wp_enqueue_script( 'xfn' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
  break;
864
  case 'yop-polls-logs' :
865
+ wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
866
+ wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
867
+ 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 );
868
+ 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 );
869
+ $this->view_yop_poll_logs_operations();
 
 
 
 
 
 
 
870
  break;
871
  case 'yop-polls-bans' :
872
+ wp_enqueue_script( 'yop-poll-admin-bans', "{$this->_config->plugin_url}/js/yop-poll-admin-bans.js", array( 'jquery' ), $this->_config->version, true );
873
+ $this->view_yop_poll_bans_operations();
 
 
874
  break;
875
  case 'yop-polls-options' :
876
+ $doScroll = 1;
877
+ wp_enqueue_style( 'yop-poll-admin-options', "{$this->_config->plugin_url}/css/yop-poll-admin-options.css", array(), $this->_config->version );
878
+ wp_enqueue_style( 'yop-poll-timepicker', "{$this->_config->plugin_url}/css/timepicker.css", array(), $this->_config->version );
879
+ wp_enqueue_style( 'yop-poll-jquery-ui', "{$this->_config->plugin_url}/css/jquery-ui.css", array(), $this->_config->version );
880
+ 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 );
881
+ 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 );
882
+ wp_enqueue_script( 'link' );
883
+ wp_enqueue_script( 'xfn' );
 
 
 
 
 
 
884
  break;
885
  case 'yop-polls-templates' :
886
+ if ( 'edit' == $action || 'add-new' == $action ){
887
+ $doScroll = 1;
888
+ }
889
+ add_filter( 'user_can_richedit', create_function( '$a', 'return false;' ), 1 );
890
+ wp_enqueue_script( array( 'editor', 'thickbox' ) );
891
+ wp_enqueue_style( 'thickbox' );
892
+ wp_enqueue_script( 'yop-poll-admin-templates', "{$this->_config->plugin_url}/js/yop-poll-admin-templates.js", array( 'jquery' ), $this->_config->version, true );
893
+ $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' ) ) );
894
+ 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 );
895
+ wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-skin-precious-white.css", array(), $this->_config->version );
896
+ wp_localize_script( 'yop-poll-admin-templates', 'yop_poll_add_new_template_config', $yop_poll_add_new_template_config );
897
+ $this->view_yop_poll_templates_operations();
 
 
 
 
 
 
 
 
 
 
 
 
898
  break;
899
  default :
900
+ $this->view_all_polls_operations();
901
  break;
902
  }
903
+ wp_localize_script( 'yop-poll-admin', "yop_poll_do_scroll", array( 'doScroll' => $doScroll ) );
904
  }
905
 
906
  /**
908
  */
909
  public function view_yop_poll_logs_operations() {
910
  global $page, $action, $order, $orderby, $current_user;
911
+ if ( '-1' != $action && isset ( $_REQUEST ['yoppolllogscheck'] ) ){
912
+ if ( 'delete' == $action ){
913
+ check_admin_referer( 'yop-poll-logs' );
914
+ $bulklogs = ( array )$_REQUEST ['yoppolllogscheck'];
915
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
916
  $total_deleted = 0;
917
  foreach ( $bulklogs as $log_id ) {
918
+ $log_id = ( int )$log_id;
919
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log_id );
920
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
921
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
922
+ Yop_Poll_Model::delete_poll_log_from_db( $log_id );
923
+ }
924
+ else {
925
+ $total_deleted++;
926
+ }
927
+ }
928
+ wp_redirect( add_query_arg( 'deleted', count( $bulklogs ) - $total_deleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'yoppolllogscheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
929
  exit ();
930
  }
931
 
932
+ if ( 'delete_group' == $action ){
933
+ check_admin_referer( 'yop-poll-logs' );
934
+ $bulklogs = ( array )$_REQUEST ['yoppolllogscheck'];
935
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
936
  $total_deleted_group = 0;
937
  foreach ( $bulklogs as $vote_id ) {
938
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $vote_id );
939
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
940
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
941
+ Yop_Poll_Model::delete_group_poll_log_from_db( $vote_id );
942
+ }
943
+ else {
944
+ $total_deleted_group++;
945
+ }
946
+ }
947
+ 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'] ) ) ) );
 
 
 
948
  exit ();
949
  }
950
+ }
951
+ elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
952
+ if ( 'delete' == $action ){
953
+ check_admin_referer( 'yop-poll-logs-delete' );
954
+ $log_id = ( int )$_REQUEST ['id'];
955
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
956
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log_id );
957
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
958
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
959
+ Yop_Poll_Model::delete_poll_log_from_db( $log_id );
960
+ }
961
+ else {
962
+ wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
963
+ }
964
+ wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
965
  exit ();
966
  }
967
+ if ( 'delete_group' == $action ){
968
+ check_admin_referer( 'yop-poll-logs-delete' );
969
  $vote_id = $_REQUEST ['id'];
970
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
971
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $vote_id );
972
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
973
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
974
+ Yop_Poll_Model::delete_group_poll_log_from_db( $vote_id );
975
+ }
976
+ else {
977
+ wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
978
+ }
979
+ wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
980
  exit ();
981
  }
982
+ }
983
+ elseif ( isset ( $_REQUEST ['export'] ) ) {
984
  global $wpdb;
985
+ if ( isset( $_REQUEST ['a'] ) && __( 'Export', 'yop_poll' ) == $_REQUEST ['a'] ){
986
+ check_admin_referer( 'yop-poll-logs' );
987
+ $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
988
+ $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
989
+ $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
990
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
991
+ $log_sdate = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
992
+ $log_edate = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
993
+ $group_by = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
994
+
995
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
996
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
997
+ if ( $this->current_user_can( 'view_own_polls_logs' ) && $poll_id ){
998
+ if ( $poll_author != $current_user->ID && !$this->current_user_can( 'view_polls_logs' ) ){
999
+ wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
1000
+ }
1001
+ }
1002
+ elseif ( !$this->current_user_can( 'view_polls_logs' ) ) {
1003
+ wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
1004
+ }
1005
+
1006
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
1007
+ if ( $group_by == 'vote' ){
1008
+ $search = array( 'fields' => array( 'name', 'ip', 'user_nicename', 'user_email', 'user_from', 'tr_id' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
1009
+ }
1010
+ else {
1011
+ $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'] ) : '' );
1012
+ }
1013
+ $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
1014
+ if ( 'all' == $_REQUEST ['export'] ){
1015
+ if ( $group_by == 'vote' ){
1016
+ $logs = Yop_Poll_Model::get_group_logs_filter_search( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1017
+ }
1018
+ else {
1019
+ $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, 0, 99999999, $log_sdate, $log_edate );
1020
+ }
1021
+ }
1022
+ if ( 'page' == $_REQUEST ['export'] ){
1023
+ if ( $group_by == 'vote' ){
1024
+ $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 );
1025
+ }
1026
+ else {
1027
+ $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
1028
+ }
1029
+ }
1030
+
1031
+ $csv_file_name = 'logs_export.' . date( 'YmdHis' ) . '.csv';
1032
+ $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' ) );
1033
+
1034
+ header( 'Content-type: application/csv' );
1035
+ header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1036
+ ob_start();
1037
+ $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1038
+
1039
+ if ( !fputcsv( $f, $csv_header_array ) ){
1040
+ _e( "Can't write header!", 'yop_poll' );
1041
+ }
1042
+
1043
+ if ( count( $logs ) > 0 ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1044
  $index = 1;
1045
  foreach ( $logs as $log ) {
1046
+ $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'] ) );
1047
+ if ( !fputcsv( $f, $logs_data ) ){
1048
+ _e( "Can't write header!", 'yop_poll' );
1049
+ }
1050
+ $index++;
 
 
 
 
 
 
 
 
 
 
1051
  }
1052
  }
1053
 
1054
+ fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1055
+ $csvStr = ob_get_contents();
1056
+ ob_end_clean();
1057
 
1058
  echo $csvStr;
1059
  exit ();
1060
  }
1061
 
1062
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
 
 
 
1063
  exit ();
1064
+ }
1065
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1066
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
1067
  exit ();
1068
  }
1069
  }
1070
+
1071
  public function yop_poll_custom_fields_operations() {
1072
  global $page, $action;
1073
+ if ( isset ( $_REQUEST ['export'] ) ){
1074
+ check_admin_referer( 'yop-poll-custom-fields' );
1075
+ if ( '' != $_REQUEST ['export'] ){
1076
+ $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
1077
+ $page_no = ( isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1 );
1078
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1079
+ $sdate = ( isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '' );
1080
+ $edate = ( isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '' );
1081
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1082
+ $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1083
+ $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1084
+ $custom_fields_number = count( $poll_custom_fields );
1085
+ $column_custom_fields_ids = array();
1086
+ $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $sdate, $edate );
1087
+ $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $per_page );
1088
+ if ( intval( $page_no ) > intval( $total_custom_fields_logs_pages ) ){
1089
  $page_no = 1;
1090
+ }
1091
 
1092
+ if ( 'all' == $_REQUEST ['export'] ){
1093
+ $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', 0, 99999999, $sdate, $edate );
1094
+ }
1095
+ if ( 'page' == $_REQUEST ['export'] ){
1096
+ $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $page_no - 1 ) * $per_page, $per_page, $sdate, $edate );
1097
+ }
1098
 
1099
+ $csv_file_name = 'custom_fields_export.' . date( 'YmdHis' ) . '.csv';
1100
+ $csv_header_array = array( __( '#', 'yop_poll' ) );
 
 
1101
  foreach ( $poll_custom_fields as $custom_field ) {
1102
  $column_custom_fields_ids [] = $custom_field ['id'];
1103
+ $csv_header_array [] = ucfirst( $custom_field ['custom_field'] );
1104
  }
1105
+ $csv_header_array [] = __( 'Vote Date', 'yop_poll' );
1106
 
1107
+ header( 'Content-type: application/csv' );
1108
+ header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1109
+ ob_start();
1110
+ $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1111
  $n = 0;
1112
+ if ( isset ( $csv_header_array ) ){
1113
+ if ( !fputcsv( $f, $csv_header_array ) ){
1114
+ _e( "Can't write header!", 'yop_poll' );
1115
+ }
1116
+ }
1117
 
1118
+ if ( count( $custom_fields_logs ) > 0 ){
1119
  $index = 1;
1120
  foreach ( $custom_fields_logs as $logs ) {
1121
+ $column_custom_fields_values = array( $index );
 
 
1122
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
1123
+ $vote_log_values = array();
1124
+ $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
1125
+ if ( count( $vote_logs ) > 0 ){
1126
  foreach ( $vote_logs as $vote_log ) {
1127
+ $temp = explode( '<#!->', $vote_log );
1128
+ $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
1129
  }
1130
  }
1131
  $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
1132
  }
1133
  $column_custom_fields_values [] = $logs ['vote_date'];
1134
+ if ( !fputcsv( $f, $column_custom_fields_values ) ){
1135
+ _e( "Can't write record!", 'yop_poll' );
1136
+ }
1137
+ $index++;
1138
  }
1139
  }
1140
+ fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1141
+ $csvStr = ob_get_contents();
1142
+ ob_end_clean();
1143
 
1144
  echo $csvStr;
1145
  exit ();
1146
  }
1147
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
 
 
 
1148
  exit ();
1149
+ }
1150
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1151
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
 
1152
  exit ();
1153
  }
1154
  }
1155
+
1156
  public function yop_poll_custom_fields_results_operations() {
1157
  global $page, $action;
1158
+ if ( isset ( $_REQUEST ['export'] ) ){
1159
+ check_admin_referer( 'yop-poll-custom-fields' );
1160
+ if ( __( 'Export', 'yop_poll' ) == $_REQUEST ['a'] ){
1161
+ $cf_per_page = ( isset ( $_GET ['cf_per_page'] ) ? intval( $_GET ['cf_per_page'] ) : 100 );
1162
+ $cf_page_no = ( isset ( $_REQUEST ['cf_page_no'] ) ? ( int )$_REQUEST ['cf_page_no'] : 1 );
1163
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1164
+ $cf_sdate = ( isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '' );
1165
+ $cf_edate = ( isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '' );
1166
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1167
+ $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1168
+ $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1169
+ $custom_fields_number = count( $poll_custom_fields );
1170
+ $column_custom_fields_ids = array();
1171
+ $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $cf_sdate, $cf_edate );
1172
+ $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $cf_per_page );
1173
+ if ( intval( $cf_page_no ) > intval( $total_custom_fields_logs_pages ) ){
1174
  $cf_page_no = 1;
1175
+ }
1176
 
1177
+ if ( 'all' == $_REQUEST ['export'] ){
1178
+ $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', 0, 99999999, $cf_sdate, $cf_edate );
1179
+ }
1180
+ if ( 'page' == $_REQUEST ['export'] ){
1181
+ $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 );
1182
+ }
1183
 
1184
+ $csv_file_name = 'custom_fields_export.' . date( 'YmdHis' ) . '.csv';
1185
+ $csv_header_array = array( __( '#', 'yop_poll' ) );
 
 
1186
  foreach ( $poll_custom_fields as $custom_field ) {
1187
  $column_custom_fields_ids [] = $custom_field ['id'];
1188
+ $csv_header_array [] = ucfirst( $custom_field ['custom_field'] );
1189
  }
1190
+ $csv_header_array [] = __( 'Vote ID', 'yop_poll' );
1191
+ $csv_header_array [] = __( 'Traking ID', 'yop_poll' );
1192
+ $csv_header_array [] = __( 'Vote Date', 'yop_poll' );
1193
+
1194
+ header( 'Content-type: application/csv' );
1195
+ header( 'Content-Disposition: attachment; filename="' . $csv_file_name . '"' );
1196
+ ob_start();
1197
+ $f = fopen( 'php://output', 'w' ) or show_error( __( "Can't open php://output!", 'yop_poll' ) );
1198
  $n = 0;
1199
+ if ( isset ( $csv_header_array ) ){
1200
+ if ( !fputcsv( $f, $csv_header_array ) ){
1201
+ _e( "Can't write header!", 'yop_poll' );
1202
+ }
1203
+ }
1204
 
1205
+ if ( count( $custom_fields_logs ) > 0 ){
1206
  $index = 1;
1207
  foreach ( $custom_fields_logs as $logs ) {
1208
+ $column_custom_fields_values = array( $index );
 
 
1209
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
1210
+ $vote_log_values = array();
1211
+ $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
1212
+ if ( count( $vote_logs ) > 0 ){
1213
  foreach ( $vote_logs as $vote_log ) {
1214
+ $temp = explode( '<#!->', $vote_log );
1215
+ $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
1216
  }
1217
  }
1218
  $column_custom_fields_values [] = isset ( $vote_log_values [$custom_field_id] ) ? $vote_log_values [$custom_field_id] : '';
1220
  $column_custom_fields_values [] = $logs ['vote_id'];
1221
  $column_custom_fields_values [] = $logs ['tr_id'];
1222
  $column_custom_fields_values [] = $logs ['vote_date'];
1223
+ if ( !fputcsv( $f, $column_custom_fields_values ) ){
1224
+ _e( "Can't write record!", 'yop_poll' );
1225
+ }
1226
+ $index++;
1227
  }
1228
  }
1229
+ fclose( $f ) or show_error( __( "Can't close php://output!", 'yop_poll' ) );
1230
+ $csvStr = ob_get_contents();
1231
+ ob_end_clean();
1232
 
1233
  echo $csvStr;
1234
  exit ();
1235
  }
1236
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'export', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
 
 
 
1237
  exit ();
1238
+ }
1239
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1240
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'a' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
 
1241
  exit ();
1242
  }
1243
  }
1244
+
1245
  public function view_yop_poll_bans_operations() {
1246
  global $page, $action;
1247
+ if ( '-1' != $action && isset ( $_REQUEST ['yoppollbanscheck'] ) ){
1248
+ if ( 'delete' == $action ){
1249
+ check_admin_referer( 'yop-poll-bans' );
1250
+ $bulkbans = ( array )$_REQUEST ['yoppollbanscheck'];
1251
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1252
  foreach ( $bulkbans as $ban_id ) {
1253
+ $ban_id = ( int )$ban_id;
1254
+ Yop_Poll_Model::delete_poll_ban_from_db( $ban_id );
1255
+ }
1256
+ wp_redirect( add_query_arg( 'deleted', count( $bulkbans ), remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollbanscheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1257
  exit ();
1258
  }
1259
+ }
1260
+ elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1261
+ if ( 'delete' == $action ){
1262
+ check_admin_referer( 'yop-poll-bans-delete' );
1263
+ $ban_id = ( int )$_REQUEST ['id'];
1264
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1265
+ Yop_Poll_Model::delete_poll_ban_from_db( $ban_id );
1266
+ wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
1267
  exit ();
1268
  }
1269
+ }
1270
+ elseif ( 'add-ban' == $action ) {
1271
+ check_admin_referer( 'yop-poll-add-ban' );
1272
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1273
+ $bans = Yop_Poll_Model::add_bans( $_REQUEST );
1274
+ if ( $bans ['error'] != '' ){
1275
+ wp_redirect( add_query_arg( 'bans-error', urlencode( $bans ['error'] ), remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
1276
  exit ();
1277
+ }
1278
+ else {
1279
+ wp_redirect( add_query_arg( 'bans-added', urlencode( ( int )$bans ['success'] ), remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
1280
  exit ();
1281
  }
1282
+ }
1283
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1284
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
1285
  exit ();
1286
  }
1287
  }
1288
+
1289
  public function view_yop_poll_templates_operations() {
1290
  global $page, $action, $yop_poll_add_new_config, $current_user;
1291
+ if ( '-1' != $action && isset ( $_REQUEST ['templatecheck'] ) ){
1292
+ if ( 'delete' == $action ){
1293
+ check_admin_referer( 'yop-poll-templates' );
1294
+ $bulktemplates = ( array )$_REQUEST ['templatecheck'];
1295
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1296
  $total_deleted = 0;
1297
  foreach ( $bulktemplates as $template_id ) {
1298
+ $template_id = ( int )$template_id;
1299
+ $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1300
+ if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){
1301
+ Yop_Poll_Model::delete_poll_template_from_db( $template_id );
1302
+ }
1303
+ else {
1304
+ $total_deleted++;
1305
+ }
1306
  }
1307
+ wp_redirect( add_query_arg( 'deleted', count( $bulktemplates ) - $total_deleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'templatecheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1308
  exit ();
1309
  }
1310
+ if ( 'clone' == $action ){
1311
+ check_admin_referer( 'yop-poll-templates' );
1312
+ $bulktemplates = ( array )$_REQUEST ['templatecheck'];
1313
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1314
  $total_cloned = 0;
1315
  foreach ( $bulktemplates as $template_id ) {
1316
+ $template_id = ( int )$template_id;
1317
+ $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1318
+ if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){
1319
+ Yop_Poll_Model::clone_poll_template( $template_id );
1320
+ }
1321
+ else {
1322
+ $total_cloned++;
1323
+ }
1324
  }
1325
+ wp_redirect( add_query_arg( 'cloned', count( $bulktemplates ) - $total_cloned, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'templatecheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1326
  exit ();
1327
  }
1328
+ }
1329
+ elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1330
+ if ( 'delete' == $action ){
1331
+ check_admin_referer( 'yop-poll-templates' );
1332
+ $template_id = ( int )$_REQUEST ['id'];
1333
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1334
+ $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1335
+ if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){
1336
+ Yop_Poll_Model::delete_poll_template_from_db( $template_id );
1337
+ }
1338
+ else {
1339
+ wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
1340
+ }
1341
+ wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
1342
  exit ();
1343
  }
1344
+ if ( 'clone' == $action ){
1345
+ check_admin_referer( 'yop-poll-templates' );
1346
+ $template_id = ( int )$_REQUEST ['id'];
1347
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1348
+ $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
1349
+ if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){
1350
+ Yop_Poll_Model::clone_poll_template( $template_id );
1351
+ }
1352
+ else {
1353
+ wp_die( __( 'You are not allowed to clone this item.', 'yop_poll' ) );
1354
+ }
1355
+ wp_redirect( add_query_arg( 'cloned', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
1356
  exit ();
1357
  }
1358
+ }
1359
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1360
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
1361
  exit ();
1362
  }
1363
  }
1364
+
1365
  public function view_all_polls_operations() {
1366
  global $page, $action, $yop_poll_add_new_config, $current_user;
1367
+ if ( '-1' != $action && isset ( $_REQUEST ['yoppollcheck'] ) ){
1368
+ if ( 'delete' == $action ){
1369
+ check_admin_referer( 'yop-poll-view' );
1370
+ $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1371
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1372
  $total_undeleted = 0;
1373
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1374
+ $yoppoll_id = ( int )$yoppoll_id;
1375
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1376
+ if ( ( $this->current_user_can( 'delete_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){
1377
+ Yop_Poll_Model::delete_poll_from_db( $yoppoll_id );
1378
+ }
1379
+ else {
1380
+ $total_undeleted++;
1381
+ }
1382
  }
1383
+ wp_redirect( add_query_arg( 'deleted', count( $bulkyoppolls ) - $total_undeleted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1384
  exit ();
1385
  }
1386
+ if ( 'clone' == $action ){
1387
+ check_admin_referer( 'yop-poll-view' );
1388
+ $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1389
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1390
  $total_uncloned = 0;
1391
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1392
+ $yoppoll_id = ( int )$yoppoll_id;
1393
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1394
+ if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
1395
+ Yop_Poll_Model::clone_poll( $yoppoll_id );
1396
+ }
1397
+ else {
1398
+ $total_uncloned++;
1399
+ }
1400
  }
1401
+ wp_redirect( add_query_arg( 'cloned', count( $bulkyoppolls ) - $total_uncloned, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1402
  exit ();
1403
  }
1404
+ if ( 'reset_votes' == $action ){
1405
+ check_admin_referer( 'yop-poll-view' );
1406
+ $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1407
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1408
  $total_unreseted = 0;
1409
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1410
+ $yoppoll_id = ( int )$yoppoll_id;
1411
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1412
+ if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){
1413
+ Yop_Poll_Model::reset_votes_for_poll( $yoppoll_id );
1414
+ }
1415
+ else {
1416
+ $total_unreseted++;
1417
+ }
1418
  }
1419
+ wp_redirect( add_query_arg( 'reseted_votes', count( $bulkyoppolls ) - $total_unreseted, remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'yoppollcheck' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
 
 
1420
  exit ();
1421
  }
1422
+ if ( 'delete_logs' == $action ){
1423
+ check_admin_referer( 'yop-poll-view' );
1424
+ $bulkyoppolls = ( array )$_REQUEST ['yoppollcheck'];
1425
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1426
  $total_undeleted_logs = 0;
1427
  foreach ( $bulkyoppolls as $yoppoll_id ) {
1428
+ $yoppoll_id = ( int )$yoppoll_id;
1429
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1430
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
1431
+ Yop_Poll_Model::delete_all_poll_logs( $yoppoll_id );
1432
+ }
1433
+ else {
1434
+ $total_undeleted_logs++;
1435
+ }
1436
  }
1437
+ 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'] ) ) ) );
 
 
 
 
1438
  exit ();
1439
  }
1440
+ }
1441
+ elseif ( '-1' != $action && isset ( $_REQUEST ['id'] ) ) {
1442
+ if ( 'delete' == $action ){
1443
+ check_admin_referer( 'yop-poll-delete' );
1444
+ $yoppoll_id = ( int )$_REQUEST ['id'];
1445
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1446
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1447
+ if ( ( $this->current_user_can( 'delete_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){
1448
+ Yop_Poll_Model::delete_poll_from_db( $yoppoll_id );
1449
+ }
1450
+ else {
1451
+ wp_die( __( 'You are not allowed to delete this item.', 'yop_poll' ) );
1452
+ }
1453
+ wp_redirect( add_query_arg( 'deleted', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
1454
  exit ();
1455
  }
1456
 
1457
+ if ( 'clone' == $action ){
1458
+ check_admin_referer( 'yop-poll-clone' );
1459
+ $yoppoll_id = ( int )$_REQUEST ['id'];
1460
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1461
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1462
+ if ( ( $this->current_user_can( 'clone_own_polls' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){
1463
+ Yop_Poll_Model::clone_poll( $yoppoll_id );
1464
+ }
1465
+ else {
1466
+ wp_die( __( 'You are not allowed to clone this item.', 'yop_poll' ) );
1467
+ }
1468
+ wp_redirect( add_query_arg( 'cloned', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
1469
  exit ();
1470
  }
1471
 
1472
+ if ( 'reset_votes' == $action ){
1473
+ check_admin_referer( 'yop-poll-reset-votes' );
1474
+ $yoppoll_id = ( int )$_REQUEST ['id'];
1475
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1476
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1477
+ if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){
1478
+ Yop_Poll_Model::reset_votes_for_poll( $yoppoll_id );
1479
+ }
1480
+ else {
1481
+ wp_die( __( 'You are not allowed to reset stats for this item.', 'yop_poll' ) );
1482
+ }
1483
+ wp_redirect( add_query_arg( 'reseted_votes', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
1484
  exit ();
1485
  }
1486
 
1487
+ if ( 'delete_logs' == $action ){
1488
+ check_admin_referer( 'yop-poll-delete-logs' );
1489
+ $yoppoll_id = ( int )$_REQUEST ['id'];
1490
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1491
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $yoppoll_id );
1492
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
1493
+ Yop_Poll_Model::delete_all_poll_logs( $yoppoll_id );
1494
+ }
1495
+ else {
1496
+ wp_die( __( 'You are not allowed to delete logs for this item.', 'yop_poll' ) );
1497
+ }
1498
+ wp_redirect( add_query_arg( 'deleted_logs', 1, remove_query_arg( array( '_wpnonce', 'id', 'action' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) ) );
 
 
1499
  exit ();
1500
  }
1501
+ }
1502
+ elseif ( !empty ( $_GET ['_wp_http_referer'] ) ) {
1503
+ wp_safe_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER ['REQUEST_URI'] ) ) );
 
 
1504
  exit ();
1505
  }
1506
  }
1514
  */
1515
  public function view_all_polls() {
1516
  global $page, $action, $orderby, $order, $current_user;
1517
+ $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
1518
+ $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'question' => 'asc', 'start_date' => 'asc', 'end_date' => 'asc', 'total_votes' => 'asc', 'total_answers' => 'asc' );
1519
+ $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
1520
+
1521
+ $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'question' => 'desc', 'start_date' => 'desc', 'end_date' => 'desc', 'total_votes' => 'desc', 'total_answers' => 'desc' );
1522
+ $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
1523
+
1524
+ $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'question' => 'sortable', 'start_date' => 'sortable', 'end_date' => 'sortable', 'total_votes' => 'sortable', 'total_answers' => 'sortable' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1525
  $order_sortable [$orderby] = 'sorted';
1526
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1527
+ $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
1528
+ if ( isset ( $_REQUEST ['filters'] ) ){
1529
+ switch ( $_REQUEST ['filters'] ) {
 
 
 
 
1530
  case 'started' :
1531
+ $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
 
 
 
 
1532
  break;
1533
  case 'not_started' :
1534
+ $filter = array( 'field' => 'start_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '>=' );
 
 
 
 
1535
  break;
1536
  case 'never_expire' :
1537
+ $filter = array( 'field' => 'end_date', 'value' => '9999-12-31 23:59:59', 'operator' => '=' );
 
 
 
 
1538
  break;
1539
  case 'expired' :
1540
+ $filter = array( 'field' => 'end_date', 'value' => YOP_POLL_MODEL::get_mysql_curent_date(), 'operator' => '<=' );
 
 
 
 
1541
  break;
1542
  }
1543
  }
1544
+ $search = array(
1545
+ 'fields' => array( 'name', 'question' ),
1546
+ 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : ''
 
 
 
1547
  );
1548
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( $orderby, $order, $filter, $search );
1549
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
1550
+ $optin_box_modal_query = admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) );
1551
+ $optin_box_modal_query = add_query_arg( 'action', 'yop_poll_show_optin_box_modal', $optin_box_modal_query );
1552
  ?>
1553
+ <?php if ( $optin_box_modal_options['show'] == 'yes' ){ ?>
1554
  <a id="yop-poll-show-modal-box"
1555
  href="<?php echo $optin_box_modal_query; ?>" style="display: none;"></a>
1556
  <?php } ?>
1563
  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>
1564
  </h2>
1565
  <?php
1566
+ if ( isset ( $_REQUEST ['deleted'] ) ){
1567
  echo '<div id="message" class="updated"><p>';
1568
+ $deleted = ( int )$_REQUEST ['deleted'];
1569
+ printf( _n( '%s Poll deleted.', '%s Polls deleted.', $deleted ), $deleted );
1570
  echo '</p></div>';
1571
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
 
 
1572
  }
1573
  ?>
1574
  <?php
1575
+ if ( isset ( $_REQUEST ['cloned'] ) ){
1576
  echo '<div id="message" class="updated"><p>';
1577
+ $cloned = ( int )$_REQUEST ['cloned'];
1578
+ printf( _n( '%s Poll cloned.', '%s Polls cloned.', $cloned ), $cloned );
1579
  echo '</p></div>';
1580
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'cloned' ), $_SERVER ['REQUEST_URI'] );
 
 
1581
  }
1582
  ?>
1583
  <?php
1584
+ if ( isset ( $_REQUEST ['reseted_votes'] ) ){
1585
  echo '<div id="message" class="updated"><p>';
1586
+ $reseted_votes = ( int )$_REQUEST ['reseted_votes'];
1587
+ printf( _n( 'Vote reseted for %s Poll.', 'Votes reseted for %s Poll.', $reseted_votes ), $reseted_votes );
1588
  echo '</p></div>';
1589
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'reseted_votes' ), $_SERVER ['REQUEST_URI'] );
 
 
1590
  }
1591
  ?>
1592
 
1593
  <?php
1594
+ if ( isset ( $_REQUEST ['deleted_logs'] ) ){
1595
  echo '<div id="message" class="updated"><p>';
1596
+ $deleted_logs = ( int )$_REQUEST ['deleted_logs'];
1597
+ printf( _n( 'Log deleted for %s Poll.', 'Log deleted for %s Polls.', $deleted_logs ), $deleted_logs );
1598
  echo '</p></div>';
1599
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted_logs' ), $_SERVER ['REQUEST_URI'] );
 
 
1600
  }
1601
  ?>
1602
 
1605
  <form action="" method="get">
1606
  <div id="post-body-content">
1607
  <?php wp_nonce_field( 'yop-poll-view' ); ?>
1608
+ <input type="hidden" name="order" value="<?php echo $order ?>"/>
1609
+ <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
1610
+ <input type="hidden" name="page" value="yop-polls"/>
1611
  <p class="search-box">
1612
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
1613
  <input id="yop-poll-search-input" type="search"
1614
+ value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
1615
+ name="s"/> <input id="search-submit" class="button"
1616
  type="submit" value="<?php _e( 'Search Polls', 'yop_poll' ); ?>"
1617
+ name=""/>
1618
  </p>
1619
  <div class="tablenav top">
1620
  <div class="alignleft actions">
1624
  <option value="clone"><?php _e( 'Clone', 'yop_poll' ); ?></option>
1625
  <option value="reset_votes"><?php _e( 'Reset Votes', 'yop_poll' ); ?></option>
1626
  <option value="delete_logs"><?php _e( 'Delete Logs', 'yop_poll' ); ?></option>
1627
+ </select>
1628
+ <input type="submit"
1629
  value="<?php _e( 'Apply', 'yop_poll' ); ?>"
1630
  class="button-secondary action" id="doaction" name="">
1631
  </div>
1633
  <select name="filters">
1634
  <option value="0"><?php _e( 'View All Polls', 'yop_poll' ); ?></option>
1635
  <option
1636
+ <?php echo isset( $_REQUEST['filters'] ) ? ( 'never_expire' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1637
  value="never_expire"><?php _e( 'No end date', 'yop_poll' ); ?></option>
1638
  <option
1639
+ <?php echo isset( $_REQUEST['filters'] ) ? ( 'expired' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1640
  value="expired"><?php _e( 'Expired', 'yop_poll' ); ?></option>
1641
  <option
1642
+ <?php echo isset( $_REQUEST['filters'] ) ? ( 'started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1643
  value="started"><?php _e( 'Started', 'yop_poll' ); ?></option>
1644
  <option
1645
+ <?php echo isset( $_REQUEST['filters'] ) ? ( 'not_started' == $_REQUEST['filters'] ? 'selected="selected"' : '' ) : '' ?>
1646
  value="not_started"><?php _e( 'Not Started', 'yop_poll' ); ?></option>
1647
+ </select>
1648
+ <input type="submit"
1649
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
1650
  class="button-secondary" id="post-query-submit" name="">
1651
  </div>
1655
  <thead>
1656
  <tr>
1657
  <th id="cb" class="manage-column column-cb check-column"
1658
+ style="width: 3%;" scope="col"><input type="checkbox"></th>
 
 
 
 
 
 
 
1659
  <th id="name"
1660
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
1661
  style="width: 30%" scope="col"><a
1662
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
1663
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
1664
  class="sorting-indicator"></span>
1665
  </a></th>
1666
  <th id="total_votes"
1667
+ class="manage-column <?php echo $order_sortable['total_votes'] ?> <?php echo $order_direction_reverse['total_votes'] ?>"
1668
  style="width: 6%" scope="col"><a
1669
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction['total_votes'] ) ) ); ?>">
1670
  <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
1671
  class="sorting-indicator"></span>
1672
  </a></th>
1673
  <th id="total_answers"
1674
+ class="manage-column <?php echo $order_sortable['total_answers'] ?> <?php echo $order_direction_reverse['total_answers'] ?>"
1675
  style="width: 7%" scope="col"><a
1676
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction['total_answers'] ) ) ); ?>">
1677
  <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
1678
  class="sorting-indicator"></span>
1679
  </a></th>
1680
  <th id="question"
1681
+ class="manage-column <?php echo $order_sortable['question'] ?> <?php echo $order_direction_reverse['question'] ?>"
1682
  style="width: 24%" scope="col"><a
1683
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction['question'] ) ) ); ?>">
1684
  <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
1685
  class="sorting-indicator"></span>
1686
  </a></th>
1687
+ <th id="poll_author" class="manage-column" style="width: 8%"
1688
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
1689
  <th id="start-date"
1690
+ class="manage-column <?php echo $order_sortable['start_date'] ?> <?php echo $order_direction_reverse['start_date'] ?>"
1691
  style="width: 10%" scope="col"><a
1692
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction['start_date'] ) ) ); ?>">
1693
  <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
1694
  class="sorting-indicator"></span>
1695
  </a></th>
1696
  <th id="end-date"
1697
+ class="manage-column <?php echo $order_sortable['end_date'] ?> <?php echo $order_direction_reverse['end_date'] ?>"
1698
  style="width: 10%" scope="col"><a
1699
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction['end_date'] ) ) ); ?>">
1700
  <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
1701
  class="sorting-indicator"></span>
1702
  </a></th>
1703
  </tr>
1704
  </thead>
1705
  <?php
1706
+ if ( count( $yop_polls ) > 0 ){
1707
  foreach ( $yop_polls as $yop_poll ) {
1708
  ?>
1709
  <tbody id="the-list">
1710
  <tr valign="middle" class="alternate"
1711
  id="yop-poll-<?php echo $yop_poll['id']; ?>">
1712
  <th class="check-column" scope="row">
1713
+ <?php if ( ( $this->current_user_can( 'delete_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){ ?>
1714
  <input type="checkbox"
1715
  value="<?php echo $yop_poll['id']; ?>" name="yoppollcheck[]">
1716
  <?php } ?>
1717
  </th>
1718
  <td><strong>
1719
+ <?php if (( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) )) { ?>
 
 
 
 
 
 
 
 
 
 
1720
  <a
1721
  title="<?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>"
1722
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"
1723
  class="row-title">
1724
  <?php } ?>
1725
  <?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?>
1726
+ <?php if (( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) )) { ?>
1727
  </a>
1728
  <?php } ?>
1729
  </strong><br>
1730
  <div class="row-actions">
1731
+ <?php if ( ( $this->current_user_can( 'edit_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls' ) ) ){ ?>
1732
  <span class="edit"><a
1733
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
1734
  | </span>
1735
  <?php } ?>
1736
+ <?php if ( ( $this->current_user_can( 'view_own_polls_logs' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'view_polls_logs' ) ) ){ ?>
1737
  <span class="edit"><a
1738
  href="<?php echo esc_url( add_query_arg( array( 'page' => 'yop-polls-logs', 'poll_id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Logs', 'yop_poll' ) ?></a>
1739
  | </span>
1740
  <?php } ?>
1741
+ <?php if ( ( $this->current_user_can( 'delete_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls' ) ) ){ ?>
1742
  <span class="delete"><a
1743
+ 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;"
1744
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete' ); ?>"
1745
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a>
1746
  | </span>
1747
  <?php } ?>
1748
+ <?php if ( ( $this->current_user_can( 'clone_own_polls' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'clone_polls' ) ) ){ ?>
1749
  <span class="clone"><a
1750
+ 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;"
1751
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $yop_poll['id'] ) ), 'yop-poll-clone' ); ?>"
1752
  class="submitclone"><?php _e( 'Clone', 'yop_poll' ) ?></a> |
1753
  </span>
1754
  <?php } ?>
1755
+ <?php if ( ( $this->current_user_can( 'view_own_polls_results' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'view_polls_results' ) ) ){ ?>
1756
  <span class="results"><a
1757
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'results', 'id' => $yop_poll['id'] ) ) ); ?>"><?php _e( 'Results', 'yop_poll' ) ?></a>
1758
  | </span>
1759
  <?php } ?>
1760
+ <?php if ( ( $this->current_user_can( 'reset_own_polls_stats' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'reset_polls_stats' ) ) ){ ?>
1761
  <span class="delete"><a
1762
+ 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;"
1763
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'reset_votes', 'id' => $yop_poll['id'] ) ), 'yop-poll-reset-votes' ); ?>"
1764
  class="submitresetvotes"><?php _e( 'Reset Stats', 'yop_poll' ) ?></a>
1765
  | </span>
1766
  <?php } ?>
1767
+ <?php if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $yop_poll['poll_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){ ?>
1768
  <span class="delete"><a
1769
+ 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;"
1770
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_logs', 'id' => $yop_poll['id'] ) ), 'yop-poll-delete-logs' ); ?>"
1771
  class="submitresetvotes"><?php _e( 'Delete Logs', 'yop_poll' ) ?></a></span>
1772
  <?php } ?>
1782
  </td>
1783
  <td>
1784
  <?php
1785
+ $user_info = get_userdata( $yop_poll ['poll_author'] );
1786
+ if ( $user_info ){
1787
+ echo esc_html( stripslashes( $user_info->user_login ) );
1788
+ }
1789
+ else {
1790
  echo '';
1791
+ }
1792
  ?>
1793
  </td>
1794
  <td>
1796
  </td>
1797
  <td>
1798
  <?php
1799
+ if ( YOP_POLL_MODEL::get_mysql_curent_date() > $yop_poll ['end_date'] ){
1800
  echo '<font style="color:#CC0000;"><b>';
1801
+ }
1802
+ echo ( '9999-12-31 23:59:59' == $yop_poll ['end_date'] ) ? __( 'No end date', 'yop_poll' ) : esc_html( stripslashes( $yop_poll ['end_date'] ) );
1803
+ if ( YOP_POLL_MODEL::get_mysql_curent_date() > $yop_poll ['end_date'] ){
1804
+ echo '</b></font>';
1805
+ }?>
1806
  </td>
1807
  </tr>
1808
  </tbody>
1809
  <?php
1810
  }
1811
+ }
1812
+ else {
1813
  ?>
1814
  <tbody id="the-list">
1815
  <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
1816
+ <th colspan="8">
1817
  <?php _e( 'No poll found!', 'yop_poll' ); ?>
1818
  </th>
1819
  </tr>
1826
  <tr>
1827
  <th id="cb" class="manage-column column-cb check-column"
1828
  style="" scope="col"><input type="checkbox"></th>
 
 
 
 
 
 
 
1829
  <th id="name"
1830
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
1831
  style="" scope="col"><a
1832
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
1833
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
1834
  class="sorting-indicator"></span>
1835
  </a></th>
1836
  <th id="total_votes"
1837
+ class="manage-column <?php echo $order_sortable['total_votes'] ?> <?php echo $order_direction_reverse['total_votes'] ?>"
1838
  style="" scope="col"><a
1839
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_votes', 'order' => $order_direction['total_votes'] ) ) ); ?>">
1840
  <span><?php _e( 'Total Votes', 'yop_poll' ); ?></span> <span
1841
  class="sorting-indicator"></span>
1842
  </a></th>
1843
  <th id="total_answers"
1844
+ class="manage-column <?php echo $order_sortable['total_answers'] ?> <?php echo $order_direction_reverse['total_answers'] ?>"
1845
  style="" scope="col"><a
1846
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'total_answers', 'order' => $order_direction['total_answers'] ) ) ); ?>">
1847
  <span><?php _e( 'Total Answers', 'yop_poll' ); ?></span> <span
1848
  class="sorting-indicator"></span>
1849
  </a></th>
1850
  <th id="question"
1851
+ class="manage-column <?php echo $order_sortable['question'] ?> <?php echo $order_direction_reverse['question'] ?>"
1852
  style="" scope="col"><a
1853
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'question', 'order' => $order_direction['question'] ) ) ); ?>">
1854
  <span><?php _e( 'Question', 'yop_poll' ); ?></span> <span
1855
  class="sorting-indicator"></span>
1856
  </a></th>
1857
  <th id="poll_author" class="manage-column" style="width: 5%"
1858
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
1859
  <th id="start-date"
1860
+ class="manage-column <?php echo $order_sortable['start_date'] ?> <?php echo $order_direction_reverse['start_date'] ?>"
1861
  style="" scope="col"><a
1862
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'start_date', 'order' => $order_direction['start_date'] ) ) ); ?>">
1863
  <span><?php _e( 'Start Date', 'yop_poll' ); ?></span> <span
1864
  class="sorting-indicator"></span>
1865
  </a></th>
1866
  <th id="end-date"
1867
+ class="manage-column <?php echo $order_sortable['end_date'] ?> <?php echo $order_direction_reverse['end_date'] ?>"
1868
  style="" scope="col"><a
1869
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'end_date', 'order' => $order_direction['end_date'] ) ) ); ?>">
1870
  <span><?php _e( 'End Date', 'yop_poll' ); ?></span> <span
1871
  class="sorting-indicator"></span>
1872
  </a></th>
1882
  </div>
1883
  <?php
1884
  }
1885
+
1886
  public function view_poll_results() {
1887
  global $page, $action, $current_user;
1888
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
1889
+ $results_order_by = ( isset ( $_GET ['results_order_by'] ) ? $_GET ['results_order_by'] : 'id' );
1890
+ $results_order = ( isset ( $_GET ['results_order'] ) ? $_GET ['results_order'] : 'ASC' );
1891
+ $soav = ( isset ( $_GET ['soav'] ) ? $_GET ['soav'] : 'no' );
1892
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
1893
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
1894
+ if ( ( !$this->current_user_can( 'view_own_polls_results' ) || $poll_author != $current_user->ID ) && ( !$this->current_user_can( 'view_polls_results' ) ) ){
1895
+ wp_die( __( 'You are not allowed to view results for this item.', 'yop_poll' ) );
1896
+ }
1897
+ $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
1898
+ if ( 'yes' == $soav ){
1899
+ $display_other_answers_values = true;
1900
+ }
1901
+ else {
1902
+ $display_other_answers_values = false;
1903
+ }
1904
+ $poll_answers = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'default', 'other' ), $results_order_by, $results_order, $display_other_answers_values );
1905
+ $poll_other_answer = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'other' ) );
 
 
1906
 
1907
  // other-answers
1908
+ $oa_per_page = ( isset ( $_GET ['oa_per_page'] ) ? intval( $_GET ['oa_per_page'] ) : 100 );
1909
+ $oa_page_no = ( isset ( $_REQUEST ['oa_page_no'] ) ? ( int )$_REQUEST ['oa_page_no'] : 1 );
1910
+ $total_logs_other_answers = count( YOP_POLL_MODEL::get_other_answers_votes( isset ( $poll_other_answer [0] ['id'] ) ? $poll_other_answer [0] ['id'] : 0 ) );
1911
+ $total_logs_other_answers_pages = ceil( $total_logs_other_answers / $oa_per_page );
1912
+ if ( intval( $oa_page_no ) > intval( $total_logs_other_answers_pages ) ){
1913
  $oa_page_no = 1;
1914
+ }
1915
+ $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 );
1916
+
1917
+ $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;' ) );
1918
+ $oa_pagination = paginate_links( $oa_args );
 
 
 
 
 
 
 
1919
  // other-answers
1920
 
1921
  // custom-fields
1922
+ $cf_per_page = ( isset ( $_GET ['cf_per_page'] ) ? intval( $_GET ['cf_per_page'] ) : 100 );
1923
+ $cf_page_no = ( isset ( $_REQUEST ['cf_page_no'] ) ? ( int )$_REQUEST ['cf_page_no'] : 1 );
1924
+ $cf_sdate = ( isset ( $_GET ['cf_sdate'] ) ? $_GET ['cf_sdate'] : '' );
1925
+ $cf_edate = ( isset ( $_GET ['cf_edate'] ) ? $_GET ['cf_edate'] : '' );
1926
+ $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
1927
+ $custom_fields_number = count( $poll_custom_fields );
1928
+ $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $cf_sdate, $cf_edate );
1929
+ $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $cf_per_page );
1930
+ if ( intval( $cf_page_no ) > intval( $total_custom_fields_logs_pages ) ){
1931
  $cf_page_no = 1;
1932
+ }
1933
+ $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 );
1934
+
1935
+ $column_custom_fields_ids = array();
1936
+ $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;' ) );
1937
+ $cf_pagination = paginate_links( $cf_args );
 
 
 
 
 
 
 
1938
  // custom-fields
1939
  ?>
1940
  <div class="wrap">
1943
 
1944
  </div>
1945
  <h2><?php _e( 'Yop Poll Results', 'yop_poll' ); ?><a class="add-new-h2"
1946
+ 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>
1947
  </h2>
1948
  <?php
1949
+ if ( $poll_details ){
1950
  ?>
1951
+ <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) ) ?></h3>
1952
+ <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) ) ?></h4>
1953
  <form method="get">
1954
+ <input type="hidden" name="page" value="yop-polls"/>
1955
+ <input type="hidden" name="action" value="results"/>
1956
+ <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
1957
  <input type="hidden" name="oa_page_no"
1958
+ value="<?php echo $oa_page_no; ?>"/>
1959
  <input type="hidden" name="cf_page_no"
1960
+ value="<?php echo $cf_page_no; ?>"/>
1961
  <input type="hidden" name="oa_per_page"
1962
+ value="<?php echo $oa_per_page; ?>"/>
1963
 
1964
  <div class="tablenav top">
1965
  <div class="alignleft actions">
1966
  <div style="display:inline; float:left; margin:7px;"><?php _e( 'Order By', 'yop_poll' ); ?></div>
1967
  <select name="results_order_by">
1968
+ <option <?php selected( $results_order_by, 'id' ) ?> value="id"><?php _e( 'Answer ID', 'yop_poll' ); ?></option>
1969
+ <option <?php selected( $results_order_by, 'answer' ) ?> value="answer"><?php _e( 'Answer Value', 'yop_poll' ); ?></option>
1970
+ <option <?php selected( $results_order_by, 'votes' ) ?> value="votes"><?php _e( 'Votes', 'yop_poll' ); ?></option>
1971
  </select>
1972
  <select name="results_order">
1973
+ <option <?php selected( $results_order, 'ASC' ) ?> value="ASC"><?php _e( 'ASC', 'yop_poll' ); ?></option>
1974
+ <option <?php selected( $results_order, 'DESC' ) ?> value="DESC"><?php _e( 'DESC', 'yop_poll' ); ?></option>
1975
+ </select>
1976
  &nbsp;| &nbsp;
1977
+ <input type="checkbox" value="yes" <?php checked( $soav, 'yes' ); ?> name="soav" id="yop-poll-show_other_answers_values"/>
1978
  <label for="yop-poll-show_other_answers_values"><?php _e( 'Show Other Answers Values', 'yop_poll' ); ?></label>
1979
  <input type="submit"
1980
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
1981
+ class="button-secondary action" id="doaction" name="a">
1982
  </div>
1983
  <br class="clear">
1984
  </div>
1994
  </thead>
1995
  <tbody>
1996
  <?php
1997
+ if ( count( $poll_answers ) > 0 ){
1998
  foreach ( $poll_answers as $answer ) {
1999
  ?>
2000
  <tr>
2006
  </tr>
2007
  <?php
2008
  }
2009
+ }
2010
+ else {
2011
  ?>
2012
  <tr>
2013
  <th colspan="4"><?php _e( 'No answers defined!', 'yop_poll' ); ?></th>
2021
  <div style="width: 30%; float: left;">
2022
  <h3><?php _e( 'Poll Other Answers', 'yop_poll' ); ?></h3>
2023
  <form method="get">
2024
+ <input type="hidden" name="page" value="yop-polls"/>
2025
+ <input type="hidden" name="action" value="results"/>
2026
+ <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2027
  <input type="hidden" name="cf_page_no"
2028
+ value="<?php echo $cf_page_no; ?>"/>
2029
  <input type="hidden" name="oa_page_no"
2030
+ value="<?php echo $oa_page_no; ?>"/>
2031
  <input type="hidden" name="cf_per_page"
2032
+ value="<?php echo $cf_per_page; ?>"/>
2033
+ <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>"/>
2034
+ <input type="hidden" name="results_order" value="<?php echo $results_order; ?>"/>
2035
+ <input type="hidden" name="soav" value="<?php echo $soav; ?>"/>
2036
  <div class="tablenav top">
2037
  <div class="tablenav-pages one-page">
2038
+ <label for="yop-poll-oa-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2039
+ :</label><input
2040
  id="yop-poll-oa-items-per-page" type="text" name="oa_per_page"
2041
+ value="<?php echo $oa_per_page; ?>"/> <input name="a"
2042
+ value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2043
+ class="displaying-num"><?php echo count( $logs_other_answers ); ?>
2044
+ / <?php echo $total_logs_other_answers; ?> items</span>
2045
  <?php print $oa_pagination; ?>
2046
  </div>
2047
  <br class="clear">
2055
  </thead>
2056
  <tbody>
2057
  <?php
2058
+ if ( count( $logs_other_answers ) > 0 ){
2059
  foreach ( $logs_other_answers as $answer ) {
2060
  ?>
2061
  <tr>
2064
  </tr>
2065
  <?php
2066
  }
2067
+ }
2068
+ else {
2069
  ?>
2070
  <tr>
2071
  <td colspan="2"><?php _e( 'No other answers defined!', 'yop_poll' ); ?></td>
2087
  <h3><?php _e( 'Custom Fields', 'yop_poll' ); ?></h3>
2088
  <form method="get">
2089
  <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2090
+ <input type="hidden" name="page" value="yop-polls"/>
2091
+ <input type="hidden" name="action" value="results"/>
2092
+ <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2093
  <input type="hidden" name="oa_page_no"
2094
+ value="<?php echo $oa_page_no; ?>"/>
2095
  <input type="hidden" name="cf_page_no"
2096
+ value="<?php echo $cf_page_no; ?>"/>
2097
  <input type="hidden" name="oa_per_page"
2098
+ value="<?php echo $oa_per_page; ?>"/>
2099
+ <input type="hidden" name="results_order_by" value="<?php echo $results_order_by; ?>"/>
2100
+ <input type="hidden" name="results_order" value="<?php echo $results_order; ?>"/>
2101
+ <input type="hidden" name="soav" value="<?php echo $soav; ?>"/>
2102
 
2103
  <div class="tablenav top">
2104
  <div class="alignleft actions">
2109
  value="<?php _e( 'Export', 'yop_poll' ); ?>"
2110
  class="button-secondary action" id="doaction" name="a">
2111
  &nbsp;&nbsp;&nbsp; <label
2112
+ for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2113
+ :</label>
2114
  <input id="yop-poll-custom-field-start-date-input" type="text"
2115
+ name="cf_sdate" value="<?php echo $cf_sdate; ?>"/>&nbsp;&nbsp; <label
2116
+ for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>
2117
+ :</label>
2118
  <input id="yop-poll-custom-field-end-date-input" type="text"
2119
+ name="cf_edate" value="<?php echo $cf_edate; ?>"/>&nbsp;&nbsp; <input
2120
  value="<?php _e( 'Filter', 'yop_poll' ); ?>" type="submit"
2121
+ name="a"/>
2122
  </div>
2123
  <div class="tablenav-pages one-page">
2124
+ <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2125
+ :</label><input
2126
  id="yop-poll-items-per-page" type="text" name="cf_per_page"
2127
+ value="<?php echo $cf_per_page; ?>"/> <input name="a"
2128
+ value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2129
+ class="displaying-num"><?php echo count( $custom_fields_logs ); ?>
2130
+ / <?php echo $total_custom_fields_logs; ?> items</span>
2131
  <?php print $cf_pagination; ?>
2132
  </div>
2133
  <br class="clear">
2140
  foreach ( $poll_custom_fields as $custom_field ) {
2141
  $column_custom_fields_ids [] = $custom_field ['id'];
2142
  ?>
2143
+ <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>
2144
  <?php
2145
  }
2146
  ?>
2154
  </thead>
2155
  <tbody>
2156
  <?php
2157
+ if ( count( $custom_fields_logs ) > 0 ){
2158
+ $index = ( $cf_page_no - 1 ) * $cf_per_page + 1;
2159
  foreach ( $custom_fields_logs as $logs ) {
2160
  ?>
2161
  <tr>
2162
  <td><?php echo $index; ?></td>
2163
  <?php
2164
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
2165
+ $vote_log_values = array();
2166
+ $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
2167
+ if ( count( $vote_logs ) > 0 ){
2168
  foreach ( $vote_logs as $vote_log ) {
2169
+ $temp = explode( '<#!->', $vote_log );
2170
+ $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
2171
  }
2172
  }
2173
  ?>
2174
+ <td><?php echo isset( $vote_log_values[$custom_field_id] ) ? $vote_log_values[$custom_field_id] : ''; ?></td>
2175
  <?php
2176
  }
2177
  ?>
2180
  <td><?php echo $logs['vote_date']; ?></td>
2181
  </tr>
2182
  <?php
2183
+ $index++;
2184
  }
2185
  }
2186
  ?>
2197
  <div style="clear: both;"></div>
2198
  </div>
2199
  <?php
2200
+ }
2201
+ else {
2202
  ?>
2203
+ <h3><?php _e( 'Your poll doesn`t exist!', 'yop_poll' ); ?></h3>
2204
  <?php
2205
  }
2206
  }
2207
+
2208
  public function view_poll_custom_fields() {
2209
  global $page, $action;
2210
+ $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
2211
+ $page_no = ( isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1 );
2212
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
2213
+ $sdate = ( isset ( $_GET ['sdate'] ) ? $_GET ['sdate'] : '' );
2214
+ $edate = ( isset ( $_GET ['edate'] ) ? $_GET ['edate'] : '' );
2215
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2216
+ $poll_details = YOP_POLL_MODEL::get_poll_from_database_by_id( $poll_id );
2217
+ $poll_custom_fields = YOP_POLL_MODEL::get_poll_customfields( $poll_id );
2218
+ $custom_fields_number = count( $poll_custom_fields );
2219
+ $total_custom_fields_logs = YOP_POLL_MODEL::get_poll_total_customfields_logs( $poll_id, $sdate, $edate );
2220
+ $total_custom_fields_logs_pages = ceil( $total_custom_fields_logs / $per_page );
2221
+ if ( intval( $page_no ) > intval( $total_custom_fields_logs_pages ) ){
2222
  $page_no = 1;
2223
+ }
2224
+ $custom_fields_logs = YOP_POLL_MODEL::get_poll_customfields_logs( $poll_id, 'vote_id', 'asc', ( $page_no - 1 ) * $per_page, $per_page, $sdate, $edate );
2225
+
2226
+ $column_custom_fields_ids = array();
2227
+ $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;' ) );
2228
+ $pagination = paginate_links( $args );
2229
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
 
 
 
 
 
 
 
 
 
2230
  ?>
2231
  <div class="wrap">
2232
  <div class="icon32 icon32-yop-poll">
2234
 
2235
  </div>
2236
  <h2><?php _e( 'Custom Fields', 'yop_poll' ); ?><a class="add-new-h2"
2237
+ 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>
2238
  </h2>
2239
  <?php
2240
+ if ( $poll_details ){
2241
+ if ( $poll_custom_fields ){
2242
  ?>
2243
+ <h3>Name: <?php echo esc_html( stripslashes( $poll_details['name'] ) ) ?></h3>
2244
+ <h4>Question: <?php echo esc_html( stripslashes( $poll_details['question'] ) ) ?></h4>
2245
  <form method="get">
2246
  <?php wp_nonce_field( 'yop-poll-custom-fields' ); ?>
2247
+ <input type="hidden" name="page" value="yop-polls"/>
2248
+ <input type="hidden" name="action" value="custom-fields"/>
2249
+ <input type="hidden" name="id" value="<?php echo $poll_id; ?>"/>
2250
+ <input type="hidden" name="page_no" value="<?php echo $page_no; ?>"/>
2251
  <table cellspacing="5" align=" center">
2252
  <tbody>
2253
  <tr>
2254
+ <th><label for="yop-poll-custom-field-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2255
+ :</label>
2256
  </th>
2257
  <td><input id="yop-poll-custom-field-start-date-input" type="text"
2258
+ name="sdate" value="<?php echo $sdate; ?>"/></td>
2259
  </tr>
2260
  <tr>
2261
+ <th><label for="yop-poll-custom-field-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>
2262
+ :</label>
2263
  </th>
2264
  <td><input id="yop-poll-custom-field-end-date-input" type="text"
2265
+ name="edate" value="<?php echo $edate; ?>"/></td>
2266
  </tr>
2267
  <tr>
2268
  <th colspan="2"><input value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2269
+ type="submit" name="a"/></th>
2270
  </tr>
2271
  </tbody>
2272
  </table>
2281
  class="button-secondary action" id="doaction" name="a">
2282
  </div>
2283
  <div class="tablenav-pages one-page">
2284
+ <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2285
+ :</label><input
2286
  id="yop-poll-items-per-page" type="text" name="per_page"
2287
+ value="<?php echo $per_page; ?>"/> <input name="a"
2288
+ value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;<span
2289
+ class="displaying-num"><?php echo count( $custom_fields_logs ); ?>
2290
+ / <?php echo $total_custom_fields_logs; ?> items</span>
2291
  <?php print $pagination; ?>
2292
  </div>
2293
  <br class="clear">
2300
  foreach ( $poll_custom_fields as $custom_field ) {
2301
  $column_custom_fields_ids [] = $custom_field ['id'];
2302
  ?>
2303
+ <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>
2304
  <?php
2305
  }
2306
  ?>
2310
  </thead>
2311
  <tbody>
2312
  <?php
2313
+ if ( count( $custom_fields_logs ) > 0 ){
2314
+ $index = ( $page_no - 1 ) * $per_page + 1;
2315
  foreach ( $custom_fields_logs as $logs ) {
2316
  ?>
2317
  <tr>
2318
  <td><?php echo $index; ?></td>
2319
  <?php
2320
  foreach ( $column_custom_fields_ids as $custom_field_id ) {
2321
+ $vote_log_values = array();
2322
+ $vote_logs = explode( '<#!,>', $logs ['vote_log'] );
2323
+ if ( count( $vote_logs ) > 0 ){
2324
  foreach ( $vote_logs as $vote_log ) {
2325
+ $temp = explode( '<#!->', $vote_log );
2326
+ $vote_log_values [$temp [1]] = stripslashes( $temp [0] );
2327
  }
2328
  }
2329
  ?>
2330
+ <td><?php echo isset( $vote_log_values[$custom_field_id] ) ? $vote_log_values[$custom_field_id] : ''; ?></td>
2331
  <?php
2332
  }
2333
  ?>
2334
  <td><?php echo $logs['vote_date']; ?></td>
2335
  </tr>
2336
  <?php
2337
+ $index++;
2338
  }
2339
  }
2340
  ?>
2349
  </form>
2350
  </div>
2351
  <?php
2352
+ }
2353
+ else {
2354
  ?>
2355
+ <h3><?php _e( 'This poll doesn\'t have set custom fields!', 'yop_poll' ); ?></h3>
2356
  <?php
2357
  }
2358
+ }
2359
+ else {
2360
  ?>
2361
+ <h3><?php _e( 'Your Poll doesn`t exist!', 'yop_poll' ); ?></h3>
2362
  <?php
2363
  }
2364
  }
2365
+
2366
  public function view_yop_poll_templates() {
2367
  global $page, $action, $orderby, $order, $current_user;
2368
+ $orderby = ( empty ( $orderby ) ) ? 'last_modified' : $orderby;
2369
+ $order = ( empty ( $order ) ) ? 'desc' : $order;
2370
+ $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'last_modified' => 'desc' );
2371
+ $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
 
 
 
 
2372
 
2373
+ $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'last_modified' => 'desc' );
2374
+ $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
 
 
 
 
2375
 
2376
+ $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'last_modified' => 'sortable' );
 
 
 
 
2377
  $order_sortable [$orderby] = 'sorted';
2378
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2379
+ $search = array( 'fields' => array( 'name', 'last_modified' ), 'value' => isset ( $_REQUEST ['s'] ) ? $_REQUEST ['s'] : '' );
2380
+ $yop_poll_templates = Yop_Poll_Model::get_yop_poll_templates_search( $orderby, $order, $search );
 
 
 
 
 
 
2381
  ?>
2382
  <div class="wrap">
2383
  <div class="icon32 icon32-yop-poll">
2389
  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>
2390
  </h2>
2391
  <?php
2392
+ if ( isset ( $_REQUEST ['deleted'] ) ){
2393
  echo '<div id="message" class="updated"><p>';
2394
+ $deleted = ( int )$_REQUEST ['deleted'];
2395
+ printf( _n( '%s Poll template deleted.', '%s Poll templates deleted.', $deleted ), $deleted );
2396
  echo '</p></div>';
2397
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
 
 
2398
  }
2399
  ?>
2400
  <?php
2401
+ if ( isset ( $_REQUEST ['cloned'] ) ){
2402
  echo '<div id="message" class="updated"><p>';
2403
+ $cloned = ( int )$_REQUEST ['cloned'];
2404
+ printf( _n( '%s Poll template cloned.', '%s Poll templates cloned.', $cloned ), $cloned );
2405
  echo '</p></div>';
2406
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'cloned' ), $_SERVER ['REQUEST_URI'] );
 
 
2407
  }
2408
  ?>
2409
  <form action="" method="get">
2410
  <?php wp_nonce_field( 'yop-poll-templates' ); ?>
2411
+ <input type="hidden" name="order" value="<?php echo $order ?>"/>
2412
+ <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
2413
+ <input type="hidden" name="page" value="yop-polls-templates"/>
2414
  <p class="search-box">
2415
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Polls', 'yop_poll' ) ?></label>
2416
  <input id="yop-poll-search-input" type="search"
2417
+ value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
2418
+ name="s"/> <input id="search-submit" class="button" type="submit"
2419
+ value="<?php _e( 'Search Polls', 'yop_poll' ); ?>" name=""/>
2420
  </p>
2421
  <div class="tablenav top">
2422
  <div class="alignleft actions">
2436
  <th id="cb" class="manage-column column-cb check-column"
2437
  scope="col" style="width: 2%;"><input type="checkbox"></th>
2438
  <th id="id"
2439
+ class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
2440
  style="width: 10%;" scope="col"><a
2441
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
2442
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2443
  class="sorting-indicator"></span>
2444
  </a></th>
2445
  <th id="name"
2446
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2447
  style="width: 38%;" scope="col"><a
2448
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2449
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2450
  class="sorting-indicator"></span>
2451
  </a></th>
2452
  <th id="template_author" class="manage-column" style="width: 10%;"
2453
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2454
  <th id="last_modified"
2455
+ class="manage-column <?php echo $order_sortable['last_modified'] ?> <?php echo $order_direction_reverse['last_modified'] ?>"
2456
  style="width: 40%;" scope="col"><a
2457
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction['last_modified'] ) ) ); ?>">
2458
  <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2459
  class="sorting-indicator"></span>
2460
  </a></th>
2461
  </tr>
2462
  </thead>
2463
  <?php
2464
+ if ( count( $yop_poll_templates ) > 0 ){
2465
  foreach ( $yop_poll_templates as $template ) {
2466
  ?>
2467
  <tbody id="the-list">
2468
  <tr valign="middle" class="alternate"
2469
  id="yop-poll-<?php echo $template['id']; ?>">
2470
  <th class="check-column" scope="row">
2471
+ <?php if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){ ?>
2472
  <input type="checkbox" value="<?php echo $template['id']; ?>"
2473
  name="templatecheck[]">
2474
  <?php } ?>
2475
  </th>
2476
  <td><strong>
2477
+ <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2478
  <a title="<?php echo $template['id']; ?>"
2479
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2480
  class="row-title">
2481
  <?php } ?>
2482
  <?php echo $template['id']; ?>
2483
+ <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2484
  </a>
2485
  <?php } ?>
2486
  </strong><br>
2487
  <div class="row-actions">
2488
+ <?php if ( ( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) ) ){ ?>
2489
  <span class="edit"><a
2490
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"><?php _e( 'Edit', 'yop_poll' ) ?></a>
2491
  | </span>
2492
  <?php } ?>
2493
+ <?php if ( ( $this->current_user_can( 'delete_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_templates' ) ) ){ ?>
2494
  <span class="delete"><a
2495
+ 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;"
2496
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2497
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a> | </span>
2498
  <?php } ?>
2499
+ <?php if ( ( $this->current_user_can( 'clone_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'clone_polls_templates' ) ) ){ ?>
2500
  <span class="clone"><a
2501
+ 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;"
2502
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'clone', 'id' => $template['id'] ) ), 'yop-poll-templates' ); ?>"
2503
  class="submitdelete"><?php _e( 'Clone', 'yop_poll' ) ?></a></span>
2504
  <?php } ?>
2505
  </div></td>
2506
  <td><strong>
2507
+ <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2508
  <a
2509
  title="<?php echo esc_html( stripslashes( $template['name'] ) ); ?>"
2510
  href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'id' => $template['id'] ) ) ); ?>"
2511
  class="row-title">
2512
  <?php } ?>
2513
  <?php echo esc_html( stripslashes( $template['name'] ) ); ?>
2514
+ <?php if (( $this->current_user_can( 'edit_own_polls_templates' ) && $template['template_author'] == $current_user->ID ) || ( $this->current_user_can( 'edit_polls_templates' ) )) { ?>
2515
  </a>
2516
  <?php } ?>
2517
  </strong><br></td>
2518
  <td>
2519
  <?php
2520
+ $user_info = get_userdata( $template ['template_author'] );
2521
+ if ( $user_info ){
2522
+ echo esc_html( stripslashes( $user_info->user_login ) );
2523
+ }
2524
+ else {
2525
  echo '';
2526
+ }
2527
  ?>
2528
  </td>
2529
  <td>
2533
  </tbody>
2534
  <?php
2535
  }
2536
+ }
2537
+ else {
2538
  ?>
2539
  <tbody id="the-list">
2540
  <tr valign="middle" class="alternate" id="yop-poll-<?php ?>">
2541
  <td id="empty-set" colspan="5">
2542
+ <h3 style="margin-bottom: 0px;"><?php _e( " You haven't used our template editor to create any yop poll templates!", 'yop_poll' ); ?> </h3>
2543
  <p style="margin-bottom: 20px;"><?php _e( "Please create your poll template first.", 'yop_poll' ); ?></p>
2544
  <a class="button-primary"
2545
  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>
2546
+ <br/> <br/>
2547
  </td>
2548
  </tr>
2549
  </tbody>
2556
  <th id="cb" class="manage-column column-cb check-column" style=""
2557
  scope="col"><input type="checkbox"></th>
2558
  <th id="id"
2559
+ class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
2560
  style="" scope="col"><a
2561
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
2562
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
2563
  class="sorting-indicator"></span>
2564
  </a></th>
2565
  <th id="name"
2566
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2567
  style="" scope="col"><a
2568
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2569
  <span><?php _e( 'Name', 'yop_poll' ); ?></span> <span
2570
  class="sorting-indicator"></span>
2571
  </a></th>
2572
  <th id="template_author" class="manage-column" style="width: 10%;"
2573
  scope="col"><span><?php _e( 'Author', 'yop_poll' ); ?></span></th>
2574
  <th id="question"
2575
+ class="manage-column <?php echo $order_sortable['last_modified'] ?> <?php echo $order_direction_reverse['last_modified'] ?>"
2576
  style="" scope="col"><a
2577
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'last_modified', 'order' => $order_direction['last_modified'] ) ) ); ?>">
2578
  <span><?php _e( 'Last Modified', 'yop_poll' ); ?></span> <span
2579
  class="sorting-indicator"></span>
2580
  </a></th>
2585
  </div>
2586
  <?php
2587
  }
2588
+
2589
  public function view_yop_poll_logs() {
2590
  global $wpdb, $page, $action, $orderby, $order, $current_user;
2591
+ $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
2592
+ $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
2593
+ $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
2594
+ $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' );
2595
+ $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
2596
+
2597
+ $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' );
2598
+ $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
2599
+
2600
+ $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' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2601
  $order_sortable [$orderby] = 'sorted';
2602
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
2603
+
2604
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
2605
+
2606
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2607
+ if ( $this->current_user_can( 'view_own_polls_logs' ) && $poll_id ){
2608
+ if ( $poll_author != $current_user->ID && !$this->current_user_can( 'view_polls_logs' ) ){
2609
+ wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
2610
+ }
2611
+ }
2612
+ elseif ( !$this->current_user_can( 'view_polls_logs' ) ) {
2613
+ wp_die( __( 'You are not allowed to access this section.', 'yop_poll' ) );
2614
+ }
2615
+ $log_sdate = ( isset ( $_GET ['log_sdate'] ) ? $_GET ['log_sdate'] : '' );
2616
+ $log_edate = ( isset ( $_GET ['log_edate'] ) ? $_GET ['log_edate'] : '' );
2617
+ $group_by = ( isset ( $_GET ['group_by'] ) ? $_GET ['group_by'] : 'vote' );
2618
+
2619
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
2620
+ if ( $group_by == 'vote' ){
2621
+ $search = array( 'fields' => array( 'name', 'ip', 'user_nicename', 'user_email', 'user_from', 'tr_id' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
2622
+ }
2623
+ else {
2624
+ $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'] ) : '' );
2625
+ }
2626
+ $filter = array( 'field' => NULL, 'value' => NULL, 'operator' => '=' );
2627
+ if ( $group_by == 'vote' ){
2628
+ $total_logs = Yop_Poll_Model::get_total_group_logs_filter_search( $search, $poll_id, $log_sdate, $log_edate );
2629
+ }
2630
+ else {
2631
+ $total_logs = Yop_Poll_Model::get_total_logs_filter_search( $search, $poll_id, $log_sdate, $log_edate );
2632
+ }
2633
+ $total_logs_pages = ceil( $total_logs / $per_page );
2634
+ if ( intval( $page_no ) > intval( $total_logs_pages ) ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2635
  $page_no = 1;
2636
+ }
2637
+ if ( $group_by == 'vote' ){
2638
+ $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 );
2639
+ }
2640
+ else {
2641
+ $logs = Yop_Poll_Model::get_logs_filter_search( $orderby, $order, $search, $poll_id, ( $page_no - 1 ) * $per_page, $per_page, $log_sdate, $log_edate );
2642
+ }
2643
+
2644
+ $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;' ) );
2645
+ $pagination = paginate_links( $args );
2646
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
 
 
 
 
 
 
 
2647
  ?>
2648
  <div class="wrap">
2649
  <div class="icon32 icon32-yop-poll">
2652
  </div>
2653
  <h2><?php _e( 'Yop Poll Logs', 'yop_poll' ); ?></h2>
2654
  <?php
2655
+ if ( isset ( $_REQUEST ['deleted'] ) ){
2656
  echo '<div id="message" class="updated"><p>';
2657
+ $deleted = ( int )$_REQUEST ['deleted'];
2658
+ printf( _n( '%s Poll Log deleted.', '%s Poll Logs deleted.', $deleted ), $deleted );
2659
  echo '</p></div>';
2660
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
 
 
2661
  }
2662
  ?>
2663
  <form method="get">
2664
  <?php wp_nonce_field( 'yop-poll-logs' ); ?>
2665
+ <input type="hidden" name="order" value="<?php echo $order ?>"/>
2666
+ <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
2667
+ <input type="hidden" name="page" value="yop-polls-logs"/>
2668
  <p class="search-box">
2669
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Logs', 'yop_poll' ) ?></label>
2670
  <input id="yop-poll-search-input" type="search"
2671
+ value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
2672
+ name="s"/> <input id="search-submit" class="button" type="submit"
2673
+ value="<?php _e( 'Search Poll Logs', 'yop_poll' ); ?>" name=""/>
2674
  </p>
2675
  <div class="tablenav top">
2676
  <div class="alignleft actions">
2680
  <option <?php echo selected( $group_by, 'vote' ); ?> value="vote"><?php _e( 'Group Logs By Vote', 'yop_poll' ); ?></option>
2681
  </select> <input type="submit"
2682
  value="<?php _e( 'Group', 'yop_poll' ); ?>"
2683
+ class="button-secondary action" id="doaction" name=""/>
2684
  </div>
2685
  </div>
2686
  <div class="tablenav top">
2687
  <div class="alignleft actions">
2688
  <select name="action">
2689
  <option selected="selected" value="-1"><?php _e( 'Bulk Actions', 'yop_poll' ); ?></option>
2690
+ <?php if ( $group_by == 'vote' ){ ?>
2691
  <option value="delete_group"><?php _e( 'Delete', 'yop_poll' ); ?></option>
2692
  <?php
2693
 
2694
+ }
2695
+ else {
2696
  ?>
2697
  <option value="delete"><?php _e( 'Delete', 'yop_poll' ); ?></option>
2698
  <?php } ?>
2704
  <select name="poll_id">
2705
  <option value=""><?php _e( 'All Logs', 'yop_poll' ); ?></option>
2706
  <?php
2707
+ if ( count( $yop_polls ) > 0 ){
2708
  foreach ( $yop_polls as $yop_poll ) {
2709
  ?>
2710
  <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
2713
  }
2714
  }
2715
  ?>
2716
+ </select> <label for="yop-poll-logs-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
2717
+ :</label>
2718
  <input id="yop-poll-logs-start-date-input" type="text"
2719
+ name="log_sdate" value="<?php echo $log_sdate; ?>"/>&nbsp;&nbsp; <label
2720
  for="yop-poll-logs-end-date-input"><?php _e( 'End Date', 'yop_poll' ); ?>:</label>
2721
  <input id="yop-poll-logs-end-date-input" type="text"
2722
+ name="log_edate" value="<?php echo $log_edate; ?>"/>&nbsp;&nbsp; <input
2723
  type="submit" value="<?php _e( 'Filter', 'yop_poll' ); ?>"
2724
  class="button-secondary" id="post-query-submit" name="">&nbsp;|&nbsp;
2725
  </div>
2734
 
2735
  </div>
2736
  <div class="tablenav-pages one-page">
2737
+ <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
2738
+ :</label>
2739
  <input id="yop-poll-items-per-page" type="text" name="per_page"
2740
+ value="<?php echo $per_page; ?>"/> <input name="a"
2741
+ value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;
2742
+ <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?>
2743
+ logs</span>
2744
  <?php print $pagination; ?>
2745
  </div>
2746
  <br class="clear">
2751
  <th id="cb" class="manage-column column-cb check-column"
2752
  style="width: 2%;" scope="col"><input type="checkbox"></th>
2753
  <th id="id"
2754
+ class="manage-column <?php echo $order_sortable['vote_id'] ?> <?php echo $order_direction_reverse['vote_id'] ?>"
2755
  style="width: 10%" scope="col"><a
2756
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction['vote_id'] ) ) ); ?>">
2757
  <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
2758
  class="sorting-indicator"></span>
2759
  </a></th>
2760
  <th id="name"
2761
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2762
  style="width: 20%" scope="col"><a
2763
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2764
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
2765
  class="sorting-indicator"></span>
2766
  </a></th>
2767
  <th id="total_votes"
2768
+ class="manage-column <?php echo $order_sortable['answer'] ?> <?php echo $order_direction_reverse['answer'] ?>"
2769
  style="width: 18%" scope="col"><a
2770
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction['answer'] ) ) ); ?>">
2771
  <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
2772
  class="sorting-indicator"></span>
2773
  </a></th>
2774
  <th id="user_from"
2775
+ class="manage-column <?php echo $order_sortable['user_from'] ?> <?php echo $order_direction_reverse['user_from'] ?>"
2776
  style="width: 10%" scope="col"><a
2777
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction['user_from'] ) ) ); ?>">
2778
  <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
2779
  class="sorting-indicator"></span>
2780
  </a></th>
2781
  <th id="user_nicename"
2782
+ class="manage-column <?php echo $order_sortable['user_nicename'] ?> <?php echo $order_direction_reverse['user_nicename'] ?>"
2783
  style="width: 10%" scope="col"><a
2784
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction['user_nicename'] ) ) ); ?>">
2785
  <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
2786
  class="sorting-indicator"></span>
2787
  </a></th>
2788
  <th id="user_email"
2789
+ class="manage-column <?php echo $order_sortable['user_email'] ?> <?php echo $order_direction_reverse['user_email'] ?>"
2790
  style="width: 10%" scope="col"><a
2791
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction['user_email'] ) ) ); ?>">
2792
  <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
2793
  class="sorting-indicator"></span>
2794
  </a></th>
2795
  <th id="tr_id"
2796
+ class="manage-column <?php echo $order_sortable['tr_id'] ?> <?php echo $order_direction_reverse['tr_id'] ?>"
2797
  style="width: 5%" scope="col"><a
2798
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction['tr_id'] ) ) ); ?>">
2799
  <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
2800
  class="sorting-indicator"></span>
2801
  </a></th>
2802
  <th id="ip"
2803
+ class="manage-column <?php echo $order_sortable['ip'] ?> <?php echo $order_direction_reverse['ip'] ?>"
2804
  style="width: 5%" scope="col"><a
2805
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction['ip'] ) ) ); ?>">
2806
  <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
2807
  class="sorting-indicator"></span>
2808
  </a></th>
2809
  <th id="vote_date"
2810
+ class="manage-column <?php echo $order_sortable['vote_date'] ?> <?php echo $order_direction_reverse['vote_date'] ?>"
2811
  style="width: 10%" scope="col"><a
2812
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction['vote_date'] ) ) ); ?>">
2813
  <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
2814
  class="sorting-indicator"></span>
2815
  </a></th>
2820
  <th id="footer_cb" class="manage-column column-cb check-column"
2821
  style="width: 2%;" scope="col"><input type="checkbox"></th>
2822
  <th id="id"
2823
+ class="manage-column <?php echo $order_sortable['vote_id'] ?> <?php echo $order_direction_reverse['vote_id'] ?>"
2824
  style="width: 10%" scope="col"><a
2825
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_id', 'order' => $order_direction['vote_id'] ) ) ); ?>">
2826
  <span><?php _e( 'Vote ID', 'yop_poll' ); ?></span> <span
2827
  class="sorting-indicator"></span>
2828
  </a></th>
2829
  <th id="footer_name"
2830
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
2831
  style="width: 20%" scope="col"><a
2832
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
2833
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
2834
  class="sorting-indicator"></span>
2835
  </a></th>
2836
  <th id="footer_answer"
2837
+ class="manage-column <?php echo $order_sortable['answer'] ?> <?php echo $order_direction_reverse['answer'] ?>"
2838
  style="width: 18%" scope="col"><a
2839
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'answer', 'order' => $order_direction['answer'] ) ) ); ?>">
2840
  <span><?php _e( 'Answer', 'yop_poll' ); ?></span> <span
2841
  class="sorting-indicator"></span>
2842
  </a></th>
2843
  <th id="footer_user_from"
2844
+ class="manage-column <?php echo $order_sortable['user_from'] ?> <?php echo $order_direction_reverse['user_from'] ?>"
2845
  style="width: 10%" scope="col"><a
2846
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_from', 'order' => $order_direction['user_from'] ) ) ); ?>">
2847
  <span><?php _e( 'User Type', 'yop_poll' ); ?></span> <span
2848
  class="sorting-indicator"></span>
2849
  </a></th>
2850
  <th id="footer_user_nicename"
2851
+ class="manage-column <?php echo $order_sortable['user_nicename'] ?> <?php echo $order_direction_reverse['user_nicename'] ?>"
2852
  style="width: 10%" scope="col"><a
2853
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_nicename', 'order' => $order_direction['user_nicename'] ) ) ); ?>">
2854
  <span><?php _e( 'User', 'yop_poll' ); ?></span> <span
2855
  class="sorting-indicator"></span>
2856
  </a></th>
2857
  <th id="footer_user_email"
2858
+ class="manage-column <?php echo $order_sortable['user_email'] ?> <?php echo $order_direction_reverse['user_email'] ?>"
2859
  style="width: 10%" scope="col"><a
2860
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'user_email', 'order' => $order_direction['user_email'] ) ) ); ?>">
2861
  <span><?php _e( 'User Email', 'yop_poll' ); ?></span> <span
2862
  class="sorting-indicator"></span>
2863
  </a></th>
2864
  <th id="footer_tr_id"
2865
+ class="manage-column <?php echo $order_sortable['tr_id'] ?> <?php echo $order_direction_reverse['tr_id'] ?>"
2866
  style="width: 5%" scope="col"><a
2867
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'tr_id', 'order' => $order_direction['tr_id'] ) ) ); ?>">
2868
  <span><?php _e( 'Tracking ID', 'yop_poll' ); ?></span> <span
2869
  class="sorting-indicator"></span>
2870
  </a></th>
2871
  <th id="footer_ip"
2872
+ class="manage-column <?php echo $order_sortable['ip'] ?> <?php echo $order_direction_reverse['ip'] ?>"
2873
  style="width: 5%" scope="col"><a
2874
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'ip', 'order' => $order_direction['ip'] ) ) ); ?>">
2875
  <span><?php _e( 'Ip', 'yop_poll' ); ?></span> <span
2876
  class="sorting-indicator"></span>
2877
  </a></th>
2878
  <th id="footer_vote_date"
2879
+ class="manage-column <?php echo $order_sortable['vote_date'] ?> <?php echo $order_direction_reverse['vote_date'] ?>"
2880
  style="width: 10%" scope="col"><a
2881
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'vote_date', 'order' => $order_direction['vote_date'] ) ) ); ?>">
2882
  <span><?php _e( 'Vote Date', 'yop_poll' ); ?></span> <span
2883
  class="sorting-indicator"></span>
2884
  </a></th>
2885
  </tr>
2886
  </tfoot>
2887
  <?php
2888
+ if ( count( $logs ) > 0 ){
2889
  foreach ( $logs as $log ) {
2890
  ?>
2891
  <tbody id="the-list">
2892
  <tr valign="middle" class="alternate"
2893
  id="yop-poll-log<?php echo $log['id']; ?>">
2894
  <th class="check-column" scope="row">
2895
+ <?php if ( $group_by == 'vote' ){ ?>
2896
  <?php
2897
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $log ['vote_id'] );
2898
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2899
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2900
  ?>
2901
  <input type="checkbox"
2902
  value="<?php echo $log['vote_id']; ?>" name="yoppolllogscheck[]">
2903
  <?php } ?>
2904
  <?php
2905
 
2906
+ }
2907
+ else {
2908
  ?>
2909
  <?php
2910
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log ['id'] );
2911
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2912
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2913
  ?>
2914
  <input type="checkbox" value="<?php echo $log['id']; ?>"
2915
  name="yoppolllogscheck[]">
2917
  <?php } ?>
2918
  </th>
2919
  <td><strong><?php echo $log['vote_id']; ?></strong><br></td>
2920
+ <td><strong><?php if ( $log['name'] != '' ){
2921
+ echo esc_html( stripslashes( $log['name'] ) );
2922
+ }
2923
+ else {
2924
+ echo esc_html( stripslashes( Yop_Poll_Model::get_poll_field_from_database_by_id( 'name', $poll_id ) ) );
2925
+ } ?></strong><br>
2926
  <div class="row-actions">
2927
+ <?php if ( $group_by == 'vote' ){ ?>
2928
  <?php
2929
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_vote_id( 'poll_id', $log ['vote_id'] );
2930
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2931
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2932
  ?>
2933
  <span class="delete"><a
2934
+ 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;"
2935
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete_group', 'id' => $log['vote_id'] ) ), 'yop-poll-logs-delete' ); ?>"
2936
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
2937
  <?php } ?>
2938
  <?php
2939
 
2940
+ }
2941
+ else {
2942
  ?>
2943
  <?php
2944
+ $poll_id = Yop_Poll_Model::get_poll_log_field_from_database_by_id( 'poll_id', $log ['id'] );
2945
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
2946
+ if ( ( $this->current_user_can( 'delete_own_polls_logs' ) && $poll_author == $current_user->ID ) || ( $this->current_user_can( 'delete_polls_logs' ) ) ){
2947
  ?>
2948
  <span class="delete"><a
2949
+ 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;"
2950
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $log['id'] ) ), 'yop-poll-logs-delete' ); ?>"
2951
  class="submitdelete"><?php _e( 'Delete', 'yop_poll' ) ?></a></span>
2952
  <?php } ?>
2953
  <?php } ?>
2954
  </div></td>
2955
  <td>
2956
+ <?php echo ( 'Other' == $log['answer'] ) ? 'Other - ' . esc_html( stripslashes( $log['other_answer_value'] ) ) : esc_html( stripslashes( $log['answer'] ) ); ?>
2957
  </td>
2958
  <td>
2959
  <?php echo esc_html( stripslashes( $log['user_from'] ) ); ?>
2982
  </table>
2983
  <div class="tablenav bottom">
2984
  <div class="tablenav-pages one-page">
2985
+ <span class="displaying-num"><?php echo count( $logs ); ?> / <?php echo $total_logs; ?>
2986
+ logs</span>
2987
  <?php print $pagination; ?>
2988
  </div>
2989
  </div>
2991
  </div>
2992
  <?php
2993
  }
2994
+
2995
  public function view_yop_poll_bans() {
2996
  global $wpdb, $page, $action, $orderby, $order;
2997
+ $per_page = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
2998
+ $page_no = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
2999
+ $orderby = ( empty ( $orderby ) ) ? 'name' : $orderby;
3000
+ $order_direction = array( 'id' => 'asc', 'name' => 'asc', 'type' => 'asc', 'value' => 'asc' );
3001
+ $order_direction [$orderby] = ( 'desc' == $order ) ? 'asc' : 'desc';
 
 
 
 
 
3002
 
3003
+ $order_direction_reverse = array( 'id' => 'desc', 'name' => 'desc', 'type' => 'desc', 'value' => 'desc' );
3004
+ $order_direction_reverse [$orderby] = ( 'desc' == $order ) ? 'desc' : 'asc';
 
 
 
 
 
3005
 
3006
+ $order_sortable = array( 'id' => 'sortable', 'name' => 'sortable', 'type' => 'sortable', 'value' => 'sortable' );
 
 
 
 
 
3007
  $order_sortable [$orderby] = 'sorted';
3008
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? ( int )$_REQUEST ['poll_id'] : NULL;
3009
+ $type = isset ( $_REQUEST ['type'] ) ? $_REQUEST ['type'] : NULL;
3010
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
3011
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
3012
+ $search = array( 'fields' => array( $wpdb->yop_poll_bans . '.value' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
3013
+ $total_bans = count( Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $search, $type, $poll_id ) );
3014
+ $total_bans_pages = ceil( $total_bans / $per_page );
3015
+ if ( intval( $page_no ) > intval( $total_bans_pages ) ){
 
 
 
 
 
3016
  $page_no = 1;
3017
+ }
3018
+ $bans = Yop_Poll_Model::get_bans_filter_search( $orderby, $order, $search, $type, $poll_id, ( $page_no - 1 ) * $per_page, $per_page );
3019
+
3020
+ $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;' ) );
3021
+ $pagination = paginate_links( $args );
3022
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
 
 
 
 
 
 
 
 
 
3023
  ?>
3024
  <div class="wrap">
3025
  <div class="icon32 icon32-yop-poll">
3031
  id="yop-poll-add-new-ban"><?php _e( 'Add New', 'yop_poll' ); ?></a>
3032
  </h2>
3033
  <?php
3034
+ if ( isset ( $_REQUEST ['deleted'] ) ){
3035
  echo '<div id="message" class="updated"><p>';
3036
+ $deleted = ( int )$_REQUEST ['deleted'];
3037
+ printf( _n( '%s Poll Ban deleted!', '%s Poll Bans deleted!', $deleted ), $deleted );
3038
  echo '</p></div>';
3039
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER ['REQUEST_URI'] );
 
 
3040
  }
3041
  ?>
3042
  <?php
3043
+ if ( isset ( $_REQUEST ['bans-added'] ) ){
3044
  echo '<div id="message" class="updated"><p>';
3045
+ $added = ( int )$_REQUEST ['bans-added'];
3046
+ printf( _n( '%s Poll Ban added!', '%s Poll Bans added!', $added ), $added );
3047
  echo '</p></div>';
3048
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'bans-added' ), $_SERVER ['REQUEST_URI'] );
 
 
3049
  }
3050
  ?>
3051
  <?php
3052
+ if ( isset ( $_REQUEST ['bans-error'] ) ){
3053
  echo '<div id="message" class="error"><p>';
3054
  print $_REQUEST ['bans-error'];
3055
  echo '</p></div>';
3056
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'bans-error' ), $_SERVER ['REQUEST_URI'] );
 
 
3057
  }
3058
  ?>
3059
  <div id='yop-poll-add-ban-div' style="display: none;">
3060
  <p><?php _e( 'Ban IP, Username or Email', 'yop_poll' ); ?></p>
3061
  <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
3062
+ <input type="hidden" name="page" value="yop-polls-bans"/>
3063
+ <input type="hidden" name="action" value="add-ban"/>
3064
  <?php wp_nonce_field( 'yop-poll-add-ban' ); ?>
3065
  <table class="form-table">
3066
  <tbody>
3070
  <td><select id="ban-poll-id" name="ban_poll_id">
3071
  <option value="0"><?php _e( 'Bans For All Polls', 'yop_poll' ); ?></option>
3072
  <?php
3073
+ if ( count( $yop_polls ) > 0 ){
3074
  foreach ( $yop_polls as $yop_poll ) {
3075
  ?>
3076
  <option value="<?php echo $yop_poll['id'] ?>"><?php echo $yop_poll['name'] ?></option>
3090
  <option value="email"><?php _e( 'Email', 'yop_poll' ); ?></option></td>
3091
  </tr>
3092
  <tr class="form-field form-required">
3093
+ <th scope="row"><label for="yop-poll-ban-value"><?php _e( 'Value', 'yop_poll' ); ?>
3094
+ <span
3095
+ class="description">(required)</span><br> <small><i><?php _e( 'One Value Per Line', 'yop_poll' ); ?></i></small></label></th>
3096
  <td><textarea rows="5" cols="20" id="yop-poll-ban-value"
3097
  name="ban_value"></textarea></td>
3098
  </tr>
3099
  </tbody>
3100
  </table>
3101
  <p class="submit">
3102
+ <input type="submit" value="<?php _e( 'Add Ban', 'yop_poll' ); ?> "
3103
  class="button-primary"> <input id="yop-poll-add-ban-close"
3104
+ type="button" value="<?php _e( 'Close', 'yop_poll' ); ?> "
3105
  class="button-primary">
3106
 
3107
  </p>
3108
  </form>
3109
  </div>
3110
+ <br/>
3111
  <form method="get">
3112
  <?php wp_nonce_field( 'yop-poll-bans' ); ?>
3113
+ <input type="hidden" name="order" value="<?php echo $order ?>"/>
3114
+ <input type="hidden" name="orderby" value="<?php echo $orderby ?>"/>
3115
+ <input type="hidden" name="page" value="yop-polls-bans"/>
3116
  <p class="search-box">
3117
  <label class="screen-reader-text" for="yop-poll-search-input"><?php _e( 'Search Poll Bans', 'yop_poll' ) ?></label>
3118
  <input id="yop-poll-search-input" type="search"
3119
+ value="<?php if ( isset( $_REQUEST['s'] ) ): echo esc_html( stripslashes( $_REQUEST['s'] ) ); endif; ?>"
3120
+ name="s"/> <input id="search-submit" class="button" type="submit"
3121
+ value="<?php _e( 'Search Poll Bans', 'yop_poll' ); ?>" name=""/>
3122
  </p>
3123
  <div class="tablenav top">
3124
  <div class="alignleft actions">
3133
  <select name="poll_id">
3134
  <option value=""><?php _e( 'All Polls', 'yop_poll' ); ?></option>
3135
  <?php
3136
+ if ( count( $yop_polls ) > 0 ){
3137
  foreach ( $yop_polls as $yop_poll ) {
3138
  ?>
3139
  <option <?php echo selected( $poll_id, $yop_poll['id'] ); ?>
3147
  <div class="alignleft actions">
3148
  <select name="type">
3149
  <option value=""><?php _e( 'All Ban Types', 'yop_poll' ); ?></option>
3150
+ <option <?php echo selected( 'ip', $type ); ?> value="ip"><?php _e( 'IP', 'yop_poll' ); ?></option>
3151
+ <option <?php echo selected( 'username', $type ); ?> value="username"><?php _e( 'Username', 'yop_poll' ); ?></option>
3152
+ <option <?php echo selected( 'email', $type ); ?> value="email"><?php _e( 'Email', 'yop_poll' ); ?></option>
3153
  </select> <input type="submit"
3154
  value="<?php _e( 'Filter', 'yop_poll' ); ?>"
3155
  class="button-secondary" id="post-query-submit" name="">
3156
  </div>
3157
  <div class="tablenav-pages one-page">
3158
+ <label for="yop-poll-items-per-page" class="displaying-num"><?php _e( 'Items Per Page', 'yop_poll' ); ?>
3159
+ :</label>
3160
  <input id="yop-poll-items-per-page" type="text" name="per_page"
3161
+ value="<?php echo $per_page; ?>"/> <input name="a"
3162
+ value="<?php _e( 'Set', 'yop_poll' ); ?>" type="submit"/>&nbsp;&nbsp;
3163
+ <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans;
3164
+ _e( 'Bans', 'yop_poll' ) ?> </span>
3165
  <?php print $pagination; ?>
3166
  </div>
3167
  <br class="clear">
3172
  <th id="cb" class="manage-column column-cb check-column"
3173
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3174
  <th id="id"
3175
+ class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
3176
  style="width: 5%" scope="col"><a
3177
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
3178
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3179
  class="sorting-indicator"></span>
3180
  </a></th>
3181
  <th id="name"
3182
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
3183
  style="width: 25%" scope="col"><a
3184
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
3185
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3186
  class="sorting-indicator"></span>
3187
  </a></th>
3188
  <th id="type"
3189
+ class="manage-column <?php echo $order_sortable['type'] ?> <?php echo $order_direction_reverse['type'] ?>"
3190
  style="width: 25%" scope="col"><a
3191
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction['type'] ) ) ); ?>">
3192
  <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3193
  class="sorting-indicator"></span>
3194
  </a></th>
3195
  <th id="value"
3196
+ class="manage-column <?php echo $order_sortable['value'] ?> <?php echo $order_direction_reverse['value'] ?>"
3197
  style="width: 15%" scope="col"><a
3198
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction['value'] ) ) ); ?>">
3199
  <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3200
  class="sorting-indicator"></span>
3201
  </a></th>
3206
  <th id="cb" class="manage-column column-cb check-column"
3207
  style="width: 2%;" scope="col"><input type="checkbox"></th>
3208
  <th id="id"
3209
+ class="manage-column <?php echo $order_sortable['id'] ?> <?php echo $order_direction_reverse['id'] ?>"
3210
  style="width: 5%" scope="col"><a
3211
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'id', 'order' => $order_direction['id'] ) ) ); ?>">
3212
  <span><?php _e( 'ID', 'yop_poll' ); ?></span> <span
3213
  class="sorting-indicator"></span>
3214
  </a></th>
3215
  <th id="name"
3216
+ class="manage-column <?php echo $order_sortable['name'] ?> <?php echo $order_direction_reverse['name'] ?>"
3217
  style="width: 25%" scope="col"><a
3218
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'name', 'order' => $order_direction['name'] ) ) ); ?>">
3219
  <span><?php _e( 'Poll Name', 'yop_poll' ); ?></span> <span
3220
  class="sorting-indicator"></span>
3221
  </a></th>
3222
  <th id="type"
3223
+ class="manage-column <?php echo $order_sortable['type'] ?> <?php echo $order_direction_reverse['type'] ?>"
3224
  style="width: 25%" scope="col"><a
3225
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'type', 'order' => $order_direction['type'] ) ) ); ?>">
3226
  <span><?php _e( 'Ban Type', 'yop_poll' ); ?></span> <span
3227
  class="sorting-indicator"></span>
3228
  </a></th>
3229
  <th id="value"
3230
+ class="manage-column <?php echo $order_sortable['value'] ?> <?php echo $order_direction_reverse['value'] ?>"
3231
  style="width: 15%" scope="col"><a
3232
+ href="<?php echo esc_url( add_query_arg( array( 'orderby' => 'value', 'order' => $order_direction['value'] ) ) ); ?>">
3233
  <span><?php _e( 'Ban Value', 'yop_poll' ); ?></span> <span
3234
  class="sorting-indicator"></span>
3235
  </a></th>
3236
  </tr>
3237
  </tfoot>
3238
  <?php
3239
+ if ( count( $bans ) > 0 ){
3240
  foreach ( $bans as $ban ) {
3241
  ?>
3242
  <tbody id="the-list">
3248
  <td><strong><?php echo esc_html( stripslashes( $ban['name'] ) ); ?></strong><br>
3249
  <div class="row-actions">
3250
  <span class="delete"><a
3251
+ 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;"
3252
  href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => $ban['id'] ) ), 'yop-poll-bans-delete' ); ?>"
3253
  class="submitdelete"><?php _e( 'Remove', 'yop_poll' ) ?></a></span>
3254
  </div></td>
3267
  </table>
3268
  <div class="tablenav bottom">
3269
  <div class="tablenav-pages one-page">
3270
+ <span class="displaying-num"><?php echo count( $bans ); ?> / <?php echo $total_bans;
3271
+ _e( 'Bans', 'yop_poll' ) ?> </span>
3272
  <?php print $pagination; ?>
3273
  </div>
3274
  </div>
3276
  </div>
3277
  <?php
3278
  }
3279
+
3280
  public function view_yop_poll_become_pro() {
3281
  global $wpdb, $page, $action;
3282
+ require_once( ABSPATH . '/wp-admin/options-head.php' );
3283
+ $pro_options = get_option( 'yop_poll_pro_options', array() );
3284
  ?>
3285
  <div class="wrap">
3286
  <div class="icon32 icon32-yop-poll">
3290
  <h2><?php _e( 'Become Pro', 'yop_poll' ); ?></h2>
3291
  <div id="message"></div>
3292
  <form action="options.php" method="post">
3293
+ <?php settings_fields( 'yop_poll_pro_options' ); ?>
3294
  <table class="form-table">
3295
  <tbody>
3296
  <tr valign="top">
3306
  </div>
3307
  <?php
3308
  }
3309
+
3310
  public function yop_poll_options_admin_init() {
3311
+ register_setting( 'yop_poll_options', 'yop_poll_options', array( &$this, 'yop_poll_options_validate' ) );
3312
+ register_setting( 'yop_poll_pro_options', 'yop_poll_pro_options', array( &$this, 'yop_poll_pro_options_validate' ) );
 
 
 
 
 
 
3313
  }
3314
 
3315
+ public function yop_poll_pro_options_validate( $input ) {
3316
+ $pro_options = get_option( 'yop_poll_pro_options', array() );
3317
+ $newinput = $pro_options;
3318
+ $errors = '';
3319
+ $updated = '';
3320
  $message_delimiter = '<br>';
3321
  // set api key
3322
+ if ( isset ( $input ['pro_key'] ) ){
3323
+ if ( $input ['pro_key'] != '' ){
3324
+ require_once( $this->_config->plugin_inc_dir . '/pro_member_model.php' );
3325
+ $yop_poll_pro_member = Yop_Poll_Pro_Member_Model::getInstance();
3326
+ if ( $yop_poll_pro_member->register_pro_member( $input ['pro_key'] ) ){
3327
+ $newinput ['pro_key'] = trim( $input ['pro_key'] );
3328
+ $newinput ['pro_api_key'] = $yop_poll_pro_member->api_return_data['apy_key'];
3329
+ $newinput ['pro_user'] = 'yes';
3330
+ $updated .= __( 'Your Pro Key Saved!', 'yop_poll' ) . $message_delimiter;
3331
  }
3332
  else {
3333
+ $newinput ['pro_key'] = trim( $input ['pro_key'] );
3334
+ $newinput ['pro_api_key'] = '';
3335
+ $newinput ['pro_user'] = 'no';
3336
+ $errors .= __( 'Pro Key Error: ', 'yop_poll' ) . $yop_poll_pro_member->error . $message_delimiter;
3337
  }
3338
  }
3339
  else {
3340
+ $newinput ['pro_key'] = $pro_options ['pro_key'];
3341
+ $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3342
+ $newinput ['pro_user'] = $pro_options ['pro_user'];
3343
+ $errors .= __( 'Pro Key Is Empty!', 'yop_poll' ) . $message_delimiter;
3344
  }
3345
  }
3346
  else {
3347
+ $newinput ['pro_key'] = $pro_options ['pro_key'];
3348
+ $newinput ['pro_api_key'] = $pro_options ['pro_api_key'];
3349
+ $newinput ['pro_user'] = $pro_options ['pro_user'];
3350
+ $errors .= __( 'An Error Has Occured!', 'yop_poll' ) . $message_delimiter;
3351
  }
3352
 
3353
+ if ( '' != $errors )
3354
+ add_settings_error( 'general', 'yop-poll-errors', $errors, 'error' );
3355
+ if ( '' != $updated )
3356
+ add_settings_error( 'general', 'yop-poll-updates', $updated, 'updated' );
3357
 
3358
  return $newinput;
3359
  }
3360
+
3361
+ public function yop_poll_options_validate( $input ) {
3362
+ $default_options = get_option( 'yop_poll_options', array() );
3363
+ $newinput = $default_options;
3364
+ $errors = '';
3365
+ $updated = '';
3366
  $message_delimiter = '<br>';
3367
+ if ( $this->current_user_can( 'manage_polls_options' ) ){
3368
  // allow_other_answers
3369
+ if ( isset ( $input ['allow_other_answers'] ) ){
3370
+ if ( in_array( $input ['allow_other_answers'], array( 'yes', 'no' ) ) ){
3371
+ if ( $default_options ['allow_other_answers'] != trim( $input ['allow_other_answers'] ) ){
3372
+ $newinput ['allow_other_answers'] = trim( $input ['allow_other_answers'] );
3373
+ $updated .= __( 'Option "Allow Other Answer" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3374
  }
3375
+ }
3376
+ else {
3377
  $newinput ['allow_other_answers'] = $default_options ['allow_other_answers'];
3378
+ $errors .= __( 'Option "Allow Other Answer" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3379
+ }
3380
 
3381
+ if ( 'yes' == $input ['allow_other_answers'] ){
3382
  // other_answers_label
3383
+ if ( isset ( $input ['other_answers_label'] ) ){
3384
+ if ( $default_options ['other_answers_label'] != trim( $input ['other_answers_label'] ) ){
3385
+ $newinput ['other_answers_label'] = trim( $input ['other_answers_label'] );
3386
+ $updated .= __( 'Option "Other Answer Label" Updated!', 'yop_poll' ) . $message_delimiter;
3387
  }
3388
  }
3389
 
3390
  //add_other_answers_to_default_answers
3391
 
3392
+ if ( isset ( $input ['add_other_answers_to_default_answers'] ) ){
3393
+ if ( in_array( $input ['add_other_answers_to_default_answers'], array( 'yes', 'no' ) ) ){
3394
+ if ( $default_options ['add_other_answers_to_default_answers'] != trim( $input ['add_other_answers_to_default_answers'] ) ){
3395
+ $newinput ['add_other_answers_to_default_answers'] = trim( $input ['add_other_answers_to_default_answers'] );
3396
+ $updated .= __( 'Option "Add the values submitted in \'Other\' as answers" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3397
  }
3398
+ }
3399
+ else {
3400
  $newinput ['add_other_answers_to_default_answers'] = $default_options ['add_other_answers_to_default_answers'];
3401
+ $errors .= __( 'Option "Add the values submitted in \'Other\' as answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3402
  }
3403
  }
3404
 
3405
+ if ( isset ( $input ['display_other_answers_values'] ) ){
3406
+ if ( in_array( $input ['display_other_answers_values'], array( 'yes', 'no' ) ) ){
3407
+ if ( $default_options ['display_other_answers_values'] != trim( $input ['display_other_answers_values'] ) ){
3408
+ $newinput ['display_other_answers_values'] = trim( $input ['display_other_answers_values'] );
3409
+ $updated .= __( 'Option "Display Other Answers Values" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3410
  }
3411
+ }
3412
+ else {
3413
  $newinput ['display_other_answers_values'] = $default_options ['display_other_answers_values'];
3414
+ $errors .= __( 'Option "Display Other Answers Values" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3415
  }
3416
  }
3417
  }
3418
  }
3419
 
3420
  // allow_multiple_answers
3421
+ if ( isset ( $input ['allow_multiple_answers'] ) ){
3422
+ if ( in_array( $input ['allow_multiple_answers'], array( 'yes', 'no' ) ) ){
3423
+ if ( $default_options ['allow_multiple_answers'] != trim( $input ['allow_multiple_answers'] ) ){
3424
+ $newinput ['allow_multiple_answers'] = trim( $input ['allow_multiple_answers'] );
3425
+ $updated .= __( 'Option "Allow Multiple Answers" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3426
  }
3427
 
3428
  // allow_multiple_answers_number
3429
+ if ( 'yes' == $input ['allow_multiple_answers'] ){
3430
+ if ( isset ( $input ['allow_multiple_answers_number'] ) ){
3431
+ if ( ctype_digit( $input ['allow_multiple_answers_number'] ) ){
3432
+ if ( $default_options ['allow_multiple_answers_number'] != trim( $input ['allow_multiple_answers_number'] ) ){
3433
+ $newinput ['allow_multiple_answers_number'] = trim( $input ['allow_multiple_answers_number'] );
3434
+ $updated .= __( 'Option "Max Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3435
  }
3436
+ }
3437
+ else {
3438
  $newinput ['allow_multiple_answers_number'] = $default_options ['allow_multiple_answers_number'];
3439
+ $errors .= __( 'Option "Max Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3440
  }
3441
  }
3442
+ if ( isset ( $input ['allow_multiple_answers_min_number'] ) ){
3443
+ if ( ctype_digit( $input ['allow_multiple_answers_min_number'] ) ){
3444
+ if ( $default_options ['allow_multiple_answers_min_number'] != trim( $input ['allow_multiple_answers_min_number'] ) ){
3445
+ $newinput ['allow_multiple_answers_min_number'] = trim( $input ['allow_multiple_answers_min_number'] );
3446
+ $updated .= __( 'Option "Min Number of allowed answers" Updated!', 'yop_poll' ) . $message_delimiter;
3447
  }
3448
+ }
3449
+ else {
3450
  $newinput ['allow_multiple_answers_min_number'] = $default_options ['allow_multiple_answers_min_number'];
3451
+ $errors .= __( 'Option "Min Number of allowed answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3452
  }
3453
  }
3454
  }
3455
+ }
3456
+ else {
3457
  $newinput ['allow_multiple_answers'] = $default_options ['allow_multiple_answers'];
3458
+ $errors .= __( 'Option "Allow Multiple Answers" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3459
  }
3460
  }
3461
 
3462
+ if ( isset ( $input ['use_captcha'] ) ){
3463
+ if ( in_array( $input ['use_captcha'], array( 'yes', 'no' ) ) ){
3464
+ if ( $default_options ['use_captcha'] != trim( $input ['use_captcha'] ) ){
3465
+ $newinput ['use_captcha'] = trim( $input ['use_captcha'] );
3466
+ $updated .= __( 'Option "Use CAPTCHA" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3467
  }
3468
+ }
3469
+ else {
3470
  $newinput ['use_captcha'] = $default_options ['use_captcha'];
3471
+ $errors .= __( 'Option "Use CAPTCHA" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3472
  }
3473
  }
3474
 
3475
  // display_answers
3476
+ if ( isset ( $input ['display_answers'] ) ){
3477
+ if ( in_array( $input ['display_answers'], array( 'vertical', 'orizontal', 'tabulated' ) ) ){
3478
+ if ( $default_options ['display_answers'] != trim( $input ['display_answers'] ) ){
3479
+ $newinput ['display_answers'] = trim( $input ['display_answers'] );
3480
+ $updated .= __( 'Option "Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
3481
  }
3482
 
3483
+ if ( 'tabulated' == $input ['display_answers'] ){
3484
  // display_answers_tabulated_cols
3485
+ if ( isset ( $input ['display_answers_tabulated_cols'] ) ){
3486
+ if ( ctype_digit( $input ['display_answers_tabulated_cols'] ) ){
3487
+ if ( $default_options ['display_answers_tabulated_cols'] != trim( $input ['display_answers_tabulated_cols'] ) ){
3488
+ $newinput ['display_answers_tabulated_cols'] = trim( $input ['display_answers_tabulated_cols'] );
3489
+ $updated .= __( 'Option "Columns for Tabulated Display Answers" Updated!', 'yop_poll' ) . $message_delimiter;
3490
  }
3491
+ }
3492
+ else {
3493
  $newinput ['display_answers_tabulated_cols'] = $default_options ['display_answers_tabulated_cols'];
3494
+ $errors .= __( 'Option "Columns for Tabulated Display Answers" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3495
  }
3496
  }
3497
  }
3498
+ }
3499
+ else {
3500
  $newinput ['display_answers'] = $default_options ['display_answers'];
3501
+ $errors .= __( 'Option "Display Answers" Not Updated! you must choose between \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3502
  }
3503
  }
3504
 
3505
  // display_results
3506
+ if ( isset ( $input ['display_results'] ) ){
3507
+ if ( in_array( $input ['display_results'], array( 'vertical', 'orizontal', 'tabulated' ) ) ){
3508
+ if ( $default_options ['display_results'] != trim( $input ['display_results'] ) ){
3509
+ $newinput ['display_results'] = trim( $input ['display_results'] );
3510
+ $updated .= __( 'Option "Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
3511
  }
3512
 
3513
+ if ( 'tabulated' == $input ['display_results'] ){
3514
  // display_results_tabulated_cols
3515
+ if ( isset ( $input ['display_results_tabulated_cols'] ) ){
3516
+ if ( ctype_digit( $input ['display_results_tabulated_cols'] ) ){
3517
+ if ( $default_options ['display_results_tabulated_cols'] != trim( $input ['display_results_tabulated_cols'] ) ){
3518
+ $newinput ['display_results_tabulated_cols'] = trim( $input ['display_results_tabulated_cols'] );
3519
+ $updated .= __( 'Option "Columns for Tabulated Display Results" Updated!', 'yop_poll' ) . $message_delimiter;
3520
  }
3521
+ }
3522
+ else {
3523
  $newinput ['display_results_tabulated_cols'] = $default_options ['display_results_tabulated_cols'];
3524
+ $errors .= __( 'Option "Columns for Tabulated Display Results" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3525
  }
3526
  }
3527
  }
3528
+ }
3529
+ else {
3530
  $newinput ['display_results'] = $default_options ['display_results'];
3531
+ $errors .= __( 'Option "Display Results" Not Updated! Choose the display layout: \'vertical\', \'horizontal\' or \'tabulated\'', 'yop_poll' ) . $message_delimiter;
3532
  }
3533
  }
3534
  //template_width
3535
+ if ( isset ( $input ['template_width'] ) ){
3536
+ if ( '' != trim( $input ['template_width'] ) ){
3537
+ if ( $default_options ['template_width'] != trim( $input ['template_width'] ) ){
3538
+ $newinput ['template_width'] = trim( $input ['template_width'] );
3539
+ $updated .= __( 'Option "Poll Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3540
  }
3541
+ }
3542
+ else {
3543
  $newinput ['template_width'] = $default_options ['template_width'];
3544
+ $errors .= __( 'Option "Poll Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3545
  }
3546
  }
3547
 
3548
  //widget_template_width
3549
+ if ( isset ( $input ['widget_template_width'] ) ){
3550
+ if ( '' != trim( $input ['widget_template_width'] ) ){
3551
+ if ( $default_options ['widget_template_width'] != trim( $input ['widget_template_width'] ) ){
3552
+ $newinput ['widget_template_width'] = trim( $input ['widget_template_width'] );
3553
+ $updated .= __( 'Option "Widget Template Width" Updated!', 'yop_poll' ) . $message_delimiter;
3554
  }
3555
+ }
3556
+ else {
3557
  $newinput ['widget_template_width'] = $default_options ['widget_template_width'];
3558
+ $errors .= __( 'Option "Widget Template Width" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3559
  }
3560
  }
3561
 
3562
  // use_template_bar
3563
+ if ( isset ( $input ['use_template_bar'] ) ){
3564
+ if ( in_array( $input ['use_template_bar'], array( 'yes', 'no' ) ) ){
3565
+ if ( $default_options ['use_template_bar'] != trim( $input ['use_template_bar'] ) ){
3566
+ $newinput ['use_template_bar'] = trim( $input ['use_template_bar'] );
3567
+ $updated .= __( 'Option "Use Template Result Bar" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3568
  }
3569
 
3570
+ if ( 'no' == $input ['use_template_bar'] ){
3571
  // bar_background
3572
+ if ( isset ( $input ['bar_background'] ) ){
3573
+ if ( ctype_alnum( $input ['bar_background'] ) ){
3574
+ if ( $default_options ['bar_background'] != trim( $input ['bar_background'] ) ){
3575
+ $newinput ['bar_background'] = trim( $input ['bar_background'] );
3576
+ $updated .= __( 'Option "Result Bar Background Color" Updated!', 'yop_poll' ) . $message_delimiter;
3577
  }
3578
+ }
3579
+ else {
3580
  $newinput ['bar_background'] = $default_options ['bar_background'];
3581
+ $errors .= __( 'Option "Result Bar Background Color" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
3582
  }
3583
  }
3584
 
3585
  // bar_height
3586
+ if ( isset ( $input ['bar_height'] ) ){
3587
+ if ( ctype_digit( $input ['bar_height'] ) ){
3588
+ if ( $default_options ['bar_height'] != trim( $input ['bar_height'] ) ){
3589
+ $newinput ['bar_height'] = trim( $input ['bar_height'] );
3590
+ $updated .= __( 'Option "Result Bar Height" Updated!', 'yop_poll' ) . $message_delimiter;
3591
  }
3592
+ }
3593
+ else {
3594
  $newinput ['bar_height'] = $default_options ['bar_height'];
3595
+ $errors .= __( 'Option "Result Bar Height" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3596
  }
3597
  }
3598
 
3599
  // bar_border_color
3600
+ if ( isset ( $input ['bar_border_color'] ) ){
3601
+ if ( ctype_alnum( $input ['bar_border_color'] ) ){
3602
+ if ( $default_options ['bar_border_color'] != trim( $input ['bar_border_color'] ) ){
3603
+ $newinput ['bar_border_color'] = trim( $input ['bar_border_color'] );
3604
+ $updated .= __( 'Option "Result Bar Border Color" Updated!', 'yop_poll' ) . $message_delimiter;
3605
  }
3606
+ }
3607
+ else {
3608
  $newinput ['bar_border_color'] = $default_options ['bar_border_color'];
3609
+ $errors .= __( 'Option "Result Bar Border Color" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3610
  }
3611
  }
3612
 
3613
  // bar_border_width
3614
+ if ( isset ( $input ['bar_border_width'] ) ){
3615
+ if ( ctype_digit( $input ['bar_border_width'] ) ){
3616
+ if ( $default_options ['bar_border_width'] != trim( $input ['bar_border_width'] ) ){
3617
+ $newinput ['bar_border_width'] = trim( $input ['bar_border_width'] );
3618
+ $updated .= __( 'Option "Result Bar Border Width" Updated!', 'yop_poll' ) . $message_delimiter;
3619
  }
3620
+ }
3621
+ else {
3622
  $newinput ['bar_border_width'] = $default_options ['bar_border_width'];
3623
+ $errors .= __( 'Option "Result Bar Border Width" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
3624
  }
3625
  }
3626
 
3627
  // bar_border_style
3628
+ if ( isset ( $input ['bar_border_style'] ) ){
3629
+ if ( ctype_alpha( $input ['bar_border_style'] ) ){
3630
+ if ( $default_options ['bar_border_style'] != trim( $input ['bar_border_style'] ) ){
3631
+ $newinput ['bar_border_style'] = trim( $input ['bar_border_style'] );
3632
+ $updated .= __( 'Option "Result Bar Border Style" Updated!', 'yop_poll' ) . $message_delimiter;
3633
  }
3634
+ }
3635
+ else {
3636
  $newinput ['bar_border_style'] = $default_options ['bar_border_style'];
3637
+ $errors .= __( 'Option "Result Bar Border Style" Not Updated! Fill in an alphanumeric value!', 'yop_poll' ) . $message_delimiter;
3638
  }
3639
  }
3640
  }
3641
+ }
3642
+ else {
3643
  $newinput ['use_template_bar'] = $default_options ['use_template_bar'];
3644
+ $errors .= __( 'Option "Use Template Result Bar" Not Updated! Choose "yes" or "no"!', 'yop_poll' ) . $message_delimiter;
3645
  }
3646
  }
3647
 
3648
  // sorting_answers
3649
+ if ( isset ( $input ['sorting_answers'] ) ){
3650
+ if ( in_array( $input ['sorting_answers'], array( 'exact', 'alphabetical', 'random', 'votes' ) ) ){
3651
+ if ( $default_options ['sorting_answers'] != trim( $input ['sorting_answers'] ) ){
3652
+ $newinput ['sorting_answers'] = trim( $input ['sorting_answers'] );
3653
+ $updated .= __( 'Option "Sort Answers" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
 
3654
  }
3655
 
3656
  // sorting_answers_direction
3657
+ if ( isset ( $input ['sorting_answers_direction'] ) ){
3658
+ if ( in_array( $input ['sorting_answers_direction'], array( 'asc', 'desc' ) ) ){
3659
+ if ( $default_options ['sorting_answers_direction'] != trim( $input ['sorting_answers_direction'] ) ){
3660
+ $newinput ['sorting_answers_direction'] = trim( $input ['sorting_answers_direction'] );
3661
+ $updated .= __( 'Option "Sort Answers Direction" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3662
  }
3663
+ }
3664
+ else {
3665
  $newinput ['sorting_answers_direction'] = $default_options ['sorting_answers_direction'];
3666
+ $errors .= __( 'Option "Sort Answers Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
3667
  }
3668
  }
3669
+ }
3670
+ else {
3671
  $newinput ['sorting_answers'] = $default_options ['sorting_answers'];
3672
+ $errors .= __( 'Option "Sort Answers" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
3673
  }
3674
  }
3675
 
3676
  // sorting_results
3677
+ if ( isset ( $input ['sorting_answers'] ) ){
3678
+ if ( in_array( $input ['sorting_results'], array( 'exact', 'alphabetical', 'random', 'votes' ) ) ){
3679
+ if ( $default_options ['sorting_results'] != trim( $input ['sorting_results'] ) ){
3680
+ $newinput ['sorting_results'] = trim( $input ['sorting_results'] );
3681
+ $updated .= __( 'Option "Sort Results" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
 
3682
  }
3683
 
3684
  // sorting_results_direction
3685
+ if ( isset ( $input ['sorting_results_direction'] ) ){
3686
+ if ( in_array( $input ['sorting_results_direction'], array( 'asc', 'desc' ) ) ){
3687
+ if ( $default_options ['sorting_results_direction'] != trim( $input ['sorting_results_direction'] ) ){
3688
+ $newinput ['sorting_results_direction'] = trim( $input ['sorting_results_direction'] );
3689
+ $updated .= __( 'Option "Sort Results Direction" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3690
  }
3691
+ }
3692
+ else {
3693
  $newinput ['sorting_results_direction'] = $default_options ['sorting_results_direction'];
3694
+ $errors .= __( 'Option "Sort Results Direction" Not Updated! Please choose between \'Ascending\' or \'Descending\'', 'yop_poll' ) . $message_delimiter;
3695
  }
3696
  }
3697
+ }
3698
+ else {
3699
  $newinput ['sorting_results'] = $default_options ['sorting_results'];
3700
+ $errors .= __( 'Option "Sort Results" Not Updated! Please choose between: \'exact\', \'alphabetical\', \'random\' or \'votes\'', 'yop_poll' ) . $message_delimiter;
3701
  }
3702
  }
3703
 
3704
  // start_date
3705
+ if ( isset ( $input ['start_date'] ) ){
3706
+ if ( '' != trim( $input ['start_date'] ) ){
3707
+ if ( $default_options ['start_date'] != trim( $input ['start_date'] ) ){
3708
+ $newinput ['start_date'] = trim( $input ['start_date'] );
3709
+ $updated .= __( 'Option "Poll Start Date" Updated!', 'yop_poll' ) . $message_delimiter;
3710
  }
3711
+ }
3712
+ else {
3713
  $newinput ['start_date'] = $default_options ['start_date'];
3714
+ $errors .= __( 'Option "Poll Start Date" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3715
  }
3716
  }
3717
 
3718
  // never_expire
3719
+ if ( !isset ( $input ['never_expire'] ) ){
3720
  $input ['never_expire'] = 'no';
3721
  }
3722
+ if ( 'yes' == $input ['never_expire'] ){
3723
+ if ( $default_options ['never_expire'] != trim( $input ['never_expire'] ) ){
3724
+ $newinput ['never_expire'] = trim( $input ['never_expire'] );
3725
+ $newinput ['end_date'] = '9999-12-31 23:59:59';
3726
+ $updated .= __( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
3727
  }
3728
+ }
3729
  else {
3730
+ if ( isset ( $input ['end_date'] ) ){
3731
+ if ( '' != $input ['end_date'] ){
3732
+ if ( $default_options ['end_date'] != trim( $input ['end_date'] ) ){
3733
+ $newinput ['end_date'] = $input ['end_date'];
3734
  $newinput ['never_expire'] = 'no';
3735
+ $updated .= __( 'Option "Poll End Date" Updated!', 'yop_poll' ) . $message_delimiter;
3736
  }
3737
+ }
3738
+ else {
3739
+ $errors .= __( 'Option "Poll End Date" Not Updated! The field is empty! ', 'yop_poll' ) . $message_delimiter;
3740
  }
3741
  }
3742
  }
3743
 
3744
  // view_results
3745
+ if ( isset ( $input ['view_results'] ) ){
3746
+ if ( in_array( $input ['view_results'], array( 'before', 'after', 'after-poll-end-date', 'never', 'custom-date' ) ) ){
3747
+ if ( $default_options ['view_results'] != trim( $input ['view_results'] ) ){
3748
+ $newinput ['view_results'] = trim( $input ['view_results'] );
3749
+ $updated .= __( 'Option "View Results" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
 
 
3750
  }
3751
 
3752
+ if ( 'custom-date' == $newinput ['view_results'] ){
3753
  // view_results_start_date
3754
+ if ( isset ( $input ['view_results_start_date'] ) ){
3755
+ if ( $default_options ['view_results_start_date'] != trim( $input ['view_results_start_date'] ) ){
3756
  $newinput ['view_results_start_date'] = $input ['view_results_start_date'];
3757
+ $updated .= __( 'Option "View Results Custom Date" Updated!', 'yop_poll' ) . $message_delimiter;
3758
  }
3759
  }
3760
  }
3761
+ }
3762
+ else {
3763
  $newinput ['view_results'] = $default_options ['view_results'];
3764
+ $errors .= __( 'Option "View Results" Not Updated! Please choose between: \'Before\', \'After\', \'After Poll End Date\', \'Never\' or \'Custom Date\'', 'yop_poll' ) . $message_delimiter;
3765
  }
3766
  }
3767
 
3768
  // vote_permisions
3769
+ if ( isset ( $input ['view_results_permissions'] ) ){
3770
+ if ( in_array( $input ['view_results_permissions'], array( 'quest-only', 'registered-only', 'guest-registered' ) ) ){
3771
+ if ( $default_options ['view_results_permissions'] != trim( $input ['view_results_permissions'] ) ){
3772
+ $newinput ['view_results_permissions'] = trim( $input ['view_results_permissions'] );
3773
+ $updated .= __( 'Option "View Results Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
3774
  }
3775
+ }
3776
+ else {
3777
  $newinput ['view_results_permissions'] = $default_options ['view_results_permissions'];
3778
+ $errors .= __( 'Option "View Results Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
3779
  }
3780
  }
3781
 
3782
  // view_results_type
3783
+ if ( isset ( $input ['view_results_type'] ) ){
3784
+ if ( in_array( $input ['view_results_type'], array( 'votes-number', 'percentages', 'votes-number-and-percentages' ) ) ){
3785
+ if ( $default_options ['view_results_type'] != trim( $input ['view_results_type'] ) ){
3786
+ $newinput ['view_results_type'] = trim( $input ['view_results_type'] );
3787
+ $updated .= __( 'Option "View Results Type" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
3788
  }
3789
+ }
3790
+ else {
3791
  $newinput ['view_results_type'] = $default_options ['view_results_type'];
3792
+ $errors .= __( 'Option "View Results Type" Not Updated! Please choose between: \'Votes number\', \'Percentages\' or \'Votes number and percentages\' ', 'yop_poll' ) . $message_delimiter;
3793
  }
3794
  }
3795
 
3796
  // answer_result_label
3797
+ if ( isset ( $input ['answer_result_label'] ) ){
3798
+ if ( 'votes-number' == $input ['view_results_type'] ){
3799
+ if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ){
3800
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3801
+ $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES%!', 'yop_poll' ) . $message_delimiter;
3802
+ }
3803
+ else {
3804
+ if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3805
+ $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3806
+ $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3807
  }
3808
  }
3809
  }
3810
 
3811
+ if ( 'percentages' == $input ['view_results_type'] ){
3812
+ if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
3813
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3814
+ $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3815
+ }
3816
+ else {
3817
+ if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3818
+ $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3819
+ $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3820
  }
3821
  }
3822
  }
3823
 
3824
+ if ( 'votes-number-and-percentages' == $input ['view_results_type'] ){
3825
+ if ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
3826
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3827
+ $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3828
+ }
3829
+ elseif ( stripos( $input ['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ) {
3830
  $newinput ['answer_result_label'] = $default_options ['answer_result_label'];
3831
+ $errors .= __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' ) . $message_delimiter;
3832
+ }
3833
+ else {
3834
+ if ( $default_options ['answer_result_label'] != trim( $input ['answer_result_label'] ) ){
3835
+ $newinput ['answer_result_label'] = trim( $input ['answer_result_label'] );
3836
+ $updated .= __( 'Option "Poll Answer Result Label" Updated!', 'yop_poll' ) . $message_delimiter;
3837
  }
3838
  }
3839
  }
3840
  }
3841
 
3842
  // singular_answer_result_votes_number_label
3843
+ if ( isset ( $input ['singular_answer_result_votes_number_label'] ) ){
3844
+ if ( '' != $input ['singular_answer_result_votes_number_label'] ){
3845
+ if ( $default_options ['singular_answer_result_votes_number_label'] != trim( $input ['singular_answer_result_votes_number_label'] ) ){
3846
+ $newinput ['singular_answer_result_votes_number_label'] = trim( $input ['singular_answer_result_votes_number_label'] );
3847
+ $updated .= __( 'Option "Poll Answer Result Votes Number Singular Label" Updated!', 'yop_poll' ) . $message_delimiter;
3848
  }
3849
+ }
3850
+ else {
3851
  $newinput ['singular_answer_result_votes_number_label'] = $default_options ['singular_answer_result_votes_number_label'];
3852
+ $errors .= __( 'Option "Poll Answer Result Votes Number Singular Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3853
  }
3854
  }
3855
 
3856
  // plural_answer_result_votes_number_label
3857
+ if ( isset ( $input ['plural_answer_result_votes_number_label'] ) ){
3858
+ if ( '' != $input ['singular_answer_result_votes_number_label'] ){
3859
+ if ( $default_options ['plural_answer_result_votes_number_label'] != trim( $input ['plural_answer_result_votes_number_label'] ) ){
3860
+ $newinput ['plural_answer_result_votes_number_label'] = trim( $input ['plural_answer_result_votes_number_label'] );
3861
+ $updated .= __( 'Option "Poll Answer Result Votes Number Plural Label" Updated!', 'yop_poll' ) . $message_delimiter;
3862
  }
3863
+ }
3864
+ else {
3865
  $newinput ['plural_answer_result_votes_number_label'] = $default_options ['plural_answer_result_votes_number_label'];
3866
+ $errors .= __( 'Option "Poll Answer Result Votes Number Plural Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3867
  }
3868
  }
3869
 
3870
  // vote_button_label
3871
+ if ( isset ( $input ['vote_button_label'] ) ){
3872
+ if ( '' != $input ['vote_button_label'] ){
3873
+ if ( $default_options ['vote_button_label'] != trim( $input ['vote_button_label'] ) ){
3874
+ $newinput ['vote_button_label'] = trim( $input ['vote_button_label'] );
3875
+ $updated .= __( 'Option "Vote Button Label" Updated!', 'yop_poll' ) . $message_delimiter;
3876
  }
3877
+ }
3878
+ else {
3879
  $newinput ['vote_button_label'] = $default_options ['vote_button_label'];
3880
+ $errors .= __( 'Option "Vote Button Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3881
  }
3882
  }
3883
 
3884
  // view_results_link
3885
+ if ( isset ( $input ['view_results_link'] ) ){
3886
+ if ( in_array( $input ['view_results_link'], array( 'yes', 'no' ) ) ){
3887
+ if ( $default_options ['view_results_link'] != trim( $input ['view_results_link'] ) ){
3888
+ $newinput ['view_results_link'] = trim( $input ['view_results_link'] );
3889
+ $updated .= __( 'Option "View Results Link" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3890
  }
3891
 
3892
+ if ( 'yes' == $input ['view_results_link'] ){
3893
  // view_results_link_label
3894
+ if ( isset ( $input ['view_results_link_label'] ) ){
3895
+ if ( '' != $input ['view_results_link_label'] ){
3896
+ if ( $default_options ['view_results_link_label'] != trim( $input ['view_results_link_label'] ) ){
3897
+ $newinput ['view_results_link_label'] = trim( $input ['view_results_link_label'] );
3898
+ $updated .= __( 'Option "View Results Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
3899
  }
3900
+ }
3901
+ else {
3902
  $newinput ['view_results_link_label'] = $default_options ['view_results_link_label'];
3903
+ $errors .= __( 'Option "View Results Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3904
  }
3905
  }
3906
  }
3907
+ }
3908
+ else {
3909
  $newinput ['view_results_link'] = $default_options ['view_results_link'];
3910
+ $errors .= __( 'Option "View Results Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3911
  }
3912
  }
3913
 
3914
  // view_back_to_vote_link
3915
+ if ( isset ( $input ['view_back_to_vote_link'] ) ){
3916
+ if ( in_array( $input ['view_back_to_vote_link'], array( 'yes', 'no' ) ) ){
3917
+ if ( $default_options ['view_back_to_vote_link'] != trim( $input ['view_back_to_vote_link'] ) ){
3918
+ $newinput ['view_back_to_vote_link'] = trim( $input ['view_back_to_vote_link'] );
3919
+ $updated .= __( 'Option "View Back To Vote Link" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3920
  }
3921
 
3922
+ if ( 'yes' == $input ['view_back_to_vote_link'] ){
3923
  // view_results_link_label
3924
+ if ( isset ( $input ['view_back_to_vote_link_label'] ) ){
3925
+ if ( '' != $input ['view_back_to_vote_link_label'] ){
3926
+ if ( $default_options ['view_back_to_vote_link_label'] != trim( $input ['view_back_to_vote_link_label'] ) ){
3927
+ $newinput ['view_back_to_vote_link_label'] = trim( $input ['view_back_to_vote_link_label'] );
3928
+ $updated .= __( 'Option "View Back to Vote Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
3929
  }
3930
+ }
3931
+ else {
3932
  $newinput ['view_back_to_vote_link_label'] = $default_options ['view_back_to_vote_link_label'];
3933
+ $errors .= __( 'Option "View Back to Vote Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
3934
  }
3935
  }
3936
  }
3937
+ }
3938
+ else {
3939
  $newinput ['view_back_to_vote_link'] = $default_options ['view_back_to_vote_link'];
3940
+ $errors .= __( 'Option "View Back to Vote Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3941
  }
3942
  }
3943
 
3944
  // view_total_votes
3945
+ if ( isset ( $input ['view_total_votes'] ) ){
3946
+ if ( in_array( $input ['view_total_votes'], array( 'yes', 'no' ) ) ){
3947
+ if ( $default_options ['view_total_votes'] != trim( $input ['view_total_votes'] ) ){
3948
+ $newinput ['view_total_votes'] = trim( $input ['view_total_votes'] );
3949
+ $updated .= __( 'Option "View Total Votes" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3950
  }
3951
 
3952
  // view_total_votes
3953
+ if ( 'yes' == $input ['view_total_votes'] ){
3954
+ if ( isset ( $input ['view_total_votes_label'] ) ){
3955
+ if ( stripos( $input ['view_total_votes_label'], '%POLL-TOTAL-VOTES%' ) === false ){
3956
  $newinput ['view_total_votes_label'] = $default_options ['view_total_votes_label'];
3957
+ $errors .= __( 'You must use %POLL-TOTAL-VOTES% to define your Total Votes label!', 'yop_poll' ) . $message_delimiter;
3958
+ }
3959
+ else {
3960
+ if ( $default_options ['view_total_votes_label'] != trim( $input ['view_total_votes_label'] ) ){
3961
+ $newinput ['view_total_votes_label'] = trim( $input ['view_total_votes_label'] );
3962
+ $updated .= __( 'Option "View Total Votes Label" Updated!', 'yop_poll' ) . $message_delimiter;
3963
  }
3964
  }
3965
  }
3966
  }
3967
+ }
3968
+ else {
3969
  $newinput ['view_total_votes'] = $default_options ['view_total_votes'];
3970
+ $errors .= __( 'Option "View Total Votes" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
3971
  }
3972
  }
3973
 
3974
  // view_total_answers
3975
+ if ( isset ( $input ['view_total_answers'] ) ){
3976
+ if ( in_array( $input ['view_total_answers'], array( 'yes', 'no' ) ) ){
3977
+ if ( $default_options ['view_total_answers'] != trim( $input ['view_total_answers'] ) ){
3978
+ $newinput ['view_total_answers'] = trim( $input ['view_total_answers'] );
3979
+ $updated .= __( 'Option "View Total Answers" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
3980
  }
3981
 
3982
  // view_total_answers
3983
+ if ( 'yes' == $input ['view_total_answers'] ){
3984
+ if ( isset ( $input ['view_total_answers_label'] ) ){
3985
+ if ( stripos( $input ['view_total_answers_label'], '%POLL-TOTAL-ANSWERS%' ) === false ){
3986
  $newinput ['view_total_answers_label'] = $default_options ['view_total_answers_label'];
3987
+ $errors .= __( 'You must use %POLL-TOTAL-ANSWERS% to define your Total Answers label!', 'yop_poll' ) . $message_delimiter;
3988
+ }
3989
+ else {
3990
+ if ( $default_options ['view_total_answers_label'] != trim( $input ['view_total_answers_label'] ) ){
3991
+ $newinput ['view_total_answers_label'] = trim( $input ['view_total_answers_label'] );
3992
+ $updated .= __( 'Option "View Total Answers Label" Updated!', 'yop_poll' ) . $message_delimiter;
3993
  }
3994
  }
3995
  }
3996
  }
3997
+ }
3998
+ else {
3999
  $newinput ['view_total_answers'] = $default_options ['view_total_answers'];
4000
+ $errors .= __( 'Option "View Total Answers" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4001
  }
4002
  }
4003
 
4004
+ if ( isset ( $input ['message_after_vote'] ) ){
4005
+ if ( $default_options ['message_after_vote'] != trim( $input ['message_after_vote'] ) ){
4006
+ $newinput ['message_after_vote'] = trim( $input ['message_after_vote'] );
4007
+ $updated .= __( 'Option "Message After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
4008
  }
4009
  }
4010
 
4011
  // use_default_loading_image
4012
+ if ( isset ( $input ['use_default_loading_image'] ) ){
4013
+ if ( in_array( $input ['use_default_loading_image'], array( 'yes', 'no' ) ) ){
4014
+ if ( $default_options ['use_default_loading_image'] != trim( $input ['use_default_loading_image'] ) ){
4015
+ $newinput ['use_default_loading_image'] = trim( $input ['use_default_loading_image'] );
4016
+ $updated .= __( 'Option "Use Default Loading Image" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4017
  }
4018
 
4019
+ if ( 'no' == $input ['use_default_loading_image'] ){
4020
+ if ( isset ( $input ['loading_image_url'] ) ){
4021
+ if ( stripos( $input ['loading_image_url'], 'http' ) === false ){
4022
  $newinput ['loading_image_url'] = $default_options ['loading_image_url'];
4023
+ $errors .= __( 'You must use a url like "http://.." to define your Loading Image Url!', 'yop_poll' ) . $message_delimiter;
4024
+ }
4025
+ else {
4026
+ if ( $default_options ['loading_image_url'] != trim( $input ['loading_image_url'] ) ){
4027
+ $newinput ['loading_image_url'] = trim( $input ['loading_image_url'] );
4028
+ $updated .= __( 'Option "Loading Image Url" Updated!', 'yop_poll' ) . $message_delimiter;
4029
  }
4030
  }
4031
  }
4032
  }
4033
+ }
4034
+ else {
4035
  $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4036
+ $errors .= __( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4037
  }
4038
  }
4039
 
4040
  // vote_permisions
4041
+ if ( isset ( $input ['vote_permisions'] ) ){
4042
+ if ( in_array( $input ['vote_permisions'], array( 'quest-only', 'registered-only', 'guest-registered' ) ) ){
4043
+ if ( $default_options ['vote_permisions'] != trim( $input ['vote_permisions'] ) ){
4044
+ $newinput ['vote_permisions'] = trim( $input ['vote_permisions'] );
4045
+ $updated .= __( 'Option "Vote Permissions" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
4046
  }
4047
 
4048
+ if ( in_array( $input ['vote_permisions'], array( 'registered-only', 'guest-registered' ) ) ){
 
 
 
4049
 
4050
+ if ( isset( $input['vote_permisions_facebook'] ) && in_array( $input['vote_permisions_facebook'], array( 'yes', 'no' ) ) ){
4051
+ if ( $default_options ['vote_permisions_facebook'] != trim( $input ['vote_permisions_facebook'] ) ){
4052
+ $newinput ['vote_permisions_facebook'] = trim( $input ['vote_permisions_facebook'] );
4053
+ $updated .= __( 'Option "Vote as Facebook User" Updated!', 'yop_poll' ) . $message_delimiter;
4054
  }
4055
+ if ( 'yes' == $input['vote_permisions_facebook'] ){
4056
+ if ( $default_options ['vote_permisions_facebook_label'] != trim( $input ['vote_permisions_facebook_label'] ) ){
4057
+ $newinput ['vote_permisions_facebook_label'] = trim( $input ['vote_permisions_facebook_label'] );
4058
+ $updated .= __( 'Option "Vote as Facebook User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4059
+ }
4060
  }
4061
  }
4062
+ if ( isset( $input['vote_permisions_wordpress'] ) && in_array( $input['vote_permisions_wordpress'], array( 'yes', 'no' ) ) ){
4063
+ if ( $default_options ['vote_permisions_wordpress'] != trim( $input ['vote_permisions_wordpress'] ) ){
4064
+ $newinput ['vote_permisions_wordpress'] = trim( $input ['vote_permisions_wordpress'] );
4065
+ $updated .= __( 'Option "Vote as Wordpress User" Updated!', 'yop_poll' ) . $message_delimiter;
4066
  }
4067
 
4068
+ if ( 'yes' == $input['vote_permisions_wordpress'] ){
4069
+ if ( $default_options ['vote_permisions_wordpress_label'] != trim( $input ['vote_permisions_wordpress_label'] ) ){
4070
+ $newinput ['vote_permisions_wordpress_label'] = trim( $input ['vote_permisions_wordpress_label'] );
4071
+ $updated .= __( 'Option "Vote as Wordpress User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4072
+ }
4073
  }
4074
  }
4075
+ if ( isset( $input['vote_permisions_anonymous'] ) && in_array( $input['vote_permisions_anonymous'], array( 'yes', 'no' ) ) ){
4076
+ if ( $default_options ['vote_permisions_anonymous'] != trim( $input ['vote_permisions_anonymous'] ) ){
4077
+ $newinput ['vote_permisions_anonymous'] = trim( $input ['vote_permisions_anonymous'] );
4078
+ $updated .= __( 'Option "Vote as Anonymous User" Updated!', 'yop_poll' ) . $message_delimiter;
4079
  }
4080
 
4081
+ if ( 'yes' == $input['vote_permisions_anonymous'] ){
4082
+ if ( $default_options ['vote_permisions_anonymous_label'] != trim( $input ['vote_permisions_anonymous_label'] ) ){
4083
+ $newinput ['vote_permisions_anonymous_label'] = trim( $input ['vote_permisions_anonymous_label'] );
4084
+ $updated .= __( 'Option "Vote as Anonymous User Buton Label" Updated!', 'yop_poll' ) . $message_delimiter;
4085
+ }
4086
  }
4087
  }
4088
  }
4089
+ }
4090
+ else {
4091
  $newinput ['vote_permisions'] = $default_options ['vote_permisions'];
4092
+ $errors .= __( 'Option "Vote Permissions" Not Updated! Please choose between \'Quest Only\', \'Registered Only\', \'Guest & Registered Users\'', 'yop_poll' ) . $message_delimiter;
4093
  }
4094
  }
4095
 
4096
  // blocking_voters
4097
+ if ( isset ( $input ['blocking_voters'] ) ){
4098
+ if ( in_array( $input ['blocking_voters'], array( 'dont-block', 'cookie', 'ip', 'username', 'cookie-ip' ) ) ){
4099
+ if ( $default_options ['blocking_voters'] != trim( $input ['blocking_voters'] ) ){
4100
+ $newinput ['blocking_voters'] = trim( $input ['blocking_voters'] );
4101
+ $updated .= __( 'Option "Blocking Voters" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
 
 
4102
  }
4103
 
4104
+ if ( 'dont-block' != $newinput ['blocking_voters'] ){
4105
  // blocking_voters_interval_value
4106
+ if ( isset ( $input ['blocking_voters_interval_value'] ) ){
4107
+ if ( ctype_digit( $input ['blocking_voters_interval_value'] ) ){
4108
+ if ( $default_options ['blocking_voters_interval_value'] != trim( $input ['blocking_voters_interval_value'] ) ){
4109
+ $newinput ['blocking_voters_interval_value'] = trim( $input ['blocking_voters_interval_value'] );
4110
+ $updated .= __( 'Option "Blocking Voters Interval Value" Updated!', 'yop_poll' ) . $message_delimiter;
4111
  }
4112
+ }
4113
+ else {
4114
  $newinput ['blocking_voters_interval_value'] = $default_options ['blocking_voters_interval_value'];
4115
+ $errors .= __( 'Option "Blocking Voters Interval Value" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4116
  }
4117
  }
4118
 
4119
  // blocking_voters_interval_unit
4120
+ if ( isset ( $input ['blocking_voters_interval_unit'] ) ){
4121
+ if ( in_array( $input ['blocking_voters_interval_unit'], array( 'seconds', 'minutes', 'hours', 'days' ) ) ){
4122
+ if ( $default_options ['blocking_voters_interval_unit'] != trim( $input ['blocking_voters_interval_unit'] ) ){
4123
+ $newinput ['blocking_voters_interval_unit'] = trim( $input ['blocking_voters_interval_unit'] );
4124
+ $updated .= __( 'Option "Blocking Voters Interval Unit" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
 
 
4125
  }
4126
+ }
4127
+ else {
4128
  $newinput ['blocking_voters_interval_unit'] = $default_options ['blocking_voters_interval_unit'];
4129
+ $errors .= __( 'Option "Blocking Voters Interval Unit" Not Updated! Please choose between \'Seconds\', \'Minutes\', \'Hours\' or \'Days\'', 'yop_poll' ) . $message_delimiter;
4130
  }
4131
  }
4132
  }
4133
+ }
4134
+ else {
4135
  $newinput ['blocking_voters'] = $default_options ['blocking_voters'];
4136
+ $errors .= __( 'Option "Blocking Voters" Not Updated! Please choose between: \'Don`t Block\', \'Cookie\', \'Ip\', \'Username\', \'Cookie and Ip\'', 'yop_poll' ) . $message_delimiter;
4137
  }
4138
  }
4139
 
4140
  // limit_number_of_votes_per_user
4141
+ if ( isset ( $input ['limit_number_of_votes_per_user'] ) ){
4142
+ if ( in_array( $input ['limit_number_of_votes_per_user'], array( 'yes', 'no' ) ) ){
4143
+ if ( $default_options ['limit_number_of_votes_per_user'] != trim( $input ['limit_number_of_votes_per_user'] ) ){
4144
+ $newinput ['limit_number_of_votes_per_user'] = trim( $input ['limit_number_of_votes_per_user'] );
4145
+ $updated .= __( 'Option "Limit Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4146
  }
4147
 
4148
+ if ( 'yes' == $input ['limit_number_of_votes_per_user'] ){
4149
+ if ( isset ( $input ['number_of_votes_per_user'] ) ){
4150
+ if ( intval( $input ['number_of_votes_per_user'] ) <= 0 ){
4151
  $newinput ['number_of_votes_per_user'] = $default_options ['number_of_votes_per_user'];
4152
+ $errors .= __( '"Number of Votes per User" must be a number > 0 !', 'yop_poll' ) . $message_delimiter;
4153
+ }
4154
+ else {
4155
+ if ( $default_options ['number_of_votes_per_user'] != $input ['number_of_votes_per_user'] ){
4156
+ $newinput ['number_of_votes_per_user'] = trim( $input ['number_of_votes_per_user'] );
4157
+ $updated .= __( 'Option "Number of Votes per User" Updated!', 'yop_poll' ) . $message_delimiter;
4158
  }
4159
  }
4160
  }
4161
  }
4162
+ }
4163
+ else {
4164
  $newinput ['use_default_loading_image'] = $default_options ['use_default_loading_image'];
4165
+ $errors .= __( 'Option "Use Default Loading Image" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4166
  }
4167
  }
4168
 
4169
  // percentages_decimals
4170
+ if ( isset ( $input ['percentages_decimals'] ) ){
4171
+ if ( ctype_digit( $input ['percentages_decimals'] ) ){
4172
+ if ( $default_options ['percentages_decimals'] != trim( $input ['percentages_decimals'] ) ){
4173
+ $newinput ['percentages_decimals'] = trim( $input ['percentages_decimals'] );
4174
+ $updated .= __( 'Option "Percentages Decimals" Updated!', 'yop_poll' ) . $message_delimiter;
4175
  }
4176
+ }
4177
+ else {
4178
  $newinput ['percentages_decimals'] = $default_options ['percentages_decimals'];
4179
+ $errors .= __( 'Option "Percentages Decimals" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4180
  }
4181
  }
4182
 
4183
  // redirect_after_vote
4184
+ if ( isset ( $input ['redirect_after_vote'] ) ){
4185
+ if ( in_array( $input ['redirect_after_vote'], array( 'yes', 'no' ) ) ){
4186
+ if ( $default_options ['redirect_after_vote'] != trim( $input ['redirect_after_vote'] ) ){
4187
+ $newinput ['redirect_after_vote'] = trim( $input ['redirect_after_vote'] );
4188
+ $updated .= __( 'Option "Redirect After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4189
  }
4190
 
4191
+ if ( 'yes' == $input ['redirect_after_vote'] ){
4192
  // archive_order
4193
+ if ( isset ( $input ['redirect_after_vote_url'] ) ){
4194
+ if ( '' != $input ['redirect_after_vote_url'] ){
4195
+ if ( $default_options ['redirect_after_vote_url'] != trim( $input ['redirect_after_vote_url'] ) ){
4196
+ $newinput ['redirect_after_vote_url'] = trim( $input ['redirect_after_vote_url'] );
4197
+ $updated .= __( 'Option "Redirect After Vote Url" Updated!', 'yop_poll' ) . $message_delimiter;
4198
  }
4199
+ }
4200
+ else {
4201
  $newinput ['redirect_after_vote_url'] = $default_options ['redirect_after_vote_url'];
4202
+ $errors .= __( 'Option "Redirect After Vote Url" Not Updated! Please fill in an url!', 'yop_poll' ) . $message_delimiter;
4203
  }
4204
  }
4205
  }
4206
+ }
4207
+ else {
4208
  $newinput ['redirect_after_vote'] = $default_options ['redirect_after_vote'];
4209
+ $errors .= __( 'Option ""Redirect After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4210
  }
4211
  }
4212
 
4213
  // date_format
4214
+ if ( isset ( $input ['date_format'] ) ){
4215
+ if ( $default_options ['date_format'] != trim( $input ['date_format'] ) ){
4216
+ $newinput ['date_format'] = trim( $input ['date_format'] );
4217
+ $updated .= __( 'Option "Poll Date Format" Updated!', 'yop_poll' ) . $message_delimiter;
4218
  }
4219
  }
4220
 
4221
  // view_poll_archive_link
4222
+ if ( isset ( $input ['view_poll_archive_link'] ) ){
4223
+ if ( in_array( $input ['view_poll_archive_link'], array( 'yes', 'no' ) ) ){
4224
+ if ( $default_options ['view_poll_archive_link'] != trim( $input ['view_poll_archive_link'] ) ){
4225
+ $newinput ['view_poll_archive_link'] = trim( $input ['view_poll_archive_link'] );
4226
+ $updated .= __( 'Option "View Poll Archive Link" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4227
  }
4228
 
4229
+ if ( 'yes' == $input ['view_poll_archive_link'] ){
4230
  // view_results_link_label
4231
+ if ( isset ( $input ['view_poll_archive_link_label'] ) ){
4232
+ if ( '' != $input ['view_poll_archive_link_label'] ){
4233
+ if ( $default_options ['view_poll_archive_link_label'] != trim( $input ['view_poll_archive_link_label'] ) ){
4234
+ $newinput ['view_poll_archive_link_label'] = trim( $input ['view_poll_archive_link_label'] );
4235
+ $updated .= __( 'Option "View Poll Archive Link Label" Updated!', 'yop_poll' ) . $message_delimiter;
4236
  }
4237
+ }
4238
+ else {
4239
  $newinput ['view_poll_archive_link_label'] = $default_options ['view_poll_archive_link_label'];
4240
+ $errors .= __( 'Option "View Poll Archive Link Label" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4241
  }
4242
  }
4243
 
4244
+ if ( isset ( $input ['poll_archive_url'] ) ){
4245
+ if ( '' != $input ['poll_archive_url'] ){
4246
+ if ( $default_options ['poll_archive_url'] != trim( $input ['poll_archive_url'] ) ){
4247
+ $newinput ['poll_archive_url'] = trim( $input ['poll_archive_url'] );
4248
+ $updated .= __( 'Option "Poll Archive URL" Updated!', 'yop_poll' ) . $message_delimiter;
4249
  }
4250
+ }
4251
+ else {
4252
  $newinput ['poll_archive_url'] = $default_options ['poll_archive_url'];
4253
+ $errors .= __( 'Option "Poll Archive URL" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4254
  }
4255
  }
4256
  }
4257
+ }
4258
+ else {
4259
  $newinput ['view_poll_archive_link'] = $default_options ['view_poll_archive_link'];
4260
+ $errors .= __( 'Option "View Poll Archive Link" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4261
  }
4262
  }
4263
 
4264
  // show_in_archive
4265
+ if ( isset ( $input ['show_in_archive'] ) ){
4266
+ if ( in_array( $input ['show_in_archive'], array( 'yes', 'no' ) ) ){
4267
+ if ( $default_options ['show_in_archive'] != trim( $input ['show_in_archive'] ) ){
4268
+ $newinput ['show_in_archive'] = trim( $input ['show_in_archive'] );
4269
+ $updated .= __( 'Option "Show Poll in Arhive" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4270
  }
4271
 
4272
+ if ( 'yes' == $input ['show_in_archive'] ){
4273
  // archive_order
4274
+ if ( isset ( $input ['archive_order'] ) ){
4275
+ if ( ctype_digit( $input ['archive_order'] ) ){
4276
+ if ( $default_options ['archive_order'] != trim( $input ['archive_order'] ) ){
4277
+ $newinput ['archive_order'] = trim( $input ['archive_order'] );
4278
+ $updated .= __( 'Option "Archive Order" Updated!', 'yop_poll' ) . $message_delimiter;
4279
  }
4280
+ }
4281
+ else {
4282
  $newinput ['archive_order'] = $default_options ['archive_order'];
4283
+ $errors .= __( 'Option "Archive Order" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4284
  }
4285
  }
4286
  }
4287
+ }
4288
+ else {
4289
  $newinput ['show_in_archive'] = $default_options ['show_in_archive'];
4290
+ $errors .= __( 'Option "Show Poll in Archive" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4291
  }
4292
  }
4293
 
4294
  // send_email_notifications
4295
+ if ( isset ( $input ['send_email_notifications'] ) ){
4296
+ if ( in_array( $input ['send_email_notifications'], array( 'yes', 'no' ) ) ){
4297
+ if ( $default_options ['send_email_notifications'] != trim( $input ['send_email_notifications'] ) ){
4298
+ $newinput ['send_email_notifications'] = trim( $input ['send_email_notifications'] );
4299
+ $updated .= __( 'Option "Send Email Notifications" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4300
  }
4301
 
4302
+ if ( 'yes' == $input ['send_email_notifications'] ){
4303
  // email_notifications_from_name
4304
+ if ( isset ( $input ['email_notifications_from_name'] ) ){
4305
+ if ( '' != $input ['email_notifications_from_name'] ){
4306
+ if ( $default_options ['email_notifications_from_name'] != trim( $input ['email_notifications_from_name'] ) ){
4307
+ $newinput ['email_notifications_from_name'] = trim( $input ['email_notifications_from_name'] );
4308
+ $updated .= __( 'Option "Notifications From Name" Updated!', 'yop_poll' ) . $message_delimiter;
4309
  }
4310
+ }
4311
+ else {
4312
  $newinput ['email_notifications_from_name'] = $default_options ['email_notifications_from_name'];
4313
+ $errors .= __( 'Option "Notifications From Name" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4314
  }
4315
  }
4316
 
4317
  // email_notifications_from_email
4318
+ if ( isset ( $input ['email_notifications_from_email'] ) ){
4319
+ if ( '' != $input ['email_notifications_from_email'] ){
4320
+ if ( $default_options ['email_notifications_from_email'] != trim( $input ['email_notifications_from_email'] ) ){
4321
+ $newinput ['email_notifications_from_email'] = trim( $input ['email_notifications_from_email'] );
4322
+ $updated .= __( 'Option "Notifications From Email" Updated!', 'yop_poll' ) . $message_delimiter;
4323
  }
4324
+ }
4325
+ else {
4326
  $newinput ['email_notifications_from_email'] = $default_options ['email_notifications_from_email'];
4327
+ $errors .= __( 'Option "Notifications From Email" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4328
  }
4329
  }
4330
 
4331
  // email_notifications_recipients
4332
+ if ( isset ( $input ['email_notifications_recipients'] ) ){
4333
+ if ( '' != $input ['email_notifications_recipients'] ){
4334
+ if ( $default_options ['email_notifications_recipients'] != trim( $input ['email_notifications_recipients'] ) ){
4335
+ $newinput ['email_notifications_recipients'] = trim( $input ['email_notifications_recipients'] );
4336
+ $updated .= __( 'Option "Email Notifications Recipients" Updated!', 'yop_poll' ) . $message_delimiter;
4337
  }
4338
+ }
4339
+ else {
4340
  $newinput ['email_notifications_recipients'] = $default_options ['email_notifications_recipients'];
4341
+ $errors .= __( 'Option "Email Notifications Recipients" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4342
  }
4343
  }
4344
 
4345
  // email_notifications_subject
4346
+ if ( isset ( $input ['email_notifications_subject'] ) ){
4347
+ if ( '' != $input ['email_notifications_subject'] ){
4348
+ if ( $default_options ['email_notifications_subject'] != trim( $input ['email_notifications_subject'] ) ){
4349
+ $newinput ['email_notifications_subject'] = trim( $input ['email_notifications_subject'] );
4350
+ $updated .= __( 'Option "Email Notifications Subject" Updated!', 'yop_poll' ) . $message_delimiter;
4351
  }
4352
+ }
4353
+ else {
4354
  $newinput ['email_notifications_subject'] = $default_options ['email_notifications_subject'];
4355
+ $errors .= __( 'Option "Email Notifications Subject" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4356
  }
4357
  }
4358
 
4359
  // email_notifications_subject
4360
+ if ( isset ( $input ['email_notifications_body'] ) ){
4361
+ if ( '' != $input ['email_notifications_body'] ){
4362
+ if ( $default_options ['email_notifications_body'] != trim( $input ['email_notifications_body'] ) ){
4363
+ $newinput ['email_notifications_body'] = trim( $input ['email_notifications_body'] );
4364
+ $updated .= __( 'Option "Email Notifications Body" Updated!', 'yop_poll' ) . $message_delimiter;
4365
  }
4366
+ }
4367
+ else {
4368
  $newinput ['email_notifications_body'] = $default_options ['email_notifications_body'];
4369
+ $errors .= __( 'Option "Email Notifications Body" Not Updated! The field is empty!', 'yop_poll' ) . $message_delimiter;
4370
  }
4371
  }
4372
  }
4373
+ }
4374
+ else {
4375
  $newinput ['send_email_notifications'] = $default_options ['send_email_notifications'];
4376
+ $errors .= __( 'Option "Send Email Notifications" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4377
  }
4378
  }
4379
 
4380
  // archive_polls_per_page
4381
+ if ( isset ( $input ['archive_polls_per_page'] ) ){
4382
+ if ( ctype_digit( $input ['archive_polls_per_page'] ) ){
4383
+ if ( $default_options ['archive_polls_per_page'] != trim( $input ['archive_polls_per_page'] ) ){
4384
+ $newinput ['archive_polls_per_page'] = trim( $input ['archive_polls_per_page'] );
4385
+ $updated .= __( 'Option "Archive Polls Per Page', 'yop_poll' ) . $message_delimiter;
4386
  }
4387
+ }
4388
+ else {
4389
  $newinput ['archive_polls_per_page'] = $default_options ['archive_polls_per_page'];
4390
+ $errors .= __( 'Option "Archive Polls Per Page" Not Updated! Please fill in a number!', 'yop_poll' ) . $message_delimiter;
4391
  }
4392
  }
4393
 
4394
  //share after vote
4395
+ if ( isset ( $input ['share_after_vote'] ) ){
4396
+ if ( in_array( $input ['share_after_vote'], array( 'yes', 'no' ) ) ){
4397
+ if ( $default_options ['share_after_vote'] != trim( $input ['share_after_vote'] ) ){
4398
+ $newinput ['share_after_vote'] = trim( $input ['share_after_vote'] );
4399
+ $updated .= __( 'Option "Share After Vote" Updated!', 'yop_poll' ) . $message_delimiter;
 
 
 
4400
  }
4401
 
4402
+ if ( 'yes' == $input ['share_after_vote'] ){
4403
  // share_name
4404
+ if ( isset ( $input ['share_name'] ) ){
4405
+ if ( $default_options ['share_name'] != trim( $input ['share_name'] ) ){
4406
+ $newinput ['share_name'] = trim( $input ['share_name'] );
4407
+ $updated .= __( 'Option "Share Name" Updated!', 'yop_poll' ) . $message_delimiter;
4408
  }
4409
  }
4410
  // share_caption
4411
+ if ( isset ( $input ['share_caption'] ) ){
4412
+ if ( $default_options ['share_caption'] != trim( $input ['share_caption'] ) ){
4413
+ $newinput ['share_caption'] = trim( $input ['share_caption'] );
4414
+ $updated .= __( 'Option "Share Caption" Updated!', 'yop_poll' ) . $message_delimiter;
4415
  }
4416
  }
4417
  // share_description
4418
+ if ( isset ( $input ['share_description'] ) ){
4419
+ if ( $default_options ['share_description'] != trim( $input ['share_description'] ) ){
4420
+ $newinput ['share_description'] = trim( $input ['share_description'] );
4421
+ $updated .= __( 'Option "Share Description" Updated!', 'yop_poll' ) . $message_delimiter;
4422
  }
4423
  }
4424
  // share_picture
4425
+ if ( isset ( $input ['share_picture'] ) ){
4426
+ if ( $default_options ['share_picture'] != trim( $input ['share_picture'] ) ){
4427
+ $newinput ['share_picture'] = trim( $input ['share_picture'] );
4428
+ $updated .= __( 'Option "Share Picture" Updated!', 'yop_poll' ) . $message_delimiter;
4429
  }
4430
  }
4431
+ }
4432
  }
4433
  else {
4434
  $newinput ['share_after_vote'] = $default_options ['share_after_vote'];
4435
+ $errors .= __( 'Option "Share After Vote" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4436
+ }
4437
  }
4438
 
4439
  //start_scheduler
4440
+ if ( isset ( $input ['start_scheduler'] ) ){
4441
+ if ( in_array( $input ['start_scheduler'], array( 'yes', 'no' ) ) ){
4442
+ if ( $default_options ['start_scheduler'] != trim( $input ['start_scheduler'] ) ){
4443
+ $newinput ['start_scheduler'] = trim( $input ['start_scheduler'] );
4444
+ $updated .= __( 'Option "Start Scheduler" Updated!', 'yop_poll' ) . $message_delimiter;
4445
+ }
 
 
 
4446
  }
4447
  else {
4448
  $newinput ['start_scheduler'] = $default_options ['start_scheduler'];
4449
+ $errors .= __( 'Option "Start Scheduler" Not Updated! Please choose between \'yes\' or \'no\'', 'yop_poll' ) . $message_delimiter;
4450
+ }
4451
  }
4452
  }
4453
  else {
4454
+ $errors .= __( 'Bad Request!', 'yop_poll' ) . $message_delimiter;
4455
  }
4456
 
4457
+ if ( '' != $errors )
4458
+ add_settings_error( 'general', 'yop-poll-errors', $errors, 'error' );
4459
+ if ( '' != $updated )
4460
+ add_settings_error( 'general', 'yop-poll-updates', $updated, 'updated' );
4461
 
4462
  return $newinput;
4463
  }
4464
+
4465
  public function view_yop_poll_options() {
4466
+ require_once( ABSPATH . '/wp-admin/options-head.php' );
4467
  global $page;
4468
+ $default_options = get_option( 'yop_poll_options', array() );
4469
+ $pro_options = get_option( 'yop_poll_pro_options' );
4470
  ?>
4471
  <div class="wrap">
4472
  <div class="icon32 icon32-yop-poll">
4475
  </div>
4476
  <h2><?php _e( 'Yop Poll Options', 'yop_poll' ); ?></h2>
4477
  <div id="message"></div>
4478
+ <br/>
4479
 
4480
  <form action="options.php" method="post">
4481
  <div id="poststuff">
4482
  <div id="post-body" class="metabox-holder columns-2">
4483
  <div id="post-body-content">
4484
+ <?php settings_fields( 'yop_poll_options' ); ?>
4485
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
4486
  <div class="postbox" id="yop-poll-advanced-options-div1">
4487
  <div title="Click to toggle" class="handlediv">
4488
+ <br/>
4489
  </div>
4490
  <h3 class="hndle">
4491
  <span><?php _e( 'Answers options', 'yop_poll' ); ?></span>
4499
  </th>
4500
  <td><label for="yop-poll-allow-other-answers-no"><input
4501
  id="yop-poll-allow-other-answers-no"
4502
+ <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4503
  type="radio" name="yop_poll_options[allow_other_answers]"
4504
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4505
  for="yop-poll-allow-other-answers-yes"><input
4506
  id="yop-poll-allow-other-answers-yes"
4507
+ <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
4508
  type="radio" name="yop_poll_options[allow_other_answers]"
4509
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4510
  </tr>
4511
+ <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4512
  <th>
4513
  <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
4514
  </th>
4515
  <td><input id="yop-poll-other-answers-label" type="text"
4516
  name="yop_poll_options[other_answers_label]"
4517
+ value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>"/>
4518
  <input type="hidden"
4519
  name="yop_poll_options[other_answers_id]"
4520
+ value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>"/>
4521
  </td>
4522
  </tr>
4523
+ <tr class="yop_poll_suboption" id="yop-poll-other-answers-to-results-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4524
  <th>
4525
+ <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>
4526
+ :<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>
4527
  </th>
4528
  <td>
4529
  <label for="yop-poll-add-other-answers-to-default-answers-no"><input
4530
  id="yop-poll-add-other-answers-to-default-answers-no"
4531
+ <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4532
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4533
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4534
  for="yop-poll-add-other-answers-to-default-answers-yes"><input
4535
  id="yop-poll-add-other-answers-to-default-answers-yes"
4536
+ <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
4537
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
4538
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4539
  </td>
4540
  </tr>
4541
+ <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
4542
  <th>
4543
  <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
4544
  </th>
4545
  <td><label for="yop-poll-display-other-answers-values-no"><input
4546
  id="yop-poll-display-other-answers-values-no"
4547
+ <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4548
  type="radio"
4549
  name="yop_poll_options[display_other_answers_values]"
4550
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4551
  for="yop-poll-display-other-answers-values-yes"><input
4552
  id="yop-poll-display-other-answers-values-yes"
4553
+ <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
4554
  type="radio"
4555
  name="yop_poll_options[display_other_answers_values]"
4556
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4557
  </tr>
4558
  <tr>
4559
  <th>
4561
  </th>
4562
  <td><label for="yop-poll-allow-multiple-answers-no"><input
4563
  id="yop-poll-allow-multiple-answers-no"
4564
+ <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
4565
  type="radio"
4566
+ name="yop_poll_options[allow_multiple_answers]" value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label>
4567
  <label for="yop-poll-allow-multiple-answers-yes"><input
4568
  id="yop-poll-allow-multiple-answers-yes"
4569
+ <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
4570
  type="radio"
4571
+ name="yop_poll_options[allow_multiple_answers]" value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
4572
 
4573
  </td>
4574
  </tr>
4575
+ <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
4576
  <th>
4577
  <?php _e( 'Max Number of allowed answers', 'yop_poll' ); ?>:
4578
  </th>
4579
  <td><input id="yop-poll-allow-multiple-answers-number"
4580
  type="text"
4581
  name="yop_poll_options[allow_multiple_answers_number]"
4582
+ value="<?php echo $default_options['allow_multiple_answers_number']; ?>"/>
4583
  </td>
4584
  </tr>
4585
+ <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
4586
  <th>
4587
  <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
4588
  </th>
4589
  <td><input id="yop-poll-allow-multiple-answers-min-number"
4590
  type="text"
4591
  name="yop_poll_options[allow_multiple_answers_min_number]"
4592
+ value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>"/>
4593
  </td>
4594
  </tr>
4595
  </tbody>
4598
  </div>
4599
  <div class="postbox" id="yop-poll-advanced-options-div2">
4600
  <div title="Click to toggle" class="handlediv">
4601
+ <br/>
4602
  </div>
4603
  <h3 class="hndle">
4604
  <span><?php _e( 'Display Options', 'yop_poll' ); ?></span>
4612
  </th>
4613
  <td><label for="yop-poll-use-captcha-no"><input
4614
  id="yop-poll-use-captcha-no"
4615
+ <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
4616
  type="radio" name="yop_poll_options[use_captcha]"
4617
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4618
  for="yop-poll-use-captcha-yes"><input
4619
  id="yop-poll-use-captcha-yes"
4620
+ <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
4621
  type="radio" name="yop_poll_options[use_captcha]"
4622
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4623
  </tr>
4624
  <tr>
4625
  <th>
4627
  </th>
4628
  <td><label for="yop-poll-display-answers-vertical"><input
4629
  id="yop-poll-display-answers-vertical"
4630
+ <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
4631
  type="radio" name="yop_poll_options[display_answers]"
4632
+ value="vertical"/> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
4633
  <label for="yop-poll-display-answers-orizontal"><input
4634
  id="yop-poll-display-answers-orizontal"
4635
+ <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
4636
  type="radio" name="yop_poll_options[display_answers]"
4637
+ value="orizontal"/> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
4638
  <label for="yop-poll-display-answers-tabulated"><input
4639
  id="yop-poll-display-answers-tabulated"
4640
+ <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
4641
  type="radio" name="yop_poll_options[display_answers]"
4642
+ value="tabulated"/> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
4643
  </td>
4644
  </tr>
4645
+ <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
4646
  <th>
4647
  <?php _e( 'Columns', 'yop_poll' ); ?>:
4648
  </th>
4649
  <td><input id="yop-poll-display-answers-tabulated-cols"
4650
  type="text"
4651
  name="yop_poll_options[display_answers_tabulated_cols]"
4652
+ value="<?php echo $default_options['display_answers_tabulated_cols']; ?>"/>
4653
  </td>
4654
  </tr>
4655
  <tr>
4658
  </th>
4659
  <td><label for="yop-poll-display-results-vertical"><input
4660
  id="yop-poll-display-results-vertical"
4661
+ <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
4662
  type="radio" name="yop_poll_options[display_results]"
4663
  value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
4664
  <label for="yop-poll-display-results-orizontal"><input
4665
  id="yop-poll-display-results-orizontal"
4666
+ <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
4667
  type="radio" name="yop_poll_options[display_results]"
4668
  value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
4669
  <label for="yop-poll-display-results-tabulated"><input
4670
  id="yop-poll-display-results-tabulated"
4671
+ <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
4672
  type="radio" name="yop_poll_options[display_results]"
4673
  value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
4674
  </td>
4675
  </tr>
4676
+ <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
4677
  <th>
4678
  <?php _e( 'Columns', 'yop_poll' ); ?>:
4679
  </th>
4680
  <td><input id="yop-poll-display-results-tabulated-cols"
4681
  type="text"
4682
  name="yop_poll_options[display_results_tabulated_cols]"
4683
+ value="<?php echo $default_options['display_results_tabulated_cols']; ?>"/>
4684
  </td>
4685
  </tr>
4686
  <tr>
4690
  <td><input id="yop-poll-template-width"
4691
  type="text"
4692
  name="yop_poll_options[template_width]"
4693
+ value="<?php echo $default_options['template_width']; ?>"/>
4694
  </td>
4695
  </tr>
4696
  <tr>
4700
  <td><input id="yop-poll-widget-template-width"
4701
  type="text"
4702
  name="yop_poll_options[widget_template_width]"
4703
+ value="<?php echo $default_options['widget_template_width']; ?>"/>
4704
  </td>
4705
  </tr>
4706
  </tbody>
4709
  </div>
4710
  <div class="postbox" id="yop-poll-advanced-options-div3">
4711
  <div title="Click to toggle" class="handlediv">
4712
+ <br/>
4713
  </div>
4714
  <h3 class="hndle">
4715
  <span><?php _e( 'Poll Bar Style', 'yop_poll' ); ?></span>
4723
  </th>
4724
  <td><label for="yop-poll-use-template-bar-no"><input
4725
  id="yop-poll-use-template-bar-no"
4726
+ <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
4727
  type="radio" name="yop_poll_options[use_template_bar]"
4728
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
4729
  for="yop-poll-use-template-bar-yes"><input
4730
  id="yop-poll-use-template-bar-yes"
4731
+ <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
4732
  type="radio" name="yop_poll_options[use_template_bar]"
4733
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
4734
  </tr>
4735
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4736
+ <th><label for="yop-poll-bar-background"><?php _e( 'Background Color', 'yop_poll' ); ?></label>
4737
  </th>
4738
  <td>#<input class="yop-small-input"
4739
  id="yop-poll-bar-background"
4740
  value="<?php echo $default_options['bar_background']; ?>"
4741
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
4742
+ type="text" name="yop_poll_options[bar_background]"/>
4743
  </td>
4744
  </tr>
4745
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4746
+ <th><label for="yop-poll-bar-height"><?php _e( 'Height', 'yop_poll' ); ?></label>
4747
  </th>
4748
  <td><input class="yop-small-input" id="yop-poll-bar-height"
4749
  value="<?php echo $default_options['bar_height']; ?>"
4750
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
4751
+ type="text" name="yop_poll_options[bar_height]"/> px</td>
4752
  </tr>
4753
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4754
+ <th><label for="yop-poll-bar-border-color"><?php _e( 'Border Color', 'yop_poll' ) ?></label>
4755
  </th>
4756
  <td>#<input class="yop-small-input"
4757
  id="yop-poll-bar-border-color"
4758
  value="<?php echo $default_options['bar_border_color']; ?>"
4759
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
4760
+ type="text" name="yop_poll_options[bar_border_color]"/>
4761
  </td>
4762
  </tr>
4763
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4764
+ <th><label for="yop-poll-bar-border-width"><?php _e( 'Border Width', 'yop_poll' ); ?></label>
4765
  </th>
4766
  <td><input class="yop-small-input"
4767
  id="yop-poll-bar-border-width"
4768
  value="<?php echo $default_options['bar_border_width']; ?>"
4769
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
4770
+ type="text" name="yop_poll_options[bar_border_width]"/> px
4771
  </td>
4772
  </tr>
4773
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4774
+ <th><label for="yop-poll-bar-border-style"><?php _e( 'Border Style', 'yop_poll' ); ?></label>
4775
  </th>
4776
  <td><select id="yop-poll-bar-border-style"
4777
  onchange="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-style', this.value)"
4787
  value="dotted">Dotted</option>
4788
  </select></td>
4789
  </tr>
4790
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
4791
+ <th><label><?php _e( 'Yop Poll Bar Preview', 'yop_poll' ); ?></label>
4792
  </th>
4793
  <td>
4794
+ <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>
4795
+ px; background-color:#<?php
4796
 
4797
  echo $default_options ['bar_background'];
4798
+ ?>
4799
+ ; border-style: <?php echo $default_options['bar_border_style']; ?>
4800
+ ; border-width: <?php echo $default_options['bar_border_width']; ?>
4801
+ px; border-color: #<?php
4802
 
4803
  echo $default_options ['bar_border_color'];
4804
  ?>;"></div>
4810
  </div>
4811
  <div class="postbox" id="yop-poll-advanced-options-div4">
4812
  <div title="Click to toggle" class="handlediv">
4813
+ <br/>
4814
  </div>
4815
  <h3 class="hndle">
4816
  <span><?php _e( 'Sorting Answers &amp; Results', 'yop_poll' ); ?></span>
4822
  <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
4823
  <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
4824
  id="yop_poll_sorting_answers_exact"
4825
+ <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
4826
  type="radio" name="yop_poll_options[sorting_answers]"
4827
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
4828
  <label for="yop_poll_sorting_answers_alphabetical"><input
4829
  id="yop_poll_sorting_answers_alphabetical"
4830
+ <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
4831
  type="radio" name="yop_poll_options[sorting_answers]"
4832
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
4833
  <label for="yop_poll_sorting_answers_random"><input
4834
  id="yop_poll_sorting_answers_random"
4835
+ <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
4836
  type="radio" name="yop_poll_options[sorting_answers]"
4837
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
4838
  <label for="yop_poll_sorting_answers_votes"><input
4839
  id="yop_poll_sorting_answers_votes"
4840
+ <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
4841
  type="radio" name="yop_poll_options[sorting_answers]"
4842
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
4843
  </td>
4848
  </th>
4849
  <td><label for="yop_poll_sorting_answers_asc"><input
4850
  id="yop_poll_sorting_answers_asc"
4851
+ <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
4852
  type="radio"
4853
  name="yop_poll_options[sorting_answers_direction]"
4854
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
4855
  <label for="yop_poll_sorting_answers_desc"><input
4856
  id="yop_poll_sorting_answers_desc"
4857
+ <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
4858
  type="radio"
4859
  name="yop_poll_options[sorting_answers_direction]"
4860
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
4864
  <th><?php _e( 'Sorting Results', 'yop_poll' ); ?>:</th>
4865
  <td valign="top"><label for="yop_poll_sorting_results_exact"><input
4866
  id="yop_poll_sorting_results_exact"
4867
+ <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
4868
  type="radio" name="yop_poll_options[sorting_results]"
4869
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
4870
  <label for="yop_poll_sorting_results_alphabetical"><input
4871
  id="yop_poll_sorting_results_alphabetical"
4872
+ <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
4873
  type="radio" name="yop_poll_options[sorting_results]"
4874
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
4875
  <label for="yop_poll_sorting_results_random"><input
4876
  id="yop_poll_sorting_results_random"
4877
+ <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
4878
  type="radio" name="yop_poll_options[sorting_results]"
4879
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
4880
  <label for="yop_poll_sorting_results_votes"><input
4881
  id="yop_poll_sorting_results_votes"
4882
+ <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
4883
  type="radio" name="yop_poll_options[sorting_results]"
4884
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
4885
  </td>
4890
  </th>
4891
  <td><label for="yop_poll_sorting_results_asc"><input
4892
  id="yop_poll_sorting_results_asc"
4893
+ <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
4894
  type="radio"
4895
  name="yop_poll_options[sorting_results_direction]"
4896
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
4897
  <label for="yop_poll_sorting_results_desc"><input
4898
  id="yop_poll_sorting_results_desc"
4899
+ <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
4900
  type="radio"
4901
  name="yop_poll_options[sorting_results_direction]"
4902
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
4908
  </div>
4909
  <div class="postbox" id="yop-poll-advanced-options-div5">
4910
  <div title="Click to toggle" class="handlediv">
4911
+ <br/>
4912
  </div>
4913
  <h3 class="hndle">
4914
  <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
4917
  <table cellspacing="0" class="links-table">
4918
  <tbody>
4919
  <tr>
4920
+ <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
4921
+ :</label><br><font size="0">(<?php _e( 'Current Server Time', 'yop_poll' );
4922
+ echo ': ' . current_time( 'mysql' ); ?>)</font>
4923
  </th>
4924
  <td><input id="yop-poll-start-date-input" type="text"
4925
  name="yop_poll_options[start_date]"
4926
+ value="<?php echo '' == $default_options['start_date'] ? current_time( 'mysql' ) : $default_options['start_date']; ?>"/>
4927
  </td>
4928
  </tr>
4929
  <tr>
4930
+ <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>
4931
+ :</label><br><font size="0">(<?php _e( 'Current Server Time', 'yop_poll' );
4932
+ echo ': ' . current_time( 'mysql' ); ?>)</font>
4933
  </th>
4934
+ <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']; ?>"/>
4935
  <label for="yop-poll-never-expire"><input type="checkbox"
4936
+ <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
4937
  id="yop-poll-never-expire"
4938
+ name="yop_poll_options[never_expire]" value="yes"/> <?php _e( 'No End Date', 'yop_poll' ); ?></label>
4939
  </td>
4940
  </tr>
4941
  </tbody>
4944
  </div>
4945
  <div class="postbox" id="yop-poll-advanced-options-div6">
4946
  <div title="Click to toggle" class="handlediv">
4947
+ <br/>
4948
  </div>
4949
  <h3 class="hndle">
4950
  <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
4958
  </th>
4959
  <td><label for="yop-poll-view-results-before-vote"><input
4960
  class="yop-poll-view-results-hide-custom"
4961
+ <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4962
  id="yop-poll-view-results-before-vote" type="radio"
4963
+ value="before" name="yop_poll_options[view_results]"/> <?php _e( 'Before Vote', 'yop_poll' ); ?></label>
4964
  <label for="yop-poll-view-results-after-vote"><input
4965
  class="yop-poll-view-results-hide-custom"
4966
+ <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4967
  id="yop-poll-view-results-after-vote" type="radio"
4968
+ value="after" name="yop_poll_options[view_results]"/> <?php _e( 'After Vote', 'yop_poll' ); ?></label>
4969
  <label for="yop-poll-view-results-after-poll-end-date"><input
4970
  class="yop-poll-view-results-hide-custom"
4971
+ <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4972
  id="yop-poll-view-results-after-poll-end-date" type="radio"
4973
  value="after-poll-end-date"
4974
+ name="yop_poll_options[view_results]"/> <?php _e( 'After Poll End Date', 'yop_poll' ); ?></label>
4975
  <label for="yop-poll-view-results-never"><input
4976
  class="yop-poll-view-results-hide-custom"
4977
+ <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4978
  id="yop-poll-view-results-never" type="radio" value="never"
4979
+ name="yop_poll_options[view_results]"/> <?php _e( 'Never', 'yop_poll' ); ?></label>
4980
  <label for="yop-poll-view-results-custom"><input
4981
  class="yop-poll-view-results-show-custom"
4982
+ <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
4983
  id="yop-poll-view-results-custom" type="radio"
4984
+ value="custom-date" name="yop_poll_options[view_results]"/> <?php _e( 'Custom Date', 'yop_poll' ); ?></label>
4985
+ <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
4986
+ <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' ); ?>
4987
+ :</label>
4988
  <input id="yop-poll-view-results-start-date" type="text"
4989
  name="yop_poll_options[view_results_start_date]"
4990
  value="<?php echo $default_options['view_results_start_date']; ?>">
4996
  </th>
4997
  <td><label for="yop-poll-view-results-permissions-quest-only"><input
4998
  id="yop-poll-view-results-permissions-quest-only"
4999
+ <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5000
  type="radio" value="quest-only"
5001
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
5002
  <label for="yop-poll-view-results-permissions-registered-only"><input
5003
  id="yop-poll-view-results-permissions-registered-only"
5004
+ <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5005
  type="radio" value="registered-only"
5006
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
5007
  <label for="yop-poll-view-results-permissions-guest-registered"><input
5008
  id="yop-poll-view-results-permissions-guest-registered"
5009
+ <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
5010
  type="radio" value="guest-registered"
5011
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
5012
  </td>
5013
  </tr>
5014
  <tr>
5017
  </th>
5018
  <td><label for="yop-poll-view-results-votes-number"><input
5019
  id="yop-poll-view-results-votes-number"
5020
+ <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5021
  type="radio" value="votes-number"
5022
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'By Votes Number', 'yop_poll' ); ?></label>
5023
  <label for="yop-poll-view-results-percentages"><input
5024
  id="yop-poll-view-results-percentages"
5025
+ <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5026
  type="radio" value="percentages"
5027
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'Percentages', 'yop_poll' ); ?></label>
5028
  <label
5029
  for="yop-poll-view-results-votes-number-and-percentages"><input
5030
  id="yop-poll-view-results-votes-number-and-percentages"
5031
+ <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
5032
  type="radio" value="votes-number-and-percentages"
5033
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'by Votes Number and Percentages', 'yop_poll' ); ?></label>
5034
  </td>
5035
  </tr>
5036
  <tr>
5037
  <th>
5038
+ <?php _e( 'Poll Answer Result Label', 'yop_poll' ); ?>:
5039
  </th>
5040
  <td><input id="yop-poll-answer-result-label" type="text"
5041
  name="yop_poll_options[answer_result_label]"
5042
+ value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>"/>
5043
+ <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>
5044
  </td>
5045
  </tr>
5046
  <tr>
5047
  <th>
5048
+ <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>
5049
+ :
5050
  </th>
5051
  <td>
5052
  <?php _e( 'Singular', 'yop_poll' ); ?>
5054
  id="yop-poll-singular-answer-result-votes-number-label"
5055
  type="text"
5056
  name="yop_poll_options[singular_answer_result_votes_number_label]"
5057
+ value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>"/>
5058
  <?php _e( 'Plural', 'yop_poll' ); ?>
5059
  <input
5060
  id="yop-poll-plural-answer-result-votes-number-label"
5061
  type="text"
5062
  name="yop_poll_options[plural_answer_result_votes_number_label]"
5063
+ value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>"/>
5064
 
5065
  </td>
5066
  </tr>
5070
  </th>
5071
  <td><input id="yop-poll-vote-button-label" type="text"
5072
  name="yop_poll_options[vote_button_label]"
5073
+ value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>"/>
5074
  </td>
5075
  </tr>
5076
  <tr>
5078
  <?php _e( 'View Results Link', 'yop_poll' ); ?>:
5079
  </th>
5080
  <td><label for="yop-poll-view-results-link-yes"><input
5081
+ <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5082
  id="yop-poll-view-results-link-yes" type="radio"
5083
+ value="yes" name="yop_poll_options[view_results_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5084
  <label for="yop-poll-view-results-link-no"><input
5085
+ <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
5086
  id="yop-poll-view-results-link-no" type="radio" value="no"
5087
+ name="yop_poll_options[view_results_link]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5088
  </td>
5089
  </tr>
5090
+ <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
5091
  <th>
5092
  <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
5093
  </th>
5094
  <td><input id="yop-poll-view-results-link-label" type="text"
5095
  name="yop_poll_options[view_results_link_label]"
5096
+ value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>"/>
5097
  </td>
5098
  </tr>
5099
  <tr>
5101
  <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
5102
  </th>
5103
  <td><label for="yop-poll-view-back-to-vote-link-yes"><input
5104
+ <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5105
  id="yop-poll-view-back-to-vote-link-yes" type="radio"
5106
+ value="yes" name="yop_poll_options[view_back_to_vote_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5107
  <label for="yop-poll-view-back-to-vote-link-no"><input
5108
+ <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
5109
  id="yop-poll-view-back-to-vote-link-no" type="radio"
5110
+ value="no" name="yop_poll_options[view_back_to_vote_link]"/><?php _e( 'No', 'yop_poll' ); ?></label>
5111
  </td>
5112
  </tr>
5113
+ <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;' : ''; ?>">
5114
  <th>
5115
  <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
5116
  </th>
5117
  <td><input id="yop-poll-view-back-to-vote-link-label"
5118
  type="text"
5119
  name="yop_poll_options[view_back_to_vote_link_label]"
5120
+ value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>"/>
5121
  </td>
5122
  </tr>
5123
  <tr>
5125
  <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
5126
  </th>
5127
  <td><label for="yop-poll-view-total-votes-yes"><input
5128
+ <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5129
  id="yop-poll-view-total-votes-yes" type="radio" value="yes"
5130
+ name="yop_poll_options[view_total_votes]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5131
  <label for="yop-poll-view-total-votes-no"><input
5132
+ <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
5133
  id="yop-poll-view-total-votes-no" type="radio" value="no"
5134
+ name="yop_poll_options[view_total_votes]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5135
  </td>
5136
  </tr>
5137
+ <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
5138
  <th>
5139
  <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
5140
  </th>
5141
  <td><input id="yop-poll-view-total-votes-label" type="text"
5142
  name="yop_poll_options[view_total_votes_label]"
5143
+ value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>"/>
5144
  </td>
5145
  </tr>
5146
  <tr>
5148
  <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
5149
  </th>
5150
  <td><label for="yop-poll-view-total-answers-yes"><input
5151
+ <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5152
  id="yop-poll-view-total-answers-yes" type="radio"
5153
+ value="yes" name="yop_poll_options[view_total_answers]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5154
  <label for="yop-poll-view-total-answers-no"><input
5155
+ <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
5156
  id="yop-poll-view-total-answers-no" type="radio" value="no"
5157
+ name="yop_poll_options[view_total_answers]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5158
  </td>
5159
  </tr>
5160
+ <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
5161
  <th>
5162
  <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
5163
  </th>
5164
  <td><input id="yop-poll-view-total-answers-label" type="text"
5165
  name="yop_poll_options[view_total_answers_label]"
5166
+ value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>"/>
5167
  </td>
5168
  </tr>
5169
  <tr>
5172
  </th>
5173
  <td><input id="yop-poll-message-after-vote" type="text"
5174
  name="yop_poll_options[message_after_vote]"
5175
+ value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>"/>
5176
  </td>
5177
  </tr>
5178
  <tr>
5179
+ <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>
5180
+ :</label>
5181
  </th>
5182
  <td><input id="yop-poll-page-url" type="text"
5183
  name="yop_poll_options[poll_page_url]"
5184
+ value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>"/>
5185
  </td>
5186
  </tr>
5187
  </tbody>
5190
  </div>
5191
  <div class="postbox" id="yop-poll-advanced-options-div7">
5192
  <div title="Click to toggle" class="handlediv">
5193
+ <br/>
5194
  </div>
5195
  <h3 class="hndle">
5196
  <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
5204
  </th>
5205
  <td><label for="yop-poll-vote-permisions-quest-only"><input
5206
  id="yop-poll-vote-permisions-quest-only"
5207
+ <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5208
  type="radio" value="quest-only"
5209
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
5210
  <label for="yop-poll-vote-permisions-registered-only"><input
5211
  id="yop-poll-vote-permisions-registered-only"
5212
+ <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5213
  type="radio" value="registered-only"
5214
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
5215
  <label for="yop-poll-vote-permisions-guest-registered"><input
5216
  id="yop-poll-vote-permisions-guest-registered"
5217
+ <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
5218
  type="radio" value="guest-registered"
5219
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
5220
  </td>
5221
  </tr>
5222
+ <?php if ( false ){ ?>
5223
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5224
  <th>
5225
  <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
5226
+ <?php if ($pro_options['pro_user'] == 'no') { ?>
5227
+ <br/><font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
5228
+ )</font>
5229
  <?php } ?></label>
5230
  </th>
5231
  <td><label for="yop-poll-vote-permisions-facebook-yes"><input
5232
+ <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5233
  id="yop-poll-vote-permisions-facebook-yes" type="radio"
5234
+ value="yes" name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5235
  <label for="yop-poll-vote-permisions-facebook-no"><input
5236
+ <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
5237
  id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
5238
+ name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5239
  </td>
5240
  </tr>
5241
 
5242
+ <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;' : ''; ?>">
5243
  <th>
5244
+ <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>
5245
+ :
5246
  </th>
5247
  <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
5248
  name="yop_poll_options[vote_permisions_facebook_label]"
5249
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>"/>
5250
  </td>
5251
  </tr>
5252
+ <?php } ?>
5253
 
5254
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5255
  <th>
5256
+ <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?>
5257
+ <br><font size="0">(<?php _e( 'Will force users to login into your blog', 'yop_poll' ); ?>
5258
+ )</font>:
5259
  </th>
5260
  <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
5261
+ <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5262
  id="yop-poll-vote-permisions-wordpress-yes" type="radio"
5263
+ value="yes" name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5264
  <label for="yop-poll-vote-permisions-wordpress-no"><input
5265
+ <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
5266
  id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
5267
+ name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5268
  </td>
5269
  </tr>
5270
+ <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;' : ''; ?>">
5271
  <th>
5272
+ <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>
5273
+ :
5274
  </th>
5275
  <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
5276
  name="yop_poll_options[vote_permisions_wordpress_label]"
5277
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>"/>
5278
  </td>
5279
+ </tr>
5280
 
5281
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
5282
  <th>
5283
+ <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?>
5284
+ <br><font size="0">(<?php _e( 'Logged users will be treated as anonymous', 'yop_poll' ); ?>
5285
+ )</font>:
5286
  </th>
5287
  <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
5288
+ <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5289
  id="yop-poll-vote-permisions-anonymous-yes" type="radio"
5290
+ value="yes" name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5291
  <label for="yop-poll-vote-permisions-anonymous-no"><input
5292
+ <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
5293
  id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
5294
+ name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5295
  </td>
5296
+ </tr>
5297
+ <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;' : ''; ?>">
5298
  <th>
5299
+ <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>
5300
+ :
5301
  </th>
5302
  <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
5303
  name="yop_poll_options[vote_permisions_anonymous_label]"
5304
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>"/>
5305
  </td>
5306
  </tr>
5307
 
5311
  </th>
5312
  <td><label for="yop-poll-blocking-voters-dont-block"><input
5313
  class="yop-poll-blocking-voters-hide-interval"
5314
+ <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5315
  id="yop-poll-blocking-voters-dont-block" type="radio"
5316
+ value="dont-block" name="yop_poll_options[blocking_voters]"/> <?php _e( 'Dont`t Block', 'yop_poll' ); ?></label>
5317
  <label for="yop-poll-blocking-voters-cookie"><input
5318
  class="yop-poll-blocking-voters-show-interval"
5319
+ <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5320
  id="yop-poll-blocking-voters-cookie" type="radio"
5321
+ value="cookie" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie', 'yop_poll' ); ?></label>
5322
  <label for="yop-poll-blocking-voters-ip"><input
5323
  class="yop-poll-blocking-voters-show-interval"
5324
+ <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5325
  id="yop-poll-blocking-voters-ip" type="radio" value="ip"
5326
+ name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Ip', 'yop_poll' ); ?></label>
5327
  <label for="yop-poll-blocking-voters-username"><input
5328
  class="yop-poll-blocking-voters-show-interval"
5329
+ <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5330
  id="yop-poll-blocking-voters-username" type="radio"
5331
+ value="username" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Username', 'yop_poll' ); ?></label>
5332
  <label for="yop-poll-blocking-voters-cookie-ip"><input
5333
  class="yop-poll-blocking-voters-show-interval"
5334
+ <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
5335
  id="yop-poll-blocking-voters-cookie-ip" type="radio"
5336
+ value="cookie-ip" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie &amp; Ip', 'yop_poll' ); ?></label>
5337
  </td>
5338
  </tr>
5339
+ <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
5340
  <th>
5341
  <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
5342
  </th>
5343
  <td><input type="text"
5344
  name="yop_poll_options[blocking_voters_interval_value]"
5345
  id="yop-poll-blocking-voters-interval-value"
5346
+ value="<?php echo $default_options['blocking_voters_interval_value']; ?>"/>
5347
  <select id="yop-poll-blocking-voters-interval-unit"
5348
  name="yop_poll_options[blocking_voters_interval_unit]">
5349
  <option
5350
+ <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5351
  value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
5352
  <option
5353
+ <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5354
  value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
5355
  <option
5356
+ <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5357
  value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
5358
  <option
5359
+ <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
5360
  value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
5361
  </select></td>
5362
  </tr>
5363
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
5364
  <th>
5365
+ <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>
5366
+ :<br><small>(<?php _e( 'Only for logged users', 'yop_poll' ); ?>
5367
+ )</small>
5368
  </th>
5369
  <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
5370
+ <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5371
  id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
5372
+ value="yes" name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5373
  <label for="yop-poll-limit-number-of-votes-per-user-no"><input
5374
+ <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
5375
  id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
5376
+ name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5377
  </td>
5378
  </tr>
5379
  <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;' : '' ?>">
5382
  </th>
5383
  <td><input id="yop-poll-number-of-votes-per-user" type="text"
5384
  name="yop_poll_options[number_of_votes_per_user]"
5385
+ value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>"/>
5386
  </td>
5387
  </tr>
5388
  <tr>
5391
  </th>
5392
  <td><input id="yop-poll-percentages-decimals" type="text"
5393
  name="yop_poll_options[percentages_decimals]"
5394
+ value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>"/>
5395
  </td>
5396
  </tr>
5397
  <tr>
5399
  <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
5400
  </th>
5401
  <td><label for="yop-poll-use-default-loading-image-yes"><input
5402
+ <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5403
  id="yop-poll-use-default-loading-image-yes" type="radio"
5404
  value="yes"
5405
+ name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5406
  <label for="yop-poll-use-default-loading-image-no"><input
5407
+ <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
5408
  id="yop-poll-use-default-loading-image-no" type="radio"
5409
  value="no"
5410
+ name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5411
  </td>
5412
  </tr>
5413
+ <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;' : ''; ?>">
5414
  <th>
5415
  <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
5416
  </th>
5417
  <td><input id="yop-poll-loading-image-url" type="text"
5418
  name="yop_poll_options[loading_image_url]"
5419
+ value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>"/>
5420
  </td>
5421
  </tr>
5422
 
5425
  <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
5426
  </th>
5427
  <td><label for="yop-poll-redirect-after-vote-yes"><input
5428
+ <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5429
  id="yop-poll-redirect-after-vote-yes" type="radio"
5430
  value="yes"
5431
+ name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5432
  <label for="yop-poll-redirect-after-vote-no"><input
5433
+ <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
5434
  id="yop-poll-redirect-after-vote-no" type="radio"
5435
  value="no"
5436
+ name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5437
  </td>
5438
  </tr>
5439
+ <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
5440
  <th>
5441
  <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
5442
  </th>
5443
  <td><input id="yop-poll-redirect-after-vote-url" type="text"
5444
  name="yop_poll_options[redirect_after_vote_url]"
5445
+ value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>"/>
5446
  </td>
5447
  </tr>
5448
  <tr>
5449
  <th>
5450
+ <?php _e( 'Poll Date Format', 'yop_poll' ); ?>
5451
+ : <br/><font size="0"><?php _e( 'Check', 'yop_popll' ) ?>
5452
+ <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e( 'documentation', 'yop_popll' ) ?></a></font>
5453
  </th>
5454
  <td><input id="yop-poll-date-format" type="text"
5455
  name="yop_poll_options[date_format]"
5456
+ value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>"/>
5457
  </td>
5458
  </tr>
5459
  </tbody>
5462
  </div>
5463
  <div class="postbox" id="yop-poll-advanced-options-div8">
5464
  <div title="Click to toggle" class="handlediv">
5465
+ <br/>
5466
  </div>
5467
  <h3 class="hndle">
5468
  <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
5477
  <td><input
5478
  <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
5479
  id="yop-poll-view-poll-archive-link-yes" type="radio"
5480
+ value="yes" name="yop_poll_options[view_poll_archive_link]"/><label
5481
+ for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5482
  <input
5483
  <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
5484
  id="yop-poll-view-poll-archive-link-no" type="radio"
5485
+ value="no" name="yop_poll_options[view_poll_archive_link]"/><label
5486
+ for="yop-poll-view-poll-archive-link-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5487
  </td>
5488
  </tr>
5489
+ <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;' : ''; ?>">
5490
  <th>
5491
  <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
5492
  </th>
5493
  <td><input id="yop-poll-view-poll-archive-link-label"
5494
  type="text"
5495
  name="yop_poll_options[view_poll_archive_link_label]"
5496
+ value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>"/>
5497
  </td>
5498
  </tr>
5499
+ <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
5500
  <th>
5501
  <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
5502
  </th>
5503
  <td><input id="yop-poll-poll-archive-url" type="text"
5504
  name="yop_poll_options[poll_archive_url]"
5505
+ value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>"/>
5506
  </td>
5507
  </tr>
5508
  <tr>
5512
  <td><label for="yop-poll-show-in-archive-yes"><input
5513
  <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
5514
  id="yop-poll-show-in-archive-yes" type="radio" value="yes"
5515
+ name="yop_poll_options[show_in_archive]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
5516
  <label for="yop-poll-show-in-archive-no"><input
5517
  <?php checked( 'no', $default_options['show_in_archive'] ); ?>
5518
  id="yop-poll-show-in-archive-no" type="radio" value="no"
5519
+ name="yop_poll_options[show_in_archive]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
5520
  </td>
5521
  </tr>
5522
+ <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
5523
  <th>
5524
  <?php _e( 'Archive Order', 'yop_poll' ); ?>:
5525
  </th>
5526
  <td><input id="yop-poll-show-in-archive-order" type="text"
5527
  name="yop_poll_options[archive_order]"
5528
+ value="<?php echo $default_options['archive_order']; ?>"/>
5529
  </td>
5530
  </tr>
5531
  <tr>
5534
  </th>
5535
  <td><input id="yop-poll-archive-polls-per-page" type="text"
5536
  name="yop_poll_options[archive_polls_per_page]"
5537
+ value="<?php echo $default_options['archive_polls_per_page']; ?>"/>
5538
  </td>
5539
  </tr>
5540
 
5544
 
5545
  <div class="postbox" id="yop-poll-advanced-options-div8">
5546
  <div title="Click to toggle" class="handlediv">
5547
+ <br/>
5548
  </div>
5549
  <h3 class="hndle">
5550
  <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
5558
  </th>
5559
  <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
5560
  id="yop-poll-send-email-notifications-yes" type="radio"
5561
+ value="yes" name="yop_poll_options[send_email_notifications]"/><label
5562
+ for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5563
  <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
5564
  id="yop-poll-send-email-notifications-no" type="radio"
5565
+ value="no" name="yop_poll_options[send_email_notifications]"/><label
5566
+ for="yop-poll-send-email-notifications-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5567
  </td>
5568
  </tr>
5569
+ <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;' : ''; ?>">
5570
  <th>
5571
  <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
5572
  </th>
5574
  <input id="yop-poll-email-notifications-from-name"
5575
  type="text"
5576
  name="yop_poll_options[email_notifications_from_name]"
5577
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>"/>
5578
  </td>
5579
  </tr>
5580
+ <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;' : ''; ?>">
5581
  <th>
5582
  <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
5583
  </th>
5585
  <input id="yop-poll-email-notifications-from-email"
5586
  type="text"
5587
  name="yop_poll_options[email_notifications_from_email]"
5588
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>"/>
5589
  </td>
5590
  </tr>
5591
+ <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;' : ''; ?>">
5592
  <th>
5593
+ <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>
5594
+ :<br><font size="0"><?php _e( 'Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll' ) ?></font>
5595
  </th>
5596
  <td valign="top">
5597
  <input id="yop-poll-email-notifications-recipients"
5598
  type="text"
5599
  name="yop_poll_options[email_notifications_recipients]"
5600
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>"/>
5601
  </td>
5602
  </tr>
5603
+ <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;' : ''; ?>">
5604
  <th>
5605
  <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
5606
  </th>
5612
  />
5613
  </td>
5614
  </tr>
5615
+ <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;' : ''; ?>">
5616
  <th>
5617
  <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
5618
  </th>
5625
  </div>
5626
  </div>
5627
 
5628
+ <?php if ( false ){ ?>
5629
  <div class="postbox" id="yop-poll-advanced-options-div9">
5630
  <div title="Click to toggle" class="handlediv">
5631
+ <br/>
5632
  </div>
5633
  <h3 class="hndle">
5634
  <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
5635
+ <?php if ( $pro_options['pro_user'] == 'no' ){ ?>
5636
+ <font size="-1">(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
5637
+ )</font>
5638
  <?php } ?>
5639
  </span>
5640
  </h3>
5648
  <td><input
5649
  <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
5650
  id="yop-poll-share-after-vote-yes" type="radio"
5651
+ value="yes" name="yop_poll_options[share_after_vote]"/><label
5652
+ for="yop-poll-share-after-vote-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5653
  <input
5654
  <?php checked( 'no', $default_options['share_after_vote'] ); ?>
5655
  id="yop-poll-share-after-vote-no" type="radio"
5656
+ value="no" name="yop_poll_options[share_after_vote]"/><label
5657
+ for="yop-poll-share-after-vote-no"><?php _e( 'No', 'yop_poll' ); ?></label>
5658
  </td>
5659
  </tr>
5660
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5661
  <th>
5662
  <?php _e( 'Share Name', 'yop_poll' ); ?>:
5663
  </th>
5664
  <td><input id="yop-poll-share-name"
5665
  type="text"
5666
  name="yop_poll_options[share_name]"
5667
+ value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>"/>
5668
  </td>
5669
+ </tr>
5670
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5671
  <th>
5672
  <?php _e( 'Share Caption', 'yop_poll' ); ?>:
5673
  </th>
5674
  <td><input id="yop-poll-share-caption"
5675
  type="text"
5676
  name="yop_poll_options[share_caption]"
5677
+ value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>"/>
5678
  </td>
5679
  </tr>
5680
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5681
  <th>
5682
  <?php _e( 'Share Description', 'yop_poll' ); ?>:
5683
  </th>
5684
  <td><input id="yop-poll-share-description"
5685
  type="text"
5686
  name="yop_poll_options[share_description]"
5687
+ value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>"/>
5688
  </td>
5689
+ </tr>
5690
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
5691
  <th>
5692
  <?php _e( 'Share Picture', 'yop_poll' ); ?>:
5693
  </th>
5694
  <td><input id="yop-poll-share-picture"
5695
  type="text"
5696
  name="yop_poll_options[share_picture]"
5697
+ value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>"/>
5698
  </td>
5699
+ </tr>
5700
 
5701
  </table>
5702
  </div>
5704
  <?php } ?>
5705
  </div>
5706
  <input name="Submit" class="button-primary" type="submit"
5707
+ value="<?php _e( 'Save Changes', 'yop_poll' ); ?>"/>
5708
  </div>
5709
 
5710
  <div class="postbox-container" id="postbox-container-1">
5711
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
5712
  <div class="postbox " id="linksubmitdiv">
5713
  <div title="Click to toggle" class="handlediv">
5714
+ <br/>
5715
  </div>
5716
  <h3 class="hndle">
5717
+ <span><?php _e( 'Save Changes', 'yop_poll' ); ?></span>
5718
  </h3>
5719
  <div class="inside">
5720
  <div id="submitlink" class="submitbox">
5723
 
5724
  <div id="publishing-action">
5725
  <input name="Submit" class="button-primary" type="submit"
5726
+ value="<?php _e( 'Save Changes', 'yop_poll' ); ?>"/>
5727
  </div>
5728
  <div class="clear"></div>
5729
  </div>
5740
 
5741
  <?php
5742
  }
5743
+
5744
  public function view_add_edit_new_poll() {
5745
  global $yop_poll_add_new_config, $action, $current_user;
5746
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
5747
+ $yop_poll_model = new Yop_Poll_Model ();
5748
+ $page_name = __( 'Add New Yop Poll', 'yop_poll' );
5749
+ $action_type = 'add-new';
5750
+ $poll_id = '';
5751
+ $default_options = get_option( 'yop_poll_options', array() );
5752
+ if ( 'edit' == $action ){
5753
+ $poll_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
5754
+ $poll_author = Yop_Poll_Model::get_poll_field_from_database_by_id( 'poll_author', $poll_id );
5755
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_author != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
5756
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
5757
+ $yop_poll_model = new Yop_Poll_Model ( $poll_id );
5758
+ $answers = Yop_Poll_Model::get_poll_answers( $poll_id );
5759
+ $other_answer = Yop_Poll_Model::get_poll_answers( $poll_id, array( 'other' ) );
5760
+ $custom_fields = Yop_Poll_Model::get_poll_customfields( $poll_id );
5761
+ $page_name = __( 'Edit Poll', 'yop_poll' );
5762
+ $action_type = 'edit';
5763
+ $poll_default_options = get_yop_poll_meta( $poll_id, 'options', true );
 
 
5764
  foreach ( $default_options as $option_name => $option_value ) {
5765
+ if ( isset ( $poll_default_options [$option_name] ) ){
5766
  $default_options [$option_name] = $poll_default_options [$option_name];
5767
  }
5768
  }
5769
  }
5770
+ $current_poll = $yop_poll_model->get_current_poll();
5771
+ $answers_number = $yop_poll_add_new_config ['default_number_of_answers'];
5772
  $customfields_number = $yop_poll_add_new_config ['default_number_of_customfields'];
5773
  ?>
5774
  <div class="wrap">
5776
  <br>
5777
 
5778
  </div>
5779
+ <h2><?php print $page_name; ?><?php if ('edit' == $action): ?><a
5780
  class="add-new-h2"
5781
  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>
5782
  <div id="message"></div>
5783
  <form method="post" name="yop_poll_edit_add_new_form"
5784
  id="yop-poll-edit-add-new-form">
5785
  <?php wp_nonce_field( 'yop-poll-edit-add-new' ); ?>
5786
+ <span <?php if ( 'edit' != $action ){ ?> style="display: none;"
5787
  <?php } ?>> Shortcode: <input id="yop_poll_shortcode" type="text"
5788
  value='[yop_poll id="<?php echo $current_poll['id']; ?>"]'
5789
  readonly="readonly">
5798
  <div class="inside">
5799
  <input type="text" id="yop-poll-name"
5800
  value="<?php echo esc_html( stripslashes( $current_poll['name'] ) ); ?>"
5801
+ tabindex="1" name="yop_poll_name" size="30"/>
5802
  <p><?php _e( 'Example: Test Poll', 'yop_poll' ); ?></p>
5803
  </div>
5804
  </div>
5809
  <div class="inside">
5810
  <input type="text" id="yop-poll-question"
5811
  value="<?php echo esc_html( stripslashes( $current_poll['question'] ) ); ?>"
5812
+ tabindex="1" name="yop_poll_question" size="30"/>
5813
  <p><?php _e( 'Example: How is my plugin?', 'yop_poll' ); ?></p>
5814
  </div>
5815
  </div>
5822
  id='yop-poll-answer-table'>
5823
  <tbody>
5824
  <?php
5825
+ for ($answer_id = 1;
5826
+ $answer_id < $answers_number;
5827
+ $answer_id++) {
5828
+ if ( isset ( $answers [$answer_id - 1] ) ){
5829
+ $answer_options = get_yop_poll_answer_meta( $answers [$answer_id - 1] ['id'], 'options' );
5830
  }
5831
  ?>
5832
  <tr class="yop_poll_tr_answer"
5834
  <th scope="row"><label class="yop_poll_answer_label"
5835
  for="yop-poll-answer<?php echo $answer_id ?>"><?php echo $yop_poll_add_new_config['text_answer']; ?> <?php echo $answer_id ?></label></th>
5836
  <td><input type="hidden"
5837
+ value="<?php echo isset( $answers[$answer_id - 1]['id'] ) ? $answers[$answer_id - 1]['id'] : ''; ?>"
5838
+ name="yop_poll_answer_ids[answer<?php echo $answer_id ?>]"/>
5839
  <input type="text"
5840
+ value="<?php echo isset( $answers[$answer_id - 1]['answer'] ) ? esc_html( stripslashes( $answers[$answer_id - 1]['answer'] ) ) : ''; ?>"
5841
  id="yop-poll-answer<?php echo $answer_id ?>"
5842
+ name="yop_poll_answer[answer<?php echo $answer_id ?>]"/></td>
5843
  <td align="right">
5844
+ <?php if ( 'edit' == $action ){ ?>
5845
  <input type="button"
5846
+ value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $answers[$answer_id - 1]['votes'] ?>)"
5847
  onclick="yop_poll_show_change_votes_number_answer(<?php echo $answers [$answer_id - 1] ['id'] ?>); return false;"
5848
+ class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $answers [$answer_id - 1] ['id'] ?>"/>
5849
  <?php } ?>
5850
  <input type="button"
5851
+ value="<?php echo $yop_poll_add_new_config['text_customize_answer']; ?>"
5852
  onclick="yop_poll_toogle_customize_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
5853
+ class="button"/>
5854
  <input
5855
  onclick="yop_poll_remove_answer('#yop-poll-answer-table', <?php echo $answer_id ?>); return false;"
5856
  type="button"
5857
+ value="<?php echo $yop_poll_add_new_config['text_remove_answer']; ?>"
5858
+ class="button"/></td>
5859
  </tr>
5860
  <tr class="yop_poll_tr_customize_answer"
5861
  id="yop_poll_tr_customize_answer<?php echo $answer_id ?>"
5865
  <tbody>
5866
  <tr>
5867
  <th>
5868
+ <?php echo $yop_poll_add_new_config['text_is_default_answer']; ?>
5869
+ :
5870
  </th>
5871
  <td valign="top"><input
5872
  id="yop-poll-is-default-answer-no-<?php echo $answer_id ?>"
5873
  <?php echo checked( 'no', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
5874
  type="radio"
5875
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
5876
+ value="no"/> <label
5877
  for="yop-poll-id-default-answer-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
5878
  <input
5879
  id="yop-poll-is-default-answer-yes-<?php echo $answer_id ?>"
5880
  <?php echo checked( 'yes', isset ( $answer_options[0]['is_default_answer'] ) ? $answer_options[0]['is_default_answer'] : $default_options['is_default_answer'] ); ?>
5881
  type="radio"
5882
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][is_default_answer]"
5883
+ value="yes"/> <label
5884
  for="yop-poll-id-default-answer-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5885
  </td>
5886
  </tr>
5890
  <tbody>
5891
  <tr>
5892
  <th>
5893
+ <?php echo $yop_poll_add_new_config['text_poll_bar_style']['use_template_bar_label']; ?>
5894
+ :
5895
  </th>
5896
  <td><input
5897
  onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').show();"
5899
  <?php echo checked( 'no', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
5900
  type="radio"
5901
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
5902
+ value="no"/> <label
5903
  for="yop-poll-answer-use-template-bar-no-<?php echo $answer_id ?>"><?php _e( 'No', 'yop_poll' ); ?></label>&nbsp;|&nbsp;
5904
  <input
5905
  onclick="jQuery('#yop-poll-answer-use-template-bar-table-<?php echo $answer_id ?>').hide();"
5907
  <?php echo checked( 'yes', isset ( $answer_options[0]['use_template_bar'] ) ? $answer_options[0]['use_template_bar'] : $default_options['use_template_bar'] ); ?>
5908
  type="radio"
5909
  name="yop_poll_answer_options[answer<?php echo $answer_id ?>][use_template_bar]"
5910
+ value="yes"/> <label
5911
  for="yop-poll-answer-use-template-bar-yes-<?php echo $answer_id ?>"><?php _e( 'Yes', 'yop_poll' ); ?></label>
5912
  </td>
5913
  </tr>
5914
  </tbody>
5915
  </table>
5916
+ <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;' : '' ); ?>">
5917
  <tbody>
5918
  <tr>
5919
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_label']; ?></label>
5931
  value="<?php echo isset ( $answer_options[0]['bar_background'] ) ? $answer_options[0]['bar_background'] : $default_options['bar_background']; ?>"
5932
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'background-color', '#' + this.value)"
5933
  type="text"
5934
+ name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_background]"/>
5935
  </td>
5936
  </tr>
5937
  <tr>
5943
  value="<?php echo isset ( $answer_options[0]['bar_height'] ) ? $answer_options[0]['bar_height'] : $default_options['bar_height']; ?>"
5944
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'height', this.value + 'px')"
5945
  type="text"
5946
+ name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_height]"/>
5947
  px</td>
5948
  </tr>
5949
  <tr>
5955
  value="<?php echo isset ( $answer_options[0]['bar_border_color'] ) ? $answer_options[0]['bar_border_color'] : $default_options['bar_border_color']; ?>"
5956
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-color', '#' + this.value )"
5957
  type="text"
5958
+ name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_color]"/>
5959
  </td>
5960
  </tr>
5961
  <tr>
5967
  value="<?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>"
5968
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview<?php echo $answer_id ?>', 'border-width', this.value + 'px')"
5969
  type="text"
5970
+ name="yop_poll_answer_options[answer<?php echo $answer_id ?>][bar_border_width]"/>
5971
  px</td>
5972
  </tr>
5973
  <tr>
5997
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
5998
  </th>
5999
  <td>
6000
+ <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']; ?>
6001
+ px; background-color:#<?php
6002
 
6003
  echo isset ( $answer_options [0] ['bar_background'] ) ? $answer_options [0] ['bar_background'] : $default_options ['bar_background'];
6004
+ ?>
6005
+ ; border-style: <?php echo isset ( $answer_options[0]['bar_border_style'] ) ? $answer_options[0]['bar_border_style'] : $default_options['bar_border_style']; ?>
6006
+ ; border-width: <?php echo isset ( $answer_options[0]['bar_border_width'] ) ? $answer_options[0]['bar_border_width'] : $default_options['bar_border_width']; ?>
6007
+ px; border-color: #<?php
6008
 
6009
  echo isset ( $answer_options [0] ['bar_border_color'] ) ? $answer_options [0] ['bar_border_color'] : $default_options ['bar_border_color'];
6010
  ?>;"></div>
6032
  </th>
6033
  <td><label for="yop-poll-allow-other-answers-no"><input
6034
  id="yop-poll-allow-other-answers-no"
6035
+ <?php echo 'no' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6036
  type="radio" name="yop_poll_options[allow_other_answers]"
6037
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6038
  for="yop-poll-allow-other-answers-yes"><input
6039
  id="yop-poll-allow-other-answers-yes"
6040
+ <?php echo 'yes' == $default_options['allow_other_answers'] ? 'checked="checked"' : ''; ?>
6041
  type="radio" name="yop_poll_options[allow_other_answers]"
6042
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6043
+ <?php if ( 'edit' == $action ){ ?>
6044
  <input type="button"
6045
+ value="<?php echo $yop_poll_add_new_config['text_change_votes_number_answer']; ?> (<?php echo $other_answer[0]['votes'] ?>)"
6046
  onclick="yop_poll_show_change_votes_number_answer(<?php echo $other_answer[0] ['id'] ?>); return false;"
6047
+ class="button yop-poll-change-no-votes-buttons" id="yop-poll-change-no-votes-button-<?php echo $other_answer[0] ['id'] ?>"/>
6048
  <?php } ?>
6049
  </td>
6050
  </tr>
6051
+ <tr class="yop_poll_suboption" id="yop-poll-other-answers-label-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6052
  <th>
6053
  <?php _e( 'Other Answer Label', 'yop_poll' ); ?>:
6054
  </th>
6055
  <td><input id="yop-poll-other-answers-label" type="text"
6056
  name="yop_poll_options[other_answers_label]"
6057
+ value="<?php echo isset( $other_answer[0]['answer'] ) ? esc_html( stripslashes( $other_answer[0]['answer'] ) ) : $default_options['other_answers_label'] ?>"/>
6058
  <input type="hidden"
6059
  name="yop_poll_options[other_answers_id]"
6060
+ value="<?php echo isset( $other_answer[0]['id'] ) ? $other_answer[0]['id'] : '' ?>"/>
6061
  </td>
6062
  </tr>
6063
+ <tr class="yop_poll_suboption" id="yop-poll-other-answers-to-results-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6064
  <th>
6065
+ <?php _e( 'Add the values submitted in "Other" as answers ', 'yop_poll' ); ?>
6066
+ :<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>
6067
  </th>
6068
  <td>
6069
  <label for="yop-poll-add-other-answers-to-default-answers-no"><input
6070
  id="yop-poll-add-other-answers-to-default-answers-no"
6071
+ <?php echo 'no' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6072
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6073
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6074
  for="yop-poll-add-other-answers-to-default-answers-yes"><input
6075
  id="yop-poll-add-other-answers-to-default-answers-yes"
6076
+ <?php echo 'yes' == $default_options['add_other_answers_to_default_answers'] ? 'checked="checked"' : ''; ?>
6077
  type="radio" name="yop_poll_options[add_other_answers_to_default_answers]"
6078
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6079
  </td>
6080
  </tr>
6081
+ <tr class="yop_poll_suboption" id="yop-poll-display-other-answers-values-div" style="<?php echo 'no' == $default_options['allow_other_answers'] ? 'display: none;' : ''; ?>">
6082
  <th>
6083
  <?php _e( 'Display Other Answers Values', 'yop_poll' ); ?>:
6084
  </th>
6085
  <td><label for="yop-poll-display-other-answers-values-no"><input
6086
  id="yop-poll-display-other-answers-values-no"
6087
+ <?php echo 'no' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6088
  type="radio"
6089
  name="yop_poll_options[display_other_answers_values]"
6090
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6091
  for="yop-poll-display-other-answers-values-yes"><input
6092
  id="yop-poll-display-other-answers-values-yes"
6093
+ <?php echo 'yes' == $default_options['display_other_answers_values'] ? 'checked="checked"' : ''; ?>
6094
  type="radio"
6095
  name="yop_poll_options[display_other_answers_values]"
6096
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6097
  </tr>
6098
+ <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;' : ''; ?>">
6099
  <th>
6100
+ <?php _e( 'Make "Other answer" default answer ', 'yop_poll' ); ?>
6101
+ :<br>
6102
+ <small><?php _e( '"Other Answer" will be autoselected', 'yop_poll' ); ?></small>
6103
  </th>
6104
  <td><label for="yop-poll-is-default-other-answers-no"><input
6105
  id="yop-poll-is-default-other-answers-no"
6106
+ <?php echo $default_options['is_default_answer'] == 'no' ? 'checked="checked"' : ''; ?>
6107
  type="radio" name="yop_poll_options[is_default_answer]"
6108
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6109
  for="yop-poll-is-default-other-answers-yes"><input
6110
  id="yop-poll-is-default-other-answers-yes"
6111
+ <?php echo $default_options['is_default_answer'] == 'yes' ? 'checked="checked"' : ''; ?>
6112
  type="radio" name="yop_poll_options[is_default_answer]"
6113
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6114
  </tr>
6115
  <tr>
6116
  <th>
6118
  </th>
6119
  <td><label for="yop-poll-allow-multiple-answers-no"><input
6120
  id="yop-poll-allow-multiple-answers-no"
6121
+ <?php echo $default_options['allow_multiple_answers'] == 'no' ? 'checked="checked"' : ''; ?>
6122
  type="radio" name="yop_poll_options[allow_multiple_answers]"
6123
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6124
  for="yop-poll-allow-multiple-answers-yes"><input
6125
  id="yop-poll-allow-multiple-answers-yes"
6126
+ <?php echo $default_options['allow_multiple_answers'] == 'yes' ? 'checked="checked"' : ''; ?>
6127
  type="radio" name="yop_poll_options[allow_multiple_answers]"
6128
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6129
  </tr>
6130
+ <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6131
  <th>
6132
  <?php _e( 'Number of allowed answers', 'yop_poll' ); ?>:
6133
  </th>
6134
  <td><input id="yop-poll-allow-multiple-answers-number"
6135
  type="text"
6136
  name="yop_poll_options[allow_multiple_answers_number]"
6137
+ value="<?php echo $default_options['allow_multiple_answers_number']; ?>"/>
6138
  </td>
6139
  </tr>
6140
+ <tr class="yop_poll_suboption" id="yop-poll-allow-multiple-answers-div1" style="<?php echo $default_options['allow_multiple_answers'] == 'no' ? 'display: none;' : ''; ?>">
6141
  <th>
6142
  <?php _e( 'Min Number of allowed answers', 'yop_poll' ); ?>:
6143
  </th>
6144
  <td><input id="yop-poll-allow-multiple-answers-min-number"
6145
  type="text"
6146
  name="yop_poll_options[allow_multiple_answers_min_number]"
6147
+ value="<?php echo $default_options['allow_multiple_answers_min_number']; ?>"/>
6148
  </td>
6149
  </tr>
6150
  <tr>
6153
  </th>
6154
  <td><label for="yop-poll-display-answers-vertical"><input
6155
  id="yop-poll-display-answers-vertical"
6156
+ <?php echo $default_options['display_answers'] == 'vertical' ? 'checked="checked"' : ''; ?>
6157
  type="radio" name="yop_poll_options[display_answers]"
6158
+ value="vertical"/> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6159
  <label for="yop-poll-display-answers-orizontal"><input
6160
  id="yop-poll-display-answers-orizontal"
6161
+ <?php echo $default_options['display_answers'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6162
  type="radio" name="yop_poll_options[display_answers]"
6163
+ value="orizontal"/> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6164
  <label for="yop-poll-display-answers-tabulated"><input
6165
  id="yop-poll-display-answers-tabulated"
6166
+ <?php echo $default_options['display_answers'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6167
  type="radio" name="yop_poll_options[display_answers]"
6168
+ value="tabulated"/> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6169
  </td>
6170
  </tr>
6171
+ <tr class="yop_poll_suboption" id="yop-poll-display-answers-tabulated-div" style="<?php echo $default_options['display_answers'] != 'tabulated' ? 'display: none;' : ''; ?>">
6172
  <th>
6173
  <?php _e( 'Columns', 'yop_poll' ); ?>:
6174
  </th>
6175
  <td><input id="yop-poll-display-answers-tabulated-cols"
6176
  type="text"
6177
  name="yop_poll_options[display_answers_tabulated_cols]"
6178
+ value="<?php echo $default_options['display_answers_tabulated_cols']; ?>"/>
6179
  </td>
6180
  </tr>
6181
  <tr>
6184
  </th>
6185
  <td><label for="yop-poll-display-results-vertical"><input
6186
  id="yop-poll-display-results-vertical"
6187
+ <?php echo $default_options['display_results'] == 'vertical' ? 'checked="checked"' : ''; ?>
6188
  type="radio" name="yop_poll_options[display_results]"
6189
  value="vertical"> <?php _e( 'Vertical', 'yop_poll' ); ?></label>
6190
  <label for="yop-poll-display-results-orizontal"><input
6191
  id="yop-poll-display-results-orizontal"
6192
+ <?php echo $default_options['display_results'] == 'orizontal' ? 'checked="checked"' : ''; ?>
6193
  type="radio" name="yop_poll_options[display_results]"
6194
  value="orizontal"> <?php _e( 'Horizontal', 'yop_poll' ); ?></label>
6195
  <label for="yop-poll-display-results-tabulated"><input
6196
  id="yop-poll-display-results-tabulated"
6197
+ <?php echo $default_options['display_results'] == 'tabulated' ? 'checked="checked"' : ''; ?>
6198
  type="radio" name="yop_poll_options[display_results]"
6199
  value="tabulated"> <?php _e( 'Tabulated', 'yop_poll' ); ?></label>
6200
  </td>
6201
  </tr>
6202
+ <tr class="yop_poll_suboption" id="yop-poll-display-results-tabulated-div" style="<?php echo $default_options['display_results'] != 'tabulated' ? 'display: none;' : ''; ?>">
6203
  <th>
6204
  <?php _e( 'Columns', 'yop_poll' ); ?>:
6205
  </th>
6206
  <td><input id="yop-poll-display-results-tabulated-cols"
6207
  type="text"
6208
  name="yop_poll_options[display_results_tabulated_cols]"
6209
+ value="<?php echo $default_options['display_results_tabulated_cols']; ?>"/>
6210
  </td>
6211
  </tr>
6212
  <tr>
6215
  </th>
6216
  <td><label for="yop-poll-use-template-bar-no"><input
6217
  id="yop-poll-use-template-bar-no"
6218
+ <?php echo 'no' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6219
  type="radio" name="yop_poll_options[use_template_bar]"
6220
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6221
  for="yop-poll-use-template-bar-yes"><input
6222
  id="yop-poll-use-template-bar-yes"
6223
+ <?php echo 'yes' == $default_options['use_template_bar'] ? 'checked="checked"' : ''; ?>
6224
  type="radio" name="yop_poll_options[use_template_bar]"
6225
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6226
  </tr>
6227
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6228
  <th><label for="yop-poll-bar-background"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_background_label']; ?></label>
6229
  </th>
6230
  <td>#<input class="yop-small-input"
6231
  id="yop-poll-bar-background"
6232
  value="<?php echo $default_options['bar_background']; ?>"
6233
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'background-color', '#' + this.value)"
6234
+ type="text" name="yop_poll_options[bar_background]"/>
6235
  </td>
6236
  </tr>
6237
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6238
  <th><label for="yop-poll-bar-height"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_height_label']; ?></label>
6239
  </th>
6240
  <td><input class="yop-small-input" id="yop-poll-bar-height"
6241
  value="<?php echo $default_options['bar_height']; ?>"
6242
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'height', this.value + 'px')"
6243
+ type="text" name="yop_poll_options[bar_height]"/> px</td>
6244
  </tr>
6245
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6246
  <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>
6247
  </th>
6248
  <td>#<input class="yop-small-input"
6249
  id="yop-poll-bar-border-color"
6250
  value="<?php echo $default_options['bar_border_color']; ?>"
6251
  onblur="yop_poll_update_bar_style( '#yop-poll-bar-preview', 'border-color', '#' + this.value )"
6252
+ type="text" name="yop_poll_options[bar_border_color]"/>
6253
  </td>
6254
  </tr>
6255
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6256
  <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>
6257
  </th>
6258
  <td><input class="yop-small-input"
6259
  id="yop-poll-bar-border-width"
6260
  value="<?php echo $default_options['bar_border_width']; ?>"
6261
  onblur="yop_poll_update_bar_style('#yop-poll-bar-preview', 'border-width', this.value + 'px')"
6262
+ type="text" name="yop_poll_options[bar_border_width]"/> px</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-style"><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_style_border_style_label']; ?></label>
6266
  </th>
6267
  <td><select id="yop-poll-bar-border-style"
6278
  value="dotted">Dotted</option>
6279
  </select></td>
6280
  </tr>
6281
+ <tr class="yop-poll-custom-result-bar-table yop_poll_suboption" style="<?php echo $default_options['use_template_bar'] == 'yes' ? 'display: none;' : ''; ?>">
6282
+
6283
  <th><label><?php echo $yop_poll_add_new_config['text_poll_bar_style']['poll_bar_preview_label']; ?></label>
6284
  </th>
6285
  <td>
6286
+ <div id="yop-poll-bar-preview"; style="width: 100px; height: <?php echo $default_options['bar_height']; ?>
6287
+ px; background-color:#<?php
6288
 
6289
  echo $default_options ['bar_background'];
6290
+ ?>
6291
+ ; border-style: <?php echo $default_options['bar_border_style']; ?>
6292
+ ; border-width: <?php echo $default_options['bar_border_width']; ?>
6293
+ px; border-color: #<?php
6294
 
6295
  echo $default_options ['bar_border_color'];
6296
  ?>;"></div>
6300
  <th><?php _e( 'Sort Answers', 'yop_poll' ); ?>:</th>
6301
  <td valign="top"><label for="yop_poll_sorting_answers_exact"><input
6302
  id="yop_poll_sorting_answers_exact"
6303
+ <?php echo $default_options['sorting_answers'] == 'exact' ? 'checked="checked"' : ''; ?>
6304
  type="radio" name="yop_poll_options[sorting_answers]"
6305
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6306
  <label for="yop_poll_sorting_answers_alphabetical"><input
6307
  id="yop_poll_sorting_answers_alphabetical"
6308
+ <?php echo $default_options['sorting_answers'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6309
  type="radio" name="yop_poll_options[sorting_answers]"
6310
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6311
  <label for="yop_poll_sorting_answers_random"><input
6312
  id="yop_poll_sorting_answers_random"
6313
+ <?php echo $default_options['sorting_answers'] == 'random' ? 'checked="checked"' : ''; ?>
6314
  type="radio" name="yop_poll_options[sorting_answers]"
6315
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6316
  <label for="yop_poll_sorting_answers_votes"><input
6317
  id="yop_poll_sorting_answers_votes"
6318
+ <?php echo $default_options['sorting_answers'] == 'votes' ? 'checked="checked"' : ''; ?>
6319
  type="radio" name="yop_poll_options[sorting_answers]"
6320
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6321
  </td>
6326
  </th>
6327
  <td><label for="yop_poll_sorting_answers_asc"><input
6328
  id="yop_poll_sorting_answers_asc"
6329
+ <?php echo $default_options['sorting_answers_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6330
  type="radio"
6331
  name="yop_poll_options[sorting_answers_direction]"
6332
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6333
  <label for="yop_poll_sorting_answers_desc"><input
6334
  id="yop_poll_sorting_answers_desc"
6335
+ <?php echo $default_options['sorting_answers_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6336
  type="radio"
6337
  name="yop_poll_options[sorting_answers_direction]"
6338
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?> </label>
6342
  <th><?php _e( 'Sorting Results in', 'yop_poll' ); ?>:</th>
6343
  <td valign="top"><label for="yop_poll_sorting_results_exact"><input
6344
  id="yop_poll_sorting_results_exact"
6345
+ <?php echo $default_options['sorting_results'] == 'exact' ? 'checked="checked"' : ''; ?>
6346
  type="radio" name="yop_poll_options[sorting_results]"
6347
  value="exact"> <?php _e( 'Exact Order', 'yop_poll' ); ?></label>
6348
  <label for="yop_poll_sorting_results_alphabetical"><input
6349
  id="yop_poll_sorting_results_alphabetical"
6350
+ <?php echo $default_options['sorting_results'] == 'alphabetical' ? 'checked="checked"' : ''; ?>
6351
  type="radio" name="yop_poll_options[sorting_results]"
6352
  value="alphabetical"> <?php _e( 'Alphabetical Order', 'yop_poll' ); ?></label>
6353
  <label for="yop_poll_sorting_results_random"><input
6354
  id="yop_poll_sorting_results_random"
6355
+ <?php echo $default_options['sorting_results'] == 'random' ? 'checked="checked"' : ''; ?>
6356
  type="radio" name="yop_poll_options[sorting_results]"
6357
  value="random"> <?php _e( 'Random Order', 'yop_poll' ); ?></label>
6358
  <label for="yop_poll_sorting_results_votes"><input
6359
  id="yop_poll_sorting_results_votes"
6360
+ <?php echo $default_options['sorting_results'] == 'votes' ? 'checked="checked"' : ''; ?>
6361
  type="radio" name="yop_poll_options[sorting_results]"
6362
  value="votes"> <?php _e( 'Number of Votes', 'yop_poll' ); ?></label>
6363
  </td>
6368
  </th>
6369
  <td><label for="yop_poll_sorting_results_asc"><input
6370
  id="yop_poll_sorting_results_asc"
6371
+ <?php echo $default_options['sorting_results_direction'] == 'asc' ? 'checked="checked"' : ''; ?>
6372
  type="radio"
6373
  name="yop_poll_options[sorting_results_direction]"
6374
  value="asc"> <?php _e( 'Ascending', 'yop_poll' ); ?></label>
6375
  <label for="yop_poll_sorting_results_desc"><input
6376
  id="yop_poll_sorting_results_desc"
6377
+ <?php echo $default_options['sorting_results_direction'] == 'desc' ? 'checked="checked"' : ''; ?>
6378
  type="radio"
6379
  name="yop_poll_options[sorting_results_direction]"
6380
  value="desc"> <?php _e( 'Descending', 'yop_poll' ); ?></label>
6394
  id='yop-poll-customfields-table'>
6395
  <tbody>
6396
  <?php
6397
+ for ( $custom_field_id = 1; $custom_field_id < $customfields_number; $custom_field_id++ ) {
6398
+ if ( isset ( $custom_fields [$custom_field_id - 1] ['id'] ) ){
6399
  ?>
6400
  <tr class="yop_poll_tr_customfields"
6401
  id="yop_poll_tr_customfield<?php echo $custom_field_id; ?>">
6403
  for="yop_poll_customfield<?php echo $custom_field_id; ?>"><?php echo $yop_poll_add_new_config['text_customfield'] ?> <?php echo $custom_field_id ?></label>
6404
  </th>
6405
  <td><input type="hidden"
6406
+ value="<?php echo isset( $custom_fields[$custom_field_id - 1]['id'] ) ? $custom_fields[$custom_field_id - 1]['id'] : ''; ?>"
6407
+ name="yop_poll_customfield_ids[customfield<?php echo $custom_field_id ?>]"/>
6408
  <input type="text"
6409
+ value="<?php echo isset( $custom_fields[$custom_field_id - 1]['custom_field'] ) ? $custom_fields[$custom_field_id - 1]['custom_field'] : ''; ?>"
6410
  id="yop-poll-customfield<?php echo $custom_field_id ?>"
6411
+ name="yop_poll_customfield[customfield<?php echo $custom_field_id ?>]"/>
6412
  <input value="yes"
6413
+ <?php if ( isset ( $custom_fields[$custom_field_id - 1]['required'] ) )
6414
+ echo ( 'yes' == $custom_fields[$custom_field_id - 1]['required'] ) ? 'checked="checked"' : ''; ?>
6415
  id="yop-poll-customfield-required-<?php echo $custom_field_id ?>"
6416
  type="checkbox"
6417
+ name="yop_poll_customfield_required[customfield<?php echo $custom_field_id ?>]"/>
6418
  <label
6419
  for="yop-poll-customfield-required-<?php echo $custom_field_id ?>"><?php echo $yop_poll_add_new_config['text_requiered_customfield'] ?></label>
6420
  </td>
6422
  onclick="yop_poll_remove_customfield( '#yop-poll-customfields-table', <?php echo $custom_field_id ?> ); return false;"
6423
  type="button"
6424
  value="<?php echo $yop_poll_add_new_config['text_remove_customfield']; ?>"
6425
+ class="button"/></td>
6426
  </tr>
6427
  <?php
6428
  }
6438
  <div class="meta-box-sortables ui-sortable" id="normal-sortables">
6439
  <div class="postbox" id="yop-poll-advanced-options-div">
6440
  <div title="Click to toggle" class="handlediv">
6441
+ <br/>
6442
  </div>
6443
  <h3 class="hndle">
6444
  <span><?php _e( 'Poll Start/End Date', 'yop_poll' ); ?>
6447
  <table cellspacing="0" class="links-table">
6448
  <tbody>
6449
  <tr>
6450
+ <th><label for="yop-poll-start-date-input"><?php _e( 'Start Date', 'yop_poll' ); ?>
6451
+ :</label><br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
6452
+ echo ': ' . current_time( 'mysql' ); ?>)</small>
6453
  </th>
6454
  <td><input id="yop-poll-start-date-input" type="text"
6455
  name="yop_poll_options[start_date]"
6456
+ value="<?php echo ( 'edit' != $action ) ? current_time( 'mysql' ) : ( '' == $default_options['start_date'] ) ? current_time( 'mysql' ) : $default_options['start_date']; ?>"/>
6457
  </td>
6458
  </tr>
6459
  <tr>
6460
+ <th><label for="yop-poll-end-date-input"><?php _e( 'End Date ', 'yop_poll' ); ?>
6461
+ :</label><br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
6462
+ echo ': ' . current_time( 'mysql' ); ?>)</small>
6463
  </th>
6464
+ <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']; ?>"/>
6465
  <label for="yop-poll-never-expire"><input type="checkbox"
6466
+ <?php echo $default_options['never_expire'] == 'yes' ? 'checked="checked"' : ''; ?>
6467
  id="yop-poll-never-expire"
6468
+ name="yop_poll_options[never_expire]" value="yes"/> <?php _e( 'No end date', 'yop_poll' ); ?></label>
6469
  </td>
6470
  </tr>
6471
  </tbody>
6474
  </div>
6475
  <div class="postbox" id="yop-poll-advanced-options-div">
6476
  <div title="Click to toggle" class="handlediv">
6477
+ <br/>
6478
  </div>
6479
  <h3 class="hndle">
6480
  <span><?php _e( 'View Results Options', 'yop_poll' ); ?></span>
6488
  </th>
6489
  <td><label for="yop-poll-view-results-before-vote"><input
6490
  class="yop-poll-view-results-hide-custom"
6491
+ <?php echo 'before' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6492
  id="yop-poll-view-results-before-vote" type="radio"
6493
+ value="before" name="yop_poll_options[view_results]"/> <?php _e( 'Before Vote', 'yop_poll' ); ?></label>
6494
  <label for="yop-poll-view-results-after-vote"><input
6495
  class="yop-poll-view-results-hide-custom"
6496
+ <?php echo 'after' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6497
  id="yop-poll-view-results-after-vote" type="radio"
6498
+ value="after" name="yop_poll_options[view_results]"/> <?php _e( 'After Vote', 'yop_poll' ); ?></label>
6499
  <label for="yop-poll-view-results-after-poll-end-date"><input
6500
  class="yop-poll-view-results-hide-custom"
6501
+ <?php echo 'after-poll-end-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6502
  id="yop-poll-view-results-after-poll-end-date" type="radio"
6503
  value="after-poll-end-date"
6504
+ name="yop_poll_options[view_results]"/> <?php _e( 'After Poll End Date', 'yop_poll' ); ?></label>
6505
  <label for="yop-poll-view-results-never"><input
6506
  class="yop-poll-view-results-hide-custom"
6507
+ <?php echo 'never' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6508
  id="yop-poll-view-results-never" type="radio" value="never"
6509
+ name="yop_poll_options[view_results]"/> <?php _e( 'Never', 'yop_poll' ); ?></label>
6510
  <label for="yop-poll-view-results-custom"><input
6511
  class="yop-poll-view-results-show-custom"
6512
+ <?php echo 'custom-date' == $default_options['view_results'] ? 'checked="checked"' : ''; ?>
6513
  id="yop-poll-view-results-custom" type="radio"
6514
+ value="custom-date" name="yop_poll_options[view_results]"/> <?php _e( 'Custom Date', 'yop_poll' ); ?></label>
6515
+ <div id="yop-poll-display-view-results-div" style="<?php echo 'custom-date' != $default_options['view_results'] ? 'display: none;' : ''; ?>">
6516
+ <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' ); ?>
6517
+ :</label>
6518
  <input id="yop-poll-view-results-start-date" type="text"
6519
  name="yop_poll_options[view_results_start_date]"
6520
  value="<?php echo $default_options['view_results_start_date']; ?>">
6526
  </th>
6527
  <td><label for="yop-poll-view-results-permissions-quest-only"><input
6528
  id="yop-poll-view-results-permissions-quest-only"
6529
+ <?php echo 'quest-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6530
  type="radio" value="quest-only"
6531
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
6532
  <label for="yop-poll-view-results-permissions-registered-only"><input
6533
  id="yop-poll-view-results-permissions-registered-only"
6534
+ <?php echo 'registered-only' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6535
  type="radio" value="registered-only"
6536
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
6537
  <label for="yop-poll-view-results-permissions-guest-registered"><input
6538
  id="yop-poll-view-results-permissions-guest-registered"
6539
+ <?php echo 'guest-registered' == $default_options['view_results_permissions'] ? 'checked="checked"' : ''; ?>
6540
  type="radio" value="guest-registered"
6541
+ name="yop_poll_options[view_results_permissions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
6542
  </td>
6543
  </tr>
6544
  <tr>
6547
  </th>
6548
  <td><label for="yop-poll-view-results-votes-number"><input
6549
  id="yop-poll-view-results-votes-number"
6550
+ <?php echo 'votes-number' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6551
  type="radio" value="votes-number"
6552
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'By Votes Number', 'yop_poll' ); ?></label>
6553
  <label for="yop-poll-view-results-percentages"><input
6554
  id="yop-poll-view-results-percentages"
6555
+ <?php echo 'percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6556
  type="radio" value="percentages"
6557
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'Percentages', 'yop_poll' ); ?></label>
6558
  <label
6559
  for="yop-poll-view-results-votes-number-and-percentages"><input
6560
  id="yop-poll-view-results-votes-number-and-percentages"
6561
+ <?php echo 'votes-number-and-percentages' == $default_options['view_results_type'] ? 'checked="checked"' : ''; ?>
6562
  type="radio" value="votes-number-and-percentages"
6563
+ name="yop_poll_options[view_results_type]"/> <?php _e( 'by Votes Number and Percentages', 'yop_poll' ); ?></label>
6564
  </td>
6565
  </tr>
6566
  <tr>
6567
  <th>
6568
+ <?php _e( 'Poll Answer Result Label', 'yop_poll' ); ?>:
6569
  </th>
6570
  <td><input id="yop-poll-answer-result-label" type="text"
6571
  name="yop_poll_options[answer_result_label]"
6572
+ value="<?php echo esc_html( stripslashes( $default_options['answer_result_label'] ) ); ?>"/>
6573
+ <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>
6574
  </td>
6575
  </tr>
6576
  <tr>
6577
  <th>
6578
+ <?php _e( 'Poll Answer Result Votes Number Label', 'yop_poll' ); ?>
6579
+ :
6580
  </th>
6581
  <td>
6582
  <?php _e( 'Singular', 'yop_poll' ); ?>
6584
  id="yop-poll-singular-answer-result-votes-number-label"
6585
  type="text"
6586
  name="yop_poll_options[singular_answer_result_votes_number_label]"
6587
+ value="<?php echo esc_html( stripslashes( $default_options['singular_answer_result_votes_number_label'] ) ); ?>"/>
6588
  <?php _e( 'Plural', 'yop_poll' ); ?>
6589
  <input
6590
  id="yop-poll-plural-answer-result-votes-number-label"
6591
  type="text"
6592
  name="yop_poll_options[plural_answer_result_votes_number_label]"
6593
+ value="<?php echo esc_html( stripslashes( $default_options['plural_answer_result_votes_number_label'] ) ); ?>"/>
6594
 
6595
  </td>
6596
  </tr>
6600
  </th>
6601
  <td><input id="yop-poll-vote-button-label" type="text"
6602
  name="yop_poll_options[vote_button_label]"
6603
+ value="<?php echo esc_html( stripslashes( $default_options['vote_button_label'] ) ); ?>"/>
6604
  </td>
6605
  </tr>
6606
  <tr>
6608
  <?php _e( 'View Results Link', 'yop_poll' ); ?>:
6609
  </th>
6610
  <td><label for="yop-poll-view-results-link-yes"><input
6611
+ <?php echo 'yes' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6612
  id="yop-poll-view-results-link-yes" type="radio"
6613
+ value="yes" name="yop_poll_options[view_results_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6614
  <label for="yop-poll-view-results-link-no"><input
6615
+ <?php echo 'no' == $default_options['view_results_link'] ? 'checked="checked"' : ''; ?>
6616
  id="yop-poll-view-results-link-no" type="radio" value="no"
6617
+ name="yop_poll_options[view_results_link]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6618
  </td>
6619
  </tr>
6620
+ <tr class="yop_poll_suboption" id="yop-poll-view-results-link-div" style="<?php echo 'yes' != $default_options['view_results_link'] ? 'display: none;' : ''; ?>">
6621
  <th>
6622
  <?php _e( 'View Results Link Label', 'yop_poll' ); ?>:
6623
  </th>
6624
  <td><input id="yop-poll-view-results-link-label" type="text"
6625
  name="yop_poll_options[view_results_link_label]"
6626
+ value="<?php echo esc_html( stripslashes( $default_options['view_results_link_label'] ) ); ?>"/>
6627
  </td>
6628
  </tr>
6629
  <tr>
6631
  <?php _e( 'View Back To Vote Link ', 'yop_poll' ); ?>:
6632
  </th>
6633
  <td><label for="yop-poll-view-back-to-vote-link-yes"><input
6634
+ <?php echo 'yes' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
6635
  id="yop-poll-view-back-to-vote-link-yes" type="radio"
6636
+ value="yes" name="yop_poll_options[view_back_to_vote_link]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6637
  <label for="yop-poll-view-back-to-vote-link-no"><input
6638
+ <?php echo 'no' == $default_options['view_back_to_vote_link'] ? 'checked="checked"' : ''; ?>
6639
  id="yop-poll-view-back-to-vote-link-no" type="radio"
6640
+ value="no" name="yop_poll_options[view_back_to_vote_link]"/><?php _e( 'No', 'yop_poll' ); ?></label>
6641
  </td>
6642
  </tr>
6643
+ <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;' : ''; ?>">
6644
  <th>
6645
  <?php _e( 'View Back To Vote Link Label', 'yop_poll' ); ?>:
6646
  </th>
6647
  <td><input id="yop-poll-view-back-to-vote-link-label"
6648
  type="text"
6649
  name="yop_poll_options[view_back_to_vote_link_label]"
6650
+ value="<?php echo esc_html( stripslashes( $default_options['view_back_to_vote_link_label'] ) ); ?>"/>
6651
  </td>
6652
  </tr>
6653
  <tr>
6655
  <?php _e( 'View Total Votes ', 'yop_poll' ); ?>:
6656
  </th>
6657
  <td><label for="yop-poll-view-total-votes-yes"><input
6658
+ <?php echo 'yes' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
6659
  id="yop-poll-view-total-votes-yes" type="radio" value="yes"
6660
+ name="yop_poll_options[view_total_votes]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6661
  <label for="yop-poll-view-total-votes-no"><input
6662
+ <?php echo 'no' == $default_options['view_total_votes'] ? 'checked="checked"' : ''; ?>
6663
  id="yop-poll-view-total-votes-no" type="radio" value="no"
6664
+ name="yop_poll_options[view_total_votes]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6665
  </td>
6666
  </tr>
6667
+ <tr class="yop_poll_suboption" id="yop-poll-view-total-votes-div" style="<?php echo 'yes' != $default_options['view_total_votes'] ? 'display: none;' : ''; ?>">
6668
  <th>
6669
  <?php _e( 'View Total Votes Label', 'yop_poll' ); ?>:
6670
  </th>
6671
  <td><input id="yop-poll-view-total-votes-label" type="text"
6672
  name="yop_poll_options[view_total_votes_label]"
6673
+ value="<?php echo esc_html( stripslashes( $default_options['view_total_votes_label'] ) ); ?>"/>
6674
  </td>
6675
  </tr>
6676
  <tr>
6678
  <?php _e( 'View Total Answers ', 'yop_poll' ); ?>:
6679
  </th>
6680
  <td><label for="yop-poll-view-total-answers-yes"><input
6681
+ <?php echo 'yes' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
6682
  id="yop-poll-view-total-answers-yes" type="radio"
6683
+ value="yes" name="yop_poll_options[view_total_answers]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6684
  <label for="yop-poll-view-total-answers-no"><input
6685
+ <?php echo 'no' == $default_options['view_total_answers'] ? 'checked="checked"' : ''; ?>
6686
  id="yop-poll-view-total-answers-no" type="radio" value="no"
6687
+ name="yop_poll_options[view_total_answers]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6688
  </td>
6689
  </tr>
6690
+ <tr class="yop_poll_suboption" id="yop-poll-view-total-answers-div" style="<?php echo 'yes' != $default_options['view_total_answers'] ? 'display: none;' : ''; ?>">
6691
  <th>
6692
  <?php _e( 'View Total Answers Label', 'yop_poll' ); ?>:
6693
  </th>
6694
  <td><input id="yop-poll-view-total-answers-label" type="text"
6695
  name="yop_poll_options[view_total_answers_label]"
6696
+ value="<?php echo esc_html( stripslashes( $default_options['view_total_answers_label'] ) ); ?>"/>
6697
  </td>
6698
  </tr>
6699
  <tr>
6702
  </th>
6703
  <td><input id="yop-poll-message-after-vote" type="text"
6704
  name="yop_poll_options[message_after_vote]"
6705
+ value="<?php echo esc_html( stripslashes( $default_options['message_after_vote'] ) ); ?>"/>
6706
  </td>
6707
  </tr>
6708
+ <?php if ( 'no' == $default_options['has_auto_generate_poll_page'] ){ ?>
6709
  <tr>
6710
  <th>
6711
  <?php _e( 'Auto Generate Poll Page ', 'yop_poll' ); ?>:
6713
  <td><input
6714
  <?php checked( 'yes', $default_options['auto_generate_poll_page'] ); ?>
6715
  id="yop-poll-auto-generate-poll-page-yes" type="radio"
6716
+ value="yes" name="yop_poll_options[auto_generate_poll_page]"/><label
6717
+ for="yop-poll-auto-generate-poll-page-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
6718
  <input
6719
  <?php checked( 'no', $default_options['auto_generate_poll_page'] ); ?>
6720
  id="yop-poll-auto-generate-poll-page-no" type="radio"
6721
+ value="no" name="yop_poll_options[auto_generate_poll_page]"/><label
6722
+ for="yop-poll-auto-generate-poll-page-no"><?php _e( 'No', 'yop_poll' ); ?></label>
6723
  </td>
6724
  </tr>
6725
  <?php } ?>
6726
  <tr>
6727
+ <th><label for="yop-poll-page-url"><?php _e( 'Poll Page Url ', 'yop_poll' ); ?>
6728
+ :</label>
6729
  </th>
6730
  <td><input id="yop-poll-page-url" type="text"
6731
  name="yop_poll_options[poll_page_url]"
6732
+ value="<?php echo esc_html( stripslashes( $default_options['poll_page_url'] ) ); ?>"/>
6733
  </td>
6734
  </tr>
6735
  </tbody>
6737
  </div>
6738
  </div>
6739
  <div class="postbox" id="yop-poll-advanced-options-div">
6740
+ <div title="Click to toggle" class="handlediv"><br/></div>
 
 
6741
  <h3 class="hndle">
6742
  <span><?php _e( 'Other Options', 'yop_poll' ); ?></span>
6743
  </h3>
6750
  </th>
6751
  <td><label for="yop-poll-use-captcha-no"><input
6752
  id="yop-poll-use-captcha-no"
6753
+ <?php echo 'no' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
6754
  type="radio" name="yop_poll_options[use_captcha]"
6755
+ value="no"/> <?php _e( 'No', 'yop_poll' ); ?></label> <label
6756
  for="yop-poll-use-captcha-yes"><input
6757
  id="yop-poll-use-captcha-yes"
6758
+ <?php echo 'yes' == $default_options['use_captcha'] ? 'checked="checked"' : ''; ?>
6759
  type="radio" name="yop_poll_options[use_captcha]"
6760
+ value="yes"/> <?php _e( 'Yes', 'yop_poll' ); ?></label></td>
6761
  </tr>
6762
  <tr>
6763
  <th>
6765
  </th>
6766
  <td><label for="yop-poll-vote-permisions-quest-only"><input
6767
  id="yop-poll-vote-permisions-quest-only"
6768
+ <?php echo 'quest-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6769
  type="radio" value="quest-only"
6770
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest Only', 'yop_poll' ); ?></label>
6771
  <label for="yop-poll-vote-permisions-registered-only"><input
6772
  id="yop-poll-vote-permisions-registered-only"
6773
+ <?php echo 'registered-only' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6774
  type="radio" value="registered-only"
6775
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Registered Users Only', 'yop_poll' ); ?></label>
6776
  <label for="yop-poll-vote-permisions-guest-registered"><input
6777
  id="yop-poll-vote-permisions-guest-registered"
6778
+ <?php echo 'guest-registered' == $default_options['vote_permisions'] ? 'checked="checked"' : ''; ?>
6779
  type="radio" value="guest-registered"
6780
+ name="yop_poll_options[vote_permisions]"/> <?php _e( 'Guest &amp; Registered Users', 'yop_poll' ); ?></label>
6781
  </td>
6782
  </tr>
6783
+ <?php if ( false ){ ?>
6784
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6785
  <th>
6786
  <?php _e( 'Vote as Facebook User', 'yop_poll' ); ?>:
6787
+ <?php if ($pro_options['pro_user'] == 'no') { ?>
6788
+ <br/><small>(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?>
6789
+ )</small>
6790
  <?php } ?></label>
6791
  </th>
6792
  <td><label for="yop-poll-vote-permisions-facebook-yes"><input
6793
+ <?php echo 'yes' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
6794
  id="yop-poll-vote-permisions-facebook-yes" type="radio"
6795
+ value="yes" name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6796
  <label for="yop-poll-vote-permisions-facebook-no"><input
6797
+ <?php echo 'no' == $default_options['vote_permisions_facebook'] ? 'checked="checked"' : ''; ?>
6798
  id="yop-poll-vote-permisions-facebook-no" type="radio" value="no"
6799
+ name="yop_poll_options[vote_permisions_facebook]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6800
  </td>
6801
  </tr>
6802
+ <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;' : ''; ?>">
6803
  <th>
6804
+ <?php _e( '"Vote as Facebook User" Button Label', 'yop_poll' ); ?>
6805
+ :
6806
  </th>
6807
  <td><input id="yop-poll-vote-permisions-facebook-label" type="text"
6808
  name="yop_poll_options[vote_permisions_facebook_label]"
6809
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_facebook_label'] ) ); ?>"/>
6810
  </td>
6811
  </tr>
6812
+ <?php } ?>
6813
 
6814
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6815
  <th>
6816
+ <?php _e( 'Vote as Wordpress User', 'yop_poll' ); ?>
6817
+ <br><small> (<?php _e( 'Will force users to login into your blog', 'yop_poll' ); ?>
6818
+ )</small>:
6819
  </th>
6820
  <td><label for="yop-poll-vote-permisions-wordpress-yes"><input
6821
+ <?php echo 'yes' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
6822
  id="yop-poll-vote-permisions-wordpress-yes" type="radio"
6823
+ value="yes" name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6824
  <label for="yop-poll-vote-permisions-wordpress-no"><input
6825
+ <?php echo 'no' == $default_options['vote_permisions_wordpress'] ? 'checked="checked"' : ''; ?>
6826
  id="yop-poll-vote-permisions-wordpress-no" type="radio" value="no"
6827
+ name="yop_poll_options[vote_permisions_wordpress]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6828
  </td>
6829
  </tr>
6830
+ <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;' : ''; ?>">
6831
  <th>
6832
+ <?php _e( '"Vote as Wordpress User" Button Label', 'yop_poll' ); ?>
6833
+ :
6834
  </th>
6835
  <td><input id="yop-poll-vote-permisions-wordpress-label" type="text"
6836
  name="yop_poll_options[vote_permisions_wordpress_label]"
6837
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_wordpress_label'] ) ); ?>"/>
6838
  </td>
6839
+ </tr>
6840
 
6841
+ <tr class="yop-poll-vote-as-div" style="<?php echo 'quest-only' == $default_options['vote_permisions'] ? 'display: none;' : ''; ?>">
6842
  <th>
6843
+ <?php _e( 'Vote as Anonymous User', 'yop_poll' ); ?>
6844
+ <br><small>(<?php _e( 'Logged users will be treated as anonymous', 'yop_poll' ); ?>
6845
+ )</small>:
6846
  </th>
6847
  <td><label for="yop-poll-vote-permisions-anonymous-yes"><input
6848
+ <?php echo 'yes' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
6849
  id="yop-poll-vote-permisions-anonymous-yes" type="radio"
6850
+ value="yes" name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6851
  <label for="yop-poll-vote-permisions-anonymous-no"><input
6852
+ <?php echo 'no' == $default_options['vote_permisions_anonymous'] ? 'checked="checked"' : ''; ?>
6853
  id="yop-poll-vote-permisions-anonymous-no" type="radio" value="no"
6854
+ name="yop_poll_options[vote_permisions_anonymous]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6855
  </td>
6856
+ </tr>
6857
+ <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;' : ''; ?>">
6858
  <th>
6859
+ <?php _e( '"Vote as Anonymous User" Button Label', 'yop_poll' ); ?>
6860
+ :
6861
  </th>
6862
  <td><input id="yop-poll-vote-permisions-anonymous-label" type="text"
6863
  name="yop_poll_options[vote_permisions_anonymous_label]"
6864
+ value="<?php echo esc_html( stripslashes( $default_options['vote_permisions_anonymous_label'] ) ); ?>"/>
6865
  </td>
6866
  </tr>
6867
 
6871
  </th>
6872
  <td><label for="yop-poll-blocking-voters-dont-block"><input
6873
  class="yop-poll-blocking-voters-hide-interval"
6874
+ <?php echo 'dont-block' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6875
  id="yop-poll-blocking-voters-dont-block" type="radio"
6876
+ value="dont-block" name="yop_poll_options[blocking_voters]"/> <?php _e( 'Dont`t Block', 'yop_poll' ); ?></label>
6877
  <label for="yop-poll-blocking-voters-cookie"><input
6878
  class="yop-poll-blocking-voters-show-interval"
6879
+ <?php echo 'cookie' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6880
  id="yop-poll-blocking-voters-cookie" type="radio"
6881
+ value="cookie" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie', 'yop_poll' ); ?></label>
6882
  <label for="yop-poll-blocking-voters-ip"><input
6883
  class="yop-poll-blocking-voters-show-interval"
6884
+ <?php echo 'ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6885
  id="yop-poll-blocking-voters-ip" type="radio" value="ip"
6886
+ name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Ip', 'yop_poll' ); ?></label>
6887
  <label for="yop-poll-blocking-voters-username"><input
6888
  class="yop-poll-blocking-voters-show-interval"
6889
+ <?php echo 'username' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6890
  id="yop-poll-blocking-voters-username" type="radio"
6891
+ value="username" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Username', 'yop_poll' ); ?></label>
6892
  <label for="yop-poll-blocking-voters-cookie-ip"><input
6893
  class="yop-poll-blocking-voters-show-interval"
6894
+ <?php echo 'cookie-ip' == $default_options['blocking_voters'] ? 'checked="checked"' : ''; ?>
6895
  id="yop-poll-blocking-voters-cookie-ip" type="radio"
6896
+ value="cookie-ip" name="yop_poll_options[blocking_voters]"/> <?php _e( 'By Cookie &amp; Ip', 'yop_poll' ); ?></label>
6897
  </td>
6898
  </tr>
6899
+ <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="<?php echo 'dont-block' == $default_options['blocking_voters'] ? 'display: none;' : ''; ?>">
6900
  <th>
6901
  <?php _e( 'Blocking voters interval', 'yop_poll' ); ?>:
6902
  </th>
6903
  <td><input type="text"
6904
  name="yop_poll_options[blocking_voters_interval_value]"
6905
  id="yop-poll-blocking-voters-interval-value"
6906
+ value="<?php echo $default_options['blocking_voters_interval_value']; ?>"/>
6907
  <select id="yop-poll-blocking-voters-interval-unit"
6908
  name="yop_poll_options[blocking_voters_interval_unit]">
6909
  <option
6910
+ <?php echo 'seconds' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6911
  value="seconds"><?php _e( 'Seconds', 'yop_poll' ); ?></option>
6912
  <option
6913
+ <?php echo 'minutes' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6914
  value="minutes"><?php _e( 'Minutes', 'yop_poll' ); ?></option>
6915
  <option
6916
+ <?php echo 'hours' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6917
  value="hours"><?php _e( 'Hours', 'yop_poll' ); ?></option>
6918
  <option
6919
+ <?php echo 'days' == $default_options['blocking_voters_interval_unit'] ? 'selected="selected"' : ''; ?>
6920
  value="days"><?php _e( 'Days', 'yop_poll' ); ?></option>
6921
  </select></td>
6922
  </tr>
6923
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
6924
  <th>
6925
+ <?php _e( 'Limit Number of Votes per User', 'yop_poll' ); ?>:
6926
+ <br><small>(<?php _e( 'Only for logged users', 'yop_poll' ); ?>
6927
+ )</small>
6928
  </th>
6929
  <td><label for="yop-poll-limit-number-of-votes-per-user-yes"><input
6930
+ <?php echo 'yes' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
6931
  id="yop-poll-limit-number-of-votes-per-user-yes" type="radio"
6932
+ value="yes" name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
6933
  <label for="yop-poll-limit-number-of-votes-per-user-no"><input
6934
+ <?php echo 'no' == $default_options['limit_number_of_votes_per_user'] ? 'checked="checked"' : ''; ?>
6935
  id="yop-poll-limit-number-of-votes-per-user-no" type="radio" value="no"
6936
+ name="yop_poll_options[limit_number_of_votes_per_user]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
6937
  </td>
6938
  </tr>
6939
  <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;' : '' ?>">
6942
  </th>
6943
  <td><input id="yop-poll-number-of-votes-per-user" type="text"
6944
  name="yop_poll_options[number_of_votes_per_user]"
6945
+ value="<?php echo esc_html( stripslashes( $default_options['number_of_votes_per_user'] ) ); ?>"/>
6946
  </td>
6947
  </tr>
6948
  <tr>
6949
  <th><?php _e( 'Poll Template ', 'yop_poll' ); ?>:</th>
6950
  <td>
6951
  <?php
6952
+ $templates = YOP_POLL_MODEL::get_yop_poll_templates_search( 'id', 'asc' );
6953
  ?>
6954
  <select class="yop-poll-template" id="yop-poll-template"
6955
  name="yop_poll_options[template]"
6956
  onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_page_template', 1);">
6957
+ <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
6958
  <?php
6959
+ if ( count( $templates ) > 0 ){
6960
  foreach ( $templates as $template ) {
6961
  ?>
6962
  <option
6963
+ <?php if ( $default_options['template'] == $template['id'] )
6964
+ echo 'selected="selected"' ?>
6965
  value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
6966
  <?php
6967
  }
6969
  ?>
6970
  </select>
6971
  <div id="yop_poll_preview_page_template" style="position: relative; float: right;">
6972
+ <?php
6973
+ if ( ( $default_options['template'] ) )
6974
+ print( Yop_Poll_Model::return_template_preview_html( $default_options['template'], 1 ) );
6975
  ?>
6976
  </div>
6977
  </td>
6984
  type="text"
6985
  name="yop_poll_options[template_width]"
6986
  style="width: 50%;"
6987
+ value="<?php echo $default_options['template_width']; ?>"/>
6988
  </td>
6989
  </tr>
6990
  <tr>
6991
  <th><?php _e( 'Widget Template ', 'yop_poll' ); ?>:</th>
6992
  <td>
6993
  <?php
6994
+ $templates = YOP_POLL_MODEL::get_yop_poll_templates_search( 'id', 'asc' );
6995
  ?>
6996
  <select class="yop-poll-widget-template" id="yop-poll-widget-template"
6997
  name="yop_poll_options[widget_template]"
6998
  onchange="yop_poll_return_template_preview(jQuery(this).val(), '#yop_poll_preview_widget_template', 2);">
6999
+ <option value=""><?php _e( '--SELECT Template--', 'yop_poll' ); ?></option>
7000
  <?php
7001
+ if ( count( $templates ) > 0 ){
7002
  foreach ( $templates as $template ) {
7003
  ?>
7004
  <option
7005
+ <?php if ( $default_options['widget_template'] == $template['id'] )
7006
+ echo 'selected="selected"' ?>
7007
  value="<?php echo $template['id']; ?>"><?php echo esc_html( stripslashes( $template['name'] ) ) ?></option>
7008
  <?php
7009
  }
7011
  ?>
7012
  </select>
7013
  <div id="yop_poll_preview_widget_template" style="position: relative; float: right;">
7014
+ <?php
7015
+ if ( ( $default_options['widget_template'] ) )
7016
+ print( Yop_Poll_Model::return_template_preview_html( $default_options['widget_template'], 2 ) );
7017
  ?>
7018
  </div>
7019
  </td>
7026
  type="text"
7027
  name="yop_poll_options[widget_template_width]"
7028
  style="width: 50%;"
7029
+ value="<?php echo $default_options['widget_template_width']; ?>"/>
7030
  </td>
7031
  </tr>
7032
  <tr>
7035
  </th>
7036
  <td><input id="yop-poll-percentages-decimals" type="text"
7037
  name="yop_poll_options[percentages_decimals]"
7038
+ value="<?php echo esc_html( stripslashes( $default_options['percentages_decimals'] ) ); ?>"/>
7039
  </td>
7040
  </tr>
7041
  <tr>
7043
  <?php _e( 'Use Default Loading Image', 'yop_poll' ); ?>:
7044
  </th>
7045
  <td><label for="yop-poll-use-default-loading-image-yes"><input
7046
+ <?php echo 'yes' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7047
  id="yop-poll-use-default-loading-image-yes" type="radio"
7048
  value="yes"
7049
+ name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7050
  <label for="yop-poll-use-default-loading-image-no"><input
7051
+ <?php echo 'no' == $default_options['use_default_loading_image'] ? 'checked="checked"' : ''; ?>
7052
  id="yop-poll-use-default-loading-image-no" type="radio"
7053
  value="no"
7054
+ name="yop_poll_options[use_default_loading_image]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7055
  </td>
7056
  </tr>
7057
+ <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;' : ''; ?>">
7058
  <th>
7059
  <?php _e( 'Loading Image Url', 'yop_poll' ); ?>:
7060
  </th>
7061
  <td><input id="yop-poll-loading-image-url" type="text"
7062
  name="yop_poll_options[loading_image_url]"
7063
+ value="<?php echo esc_html( stripslashes( $default_options['loading_image_url'] ) ); ?>"/>
7064
  </td>
7065
  </tr>
7066
 
7069
  <?php _e( 'Redirect After Vote', 'yop_poll' ); ?>:
7070
  </th>
7071
  <td><label for="yop-poll-redirect-after-vote-yes"><input
7072
+ <?php echo 'yes' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7073
  id="yop-poll-redirect-after-vote-yes" type="radio"
7074
  value="yes"
7075
+ name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7076
  <label for="yop-poll-redirect-after-vote-no"><input
7077
+ <?php echo 'no' == $default_options['redirect_after_vote'] ? 'checked="checked"' : ''; ?>
7078
  id="yop-poll-redirect-after-vote-no" type="radio"
7079
  value="no"
7080
+ name="yop_poll_options[redirect_after_vote]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7081
  </td>
7082
  </tr>
7083
+ <tr class="yop_poll_suboption" id="yop-poll-redirect-after-vote-url-div" style="<?php echo 'no' == $default_options['redirect_after_vote'] ? 'display: none;' : ''; ?>">
7084
  <th>
7085
  <?php _e( 'Redirect After Vote Url', 'yop_poll' ); ?>:
7086
  </th>
7087
  <td><input id="yop-poll-redirect-after-vote-url" type="text"
7088
  name="yop_poll_options[redirect_after_vote_url]"
7089
+ value="<?php echo esc_html( stripslashes( $default_options['redirect_after_vote_url'] ) ); ?>"/>
7090
  </td>
7091
  </tr>
7092
 
7095
  <?php _e( 'Reset Poll Stats Automatically', 'yop_poll' ); ?>:
7096
  </th>
7097
  <td><label for="yop-poll-schedule-reset-poll-stats-yes"><input
7098
+ <?php echo 'yes' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7099
  id="yop-poll-schedule-reset-poll-stats-yes" type="radio"
7100
  value="yes"
7101
+ name="yop_poll_options[schedule_reset_poll_stats]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7102
  <label for="yop-poll-schedule-reset-poll-stats-no"><input
7103
+ <?php echo 'no' == $default_options['schedule_reset_poll_stats'] ? 'checked="checked"' : ''; ?>
7104
  id="yop-poll-schedule-reset-poll-stats-no" type="radio"
7105
  value="no"
7106
+ name="yop_poll_options[schedule_reset_poll_stats]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7107
  </td>
7108
  </tr>
7109
+ <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;' : ''; ?>">
7110
  <th>
7111
+ <?php _e( 'Reset Stats Date', 'yop_poll' ); ?>
7112
+ :<br><small>(<?php _e( 'Current Server Time', 'yop_poll' );
7113
+ echo ': ' . current_time( 'mysql' ); ?>)</small>
7114
  </th>
7115
  <td><input id="yop-poll-schedule-reset-poll-stats-date" type="text"
7116
  name="yop_poll_options[schedule_reset_poll_date]"
7117
+ value="<?php echo date( 'Y-m-d H:i:s', $default_options['schedule_reset_poll_date'] ); ?>"/>
7118
  </td>
7119
  </tr>
7120
+ <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;' : ''; ?>">
7121
  <th>
7122
  <?php _e( 'Reset Stats Every', 'yop_poll' ); ?>:
7123
  </th>
7124
  <td><input style="width:20%" id="yop-poll-schedule-reset-poll-stats-recurring-value" type="text"
7125
  name="yop_poll_options[schedule_reset_poll_recurring_value]"
7126
+ value="<?php echo esc_html( stripslashes( $default_options['schedule_reset_poll_recurring_value'] ) ); ?>"/>
7127
  <select name="yop_poll_options[schedule_reset_poll_recurring_unit]">
7128
  <option value="hour" <?php echo selected( 'hour', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>HOURS</option>
7129
  <option value="day" <?php echo selected( 'day', $default_options['schedule_reset_poll_recurring_unit'] ) ?>>DAYS</option>
7132
  </tr>
7133
  <tr>
7134
  <th>
7135
+ <?php _e( 'Poll Date Format', 'yop_poll' ); ?>
7136
+ : <br/><small><?php _e( 'Check', 'yop_popll' ) ?>
7137
+ <a target="_blank" href="http://codex.wordpress.org/Formatting_Date_and_Time"> <?php _e( 'documentation', 'yop_popll' ) ?></a></small>
7138
  </th>
7139
  <td><input id="yop-poll-date-format" type="text"
7140
  name="yop_poll_options[date_format]"
7141
+ value="<?php echo esc_html( stripslashes( $default_options['date_format'] ) ); ?>"/>
7142
  </td>
7143
  </tr>
7144
  </tbody>
7147
  </div>
7148
  <div class="postbox" id="yop-poll-advanced-options-div">
7149
  <div title="Click to toggle" class="handlediv">
7150
+ <br/>
7151
  </div>
7152
  <h3 class="hndle">
7153
  <span><?php _e( 'Archive Options', 'yop_poll' ); ?></span>
7162
  <td><input
7163
  <?php checked( 'yes', $default_options['view_poll_archive_link'] ); ?>
7164
  id="yop-poll-view-poll-archive-link-yes" type="radio"
7165
+ value="yes" name="yop_poll_options[view_poll_archive_link]"/><label
7166
+ for="yop-poll-view-poll-archive-link-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7167
  <input
7168
  <?php checked( 'no', $default_options['view_poll_archive_link'] ); ?>
7169
  id="yop-poll-view-poll-archive-link-no" type="radio"
7170
+ value="no" name="yop_poll_options[view_poll_archive_link]"/><label
7171
+ for="yop-poll-view-poll-archive-link-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7172
  </td>
7173
  </tr>
7174
+ <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;' : ''; ?>">
7175
  <th>
7176
  <?php _e( 'View Poll Archive Link Label', 'yop_poll' ); ?>:
7177
  </th>
7178
  <td><input id="yop-poll-view-poll-archive-link-label"
7179
  type="text"
7180
  name="yop_poll_options[view_poll_archive_link_label]"
7181
+ value="<?php echo esc_html( stripslashes( $default_options['view_poll_archive_link_label'] ) ); ?>"/>
7182
  </td>
7183
  </tr>
7184
+ <tr id="yop-poll-view-poll-archive-link-div" style="<?php echo 'yes' != $default_options['view_poll_archive_link'] ? 'display: none;' : ''; ?>">
7185
  <th>
7186
  <?php _e( 'Poll Archive Url', 'yop_poll' ); ?>:
7187
  </th>
7188
  <td><input id="yop-poll-poll-archive-url" type="text"
7189
  name="yop_poll_options[poll_archive_url]"
7190
+ value="<?php echo esc_html( stripslashes( $default_options['poll_archive_url'] ) ); ?>"/>
7191
  </td>
7192
  </tr>
7193
  <tr>
7197
  <td><label for="yop-poll-show-in-archive-yes"><input
7198
  <?php checked( 'yes', $default_options['show_in_archive'] ); ?>
7199
  id="yop-poll-show-in-archive-yes" type="radio" value="yes"
7200
+ name="yop_poll_options[show_in_archive]"/> <?php _e( 'Yes', 'yop_poll' ); ?></label>
7201
  <label for="yop-poll-show-in-archive-no"><input
7202
  <?php checked( 'no', $default_options['show_in_archive'] ); ?>
7203
  id="yop-poll-show-in-archive-no" type="radio" value="no"
7204
+ name="yop_poll_options[show_in_archive]"/> <?php _e( 'No', 'yop_poll' ); ?></label>
7205
  </td>
7206
  </tr>
7207
+ <tr class="yop_poll_suboption" id="yop-poll-show-in-archive-div" style="<?php echo 'yes' != $default_options['show_in_archive'] ? 'display: none;' : ''; ?>">
7208
  <th>
7209
  <?php _e( 'Archive Order', 'yop_poll' ); ?>:
7210
  </th>
7211
  <td><input id="yop-poll-show-in-archive-order" type="text"
7212
  name="yop_poll_options[archive_order]"
7213
+ value="<?php echo esc_html( stripslashes( $default_options['archive_order'] ) ); ?>"/>
7214
  </td>
7215
  </tr>
7216
 
7219
  </div>
7220
  <div class="postbox" id="yop-poll-advanced-options-div8">
7221
  <div title="Click to toggle" class="handlediv">
7222
+ <br/>
7223
  </div>
7224
  <h3 class="hndle">
7225
  <span><?php _e( 'Notifications Options', 'yop_poll' ); ?></span>
7233
  </th>
7234
  <td><input <?php checked( 'yes', $default_options['send_email_notifications'] ); ?>
7235
  id="yop-poll-send-email-notifications-yes" type="radio"
7236
+ value="yes" name="yop_poll_options[send_email_notifications]"/><label
7237
+ for="yop-poll-send-email-notifications-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7238
  <input <?php checked( 'no', $default_options['send_email_notifications'] ); ?>
7239
  id="yop-poll-send-email-notifications-no" type="radio"
7240
+ value="no" name="yop_poll_options[send_email_notifications]"/><label
7241
+ for="yop-poll-send-email-notifications-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7242
  </td>
7243
  </tr>
7244
+ <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;' : ''; ?>">
7245
  <th>
7246
  <?php _e( 'Notifications From Name', 'yop_poll' ); ?>:
7247
  </th>
7249
  <input id="yop-poll-email-notifications-from-name"
7250
  type="text"
7251
  name="yop_poll_options[email_notifications_from_name]"
7252
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_name'] ) ); ?>"/>
7253
  </td>
7254
  </tr>
7255
+ <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;' : ''; ?>">
7256
  <th>
7257
  <?php _e( 'Notifications From Email', 'yop_poll' ); ?>:
7258
  </th>
7260
  <input id="yop-poll-email-notifications-from-email"
7261
  type="text"
7262
  name="yop_poll_options[email_notifications_from_email]"
7263
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_from_email'] ) ); ?>"/>
7264
  </td>
7265
  </tr>
7266
+ <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;' : ''; ?>">
7267
  <th>
7268
+ <?php _e( 'Notifications Recipients', 'yop_poll' ); ?>
7269
+ :<br><small><?php _e( 'Use comma separated email addresses: email@xmail.com,email2@xmail.com', 'yop_poll' ) ?></small>
7270
  </th>
7271
  <td valign="top">
7272
  <input id="yop-poll-email-notifications-recipients"
7273
  type="text"
7274
  name="yop_poll_options[email_notifications_recipients]"
7275
+ value="<?php echo esc_html( stripslashes( $default_options['email_notifications_recipients'] ) ); ?>"/>
7276
  </td>
7277
  </tr>
7278
+ <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;' : ''; ?>">
7279
  <th>
7280
  <?php _e( 'Notifications Subject', 'yop_poll' ); ?>:
7281
  </th>
7287
  />
7288
  </td>
7289
  </tr>
7290
+ <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;' : ''; ?>">
7291
  <th>
7292
  <?php _e( 'Notifications Body', 'yop_poll' ); ?>:
7293
  </th>
7299
  </table>
7300
  </div>
7301
  </div>
7302
+ <?php if ( false ){ ?>
7303
  <div class="postbox" id="yop-poll-advanced-options-div9">
7304
  <div title="Click to toggle" class="handlediv">
7305
+ <br/>
7306
  </div>
7307
  <h3 class="hndle">
7308
  <span><?php _e( 'Facebook Share Options', 'yop_poll' ); ?>
7309
+ <?php if ( $pro_options['pro_user'] == 'no' ){ ?>
7310
+ <small>(<?php _e( 'Available only for pro version of Yop Poll', 'yop_poll' ); ?> )</small>
7311
  <?php } ?>
7312
  </span>
7313
  </h3>
7321
  <td><input
7322
  <?php checked( 'yes', $default_options['share_after_vote'] ); ?>
7323
  id="yop-poll-share-after-vote-yes" type="radio"
7324
+ value="yes" name="yop_poll_options[share_after_vote]"/><label
7325
+ for="yop-poll-share-after-vote-yes"><?php _e( 'Yes', 'yop_poll' ); ?></label>
7326
  <input
7327
  <?php checked( 'no', $default_options['share_after_vote'] ); ?>
7328
  id="yop-poll-share-after-vote-no" type="radio"
7329
+ value="no" name="yop_poll_options[share_after_vote]"/><label
7330
+ for="yop-poll-share-after-vote-no"><?php _e( 'No', 'yop_poll' ); ?></label>
7331
  </td>
7332
  </tr>
7333
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-name-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7334
  <th>
7335
  <?php _e( 'Share Name', 'yop_poll' ); ?>:
7336
  </th>
7337
  <td><input id="yop-poll-share-name"
7338
  type="text"
7339
  name="yop_poll_options[share_name]"
7340
+ value="<?php echo esc_html( stripslashes( $default_options['share_name'] ) ); ?>"/>
7341
  </td>
7342
+ </tr>
7343
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-caption-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7344
  <th>
7345
  <?php _e( 'Share Caption', 'yop_poll' ); ?>:
7346
  </th>
7347
  <td><input id="yop-poll-share-caption"
7348
  type="text"
7349
  name="yop_poll_options[share_caption]"
7350
+ value="<?php echo esc_html( stripslashes( $default_options['share_caption'] ) ); ?>"/>
7351
  </td>
7352
  </tr>
7353
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-description-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7354
  <th>
7355
  <?php _e( 'Share Description', 'yop_poll' ); ?>:
7356
  </th>
7357
  <td><input id="yop-poll-share-description"
7358
  type="text"
7359
  name="yop_poll_options[share_description]"
7360
+ value="<?php echo esc_html( stripslashes( $default_options['share_description'] ) ); ?>"/>
7361
  </td>
7362
+ </tr>
7363
+ <tr class="yop_poll_suboption" id="yop-poll-share-after-vote-picture-tr" style="<?php echo 'yes' != $default_options['share_after_vote'] ? 'display: none;' : ''; ?>">
7364
  <th>
7365
  <?php _e( 'Share Picture', 'yop_poll' ); ?>:
7366
  </th>
7367
  <td><input id="yop-poll-share-picture"
7368
  type="text"
7369
  name="yop_poll_options[share_picture]"
7370
+ value="<?php echo esc_html( stripslashes( $default_options['share_picture'] ) ); ?>"/>
7371
  </td>
7372
+ </tr>
7373
 
7374
  </table>
7375
  </div>
7377
  <?php } ?>
7378
  </div>
7379
  <input type="hidden" value="<?php echo $poll_id ?>"
7380
+ name="yop_poll_id" id="yop-poll-edit-add-new-form-poll-id"/> <input
7381
  type="hidden" value="<?php echo $action_type ?>"
7382
+ name="action_type" id="yop-poll-edit-add-new-form-action-type"/>
7383
  <input type="button" accesskey="p" class="button-primary"
7384
  value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7385
+ id="yop-poll-edit-add-new-form-submit"/>
7386
  </div>
7387
  <div class="postbox-container" id="postbox-container-1">
7388
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
7389
  <div class="postbox " id="linksubmitdiv">
7390
  <div title="Click to toggle" class="handlediv">
7391
+ <br/>
7392
  </div>
7393
  <h3 class="hndle">
7394
  <span><?php _e( 'Save', 'yop_poll' ); ?></span>
7399
  <div id="publishing-action">
7400
  <input type="button" accesskey="p" class="button-primary"
7401
  value="<?php _e( 'Save Poll', 'yop_poll' ); ?>"
7402
+ id="yop-poll-edit-add-new-form-submit1"/>
7403
  </div>
7404
  <div class="clear"></div>
7405
  </div>
7410
  <?php if ( 'edit' == $action ) : ?>
7411
  <div id="submitdiv" class="postbox ">
7412
  <div title="Click to toggle" class="handlediv">
7413
+ <br/>
7414
  </div>
7415
  <h3 class="hndle">
7416
  <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
7420
  <div id="minor-publishing">
7421
  <div id="misc-publishing-actions">
7422
  <div class="misc-pub-section">
7423
+ <label for="post_status"><?php _e( 'Poll Author', 'yop_poll' ) ?>
7424
+ :</label>
7425
+ <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'] );
7426
+ echo $poll_author->user_nicename; ?></b></span>
7427
  <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>
7428
  </div>
7429
  </div>
7430
  <div id="misc-publishing-actions">
7431
  <div class="misc-pub-section">
7432
+ <label for="post_status"><?php _e( 'Total Votes', 'yop_poll' ) ?>
7433
+ :</label>
7434
  <span id="yop-poll-change-no-votes-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_votes'] ?></b></span>
7435
  <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>
7436
  </div>
7437
  </div>
7438
  <div id="misc-publishing-actions">
7439
  <div class="misc-pub-section">
7440
+ <label for="post_status"><?php _e( 'Total Answers', 'yop_poll' ) ?>
7441
+ :</label>
7442
  <span id="yop-poll-change-no-answers-poll-container-<?php echo $current_poll['id'] ?>"><b><?php echo $current_poll['total_answers'] ?></b></span>
7443
  <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>
7444
  </div>
7445
+ </div>
7446
  </div>
7447
  <div class="clear"></div>
7448
  </div>
7458
  </div>
7459
  <?php
7460
  }
7461
+
7462
  public function view_add_edit_poll_template() {
7463
  global $action, $current_user;
7464
+ $page_name = __( 'Add New Poll Template', 'yop_poll' );
7465
  $action_type = 'add-new';
7466
  $template_id = '';
7467
+ if ( 'edit' == $action ){
7468
+ $template_id = ( isset ( $_GET ['id'] ) ? intval( $_GET ['id'] ) : 0 );
7469
+ $template_author = Yop_Poll_Model::get_poll_template_field_from_database_by_id( 'template_author', $template_id );
7470
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_author != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7471
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7472
+ $page_name = __( 'Edit Poll Template', 'yop_poll' );
7473
  $action_type = 'edit';
7474
  }
7475
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7476
+ $current_template = YOP_POLL_MODEL::get_poll_template_from_database_by_id( $template_id );
7477
  ?>
7478
  <div class="wrap">
7479
  <div class="icon32 icon32-yop-poll">
7480
  <br>
7481
 
7482
  </div>
7483
+ <h2><?php print $page_name; ?><?php if ('edit' == $action): ?><a
7484
  class="add-new-h2"
7485
  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>
7486
  <div id="message"></div>
7497
  <div class="inside">
7498
  <input type="text" id="yop-poll-template-name"
7499
  value="<?php echo esc_html( stripslashes( $current_template['name'] ) ); ?>"
7500
+ tabindex="1" name="yop_poll_template_name" size="30"/>
7501
  <p><?php _e( 'Example: Test Poll Template', 'yop_poll' ); ?></p>
7502
  </div>
7503
  </div>
7506
  <label for="yop-poll-before_vote-template-input"><?php _e( 'Template Before Vote', 'yop_poll' ); ?></label>
7507
  </h3>
7508
  <div class="inside">
7509
+ <?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 ) ); ?>
7510
  </div>
7511
  </div>
7512
  <div class="stuffbox" id="yop-poll-after-vote-template-div">
7514
  <label for="yop-poll-after-vote-template-input"><?php _e( 'Template After Vote', 'yop_poll' ); ?></label>
7515
  </h3>
7516
  <div class="inside">
7517
+ <?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 ) ); ?>
7518
  </div>
7519
  </div>
7520
  <div class="postbox" id="yop-poll-template-before-start-date-div">
7527
  <label for="yop-poll-template-before-start-date-input"><?php _e( 'Template Before Start Date', 'yop_poll' ); ?></label>
7528
  </h3>
7529
  <div class="inside">
7530
+ <?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 ) ); ?>
7531
  </div>
7532
  </div>
7533
  <div class="postbox" id="yop-poll-template-after-end-date-div">
7540
  <label for="yop-poll-template-after-end-date-input"><?php _e( 'Template After End Date', 'yop_poll' ); ?></label>
7541
  </h3>
7542
  <div class="inside">
7543
+ <?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 ) ); ?>
7544
  </div>
7545
  </div>
7546
  <div class="postbox" id="yop-poll-template-css-div">
7553
  <label for="yop-poll-template-css-input"><?php _e( 'Css', 'yop_poll' ); ?></label>
7554
  </h3>
7555
  <div class="inside">
7556
+ <?php wp_editor( stripslashes( $current_template['css'] ), 'yop-poll-template-css-input', array( 'textarea_name' => 'yop_poll_template_css', 'teeny' => true, 'media_buttons' => false ) ); ?>
7557
  </div>
7558
  </div>
7559
  <div class="postbox" id="yop-poll-template-js-div">
7566
  <label for="yop-poll-template-js-input"><?php _e( 'JavaScript', 'yop_poll' ); ?></label>
7567
  </h3>
7568
  <div class="inside">
7569
+ <?php wp_editor( stripslashes( $current_template['js'] ), 'yop-poll-template-js-input', array( 'textarea_name' => 'yop_poll_template_js', 'teeny' => true, 'media_buttons' => false ) ); ?>
7570
  </div>
7571
  </div>
7572
 
7573
  <input type="hidden" value="<?php echo $current_template['id']; ?>"
7574
  name="template_id"
7575
+ id="yop-poll-edit-add-new-template-form-template-id"/> <input
7576
  type="hidden" value="<?php echo $action_type ?>"
7577
  name="action_type"
7578
+ id="yop-poll-edit-add-new-template-form-action-type"/> <input
7579
  type="button" class="button-primary"
7580
+ value="<?php _e( 'Save Poll Template', 'yop_poll' ) ?>"
7581
+ id="yop-poll-edit-add-new-template-form-save"/>
7582
  </div>
7583
  <div class="postbox-container" id="postbox-container-1">
7584
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
7585
  <div class="postbox " id="linksubmitdiv">
7586
  <div title="Click to toggle" class="handlediv">
7587
+ <br/>
7588
  </div>
7589
  <h3 class="hndle">
7590
  <span><?php _e( 'Save', 'yop_poll' ); ?></span>
7595
  <div id="publishing-action">
7596
  <input type="button" accesskey="p" class="button-primary"
7597
  value="<?php _e( 'Save Poll Template', 'yop_poll' ); ?>"
7598
+ id="yop-poll-edit-add-new-template-form-save1"/>
7599
  </div>
7600
  <div class="clear"></div>
7601
  </div>
7604
  </div>
7605
  </div>
7606
  <?php
7607
+ if ( 'edit' == $action ){
7608
  ?>
7609
  <div id="submitdiv" class="postbox ">
7610
  <div title="Click to toggle" class="handlediv">
7611
+ <br/>
7612
  </div>
7613
  <h3 class="hndle">
7614
  <span><?php _e( 'Tools ', 'yop_poll' ); ?></span>
7618
  <div id="minor-publishing">
7619
  <div id="misc-publishing-actions">
7620
  <div class="misc-pub-section">
7621
+ <label for="post_status"><?php _e( 'Template Author', 'yop_poll' ) ?>
7622
+ :</label>
7623
+ <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'] );
7624
+ echo $template_author->user_nicename; ?></b></span>
7625
  <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>
7626
  </div>
7627
+ </div>
7628
  </div>
7629
  <div class="clear"></div>
7630
  </div>
7632
  <div id="minor-publishing">
7633
  <div id="misc-publishing-actions">
7634
  <div class="misc-pub-section">
7635
+ <p><?php _e( 'Select Template For Reset', 'yop_poll' ) ?>
7636
+ :</p>
7637
  <select name="yop_poll_reset_template_id"
7638
  id="yop-poll-reset-template-id">
7639
+ <option <?php selected( 'White', $current_template['name'] ); ?> value="1"><?php _e( 'White', 'yop_poll' ) ?></option>
7640
+ <option <?php selected( 'Grey', $current_template['name'] ); ?> value="2"><?php _e( 'Grey', 'yop_poll' ) ?></option>
7641
+ <option <?php selected( 'Dark', $current_template['name'] ); ?> value="3"><?php _e( 'Dark', 'yop_poll' ) ?></option>
7642
+ <option <?php selected( 'Blue v1', $current_template['name'] ); ?> value="4"><?php _e( 'Blue v1', 'yop_poll' ) ?></option>
7643
+ <option <?php selected( 'Blue v2', $current_template['name'] ); ?> value="5"><?php _e( 'Blue v2', 'yop_poll' ) ?></option>
7644
+ <option <?php selected( 'Blue v3', $current_template['name'] ); ?> value="6"><?php _e( 'Blue v3', 'yop_poll' ) ?></option>
7645
+ <option <?php selected( 'Red v1', $current_template['name'] ); ?> value="7"><?php _e( 'Red v1', 'yop_poll' ) ?></option>
7646
+ <option <?php selected( 'Red v2', $current_template['name'] ); ?> value="8"><?php _e( 'Red v2', 'yop_poll' ) ?></option>
7647
+ <option <?php selected( 'Red v3', $current_template['name'] ); ?> value="9"><?php _e( 'Red v3', 'yop_poll' ) ?></option>
7648
+ <option <?php selected( 'Green v1', $current_template['name'] ); ?> value="10"><?php _e( 'Green v1', 'yop_poll' ) ?></option>
7649
+ <option <?php selected( 'Green v2', $current_template['name'] ); ?> value="11"><?php _e( 'Green v2', 'yop_poll' ) ?></option>
7650
+ <option <?php selected( 'Green v3', $current_template['name'] ); ?> value="12"><?php _e( 'Green v3', 'yop_poll' ) ?></option>
7651
+ <option <?php selected( 'Orange v1', $current_template['name'] ); ?> value="13"><?php _e( 'Orange v1', 'yop_poll' ) ?></option>
7652
+ <option <?php selected( 'Orange v2', $current_template['name'] ); ?> value="14"><?php _e( 'Orange v2', 'yop_poll' ) ?></option>
7653
+ <option <?php selected( 'Orange v3', $current_template['name'] ); ?> value="15"><?php _e( 'Orange v3', 'yop_poll' ) ?></option>
7654
  </select>
7655
+ </div>
7656
+ </div>
7657
  </div>
7658
  <div class="clear"></div>
7659
  </div>
7662
  <div id="publishing-action">
7663
  <input type="button" accesskey="r" class="button-primary"
7664
  value="<?php _e( 'Reset Poll Template', 'yop_poll' ); ?>"
7665
+ 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() }"/>
7666
  </div>
7667
  <div class="clear"></div>
7668
  </div>
7690
  * Start Ajax section
7691
  */
7692
  function ajax_edit_add_new_poll() {
7693
+ if ( is_admin() ){
7694
  global $wpdb, $current_user;
7695
+ check_ajax_referer( 'yop-poll-edit-add-new' );
7696
+
7697
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7698
  $yop_poll_model = new Yop_Poll_Model ();
7699
+ if ( 'add-new' == $_REQUEST ['action_type'] ){
7700
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) ) && ( !$this->current_user_can( 'edit_polls' ) ) )
7701
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7702
  else {
7703
+ $yop_poll_id = $yop_poll_model->add_poll_to_database( $_REQUEST, $this->_config );
7704
+ if ( $yop_poll_id ){
7705
+ _e( 'Poll successfully added!', 'yop_poll' );
7706
+ }
7707
+ else {
7708
  echo $yop_poll_model->error;
7709
  }
7710
  }
7711
  }
7712
+ if ( 'edit' == $_REQUEST ['action_type'] ){
7713
+ if ( ctype_digit( $_REQUEST ['yop_poll_id'] ) ){
7714
+ $poll_details = Yop_Poll_Model::get_poll_from_database_by_id( $_REQUEST ['yop_poll_id'] );
7715
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
7716
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7717
  else {
7718
+ $yop_poll_id = $yop_poll_model->edit_poll_in_database( $_REQUEST, $this->_config );
7719
+ if ( $yop_poll_id )
7720
+ _e( 'Poll successfully Edited!', 'yop_poll' );
7721
  else
7722
  echo $yop_poll_model->error;
7723
  }
7724
+ }
7725
+ else
7726
+ _e( 'We\'re unable to update your poll!', 'yop_poll' );
7727
  }
7728
  unset ( $yop_poll_model );
7729
  }
7730
  die ();
7731
  }
7732
+
7733
  function ajax_edit_add_new_poll_template() {
7734
+ if ( is_admin() ){
7735
  global $wpdb, $current_user;
7736
+ check_ajax_referer( 'yop-poll-edit-add-new-template' );
7737
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7738
  $yop_poll_model = new Yop_Poll_Model ();
7739
+ if ( 'add-new' == $_REQUEST ['action_type'] ){
7740
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7741
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7742
  else {
7743
+ $yop_poll_template_id = $yop_poll_model->add_poll_template_to_database( $_REQUEST, $this->_config );
7744
+ if ( $yop_poll_template_id ){
7745
+ _e( 'Poll template successfully added!', 'yop_poll' );
7746
+ }
7747
+ else {
7748
  echo $yop_poll_model->error;
7749
  }
7750
  }
7751
  }
7752
+ if ( 'edit' == $_REQUEST ['action_type'] ){
7753
+ if ( ctype_digit( $_REQUEST ['template_id'] ) ){
7754
+ $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
7755
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7756
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7757
  else {
7758
+ $yop_poll_template_id = $yop_poll_model->edit_poll_template_in_database( $_REQUEST, $this->_config );
7759
+ if ( $yop_poll_template_id ){
7760
+ _e( 'Poll Template successfully Edited!', 'yop_poll' );
7761
+ }
7762
+ else {
7763
  echo $yop_poll_model->error;
7764
  }
7765
  }
7766
+ }
7767
+ else
7768
+ _e( 'We\'re unable to update your poll template!', 'yop_poll' );
7769
  }
7770
  unset ( $yop_poll_model );
7771
  }
7772
  die ();
7773
  }
7774
+
7775
  function ajax_reset_poll_template() {
7776
+ if ( is_admin() ){
7777
  global $wpdb, $current_user;
7778
+ check_ajax_referer( 'yop-poll-edit-add-new-template' );
7779
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7780
  $yop_poll_model = new Yop_Poll_Model ();
7781
+ if ( 'edit' == $_REQUEST ['action_type'] ){
7782
+ if ( ctype_digit( $_REQUEST ['template_id'] ) ){
7783
+ $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $_REQUEST ['template_id'] );
7784
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
7785
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
7786
  else {
7787
+ $yop_poll_template_id = $yop_poll_model->reset_poll_template( $_REQUEST, $this->_config );
7788
+ if ( $yop_poll_template_id ){
7789
+ _e( 'Poll Template Successfully Reseted!', 'yop_poll' );
7790
+ }
7791
+ else {
7792
  echo $yop_poll_model->error;
7793
  }
7794
  }
7795
+ }
7796
+ else
7797
+ _e( 'We\'re unable to reset your poll template!', 'yop_poll' );
7798
  }
7799
  unset ( $yop_poll_model );
7800
  }
7801
  die ();
7802
  }
7803
+
7804
  public function yop_poll_do_vote() {
7805
+ $error = '';
7806
  $success = '';
7807
  $message = '';
7808
+ if ( is_admin() ){
7809
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
7810
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7811
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7812
+ if ( $poll_id ){
7813
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7814
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7815
  $yop_poll_model->set_unique_id( $unique_id );
7816
+ $poll_html = $yop_poll_model->register_vote( $_REQUEST );
7817
+ if ( $poll_html ){
7818
  $message = $poll_html;
7819
+ $success = $yop_poll_model->success;
7820
+ }
7821
+ else {
7822
  $error = $yop_poll_model->error;
7823
  }
7824
  unset ( $yop_poll_model );
7825
+ }
7826
+ else {
7827
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7828
  }
7829
  }
7830
+ print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
 
 
 
 
7831
  die ();
7832
  }
7833
+
7834
  public function yop_poll_view_results() {
7835
+ $error = '';
7836
  $success = '';
7837
  $message = '';
7838
+ if ( is_admin() ){
7839
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
7840
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
7841
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
7842
+ $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
7843
+ if ( $poll_id ){
7844
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7845
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7846
  $yop_poll_model->set_unique_id( $unique_id );
7847
  $yop_poll_model->vote = true;
7848
+ $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array( 'tr_id' => $tr_id, 'location' => $location ) ) );
7849
+ if ( $poll_html ){
7850
  $message = $poll_html;
7851
  $success = $yop_poll_model->success;
7852
+ }
7853
+ else {
7854
  $error = $yop_poll_model->error;
7855
  }
7856
  unset ( $yop_poll_model );
7857
+ }
7858
+ else {
7859
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7860
  }
7861
  }
7862
+ print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
 
 
 
 
7863
  die ();
7864
  }
7865
+
7866
  public function yop_poll_back_to_vote() {
7867
+ $error = '';
7868
  $success = '';
7869
  $message = '';
7870
+ if ( is_admin() ){
7871
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : 0;
7872
+ $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : '';
7873
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : 'page';
7874
+ $tr_id = isset ( $_REQUEST ['tr_id'] ) ? $_REQUEST ['tr_id'] : '';
7875
+ if ( $poll_id ){
7876
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7877
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7878
  $yop_poll_model->set_unique_id( $unique_id );
7879
+ $poll_html = do_shortcode( $yop_poll_model->return_poll_html( array( 'tr_id' => $tr_id, 'location' => $location ) ) );
7880
+ if ( $poll_html ){
7881
  $message = $poll_html;
7882
  $success = $yop_poll_model->success;
7883
+ }
7884
+ else {
7885
  $error = $yop_poll_model->error;
7886
  }
7887
  unset ( $yop_poll_model );
7888
+ }
7889
+ else {
7890
+ $error = __( 'Invalid Request! Try later!', 'yop_poll' );
7891
  }
7892
  }
7893
+ print '[ajax-response]' . json_encode( array( 'error' => $error, 'success' => $success, 'message' => $message ) ) . '[/ajax-response]';
 
 
 
 
7894
  die ();
7895
  }
7896
+
7897
  public function yop_poll_load_css() {
7898
+ header( 'Content-Type: text/css' );
7899
  // check_ajax_referer('yop-poll-public-css');
7900
+ if ( is_admin() ){
7901
+ $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
7902
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7903
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7904
+ if ( $poll_id ){
7905
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7906
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7907
  $yop_poll_model->set_unique_id( $unique_id );
7908
+ $poll_css = $yop_poll_model->return_poll_css( array( 'location' => $location ) );
7909
  print $poll_css;
7910
  unset ( $yop_poll_model );
7911
  }
7912
  }
7913
  die ();
7914
  }
7915
+
7916
+ public function yop_poll_load_js() {
7917
+ header( 'Content-Type: text/javascript' );
7918
  // check_ajax_referer('yop-poll-public-js');
7919
+ if ( is_admin() ){
7920
+ $poll_id = isset ( $_REQUEST ['id'] ) ? $_REQUEST ['id'] : NULL;
7921
+ $location = isset ( $_REQUEST ['location'] ) ? $_REQUEST ['location'] : NULL;
7922
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
7923
+ if ( $poll_id ){
7924
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7925
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
7926
  $yop_poll_model->set_unique_id( $unique_id );
7927
+ $poll_js = $yop_poll_model->return_poll_js( array( 'location' => $location ) );
7928
  print $poll_js;
7929
  unset ( $yop_poll_model );
7930
  }
7931
  }
7932
  die ();
7933
  }
7934
+
7935
  public function ajax_get_polls_for_editor() {
7936
+ check_ajax_referer( 'yop-poll-editor' );
7937
+ if ( is_admin() ){
7938
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
7939
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
7940
  ?>
7941
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
7942
  <html xmlns="http://www.w3.org/1999/xhtml">
7943
  <head>
7944
+ <title><?php _e( 'Insert Poll', 'yop_poll' ); ?></title>
7945
  <script type="text/javascript"
7946
  src="<?php echo get_option( 'siteurl' ) ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
7947
  <script type="text/javascript">
7948
  function insertYopPollTinyMce( poll_id, tr_id ) {
7949
+ tr_id = typeof tr_id !== 'undefined' ? tr_id : '';
7950
  if ( isNaN( poll_id ) ) {
7951
  alert( '<?php _e( 'Error: Invalid Yop Poll!\n\nPlease choose the poll again:\n\n', 'yop_poll' ) ?>' );
7952
  }
7953
  else {
7954
  if ( poll_id != null && poll_id != '' ) {
7955
+ if ( tr_id != '' ) {
7956
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll id="' + poll_id + '" tr_id="' + tr_id + '"]' );
7957
+ }
7958
+ else {
7959
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll id="' + poll_id + '"]' );
7960
+ }
7961
  }
7962
  else {
7963
+ tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '[yop_poll]' );
7964
  }
7965
  tinyMCEPopup.close();
7966
  }
7975
  <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
7976
  <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
7977
  <?php
7978
+ if ( count( $yop_polls ) > 0 ){
7979
  foreach ( $yop_polls as $yop_poll ) {
7980
  ?>
7981
  <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
7985
  ?>
7986
  </select>
7987
  </label>
7988
+ <br/>
7989
  <label for="yop-poll-tr-id-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span><br>
7990
+ <input class="widefat" name="yop_poll_tr_id" id="yop-poll-tr-id-dialog"/>
7991
  </label>
7992
 
7993
 
7994
  <center> <input type="button" class="button-primary"
7995
  value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
7996
+ onclick=" insertYopPollTinyMce( document.getElementById('yop-poll-id-dialog').value, document.getElementById('yop-poll-tr-id-dialog').value );"/></center>
7997
+ <br/>
7998
  <center> <input type="button" class="button-primary"
7999
  value="<?php _e( 'Close', 'yop_poll' ); ?>"
8000
+ onclick="tinyMCEPopup.close();"/></center>
8001
  </p>
8002
  </body>
8003
  </html>
8005
  }
8006
  die ();
8007
  }
8008
+
8009
  public function ajax_preview_template() {
8010
+ if ( true /*check_ajax_referer( 'yop-poll-edit-add-new' )*/ ){
8011
+ if ( is_admin() ){
8012
  $template_id = trim( $_POST['template_id'] );
8013
  $loc = trim( $_POST['loc'] );
8014
  require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8015
  $yop_poll_model = new Yop_Poll_Model();
8016
+ $template = $yop_poll_model->return_template_preview_html( $template_id, $loc );
8017
  print $template;
8018
  unset( $yop_poll_model );
8019
  }
8020
  }
8021
  die();
8022
  }
8023
+
8024
  public function ajax_get_polls_for_html_editor() {
8025
+ check_ajax_referer( 'yop-poll-html-editor' );
8026
+ if ( is_admin() ){
8027
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8028
+ $yop_polls = Yop_Poll_Model::get_yop_polls_filter_search( 'id', 'asc' );
8029
  ?>
8030
  <p style="text-align: center;">
8031
  <label for="yop-poll-id-html-dialog"> <span><?php _e( 'Poll to Display', 'yop_poll' ); ?>:</span>
8035
  <option value="-2"><?php _e( 'Display Latest Poll', 'yop_poll' ); ?></option>
8036
  <option value="-1"><?php _e( 'Display Current Active Poll', 'yop_poll' ); ?></option>
8037
  <?php
8038
+ if ( count( $yop_polls ) > 0 ){
8039
  foreach ( $yop_polls as $yop_poll ) {
8040
  ?>
8041
  <option value="<?php echo $yop_poll['id']; ?>"><?php echo esc_html( stripslashes( $yop_poll['name'] ) ); ?></option>
8043
  }
8044
  }
8045
  ?>
8046
+ </select>
8047
  </label>
8048
+ <br/><br/>
8049
  <label for="yop-poll-tr-id-html-dialog"> <span><?php _e( 'Tracking ID', 'yop_poll' ); ?>:</span>
8050
+ <input type="text" name="yop_poll_tr_id" id="yop-poll-tr-id-html-dialog" class="widefat" value=""/>
8051
+ </label>
8052
 
8053
+ <br/> <br/> <input type="button" class=""
8054
  value="<?php _e( 'Insert Poll', 'yop_poll' ); ?>"
8055
+ onclick=" insertYopPoll( edCanvas, document.getElementById('yop-poll-id-html-dialog').value, document.getElementById('yop-poll-tr-id-html-dialog').value );"/>
8056
+ <br/> <br/> <input type="button" class=""
8057
+ value="<?php _e( 'Close', 'yop_poll' ); ?>" onclick="tb_remove();"/>
8058
  </p>
8059
 
8060
  <?php
8061
  }
8062
  die ();
8063
  }
8064
+
8065
  public function ajax_show_captcha() {
8066
+ if ( is_admin() ){
8067
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8068
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8069
+ if ( $poll_id ){
8070
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8071
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8072
  $yop_poll_model->set_unique_id( $unique_id );
8073
  $poll_options = $yop_poll_model->poll_options;
8074
+ if ( 'yes' == $poll_options ['use_captcha'] ){
8075
+ require_once( $this->_config->plugin_inc_dir . '/securimage.php' );
8076
+ $img = new Yop_Poll_Securimage ();
8077
+ $img->ttf_file = $this->_config->plugin_path . 'captcha/AHGBold.ttf';
8078
+ $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8079
  $img->image_height = 60;
8080
+ $img->image_width = intval( $img->image_height * M_E );
8081
+ $img->text_color = new Yop_Poll_Securimage_Color ( rand( 0, 255 ), rand( 0, 255 ), rand( 0, 255 ) );
8082
+ $img->show();
8083
+ }
8084
+ }
8085
+ else
8086
+ wp_die( 'Invalid Poll' );
8087
+ }
8088
+ else
8089
+ wp_die( 'captcha error' );
8090
  die ();
8091
  }
8092
+
8093
  public function ajax_play_captcha() {
8094
+ if ( is_admin() ){
8095
+ $poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : NULL;
8096
  $unique_id = isset ( $_REQUEST ['unique_id'] ) ? $_REQUEST ['unique_id'] : NULL;
8097
+ if ( $poll_id ){
8098
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8099
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8100
+ $poll_options = $yop_poll_model->poll_options;
8101
+ if ( 'yes' == $poll_options ['use_captcha'] ){
8102
+ require_once( $this->_config->plugin_inc_dir . '/securimage.php' );
8103
+ $img = new Yop_Poll_Securimage ();
8104
+ $img->audio_path = $this->_config->plugin_path . 'captcha/audio/';
8105
  $img->audio_noise_path = $this->_config->plugin_path . 'captcha/audio/noise/';
8106
+ $img->namespace = 'yop_poll_' . $poll_id . $unique_id;
8107
 
8108
+ $img->outputAudioFile();
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_show_optin_box_modal() {
8120
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8121
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8122
+ $optin_box_modal_options ['show'] = 'no'; //restore to no
8123
+ $optin_box_modal_options ['last_show_date'] = Yop_Poll_Model::get_mysql_curent_date();
8124
+ update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8125
  ?>
8126
  <?php
8127
+ $this->yop_poll_optin_form1();
8128
  ?>
8129
  <?php
8130
  die ();
8131
  }
8132
+
8133
  public function ajax_modal_option_signup() {
8134
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8135
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8136
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
8137
+ update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8138
  die ();
8139
  }
8140
+
8141
  public function ajax_sidebar_option_signup() {
8142
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8143
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8144
  $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
8145
+ update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
8146
  die ();
8147
  }
8148
+
8149
  public function ajax_is_wordpress_user() {
8150
  global $current_user;
8151
  if ( $current_user->ID > 0 )
8153
  else
8154
  print '[response]false[/response]';
8155
  die();
8156
+ }
8157
+
8158
  public static function base64_decode( $str ) {
8159
+ $str = str_replace( '-', '/', $str );
8160
+ $str = str_replace( '_', '+', $str );
8161
  return base64_decode( $str );
8162
  }
8163
+
8164
  public function ajax_set_wordpress_vote() {
8165
 
8166
+ $poll_id = self::base64_decode( $_GET['poll_id'] );
8167
+ $unique_id = self::base64_decode( $_GET['unique_id'] );
8168
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8169
  $yop_poll_model = new YOP_POLL_MODEL ( $poll_id );
8170
 
8171
+ $answers = YOP_POLL_MODEL::get_poll_answers( $poll_id, array( 'default', 'other' ) );
8172
+ $yop_poll_answers = array();
8173
+ if ( count( $answers ) > 0 ){
8174
  foreach ( $answers as $answer ) {
8175
+ $yop_poll_answers[] = array( 'id' => $answer['id'], 'value' => html_entity_decode( (string)$answer['answer'], ENT_QUOTES, 'UTF-8' ), 'type' => $answer['type'] );
8176
  }
8177
  }
8178
 
8179
+ $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' ),
 
 
 
 
 
 
 
 
 
 
 
 
8180
 
8181
+ ) );
 
8182
 
8183
  ?>
8184
  <!DOCTYPE html>
8188
  <script type="text/javascript">
8189
 
8190
  function close_window() {
8191
+ var yop_poll_various_config = new Object();
8192
+ yop_poll_various_config.poll_id = '<?php echo self::base64_decode( $_GET['poll_id'] ) ?>';
8193
+ yop_poll_various_config.unique_id = '<?php echo self::base64_decode( $_GET['unique_id'] ) ?>';
8194
+ yop_poll_various_config.poll_location = '<?php echo self::base64_decode( $_GET['poll_location'] ) ?>';
8195
+ yop_poll_various_config.is_modal = <?php echo self::base64_decode( $_GET['is_modal'] ) == 'true' ? 'true' : 'false'; ?>;
8196
+ yop_poll_various_config.vote_loading_image_target = '<?php echo self::base64_decode( $_GET['vote_loading_image_target'] ) ?>';
8197
+ yop_poll_various_config.vote_loading_image_id = '<?php echo self::base64_decode( $_GET['vote_loading_image_id'] ) ?>';
8198
+ yop_poll_various_config.vote_type = '<?php echo self::base64_decode( $_GET['vote_type'] ) ?>';
8199
+ yop_poll_various_config.facebook_user_details = '<?php echo isset( $_GET['facebook_user_details'] ) ? $_GET['facebook_user_details'] : '' ?>';
8200
+ yop_poll_various_config.facebook_error = '<?php echo isset( $_GET['facebook_error'] ) ? $_GET['facebook_error'] : '' ?>';
8201
+ yop_poll_various_config.public_config = <?php echo json_encode( $public_config ); ?>;
8202
+ 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' ) ?>' );
8203
  result = window.opener.yop_poll_do_vote( yop_poll_various_config );
8204
+ if ( result ) {
8205
  window.close();
8206
+ }
8207
  }
8208
  </script>
8209
  </head>
8210
  <body onload="close_window()">
8211
+ <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>
8212
  </div>
8213
  </body>
8214
  </html>
8215
  <?php
8216
  die();
8217
  }
8218
+
8219
  public function ajax_do_change_votes_number_answer() {
8220
  global $current_user;
8221
+ $answer_id = intval( $_POST['yop_poll_answer_id'] );
8222
+ $votes_number = intval( $_POST['yop_poll_answer_votes'] );
8223
+ $change_to_all = $_POST['yop_poll_change_to_all_poll_answers'];
8224
+ $according_to_logs = $_POST['yop_poll_update_answers_with_logs'];
8225
+ $response = NULL;
8226
 
8227
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8228
+ $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8229
 
8230
  $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8231
+ $poll_details = $yop_poll_model->get_current_poll();
8232
 
8233
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8234
+ $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8235
  }
8236
  else {
8237
+ if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-votes-number-answer-' . $answer_id], 'yop_poll-change-votes-number-answer-action-' . $answer_id ) ){
8238
+ $response = __( 'Bad Request!', 'yop_poll' );
8239
  }
8240
  else {
8241
+ if ( 'yes' == $according_to_logs ){
8242
+ if ( 'yes' == $change_to_all ){
8243
+ $poll_answers = YOP_POLL_MODEL::get_poll_answers( $answer_details['poll_id'], array( 'default', 'other' ) );
8244
+ if ( count( $poll_answers ) > 0 )
8245
+ foreach ( $poll_answers as $answer ) {
 
 
 
8246
  Yop_Poll_Model::update_answer_field( $answer['id'], array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer['id'] ), 'type' => '%d' ) );
8247
  }
8248
  }
8249
  else
8250
  Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => YOP_POLL_MODEL::get_answer_votes_from_logs( $answer_id ), 'type' => '%d' ) );
8251
+ $response = __( 'Success', 'yop_poll' );
8252
  }
8253
  else {
8254
  if ( intval( $votes_number ) < 0 )
8255
+ $response = __( 'Invalid Number Of Votes', 'yop_poll' ) . '!';
8256
  else {
8257
  if ( 'yes' == $change_to_all )
8258
  Yop_Poll_Model::update_all_poll_answers_field( $answer_details['poll_id'], array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8259
  else
8260
  Yop_Poll_Model::update_answer_field( $answer_id, array( 'name' => 'votes', 'value' => $votes_number, 'type' => '%d' ) );
8261
+ $response = __( 'Success', 'yop_poll' );
8262
  }
8263
  }
8264
  }
8265
  }
8266
+ print '[response]' . $response . '[/response]';
8267
  die();
8268
  }
8269
+
8270
  public function ajax_do_change_total_number_poll() {
8271
  global $current_user;
8272
+ $poll_id = intval( $_POST['yop_poll_id'] );
8273
+ $total_votes = intval( $_POST['yop_poll_total_votes'] );
8274
+ $total_answers = intval( $_POST['yop_poll_total_answers'] );
8275
+ $type = $_POST['yop_poll_type'];
8276
+ $change_to_all = $_POST['yop_poll_change_to_all'];
8277
+ $according_to_logs = $_POST['yop_poll_update_poll_with_logs'];
8278
+ $according_to_answers = $_POST['yop_poll_update_poll_with_answers'];
8279
+ $response = NULL;
8280
 
8281
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8282
+ $poll_details = $yop_poll_model->get_current_poll();
8283
 
8284
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8285
+ $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8286
  }
8287
  else {
8288
+ if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-total-number-poll-' . $poll_id], 'yop_poll-change-total-number-poll-action-' . $poll_id ) ){
8289
+ $response = __( 'Bad Request!', 'yop_poll' );
8290
  }
8291
  else {
8292
+ if ( 'yes' == $according_to_logs ){
8293
+ if ( 'votes' == $type ){
8294
+ if ( 'yes' == $change_to_all ){
8295
+ $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8296
+ if ( count( $all_polls ) > 0 ){
8297
+ foreach ( $all_polls as $poll )
8298
+ 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' ) );
8299
  }
8300
  }
8301
  else {
8302
  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' ) );
8303
  }
8304
  }
8305
+ if ( 'answers' == $type ){
8306
+ if ( 'yes' == $change_to_all ){
8307
+ $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8308
+ if ( count( $all_polls ) > 0 ){
8309
+ foreach ( $all_polls as $poll )
8310
+ 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' ) );
8311
  }
8312
  }
8313
  else {
8314
  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' ) );
8315
  }
8316
  }
8317
+ $response = __( 'Success', 'yop_poll' );
8318
  }
8319
  elseif ( 'yes' == $according_to_answers ) {
8320
+ if ( 'votes' == $type ){
8321
+ if ( 'yes' == $change_to_all ){
8322
+ $all_polls = YOP_POLL_MODEL::get_yop_polls_filter_search();
8323
+ if ( count( $all_polls ) > 0 ){
8324
+ foreach ( $all_polls as $poll )
8325
+ 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' ) );
8326
  }
8327
  }
8328
  else {
8329
  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' ) );
8330
  }
8331
  }
8332
+ $response = __( 'Success', 'yop_poll' );
8333
  }
8334
  else {
8335
  if ( intval( $total_votes ) < 0 && $type == 'votes' )
8336
+ $response = __( 'Invalid Number Of Total Votes', 'yop_poll' ) . '!';
8337
  if ( intval( $total_answers ) < 0 && $type == 'answers' )
8338
+ $response = __( 'Invalid Number Of Total Answers', 'yop_poll' ) . '!';
8339
  else {
8340
+ if ( 'votes' == $type ){
8341
  if ( 'yes' == $change_to_all )
8342
  Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8343
  else
8344
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_votes', 'value' => $total_votes, 'type' => '%d' ) );
8345
  }
8346
+ if ( 'answers' == $type ){
8347
  if ( 'yes' == $change_to_all )
8348
  Yop_Poll_Model::update_all_polls_field( array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8349
  else
8350
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'total_answers', 'value' => $total_answers, 'type' => '%d' ) );
8351
  }
8352
+ $response = __( 'Success', 'yop_poll' );
8353
  }
8354
  }
8355
  }
8356
  }
8357
+ print '[response]' . $response . '[/response]';
8358
  die();
8359
  }
8360
+
8361
  public function ajax_do_change_poll_author() {
8362
  global $current_user;
8363
+ $poll_id = intval( $_POST['yop_poll_id'] );
8364
+ $poll_author = intval( $_POST['yop_poll_author'] );
8365
+ $response = NULL;
8366
 
8367
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8368
+ $poll_details = $yop_poll_model->get_current_poll();
8369
 
8370
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) ){
8371
+ $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8372
  }
8373
  else {
8374
+ if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-poll-author-' . $poll_id], 'yop_poll-change-poll-author-action-' . $poll_id ) ){
8375
+ $response = __( 'Bad Request!', 'yop_poll' );
8376
  }
8377
  else {
8378
  if ( intval( $poll_author ) <= 0 )
8379
+ $response = __( 'Invalid Poll Author', 'yop_poll' ) . '!';
8380
  else {
8381
  Yop_Poll_Model::update_poll_field( $poll_id, array( 'name' => 'poll_author', 'value' => $poll_author, 'type' => '%d' ) );
8382
+ $response = __( 'Success', 'yop_poll' );
8383
  }
8384
  }
8385
  }
8386
+ print '[response]' . $response . '[/response]';
8387
  die();
8388
  }
8389
+
8390
  public function ajax_do_change_template_author() {
8391
  global $current_user;
8392
+ $template_id = intval( $_POST['yop_poll_template_id'] );
8393
+ $template_author = intval( $_POST['yop_poll_template_author'] );
8394
+ $response = NULL;
8395
 
8396
+ $template_details = Yop_Poll_Model::get_poll_template_from_database_by_id( $template_id );
8397
 
8398
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_details ['template_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) ){
8399
+ $response = __( 'You are not allowed to edit this item.', 'yop_poll' );
8400
  }
8401
  else {
8402
+ if ( !wp_verify_nonce( $_POST['yop-poll-nonce-change-poll-template-author-' . $template_id], 'yop_poll-change-poll-template-author-action-' . $template_id ) ){
8403
+ $response = __( 'Bad Request!', 'yop_poll' );
8404
  }
8405
  else {
8406
  if ( intval( $template_author ) <= 0 )
8407
+ $response = __( 'Invalid Template Author', 'yop_poll' ) . '!';
8408
  else {
8409
  Yop_Poll_Model::update_template_field( $template_id, array( 'name' => 'template_author', 'value' => $template_author, 'type' => '%d' ) );
8410
+ $response = __( 'Success', 'yop_poll' );
8411
  }
8412
  }
8413
  }
8414
+ print '[response]' . $response . '[/response]';
8415
  die();
8416
  }
8417
+
8418
  public function ajax_show_change_votes_number_answer() {
8419
  global $current_user;
8420
+ $answer_id = intval( $_GET['answer_id'] );
8421
 
8422
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8423
+ $answer_details = YOP_POLL_MODEL::get_poll_answer_by_id( $answer_id );
8424
  $yop_poll_model = new Yop_Poll_Model ( $answer_details['poll_id'] );
8425
+ $poll_details = $yop_poll_model->get_current_poll();
8426
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8427
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8428
  ?>
8429
  <div id="yop-poll-change-votes">
8430
  <form id="yop-poll-change-answer-no-votes-form">
8434
  <tr><td colspan="2" align="center" id="yop-poll-change-no-votes-error" class="error-message"></td></tr>
8435
  <tr id="yop-poll-manual-change-no-votes">
8436
  <td>
8437
+ <label class="yop_poll_answer_no_votes_label" for="yop-poll-answer-no-votes"><?php _e( 'New Number Of Votes', 'yop_poll' ); ?>
8438
+ :</label></td>
8439
  <td>
8440
+ <input id="yop-poll-answer-no-votes" type="text" value="<?php echo $answer_details['votes']; ?>" name="yop_poll_answer_votes"/>
8441
  </td>
8442
  </tr>
8443
  <tr>
8444
  <td colspan="2">
8445
+ <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();"/>
8446
+ <label for="yop-poll-update-answers-with-logs"><?php _e( 'Update According To Logs', 'yop_poll' ); ?></label>
8447
  </td>
8448
  </tr>
8449
  <tr>
8450
  <td colspan="2">
8451
+ <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' ); ?>');"/>
8452
+ <label for="yop-poll-change-to-all-poll-answers"><?php _e( 'Change To All Poll Answers', 'yop_poll' ); ?></label>
8453
  </td>
8454
  </tr>
8455
  <tr>
8456
  <td colspan="2" align="center">
8457
+ <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']; ?>' )"/>
8458
+ <input type="hidden" name="yop_poll_answer_id" value="<?php echo $answer_details['id']; ?>"/>
8459
  </td>
8460
  </tr>
8461
  </tbody>
8462
  </table>
8463
+ <?php wp_nonce_field( 'yop_poll-change-votes-number-answer-action-' . $answer_id, 'yop-poll-nonce-change-votes-number-answer-' . $answer_id, false ); ?>
8464
  </form>
8465
  </div>
8466
  <?php
8467
  die();
8468
  }
8469
+
8470
  public function ajax_show_change_total_number_poll() {
8471
  global $current_user;
8472
+ $poll_id = intval( $_GET['poll_id'] );
8473
+ $type = $_GET['type'];
8474
 
8475
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8476
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8477
+ $poll_details = $yop_poll_model->get_current_poll();
8478
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_details ['poll_author'] != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8479
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8480
  ?>
8481
  <div id="yop-poll-change-total">
8482
  <form id="yop-poll-change-poll-total-no-form">
8484
  <tbody>
8485
  <tr><td colspan="2" align="center"><b><?php echo $poll_details['name']; ?></b></td></tr>
8486
  <tr><td colspan="2" align="center" id="yop-poll-change-total-no-error" class="error-message"></td></tr>
8487
+ <?php if ( 'votes' == $type ){ ?>
8488
  <tr id="yop-poll-manual-change-no-votes">
8489
  <td>
8490
+ <label class="yop_poll_total_votes_label" for="yop-poll-total-votes"><?php _e( 'New Number Of Poll Total Votes', 'yop_poll' ); ?>
8491
+ :</label></td>
8492
  <td>
8493
+ <input id="yop-poll-total-votes" type="text" value="<?php echo $poll_details['total_votes']; ?>" name="yop_poll_total_votes"/>
8494
  </td>
8495
  </tr>
8496
  <?php } ?>
8497
+ <?php if ( 'answers' == $type ){ ?>
8498
  <tr id="yop-poll-manual-change-no-votes">
8499
  <td>
8500
+ <label class="yop_poll_total_answers_label" for="yop-poll-total-answers"><?php _e( 'New Number Of Poll Total Answers', 'yop_poll' ); ?>
8501
+ :</label></td>
8502
  <td>
8503
+ <input id="yop-poll-total-answers" type="text" value="<?php echo $poll_details['total_answers']; ?>" name="yop_poll_total_answers"/>
8504
  </td>
8505
  </tr>
8506
  <?php } ?>
8507
  <tr>
8508
  <td colspan="2">
8509
+ <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();} "/>
8510
+ <label for="yop-poll-update-poll-with-logs"><?php _e( 'Update According To Logs', 'yop_poll' ); ?></label>
8511
  </td>
8512
  </tr>
8513
+ <?php if ( 'votes' == $type ){ ?>
8514
  <tr>
8515
  <td colspan="2">
8516
+ <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(); }"/>
8517
+ <label for="yop-poll-update-poll-with-answers"><?php _e( 'Update According To Answers', 'yop_poll' ); ?></label>
8518
  </td>
8519
  </tr>
8520
  <?php } ?>
8521
  <tr>
8522
  <td colspan="2">
8523
+ <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' ); ?>');"/>
8524
+ <label for="yop-poll-change-to-all"><?php _e( 'Change To All Polls', 'yop_poll' ); ?></label>
8525
  </td>
8526
  </tr>
8527
  <tr>
8528
  <td colspan="2" align="center">
8529
+ <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; ?>')"/>
8530
+ <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>"/>
8531
+ <input type="hidden" name="yop_poll_type" value="<?php echo $type; ?>"/>
8532
  </td>
8533
  </tr>
8534
  </tbody>
8535
  </table>
8536
+ <?php wp_nonce_field( 'yop_poll-change-total-number-poll-action-' . $poll_id, 'yop-poll-nonce-change-total-number-poll-' . $poll_id, false ); ?>
8537
  </form>
8538
  </div>
8539
  <?php
8540
  die();
8541
  }
8542
+
8543
  public function ajax_show_change_poll_author() {
8544
  global $current_user;
8545
+ $poll_id = intval( $_GET['poll_id'] );
8546
 
8547
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8548
  $yop_poll_model = new Yop_Poll_Model ( $poll_id );
8549
+ $poll_details = $yop_poll_model->get_current_poll();
8550
+ $poll_author = get_user_by( 'id', $poll_details ['poll_author'] );
8551
+ if ( ( !$this->current_user_can( 'edit_own_polls' ) || $poll_author->ID != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls' ) ) )
8552
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8553
  ?>
8554
  <div id="yop-poll-change-poll-author">
8555
  <form id="yop-poll-change-poll-author-form">
8559
  <tr><td colspan="2" align="center" id="yop-poll-change-poll-author-error" class="error-message"></td></tr>
8560
  <tr id="yop-poll-manual-change-no-votes">
8561
  <td>
8562
+ <label class="yop_poll_total_votes_label" for="yop-poll-author"><?php _e( 'New Poll Author', 'yop_poll' ); ?>
8563
+ :</label></td>
8564
  <td>
8565
  <?php
8566
+ $blogusers = get_users( 'blog_id=' . $GLOBALS['blog_id'] . '&orderby=nicename&order=ASC' );
8567
  ?>
8568
  <select id="yop-poll-author-select" name="yop_poll_author">
8569
+ <?php
8570
+ foreach ( $blogusers as $user ) {
8571
+ echo '<option ' . selected( $poll_author->ID, $user->ID, false ) . ' value="' . $user->ID . '">' . $user->user_nicename . '</option>';
8572
  }
8573
  ?>
8574
  </select>
8576
  </tr>
8577
  <tr>
8578
  <td colspan="2" align="center">
8579
+ <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_poll_author( '<?php echo $poll_details['id']; ?>')"/>
8580
+ <input type="hidden" name="yop_poll_id" value="<?php echo $poll_details['id']; ?>"/>
8581
  </td>
8582
  </tr>
8583
  </tbody>
8584
  </table>
8585
+ <?php wp_nonce_field( 'yop_poll-change-poll-author-action-' . $poll_id, 'yop-poll-nonce-change-poll-author-' . $poll_id, false ); ?>
8586
  </form>
8587
  </div>
8588
  <?php
8589
  die();
8590
  }
8591
+
8592
  public function ajax_show_change_template_author() {
8593
  global $current_user;
8594
+ $template_id = intval( $_GET['template_id'] );
8595
 
8596
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
8597
+ $template_details = YOP_POLL_MODEL::get_poll_template_from_database_by_id( $template_id );
8598
+ $template_author = get_user_by( 'id', $template_details ['template_author'] );
8599
+ if ( ( !$this->current_user_can( 'edit_own_polls_templates' ) || $template_author->ID != $current_user->ID ) && ( !$this->current_user_can( 'edit_polls_templates' ) ) )
8600
+ wp_die( __( 'You are not allowed to edit this item.', 'yop_poll' ) );
8601
  ?>
8602
  <div id="yop-poll-change-template-author">
8603
  <form id="yop-poll-change-template-author-form">
8607
  <tr><td colspan="2" align="center" id="yop-poll-change-template-author-error" class="error-message"></td></tr>
8608
  <tr>
8609
  <td>
8610
+ <label for="yop-template-author"><?php _e( 'New Template Author', 'yop_poll' ); ?>
8611
+ :</label></td>
8612
  <td>
8613
  <?php
8614
+ $blogusers = get_users( 'blog_id=' . $GLOBALS['blog_id'] . '&orderby=nicename&order=ASC' );
8615
  ?>
8616
  <select id="yop-poll-template-author-select" name="yop_poll_template_author">
8617
+ <?php
8618
+ foreach ( $blogusers as $user ) {
8619
+ echo '<option ' . selected( $template_author->ID, $user->ID, false ) . ' value="' . $user->ID . '">' . $user->user_nicename . '</option>';
8620
  }
8621
  ?>
8622
  </select>
8624
  </tr>
8625
  <tr>
8626
  <td colspan="2" align="center">
8627
+ <input type="button" class="button-primary" value="<?php _e( 'Save', 'yop_poll' ) ?>" onclick="yop_poll_do_change_template_author( '<?php echo $template_details['id']; ?>')"/>
8628
+ <input type="hidden" name="yop_poll_template_id" value="<?php echo $template_details['id']; ?>"/>
8629
  </td>
8630
  </tr>
8631
  </tbody>
8632
  </table>
8633
+ <?php wp_nonce_field( 'yop_poll-change-poll-template-author-action-' . $template_id, 'yop-poll-nonce-change-poll-template-author-' . $template_id, false ); ?>
8634
  </form>
8635
  </div>
8636
  <?php
8640
  * End Ajax section
8641
  */
8642
 
8643
+ /* start tinymce */
8644
+ function load_editor_functions( $hook ) {
8645
  global $post;
8646
 
8647
+ if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ){
8648
+ $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' ) );
8649
+ wp_enqueue_style( 'thickbox' );
8650
+ wp_enqueue_script( 'thickbox' );
8651
+ wp_enqueue_script( 'yop-poll-editor-functions', "{$this->_config->plugin_url}/tinymce/yop-poll-editor-functions.js", 'jquery', $this->_config->version, true );
8652
+ wp_localize_script( 'yop-poll-editor-functions', 'yop_poll_editor_config', $yop_poll_editor_config );
 
 
 
 
 
 
 
8653
  }
8654
  }
8655
+
8656
+ function register_button( $buttons ) {
8657
+ array_push( $buttons, "separator", "yoppoll" );
8658
  return $buttons;
8659
  }
8660
+
8661
+ function add_plugin( $plugin_array ) {
8662
  $plugin_array ['yoppoll'] = "{$this->_config->plugin_url}/tinymce/yop-poll-editor.js";
8663
  return $plugin_array;
8664
  }
8665
+
8666
+ function my_yop_poll_button( $hook ) {
8667
+ if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ){
8668
+ if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ){
8669
  return;
8670
  }
8671
 
8672
+ if ( get_user_option( 'rich_editing' ) == 'true' ){
8673
+ add_filter( 'mce_external_plugins', array( &$this, 'add_plugin' ) );
8674
+ add_filter( 'mce_buttons', array( &$this, 'register_button' ) );
 
 
 
 
 
 
8675
  }
8676
  }
8677
  }
8678
+ /**
8679
+ * end tinymce
8680
+ */
8681
 
8682
  /*START donate*/
8683
  private function yop_poll_donate() {
8684
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
8685
+ wp_enqueue_style("yop-poll-donate-css", "{$this->_config->plugin_url}/css/yop-poll-donate.css");
8686
  ?>
8687
  <div class="postbox-container side" id="postbox-container-1">
8688
  <div class="meta-box-sortables ui-sortable" id="side-sortables">
8689
+ <div class="postbox " id="donate">
8690
+ <div title="Click to toggle" class="handlediv"><br/></div>
8691
+ <div id="toggle">
8692
+ <div id="toggle_title"><?php _e( 'Support This Plugin', 'yop_poll' ); ?></div>
8693
  </div>
 
 
 
8694
  <div class="inside">
8695
+ <p><b><?php _e( 'Have you found this plugin useful? Please help support it\'s continued development with a donation', 'yop_poll' ); ?>
8696
+ !</b></p>
8697
+ <a href="http://www.yop-poll.com/thankyou/don.php" target="_blank">
8698
+ <div id="donateButton"><span><?php _e( 'Donate', 'yop_poll' ); ?></span></div>
8699
+ </a>
8700
+ <br/>
8701
+ <b><?php _e( 'Short on funds?', 'yop_poll' ); ?></b><br/>
8702
+ <a target="_blank"
8703
+ 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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8704
  </div>
8705
  </div>
8706
 
8707
  <?php
8708
+ include_once( ABSPATH . WPINC . '/feed.php' );
8709
+ $feed = fetch_feed( 'http://yop-poll.com/feed/' );
8710
+ if ( !is_wp_error( $feed ) )
8711
+ $feeditems = $feed->get_items( 0, $feed->get_item_quantity( 5 ) );
8712
  ?>
8713
  <?php
8714
+ if ( $feeditems ){
8715
  ?>
8716
  <div class="postbox " id="linksubmitdiv2">
8717
  <div title="Click to toggle" class="handlediv">
8718
+ <br/>
8719
  </div>
8720
  <h3 class="hndle">
8721
  <span><?php _e( 'The Latest About Yop Poll', 'yop_poll' ); ?></span>
8724
  <ul id="news_ul">
8725
  <?php
8726
  foreach ( $feeditems as $item ) {
8727
+ $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), $protocolls = NULL, 'display' ) );
8728
  ?>
8729
  <li><a href="<?php echo $url ?>" target="_blank"><b><?php echo esc_html( $item->get_title() ); ?></b></a></li>
8730
  <?php
8737
  }
8738
  ?>
8739
  <?php
8740
+ if ( $optin_box_modal_options ['show'] == 'no' ){
8741
+ if ( $optin_box_modal_options ['sidebar_had_submit'] == 'no' ){
8742
+ if ( $optin_box_modal_options ['modal_had_submit'] == 'no' ){
8743
  ?>
8744
+ <?php $this->yop_poll_optin_form2(); ?>
8745
  <?php
8746
  }
8747
  }
8751
  </div>
8752
  <?php
8753
  }
8754
+
8755
  private function yop_poll_optin_form() {
8756
  ?>
8757
  <style type="text/css">
8760
  background: #FFF !important;
8761
  }
8762
 
8763
+ #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 {
 
8764
  margin-left: 0 !important;
8765
  margin-right: 0 !important;
8766
  margin-top: 0 !important;
8773
  background-image: none !important;
8774
  }
8775
 
8776
+ #WFItem394041 div, #WFItem394041 dl, #WFItem394041 dt, #WFItem394041 dd, #WFItem394041 ul, #WFItem394041 ol, #WFItem394041 li, #WFItem394041 h1, #WFItem394041 h2 {
 
8777
  border: none !important;
8778
  background: none !important;
8779
  float: none !important;
8789
  border-spacing: 0 !important;
8790
  }
8791
 
8792
+ #WFItem394041 fieldset, #WFItem394041 img {
8793
  border: 0 !important;
8794
  }
8795
 
8796
+ #WFItem394041 address, #WFItem394041 caption, #WFItem394041 cite, #WFItem394041 code, #WFItem394041 dfn, #WFItem394041 em, #WFItem394041 th, #WFItem394041 var {
 
8797
  font-style: normal !important;
8798
  font-weight: normal !important;
8799
  }
8813
  list-style: none !important;
8814
  }
8815
 
8816
+ caption, #WFItem394041 th {
8817
  text-align: left !important;
8818
  }
8819
 
8820
+ #WFItem394041 h1, #WFItem394041 h2, #WFItem394041 h3, #WFItem394041 h4, #WFItem394041 h5, #WFItem394041 h6 {
 
8821
  font-size: 100% !important;
8822
  font-weight: normal !important;
8823
  }
8824
 
8825
+ #WFItem394041 q:before, #WFItem394041 q:after {
8826
  content: " " !important;
8827
  }
8828
 
8829
+ #WFItem394041 abbr, #WFItem394041 acronym {
8830
  border: 0 !important;
8831
  font-variant: normal !important;
8832
  }
8839
  vertical-align: text-bottom !important;
8840
  }
8841
 
8842
+ #WFItem394041 input, #WFItem394041 textarea, #WFItem394041 select {
8843
  font-family: inherit !important;
8844
  font-size: inherit !important;
8845
  font-weight: inherit !important;
8847
  line-height: auto !important;
8848
  }
8849
 
8850
+ #WFItem394041 input, #WFItem394041 textarea, #WFItem394041 select {
8851
  *font-size: 100% !important;
8852
  }
8853
 
8874
  }
8875
 
8876
  #WFWrapper .close {
8877
+ background: url(https://app.getresponse.com/images/common/highslide/close.png) repeat scroll 0 0 transparent !important;
 
 
8878
  cursor: pointer !important;
8879
  height: 30px !important;
8880
  position: absolute !important;
8885
  }
8886
 
8887
  #wfCloseX {
8888
+ background: url(https://app.getresponse.com/images/common/highslide/close.png) repeat scroll 0 0 transparent !important;
 
 
8889
  cursor: pointer !important;
8890
  height: 30px !important;
8891
  position: absolute !important;
8905
  zoom: 1 !important;
8906
  }
8907
 
8908
+ #WFItem394041 *:first-child + html .clearfix {
8909
  zoom: 1 !important;
8910
  }
8911
 
8969
  margin-left: 25px !important;
8970
  }
8971
 
8972
+ #WFItem394041 .actTinyMceElBodyContent ol ul, #WFItem394041 .actTinyMceElBodyContent ul ol, #WFItem394041 .actTinyMceElBodyContent ul ul, #WFItem394041 .actTinyMceElBodyContent ol ol {
 
8973
  margin-top: 0 !important;
8974
  margin-bottom: 0 !important;
8975
  }
9107
  font-style: normal !important;
9108
  text-decoration: none !important;
9109
  background-color: #0DBAFF !important;
9110
+ background-image: url(https://app.getresponse.com/images/core/webforms/gradient_top.png) !important;
 
 
9111
  border-width: 0px !important;
9112
  border-color: #000000 !important;
9113
  border-style: none !important;
9129
  border-bottom-right-radius: 8px !important;
9130
  }
9131
 
9132
+ #WFItem394041 .wf-button:hover {
9133
+ !important;
9134
 
9135
  }
9136
 
9161
 
9162
  #WFItem394041 .wf-privacyico {
9163
  padding: 4px 0 0 20px !important;
9164
+ background: url(https://app.getresponse.com/images/core/webforms/lock.png) no-repeat left center !important;
 
 
9165
  }
9166
 
9167
  #WFItem394041 .wf-counter {
9241
  position: relative !important;
9242
  top: 3px !important;
9243
  margin-left: 3px !important;
9244
+ background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 -32px !important;
 
 
9245
  }
9246
 
9247
  #WFItem394041 .wf-rc-audio {
9253
  position: relative !important;
9254
  top: 3px !important;
9255
  margin-left: 3px !important;
9256
+ background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 0 !important;
 
 
9257
  }
9258
 
9259
  #WFItem394041 .wf-rc-image {
9265
  position: relative !important;
9266
  top: 3px !important;
9267
  margin-left: 3px !important;
9268
+ background: url(https://app.getresponse.com/images/core/webforms/captchaico.png) no-repeat 0 -16px !important;
 
 
9269
  }
9270
 
9271
  #WFItem394041 #recaptcha_image {
9334
  <em class="clearfix clearer"></em>
9335
  </div>
9336
  </div>
9337
+ <input type="hidden" name="webform_id" value="394041"/>
9338
  </form>
9339
  </div>
9340
  <?php
9342
 
9343
  private function yop_poll_optin_form1() {
9344
  ?>
9345
+ <style type="text/css">
9346
+ @font-face {
9347
+ font-family: Lato-Reg;
9348
+ src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Reg.ttf);
9349
+ }
9350
+
9351
+ @font-face {
9352
+ font-family: Lato-Lig;
9353
+ src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Lig.ttf);
9354
+ }
9355
+
9356
+ @font-face {
9357
+ font-family: Lato-Bla;
9358
+ src: url(<?php echo $this->_config->plugin_url; ?>/fonts/Lato-Bla.ttf);
9359
+ }
9360
+
9361
+ @font-face {
9362
+ font-family: 'FontomasCustomRegular';
9363
+ src: url('<?php echo $this->_config->plugin_url; ?>/fonts/fontomas-webfont.eot');
9364
+ 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');
9365
+ font-weight: normal;
9366
+ font-style: normal;
9367
+ }
9368
+
9369
+ /* Optin */
9370
+ #WFItem394041 {
9371
+ background: #f7f7f7; /* Old browsers */
9372
+ background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* FF3.6+ */
9373
+ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #f7f7f7), color-stop(100%, #ffffff)); /* Chrome,Safari4+ */
9374
+ background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Chrome10+,Safari5.1+ */
9375
+ background: -o-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* Opera 11.10+ */
9376
+ background: -ms-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* IE10+ */
9377
+ background: linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%); /* W3C */
9378
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#ffffff', GradientType=1); /* IE6-9 fallback on horizontal gradient */
9379
+ border: 1px solid #fff;
9380
+ -moz-box-shadow: 0px 0px 9px #dadada;
9381
+ -webkit-box-shadow: 0px 0px 9px #dadada;
9382
+ box-shadow: 0px 0px 9px #dadada;
9383
+ color: #95abb7;
9384
+ text-align: center;
9385
+ width: 25em;
9386
+ height: auto;
9387
+ }
9388
+ #WFItem394041 h1 {
9389
+ font-size: 8em;
9390
+ margin: 0.2em;
9391
+ color: #fff;
9392
+ font-family: Lato-Bla, Arial, Helvetica, sans-serif;
9393
+ line-height: 1em;
9394
+ }
9395
+
9396
+ #WFItem394041 label {
9397
+ position: relative;
9398
+ }
9399
+
9400
+ #WFItem394041 h2 {
9401
+ font-size: 3em;
9402
+ margin-top: 0.5em;
9403
+ font-variant: small-caps;
9404
+ font-weight: bold;
9405
+ color: #95abb7;
9406
+ }
9407
+
9408
+ #WFItem394041 h3 {
9409
+ font-size: 2em;
9410
+ margin-top: 0.2em;
9411
+ font-weight: bold;
9412
+ color: #95abb7;
9413
+ display: inline;
9414
+ }
9415
+
9416
+ #WFItem394041 #circle {
9417
+ border-radius: 50%;
9418
+ background: #00a8ff;
9419
+ position: relative;
9420
+ margin: 0 auto;
9421
+ width: 7.75em;
9422
+ height: 7.75em;
9423
+ }
9424
+
9425
+ #WFItem394041 #email {
9426
+ border-style: none;
9427
+ border: 1px solid #00a8ff;
9428
+ background: #fff;
9429
+ margin-top: 0.5em;
9430
+ padding-left: 2em;
9431
+ font-size: 1.125em;
9432
+ font-family: Calibri, Arial, Helvetica, sans-serif;
9433
+ color: #aeaaaa;
9434
+ -webkit-transition: all 0.3s linear;
9435
+ -moz-transition: all 0.3s linear;
9436
+ -o-transition: all 0.3s linear;
9437
+ transition: all 0.3s linear;
9438
+ width: 75%;
9439
+ height: 2.3em;
9440
+ }
9441
+
9442
+ #WFItem394041 #email:focus {
9443
+ background: #f9f9f9;
9444
+ }
9445
+
9446
+ #WFItem394041 .wf-button {
9447
+ margin-top: 10px;
9448
+ font-size: 1.4em;
9449
+ height: 1.7em;
9450
+ margin-bottom: 0.5em;
9451
+ border: none;
9452
+ background: #00a8ff;
9453
+ color: white;
9454
+ cursor: pointer;
9455
+ width: 75%;
9456
+ }
9457
+
9458
+ #WFItem394041 .wf-button:active {
9459
+ background: #0098e6;
9460
+ }
9461
+
9462
+ #yop-poll-close-modal-box {
9463
+ text-decoration: none;
9464
+ position: absolute;
9465
+ color: #00A8FF;
9466
+ cursor: pointer;
9467
+ float: right;
9468
+ font-size: 1.5em;
9469
+ height: 1em;
9470
+ width: 1em;
9471
+ top: 5px;
9472
+ right: 5px;
9473
+ }
9474
+
9475
+ #WFItem394041 [data-icon]:after {
9476
+ left: 2px;
9477
+ content: attr(data-icon);
9478
+ font-family: 'FontomasCustomRegular';
9479
+ color: #00a8ff;
9480
+ position: absolute;
9481
+ left: 5px;
9482
+ top: 4px;
9483
+ width: 20px;
9484
+ }
9485
+
9486
  </style>
9487
+ <div id="WFItem394041" class="wf-formTpl">
9488
+ <a href="javascript:void(0)" id="yop-poll-close-modal-box"><span>x</span></a>
9489
  <form accept-charset="utf-8"
9490
+ action="https://app.getresponse.com/add_contact_webform.html"
9491
+ method="post" target="_top">
9492
  <div class="box">
9493
  <div id="WFIcenter" class="wf-body">
9494
  <ul class="wf-sortable" id="wf-sort-id">
9495
  <li>
9496
+ <div id="circle"><h1>?</h1></div>
9497
+ <p><h2><?php _e( 'Need Help?', 'yop_poll' ); ?></h2><br><h3><?php _e( 'Download<br /> YOP Poll User Guide', 'yop_poll' ); ?></h3></p>
9498
+ </li>
9499
  <li class="wf-email" rel="undefined"
9500
+ style="display: block !important;">
9501
  <div class="wf-contbox">
9502
  <div class="wf-inputpos">
9503
+ <label for="email" data-icon="e"/>
9504
+ <input id="email" type="text" class="wf-input wf-req wf-valid__email"
9505
+ name="email" placeholder="<?php _e( 'Email', 'yop_poll' ); ?>"></input>
9506
  </div>
9507
  <em class="clearfix clearer"></em>
9508
  </div>
9509
  </li>
9510
  <li class="wf-submit" rel="undefined"
9511
+ style="display: block !important;">
9512
  <div class="wf-contbox">
9513
  <div class="wf-inputpos">
9514
+ <input type="submit" value="<?php _e( 'Send me the FREE guide!', 'yop_poll' ); ?>" class="wf-button" name="submit"></input>
9515
  </div>
9516
  <em class="clearfix clearer"></em>
9517
  </div>
9518
  </li>
9519
  <li class="wf-captcha" rel="undefined"
9520
+ style="display: none !important;">
9521
+ <div wf-captchaerror="<?php _e( 'Incorrect please try again', 'yop_poll' ); ?>"
9522
+ wf-captchasound="<?php _e( 'Enter the numbers you hear:', 'yop_poll' ); ?>"
9523
+ wf-captchaword="<?php _e( 'Enter the words above:', 'yop_poll' ); ?>"
9524
+ class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9525
  </li>
9526
  </ul>
9527
  </div>
9530
  <em class="clearfix clearer"></em>
9531
  </div>
9532
  </div>
9533
+ <input type="hidden" name="webform_id" value="394041"/>
9534
  </form>
9535
  </div>
9536
  <?php
9537
  }
9538
 
9539
  private function yop_poll_optin_form2() {
9540
+ wp_enqueue_style("yop-poll-optin2-css", "{$this->_config->plugin_url}/css/yop-poll-optin2.css");
9541
  ?>
9542
+
9543
+ <div id="WFItem394041" class="optin">
9544
+ <div id="circle">
9545
+ <h1>?</h1>
9546
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9547
  <form accept-charset="utf-8"
9548
+ action="https://app.getresponse.com/add_contact_webform.html"
9549
+ method="post" target="_top">
9550
  <div class="box">
9551
  <div id="WFIcenter" class="wf-body">
9552
  <ul class="wf-sortable" id="wf-sort-id">
9553
  <li>
9554
+ <p>
9555
+ <b>
9556
+ <?php _e( 'Need Help?', 'yop_poll' ); ?><br>
9557
+ <?php _e( 'Download YOP Poll User Guide!', 'yop_poll' ); ?>
9558
+ </b>
9559
+ </p>
9560
+ </li>
9561
  <li class="wf-email" rel="undefined"
9562
+ style="display: block !important;">
9563
  <div class="wf-contbox">
9564
  <div class="wf-inputpos">
9565
+ <label for="email" data-icon="e"/>
9566
+ <input id="email" type="text" class="wf-input wf-req wf-valid__email"
9567
+ name="email" placeholder="<?php _e( 'Email', 'yop_poll' ); ?>"></input>
9568
  </div>
9569
  <em class="clearfix clearer"></em>
9570
  </div>
9571
  </li>
9572
  <li class="wf-submit" rel="undefined"
9573
+ style="display: block !important;">
9574
  <div class="wf-contbox">
9575
  <div class="wf-inputpos">
9576
+ <input type="submit" value="<?php _e( 'Send me the guide!', 'yop_poll' ); ?>" class="wf-button" name="submit"></input>
9577
  </div>
9578
  <em class="clearfix clearer"></em>
9579
  </div>
9580
  </li>
9581
  <li class="wf-captcha" rel="undefined"
9582
+ style="display: none !important;">
9583
+ <div wf-captchaerror="<?php _e( 'Incorrect please try again', 'yop_poll' ); ?>"
9584
+ wf-captchasound="<?php _e( 'Enter the numbers you hear:', 'yop_poll' ); ?>"
9585
+ wf-captchaword="<?php _e( 'Enter the words above:', 'yop_poll' ); ?>"
9586
+ class="wf-contbox wf-captcha-1" id="wf-captcha-1"></div>
9587
  </li>
9588
  </ul>
9589
  </div>
9592
  <em class="clearfix clearer"></em>
9593
  </div>
9594
  </div>
9595
+ <input type="hidden" name="webform_id" value="394041"/>
9596
  </form>
9597
  </div>
9598
  <?php
9599
  }
9600
 
 
9601
  public function load_optin_box() {
9602
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
9603
+ if ( $optin_box_modal_options ['show'] == 'yes' ){
9604
+ 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 );
9605
+ 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 );
9606
+ $yop_poll_modal_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_modal_option_signup' ) );
9607
+ wp_localize_script( 'yop-poll-modal-functions', 'yop_poll_modal_functions_config', $yop_poll_modal_functions_config );
9608
+ wp_enqueue_style( 'yop-poll-modal-box-css', "{$this->_config->plugin_url}/modal/css/jquery.modalbox-basic.css", array(), $this->_config->version );
9609
+ }
9610
+ elseif ( $optin_box_modal_options ['sidebar_had_submit'] == 'no' ) {
9611
+ 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 );
9612
+ $yop_poll_sidebar_functions_config = array( 'ajax' => array( 'url' => admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ), 'action' => 'yop_poll_sidebar_option_signup' ) );
9613
+ wp_localize_script( 'yop-poll-sidebar-option-functions', 'yop_poll_sidebar_functions_config', $yop_poll_sidebar_functions_config );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9614
  }
9615
  }
9616
+
9617
  public function popup_bar() {
9618
+ require_once( $this->_config->plugin_inc_dir . '/yop_poll_model.php' );
9619
+ $date_30_days_before = Yop_Poll_Model::get_mysql_custom_date( -30, 'DAY' );
9620
+ $yop_poll_first_install_date = get_option( 'yop_poll_first_install_date' );
9621
+ $yop_poll_admin_notices_donate = get_option( 'yop_poll_admin_notices_donate' );
9622
+ if ( $date_30_days_before >= $yop_poll_first_install_date ){
9623
+ if ( 'yes' == $yop_poll_admin_notices_donate ){
9624
  ?>
9625
+ <style type="text/css">
9626
+ .yop-poll-updated {
9627
+ background: #f7f7f7 !important; /* Old browsers */
9628
+ background: -moz-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* FF3.6+ */
9629
+ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #f7f7f7), color-stop(100%, #ffffff)) !important; /* Chrome,Safari4+ */
9630
+ background: -webkit-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* Chrome10+,Safari5.1+ */
9631
+ background: -o-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* Opera 11.10+ */
9632
+ background: -ms-linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* IE10+ */
9633
+ background: linear-gradient(45deg, #f7f7f7 0%, #ffffff 100%) !important; /* W3C */
9634
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7', endColorstr='#ffffff', GradientType=1) !important; /* IE6-9 fallback on horizontal gradient */
9635
+ border: 1px solid #fff !important;
9636
+ -moz-box-shadow: 0px 0px 9px #dadada !important;
9637
+ -webkit-box-shadow: 0px 0px 9px #dadada !important;
9638
+ box-shadow: 0px 0px 9px #dadada !important;
9639
+ margin: 5px 0px 15px !important;
9640
+ padding: 1px 12px !important;
9641
+ font-size: 16px !important;
9642
+ line-height: 1.4em !important;
9643
+ text-shadow: 1px 1px #fff !important;
9644
+ width: 98% !important;
9645
+ border: none !important;
9646
+ }
9647
+
9648
+ .yop-poll-button {
9649
+ border: none;
9650
+ background: #fff;
9651
+ border: 1px solid #00a8ff;
9652
+ color: #95abb7;
9653
+ padding: 5px;
9654
+ font-family: Lato-Bla, Arial, Helvetica, sans-serif;
9655
+ font-size: 16px;
9656
+ -webkit-transition: all 0.3s linear;
9657
+ -moz-transition: all 0.3s linear;
9658
+ -o-transition: all 0.3s linear;
9659
+ transition: all 0.3s linear;
9660
+ }
9661
+
9662
+ .yop-poll-button:hover {
9663
+ color: #fff;
9664
+ background: #00a8ff;
9665
+ border: 1px solid #fff;
9666
+ cursor: pointer;
9667
+ }
9668
+ </style>
9669
+ <div class="updated yop-poll-updated" id="message">
9670
  <p>
9671
  <?php _e( 'It looks like you\'ve been enjoying YOP POLL Plugin for at least 30 days.', 'yop_poll' ); ?>
9672
  <?php _e( 'Would you consider a small donation to help support continued development of the plugin?', 'yop_poll' ); ?>
9673
  </p>
9674
  <p>
9675
+ <input type="button" class="yop-poll-button"
9676
  value="<?php _e( 'Support This Plugin', 'yop_poll' ) ?>"
9677
+ 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');"/>
9678
+ <input type="button" class="yop-poll-button"
9679
+ value="<?php _e( 'Rate it 5&#9733;\'s', 'yop_poll' ) ?>"
9680
+ 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');"/>
9681
+ <input type="button" class="yop-poll-button"
9682
  value="<?php _e( 'Tell Your Followers', 'yop_poll' ) ?>"
9683
+ 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');"/>
9684
+ <input type="button" class="yop-poll-button"
9685
  value="<?php _e( 'Don\'t Bug Me Again', 'yop_poll' ) ?>"
9686
+ 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' ) ) ) ); ?>'"/>
9687
  </p>
9688
  </div>
9689
  <?php
9690
  }
9691
  }
9692
  }
9693
+
9694
  public function popup_bar_operations() {
9695
+ 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' ) ){
9696
+ update_option( "yop_poll_admin_notices_donate", 'no' );
9697
+ $this->remove_action( 'admin_notices', 'popup_bar' );
9698
 
9699
+ if ( isset ( $_GET ['yop_poll_support_plugin'] ) ){
9700
+ if ( 'yes' == $_GET ['yop_poll_support_plugin'] ){
9701
+ wp_redirect( 'http://www.yop-poll.com/thankyou/don.php', '302' );
9702
  }
9703
  }
9704
 
9705
+ if ( isset ( $_GET ['yop_poll_rate_plugin'] ) ){
9706
+ if ( 'yes' == $_GET ['yop_poll_rate_plugin'] ){
9707
+ wp_redirect( 'http://wordpress.org/support/view/plugin-reviews/yop-poll?filter=5', '302' );
9708
  }
9709
  }
9710
 
9711
+ if ( isset ( $_GET ['yop_poll_tell_followers'] ) ){
9712
+ if ( 'yes' == $_GET ['yop_poll_tell_followers'] ){
9713
+ 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' );
9714
  }
9715
  }
9716
 
9717
+ if ( isset ( $_GET ['yop_poll_do_not_bug'] ) ){
9718
+ if ( 'yes' == $_GET ['yop_poll_do_not_bug'] ){
9719
+ 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' );
 
 
 
 
 
 
9720
  }
9721
  }
9722
  }
9723
  }
9724
 
9725
  /* END donate */
9726
+ private function current_user_can( $capability = '' ) {
9727
  global $current_user;
9728
+ get_currentuserinfo();
9729
  $user_roles = $current_user->roles;
9730
+ $user_role = array_shift( $user_roles );
9731
 
9732
+ $capabilities_roles = array(
9733
+ 'manage_polls_options' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9734
  'administrator' => true,
9735
+ 'editor' => true,
9736
+ 'author' => false,
9737
+ 'contributor' => false,
9738
+ 'subscriber' => false ),
9739
+ 'manage_polls_bans' => array(
 
9740
  'administrator' => true,
9741
+ 'editor' => false,
9742
+ 'author' => false,
9743
+ '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 ) );
9744
+ if ( isset ( $capabilities_roles [$capability] [$user_role] ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9745
  return $capabilities_roles [$capability] [$user_role];
9746
  return false;
9747
  }
inc/plugin-functions.php CHANGED
@@ -1,165 +1,199 @@
1
  <?php
2
- //
3
- // Yop poll meta functions
4
- //
5
- /**
6
- * Update yop poll meta field based on yop poll ID.
7
- *
8
- * Use the $prev_value parameter to differentiate between meta fields with the
9
- * same key and yop poll ID.
10
- *
11
- * If the meta field for the yop poll does not exist, it will be added.
12
- *
13
- * @param int $yop_poll_id Yop Poll ID.
14
- * @param string $meta_key Metadata key.
15
- * @param mixed $meta_value Metadata value.
16
- * @param mixed $prev_value Optional. Previous value to check before removing.
17
- * @return bool False on failure, true if success.
18
- */
19
-
20
- function update_yop_poll_meta($poll_id, $meta_key, $meta_value, $prev_value = '') {
21
- return update_metadata('yop_poll', $poll_id, $meta_key, $meta_value, $prev_value);
22
- }
23
-
24
- /**
25
- * Add yop poll data field to a yop poll.
26
- *
27
- * @param int $yop_poll_id yop poll ID.
28
- * @param string $meta_key Metadata name.
29
- * @param mixed $meta_value Metadata value.
30
- * @param bool $unique Optional, default is false. Whether the same key should not be added.
31
- * @return bool False for failure. True for success.
32
- */
33
- function add_yop_poll_meta($poll_id, $meta_key, $meta_value, $unique = false) {
34
- return add_metadata('yop_poll', $poll_id, $meta_key, $meta_value, $unique);
35
- }
36
-
37
- /**
38
- * Remove metadata matching criteria from a yop_poll.
39
- *
40
- * You can match based on the key, or key and value. Removing based on key and
41
- * value, will keep from removing duplicate metadata with the same key. It also
42
- * allows removing all metadata matching key, if needed.
43
- *
44
- * @param int $poll_id post ID
45
- * @param string $meta_key Metadata name.
46
- * @param mixed $meta_value Optional. Metadata value.
47
- * @return bool False for failure. True for success.
48
- */
49
- function delete_yop_poll_meta($poll_id, $meta_key, $meta_value = '') {
50
- return delete_metadata('yop_poll', $poll_id, $meta_key, $meta_value);
51
- }
52
-
53
- /**
54
- * Retrieve yop_poll meta field for a yop poll.
55
- *
56
- * @param int $poll_id Yop poll ID.
57
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
58
- * @param bool $single Whether to return a single value.
59
- * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
60
- * is true.
61
- */
62
- function get_yop_poll_meta($poll_id, $key = '', $single = false) {
63
- return get_metadata('yop_poll', $poll_id, $key, $single);
64
- }
65
-
66
- /**
67
- * Delete everything from yop_poll meta matching meta key.
68
- *
69
- * @param string $poll_meta_key Key to search for when deleting.
70
- * @return bool Whether the poll meta key was deleted from the database
71
- */
72
- function delete_yop_poll_meta_by_key($poll_meta_key) {
73
- return delete_metadata( 'yop_poll', null, $poll_meta_key, '', true );
74
- }
75
-
76
- //
77
- // Yop poll answer meta functions
78
- //
79
- /**
80
- * Update yop poll answer meta field based on yop poll ID.
81
- *
82
- * Use the $prev_value parameter to differentiate between meta fields with the
83
- * same key and yop poll answer ID.
84
- *
85
- * If the meta field for the yop poll answer does not exist, it will be added.
86
- *
87
- * @param int $yop_poll_answer_id Yop Poll ID.
88
- * @param string $meta_key Metadata key.
89
- * @param mixed $meta_value Metadata value.
90
- * @param mixed $prev_value Optional. Previous value to check before removing.
91
- * @return bool False on failure, true if success.
92
- */
93
- function update_yop_poll_answer_meta($poll_answer_id, $meta_key, $meta_value, $prev_value = '') {
94
- return update_metadata('yop_poll_answer', $poll_answer_id, $meta_key, $meta_value, $prev_value);
95
- }
96
-
97
- /**
98
- * Add yop poll answer data field to a yop poll answer.
99
- *
100
- * @param int $yop_poll_answer_id yop poll answer ID.
101
- * @param string $meta_key Metadata name.
102
- * @param mixed $meta_value Metadata value.
103
- * @param bool $unique Optional, default is false. Whether the same key should not be added.
104
- * @return bool False for failure. True for success.
105
- */
106
- function add_yop_poll_answer_meta($poll_answer_id, $meta_key, $meta_value, $unique = false) {
107
- return add_metadata('yop_poll_answer', $poll_answer_id, $meta_key, $meta_value, $unique);
108
- }
109
-
110
- /**
111
- * Remove metadata matching criteria from a yop_answer_poll.
112
- *
113
- * You can match based on the key, or key and value. Removing based on key and
114
- * value, will keep from removing duplicate metadata with the same key. It also
115
- * allows removing all metadata matching key, if needed.
116
- *
117
- * @param int $poll_answer_id post ID
118
- * @param string $meta_key Metadata name.
119
- * @param mixed $meta_value Optional. Metadata value.
120
- * @return bool False for failure. True for success.
121
- */
122
- function delete_yop_poll_answer_meta($poll_answer_id, $meta_key, $meta_value = '') {
123
- return delete_metadata('yop_poll_answer', $poll_answer_id, $meta_key, $meta_value);
124
- }
125
-
126
- /**
127
- * Retrieve yop_poll_answer meta field for a yop poll answer.
128
- *
129
- * @param int $poll_answer_id Yop poll answer ID.
130
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
131
- * @param bool $single Whether to return a single value.
132
- * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
133
- * is true.
134
- */
135
- function get_yop_poll_answer_meta($poll_answer_id, $key = '', $single = false) {
136
- return get_metadata('yop_poll_answer', $poll_answer_id, $key, $single);
137
- }
138
-
139
- /**
140
- * Delete everything from yop_poll_answer meta matching meta key.
141
- *
142
- * @param string $poll_meta_key Key to search for when deleting.
143
- * @return bool Whether the poll meta key was deleted from the database
144
- */
145
- function delete_yop_poll_answer_meta_by_key($poll_answer_meta_key) {
146
- return delete_metadata( 'yop_poll_answer', null, $poll_answer_meta_key, '', true );
147
- }
148
-
149
- function get_human_time( $date ) {
150
- $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
151
- $m_time = $date;
152
- $time = get_post_time( 'G', true, $post );
153
-
154
- $time_diff = time() - $time;
155
-
156
- if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
157
- $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
158
- else
159
- $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
160
- }
161
-
162
- function yop_poll_set_html_content_type() {
163
- return 'text/html';
164
- }
165
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ //
3
+ // Yop poll meta functions
4
+ //
5
+ /**
6
+ * Update yop poll meta field based on yop poll ID.
7
+ *
8
+ * Use the $prev_value parameter to differentiate between meta fields with the
9
+ * same key and yop poll ID.
10
+ *
11
+ * If the meta field for the yop poll does not exist, it will be added.
12
+ *
13
+ * @param int $yop_poll_id Yop Poll ID.
14
+ * @param string $meta_key Metadata key.
15
+ * @param mixed $meta_value Metadata value.
16
+ * @param mixed $prev_value Optional. Previous value to check before removing.
17
+ *
18
+ * @return bool False on failure, true if success.
19
+ */
20
+
21
+ function update_yop_poll_meta( $poll_id, $meta_key, $meta_value, $prev_value = '' ) {
22
+ return update_metadata( 'yop_poll', $poll_id, $meta_key, $meta_value, $prev_value );
23
+ }
24
+
25
+ /**
26
+ * Add yop poll data field to a yop poll.
27
+ *
28
+ * @param int $yop_poll_id yop poll ID.
29
+ * @param string $meta_key Metadata name.
30
+ * @param mixed $meta_value Metadata value.
31
+ * @param bool $unique Optional, default is false. Whether the same key should not be added.
32
+ *
33
+ * @return bool False for failure. True for success.
34
+ */
35
+ function add_yop_poll_meta( $poll_id, $meta_key, $meta_value, $unique = false ) {
36
+ return add_metadata( 'yop_poll', $poll_id, $meta_key, $meta_value, $unique );
37
+ }
38
+
39
+ /**
40
+ * Remove metadata matching criteria from a yop_poll.
41
+ *
42
+ * You can match based on the key, or key and value. Removing based on key and
43
+ * value, will keep from removing duplicate metadata with the same key. It also
44
+ * allows removing all metadata matching key, if needed.
45
+ *
46
+ * @param int $poll_id post ID
47
+ * @param string $meta_key Metadata name.
48
+ * @param mixed $meta_value Optional. Metadata value.
49
+ *
50
+ * @return bool False for failure. True for success.
51
+ */
52
+ function delete_yop_poll_meta( $poll_id, $meta_key, $meta_value = '' ) {
53
+ return delete_metadata( 'yop_poll', $poll_id, $meta_key, $meta_value );
54
+ }
55
+
56
+ /**
57
+ * Retrieve yop_poll meta field for a yop poll.
58
+ *
59
+ * @param int $poll_id Yop poll ID.
60
+ * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
61
+ * @param bool $single Whether to return a single value.
62
+ *
63
+ * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
64
+ * is true.
65
+ */
66
+ function get_yop_poll_meta( $poll_id, $key = '', $single = false ) {
67
+ return get_metadata( 'yop_poll', $poll_id, $key, $single );
68
+ }
69
+
70
+ /**
71
+ * Delete everything from yop_poll meta matching meta key.
72
+ *
73
+ * @param string $poll_meta_key Key to search for when deleting.
74
+ *
75
+ * @return bool Whether the poll meta key was deleted from the database
76
+ */
77
+ function delete_yop_poll_meta_by_key( $poll_meta_key ) {
78
+ return delete_metadata( 'yop_poll', NULL, $poll_meta_key, '', true );
79
+ }
80
+
81
+ //
82
+ // Yop poll answer meta functions
83
+ //
84
+ /**
85
+ * Update yop poll answer meta field based on yop poll ID.
86
+ *
87
+ * Use the $prev_value parameter to differentiate between meta fields with the
88
+ * same key and yop poll answer ID.
89
+ *
90
+ * If the meta field for the yop poll answer does not exist, it will be added.
91
+ *
92
+ * @param int $yop_poll_answer_id Yop Poll ID.
93
+ * @param string $meta_key Metadata key.
94
+ * @param mixed $meta_value Metadata value.
95
+ * @param mixed $prev_value Optional. Previous value to check before removing.
96
+ *
97
+ * @return bool False on failure, true if success.
98
+ */
99
+ function update_yop_poll_answer_meta( $poll_answer_id, $meta_key, $meta_value, $prev_value = '' ) {
100
+ return update_metadata( 'yop_poll_answer', $poll_answer_id, $meta_key, $meta_value, $prev_value );
101
+ }
102
+
103
+ /**
104
+ * Add yop poll answer data field to a yop poll answer.
105
+ *
106
+ * @param int $yop_poll_answer_id yop poll answer ID.
107
+ * @param string $meta_key Metadata name.
108
+ * @param mixed $meta_value Metadata value.
109
+ * @param bool $unique Optional, default is false. Whether the same key should not be added.
110
+ *
111
+ * @return bool False for failure. True for success.
112
+ */
113
+ function add_yop_poll_answer_meta( $poll_answer_id, $meta_key, $meta_value, $unique = false ) {
114
+ return add_metadata( 'yop_poll_answer', $poll_answer_id, $meta_key, $meta_value, $unique );
115
+ }
116
+
117
+ /**
118
+ * Remove metadata matching criteria from a yop_answer_poll.
119
+ *
120
+ * You can match based on the key, or key and value. Removing based on key and
121
+ * value, will keep from removing duplicate metadata with the same key. It also
122
+ * allows removing all metadata matching key, if needed.
123
+ *
124
+ * @param int $poll_answer_id post ID
125
+ * @param string $meta_key Metadata name.
126
+ * @param mixed $meta_value Optional. Metadata value.
127
+ *
128
+ * @return bool False for failure. True for success.
129
+ */
130
+ function delete_yop_poll_answer_meta( $poll_answer_id, $meta_key, $meta_value = '' ) {
131
+ return delete_metadata( 'yop_poll_answer', $poll_answer_id, $meta_key, $meta_value );
132
+ }
133
+
134
+ /**
135
+ * Retrieve yop_poll_answer meta field for a yop poll answer.
136
+ *
137
+ * @param int $poll_answer_id Yop poll answer ID.
138
+ * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
139
+ * @param bool $single Whether to return a single value.
140
+ *
141
+ * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
142
+ * is true.
143
+ */
144
+ function get_yop_poll_answer_meta( $poll_answer_id, $key = '', $single = false ) {
145
+ return get_metadata( 'yop_poll_answer', $poll_answer_id, $key, $single );
146
+ }
147
+
148
+ /**
149
+ * Delete everything from yop_poll_answer meta matching meta key.
150
+ *
151
+ * @param string $poll_meta_key Key to search for when deleting.
152
+ *
153
+ * @return bool Whether the poll meta key was deleted from the database
154
+ */
155
+ function delete_yop_poll_answer_meta_by_key( $poll_answer_meta_key ) {
156
+ return delete_metadata( 'yop_poll_answer', NULL, $poll_answer_meta_key, '', true );
157
+ }
158
+
159
+ function get_human_time( $date ) {
160
+ $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
161
+ $m_time = $date;
162
+ $time = get_post_time( 'G', true, $post );
163
+
164
+ $time_diff = time() - $time;
165
+
166
+ if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ){
167
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
168
+ }
169
+ else {
170
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
171
+ }
172
+ }
173
+
174
+ function yop_poll_set_html_content_type() {
175
+ return 'text/html';
176
+ }
177
+
178
+ function yop_poll_dump( $str ) {
179
+ print "<pre>";
180
+ print_r( $str );
181
+ print "</pre>";
182
+ }
183
+
184
+ function yop_poll_kses( $string ) {
185
+ $pt = array(
186
+ 'a' => array(
187
+ 'href' => array(),
188
+ 'title' => array(),
189
+ 'target' => array()
190
+ ),
191
+ 'img' => array(
192
+ 'src' => array(),
193
+ 'title' => array(),
194
+ 'style' => array()
195
+ ),
196
+ 'br' => array()
197
+ );
198
+ return wp_kses( $string, $pt );
199
+ }
inc/public-admin.php CHANGED
@@ -2,9 +2,9 @@
2
  class Yop_Poll_Public_Admin extends Yop_Poll_Plugin {
3
  protected function init() {
4
  $this->add_action( 'init', 'load_translation_file', 1 );
 
5
  $this->add_action( 'init', 'public_loader', 1 );
6
  $this->add_action( 'widgets_init', 'widget_init' );
7
- $this->add_filter( 'the_content', 'yop_poll_do_shortcode_the_content_filter');
8
  $this->add_filter( 'widget_text', 'do_shortcode');
9
  $this->add_action( 'init', 'yop_poll_setup_schedule');
10
  $this->add_action( 'yop_poll_hourly_event', 'yop_poll_do_scheduler' );
@@ -203,7 +203,18 @@
203
  }
204
 
205
  public function yop_poll_do_shortcode_the_content_filter( $content ) {
206
- return do_shortcode( $content );
 
 
 
 
 
 
 
 
 
 
 
207
  }
208
 
209
  public function widget_init(){
2
  class Yop_Poll_Public_Admin extends Yop_Poll_Plugin {
3
  protected function init() {
4
  $this->add_action( 'init', 'load_translation_file', 1 );
5
+ $this->add_filter( 'the_content', 'yop_poll_do_shortcode_the_content_filter', 1 );
6
  $this->add_action( 'init', 'public_loader', 1 );
7
  $this->add_action( 'widgets_init', 'widget_init' );
 
8
  $this->add_filter( 'widget_text', 'do_shortcode');
9
  $this->add_action( 'init', 'yop_poll_setup_schedule');
10
  $this->add_action( 'yop_poll_hourly_event', 'yop_poll_do_scheduler' );
203
  }
204
 
205
  public function yop_poll_do_shortcode_the_content_filter( $content ) {
206
+ global $shortcode_tags;
207
+ // Backup current registered shortcodes and clear them all out
208
+ $orig_shortcode_tags = $shortcode_tags;
209
+ $shortcode_tags = array();
210
+
211
+ // Do the shortcode (only the one above is registered)
212
+ $content = do_shortcode( $content );
213
+
214
+ // Put the original shortcodes back
215
+ $shortcode_tags = $orig_shortcode_tags;
216
+
217
+ return $content;
218
  }
219
 
220
  public function widget_init(){
inc/yop_poll_model.php CHANGED
@@ -1,79 +1,81 @@
1
  <?php
2
- class Yop_Poll_Model {
3
- var $error = NULL;
4
- var $success = NULL;
5
- var $poll = array(
6
- 'id' => NULL,
7
- 'name' => NULL,
8
- 'question' => NULL,
9
- 'start_date' => NULL,
10
- 'end_date' => NULL,
11
- 'total_votes' => 0,
12
- 'total_answers' => 0,
13
- 'status' => 'open',
14
- 'date_added' => NULL,
15
- 'last_modified' => NULL
 
16
  );
17
 
18
- var $poll_options = NULL;
19
- var $answers = NULL;
20
- var $custom_fields = NULL;
21
-
22
- var $template = array(
23
- 'id' => NULL,
24
- 'name' => NULL,
25
- 'before_vote_template' => NULL,
26
- 'after_vote_template' => NULL,
27
- 'before_start_date_template' => NULL,
28
- 'after_end_date_template' => NULL,
29
- 'css' => NULL,
30
- 'js' => NULL,
31
- 'status' => 'active',
32
- 'date_added' => NULL,
33
- 'last_modified' => NULL,
34
- 'show_in_archive' => NULL,
35
- 'archive_order' => NULL,
36
- 'reset_template_id' => NULL,
37
  );
38
- var $vote = false;
39
- var $vote_types = array( 'default', 'wordpress', 'facebook', 'anonymous' );
40
- var $unique_id = '';
41
- var $tr_id = '';
42
 
43
  public function __construct( $poll_id = -99, $offset = 0 ) {
44
  //do not load id= -99
45
  $poll = NULL;
46
  //Current Active Poll id = -1
47
- if ( -1 == $poll_id ) {
48
- $poll = self::get_current_active_poll( $offset );
49
  }
50
  //Latest Poll id = -2
51
- elseif ( -2 == $poll_id) {
52
- $polls = self::get_yop_polls_filter_search( 'date_added', 'desc' );
53
- $poll = ( $polls[$offset] ) ? $polls[$offset] : NULL ;
54
  }
55
  //Random Poll id = -3
56
  elseif ( -3 == $poll_id ) {
57
- $polls = self::get_yop_polls_filter_search( 'rand()', '' );
58
- $poll = $polls[0];
59
  }
60
  //Latest Closed Poll id = -4
61
  elseif ( -4 == $poll_id ) {
62
- $poll = self::get_latest_closed_poll( $offset );
63
  }
64
  //normal poll
65
  elseif ( $poll_id > 0 ) {
66
- $poll = self::get_poll_from_database_by_id( $poll_id );
67
- }
68
- if ( $poll ) {
69
- $this->poll = $poll;
70
- $this->poll_options = get_yop_poll_meta( $this->poll['id'], 'options', true );
71
- $default_options = get_option( 'yop_poll_options', false );
72
- if ( is_array( $default_options) ) {
73
- if ( count( $default_options ) > 0 ) {
74
  foreach ( $default_options as $option_name => $option_value ) {
75
- if( ! isset( $this->poll_options [ $option_name ] ) )
76
- $this->poll_options [ $option_name ] = $option_value;
 
77
  }
78
  }
79
  }
@@ -82,20 +84,21 @@
82
 
83
  public static function get_poll_options_by_id( $poll_id = 0 ) {
84
  $poll_options = get_yop_poll_meta( $poll_id, 'options', true );
85
- $default_options = get_option( 'yop_poll_options', false );
86
- if ( is_array( $default_options) ) {
87
- if ( count( $default_options ) > 0 ) {
88
  foreach ( $default_options as $option_name => $option_value ) {
89
- if( ! isset( $poll_options [ $option_name ] ) )
90
- $poll_options [ $option_name ] = $option_value;
 
91
  }
92
  }
93
  }
94
- return $poll_options;
95
  }
96
 
97
  public function set_unique_id( $unique_id ) {
98
- $this->unique_id = $unique_id;
99
  }
100
 
101
  public function get_unique_id() {
@@ -103,33 +106,36 @@
103
  }
104
 
105
  private function countAnswers( $request = array() ) {
106
- $answers = 0;
107
- if ( isset( $request['yop_poll_answer'] ) )
108
- $answers = count( $request['yop_poll_answer'] );
109
- if ( isset( $request['yop_poll_options']['allow_other_answers'] ) )
110
- if ( 'yes' == $request['yop_poll_options']['allow_other_answers'] )
111
- $answers = $answers + 1;
112
- return $answers;
 
 
 
113
  }
114
 
115
- public function verify_request_data ( $request = array(), $config = null ) {
116
- if ( isset( $request['yop_poll_name'] ) && '' == trim( $request['yop_poll_name'] ) ) {
117
  $this->error = __( 'Poll name needed!', 'yop_poll' );
118
  return false;
119
  }
120
- elseif (isset( $request['yop_poll_question'] ) && '' == trim( $request['yop_poll_question'] ) ) {
121
  $this->error = __( 'Poll question needed!', 'yop_poll' );
122
  return false;
123
  }
124
  elseif ( $this->countAnswers( $request ) < $config->min_number_of_answers ) {
125
- $this->error = __( 'At least '.$config->min_number_of_answers.' answers needed!', 'yop_poll' );
126
  return false;
127
  }
128
  else {
129
- if ( isset( $request['yop_poll_answer'] ) ) {
130
  $index = 1;
131
  foreach ( $request['yop_poll_answer'] as $answer_id => $answer_value ) {
132
- if ( '' == trim( $answer_value ) ) {
133
  $this->error = __( 'Answer ' . $index . ' should not be empty!', 'yop_poll' );
134
  return false;
135
  }
@@ -137,17 +143,17 @@
137
  }
138
  }
139
  elseif ( isset( $request['yop_poll_options']['allow_other_answers'] ) ) {
140
- if ( 'no' == $request['yop_poll_options']['allow_other_answers'] ) {
141
  $this->error = __( 'Answers not found!', 'yop_poll' );
142
  return false;
143
  }
144
  }
145
 
146
- if ( isset( $request['yop_poll_customfield'] ) ) {
147
  $index = 1;
148
- if ( count( $request['yop_poll_customfield'] > 0 ) ) {
149
  foreach ( $request['yop_poll_customfield'] as $customfield_id => $customfield_value ) {
150
- if ( '' == trim( $customfield_value ) ) {
151
  $this->error = __( 'Custom Field ' . $index . ' should not be empty!', 'yop_poll' );
152
  return false;
153
  }
@@ -156,8 +162,8 @@
156
  }
157
  }
158
 
159
- if ( isset( $request['yop_poll_options']['start_date'] ) ) {
160
- if ( '' == $request['yop_poll_options']['start_date'] ) {
161
  $this->error = __( 'Start Date needed!', 'yop_poll' );
162
  return false;
163
  }
@@ -167,16 +173,16 @@
167
  return false;
168
  }
169
 
170
- if ( ! isset( $request['yop_poll_options']['never_expire'] ) ) {
171
- if ( isset( $request['yop_poll_options']['end_date'] ) ) {
172
- if ( '' == $request['yop_poll_options']['end_date'] ) {
173
  $this->error = __( 'End Date needed!', 'yop_poll' );
174
  return false;
175
  }
176
  }
177
- if ( isset( $request['yop_poll_options']['start_date'] ) ) {
178
- if ( isset( $request['yop_poll_options']['end_date'] ) ) {
179
- if ( $request['yop_poll_options']['start_date'] > $request['yop_poll_options']['end_date']) {
180
  $this->error = __( 'Invalid entry! Start Date is after the End Date! ', 'yop_poll' );
181
  return false;
182
  }
@@ -185,23 +191,23 @@
185
  }
186
 
187
  //answer_result_label
188
- if ( isset( $request['yop_poll_options']['answer_result_label'] ) ) {
189
- if ( 'votes-number' == $request['yop_poll_options']['view_results_type'] ) {
190
- if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ) {
191
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES%!', 'yop_poll' );
192
  return false;
193
  }
194
  }
195
 
196
- if ( 'percentages' == $request['yop_poll_options']['view_results_type'] ) {
197
- if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ) {
198
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' );
199
  return false;
200
  }
201
  }
202
 
203
- if ( 'votes-number-and-percentages' == $request['yop_poll_options']['view_results_type'] ) {
204
- if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ) {
205
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' );
206
  return false;
207
  }
@@ -217,12 +223,12 @@
217
  }
218
 
219
  //view_results_link
220
- if ( isset( $request['yop_poll_options']['view_results_link'] ) ) {
221
- if ( in_array( $request['yop_poll_options']['view_results_link'], array('yes', 'no' ) ) ) {
222
- if ( 'yes' == $request['yop_poll_options']['view_results_link'] ) {
223
  //view_results_link_label
224
- if ( isset( $request['yop_poll_options']['view_results_link_label'] ) ) {
225
- if ( '' == $request['yop_poll_options']['view_results_link_label'] ) {
226
  $this->error = __( 'Option "View Results Link Label" is empty!', 'yop_poll' );
227
  return false;
228
  }
@@ -244,12 +250,12 @@
244
  }
245
 
246
  //view_back_to_vote_link
247
- if ( isset( $request['yop_poll_options']['view_back_to_vote_link'] ) ) {
248
- if ( in_array( $request['yop_poll_options']['view_back_to_vote_link'], array('yes', 'no' ) ) ) {
249
- if ( 'yes' == $request['yop_poll_options']['view_back_to_vote_link'] ) {
250
  //view_back_to_vote_link_label
251
- if ( isset( $request['yop_poll_options']['view_back_to_vote_link_label'] ) ) {
252
- if ( '' == $request['yop_poll_options']['view_back_to_vote_link_label'] ) {
253
  $this->error = __( 'Option "View Back to Vote Link Label" is empty!', 'yop_poll' );
254
  return false;
255
  }
@@ -271,18 +277,18 @@
271
  }
272
 
273
  //view_total_votes
274
- if ( isset( $request['yop_poll_options']['view_total_votes'] ) ) {
275
- if ( in_array( $request['yop_poll_options']['view_total_votes'], array('yes', 'no' ) ) ) {
276
  //view_total_votes
277
- if( 'yes' == $request['yop_poll_options']['view_total_votes'] ) {
278
- if ( isset( $request['yop_poll_options']['view_total_votes_label'] ) ) {
279
- if ( stripos( $request['yop_poll_options']['view_total_votes_label'], '%POLL-TOTAL-VOTES%' ) === false ) {
280
- $this->error = __('You must use %POLL-TOTAL-VOTES% to define your Total Votes label!', 'yop_poll' );
281
  return false;
282
  }
283
  }
284
  else {
285
- $this->error = __('Option "Total Votes Label" not found!', 'yop_poll' );
286
  return false;
287
  }
288
  }
@@ -298,18 +304,18 @@
298
  }
299
 
300
  //view_total_answers
301
- if ( isset( $request['yop_poll_options']['view_total_answers'] ) ) {
302
- if ( in_array( $request['yop_poll_options']['view_total_answers'], array('yes', 'no' ) ) ) {
303
  //view_total_votes
304
- if( 'yes' == $request['yop_poll_options']['view_total_answers'] ) {
305
- if ( isset( $request['yop_poll_options']['view_total_answers_label'] ) ) {
306
- if ( stripos( $request['yop_poll_options']['view_total_answers_label'], '%POLL-TOTAL-ANSWERS%' ) === false ) {
307
- $this->error = __('You must use %POLL-TOTAL-ANSWERS% to define your Total Answers label!', 'yop_poll' );
308
  return false;
309
  }
310
  }
311
  else {
312
- $this->error = __('Option "Total Answers Label" not found!', 'yop_poll' );
313
  return false;
314
  }
315
  }
@@ -325,12 +331,12 @@
325
  }
326
 
327
  //view_poll_archive_link
328
- if ( isset( $request['yop_poll_options']['view_poll_archive_link'] ) ) {
329
- if ( in_array( $request['yop_poll_options']['view_poll_archive_link'], array('yes', 'no' ) ) ) {
330
- if ( 'yes' == $request['yop_poll_options']['view_poll_archive_link'] ) {
331
  //view_poll_archive_link_label
332
- if ( isset( $request['yop_poll_options']['view_poll_archive_link_label'] ) ) {
333
- if ( '' == $request['yop_poll_options']['view_poll_archive_link_label'] ) {
334
  $this->error = __( 'Option "View Poll Archive Link Label" is empty!', 'yop_poll' );
335
  return false;
336
  }
@@ -341,8 +347,8 @@
341
  }
342
 
343
  //poll_archive_url
344
- if ( isset( $request['yop_poll_options']['poll_archive_url'] ) ) {
345
- if ( '' == $request['yop_poll_options']['poll_archive_url'] ) {
346
  $this->error = __( 'Option "Poll Archive URL" is empty!', 'yop_poll' );
347
  return false;
348
  }
@@ -364,12 +370,12 @@
364
  }
365
 
366
  //show_in_archive
367
- if ( isset( $request['yop_poll_options']['show_in_archive'] ) ) {
368
- if ( in_array( $request['yop_poll_options']['show_in_archive'], array('yes', 'no' ) ) ) {
369
- if ( 'yes' == $request['yop_poll_options']['show_in_archive'] ) {
370
  //archive_order
371
- if ( isset( $request['yop_poll_options']['archive_order'] ) ) {
372
- if ( '' == $request['yop_poll_options']['archive_order'] ) {
373
  $this->error = __( 'Option "Archive Order" is empty!', 'yop_poll' );
374
  return false;
375
  }
@@ -390,9 +396,9 @@
390
  return false;
391
  }
392
 
393
- if( isset( $request['yop_poll_options']['template'] ) ) {
394
- $template = self::get_poll_template_from_database_by_id( $request['yop_poll_options']['template'] );
395
- if ( ! $template ) {
396
  $this->error = __( 'Template not found!', 'yop_poll' );
397
  return false;
398
  }
@@ -407,12 +413,12 @@
407
  return false;
408
  }
409
 
410
- public function verify_template_request_data( $request = array(), $config = null ) {
411
- if ( isset( $request['yop_poll_template_name'] ) && '' == trim( $request['yop_poll_template_name'] ) ) {
412
  $this->error = __( 'Poll Template name needed!', 'yop_poll' );
413
  return false;
414
  }
415
- elseif (isset( $request['yop_pol_template'] ) && '' == trim( $request['yop_pol_template'] ) ) {
416
  $this->error = __( 'Poll template needed!', 'yop_poll' );
417
  return false;
418
  }
@@ -422,24 +428,24 @@
422
  return false;
423
  }
424
 
425
- public function make_poll_template_from_request_data ( $request = array(), $config = null ) {
426
- $this->template['id'] = isset( $request['template_id'] ) ? trim( $request['template_id'] ) : null;
427
- $this->template['name'] = isset( $request['yop_poll_template_name'] ) ? trim( $request['yop_poll_template_name'] ) : null;
428
- $this->template['before_vote_template'] = isset( $request['yop_poll_before_vote_template'] ) ? trim( $request['yop_poll_before_vote_template'] ) : null;
429
- $this->template['after_vote_template'] = isset( $request['yop_poll_after_vote_template'] ) ? trim( $request['yop_poll_after_vote_template'] ) : null;
430
- $this->template['before_start_date_template'] = isset( $request['yop_poll_template_before_start_date'] ) ? trim( $request['yop_poll_template_before_start_date'] ) : null;
431
- $this->template['after_end_date_template'] = isset( $request['yop_poll_template_after_end_date'] ) ? trim( $request['yop_poll_template_after_end_date'] ) : null;
432
- $this->template['css'] = isset( $request['yop_poll_template_css'] ) ? trim( $request['yop_poll_template_css'] ) : null;
433
- $this->template['js'] = isset( $request['yop_poll_template_css'] ) ? trim( $request['yop_poll_template_js'] ) : null;
434
- $this->template['reset_template_id'] = isset( $request['yop_poll_reset_template_id'] ) ? trim( $request['yop_poll_reset_template_id'] ) : null;
435
  }
436
 
437
- public function add_poll_template_to_database ( $request = array(), $config = null ) {
438
- if( $this->verify_template_request_data( $request, $config )) {
439
  $this->make_poll_template_from_request_data( $request, $config );
440
  $result = self::get_poll_template_from_database_by_name( $this->template['name'] );
441
- if( !isset( $result['id'] ) ) {
442
- $this->template['id'] = self::insert_poll_template_to_database( $this->template );
443
  return $this->template['id'];
444
  }
445
  else {
@@ -454,66 +460,56 @@
454
 
455
  public static function add_bans( $request ) {
456
  global $wpdb;
457
- $success = NULL;
458
- $error = NULL;
459
 
460
- if ( ! isset( $request['ban_poll_id'] ) ) {
461
- $error = __( 'You must choose a yop poll! ');
462
  }
463
- elseif ( ! ctype_digit( $request['ban_poll_id'] ) ) {
464
- $error = __( 'Invalid Yop Poll! Please try again! ');
465
  }
466
- elseif( ! in_array( $request['ban_type'], array( 'ip', 'username', 'email') ) ) {
467
- $error = __( 'You must choose a ban type!', 'yop_poll');
468
  }
469
  elseif ( '' == trim( $request['ban_value'] ) ) {
470
- $error = __( 'You must choose a ban value!', 'yop_poll');
471
  }
472
  else {
473
- $ban_textarea = nl2br( $request['ban_value'] );
474
- $values = explode( '<br />', $ban_textarea );
475
- if( count( $values ) > 0 ) {
476
- foreach( $values as $value ) {
477
- if ( '' != trim( $value )) {
478
- $ban = array(
479
- 'poll_id' => trim($request['ban_poll_id']),
480
- 'type' => trim($request['ban_type']),
481
- 'value' => trim($value)
482
- );
483
- $exist = $wpdb->get_var(
484
- $wpdb->prepare(
485
- "
486
  SELECT id
487
- FROM ".$wpdb->yop_poll_bans."
488
  WHERE poll_id in( 0, %d) AND
489
  (type = %s and value = %s )
490
  LIMIT 0,1
491
- ",
492
- $ban['poll_id'],
493
- $ban['type'],
494
- $ban['value']
495
- )
496
- );
497
-
498
- if ( ! $exist ) {
499
  $ban = self::insert_ban_to_database( $ban );
500
- if ( $ban )
501
  $success++;
 
502
  }
503
  }
504
  }
505
  }
506
  }
507
- return array('success' => $success, 'error' => $error );
508
  }
509
 
510
- public function edit_poll_template_in_database ( $request = array(), $config = null ) {
511
- if( $this->verify_template_request_data( $request, $config )) {
512
  $this->make_poll_template_from_request_data( $request, $config );
513
  $result = self::get_poll_template_from_database_by_id( $this->template['id'] );
514
- if( isset( $result['id'] ) ) {
515
  $result = self::get_poll_template_from_database_by_name( $this->template['name'], array( $this->template['id'] ) );
516
- if ( !isset($result['id']) ) {
517
  self::update_poll_template_in_database( $this->template );
518
  return $this->template['id'];
519
  }
@@ -532,11 +528,11 @@
532
  }
533
  }
534
 
535
- public function reset_poll_template ( $request = array(), $config = null ) {
536
  $this->make_poll_template_from_request_data( $request, $config );
537
  $result = self::get_poll_template_from_database_by_id( $this->template['id'] );
538
- if ( isset( $result['id'] ) ) {
539
- if ( '' != $this->template['reset_template_id'] ) {
540
  self::reset_poll_template_in_database( $this->template['id'], $this->template['reset_template_id'] );
541
  return $this->template['id'];
542
  }
@@ -554,235 +550,222 @@
554
  private static function reset_poll_template_in_database( $poll_id, $template_id ) {
555
  global $wpdb;
556
 
557
- $sql = "UPDATE `" . $wpdb->yop_poll_templates . "` SET ";
558
  switch ( $template_id ) {
559
- case '1': //White
560
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
561
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
562
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
563
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
564
  `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}',
565
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
566
- `last_modified` = '".current_time( 'mysql' )."' ";
567
  break;
568
- case '2': //Grey
569
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
570
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
571
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
572
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
573
  `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}',
574
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
575
- `last_modified` = '".current_time( 'mysql' )."' ";
576
  break;
577
- case '3': //Dark
578
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
579
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
580
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
581
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
582
  `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}',
583
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
584
- `last_modified` = '".current_time( 'mysql' )."' ";
585
  break;
586
- case '4': //Blue v1
587
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
588
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
589
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
590
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
591
  `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}',
592
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
593
- `last_modified` = '".current_time( 'mysql' )."' ";
594
  break;
595
- case '5': //Blue v2
596
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
597
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
598
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
599
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
600
  `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}',
601
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
602
- `last_modified` = '".current_time( 'mysql' )."' ";
603
  break;
604
- case '6': //Blue v3
605
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
606
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
607
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
608
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
609
  `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}',
610
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
611
- `last_modified` = '".current_time( 'mysql' )."' ";
612
  break;
613
- case '7': //Red v1
614
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
615
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
616
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
617
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
618
  `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}',
619
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
620
- `last_modified` = '".current_time( 'mysql' )."' ";
621
  break;
622
- case '8': //Red v2
623
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
624
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
625
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
626
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
627
  `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}',
628
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
629
- `last_modified` = '".current_time( 'mysql' )."' ";
630
  break;
631
- case '9': //Red v3
632
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
633
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
634
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
635
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
636
  `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}',
637
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
638
- `last_modified` = '".current_time( 'mysql' )."' ";
639
  break;
640
- case '10': //Green v1
641
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
642
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
643
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
644
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
645
  `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}',
646
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
647
- `last_modified` = '".current_time( 'mysql' )."' ";
648
  break;
649
- case '11': //Green v2
650
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
651
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
652
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
653
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
654
  `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}',
655
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
656
- `last_modified` = '".current_time( 'mysql' )."' ";
657
  break;
658
- case '12': //Green v3
659
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
660
- `after_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result-%POLL-ID%\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per-%POLL-ID%\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-vote-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-footer\\".'"'.">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\".'"'."yop-poll-back-%POLL-ID%\\".'"'.">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
661
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
662
- `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-1\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-result-%POLL-ID%\\".'"'.">\r\n <label class=\\".'"'."pds-feedback-label\\".'"'.">\r\n <span class=\\".'"'."pds-answer-text\\".'"'.">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\".'"'."pds-feedback-result\\".'"'.">\r\n <span class=\\".'"'."pds-feedback-per\\".'"'."> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\".'"'."pds-clear\\".'"'." style=\\".'"'."display: block;clear: both;height:1px;line-height:1px;\\".'"'."> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
663
  `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}',
664
- `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."border-left-width\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."border-right-width\\".'"'.")) );\r\n }\r\n else {\r\n jQuery(this).css(\\".'"'."border-left-width\\".'"'.", \'0px\');\r\n jQuery(this).css(\\".'"'."border-right-width\\".'"'.", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) - parseInt(jQuery(this).css(\\".'"'."padding-left\\".'"'.")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\".'"'.") ); \r\n stripBorder_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\".'"'."));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\".'"'."), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\".'"'."#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\".'"'."), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
665
- `last_modified` = '".current_time( 'mysql' )."' ";
666
  break;
667
- case '13': //Orange v1
668
- $sql .= "`before_vote_template` = '<div id=\\".'"'."yop-poll-name-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-name\\".'"'.">%POLL-NAME%</div>\r\n<div id=\\".'"'."yop-poll-question-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-question\\".'"'.">%POLL-QUESTION%</div>\r\n<div id=\\".'"'."yop-poll-answers-%POLL-ID%\\".'"'." class=\\".'"'."yop-poll-answers\\".'"'.">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\".'"'."yop-poll-li-answer-%POLL-ID%\\".'"'.">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\".'"'."yop-poll-results-text-%POLL-ID%\\".'"'.">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\".'"'."yop-poll-custom-%POLL-ID%\\".'"'.">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\".'"'.">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\".'"'."yop-poll-results-%POLL-ID%\\".'"'.">%POLL-VIEW-RESULT-LINK%</div>\r\n <d
1
  <?php
2
+
3
+ class Yop_Poll_Model{
4
+ var $error = NULL;
5
+ var $success = NULL;
6
+ var $poll = array(
7
+ 'id' => NULL,
8
+ 'name' => NULL,
9
+ 'question' => NULL,
10
+ 'start_date' => NULL,
11
+ 'end_date' => NULL,
12
+ 'total_votes' => 0,
13
+ 'total_answers' => 0,
14
+ 'status' => 'open',
15
+ 'date_added' => NULL,
16
+ 'last_modified' => NULL
17
  );
18
 
19
+ var $poll_options = NULL;
20
+ var $answers = NULL;
21
+ var $custom_fields = NULL;
22
+
23
+ var $template = array(
24
+ 'id' => NULL,
25
+ 'name' => NULL,
26
+ 'before_vote_template' => NULL,
27
+ 'after_vote_template' => NULL,
28
+ 'before_start_date_template' => NULL,
29
+ 'after_end_date_template' => NULL,
30
+ 'css' => NULL,
31
+ 'js' => NULL,
32
+ 'status' => 'active',
33
+ 'date_added' => NULL,
34
+ 'last_modified' => NULL,
35
+ 'show_in_archive' => NULL,
36
+ 'archive_order' => NULL,
37
+ 'reset_template_id' => NULL
38
  );
39
+ var $vote = false;
40
+ var $vote_types = array( 'default', 'wordpress', 'facebook', 'anonymous' );
41
+ var $unique_id = '';
42
+ var $tr_id = '';
43
 
44
  public function __construct( $poll_id = -99, $offset = 0 ) {
45
  //do not load id= -99
46
  $poll = NULL;
47
  //Current Active Poll id = -1
48
+ if ( -1 == $poll_id ){
49
+ $poll = self::get_current_active_poll( $offset );
50
  }
51
  //Latest Poll id = -2
52
+ elseif ( -2 == $poll_id ) {
53
+ $polls = self::get_yop_polls_filter_search( 'date_added', 'desc' );
54
+ $poll = ( $polls[$offset] ) ? $polls[$offset] : NULL;
55
  }
56
  //Random Poll id = -3
57
  elseif ( -3 == $poll_id ) {
58
+ $polls = self::get_yop_polls_filter_search( 'rand()', '' );
59
+ $poll = $polls[0];
60
  }
61
  //Latest Closed Poll id = -4
62
  elseif ( -4 == $poll_id ) {
63
+ $poll = self::get_latest_closed_poll( $offset );
64
  }
65
  //normal poll
66
  elseif ( $poll_id > 0 ) {
67
+ $poll = self::get_poll_from_database_by_id( $poll_id );
68
+ }
69
+ if ( $poll ){
70
+ $this->poll = $poll;
71
+ $this->poll_options = get_yop_poll_meta( $this->poll['id'], 'options', true );
72
+ $default_options = get_option( 'yop_poll_options', false );
73
+ if ( is_array( $default_options ) ){
74
+ if ( count( $default_options ) > 0 ){
75
  foreach ( $default_options as $option_name => $option_value ) {
76
+ if ( !isset( $this->poll_options [$option_name] ) ){
77
+ $this->poll_options [$option_name] = $option_value;
78
+ }
79
  }
80
  }
81
  }
84
 
85
  public static function get_poll_options_by_id( $poll_id = 0 ) {
86
  $poll_options = get_yop_poll_meta( $poll_id, 'options', true );
87
+ $default_options = get_option( 'yop_poll_options', false );
88
+ if ( is_array( $default_options ) ){
89
+ if ( count( $default_options ) > 0 ){
90
  foreach ( $default_options as $option_name => $option_value ) {
91
+ if ( !isset( $poll_options [$option_name] ) ){
92
+ $poll_options [$option_name] = $option_value;
93
+ }
94
  }
95
  }
96
  }
97
+ return $poll_options;
98
  }
99
 
100
  public function set_unique_id( $unique_id ) {
101
+ $this->unique_id = $unique_id;
102
  }
103
 
104
  public function get_unique_id() {
106
  }
107
 
108
  private function countAnswers( $request = array() ) {
109
+ $answers = 0;
110
+ if ( isset( $request['yop_poll_answer'] ) ){
111
+ $answers = count( $request['yop_poll_answer'] );
112
+ }
113
+ if ( isset( $request['yop_poll_options']['allow_other_answers'] ) ){
114
+ if ( 'yes' == $request['yop_poll_options']['allow_other_answers'] ){
115
+ $answers = $answers + 1;
116
+ }
117
+ }
118
+ return $answers;
119
  }
120
 
121
+ public function verify_request_data( $request = array(), $config = NULL ) {
122
+ if ( isset( $request['yop_poll_name'] ) && '' == trim( $request['yop_poll_name'] ) ){
123
  $this->error = __( 'Poll name needed!', 'yop_poll' );
124
  return false;
125
  }
126
+ elseif ( isset( $request['yop_poll_question'] ) && '' == trim( $request['yop_poll_question'] ) ) {
127
  $this->error = __( 'Poll question needed!', 'yop_poll' );
128
  return false;
129
  }
130
  elseif ( $this->countAnswers( $request ) < $config->min_number_of_answers ) {
131
+ $this->error = __( 'At least ' . $config->min_number_of_answers . ' answers needed!', 'yop_poll' );
132
  return false;
133
  }
134
  else {
135
+ if ( isset( $request['yop_poll_answer'] ) ){
136
  $index = 1;
137
  foreach ( $request['yop_poll_answer'] as $answer_id => $answer_value ) {
138
+ if ( '' == trim( $answer_value ) ){
139
  $this->error = __( 'Answer ' . $index . ' should not be empty!', 'yop_poll' );
140
  return false;
141
  }
143
  }
144
  }
145
  elseif ( isset( $request['yop_poll_options']['allow_other_answers'] ) ) {
146
+ if ( 'no' == $request['yop_poll_options']['allow_other_answers'] ){
147
  $this->error = __( 'Answers not found!', 'yop_poll' );
148
  return false;
149
  }
150
  }
151
 
152
+ if ( isset( $request['yop_poll_customfield'] ) ){
153
  $index = 1;
154
+ if ( count( $request['yop_poll_customfield'] > 0 ) ){
155
  foreach ( $request['yop_poll_customfield'] as $customfield_id => $customfield_value ) {
156
+ if ( '' == trim( $customfield_value ) ){
157
  $this->error = __( 'Custom Field ' . $index . ' should not be empty!', 'yop_poll' );
158
  return false;
159
  }
162
  }
163
  }
164
 
165
+ if ( isset( $request['yop_poll_options']['start_date'] ) ){
166
+ if ( '' == $request['yop_poll_options']['start_date'] ){
167
  $this->error = __( 'Start Date needed!', 'yop_poll' );
168
  return false;
169
  }
173
  return false;
174
  }
175
 
176
+ if ( !isset( $request['yop_poll_options']['never_expire'] ) ){
177
+ if ( isset( $request['yop_poll_options']['end_date'] ) ){
178
+ if ( '' == $request['yop_poll_options']['end_date'] ){
179
  $this->error = __( 'End Date needed!', 'yop_poll' );
180
  return false;
181
  }
182
  }
183
+ if ( isset( $request['yop_poll_options']['start_date'] ) ){
184
+ if ( isset( $request['yop_poll_options']['end_date'] ) ){
185
+ if ( $request['yop_poll_options']['start_date'] > $request['yop_poll_options']['end_date'] ){
186
  $this->error = __( 'Invalid entry! Start Date is after the End Date! ', 'yop_poll' );
187
  return false;
188
  }
191
  }
192
 
193
  //answer_result_label
194
+ if ( isset( $request['yop_poll_options']['answer_result_label'] ) ){
195
+ if ( 'votes-number' == $request['yop_poll_options']['view_results_type'] ){
196
+ if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-VOTES%' ) === false ){
197
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES%!', 'yop_poll' );
198
  return false;
199
  }
200
  }
201
 
202
+ if ( 'percentages' == $request['yop_poll_options']['view_results_type'] ){
203
+ if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
204
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' );
205
  return false;
206
  }
207
  }
208
 
209
+ if ( 'votes-number-and-percentages' == $request['yop_poll_options']['view_results_type'] ){
210
+ if ( stripos( $request['yop_poll_options']['answer_result_label'], '%POLL-ANSWER-RESULT-PERCENTAGES%' ) === false ){
211
  $this->error = __( 'Option "Poll Answer Result Label" Not Updated! You must use %POLL-ANSWER-RESULT-VOTES% and %POLL-ANSWER-RESULT-PERCENTAGES%!', 'yop_poll' );
212
  return false;
213
  }
223
  }
224
 
225
  //view_results_link
226
+ if ( isset( $request['yop_poll_options']['view_results_link'] ) ){
227
+ if ( in_array( $request['yop_poll_options']['view_results_link'], array( 'yes', 'no' ) ) ){
228
+ if ( 'yes' == $request['yop_poll_options']['view_results_link'] ){
229
  //view_results_link_label
230
+ if ( isset( $request['yop_poll_options']['view_results_link_label'] ) ){
231
+ if ( '' == $request['yop_poll_options']['view_results_link_label'] ){
232
  $this->error = __( 'Option "View Results Link Label" is empty!', 'yop_poll' );
233
  return false;
234
  }
250
  }
251
 
252
  //view_back_to_vote_link
253
+ if ( isset( $request['yop_poll_options']['view_back_to_vote_link'] ) ){
254
+ if ( in_array( $request['yop_poll_options']['view_back_to_vote_link'], array( 'yes', 'no' ) ) ){
255
+ if ( 'yes' == $request['yop_poll_options']['view_back_to_vote_link'] ){
256
  //view_back_to_vote_link_label
257
+ if ( isset( $request['yop_poll_options']['view_back_to_vote_link_label'] ) ){
258
+ if ( '' == $request['yop_poll_options']['view_back_to_vote_link_label'] ){
259
  $this->error = __( 'Option "View Back to Vote Link Label" is empty!', 'yop_poll' );
260
  return false;
261
  }
277
  }
278
 
279
  //view_total_votes
280
+ if ( isset( $request['yop_poll_options']['view_total_votes'] ) ){
281
+ if ( in_array( $request['yop_poll_options']['view_total_votes'], array( 'yes', 'no' ) ) ){
282
  //view_total_votes
283
+ if ( 'yes' == $request['yop_poll_options']['view_total_votes'] ){
284
+ if ( isset( $request['yop_poll_options']['view_total_votes_label'] ) ){
285
+ if ( stripos( $request['yop_poll_options']['view_total_votes_label'], '%POLL-TOTAL-VOTES%' ) === false ){
286
+ $this->error = __( 'You must use %POLL-TOTAL-VOTES% to define your Total Votes label!', 'yop_poll' );
287
  return false;
288
  }
289
  }
290
  else {
291
+ $this->error = __( 'Option "Total Votes Label" not found!', 'yop_poll' );
292
  return false;
293
  }
294
  }
304
  }
305
 
306
  //view_total_answers
307
+ if ( isset( $request['yop_poll_options']['view_total_answers'] ) ){
308
+ if ( in_array( $request['yop_poll_options']['view_total_answers'], array( 'yes', 'no' ) ) ){
309
  //view_total_votes
310
+ if ( 'yes' == $request['yop_poll_options']['view_total_answers'] ){
311
+ if ( isset( $request['yop_poll_options']['view_total_answers_label'] ) ){
312
+ if ( stripos( $request['yop_poll_options']['view_total_answers_label'], '%POLL-TOTAL-ANSWERS%' ) === false ){
313
+ $this->error = __( 'You must use %POLL-TOTAL-ANSWERS% to define your Total Answers label!', 'yop_poll' );
314
  return false;
315
  }
316
  }
317
  else {
318
+ $this->error = __( 'Option "Total Answers Label" not found!', 'yop_poll' );
319
  return false;
320
  }
321
  }
331
  }
332
 
333
  //view_poll_archive_link
334
+ if ( isset( $request['yop_poll_options']['view_poll_archive_link'] ) ){
335
+ if ( in_array( $request['yop_poll_options']['view_poll_archive_link'], array( 'yes', 'no' ) ) ){
336
+ if ( 'yes' == $request['yop_poll_options']['view_poll_archive_link'] ){
337
  //view_poll_archive_link_label
338
+ if ( isset( $request['yop_poll_options']['view_poll_archive_link_label'] ) ){
339
+ if ( '' == $request['yop_poll_options']['view_poll_archive_link_label'] ){
340
  $this->error = __( 'Option "View Poll Archive Link Label" is empty!', 'yop_poll' );
341
  return false;
342
  }
347
  }
348
 
349
  //poll_archive_url
350
+ if ( isset( $request['yop_poll_options']['poll_archive_url'] ) ){
351
+ if ( '' == $request['yop_poll_options']['poll_archive_url'] ){
352
  $this->error = __( 'Option "Poll Archive URL" is empty!', 'yop_poll' );
353
  return false;
354
  }
370
  }
371
 
372
  //show_in_archive
373
+ if ( isset( $request['yop_poll_options']['show_in_archive'] ) ){
374
+ if ( in_array( $request['yop_poll_options']['show_in_archive'], array( 'yes', 'no' ) ) ){
375
+ if ( 'yes' == $request['yop_poll_options']['show_in_archive'] ){
376
  //archive_order
377
+ if ( isset( $request['yop_poll_options']['archive_order'] ) ){
378
+ if ( '' == $request['yop_poll_options']['archive_order'] ){
379
  $this->error = __( 'Option "Archive Order" is empty!', 'yop_poll' );
380
  return false;
381
  }
396
  return false;
397
  }
398
 
399
+ if ( isset( $request['yop_poll_options']['template'] ) ){
400
+ $template = self::get_poll_template_from_database_by_id( $request['yop_poll_options']['template'] );
401
+ if ( !$template ){
402
  $this->error = __( 'Template not found!', 'yop_poll' );
403
  return false;
404
  }
413
  return false;
414
  }
415
 
416
+ public function verify_template_request_data( $request = array(), $config = NULL ) {
417
+ if ( isset( $request['yop_poll_template_name'] ) && '' == trim( $request['yop_poll_template_name'] ) ){
418
  $this->error = __( 'Poll Template name needed!', 'yop_poll' );
419
  return false;
420
  }
421
+ elseif ( isset( $request['yop_pol_template'] ) && '' == trim( $request['yop_pol_template'] ) ) {
422
  $this->error = __( 'Poll template needed!', 'yop_poll' );
423
  return false;
424
  }
428
  return false;
429
  }
430
 
431
+ public function make_poll_template_from_request_data( $request = array(), $config = NULL ) {
432
+ $this->template['id'] = isset( $request['template_id'] ) ? trim( $request['template_id'] ) : NULL;
433
+ $this->template['name'] = isset( $request['yop_poll_template_name'] ) ? trim( $request['yop_poll_template_name'] ) : NULL;
434
+ $this->template['before_vote_template'] = isset( $request['yop_poll_before_vote_template'] ) ? trim( $request['yop_poll_before_vote_template'] ) : NULL;
435
+ $this->template['after_vote_template'] = isset( $request['yop_poll_after_vote_template'] ) ? trim( $request['yop_poll_after_vote_template'] ) : NULL;
436
+ $this->template['before_start_date_template'] = isset( $request['yop_poll_template_before_start_date'] ) ? trim( $request['yop_poll_template_before_start_date'] ) : NULL;
437
+ $this->template['after_end_date_template'] = isset( $request['yop_poll_template_after_end_date'] ) ? trim( $request['yop_poll_template_after_end_date'] ) : NULL;
438
+ $this->template['css'] = isset( $request['yop_poll_template_css'] ) ? trim( $request['yop_poll_template_css'] ) : NULL;
439
+ $this->template['js'] = isset( $request['yop_poll_template_css'] ) ? trim( $request['yop_poll_template_js'] ) : NULL;
440
+ $this->template['reset_template_id'] = isset( $request['yop_poll_reset_template_id'] ) ? trim( $request['yop_poll_reset_template_id'] ) : NULL;
441
  }
442
 
443
+ public function add_poll_template_to_database( $request = array(), $config = NULL ) {
444
+ if ( $this->verify_template_request_data( $request, $config ) ){
445
  $this->make_poll_template_from_request_data( $request, $config );
446
  $result = self::get_poll_template_from_database_by_name( $this->template['name'] );
447
+ if ( !isset( $result['id'] ) ){
448
+ $this->template['id'] = self::insert_poll_template_to_database( $this->template );
449
  return $this->template['id'];
450
  }
451
  else {
460
 
461
  public static function add_bans( $request ) {
462
  global $wpdb;
463
+ $success = NULL;
464
+ $error = NULL;
465
 
466
+ if ( !isset( $request['ban_poll_id'] ) ){
467
+ $error = __( 'You must choose a yop poll! ' );
468
  }
469
+ elseif ( !ctype_digit( $request['ban_poll_id'] ) ) {
470
+ $error = __( 'Invalid Yop Poll! Please try again! ' );
471
  }
472
+ elseif ( !in_array( $request['ban_type'], array( 'ip', 'username', 'email' ) ) ) {
473
+ $error = __( 'You must choose a ban type!', 'yop_poll' );
474
  }
475
  elseif ( '' == trim( $request['ban_value'] ) ) {
476
+ $error = __( 'You must choose a ban value!', 'yop_poll' );
477
  }
478
  else {
479
+ $ban_textarea = nl2br( $request['ban_value'] );
480
+ $values = explode( '<br />', $ban_textarea );
481
+ if ( count( $values ) > 0 ){
482
+ foreach ( $values as $value ) {
483
+ if ( '' != trim( $value ) ){
484
+ $ban = array( 'poll_id' => trim( $request['ban_poll_id'] ), 'type' => trim( $request['ban_type'] ), 'value' => trim( $value ) );
485
+ $exist = $wpdb->get_var( $wpdb->prepare( "
 
 
 
 
 
 
486
  SELECT id
487
+ FROM " . $wpdb->yop_poll_bans . "
488
  WHERE poll_id in( 0, %d) AND
489
  (type = %s and value = %s )
490
  LIMIT 0,1
491
+ ", $ban['poll_id'], $ban['type'], $ban['value'] ) );
492
+
493
+ if ( !$exist ){
 
 
 
 
 
494
  $ban = self::insert_ban_to_database( $ban );
495
+ if ( $ban ){
496
  $success++;
497
+ }
498
  }
499
  }
500
  }
501
  }
502
  }
503
+ return array( 'success' => $success, 'error' => $error );
504
  }
505
 
506
+ public function edit_poll_template_in_database( $request = array(), $config = NULL ) {
507
+ if ( $this->verify_template_request_data( $request, $config ) ){
508
  $this->make_poll_template_from_request_data( $request, $config );
509
  $result = self::get_poll_template_from_database_by_id( $this->template['id'] );
510
+ if ( isset( $result['id'] ) ){
511
  $result = self::get_poll_template_from_database_by_name( $this->template['name'], array( $this->template['id'] ) );
512
+ if ( !isset( $result['id'] ) ){
513
  self::update_poll_template_in_database( $this->template );
514
  return $this->template['id'];
515
  }
528
  }
529
  }
530
 
531
+ public function reset_poll_template( $request = array(), $config = NULL ) {
532
  $this->make_poll_template_from_request_data( $request, $config );
533
  $result = self::get_poll_template_from_database_by_id( $this->template['id'] );
534
+ if ( isset( $result['id'] ) ){
535
+ if ( '' != $this->template['reset_template_id'] ){
536
  self::reset_poll_template_in_database( $this->template['id'], $this->template['reset_template_id'] );
537
  return $this->template['id'];
538
  }
550
  private static function reset_poll_template_in_database( $poll_id, $template_id ) {
551
  global $wpdb;
552
 
553
+ $sql = "UPDATE `" . $wpdb->yop_poll_templates . "` SET ";
554
  switch ( $template_id ) {
555
+ case '1': //White
556
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
557
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
558
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
559
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
560
  `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}',
561
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
562
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
563
  break;
564
+ case '2': //Grey
565
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
566
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
567
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
568
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
569
  `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}',
570
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
571
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
572
  break;
573
+ case '3': //Dark
574
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
575
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
576
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
577
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
578
  `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}',
579
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
580
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
581
  break;
582
+ case '4': //Blue v1
583
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
584
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
585
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
586
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
587
  `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}',
588
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
589
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
590
  break;
591
+ case '5': //Blue v2
592
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
593
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
594
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
595
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
596
  `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}',
597
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
598
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
599
  break;
600
+ case '6': //Blue v3
601
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
602
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
603
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
604
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
605
  `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}',
606
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
607
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
608
  break;
609
+ case '7': //Red v1
610
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
611
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
612
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
613
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
614
  `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}',
615
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
616
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
617
  break;
618
+ case '8': //Red v2
619
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
620
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
621
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
622
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
623
  `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}',
624
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
625
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
626
  break;
627
+ case '9': //Red v3
628
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
629
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
630
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
631
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
632
  `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}',
633
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
634
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
635
  break;
636
+ case '10': //Green v1
637
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
638
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
639
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
640
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
641
  `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}',
642
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
643
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
644
  break;
645
+ case '11': //Green v2
646
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
647
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
648
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
649
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
650
  `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}',
651
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
652
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
653
  break;
654
+ case '12': //Green v3
655
+ $sql .= "`before_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-ANSWER-CHECK-INPUT% \r\n %POLL-ANSWER-LABEL%\r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_CONTAINER]\r\n [OTHER_ANSWER_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-answer-%POLL-ID%\\" . '"' . ">\r\n %POLL-OTHER-ANSWER-CHECK-INPUT% \r\n %POLL-OTHER-ANSWER-LABEL% \r\n <span class=\\" . '"' . "yop-poll-results-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-RESULT-LABEL%</span>\r\n %POLL-OTHER-ANSWER-TEXT-INPUT% \r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/OTHER_ANSWER_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-custom-%POLL-ID%\\" . '"' . ">\r\n <ul>\r\n [CUSTOM_FIELD_CONTAINER]\r\n <li>%POLL-CUSTOM-FIELD-LABEL% %POLL-CUSTOM-FIELD-TEXT-INPUT%</li>\r\n [/CUSTOM_FIELD_CONTAINER]\r\n </ul>\r\n</div> \r\n[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\\" . '"' . ">\r\n <div>%POLL-VOTE-BUTTON%</div>\r\n <div id=\\" . '"' . "yop-poll-results-%POLL-ID%\\" . '"' . ">%POLL-VIEW-RESULT-LINK%</div>\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n</div>',
656
+ `after_vote_template` = '<div id=\\" . '"' . "yop-poll-name-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-name\\" . '"' . ">%POLL-NAME%</div>\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text-%POLL-ID%\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result-%POLL-ID%\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per-%POLL-ID%\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <div>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </div>\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n<div id=\\" . '"' . "yop-poll-vote-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-footer\\" . '"' . ">\r\n <div>%POLL-TOTAL-ANSWERS%</div>\r\n <div>%POLL-TOTAL-VOTES%</div>\r\n <div id=\\" . '"' . "yop-poll-back-%POLL-ID%\\" . '"' . ">%POLL-BACK-TO-VOTE-LINK%</div>\r\n</div>',
657
  `before_start_date_template` = 'This poll is about to <br>\r\nstart at %POLL-START-DATE%<br>\r\nand finish at %POLL-END-DATE%<br>',
658
+ `after_end_date_template` = 'This poll is closed!\r\nPoll activity: <br>\r\nstart_date %POLL-START-DATE%<br>\r\nend_date %POLL-END-DATE%<br>\r\n\r\nPoll Results:\r\n<div id=\\" . '"' . "yop-poll-question-%POLL-ID%\\" . '"' . " class=\\" . '"' . "yop-poll-question\\" . '"' . ">%POLL-QUESTION%</div>\r\n<div id=\\" . '"' . "yop-poll-answers-1\\" . '"' . " class=\\" . '"' . "yop-poll-answers\\" . '"' . ">\r\n <ul>\r\n [ANSWER_RESULT_CONTAINER]\r\n <li class=\\" . '"' . "yop-poll-li-result-%POLL-ID%\\" . '"' . ">\r\n <label class=\\" . '"' . "pds-feedback-label\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-answer-text\\" . '"' . ">%POLL-ANSWER-LABEL%</span>\r\n <span class=\\" . '"' . "pds-feedback-result\\" . '"' . ">\r\n <span class=\\" . '"' . "pds-feedback-per\\" . '"' . "> %POLL-ANSWER-RESULT-LABEL%</span>\r\n </span>\r\n </label>\r\n <span class=\\" . '"' . "pds-clear\\" . '"' . " style=\\" . '"' . "display: block;clear: both;height:1px;line-height:1px;\\" . '"' . "> </span>\r\n %POLL-ANSWER-RESULT-BAR%\r\n </li>\r\n [/ANSWER_RESULT_CONTAINER]\r\n </ul>\r\n</div>\r\n%POLL-VOTE-BUTTON%',
659
  `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}',
660
+ `js` = 'function stripBorder_%POLL-ID%(object) {\r\n object.each(function() {\r\n if( parseInt(jQuery(this).width() ) > 0) {\r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ")) );\r\n }\r\n else {\r\n jQuery(this).css(\\" . '"' . "border-left-width\\" . '"' . ", \'0px\');\r\n jQuery(this).css(\\" . '"' . "border-right-width\\" . '"' . ", \'0px\');\r\n }\r\n });\r\n}\r\nfunction stripPadding_%POLL-ID%(object) {\r\n object.each(function() { \r\n jQuery(this).width( parseInt( jQuery(this).width() ) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) - parseInt(jQuery(this).css(\\" . '"' . "padding-left\\" . '"' . ")) );\r\n });\r\n}\r\n\r\nfunction strip_results_%POLL-ID%() {\r\n stripPadding_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop_poll_li_result-%POLL-ID%\\" . '"' . ") ); \r\n stripBorder_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-result-bar-%POLL-ID%\\" . '"' . "));\r\n}\r\n\r\njQuery(document).ready(function(e) {\r\n if(typeof window.strip_results_%POLL-ID% == \'function\') \r\n strip_results_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_answers_%POLL-ID% == \'function\') \r\n tabulate_answers_%POLL-ID%();\r\n \r\n if(typeof window.tabulate_results_%POLL-ID% == \'function\') \r\n tabulate_results_%POLL-ID%();\r\n \r\n});\r\n\r\nfunction equalWidth_%POLL-ID%(obj, cols, findWidest ) {\r\n findWidest = typeof findWidest !== \'undefined\' ? findWidest : false;\r\n if ( findWidest ) {\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n width = parseInt(thisWidth / cols); \r\n jQuery(this).width(width); \r\n jQuery(this).css(\'float\', \'left\'); \r\n });\r\n }\r\n else {\r\n var widest = 0;\r\n obj.each(function() {\r\n var thisWidth = jQuery(this).width();\r\n if(thisWidth > widest) {\r\n widest = thisWidth; \r\n } \r\n });\r\n width = parseInt( widest / cols); \r\n obj.width(width); \r\n obj.css(\'float\', \'left\'); \r\n } \r\n}\r\n\r\nfunction tabulate_answers_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-answer-%POLL-ID%\\" . '"' . "), %ANSWERS-TABULATED-COLS% );\r\n //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 );\r\n}\r\n\r\nfunction tabulate_results_%POLL-ID%() {\r\n equalWidth_%POLL-ID%( jQuery(\\" . '"' . "#yop-poll-container-%POLL-ID% .yop-poll-li-result-%POLL-ID%\\" . '"' . "), %RESULTS-TABULATED-COLS% );\r\n //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 );\r\n}',
661
+ `last_modified` = '" . current_time( 'mysql' ) . "' ";
662
  break;