YOP Poll - Version 5.8.3

Version Description

  • fixed php7 issues
Download this release

Release Info

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

Code changes from version 5.7.9 to 5.8.3

css/reveal.css CHANGED
@@ -20,7 +20,6 @@
20
left: 50%;
21
margin-left: -570px;
22
width: 1050px;
23
- background: #eee url(modal-gloss.png) no-repeat -200px -80px;
24
position: absolute;
25
z-index: 101;
26
padding: 30px 40px 34px;
20
left: 50%;
21
margin-left: -570px;
22
width: 1050px;
23
position: absolute;
24
z-index: 101;
25
padding: 30px 40px 34px;
inc/admin.php CHANGED
@@ -1,6 +1,5 @@
1
<?php
2
class Yop_Poll_Admin extends Yop_Poll_Plugin {
3
-
4
public function admin_loader() {
5
$this->add_action( 'admin_menu', 'admin_menu', 1 );
6
$this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
@@ -11,48 +10,35 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
11
$this->wp_ajax_action( 'reset_templates' );
12
$this->wp_ajax_action( 'reset_templates' );
13
$this->wp_ajax_action( 'add_votes' );
14
-
15
$this->add_action( 'admin_enqueue_scripts', 'my_yop_poll_button' );
16
$this->add_action( 'admin_enqueue_scripts', 'load_editor_functions' );
17
-
18
$this->add_action( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
19
$this->add_action( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
20
-
21
$this->add_action( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
22
$this->add_action( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
23
-
24
$this->add_action( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
25
$this->add_action( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
26
$this->add_action( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
27
-
28
$this->add_action( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
29
$this->add_action( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
30
-
31
$this->add_action( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
32
$this->add_action( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
33
-
34
$this->add_action( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
35
$this->add_action( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
36
- register_uninstall_hook( $this->_config->plugin_file, 'yop_poll_uninstall' );
37
-
38
$this->add_action( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
39
$this->add_action( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
40
-
41
$this->add_action( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
42
$this->add_action( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
43
-
44
$this->add_action( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
45
$this->add_action( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
46
-
47
$this->add_action( 'wp_ajax_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
48
$this->add_action( 'wp_ajax_nopriv_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
49
-
50
$this->add_action( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
51
$this->add_action( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
52
-
53
$this->add_action( 'wp_ajax_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
54
$this->add_action( 'wp_ajax_nopriv_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
55
-
56
}
57
public function db_update() {
58
$main_obj=new YOP_POLL_Maintenance();
@@ -60,16 +46,13 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
60
61
}
62
public function admin_menu() {
63
-
64
if( is_admin() ) {
65
-
66
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
67
if( function_exists( 'add_menu_page' ) ) {
68
-
69
- $page = add_object_page( __yop_poll( 'Yop Poll' ), __yop_poll( 'Yop Poll' ), 'edit_own_yop_polls', 'yop-polls', array(
70
$pollAdminObj,
71
'manage_polls'
72
- ), YOP_POLL_URL . "images/yop-poll-admin-menu-icon16.png" );
73
if( $page ) {
74
$this->add_action( "load-$page", 'manage_pages_load' );
75
add_action( "load-$page", array(
@@ -79,7 +62,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
79
80
if( function_exists( 'add_submenu_page' ) ) {
81
if( current_user_can( 'edit_own_yop_polls' ) ) {
82
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'All Polls' ), __yop_poll( 'All Polls' ), 'edit_own_yop_polls', 'yop-polls', array(
83
$pollAdminObj,
84
'manage_polls'
85
) );
@@ -91,7 +74,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
91
) );
92
}
93
94
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Add New' ), __yop_poll( 'Add New' ), 'edit_own_yop_polls', 'yop-polls-add-new', array(
95
&$pollAdminObj,
96
'manage_polls'
97
) );
@@ -103,25 +86,9 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
103
) );
104
}
105
}
106
- if( current_user_can( 'manage_yop_polls_imports' ) ) {
107
-
108
- $importObj = YOP_POLL_Imports_Admin::get_instance();
109
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Import' ), __yop_poll( 'Import' ), 'view_yop_polls_imports', 'yop-polls-imports', array(
110
- &$importObj,
111
- "manage_imports"
112
- ) );
113
- if( $subpage ) {
114
- $this->add_action( "load-$subpage", "manage_pages_load" );
115
- add_action( "load-$subpage", array(
116
- $importObj,
117
- 'manage_load_imports'
118
- ) );
119
- }
120
-
121
- }
122
if( current_user_can( 'view_yop_polls_logs' ) ) {
123
$logsObj = YOP_POLL_Logs_Admin::get_instance();
124
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Logs' ), __yop_poll( 'Logs' ), 'view_yop_polls_logs', 'yop-polls-logs', array(
125
&$logsObj,
126
"manage_logs"
127
) );
@@ -135,7 +102,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
135
}
136
if( current_user_can( 'manage_yop_polls_options' ) ) {
137
$genOptObj = YOP_POLL_General_Options::get_instance();
138
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Options' ), __yop_poll( 'Options' ), 'manage_yop_polls_options', 'yop-polls-options', array(
139
&$genOptObj,
140
"manage_options"
141
) );
@@ -149,7 +116,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
149
}
150
if( current_user_can( 'edit_yop_polls_templates' ) ) {
151
$templatesObj = YOP_POLL_Templates_Admin::get_instance();
152
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Templates' ), __yop_poll( 'Templates' ), 'edit_yop_polls_templates', 'yop-polls-templates', array(
153
&$templatesObj,
154
"manage_templates"
155
) );
@@ -165,7 +132,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
165
166
if( current_user_can( 'manage_yop_polls_bans' ) ) {
167
$bansObj = YOP_POLL_Ban_Admin::get_instance();
168
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( 'Bans' ), __yop_poll( 'Bans' ), 'manage_yop_polls_bans', 'yop-polls-bans', array(
169
&$bansObj,
170
"manage_bans"
171
) );
@@ -180,7 +147,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
180
181
if( current_user_can( 'help_yop_poll_page' ) ) {
182
$proObj = YOP_POLL_Pro_Admin::get_instance();
183
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( "Help" ), __yop_poll( "Help" ), 'help_yop_poll_page', 'yop-polls-help', array(
184
&$proObj,
185
"yop_poll_help"
186
) );
@@ -192,7 +159,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
192
}
193
if( current_user_can( 'become_yop_poll_pro' ) ) {
194
$proObj = YOP_POLL_Pro_Admin::get_instance();
195
- $subpage = add_submenu_page( 'yop-polls', __yop_poll( "Upgrade to Pro" ), __yop_poll( "Upgrade to Pro" ), 'become_yop_poll_pro', 'yop-polls-become-pro', array(
196
&$proObj,
197
"manage_pages"
198
) );
@@ -208,7 +175,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
208
}
209
}
210
}
211
-
212
private static function update_poll_template_in_database2( $template ) {
213
global $wpdb;
214
$sql = $wpdb->query( $wpdb->prepare( "
@@ -450,7 +416,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
450
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
451
die ();
452
}
453
-
454
public function manage_pages_load() {
455
wp_reset_vars( array(
456
'page',
@@ -508,19 +473,16 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
508
wp_localize_script( 'yop-poll-tool_tips-js', 'yop_poll_tool_tips', $yop_poll_tooltips );
509
wp_enqueue_media();
510
}
511
-
512
public function get_new_poll_answer_template() {
513
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
514
$pollAdminObj->get_new_answer_template( $_REQUEST );
515
die();
516
}
517
-
518
public function get_new_poll_question_template() {
519
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
520
$pollAdminObj->get_new_question_template( $_REQUEST );
521
die();
522
}
523
-
524
public function add_edit_poll() {
525
if( is_admin() ) {
526
if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
@@ -532,7 +494,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
532
}
533
die();
534
}
535
-
536
public function add_edit_templates() {
537
if( is_admin() ) {
538
if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false )
@@ -545,7 +506,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
545
}
546
die();
547
}
548
-
549
public function reset_templates() {
550
if( is_admin() ) {
551
if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false ) ) {
@@ -558,7 +518,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
558
}
559
die();
560
}
561
-
562
public function yop_poll_options_admin_init() {
563
$genOptObj = YOP_POLL_General_Options::get_instance();
564
register_setting( 'yop_poll_options', 'yop_poll_options', array(
@@ -566,7 +525,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
566
'general_options_validate'
567
) );
568
}
569
-
570
public function disable_check_for_updates_wp( $r, $url ) {
571
if( 0 !== strpos( $url, 'https://api.wordpress.org/plugins/update-check' ) ) {
572
return $r;
@@ -580,7 +538,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
580
581
return $r;
582
}
583
-
584
public function ajax_show_captcha() {
585
if( is_admin() ) {
586
$poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
@@ -609,9 +566,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
609
}
610
die ();
611
}
612
-
613
//region AJAX SECTION
614
-
615
public function ajax_play_captcha() {
616
if( is_admin() ) {
617
$poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
@@ -638,7 +593,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
638
}
639
die ();
640
}
641
-
642
public function yop_poll_do_vote() {
643
$error = '';
644
$success = '';
@@ -683,7 +637,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
683
) ) . '[/ajax-response]';
684
die ();
685
}
686
-
687
public function yop_poll_view_results() {
688
$error = '';
689
$success = '';
@@ -740,7 +693,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
740
) ) . '[/ajax-response]';
741
die ();
742
}
743
-
744
public function yop_poll_back_to_vote() {
745
$error = '';
746
$success = '';
@@ -793,7 +745,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
793
) ) . '[/ajax-response]';
794
die ();
795
}
796
-
797
public function yop_poll_load_js() {
798
header( 'Content-Type: text/javascript' );
799
// check_ajax_referer('yop-poll-public-js');
@@ -812,7 +763,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
812
}
813
die ();
814
}
815
-
816
public function ajax_set_google_vote() {
817
$poll_id = xss_clean(yop_poll_base64_decode( $_GET['poll_id'] ));
818
$unique_id = xss_clean(yop_poll_base64_decode( $_GET['unique_id'] ));
@@ -945,7 +895,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
945
$facebook->destroySession();
946
die();
947
}
948
-
949
public function ajax_set_wordpress_vote() {
950
$poll_id = yop_poll_base64_decode( xss_clean($_GET['poll_id']) );
951
$unique_id = yop_poll_base64_decode( xss_clean($_GET['unique_id'] ));
@@ -1002,7 +951,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1002
<?php
1003
die();
1004
}
1005
-
1006
public function ajax_is_wordpress_user() {
1007
global $current_user;
1008
if( $current_user->ID > 0 ) {
@@ -1013,7 +961,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1013
}
1014
die();
1015
}
1016
-
1017
public function ajax_get_polls_for_editor() {
1018
//check_ajax_referer( 'yop-poll-editor' );
1019
if( is_admin() ) {
@@ -1200,9 +1147,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1200
}
1201
die ();
1202
}
1203
-
1204
-
1205
-
1206
public function ajax_get_polls_for_html_editor() {
1207
check_ajax_referer( 'yop-poll-html-editor' );
1208
if( is_admin() ) {
@@ -1344,7 +1288,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1344
</td>
1345
</tr>
1346
</table>
1347
-
1348
<!--
1349
<p style="text-align: center;">
1350
<label for="yop-poll-id-html-dialog"> <span><?php _e( 'Pollsss to Display', 'yop_poll' ); ?>:</span>
@@ -1398,7 +1342,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1398
}
1399
die ();
1400
}
1401
-
1402
public function ajax_preview_add_edit() {
1403
if( is_admin() ) {
1404
if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
@@ -1408,7 +1351,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1408
}
1409
die();
1410
}
1411
-
1412
function load_editor_functions( $hook ) {
1413
global $post;
1414
@@ -1428,21 +1370,16 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1428
}
1429
}
1430
//endregion
1431
-
1432
// region TINYMCE
1433
-
1434
function register_button( $buttons ) {
1435
array_push( $buttons, "separator", "yoppoll" );
1436
1437
return $buttons;
1438
}
1439
-
1440
function add_plugin( $plugin_array ) {
1441
$plugin_array ['yoppoll'] = YOP_POLL_URL . "tinymce/yop-poll-editor.js";
1442
-
1443
return $plugin_array;
1444
}
1445
-
1446
function my_yop_poll_button( $hook ) {
1447
if( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
1448
if( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
@@ -1462,7 +1399,6 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1462
}
1463
}
1464
public function add_votes(){
1465
-
1466
if( is_admin() ) {
1467
1468
if( ! check_ajax_referer( 'yop-poll-results_vote_add_vote','yop-poll-results_votes_add_votes', false ) ) {
@@ -1496,7 +1432,5 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
1496
}
1497
//endregion
1498
}
1499
-
1500
-
1501
;
1502
- ?>
1
<?php
2
class Yop_Poll_Admin extends Yop_Poll_Plugin {
3
public function admin_loader() {
4
$this->add_action( 'admin_menu', 'admin_menu', 1 );
5
$this->add_action( 'admin_init', 'yop_poll_options_admin_init', 1 );
10
$this->wp_ajax_action( 'reset_templates' );
11
$this->wp_ajax_action( 'reset_templates' );
12
$this->wp_ajax_action( 'add_votes' );
13
$this->add_action( 'admin_enqueue_scripts', 'my_yop_poll_button' );
14
$this->add_action( 'admin_enqueue_scripts', 'load_editor_functions' );
15
$this->add_action( 'wp_ajax_yop_poll_editor', 'ajax_get_polls_for_editor', 1 );
16
$this->add_action( 'wp_ajax_yop_poll_html_editor', 'ajax_get_polls_for_html_editor', 1 );
17
$this->add_action( 'wp_ajax_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
18
$this->add_action( 'wp_ajax_nopriv_yop_poll_show_captcha', 'ajax_show_captcha', 1 );
19
$this->add_action( 'wp_ajax_yop_poll_show_optin_box_modal', 'ajax_show_optin_box_modal', 1 );
20
$this->add_action( 'wp_ajax_yop_poll_modal_option_signup', 'ajax_modal_option_signup', 1 );
21
$this->add_action( 'wp_ajax_yop_poll_sidebar_option_signup', 'ajax_sidebar_option_signup', 1 );
22
$this->add_action( 'wp_ajax_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
23
$this->add_action( 'wp_ajax_nopriv_yop_poll_play_captcha', 'ajax_play_captcha', 1 );
24
$this->add_action( 'wp_ajax_nopriv_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
25
$this->add_action( 'wp_ajax_yop_poll_do_vote', 'yop_poll_do_vote', 1 );
26
$this->add_action( 'wp_ajax_yop_poll_load_js', 'yop_poll_load_js', 1 );
27
$this->add_action( 'wp_ajax_nopriv_yop_poll_load_js', 'yop_poll_load_js', 1 );
28
+ register_uninstall_hook( YOP_POLL_PLUGIN_FILE, 'yop_poll_uninstall' );
29
$this->add_action( 'wp_ajax_nopriv_yop_poll_view_results', 'yop_poll_view_results', 1 );
30
$this->add_action( 'wp_ajax_yop_poll_view_results', 'yop_poll_view_results', 1 );
31
$this->add_action( 'wp_ajax_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
32
$this->add_action( 'wp_ajax_nopriv_yop_poll_back_to_vote', 'yop_poll_back_to_vote', 1 );
33
$this->add_action( 'wp_ajax_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
34
$this->add_action( 'wp_ajax_nopriv_yop_poll_is_wordpress_user', 'ajax_is_wordpress_user', 1 );
35
$this->add_action( 'wp_ajax_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
36
$this->add_action( 'wp_ajax_nopriv_yop_poll_preview_add_edit', 'ajax_preview_add_edit', 1 );
37
$this->add_action( 'wp_ajax_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
38
$this->add_action( 'wp_ajax_nopriv_yop_poll_set_wordpress_vote', 'ajax_set_wordpress_vote', 1 );
39
$this->add_action( 'wp_ajax_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
40
$this->add_action( 'wp_ajax_nopriv_yop_poll_set_google_vote', 'ajax_set_google_vote', 1 );
41
+ load_plugin_textdomain( 'yop_poll', false, YOP_POLL_PLUGIN_DIR . '/languages' );
42
}
43
public function db_update() {
44
$main_obj=new YOP_POLL_Maintenance();
46
47
}
48
public function admin_menu() {
49
if( is_admin() ) {
50
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
51
if( function_exists( 'add_menu_page' ) ) {
52
+ $page = add_menu_page( __( 'Yop Poll', 'yop-poll' ), __( 'Yop Poll', 'yop-poll' ), 'edit_own_yop_polls', 'yop-polls', array(
53
$pollAdminObj,
54
'manage_polls'
55
+ ), YOP_POLL_URL . "images/yop-poll-admin-menu-icon16.png", "26.6" );
56
if( $page ) {
57
$this->add_action( "load-$page", 'manage_pages_load' );
58
add_action( "load-$page", array(
62
63
if( function_exists( 'add_submenu_page' ) ) {
64
if( current_user_can( 'edit_own_yop_polls' ) ) {
65
+ $subpage = add_submenu_page( 'yop-polls', __( 'All Polls', 'yop-poll' ), __( 'All Polls', 'yop-poll' ), 'edit_own_yop_polls', 'yop-polls', array(
66
$pollAdminObj,
67
'manage_polls'
68
) );
74
) );
75
}
76
77
+ $subpage = add_submenu_page( 'yop-polls', __( 'Add New', 'yop-poll' ), __( 'Add New', 'yop-poll' ), 'edit_own_yop_polls', 'yop-polls-add-new', array(
78
&$pollAdminObj,
79
'manage_polls'
80
) );
86
) );
87
}
88
}
89
if( current_user_can( 'view_yop_polls_logs' ) ) {
90
$logsObj = YOP_POLL_Logs_Admin::get_instance();
91
+ $subpage = add_submenu_page( 'yop-polls', __( 'Logs', 'yop-poll' ), __( 'Logs', 'yop-poll' ), 'view_yop_polls_logs', 'yop-polls-logs', array(
92
&$logsObj,
93
"manage_logs"
94
) );
102
}
103
if( current_user_can( 'manage_yop_polls_options' ) ) {
104
$genOptObj = YOP_POLL_General_Options::get_instance();
105
+ $subpage = add_submenu_page( 'yop-polls', __( 'Options', 'yop-poll' ), __( 'Options', 'yop-poll' ), 'manage_yop_polls_options', 'yop-polls-options', array(
106
&$genOptObj,
107
"manage_options"
108
) );
116
}
117
if( current_user_can( 'edit_yop_polls_templates' ) ) {
118
$templatesObj = YOP_POLL_Templates_Admin::get_instance();
119
+ $subpage = add_submenu_page( 'yop-polls', __( 'Templates', 'yop-poll' ), __( 'Templates', 'yop-poll' ), 'edit_yop_polls_templates', 'yop-polls-templates', array(
120
&$templatesObj,
121
"manage_templates"
122
) );
132
133
if( current_user_can( 'manage_yop_polls_bans' ) ) {
134
$bansObj = YOP_POLL_Ban_Admin::get_instance();
135
+ $subpage = add_submenu_page( 'yop-polls', __( 'Bans', 'yop-poll' ), __( 'Bans', 'yop-poll' ), 'manage_yop_polls_bans', 'yop-polls-bans', array(
136
&$bansObj,
137
"manage_bans"
138
) );
147
148
if( current_user_can( 'help_yop_poll_page' ) ) {
149
$proObj = YOP_POLL_Pro_Admin::get_instance();
150
+ $subpage = add_submenu_page( 'yop-polls', __( "Help", 'yop-poll' ), __( "Help", 'yop-poll' ), 'help_yop_poll_page', 'yop-polls-help', array(
151
&$proObj,
152
"yop_poll_help"
153
) );
159
}
160
if( current_user_can( 'become_yop_poll_pro' ) ) {
161
$proObj = YOP_POLL_Pro_Admin::get_instance();
162
+ $subpage = add_submenu_page( 'yop-polls', __( "Upgrade to Pro", 'yop-poll' ), __( "Upgrade to Pro", 'yop-poll' ), 'become_yop_poll_pro', 'yop-polls-become-pro', array(
163
&$proObj,
164
"manage_pages"
165
) );
175
}
176
}
177
}
178
private static function update_poll_template_in_database2( $template ) {
179
global $wpdb;
180
$sql = $wpdb->query( $wpdb->prepare( "
416
update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
417
die ();
418
}
419
public function manage_pages_load() {
420
wp_reset_vars( array(
421
'page',
473
wp_localize_script( 'yop-poll-tool_tips-js', 'yop_poll_tool_tips', $yop_poll_tooltips );
474
wp_enqueue_media();
475
}
476
public function get_new_poll_answer_template() {
477
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
478
$pollAdminObj->get_new_answer_template( $_REQUEST );
479
die();
480
}
481
public function get_new_poll_question_template() {
482
$pollAdminObj = YOP_POLL_Poll_Admin::get_instance();
483
$pollAdminObj->get_new_question_template( $_REQUEST );
484
die();
485
}
486
public function add_edit_poll() {
487
if( is_admin() ) {
488
if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
494
}
495
die();
496
}
497
public function add_edit_templates() {
498
if( is_admin() ) {
499
if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false )
506
}
507
die();
508
}
509
public function reset_templates() {
510
if( is_admin() ) {
511
if( ! check_ajax_referer( 'yop-poll-templates-add-edit-action', 'yop-poll-templates-add-edit-name', false ) ) {
518
}
519
die();
520
}
521
public function yop_poll_options_admin_init() {
522
$genOptObj = YOP_POLL_General_Options::get_instance();
523
register_setting( 'yop_poll_options', 'yop_poll_options', array(
525
'general_options_validate'
526
) );
527
}
528
public function disable_check_for_updates_wp( $r, $url ) {
529
if( 0 !== strpos( $url, 'https://api.wordpress.org/plugins/update-check' ) ) {
530
return $r;
538
539
return $r;
540
}
541
public function ajax_show_captcha() {
542
if( is_admin() ) {
543
$poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
566
}
567
die ();
568
}
569
//region AJAX SECTION
570
public function ajax_play_captcha() {
571
if( is_admin() ) {
572
$poll_id = isset ( $_REQUEST ['poll_id'] ) ? $_REQUEST ['poll_id'] : null;
593
}
594
die ();
595
}
596
public function yop_poll_do_vote() {
597
$error = '';
598
$success = '';
637
) ) . '[/ajax-response]';
638
die ();
639
}
640
public function yop_poll_view_results() {
641
$error = '';
642
$success = '';
693
) ) . '[/ajax-response]';
694
die ();
695
}
696
public function yop_poll_back_to_vote() {
697
$error = '';
698
$success = '';
745
) ) . '[/ajax-response]';
746
die ();
747
}
748
public function yop_poll_load_js() {
749
header( 'Content-Type: text/javascript' );
750
// check_ajax_referer('yop-poll-public-js');
763
}
764
die ();
765
}
766
public function ajax_set_google_vote() {
767
$poll_id = xss_clean(yop_poll_base64_decode( $_GET['poll_id'] ));
768
$unique_id = xss_clean(yop_poll_base64_decode( $_GET['unique_id'] ));
895
$facebook->destroySession();
896
die();
897
}
898
public function ajax_set_wordpress_vote() {
899
$poll_id = yop_poll_base64_decode( xss_clean($_GET['poll_id']) );
900
$unique_id = yop_poll_base64_decode( xss_clean($_GET['unique_id'] ));
951
<?php
952
die();
953
}
954
public function ajax_is_wordpress_user() {
955
global $current_user;
956
if( $current_user->ID > 0 ) {
961
}
962
die();
963
}
964
public function ajax_get_polls_for_editor() {
965
//check_ajax_referer( 'yop-poll-editor' );
966
if( is_admin() ) {
1147
}
1148
die ();
1149
}
1150
public function ajax_get_polls_for_html_editor() {
1151
check_ajax_referer( 'yop-poll-html-editor' );
1152
if( is_admin() ) {
1288
</td>
1289
</tr>
1290
</table>
1291
+
1292
<!--
1293
<p style="text-align: center;">
1294
<label for="yop-poll-id-html-dialog"> <span><?php _e( 'Pollsss to Display', 'yop_poll' ); ?>:</span>
1342
}
1343
die ();
1344
}
1345
public function ajax_preview_add_edit() {
1346
if( is_admin() ) {
1347
if( ! check_ajax_referer( 'yop-poll-add-edit-action', 'yop-poll-add-edit-name', false ) ) {
1351
}
1352
die();
1353
}
1354
function load_editor_functions( $hook ) {
1355
global $post;
1356
1370
}
1371
}
1372
//endregion
1373
// region TINYMCE
1374
function register_button( $buttons ) {
1375
array_push( $buttons, "separator", "yoppoll" );
1376
1377
return $buttons;
1378
}
1379
function add_plugin( $plugin_array ) {
1380
$plugin_array ['yoppoll'] = YOP_POLL_URL . "tinymce/yop-poll-editor.js";
1381
return $plugin_array;
1382
}
1383
function my_yop_poll_button( $hook ) {
1384
if( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'page-new.php' || $hook == 'page.php' ) {
1385
if( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
1399
}
1400
}
1401
public function add_votes(){
1402
if( is_admin() ) {
1403
1404
if( ! check_ajax_referer( 'yop-poll-results_vote_add_vote','yop-poll-results_votes_add_votes', false ) ) {
1432
}
1433
//endregion
1434
}
1435
;
1436
+ ?>
inc/bans_admin.php CHANGED
@@ -26,7 +26,7 @@
26
public function manage_load_bans() {
27
wp_enqueue_script( 'yop-poll-admin-bans-js', YOP_POLL_URL . "js/yop-poll-admin-bans.js", array( 'jquery' ), YOP_POLL_VERSION, true );
28
wp_enqueue_script( 'yop-poll-edit-ban-js', YOP_POLL_URL . "js/yop-poll-edit-ban.js", array( 'jquery' ), YOP_POLL_VERSION, true );
29
- wp_enqueue_script( 'yop-poll-add-edit-ban-js', YOP_POLL_URL . 'js/polls/yop-poll-add-edit.js', array( 'jquery', 'jquery-ui-sortable', 'yop-poll-admin-js' ), YOP_POLL_VERSION, true );
30
wp_enqueue_style( 'yop-poll-global-admin-bans-css', YOP_POLL_URL . "css/yop-poll-admin.css", array(), YOP_POLL_VERSION );
31
wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
32
wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
26
public function manage_load_bans() {
27
wp_enqueue_script( 'yop-poll-admin-bans-js', YOP_POLL_URL . "js/yop-poll-admin-bans.js", array( 'jquery' ), YOP_POLL_VERSION, true );
28
wp_enqueue_script( 'yop-poll-edit-ban-js', YOP_POLL_URL . "js/yop-poll-edit-ban.js", array( 'jquery' ), YOP_POLL_VERSION, true );
29
+ wp_enqueue_script( 'yop-poll-add-edit-ban-js', YOP_POLL_URL . 'js/polls/yop-poll-add-edit.js', array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-dialog', 'yop-poll-admin-js' ), YOP_POLL_VERSION, true );
30
wp_enqueue_style( 'yop-poll-global-admin-bans-css', YOP_POLL_URL . "css/yop-poll-admin.css", array(), YOP_POLL_VERSION );
31
wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
32
wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
inc/maintenance.php CHANGED
@@ -769,6 +769,22 @@ NOWDOC;
769
global $wpdb;
770
update_option("yop_poll_version", '5.7.9');
771
}
772
}
773
774
private static function update_poll_template_in_database2($template)
769
global $wpdb;
770
update_option("yop_poll_version", '5.7.9');
771
}
772
+ if (version_compare($installed_version, '5.7.9', '<=')) {
773
+ global $wpdb;
774
+ update_option("yop_poll_version", '5.8.0');
775
+ }
776
+ if (version_compare($installed_version, '5.8.0', '<=')) {
777
+ global $wpdb;
778
+ update_option("yop_poll_version", '5.8.1');
779
+ }
780
+ if (version_compare($installed_version, '5.8.1', '<=')) {
781
+ global $wpdb;
782
+ update_option("yop_poll_version", '5.8.2');
783
+ }
784
+ if (version_compare($installed_version, '5.8.2', '<=')) {
785
+ global $wpdb;
786
+ update_option("yop_poll_version", '5.8.3');
787
+ }
788
}
789
790
private static function update_poll_template_in_database2($template)
inc/plugin-functions.php CHANGED
@@ -686,7 +686,7 @@ function yop_poll_poll_default_options() {
686
'br' => array()
687
);
688
689
- return wp_kses( $string, $pt );
690
}
691
692
function yop_poll_base64_encode( $str ) {
@@ -794,7 +794,15 @@ function yop_poll_poll_default_options() {
794
global $wpdb;
795
$response['success'] = "";
796
$response['error'] = "";
797
-
798
$sql = $wpdb->query( $wpdb->prepare( "
799
INSERT INTO {$wpdb->yop_poll_results} (
800
poll_id,
@@ -1054,4 +1062,4 @@ function widgets_init(){
1054
add_action( 'widgets_init', function () {
1055
return widget_init();
1056
} );
1057
- }
686
'br' => array()
687
);
688
689
+ return wp_kses( stripslashes($string), $pt );
690
}
691
692
function yop_poll_base64_encode( $str ) {
794
global $wpdb;
795
$response['success'] = "";
796
$response['error'] = "";
797
+ if ( false == isset( $result['tr_id'] ) ) {
798
+ $result['tr_id'] = '';
799
+ }
800
+ if ( false == isset( $result['user_details'] ) ) {
801
+ $result['user_details'] = '';
802
+ }
803
+ if ( false == isset( $result['country'] ) ) {
804
+ $result['country'] = '';
805
+ }
806
$sql = $wpdb->query( $wpdb->prepare( "
807
INSERT INTO {$wpdb->yop_poll_results} (
808
poll_id,
1062
add_action( 'widgets_init', function () {
1063
return widget_init();
1064
} );
1065
+ }
inc/plugin.php CHANGED
@@ -1,58 +1,46 @@
1
<?php
2
-
3
- abstract class Yop_Poll_Plugin{
4
- protected $_config;
5
-
6
- public function __construct( Yop_Poll_Config $config ) {
7
- $this->_config = $config;
8
- $plugin_path = $this->_config->plugin_dir . '/' . $this->_config->languages_dir;
9
- load_plugin_textdomain( 'yop_poll', false, $plugin_path );
10
- $this->init();
11
- }
12
-
13
- abstract protected function init();
14
-
15
- protected function add_action( $action, $function = '', $priority = 10, $accepted_args = 1 ) {
16
- add_action( $action, array( $this, $function == '' ? $action : $function ), $priority, $accepted_args );
17
- }
18
-
19
- protected function remove_action( $action, $function = '', $priority = 10 ) {
20
- remove_action( $action, array( $this, $function == '' ? $action : $function ), $priority );
21
}
22
-
23
- protected function add_filter( $filter, $function, $priority = 10, $accepted_args = 1 ) {
24
- add_filter( $filter, array( $this, $function == '' ? $filter : $function ), $priority, $accepted_args );
25
}
26
-
27
- protected function remove_filter( $filter, $function = '', $priority = 10 ) {
28
- remove_filter( $filter, array( $this, $function == '' ? $filter : $function ), $priority );
29
}
30
-
31
- protected function wp_ajax_action( $function = '', $priv = true, $nopriv = false, $priority = 1 ) {
32
- $request = $this->make_request( $function );
33
- if ( $request ){
34
- if ( $priv ){
35
- add_action( 'wp_ajax_yop_poll_' . $request[1], array( $request[0], $request[1] ), $priority, 1 );
36
- }
37
- if ( $nopriv ){
38
- add_action( 'wp_ajax_nopriv_yop_poll_' . $request[1], array( $request[0], $request[1] ), $priority, 1 );
39
- }
40
- }
41
- }
42
-
43
- private function make_request( $function = '' ) {
44
- $request = array();
45
- if ( '' == $function ){
46
- return false;
47
- }
48
- if ( is_array( $function ) ){
49
- $request[0] = $function[0];
50
- $request[1] = $function[1];
51
- }
52
- if ( is_string( $function ) ){
53
- $request[0] = $this;
54
- $request[1] = $function;
55
- }
56
- return $request;
57
}
58
- }
1
<?php
2
+ abstract class Yop_Poll_Plugin{
3
+ protected $_config;
4
+ public function __construct( Yop_Poll_Config $config ) {
5
+ $this->init();
6
+ }
7
+ abstract protected function init();
8
+ protected function add_action( $action, $function = '', $priority = 10, $accepted_args = 1 ) {
9
+ add_action( $action, array( $this, $function == '' ? $action : $function ), $priority, $accepted_args );
10
+ }
11
+ protected function remove_action( $action, $function = '', $priority = 10 ) {
12
+ remove_action( $action, array( $this, $function == '' ? $action : $function ), $priority );
13
+ }
14
+ protected function add_filter( $filter, $function, $priority = 10, $accepted_args = 1 ) {
15
+ add_filter( $filter, array( $this, $function == '' ? $filter : $function ), $priority, $accepted_args );
16
+ }
17
+ protected function remove_filter( $filter, $function = '', $priority = 10 ) {
18
+ remove_filter( $filter, array( $this, $function == '' ? $filter : $function ), $priority );
19
+ }
20
+ protected function wp_ajax_action( $function = '', $priv = true, $nopriv = false, $priority = 1 ) {
21
+ $request = $this->make_request( $function );
22
+ if ( $request ){
23
+ if ( $priv ){
24
+ add_action( 'wp_ajax_yop_poll_' . $request[1], array( $request[0], $request[1] ), $priority, 1 );
25
+ }
26
+ if ( $nopriv ){
27
+ add_action( 'wp_ajax_nopriv_yop_poll_' . $request[1], array( $request[0], $request[1] ), $priority, 1 );
28
+ }
29
}
30
+ }
31
+ private function make_request( $function = '' ) {
32
+ $request = array();
33
+ if ( '' == $function ){
34
+ return false;
35
}
36
+ if ( is_array( $function ) ){
37
+ $request[0] = $function[0];
38
+ $request[1] = $function[1];
39
}
40
+ if ( is_string( $function ) ){
41
+ $request[0] = $this;
42
+ $request[1] = $function;
43
}
44
+ return $request;
45
+ }
46
+ }
inc/poll_admin.php CHANGED
@@ -2138,7 +2138,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
2138
$index=0;
2139
$i=0;
2140
$message['append_row']="";
2141
- $append_row="";
2142
while($ok==1){
2143
2144
// yop_poll_dump($answer_details);
@@ -2213,6 +2213,9 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
2213
$message = insert_result_in_db( $result );
2214
2215
$index++;
2216
$append_row[$i].= " <tr valign=".'middle'." class=".
2217
'alternate'."
2218
id=".'yop-poll-log{{log.id}}'.">
@@ -2275,6 +2278,9 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
2275
}
2276
2277
//yop_poll_dump($append_row);
2278
foreach($append_row as $a){
2279
$message['append_row'].=$a;
2280
}
2138
$index=0;
2139
$i=0;
2140
$message['append_row']="";
2141
+ $append_row = array();
2142
while($ok==1){
2143
2144
// yop_poll_dump($answer_details);
2213
$message = insert_result_in_db( $result );
2214
2215
$index++;
2216
+ if ( false === isset( $append_row[$i] ) ) {
2217
+ $append_row[$i] = '';
2218
+ }
2219
$append_row[$i].= " <tr valign=".'middle'." class=".
2220
'alternate'."
2221
id=".'yop-poll-log{{log.id}}'.">
2278
}
2279
2280
//yop_poll_dump($append_row);
2281
+ if ( false === isset( $message['append_row'] ) ) {
2282
+ $message['append_row'] = '';
2283
+ }
2284
foreach($append_row as $a){
2285
$message['append_row'].=$a;
2286
}
inc/public-admin.php CHANGED
@@ -68,7 +68,7 @@
68
*
69
*/
70
public function load_translation_file() {
71
- $plugin_path = $this->_config->plugin_dir . '/' . $this->_config->languages_dir;
72
load_plugin_textdomain( 'yop_poll', false, $plugin_path );
73
}
74
@@ -102,7 +102,7 @@
102
103
public function yop_poll_archive_shortcode_function( $atts, $content = null ) {
104
extract( shortcode_atts( array( 'results' => 0 ), $atts ) );
105
- $template = '';
106
$yop_poll_page = 1;
107
$big = 99999;
108
if( isset( $_REQUEST['yop_poll_page'] ) ) {
@@ -136,14 +136,14 @@
136
if( count( $archives ) > 0 ) {
137
foreach( $archives as $poll ){
138
139
- $template [] = $this->return_yop_poll( $poll['ID'], $results );
140
}
141
}
142
}else{
143
if( count( $archives ) > 0 ) {
144
foreach( $archives as $poll ){
145
146
- $template [] = $this->return_yop_poll( $poll, $results );
147
}
148
}
149
}
@@ -158,10 +158,17 @@
158
$per_page = count( $archive );
159
}
160
161
-
162
$args = array(
163
- 'base' => remove_query_arg( 'yop_poll_page', $_SERVER['REQUEST_URI'] ) . '%_%',
164
- 'format' => '&yop_poll_page=%#%',
165
'total' => $total_per_page,
166
'current' => max( 1, $yop_poll_page ),
167
'prev_next' => true,
68
*
69
*/
70
public function load_translation_file() {
71
+ $plugin_path = YOP_POLL_PLUGIN_DIR . '/languages';
72
load_plugin_textdomain( 'yop_poll', false, $plugin_path );
73
}
74
102
103
public function yop_poll_archive_shortcode_function( $atts, $content = null ) {
104
extract( shortcode_atts( array( 'results' => 0 ), $atts ) );
105
+ $template = array();
106
$yop_poll_page = 1;
107
$big = 99999;
108
if( isset( $_REQUEST['yop_poll_page'] ) ) {
136
if( count( $archives ) > 0 ) {
137
foreach( $archives as $poll ){
138
139
+ $template[] = $this->return_yop_poll( $poll['ID'], $results );
140
}
141
}
142
}else{
143
if( count( $archives ) > 0 ) {
144
foreach( $archives as $poll ){
145
146
+ $template[] = $this->return_yop_poll( $poll, $results );
147
}
148
}
149
}
158
$per_page = count( $archive );
159
}
160
161
+ $query_arg = remove_query_arg( 'yop_poll_page', $_SERVER['REQUEST_URI'] );
162
+ $query_url = parse_url($query_arg, PHP_URL_QUERY);
163
+ if( isset($query_url) && ($query_url != "")) {
164
+ $query_char = "&";
165
+ }
166
+ else {
167
+ $query_char = "?";
168
+ }
169
$args = array(
170
+ 'base' => $query_arg . '%_%',
171
+ 'format' => $query_char . 'yop_poll_page=%#%',
172
'total' => $total_per_page,
173
'current' => max( 1, $yop_poll_page ),
174
'prev_next' => true,
inc/widget.php CHANGED
@@ -39,8 +39,8 @@
39
wp_enqueue_script( 'yop-poll-jquery-popup-windows', YOP_POLL_URL . "js/jquery.popupWindow.js", array( 'jquery' ), YOP_POLL_VERSION, true );
40
wp_enqueue_style( 'yop-poll-public', YOP_POLL_URL . "css/yop-poll-public.css", array(), YOP_POLL_VERSION );
41
wp_enqueue_script( 'yop-poll-widget-user-defined_' . $poll_id . $poll_unique_id, add_query_arg( array( 'id' => $poll_id, 'location' => 'widget', 'unique_id' => $poll_unique_id ), admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_load_js' ), array( 'jquery' ), YOP_POLL_VERSION, true );
42
- wp_enqueue_script( 'yop-poll-public', YOP_POLL_URL . 'js/yop-poll-public.js', array(), YOP_POLL_VERSION, true );
43
- wp_enqueue_script( 'yop-poll-json2', YOP_POLL_URL . "js/yop-poll-json2.js", array(), YOP_POLL_VERSION, true );
44
wp_enqueue_script( 'yop-poll-jquery-base64', YOP_POLL_URL . "js/yop-poll-jquery.base64.min.js", array(), YOP_POLL_VERSION, true );
45
46
$yop_poll_public_config_general = array(
@@ -97,8 +97,8 @@
97
'loading_image_alt' => __( 'Loading', 'yop_poll' ),
98
99
);
100
- wp_localize_script( 'yop-poll-public', 'yop_poll_public_config_general', $yop_poll_public_config_general );
101
- wp_localize_script( 'yop-poll-public', 'yop_poll_public_config_' . $poll_id . $poll_unique_id, $yop_poll_public_config );
102
103
echo $before_widget;
104
echo $before_title . $title . $after_title;
@@ -168,4 +168,4 @@
168
<input type = "hidden" id = "<?php echo $this->get_field_id( 'doSave' ); ?>" name = "<?php echo $this->get_field_name( 'doSave' ); ?>" value = "yes"/>
169
<?php
170
}
171
- }
39
wp_enqueue_script( 'yop-poll-jquery-popup-windows', YOP_POLL_URL . "js/jquery.popupWindow.js", array( 'jquery' ), YOP_POLL_VERSION, true );
40
wp_enqueue_style( 'yop-poll-public', YOP_POLL_URL . "css/yop-poll-public.css", array(), YOP_POLL_VERSION );
41
wp_enqueue_script( 'yop-poll-widget-user-defined_' . $poll_id . $poll_unique_id, add_query_arg( array( 'id' => $poll_id, 'location' => 'widget', 'unique_id' => $poll_unique_id ), admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) . '?action=yop_poll_load_js' ), array( 'jquery' ), YOP_POLL_VERSION, true );
42
+ wp_enqueue_script( 'yop-poll-public-js', YOP_POLL_URL . 'js/yop-poll-public.js', array(), YOP_POLL_VERSION, true );
43
+ wp_enqueue_script( 'yop-poll-json-2', YOP_POLL_URL . "js/yop-poll-json2.js", array(), YOP_POLL_VERSION, true );
44
wp_enqueue_script( 'yop-poll-jquery-base64', YOP_POLL_URL . "js/yop-poll-jquery.base64.min.js", array(), YOP_POLL_VERSION, true );
45
46
$yop_poll_public_config_general = array(
97
'loading_image_alt' => __( 'Loading', 'yop_poll' ),
98
99
);
100
+ wp_localize_script( 'yop-poll-public-js', 'yop_poll_public_config_general', $yop_poll_public_config_general );
101
+ wp_localize_script( 'yop-poll-public-js', 'yop_poll_public_config_' . $poll_id . $poll_unique_id, $yop_poll_public_config );
102
103
echo $before_widget;
104
echo $before_title . $title . $after_title;
168
<input type = "hidden" id = "<?php echo $this->get_field_id( 'doSave' ); ?>" name = "<?php echo $this->get_field_name( 'doSave' ); ?>" value = "yes"/>
169
<?php
170
}
171
+ }
js/yop-poll-facebook..js DELETED
@@ -1 +0,0 @@
1
- jQuery( '<div></div>', {
2
id: 'fb-root'
3
FB.init( {
4
appId: yop_poll_fb_appID,
5
status: true,
6
xfbml: true
7
} );
8
var js, fjs = d.getElementsByTagName( s )[0];
9
if ( d.getElementById( id ) ) {return;}
10
js = d.createElement( s );
11
js.id = id;
12
js.src = "//connect.facebook.net/en_US/all.js";
13
fjs.parentNode.insertBefore( js, fjs );
0
id: 'fb-root'
1
FB.init( {
2
appId: yop_poll_fb_appID,
3
status: true,
4
xfbml: true
5
} );
6
var js, fjs = d.getElementsByTagName( s )[0];
7
if ( d.getElementById( id ) ) {return;}
8
js = d.createElement( s );
9
js.id = id;
10
js.src = "//connect.facebook.net/en_US/all.js";
11
fjs.parentNode.insertBefore( js, fjs );
js/yop-poll-public.js CHANGED
@@ -30,7 +30,6 @@ jQuery(document).ready(function(){
30
},
31
32
success: function( data ) {
33
-
34
data = yop_poll_extractApiResponse( data );
35
36
data = data.split( ';' );
@@ -910,4 +909,4 @@ function yop_poll_set_super_cookie(cookie) {
910
d.setTime( d.getTime() + (3600 * 1000 * 24 * 365) );
911
var expires = "expires=" + d.toGMTString();
912
superCookie.setItem( cookie, "num_votes=" + (parseInt( votes[0] ) + 1) + ";" + expires )
913
- }
30
},
31
32
success: function( data ) {
33
data = yop_poll_extractApiResponse( data );
34
35
data = data.split( ';' );
909
d.setTime( d.getTime() + (3600 * 1000 * 24 * 365) );
910
var expires = "expires=" + d.toGMTString();
911
superCookie.setItem( cookie, "num_votes=" + (parseInt( votes[0] ) + 1) + ";" + expires )
912
+ }
models/abstract_model.php CHANGED
@@ -793,6 +793,9 @@ abstract class YOP_POLL_Abstract_Model
793
{
794
795
$poll_options = get_yop_poll_meta($this->ID, 'options', true);
796
797
if ($this->options && count($this->options) > 0) {
798
@@ -1334,7 +1337,9 @@ abstract class YOP_POLL_Abstract_Model
1334
}
1335
1336
$ip = yop_poll_get_ip();
1337
-
1338
$sql = $wpdb->prepare("
1339
1340
SELECT id
793
{
794
795
$poll_options = get_yop_poll_meta($this->ID, 'options', true);
796
+ if ( ( false == $poll_options ) || ( '' == $poll_options ) ) {
797
+ $poll_options = array();
798
+ }
799
800
if ($this->options && count($this->options) > 0) {
801
1337
}
1338
1339
$ip = yop_poll_get_ip();
1340
+ if ( false === isset( $id ) ) {
1341
+ $id = '';
1342
+ }
1343
$sql = $wpdb->prepare("
1344
1345
SELECT id
models/answer_model.php CHANGED
@@ -406,6 +406,9 @@
406
function save_options() {
407
408
$answer_options = get_yop_poll_answer_meta( $this->id, 'options', true );
409
410
if ( $this->options && count( $this->options ) > 0 ){
411
406
function save_options() {
407
408
$answer_options = get_yop_poll_answer_meta( $this->id, 'options', true );
409
+ if ( ( false == $answer_options ) || ( '' == $answer_options ) ) {
410
+ $answer_options = array();
411
+ }
412
413
if ( $this->options && count( $this->options ) > 0 ){
414
models/custom_field_model.php CHANGED
@@ -92,7 +92,7 @@
92
}
93
94
wp_cache_add( $custom_field->ID, $custom_field, 'yop_poll_custom_field' );
95
- return $custom_field;
96
}
97
98
function __isset( $key ) {
@@ -183,12 +183,14 @@
183
}
184
185
function __set( $key, $value ) {
186
if ( 'id' == strtolower( $key ) ){
187
$this->ID = $value;
188
$this->data->ID = $value;
189
return;
190
}
191
-
192
if ( in_array( $key, $this->default_fields ) ){ //this is not an option
193
$this->data->$key = $value;
194
}
@@ -220,6 +222,7 @@
220
}
221
222
function insert() {
223
$GLOBALS['wpdb']->insert(
224
$GLOBALS['wpdb']->yop_poll_custom_fields,
225
array(
@@ -240,6 +243,7 @@
240
}
241
242
function update() {
243
$GLOBALS['wpdb']->update(
244
$GLOBALS['wpdb']->yop_poll_custom_fields,
245
array(
@@ -265,4 +269,4 @@
265
wp_cache_delete( $this->ID, 'yop_poll_custom_field' );
266
$this->_unset();
267
}
268
- }
92
}
93
94
wp_cache_add( $custom_field->ID, $custom_field, 'yop_poll_custom_field' );
95
+ return stripslashes_deep($custom_field);
96
}
97
98
function __isset( $key ) {
183
}
184
185
function __set( $key, $value ) {
186
+ if ( false === is_object( $this->data ) ) {
187
+ $this->data = new \stdClass();
188
+ }
189
if ( 'id' == strtolower( $key ) ){
190
$this->ID = $value;
191
$this->data->ID = $value;
192
return;
193
}
194
if ( in_array( $key, $this->default_fields ) ){ //this is not an option
195
$this->data->$key = $value;
196
}
222
}
223
224
function insert() {
225
+ $this->custom_field = sanitize_text_field( $this->custom_field );
226
$GLOBALS['wpdb']->insert(
227
$GLOBALS['wpdb']->yop_poll_custom_fields,
228
array(
243
}
244
245
function update() {
246
+ $this->custom_field = sanitize_text_field( $this->custom_field );
247
$GLOBALS['wpdb']->update(
248
$GLOBALS['wpdb']->yop_poll_custom_fields,
249
array(
269
wp_cache_delete( $this->ID, 'yop_poll_custom_field' );
270
$this->_unset();
271
}
272
+ }
models/poll_model.php CHANGED
@@ -654,7 +654,6 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
654
$percentages_decimals = $this->percentages_decimals;
655
}
656
if (isset($this->sorting_results)) {
657
- error_log('maybe here');
658
if ('as_defined' == $this->sorting_results) {
659
$question->sortAnswers('question_order', 'asc');
660
} elseif ('database' == $this->sorting_results) {
@@ -740,6 +739,10 @@ Class YOP_POLL_Poll_Model extends YOP_POLL_Abstract_Model
740
$vote_type = $request['vote_type'];
741
$SuperCookie = strip_tags(xss_clean($request['supercookie']));
742
$tr_id = strip_tags(xss_clean($request['yop_poll_tr_id']));
743
$votes = 0;
744
$user_id = 0;
745
$user_type = 'default';
654
$percentages_decimals = $this->percentages_decimals;
655
}
656
if (isset($this->sorting_results)) {
657
if ('as_defined' == $this->sorting_results) {
658
$question->sortAnswers('question_order', 'asc');
659
} elseif ('database' == $this->sorting_results) {
739
$vote_type = $request['vote_type'];
740
$SuperCookie = strip_tags(xss_clean($request['supercookie']));
741
$tr_id = strip_tags(xss_clean($request['yop_poll_tr_id']));
742
+ $facebook_user_details = null;
743
+ $google_user_details = null;
744
+
745
+
746
$votes = 0;
747
$user_id = 0;
748
$user_type = 'default';
models/question_model.php CHANGED
@@ -429,6 +429,9 @@
429
private function save_options() {
430
431
$question_options = get_yop_poll_question_meta( $this->ID, 'options', true );
432
433
if ( $this->options && count( $this->options ) > 0 ){
434
@@ -446,7 +449,7 @@
446
}
447
448
private function insert() {
449
-
450
$GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
451
INSERT INTO " . $GLOBALS['wpdb']->yop_poll_questions . "
452
SET
@@ -486,6 +489,7 @@
486
}
487
488
private function update() {
489
$GLOBALS['wpdb']->query(
490
$GLOBALS['wpdb']->prepare( "
491
UPDATE " . $GLOBALS['wpdb']->yop_poll_questions . "
429
private function save_options() {
430
431
$question_options = get_yop_poll_question_meta( $this->ID, 'options', true );
432
+ if ( ( false == $question_options ) || ( '' == $question_options ) ) {
433
+ $question_options = array();
434
+ }
435
436
if ( $this->options && count( $this->options ) > 0 ){
437
449
}
450
451
private function insert() {
452
+ $this->question = sanitize_text_field( $this->question );
453
$GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
454
INSERT INTO " . $GLOBALS['wpdb']->yop_poll_questions . "
455
SET
489
}
490
491
private function update() {
492
+ $this->question = sanitize_text_field( $this->question );
493
$GLOBALS['wpdb']->query(
494
$GLOBALS['wpdb']->prepare( "
495
UPDATE " . $GLOBALS['wpdb']->yop_poll_questions . "
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: yourownprogrammer
3
Donate Link: http://www.yop-poll.com
4
Tags: booth, create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop
5
Requires at least: 3.3
6
- Tested up to: 4.5
7
Stable tag: trunk
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.htm
@@ -142,6 +142,23 @@ You can have only one question per poll. If you want to ask more than one questi
142
143
== Changelog ==
144
145
= 5.7.9 =
146
* start date and end date easier to read on the front end
147
* Fixed issue with showing results before vote
3
Donate Link: http://www.yop-poll.com
4
Tags: booth, create poll, poll plugin, poll, polls, wordpress poll, vote, voting, survey, polling, yop poll, yop
5
Requires at least: 3.3
6
+ Tested up to: 4.9
7
Stable tag: trunk
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.htm
142
143
== Changelog ==
144
145
+ = 5.8.3 =
146
+ * fixed php7 issues
147
+
148
+ = 5.8.2 =
149
+ * fixed issue with notices showing up on front pages
150
+
151
+ = 5.8.1 =
152
+ * fixed security issue
153
+ * fixed issue with multisite
154
+ * compatibility with wordpress 4.7.2
155
+
156
+ = 5.8.0 =
157
+ * compatibility with wordpress 4.5.2
158
+ * fixed issue with navigation links on archive page
159
+ * fixed loading issue
160
+ * fixed issue with custom fields
161
+
162
= 5.7.9 =
163
* start date and end date easier to read on the front end
164
* Fixed issue with showing results before vote
yop_poll.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin Name: YOP Poll
5
* Plugin URI: http://yop-poll.com
6
* Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use poll plugin for your WordPress website.
7
- * Version: 5.7.9
8
* Author: yourownprogrammer
9
* Author URI: http://yop-poll.com
10
* License: GPLv2 or later
@@ -15,7 +15,7 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
15
16
define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
17
define ( 'YOP_POLL_WP_VERSION', '3.3' );
18
- define ( 'YOP_POLL_VERSION', '5.7.9' );
19
define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
20
define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
21
define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
@@ -83,7 +83,7 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
83
84
if( is_admin() ) {
85
if( YOP_POLL_DEBUG ) {
86
- error_reporting( E_ALL ^ E_NOTICE );
87
}
88
else {
89
error_reporting( 0 );
4
* Plugin Name: YOP Poll
5
* Plugin URI: http://yop-poll.com
6
* Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use poll plugin for your WordPress website.
7
+ * Version: 5.8.3
8
* Author: yourownprogrammer
9
* Author URI: http://yop-poll.com
10
* License: GPLv2 or later
15
16
define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
17
define ( 'YOP_POLL_WP_VERSION', '3.3' );
18
+ define ( 'YOP_POLL_VERSION', '5.8.3' );
19
define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
20
define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
21
define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
83
84
if( is_admin() ) {
85
if( YOP_POLL_DEBUG ) {
86
+ error_reporting( E_ALL );
87
}
88
else {
89
error_reporting( 0 );