PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.5.1
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.5.1
6.5.1 6.5.0 6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 All 154 releases
← All changes | includes/lists/class-poll-maker-polls-list-table.php +162 -76 5.6.3 → 6.5.1 View file →
@@ -9,10 +9,10 @@
9 9 public function __construct( $plugin_name ) {
10 10 $this->plugin_name = $plugin_name;
11 11 $this->title_length = Poll_Maker_Ays_Admin::get_listtables_title_length('polls');
12 12 parent::__construct(array(
13 - 'singular' => __('Poll', "poll-maker"), //singular name of the listed records
14 - 'plural' => __('Polls', "poll-maker"), //plural name of the listed records
13 + 'singular' =>esc_html__('Poll', "poll-maker"), //singular name of the listed records
14 + 'plural' =>esc_html__('Polls', "poll-maker"), //plural name of the listed records
15 15 'ajax' => false, //does this table support ajax?
16 16 ));
17 17 add_action('admin_notices', array($this, 'poll_notices'));
18 18 add_filter( 'default_hidden_columns', array( $this, 'get_hidden_columns'), 10, 2 );
@@ -104,9 +104,9 @@
104 104
105 105 ?>
106 106 <div id="poll-filter-div-<?php echo esc_attr( $which ); ?>" class="alignleft actions bulkactions">
107 107 <select name="filterby-<?php echo esc_attr($which); ?>" id="bulk-action-selector-<?php echo esc_attr($which); ?>">
108 - <option value=""><?php echo __('Select Category', "poll-maker")?></option>
108 + <option value=""><?php echo esc_html__('Select Category', "poll-maker")?></option>
109 109 <?php
110 110 foreach($categories_select as $key => $cat_title){
111 111 echo "<option ".$cat_title['selected']." value='".$cat_title['id']."'>".$cat_title['title']."</option>";
112 112 }
@@ -112,9 +112,9 @@
112 112 }
113 113 ?>
114 114 </select>
115 115 <select name="filterbyauthor-<?php echo esc_attr( $which ); ?>" id="bulk-action-selector-<?php echo esc_attr( $which ); ?>">
116 - <option value=""><?php echo __('Select Author', "poll-maker")?></option>
116 + <option value=""><?php echo esc_html__('Select Author', "poll-maker")?></option>
117 117 <?php
118 118 foreach ($authors as $author_key => $author) {
119 119 $user_selected = ( isset($author_id_select) && $author_key == $author_id_select ) ? "selected" : "";
120 120
@@ -122,9 +122,9 @@
122 122 }
123 123 ?>
124 124 </select>
125 125 <select name="filterbytype-<?php echo esc_attr( $which ); ?>" id="bulk-action-selector-<?php echo esc_attr( $which ); ?>">
126 - <option value=""><?php echo __('Select Type', "poll-maker")?></option>
126 + <option value=""><?php echo esc_html__('Select Type', "poll-maker"); ?></option>
127 127 <?php
128 128 foreach( $types as $type_key => $type){
129 129 $user_selected_type = ( isset($type_select) && $type == $type_select ) ? "selected" : "";
130 130 echo "<option ".$user_selected_type." value='".$type."'>".$type."</option>";
@@ -130,11 +130,11 @@
130 130 echo "<option ".$user_selected_type." value='".$type."'>".$type."</option>";
131 131 }
132 132 ?>
133 133 </select>
134 - <input type="button" id="doaction-<?php echo esc_attr($which); ?>" class="ays-poll-question-tab-all-filter-button-<?php echo esc_attr($which); ?> button" value="Filter">
134 + <input type="button" id="doaction-<?php echo esc_attr($which); ?>" class="ays-poll-question-tab-all-filter-button-<?php echo esc_attr($which); ?> button" value="<?php echo esc_attr__('Filter', "poll-maker"); ?>">
135 135 </div>
136 - <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>" class="button actions_style"><?php echo __( "Clear filters", "poll-maker" ); ?></a>
136 + <a href="?page=<?php echo esc_attr( $_REQUEST['page'] ); ?>" class="button actions_style"><?php echo esc_html__( "Clear filters", "poll-maker" ); ?></a>
137 137 <?php
138 138 }
139 139
140 140 protected function get_views() {
@@ -170,11 +170,11 @@
170 170 $publish_url = esc_url( add_query_arg('fstatus', 1, $status_links_url) );
171 171 $unpublish_url = esc_url( add_query_arg('fstatus', 0, $status_links_url) );
172 172
173 173 $status_links = array(
174 - "all" => "<a ".$selected_all." href='?page=".esc_attr( $_REQUEST['page'] )."'>". __( 'All', "poll-maker" )." (".$all_count.")</a>",
175 - "published" => "<a ".$selected_1." href='". $publish_url ."'>". __( 'Published', "poll-maker" )." (".$published_count.")</a>",
176 - "unpublished" => "<a ".$selected_0." href='". $unpublish_url ."'>". __( 'Unpublished', "poll-maker" )." (".$unpublished_count.")</a>"
174 + "all" => "<a ".$selected_all." href='?page=".esc_attr( $_REQUEST['page'] )."'>".esc_html__( 'All', "poll-maker" )." (".$all_count.")</a>",
175 + "published" => "<a ".$selected_1." href='". $publish_url ."'>".esc_html__( 'Published', "poll-maker" )." (".$published_count.")</a>",
176 + "unpublished" => "<a ".$selected_0." href='". $unpublish_url ."'>".esc_html__( 'Unpublished', "poll-maker" )." (".$unpublished_count.")</a>"
177 177 );
178 178 return $status_links;
179 179 }
180 180
@@ -225,27 +225,35 @@
225 225 global $wpdb;
226 226 $poll_table = esc_sql($wpdb->prefix . 'ayspoll_polls');
227 227 $answer_table = esc_sql($wpdb->prefix . 'ayspoll_answers');
228 228 if (isset($data["poll_action"]) && wp_verify_nonce($data["poll_action"], 'poll_action')) {
229 +
230 + $poll_allowed_html = Poll_Maker_Data::ays_poll_custom_allowed_html();
231 +
229 232 $title = isset($data['ays-poll-title']) && $data['ays-poll-title'] != "" ? sanitize_text_field($data['ays-poll-title']) : "Default title";
230 233 $show_title = isset($data['show_title']) && $data['show_title'] == 'show' ? 1 : 0;
231 234 $limit_users = isset($data['apm_limit_users']) && $data['apm_limit_users'] == 'on' ? 1 : 0;
232 235 $limit_users_method = isset($data['ays_limit_method']) ? sanitize_text_field($data['ays_limit_method']) : 'ip';
233 - $limit_users_msg = isset($data['ays_limitation_message']) ? wpautop($data['ays_limitation_message']) : "";
236 + $limit_users_msg = isset($data['ays_limitation_message']) ? wp_kses( $data['ays_limitation_message'], $poll_allowed_html ) : "";
234 237 $limit_users_url = isset($data['ays_redirect_url']) ? wp_http_validate_url($data['ays_redirect_url']) : "";
235 238 $limit_users_delay = isset($data['ays_redirection_delay']) ? absint($data['ays_redirection_delay']) : 0;
236 239 $limit_users_role_enable = isset($data['ays_enable_restriction_pass']) && $data['ays_enable_restriction_pass'] == 'on' ? 1 : 0;
237 240 $limit_users_role = (isset($data["ays_users_roles"]) && !empty($data["ays_users_roles"])) ? $data["ays_users_roles"] : array();
238 - $limit_users_role_msg = isset($data['restriction_pass_message']) ? wpautop($data['restriction_pass_message']) : "";
241 + $limit_users_role_msg = isset($data['restriction_pass_message']) ? wp_kses( $data['restriction_pass_message'], $poll_allowed_html ) : "";
242 +
239 243 $limit_users_logged_enable = (isset($data['ays_enable_logged_users']) && $data['ays_enable_logged_users'] == 'on') || $limit_users_role_enable ? 1 : 0;
240 - $limit_users_logged_msg = isset($data['ays_enable_logged_users_message']) ? wpautop($data['ays_enable_logged_users_message']) : "";
244 + $limit_users_logged_msg = isset($data['ays_enable_logged_users_message']) ? wp_kses( $data['ays_enable_logged_users_message'], $poll_allowed_html ) : "";
245 +
241 246 $hide_results = isset($data['ays-poll-hide-results']) && 'hide' == $data['ays-poll-hide-results'] ? 1 : 0;
242 247 $hide_result_message = isset($data['ays_poll_result_message']) && 'hide' == $data['ays_poll_result_message'] ? 1 : 0;
243 - $hide_results_text = stripcslashes($data['ays-poll-hide-results-text']);
244 - $ays_result_message = wp_kses_post(stripcslashes($data['ays_result_message']));
248 +
249 + $hide_results_text = isset( $data['ays-poll-hide-results-text'] ) && $data['ays-poll-hide-results-text'] != '' ? wp_kses( $data['ays-poll-hide-results-text'], $poll_allowed_html ) : '';
250 +
251 + $ays_result_message = isset( $data['ays_result_message'] ) && $data['ays_result_message'] != '' ? wp_kses( $data['ays_result_message'], $poll_allowed_html ) : '';
252 +
245 253 $allow_not_vote = isset($data['ays-poll-allow-not-vote']) && 'allow' == $data['ays-poll-allow-not-vote'] ? 1 : 0;
246 254 $show_social = isset($data['ays-poll-show-social']) && 'show' == $data['ays-poll-show-social'] ? 1 : 0;
247 - $poll_social_buttons_heading = ( isset( $data[ 'ays_poll_social_buttons_heading' ] ) && $data[ 'ays_poll_social_buttons_heading' ] != '' ) ? stripslashes(wp_kses_post($data[ 'ays_poll_social_buttons_heading' ])) : '';
255 + $poll_social_buttons_heading = ( isset( $data[ 'ays_poll_social_buttons_heading' ] ) && $data[ 'ays_poll_social_buttons_heading' ] != '' ) ? wp_kses( $data['ays_poll_social_buttons_heading'], $poll_allowed_html ) : '';
248 256 $poll_show_social_ln = isset($data['ays_poll_enable_linkedin_share_button']) && $data['ays_poll_enable_linkedin_share_button'] == "on" ? "on" : "off";
249 257 $poll_show_social_fb = isset($data['ays_poll_enable_facebook_share_button']) && $data['ays_poll_enable_facebook_share_button'] == "on" ? "on" : "off";
250 258 $poll_show_social_tr = isset($data['ays_poll_enable_twitter_share_button']) && $data['ays_poll_enable_twitter_share_button'] == "on" ? "on" : "off";
251 259 $poll_show_social_vk = isset($data['ays_poll_enable_vkontakte_share_button']) && $data['ays_poll_enable_vkontakte_share_button'] == "on" ? "on" : "off";
@@ -251,16 +259,13 @@
251 259 $poll_show_social_vk = isset($data['ays_poll_enable_vkontakte_share_button']) && $data['ays_poll_enable_vkontakte_share_button'] == "on" ? "on" : "off";
252 260 $categories = isset($data['ays-poll-categories']) ? ',' . implode(',', $data['ays-poll-categories']) . ',' : ',1,';
253 261 $description = isset($data['ays-poll-description']) && $data['ays-poll-description'] != '' ? sanitize_textarea_field($data['ays-poll-description']) : "";
254 262 $type = isset($data['ays-poll-type']) ? sanitize_text_field($data['ays-poll-type']) : "";
255 - $question = wp_kses_post(stripcslashes($data['ays_poll_question']));
263 +
264 + $question = isset( $data['ays_poll_question'] ) && $data['ays_poll_question'] != '' ? wp_kses( $data['ays_poll_question'], $poll_allowed_html ) : '';
265 +
256 266 $image = isset($data['ays_poll_image']) && $data['ays_poll_image'] != '' ? sanitize_url($data['ays_poll_image']): '';
257 - // if ($image != '') {
258 - // if ( !(filter_var($image, FILTER_VALIDATE_URL) && wp_http_validate_url($image)) ) {
259 - // // invalid URL, handle accordingly
260 - // $image = '';
261 - // }
262 - // }
267 +
263 268 if( $image != "" ){
264 269 $check_if_current_image_exists = Poll_Maker_Ays_Admin::ays_poll_check_if_current_image_exists($image);
265 270
266 271 if( !$check_if_current_image_exists ){
@@ -341,10 +346,11 @@
341 346 $deactiveInterval_fullArr = explode(" ",$deactiveInterval_full);
342 347 $deactiveInterval = isset($deactiveInterval_fullArr[0]) ? $deactiveInterval_fullArr[0] : "";
343 348 $deactiveIntervalSec = isset($deactiveInterval_fullArr[1]) ? $deactiveInterval_fullArr[1] : "";
344 349
345 - $active_date_message = wpautop($data['active_date_message']);
346 - $active_date_message_soon = wpautop($data['active_date_message_soon']);
350 + $active_date_message = isset( $data['active_date_message'] ) && $data['active_date_message'] != '' ? wp_kses( $data['active_date_message'], $poll_allowed_html ) : '';
351 + $active_date_message_soon = isset( $data['active_date_message_soon'] ) && $data['active_date_message_soon'] != '' ? wp_kses( $data['active_date_message_soon'], $poll_allowed_html ) : '';
352 +
347 353 $css = stripcslashes($data['ays_custom_css']);
348 354 $active_date_check = isset($data['active_date_check']) && !empty($data['active_date_check']) ? $data['active_date_check'] : '';
349 355 $enable_restart_button = isset($data['ays_enable_restart_button']) && 'on' == $data['ays_enable_restart_button'] ? 1 : 0;
350 356 $enable_vote_btn = isset($data['ays_enable_vote_button']) && 1 == $data['ays_enable_vote_button'] ? 1 : 0;
@@ -359,9 +365,9 @@
359 365 $ays_show_result_btn_see = isset($data['ays_poll_show_result_btn_see_schedule']) && !empty($data['ays_poll_show_result_btn_see_schedule']) ? $data['ays_poll_show_result_btn_see_schedule'] : 'with_see';
360 366 $info_form = isset($data['ays_poll_info_form']) && 'on' == $data['ays_poll_info_form'] ? 1 : 0;
361 367 $form_fields = isset($data['ays-poll-form-fields']) ? sanitize_text_field(implode(',', $data['ays-poll-form-fields'])) : "";
362 368 $form_required_fields = isset($data['ays-poll-form-required-fields']) ? sanitize_text_field(implode(',', $data['ays-poll-form-required-fields'])) : "";
363 - $info_form_title = isset($data['ays-poll-info-form-text']) ? wpautop(wp_kses_post(stripslashes($data['ays-poll-info-form-text']))) : "";
369 + $info_form_title = isset($data['ays-poll-info-form-text']) ? wp_kses( $data['ays-poll-info-form-text'], $poll_allowed_html ) : "";
364 370 $title_bg_color = sanitize_text_field($data['ays_poll_title_bg_color']);
365 371
366 372 // Poll main URL
367 373 $poll_main_url = (isset( $_POST['ays_poll_main_url'] ) && $_POST['ays_poll_main_url'] != '') ? wp_kses_post( $_POST['ays_poll_main_url'] ) : '';
@@ -445,8 +451,14 @@
445 451
446 452 // Poll schedule container on/off
447 453 $poll_show_container = (isset($data['ays_show_poll_container']) && $data['ays_show_poll_container'] == 'on') ? 'on' : 'off';
448 454
455 + // Show votes count per answers before voting
456 + $show_votes_before_voting = (isset($data['ays_show_votes_before_voting']) && $data['ays_show_votes_before_voting'] == 'on') ? 'on' : 'off';
457 + $show_votes_before_voting_by = (isset($data['ays_show_votes_before_voting_by']) && $data['ays_show_votes_before_voting_by'] != '') ? $data['ays_show_votes_before_voting_by'] : 'by_count';
458 +
459 +
460 +
449 461 // Poll see results button in limitations
450 462 $poll_see_result_button = (isset($data['ays_see_result_show']) && $data['ays_see_result_show'] == 'on') ? 'on' : 'off';
451 463 $poll_see_result_radio = (isset($data['ays_poll_see_result_show']) && $data['ays_poll_see_result_show'] != '') ? sanitize_text_field($data['ays_poll_see_result_show']) : '';
452 464
@@ -539,9 +551,11 @@
539 551 $poll_buttons_border_radius = (isset($data['ays_poll_buttons_border_radius']) && $data['ays_poll_buttons_border_radius'] != "") ? sanitize_text_field($data['ays_poll_buttons_border_radius']) : '3';
540 552
541 553 // Buttons width
542 554 $poll_buttons_width = (isset($data['ays_poll_buttons_width']) && sanitize_text_field( $data['ays_poll_buttons_width'] ) != "") ? sanitize_text_field( $data['ays_poll_buttons_width'] ) : '';
543 -
555 +
556 + // Buttons mobile width
557 + $poll_buttons_mobile_width = (isset($data['ays_poll_buttons_mobile_width']) && sanitize_text_field( $data['ays_poll_buttons_mobile_width'] ) != "") ? sanitize_text_field( $data['ays_poll_buttons_mobile_width'] ) : $poll_buttons_width;
544 558 // ==== ====
545 559
546 560 // ==== Allow Answer options ====
547 561 // Allow custom answer
@@ -546,8 +560,9 @@
546 560 // ==== Allow Answer options ====
547 561 // Allow custom answer
548 562 $poll_allow_answer = (isset($data['ays_poll_allow_add_answers']) && $data['ays_poll_allow_add_answers'] == "on") ? "on" : "off";
549 563 // Require admin approval
564 +
550 565 $poll_allow_answer_require = (isset($data['ays_poll_allow_answer_require']) && $data['ays_poll_allow_answer_require'] == "on") ? "on" : "off";
551 566
552 567 // ==== ====
553 568
@@ -599,8 +614,14 @@
599 614
600 615 // Poll title font size for mobile
601 616 $poll_title_font_size_mobile = (isset($data['ays_poll_title_font_size_mobile']) && $data['ays_poll_title_font_size_mobile'] != "" && $data['ays_poll_title_font_size_mobile'] > 0) ? sanitize_text_field($data['ays_poll_title_font_size_mobile']) : "20";
602 617
618 + // Poll title font weight
619 + $poll_title_font_weight = (isset($data['ays_poll_title_font_weight']) && $data['ays_poll_title_font_weight'] != "") ? sanitize_text_field($data['ays_poll_title_font_weight']) : "normal";
620 +
621 + // Poll title font weight for mobile
622 + $poll_title_font_weight_mobile = (isset($data['ays_poll_title_font_weight_mobile']) && $data['ays_poll_title_font_weight_mobile'] != "") ? sanitize_text_field($data['ays_poll_title_font_weight_mobile']) : "normal";
623 +
603 624 // Poll title alignment
604 625 $poll_title_alignment = ( isset($data['ays_poll_title_alignment']) && $data['ays_poll_title_alignment'] != "" ) ? sanitize_text_field($data['ays_poll_title_alignment']) : "center";
605 626
606 627 // Poll title alignment mobile
@@ -605,8 +626,11 @@
605 626
606 627 // Poll title alignment mobile
607 628 $poll_title_alignment_mobile = ( isset($data['ays_poll_title_alignment_mobile']) && $data['ays_poll_title_alignment_mobile'] != "" ) ? sanitize_text_field($data['ays_poll_title_alignment_mobile']) : "center";
608 629
630 + // Poll title text transform
631 + $poll_title_text_transform = ( isset($data['ays_poll_title_text_transform']) && $data['ays_poll_title_text_transform'] != "" ) ? sanitize_text_field($data['ays_poll_title_text_transform']) : "none";
632 +
609 633 // ===== Poll text type options start =====
610 634 $poll_text_type_length_enable = ( isset($data['ays_poll_enable_question_length']) && $data['ays_poll_enable_question_length'] != "" ) ? sanitize_text_field($data['ays_poll_enable_question_length']) : "off";
611 635 $poll_text_type_limit_type = ( isset($data['ays_poll_question_limit_text_type']) && $data['ays_poll_question_limit_text_type'] != "" ) ? sanitize_text_field($data['ays_poll_question_limit_text_type']) : "characters";
612 636 $poll_text_type_limit_length = ( isset($data['ays_poll_question_text_max_length']) && $data['ays_poll_question_text_max_length'] != "" ) ? sanitize_text_field($data['ays_poll_question_text_max_length']) : "";
@@ -619,9 +643,9 @@
619 643 $poll_enable_password = ( isset($data['ays_poll_enable_password']) && $data['ays_poll_enable_password'] == "on" ) ? "on" : "off";
620 644 $poll_password = ( isset($data['ays_poll_password']) && $data['ays_poll_password'] != "" ) ? sanitize_text_field($data['ays_poll_password']) : "";
621 645 // Enable toggle password visibility
622 646 $poll_enable_password_visibility = (isset($data['ays_poll_enable_password_visibility']) && $data['ays_poll_enable_password_visibility'] == 'on') ? 'on' : 'off';
623 - $poll_password_message = ( isset($data['ays_poll_password_message']) && $data['ays_poll_password_message'] != "" ) ? wp_kses_post($data['ays_poll_password_message']) : "Please enter password";
647 + $poll_password_message = ( isset($data['ays_poll_password_message']) && $data['ays_poll_password_message'] != "" ) ? wp_kses( $data['ays_poll_password_message'], $poll_allowed_html ) : "Please enter password";
624 648
625 649 // Add post for poll
626 650 $ays_add_post_for_poll = isset($data['ays_add_post_for_poll']) && $data['ays_add_post_for_poll'] == 'on' ? 'on' : 'off';
627 651
@@ -649,9 +673,9 @@
649 673 $poll_logo_url_new_tab = (isset( $data[ 'ays_poll_logo_enable_image_url_new_tab' ] ) && $data[ 'ays_poll_logo_enable_image_url_new_tab' ] == 'on') ? "on" : 'off';
650 674
651 675 // Social Media links
652 676 $enable_social_links = (isset($data['ays_poll_enable_social_links']) && sanitize_text_field( $data['ays_poll_enable_social_links'] ) == "on") ? 'on' : 'off';
653 - $poll_social_links_heading = ( isset( $data[ 'ays_poll_social_links_heading' ] ) && $data[ 'ays_poll_social_links_heading' ] != '' ) ? stripslashes(wp_kses_post($data[ 'ays_poll_social_links_heading' ])) : '';
677 + $poll_social_links_heading = ( isset( $data[ 'ays_poll_social_links_heading' ] ) && $data[ 'ays_poll_social_links_heading' ] != '' ) ? wp_kses( $data['ays_poll_social_links_heading'], $poll_allowed_html ) : '';
654 678 $ays_social_links = (isset($data['ays_poll_social_links'])) ? array_map( 'sanitize_text_field', $data['ays_poll_social_links'] ) : array(
655 679 'linkedin_link' => '',
656 680 'facebook_link' => '',
657 681 'twitter_link' => '',
@@ -656,8 +680,10 @@
656 680 'facebook_link' => '',
657 681 'twitter_link' => '',
658 682 'vkontakte_link' => '',
659 683 'youtube_link' => '',
684 + 'tiktok_link' => '',
685 + 'instagram_link' => '',
660 686 );
661 687
662 688 $linkedin_link = isset($ays_social_links['ays_linkedin_link']) && sanitize_text_field( $ays_social_links['ays_linkedin_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_linkedin_link'] ) : '';
663 689 $facebook_link = isset($ays_social_links['ays_facebook_link']) && sanitize_text_field( $ays_social_links['ays_facebook_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_facebook_link'] ) : '';
@@ -663,8 +689,10 @@
663 689 $facebook_link = isset($ays_social_links['ays_facebook_link']) && sanitize_text_field( $ays_social_links['ays_facebook_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_facebook_link'] ) : '';
664 690 $twitter_link = isset($ays_social_links['ays_twitter_link']) && sanitize_text_field( $ays_social_links['ays_twitter_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_twitter_link'] ) : '';
665 691 $vkontakte_link = isset($ays_social_links['ays_vkontakte_link']) && sanitize_text_field( $ays_social_links['ays_vkontakte_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_vkontakte_link'] ) : '';
666 692 $youtube_link = isset($ays_social_links['ays_youtube_link']) && sanitize_text_field( $ays_social_links['ays_youtube_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_youtube_link'] ) : '';
693 + $tiktok_link = isset($ays_social_links['ays_tiktok_link']) && sanitize_text_field( $ays_social_links['ays_tiktok_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_tiktok_link'] ) : '';
694 + $instagram_link = isset($ays_social_links['ays_instagram_link']) && sanitize_text_field( $ays_social_links['ays_instagram_link'] ) != '' ? sanitize_text_field( $ays_social_links['ays_instagram_link'] ) : '';
667 695
668 696 $social_links = array(
669 697 'linkedin_link' => $linkedin_link,
670 698 'facebook_link' => $facebook_link,
@@ -670,8 +698,10 @@
670 698 'facebook_link' => $facebook_link,
671 699 'twitter_link' => $twitter_link,
672 700 'vkontakte_link' => $vkontakte_link,
673 701 'youtube_link' => $youtube_link,
702 + 'tiktok_link' => $tiktok_link,
703 + 'instagram_link' => $instagram_link,
674 704 );
675 705
676 706 $show_chart_type = (isset($_POST['ays_poll_show_result_chart']) && sanitize_text_field( $_POST['ays_poll_show_result_chart'] ) != "") ? sanitize_text_field( $_POST['ays_poll_show_result_chart'] ) : 'default_bar_chart';
677 707 $show_chart_type_google_height = (isset($_POST['ays_poll_show_result_chart_google_height']) && $_POST['ays_poll_show_result_chart_google_height'] != "" && $_POST['ays_poll_show_result_chart_google_height'] != 0) ? absint( intval($_POST['ays_poll_show_result_chart_google_height']) ) : 400;
@@ -705,8 +735,10 @@
705 735 'poll_answer_box_shadow_z_offset' => $poll_answer_box_shadow_z_offset,
706 736 'title_bg_color' => $title_bg_color, //aray
707 737 'poll_title_font_size' => $poll_title_font_size,
708 738 'poll_title_font_size_mobile' => $poll_title_font_size_mobile,
739 + 'poll_title_font_weight' => $poll_title_font_weight,
740 + 'poll_title_font_weight_mobile' => $poll_title_font_weight_mobile,
709 741 'icon_size' => $icon_size,
710 742 'width' => $width,
711 743 'width_for_mobile' => $width_for_mobile,
712 744 "poll_min_height" => $poll_min_height,
@@ -734,8 +766,9 @@
734 766 'poll_buttons_left_right_padding' => $poll_buttons_left_right_padding,
735 767 'poll_buttons_top_bottom_padding' => $poll_buttons_top_bottom_padding,
736 768 'poll_buttons_border_radius' => $poll_buttons_border_radius,
737 769 'poll_buttons_width' => $poll_buttons_width,
770 + 'poll_buttons_mobile_width' => $poll_buttons_mobile_width,
738 771 "disable_answer_hover" => $disable_answer_hover,
739 772 "logo_image" => $poll_logo_image,
740 773 'poll_enable_logo_url' => $poll_logo_image_url_check,
741 774 'poll_logo_title' => $poll_logo_title,
@@ -781,8 +814,10 @@
781 814 "enable_view_more_button" => $enable_view_more_button,
782 815 "poll_view_more_button_count" => $poll_view_more_button_count,
783 816 "answer_sort_type" => $poll_answer_ordering,
784 817 "show_answers_numbering" => $show_answers_numbering,
818 + "show_votes_before_voting" => $show_votes_before_voting,
819 + "show_votes_before_voting_by" => $show_votes_before_voting_by,
785 820 // Settings tab end
786 821 'hide_results' => $hide_results,
787 822 'hide_result_message' => $hide_result_message,
788 823 'hide_results_text' => $hide_results_text,
@@ -846,8 +881,9 @@
846 881 'poll_answer_image_height_for_mobile' => $poll_answer_image_height_for_mobile,
847 882 'poll_answer_image_border_radius' => $poll_answer_image_border_radius,
848 883 'poll_title_alignment' => $poll_title_alignment,
849 884 'poll_title_alignment_mobile' => $poll_title_alignment_mobile,
885 + 'poll_title_text_transform' => $poll_title_text_transform,
850 886 // Text type options
851 887 'poll_text_type_length_enable' => $poll_text_type_length_enable,
852 888 'poll_text_type_limit_type' => $poll_text_type_limit_type,
853 889 'poll_text_type_limit_length' => $poll_text_type_limit_length,
@@ -1007,8 +1043,17 @@
1007 1043 )
1008 1044 );
1009 1045 }
1010 1046 $message = 'created';
1047 +
1048 + $post_type_args = array(
1049 + 'poll_id' => $last_id,
1050 + 'author_id' => !empty($poll_create_author) ? $poll_create_author : get_current_user_id(),
1051 + 'poll_title' => $title,
1052 + );
1053 +
1054 + $custom_post_id = Poll_Maker_Custom_Post_Type::ays_poll_add_custom_post($post_type_args);
1055 +
1011 1056 } else {
1012 1057 $poll = $this->get_poll_by_id($id);
1013 1058 $poll_result = $wpdb->update(
1014 1059 $poll_table,
@@ -1254,15 +1299,15 @@
1254 1299 <!-- /wp:poll-maker/poll -->';
1255 1300 }
1256 1301
1257 1302 $new_post = array(
1258 - 'post_title' => $title,
1259 - 'post_content' => $post_content,
1260 - 'post_status' => 'publish',
1261 - 'post_date' => current_time( 'mysql' ),
1262 - 'post_author' => $user_ID,
1263 - 'post_type' => 'post',
1264 - 'post_category' => $add_postcat_for_poll
1303 + 'post_title' => $title,
1304 + 'post_content' => $post_content,
1305 + 'post_status' => 'publish',
1306 + 'post_date' => current_time( 'mysql' ),
1307 + 'post_author' => $user_ID,
1308 + 'post_type' => 'post',
1309 + 'post_category' => $add_postcat_for_poll
1265 1310 );
1266 1311 $post_id = wp_insert_post($new_post);
1267 1312 if(! empty($image)){
1268 1313 $sql = "SELECT ID FROM ".$wpdb->prefix."posts WHERE post_type = 'attachment' AND guid = '".$image."'";
@@ -1285,8 +1330,20 @@
1285 1330
1286 1331 if ($poll_result >= 0) {
1287 1332 if($message == 'created'){
1288 1333 setcookie('ays_poll_created_new', $last_id, time() + 3600, '/');
1334 + if(!empty($custom_post_id)){
1335 + $custom_post_url = array(
1336 + 'post_type' => 'ays-poll-maker',
1337 + 'p' => $custom_post_id,
1338 + 'preview' => 'true',
1339 + );
1340 + $custom_post_url_ready = http_build_query($custom_post_url);
1341 + $ready_url = get_home_url();
1342 + $ready_url .= '/?' . $custom_post_url_ready;
1343 + setcookie('ays_poll_created_new_'.$last_id.'_post_id', $ready_url, time() + 3600, '/');
1344 + }
1345 +
1289 1346 }
1290 1347 }
1291 1348
1292 1349 if ($poll_result >= 0) {
@@ -1315,9 +1372,9 @@
1315 1372 global $wpdb;
1316 1373
1317 1374 // Nonce verification for CSRF protection
1318 1375 if (!isset($_GET['_wpnonce']) && !wp_verify_nonce($_GET['_wpnonce'], $this->plugin_name . '-duplicate-poll')) {
1319 - wp_die(__('Security check error. Try again.', "poll-maker"));
1376 + wp_die( esc_html__('Security check error. Try again.', "poll-maker"));
1320 1377 }
1321 1378
1322 1379 $poll_table = esc_sql($wpdb->prefix."ayspoll_polls");
1323 1380 $answers_table = esc_sql($wpdb->prefix."ayspoll_answers");
@@ -1394,8 +1451,17 @@
1394 1451 }
1395 1452 }
1396 1453 $message = 'duplicated';
1397 1454 if ($result >= 0 && $flag == true) {
1455 +
1456 + $post_type_args = array(
1457 + 'poll_id' => $poll_id,
1458 + 'author_id' => !empty($user->ID) ? $user->ID : $user_id,
1459 + 'poll_title' => "Copy - ".$duplicate['title'],
1460 + );
1461 +
1462 + $custom_post_id = Poll_Maker_Custom_Post_Type::ays_poll_add_custom_post($post_type_args);
1463 +
1398 1464 $url = esc_url_raw(remove_query_arg(array('action', 'poll'))) . '&status=' . $message;
1399 1465 wp_redirect($url);
1400 1466 exit;
1401 1467 }
@@ -1505,28 +1571,37 @@
1505 1571 $duplicate_nonce = wp_create_nonce($this->plugin_name . '-duplicate-poll');
1506 1572
1507 1573 $poll_title = stripcslashes($item['title']);
1508 1574
1575 + $custom_post_id = isset($item['custom_post_id']) && $item['custom_post_id'] != 0 && $item['custom_post_id'] != '' ? esc_attr(intval($item['custom_post_id'])) : 0;
1576 +
1509 1577 $p = esc_attr($poll_title);
1510 1578 $polls_title_length = intval( $this->title_length );
1511 1579
1512 1580 $restitle = Poll_Maker_Ays_Admin::ays_restriction_string("word", $poll_title, $polls_title_length);
1513 1581
1514 - $title = sprintf('<a href="?page=%s&action=%s&poll=%d" title="%s">%s</a>', esc_attr($_REQUEST['page']), 'edit', absint($item['id']), $p, $restitle);
1515 - $actions = [
1516 - 'edit' => sprintf('<a href="?page=%s&action=%s&poll=%d">' . __('Edit', "poll-maker") . '</a>', esc_attr($_REQUEST['page']), 'edit', absint($item['id'])),
1517 - 'duplicate' => sprintf('<a href="?page=%s&action=%s&poll=%d&_wpnonce=%s">' . __('Duplicate', "poll-maker") . '</a>', esc_attr($_REQUEST['page']), 'duplicate', absint($item['id']),$duplicate_nonce),
1518 - 'results' => sprintf('<a href="?page=%s&poll=%d&title=%s">'. __('View Results', "poll-maker") .'</a>', esc_attr( $_REQUEST['page'] ) . '-results-each', absint( $item['id'] ) , $poll_title ),
1519 - 'delete' => sprintf('<a href="?page=%s&action=%s&poll=%d&_wpnonce=%s">' . __('Delete', "poll-maker") . '</a>', esc_attr($_REQUEST['page']), 'delete', absint($item['id']), $delete_nonce),
1520 - ];
1582 + $title = sprintf('<a href="?page=%s&action=%s&poll=%d" title="%s">%s</a>', esc_attr($_REQUEST['page']), 'edit', absint($item['id']), $p, $restitle);
1521 1583
1584 + $actions['edit'] = sprintf( '<a href="?page=%s&action=%s&poll=%d">'. esc_html__('Edit', 'poll-maker') .'</a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ) );
1585 +
1586 + $actions['duplicate'] = sprintf('<a href="?page=%s&action=%s&poll=%d&_wpnonce=%s">' .esc_html__('Duplicate', "poll-maker") . '</a>', esc_attr($_REQUEST['page']), 'duplicate', absint($item['id']),$duplicate_nonce);
1587 +
1588 + $actions['results'] = sprintf( '<a href="?page=%s&poll=%d&title=%s">'. esc_html__('View Results', 'poll-maker') .'</a>', esc_attr( $_REQUEST['page'] ) . '-results-each', absint( $item['id'] ), $poll_title );
1589 +
1590 + if($custom_post_id > 0){
1591 + $actions['custom_posts'] = sprintf( '<a href="%s" target="_blank">'. esc_html__('Preview', "poll-maker") .'</a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($custom_post_id) ) ));
1592 + }
1593 +
1594 + $actions['delete'] = sprintf( '<a class="ays_confirm_del" data-message="%s" href="?page=%s&action=%s&poll=%d&_wpnonce=%s">'. esc_html__('Delete', 'poll-maker') .'</a>', $restitle, esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce );
1595 +
1596 +
1522 1597 return $title . $this->row_actions($actions);
1523 1598 }
1524 1599
1525 1600 function column_shortcode( $item ) {
1526 1601 $shortcode_content = '<div class="ays-poll-shortcode-container">
1527 - <div class="ays-poll-copy-image" data-toggle="tooltip" aria-label="Click to copy" data-original-title="Click to copy">
1528 - <img src="' . POLL_MAKER_AYS_ADMIN_URL . '/images/icons/edit-shortcode.svg">
1602 + <div class="ays-poll-copy-image" data-toggle="tooltip" aria-label="' . __( 'Click to copy', "poll-maker" ) . '" data-original-title="' . __( 'Click to copy', "poll-maker" ) . '">
1603 + <img src="' . esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/edit-shortcode.svg">
1529 1604 </div>';
1530 1605
1531 1606 $shortcode_input = sprintf('<input type="text" class="ays-poll-shortcode-input" onclick="this.setSelectionRange(0, this.value.length)" readonly value="[ays_poll id=%s]" />', $item["id"]);
1532 1607
@@ -1540,9 +1615,9 @@
1540 1615 return sprintf('<input type="text" onClick="this.setSelectionRange(0, this.value.length)" readonly value="<?php echo do_shortcode(\'[ays_poll id=%s]\'); ?>" />', $item["id"]);
1541 1616 }
1542 1617
1543 1618 function column_results($item) {
1544 - return sprintf('<a href="?page=%s&poll=%d&title=%s"><img src="'. POLL_MAKER_AYS_ADMIN_URL .'/images/icons/view-poll-results.svg"></a>', esc_attr( $_REQUEST['page'] ) . '-results-each', absint( $item['id']), $item['title']);
1619 + return sprintf('<a href="?page=%s&poll=%d&title=%s"><img src="'. esc_url(POLL_MAKER_AYS_ADMIN_URL) .'/images/icons/view-poll-results.svg"></a>', esc_attr( $_REQUEST['page'] ) . '-results-each', absint( $item['id']), $item['title']);
1545 1620 }
1546 1621
1547 1622 function column_categories( $item ) {
1548 1623 if ($item['categories'] == '') {
@@ -1618,9 +1693,9 @@
1618 1693 );
1619 1694 $options = json_decode($res['styles'], true);
1620 1695 $status = isset($options['published']) ? $options['published'] : 1;
1621 1696
1622 - return $status ? "<i class=\"ays_poll_far ays_poll_fa-check-square\"></i> " . __("Published", "poll-maker") : "<i class=\"ays_poll_far ays_poll_fa-square\"></i> " . __("Unpublished", "poll-maker");
1697 + return $status ? "<i class=\"ays_poll_far ays_poll_fa-check-square\"></i> " .esc_html__("Published", "poll-maker") : "<i class=\"ays_poll_far ays_poll_fa-xmark-square\"></i> " .esc_html__("Unpublished", "poll-maker");
1623 1698 }
1624 1699
1625 1700 function column_poll_image( $item ) {
1626 1701 global $wpdb;
@@ -1668,19 +1743,19 @@
1668 1743 */
1669 1744 function get_columns() {
1670 1745 $columns = array(
1671 1746 'cb' => '<input type="checkbox" />',
1672 - 'title' => __('Title', "poll-maker"),
1673 - 'poll_image' => __('Question image', "poll-maker"),
1674 - 'type' => __('Type', "poll-maker"),
1675 - 'shortcode' => __('Shortcode', "poll-maker"),
1676 - 'code_include' => __('Code Include', "poll-maker"),
1677 - 'results' => __('Results', "poll-maker"),
1678 - 'categories' => __('Categories', "poll-maker"),
1679 - 'create_date' => __('Created', "poll-maker" ),
1680 - 'completed_count' => __('Completed count', "poll-maker" ),
1681 - 'publish' => __('Status', "poll-maker"),
1682 - 'id' => __('ID', "poll-maker"),
1747 + 'title' => esc_html__('Title', "poll-maker"),
1748 + 'poll_image' => esc_html__('Question image', "poll-maker"),
1749 + 'type' => esc_html__('Type', "poll-maker"),
1750 + 'shortcode' => esc_html__('Shortcode', "poll-maker"),
1751 + 'code_include' => esc_html__('Code Include', "poll-maker"),
1752 + 'results' => esc_html__('Results', "poll-maker"),
1753 + 'categories' => esc_html__('Categories', "poll-maker"),
1754 + 'create_date' => esc_html__('Created', "poll-maker" ),
1755 + 'completed_count' => esc_html__('Completed count', "poll-maker" ),
1756 + 'publish' => esc_html__('Status', "poll-maker"),
1757 + 'id' => esc_html__('ID', "poll-maker"),
1683 1758 );
1684 1759
1685 1760 return $columns;
1686 1761 }
@@ -1719,9 +1794,9 @@
1719 1794 * @return array
1720 1795 */
1721 1796 public function get_bulk_actions() {
1722 1797 $actions = array(
1723 - 'bulk-delete' => __('Delete', "poll-maker"),
1798 + 'bulk-delete' =>esc_html__('Delete', "poll-maker"),
1724 1799 );
1725 1800
1726 1801 return $actions;
1727 1802 }
@@ -1841,11 +1916,15 @@
1841 1916
1842 1917 $sql = "SELECT COUNT(*) FROM {$wpdb->prefix}ayspoll_polls";
1843 1918
1844 1919 if (isset($_GET['filterby']) && absint(intval($_GET['filterby'])) > 0) {
1845 - $cat_id = absint(intval($_GET['filterby']));
1846 - $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1847 - }
1920 + $cat_id = absint(intval($_GET['filterby']));
1921 + if (isset($_SERVER['HTTP_HOST']) && sanitize_text_field($_SERVER['HTTP_HOST']) == "playground.wordpress.net") {
1922 + $sql .= " WHERE categories LIKE '%," . $cat_id . ",%' OR categories LIKE '" . $cat_id . ",%' OR categories LIKE '%," . $cat_id . "' OR categories = '" . $cat_id . "'";
1923 + } else {
1924 + $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1925 + }
1926 + }
1848 1927
1849 1928 return $wpdb->get_var( $sql );
1850 1929 }
1851 1930
@@ -1859,9 +1938,13 @@
1859 1938 $sql = "SELECT * FROM " . $poll_table;
1860 1939
1861 1940 if (isset($_GET['filterby']) && absint(intval($_GET['filterby'])) > 0) {
1862 1941 $cat_id = absint(intval($_GET['filterby']));
1863 - $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1942 + if (isset($_SERVER['HTTP_HOST']) && sanitize_text_field($_SERVER['HTTP_HOST']) == "playground.wordpress.net") {
1943 + $sql .= " WHERE categories LIKE '%," . $cat_id . ",%' OR categories LIKE '" . $cat_id . ",%' OR categories LIKE '%," . $cat_id . "' OR categories = '" . $cat_id . "'";
1944 + } else {
1945 + $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1946 + }
1864 1947 }
1865 1948
1866 1949 $results = $wpdb->get_results($sql, ARRAY_A);
1867 1950
@@ -1887,9 +1970,13 @@
1887 1970 $sql = "SELECT * FROM " . $poll_table;
1888 1971
1889 1972 if (isset($_GET['filterby']) && absint(intval($_GET['filterby'])) > 0) {
1890 1973 $cat_id = absint(intval($_GET['filterby']));
1891 - $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1974 + if (isset($_SERVER['HTTP_HOST']) && sanitize_text_field($_SERVER['HTTP_HOST']) == "playground.wordpress.net") {
1975 + $sql .= " WHERE categories LIKE '%," . $cat_id . ",%' OR categories LIKE '" . $cat_id . ",%' OR categories LIKE '%," . $cat_id . "' OR categories = '" . $cat_id . "'";
1976 + } else {
1977 + $sql .= " WHERE FIND_IN_SET('{$cat_id}', categories) > 0";
1978 + }
1892 1979 }
1893 1980
1894 1981 $results = $wpdb->get_results($sql, ARRAY_A);
1895 1982
@@ -1973,13 +2060,12 @@
1973 2060
1974 2061 $where[] = sprintf(" categories LIKE('%%,%s,%%') ", esc_sql( $wpdb->esc_like( $cat_id ) ) );
1975 2062 }
1976 2063
1977 - if ( isset($_REQUEST['filterbyauthor'] ) && $_REQUEST['filterbyauthor'] > 0) {
1978 - $poll_author = esc_sql( sanitize_text_field( $_REQUEST['filterbyauthor'] ) );
1979 -
1980 - $where[] = " JSON_EXTRACT(styles, '$.poll_create_author') = " . ($poll_author);
1981 - }
2064 + if ( isset( $_REQUEST['filterbyauthor'] ) && absint( $_REQUEST['filterbyauthor'] ) > 0 ) {
2065 + $poll_author = absint( $_REQUEST['filterbyauthor'] );
2066 + $where[] = $wpdb->prepare( "JSON_EXTRACT(styles, '$.poll_create_author') = %d", $poll_author );
2067 + }
1982 2068
1983 2069 if(isset( $_REQUEST['filterbytype'] ) && $_REQUEST['filterbytype'] != "" ){
1984 2070 $type = esc_sql( sanitize_text_field( $_REQUEST['filterbytype'] ) );
1985 2071 if (isset($type) && $type != '') {
@@ -2034,18 +2120,18 @@
2034 2120 return;
2035 2121 }
2036 2122
2037 2123 if ('created' == $status) {
2038 - $updated_message = esc_html(__('Poll created.', "poll-maker"));
2124 + $updated_message = esc_html( esc_html__('Poll created.', "poll-maker"));
2039 2125 } elseif ('updated' == $status) {
2040 - $updated_message = esc_html(__('Poll saved.', "poll-maker"));
2126 + $updated_message = esc_html( esc_html__('Poll saved.', "poll-maker"));
2041 2127 } elseif ('duplicated' == $status) {
2042 - $updated_message = esc_html(__('Poll duplicated.', "poll-maker"));
2128 + $updated_message = esc_html( esc_html__('Poll duplicated.', "poll-maker"));
2043 2129 } elseif ('deleted' == $status) {
2044 2130 $deleted_count = isset($_GET['d_count']) && $_GET['d_count'] != "" ? intval(esc_attr($_GET['d_count'])) : 0;
2045 - $deleted_count_message = __('Poll deleted.', "poll-maker");
2131 + $deleted_count_message =esc_html__('Poll deleted.', "poll-maker");
2046 2132 if($deleted_count > 1){
2047 - $deleted_count_message = $deleted_count . __(' Polls are deleted.', "poll-maker");
2133 + $deleted_count_message = $deleted_count .esc_html__(' Polls are deleted.', "poll-maker");
2048 2134 }
2049 2135 $updated_message = $deleted_count_message;
2050 2136 }
2051 2137
@@ -2053,9 +2139,9 @@
2053 2139 return;
2054 2140 }
2055 2141
2056 2142 ?>
2057 - <div class="notice notice-success is-dismissible">
2143 + <div class="ays-poll-admin-notice notice notice-success is-dismissible">
2058 2144 <p>
2059 2145 <?php echo $updated_message; ?>
2060 2146 </p>
2061 2147 </div>