PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.3.4
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.3.4
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 5.6.6 5.6.7 All 152 releases
poll-maker / admin / class-poll-maker-ays-admin.php

class-poll-maker-ays-admin.php in Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls 6.3.4, at admin/class-poll-maker-ays-admin.php

4,815 lines 257.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The admin-specific functionality of the plugin.
5 *
6 * @link https://ays-pro.com/
7 * @since 1.0.0
8 *
9 * @package Poll_Maker_Ays
10 * @subpackage Poll_Maker_Ays/admin
11 */
12
13 /**
14 * The admin-specific functionality of the plugin.
15 *
16 * Defines the plugin name, version, and two examples hooks for how to
17 * enqueue the admin-specific stylesheet and JavaScript.
18 *
19 * @package Poll_Maker_Ays
20 * @subpackage Poll_Maker_Ays/admin
21 * @author Poll Maker Team <info@ays-pro.com>
22 */
23 class Poll_Maker_Ays_Admin {
24
25 /**
26 * The ID of this plugin.
27 *
28 * @since 1.0.0
29 * @access private
30 * @var string $plugin_name The ID of this plugin.
31 */
32 private $plugin_name;
33
34 /**
35 * The version of this plugin.
36 *
37 * @since 1.0.0
38 * @access private
39 * @var string $version The current version of this plugin.
40 */
41 private $version;
42
43 private $polls_obj;
44 private $cats_obj;
45 private $results_obj;
46 private $each_results_obj;
47 private $settings_obj;
48 private $answer_results_obj;
49 private $capability;
50
51 /**
52 * Initialize the class and set its properties.
53 *
54 * @param string $plugin_name The name of this plugin.
55 * @param string $version The version of this plugin.
56 *
57 * @since 1.0.0
58 */
59 public function __construct( $plugin_name, $version ) {
60
61 $this->plugin_name = $plugin_name;
62 $this->version = $version;
63 add_filter('set-screen-option', array(__CLASS__, 'set_screen'), 10, 3);
64 $per_page_array = array(
65 'polls_per_page',
66 'poll_cats_per_page',
67 'poll_results_per_page',
68 );
69 foreach($per_page_array as $option_name){
70 add_filter('set_screen_option_'.$option_name, array(__CLASS__, 'set_screen'), 10, 3);
71 }
72 }
73
74 /**
75 * Register the styles for the admin menu area.
76 *
77 * @since 1.5.5
78 */
79 public function admin_menu_styles() {
80 echo "
81 <style>
82 #adminmenu a.toplevel_page_poll-maker-ays div.wp-menu-image img {
83 width: 28px;
84 padding-top: 2px;
85 }
86
87 #adminmenu li.toplevel_page_poll-maker-ays ul.wp-submenu.wp-submenu-wrap li:last-child a {
88 color: #68A615;
89 font-weight: bold;
90 }
91
92 .apm-badge {
93 position: relative;
94 top: -1px;
95 right: -3px;
96 }
97
98 .apm-badge.badge-danger {
99 color: #fff;
100 background-color: #ca4a1f;
101 }
102
103 .apm-badge.badge {
104 display: inline-block;
105 vertical-align: top;
106 margin: 1px 0 0 2px;
107 padding: 0 5px;
108 min-width: 7px;
109 height: 17px;
110 border-radius: 11px;
111 font-size: 9px;
112 line-height: 17px;
113 text-align: center;
114 z-index: 26;
115 }
116
117 .wp-first-item .apm-badge {
118 display: none;
119 }
120
121 .apm-badge.badge.apm-no-results {
122 display: none;
123 }
124 </style>
125 ";
126 }
127
128 /**
129 * Register the stylesheets for the admin area.
130 *
131 * @since 1.0.0
132 */
133 public function enqueue_styles( $hook_suffix ) {
134 wp_enqueue_style($this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'css/admin.css', array(), $this->version, 'all');
135 wp_enqueue_style($this->plugin_name . '-sweetalert-css', plugin_dir_url(__FILE__) . 'css/poll-maker-sweetalert2.min.css', array(), $this->version, 'all');
136 if (false === strpos($hook_suffix, $this->plugin_name)) {
137 return;
138 }
139 // wp_enqueue_style('wp-color-picker');
140 /**
141 * This function is provided for demonstration purposes only.
142 *
143 * An instance of this class should be passed to the run() function
144 * defined in Poll_Maker_Ays_Loader as all of the hooks are defined
145 * in that particular class.
146 *
147 * The Poll_Maker_Ays_Loader will then create the relationship
148 * between the defined hooks and the functions defined in this
149 * class.
150 */
151
152 // You need styling for the datepicker. For simplicity I've linked to the jQuery UI CSS on a CDN.
153 wp_register_style( 'jquery-ui', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css' );
154 wp_enqueue_style( 'jquery-ui' );
155
156 wp_enqueue_style('wp-color-picker');
157 wp_enqueue_style('ays_poll_animate.css', plugin_dir_url(__FILE__) . 'css/animate.min.css', array(), $this->version, 'all');
158 wp_enqueue_style( $this->plugin_name . '-font-awesome', plugin_dir_url(__FILE__) . 'css/poll-maker-font-awesome-all.css', array(), $this->version, 'all');
159 wp_enqueue_style('ays_poll_bootstrap', plugin_dir_url(__FILE__) . 'css/bootstrap.min.css', array(), $this->version, 'all');
160 wp_enqueue_style($this->plugin_name.'-jquery-datetimepicker', plugin_dir_url(__FILE__) . 'css/jquery-ui-timepicker-addon.css', array(), $this->version, 'all');
161 wp_enqueue_style('ays-poll-select2', plugin_dir_url(__FILE__) . 'css/select2.min.css', array(), $this->version, 'all');
162 wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/poll-maker-ays-admin.css', array(), $this->version, 'all');
163 wp_enqueue_style($this->plugin_name.'popup-layer', plugin_dir_url(__FILE__) . 'css/poll-maker-ays-admin-popup-layer.css', array(), $this->version, 'all');
164 wp_enqueue_style( $this->plugin_name . '-dropdown', plugin_dir_url(__FILE__) . '/css/dropdown.min.css', array(), $this->version, 'all');
165 wp_enqueue_style( $this->plugin_name . '-transition', plugin_dir_url(__FILE__) . '/css/transition.min.css', array(), $this->version, 'all');
166
167
168 }
169
170 /**
171 * Register the JavaScript for the admin area.
172 *
173 * @since 1.0.0
174 */
175 public function enqueue_scripts( $hook_suffix ) {
176 wp_enqueue_script( $this->plugin_name . '-dropdown-min', plugin_dir_url(__FILE__) . '/js/dropdown.min.js', array('jquery'), $this->version, true);
177 wp_enqueue_script( $this->plugin_name . '-transition-min', plugin_dir_url(__FILE__) . '/js/transition.min.js', array('jquery'), $this->version, true);
178 global $wp_version;
179 if (false !== strpos($hook_suffix, "plugins.php")){
180 wp_enqueue_script('sweetalert-js-poll', plugin_dir_url(__FILE__) . 'js/sweetalert2.all.min.js', array('jquery'), $this->version, true);
181
182 wp_enqueue_script($this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'js/admin.js', array('jquery'), $this->version, true);
183 wp_localize_script($this->plugin_name . '-admin', 'apm_admin_ajax_obj',
184 array(
185 'ajaxUrl' => admin_url('admin-ajax.php'),
186
187 'errorMsg' => __( "Error", 'poll-maker' ),
188 'loadResource' => __( "Can't load resource.", 'poll-maker' ),
189 'somethingWentWrong' => __( "Maybe something went wrong.", 'poll-maker' ),
190 ));
191 }
192
193 $version1 = $wp_version;
194 $operator = '>=';
195 $version2 = '5.5';
196 $versionCompare = $this->versionCompare($version1, $operator, $version2);
197 if ($versionCompare) {
198 wp_enqueue_script( $this->plugin_name.'-wp-load-scripts', plugin_dir_url(__FILE__) . 'js/ays-wp-load-scripts.js', array(), $this->version, true);
199 }
200
201 if (false === strpos($hook_suffix, $this->plugin_name)) {
202 return;
203 }
204
205 $poll_banner_date = $this->ays_poll_update_banner_time();
206
207 /**
208 * This function is provided for demonstration purposes only.
209 *
210 * An instance of this class should be passed to the run() function
211 * defined in Poll_Maker_Ays_Loader as all of the hooks are defined
212 * in that particular class.
213 *
214 * The Poll_Maker_Ays_Loader will then create the relationship
215 * between the defined hooks and the functions defined in this
216 * class.
217 */
218 wp_enqueue_script('jquery');
219 wp_enqueue_script('jquery-ui-datepicker');
220 wp_enqueue_media();
221 wp_enqueue_script( $this->plugin_name.'-wp-color-picker-alpha', plugin_dir_url(__FILE__) . 'js/wp-color-picker-alpha.min.js', array('wp-color-picker'), $this->version, true);
222 wp_enqueue_script('ays_poll_popper', plugin_dir_url(__FILE__) . 'js/popper.min.js', array('jquery'), $this->version, true);
223 wp_enqueue_script('ays_poll_bootstrap', plugin_dir_url(__FILE__) . 'js/bootstrap.min.js', array('jquery'), $this->version, true);
224 wp_enqueue_script('ays_poll_select2', plugin_dir_url(__FILE__) . 'js/select2.min.js', array('jquery'), $this->version, true);
225 wp_enqueue_script('sweetalert-js-poll', plugin_dir_url(__FILE__) . 'js/sweetalert2.all.min.js', array('jquery'), $this->version, true);
226 wp_enqueue_script( $this->plugin_name."-jquery.datetimepicker.js", plugin_dir_url( __FILE__ ) . 'js/jquery-ui-timepicker-addon.js', array( 'jquery' ), $this->version, true );
227 wp_enqueue_script('ays-poll-admin-js', plugin_dir_url(__FILE__) . 'js/poll-maker-ays-admin.js', array('jquery', 'wp-color-picker'), $this->version, true);
228 wp_enqueue_script( $this->plugin_name . '-charts-google', plugin_dir_url(__FILE__) . 'js/google-chart.js', array('jquery'), $this->version, false);
229 wp_localize_script('ays-poll-admin-js', 'pollLangObj', array(
230 'pollBannerDate' => $poll_banner_date,
231 'errorMsg' => esc_html__('Error', "poll-maker"),
232 'somethingWentWrong' => esc_html__('Maybe something went wrong.', "poll-maker"),
233 'add' => esc_html__('Add', "poll-maker"),
234 'answersMinCount' => esc_html__('Sorry minimum count of answers should be 2', "poll-maker"),
235 'copied' => esc_html__('Copied!', "poll-maker"),
236 'clickForCopy' => esc_html__('Click for copy.', "poll-maker"),
237 'areYouSure' => esc_html__('Are you sure you want to redirect to another poll? Note that the changes made in this poll will not be saved.', "poll-maker"),
238 'deleteAnswer' => esc_html__('Are you sure you want to delete this answer?', "poll-maker"),
239 'youPollIsCreated' => esc_html__('Your Poll is Created!', 'poll-maker'),
240 'youCanUuseThisShortcode' => esc_html__('Copy the generated shortcode and paste it into any post or page to display Poll', "poll-maker"),
241 'greateJob' => esc_html__('Great job', "poll-maker"),
242 'editPollPage' => esc_html__( 'edit poll page', 'poll-maker'),
243 'formMoreDetailed' => esc_html__('For more detailed configuration visit', "poll-maker"),
244 'done' => esc_html__('Done', "poll-maker"),
245 'thumbsUpGreat' => esc_html__('Thumbs up, Done', "poll-maker"),
246 "preivewPoll" => esc_html__( "Preview Poll", 'poll-maker' ),
247 'successCopyCoupon' => esc_html__( "Coupon code copied!", 'poll-maker' ),
248 'failedCopyCoupon' => esc_html__( "Failed to copy coupon code", 'poll-maker' ),
249 ) );
250
251 wp_localize_script('ays-poll-admin-js', 'poll', array(
252 'ajax' => admin_url('admin-ajax.php'),
253 'pleaseEnterMore' =>esc_html__('Please select more', "poll-maker"),
254 'urlImg' => (esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/'),
255 "emptyEmailError" => esc_html__( 'Email field is empty', 'poll-maker'),
256 "invalidEmailError" => esc_html__( 'Invalid Email address', 'poll-maker'),
257 'selectUser' => esc_html__( 'Select user', 'poll-maker'),
258 'pleaseEnterMore' => esc_html__( "Please enter 1 or more characters", 'poll-maker' ),
259 'searching' => esc_html__( "Searching...", 'poll-maker' ),
260 'activated' => esc_html__( "Activated", 'poll-maker' ),
261 'errorMsg' => esc_html__( "Error", 'poll-maker' ),
262 'loadResource' => esc_html__( "Can't load resource.", 'poll-maker' ),
263 'somethingWentWrong' => esc_html__( "Maybe something went wrong.", 'poll-maker' ),
264 'greateJob' => esc_html__( 'Great job', 'poll-maker'),
265 'formMoreDetailed' => esc_html__( 'For more detailed configuration visit', 'poll-maker'),
266 'greate' => esc_html__( 'Great!', 'poll-maker'),
267
268 ));
269
270 wp_enqueue_script( $this->plugin_name . '-quick-start-js', plugin_dir_url(__FILE__) . 'js/poll-maker-poll-quick-start.js', array('jquery'), $this->version, true);
271 wp_enqueue_script( $this->plugin_name . '-admin-ajax', plugin_dir_url(__FILE__) . 'js/poll-maker-ays-ajax-admin.js', array('jquery'), $this->version, true);
272
273 wp_localize_script($this->plugin_name . '-admin-ajax', 'poll_maker_ajax', array(
274 'ajax_url' => admin_url('admin-ajax.php'),
275 'nonce' => wp_create_nonce('ays_poll_nonce'),
276 "emptyEmailError" => esc_html__( 'Email field is empty', 'poll-maker'),
277 "invalidEmailError" => esc_html__( 'Invalid Email address', 'poll-maker'),
278 'selectUser' => esc_html__( 'Select user', 'poll-maker'),
279 'pleaseEnterMore' => esc_html__( "Please enter 1 or more characters", 'poll-maker' ),
280 'searching' => esc_html__( "Searching...", 'poll-maker' ),
281 'activated' => esc_html__( "Activated", 'poll-maker' ),
282 'errorMsg' => esc_html__( "Error", 'poll-maker' ),
283 'loadResource' => esc_html__( "Can't load resource.", 'poll-maker' ),
284 'somethingWentWrong' => esc_html__( "Maybe something went wrong.", 'poll-maker' ),
285 'youCanUuseThisShortcode' => esc_html__( 'Copy the generated shortcode and paste it into any post or page to display Poll.', 'poll-maker'),
286 'youPollIsCreated' => esc_html__( 'Your Poll is Created!', 'poll-maker'),
287 'greateJob' => esc_html__( 'Great job', 'poll-maker'),
288 'formMoreDetailed' => esc_html__( 'For more detailed configuration visit', 'poll-maker'),
289 'editpollPage' => esc_html__( 'edit poll page', 'poll-maker'),
290 'greate' => esc_html__( 'Great!', 'poll-maker'),
291 'thumbsUpGreat' => esc_html__( 'Thumbs up, great!', 'poll-maker'),
292 "preivewPoll" => esc_html__( "Preview Poll", 'poll-maker' ),
293
294 "checklistMarkAsDone" => esc_html__( "Mark as done", 'poll-maker' ),
295 "checklistUnmarkAsDone" => esc_html__( "Unmark as done", 'poll-maker' ),
296 ));
297 $color_picker_strings = array(
298 'clear' =>esc_html__('Clear', "poll-maker"),
299 'clearAriaLabel' =>esc_html__('Clear color', "poll-maker"),
300 'defaultString' =>esc_html__('Default', "poll-maker"),
301 'defaultAriaLabel' =>esc_html__('Select default color', "poll-maker"),
302 'pick' =>esc_html__('Select Color', "poll-maker"),
303 'defaultLabel' =>esc_html__('Color value', "poll-maker"),
304 );
305 wp_localize_script( $this->plugin_name.'-wp-color-picker-alpha', 'wpColorPickerL10n', $color_picker_strings );
306 }
307
308 public function ays_poll_add_body_class( $classes ) {
309 global $pagenow;
310
311 if ( $pagenow === 'admin.php' ) {
312 $page = isset( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
313
314 if ( strpos( $page, $this->plugin_name ) === 0 ) {
315 $classes .= ' ays-poll-plugin-admin';
316 }
317 }
318
319 return $classes;
320 }
321
322 /**
323 * De-register JavaScript files for the admin area.
324 *
325 * @since 1.0.0
326 */
327 public function disable_scripts($hook_suffix) {
328 if (false !== strpos($hook_suffix, $this->plugin_name)) {
329 if (is_plugin_active('ai-engine/ai-engine.php')) {
330 wp_deregister_script('mwai');
331 wp_deregister_script('mwai-vendor');
332 wp_dequeue_script('mwai');
333 wp_dequeue_script('mwai-vendor');
334 }
335
336 if (is_plugin_active('html5-video-player/html5-video-player.php')) {
337 wp_dequeue_style('h5vp-admin');
338 wp_dequeue_style('fs_common');
339 }
340
341 if (is_plugin_active('panorama/panorama.php')) {
342 wp_dequeue_style('bppiv_admin_custom_css');
343 wp_dequeue_style('bppiv-custom-style');
344 }
345
346 if (is_plugin_active('wp-social/wp-social.php')) {
347 wp_dequeue_style('wp_social_select2_css');
348 wp_deregister_script('wp_social_select2_js');
349 wp_dequeue_script('wp_social_select2_js');
350 }
351
352 if (is_plugin_active('real-media-library-lite/index.php')) {
353 wp_dequeue_style('real-media-library-lite-rml');
354 }
355
356 // Theme | Pixel Ebook Store
357 wp_dequeue_style('pixel-ebook-store-free-demo-content-style');
358
359 // Theme | Interactive Education
360 wp_dequeue_style('interactive-education-free-demo-content-style');
361
362 // Theme | Phlox 2.17.6
363 wp_dequeue_style('auxin-admin-style');
364 }
365 }
366
367 public function ays_poll_disable_all_notice_from_plugin() {
368 if (!function_exists('get_current_screen')) {
369 return;
370 }
371
372 $screen = get_current_screen();
373
374 if (empty($screen) || strpos($screen->id, $this->plugin_name) === false) {
375 return;
376 }
377
378 global $wp_filter;
379
380 // Keep plugin-specific notices
381 $our_plugin_notices = array();
382
383 $exclude_functions = [
384 'poll_maker_admin_notice',
385 ];
386
387 if (!empty($wp_filter['admin_notices'])) {
388 foreach ($wp_filter['admin_notices']->callbacks as $priority => $callbacks) {
389 foreach ($callbacks as $key => $callback) {
390 // For class-based methods
391 if (
392 is_array($callback['function']) &&
393 is_object($callback['function'][0]) &&
394 get_class($callback['function'][0]) === __CLASS__
395 ) {
396 $our_plugin_notices[$priority][$key] = $callback;
397 }
398 // For standalone functions
399 elseif (
400 is_string($callback['function']) &&
401 in_array($callback['function'], $exclude_functions)
402 ) {
403 $our_plugin_notices[$priority][$key] = $callback;
404 }
405 }
406 }
407 }
408
409 // Remove all notices
410 remove_all_actions('admin_notices');
411 remove_all_actions('all_admin_notices');
412
413 // Re-add only your plugin's notices
414 foreach ($our_plugin_notices as $priority => $callbacks) {
415 foreach ($callbacks as $callback) {
416 add_action('admin_notices', $callback['function'], $priority);
417 }
418 }
419 }
420
421 public function codemirror_enqueue_scripts($hook) {
422 if(strpos($hook, $this->plugin_name) !== false){
423 if(function_exists('wp_enqueue_code_editor')){
424 $cm_settings['codeEditor'] = wp_enqueue_code_editor(array(
425 'type' => 'text/css',
426 'codemirror' => array(
427 'inputStyle' => 'contenteditable',
428 'theme' => 'cobalt',
429 )
430 ));
431
432 wp_enqueue_script('wp-theme-plugin-editor');
433 wp_localize_script('wp-theme-plugin-editor', 'cm_settings', $cm_settings);
434
435 wp_enqueue_style('wp-codemirror');
436 }
437 }
438 }
439
440 public function versionCompare($version1, $operator, $version2) {
441
442 $_fv = intval ( trim ( str_replace ( '.', '', $version1 ) ) );
443 $_sv = intval ( trim ( str_replace ( '.', '', $version2 ) ) );
444
445 if (strlen ( $_fv ) > strlen ( $_sv )) {
446 $_sv = str_pad ( $_sv, strlen ( $_fv ), 0 );
447 }
448
449 if (strlen ( $_fv ) < strlen ( $_sv )) {
450 $_fv = str_pad ( $_fv, strlen ( $_sv ), 0 );
451 }
452
453 return version_compare ( ( string ) $_fv, ( string ) $_sv, $operator );
454 }
455
456 public function add_plugin_admin_menu() {
457
458 /*
459 * Check unread results
460 *
461 */
462 global $wpdb;
463 $sql = "SELECT COUNT(unread) FROM {$wpdb->prefix}ayspoll_reports WHERE unread=1";
464 $unread_results = $wpdb->get_var($sql);
465 $show = $unread_results > 0 ? '' : "apm-no-results";
466 /*
467 * Add a settings page for this plugin to the Settings menu.
468 *
469 * NOTE: Alternative menu locations are available via WordPress administration menu functions.
470 *
471 * Administration Menus: http://codex.wordpress.org/Administration_Menus
472 *
473 */
474
475 $menu_item = ($unread_results == 0) ? 'Poll Maker' : 'Poll Maker' . '<span style="margin-right: 10px;" class="apm-badge badge badge-danger '.$show.'">' . $unread_results . '</span>';
476
477 $this->capability = $this->poll_maker_capabilities();
478 $capability = $this->poll_maker_capabilities();
479 $hook_poll = add_menu_page(
480 'Poll Maker',
481 $menu_item,
482 $capability,
483 $this->plugin_name,
484 array($this,'display_plugin_polls_page'),
485 esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/icons/icon-poll-maker-128x128.svg',
486 '6.33'
487 );
488
489 add_action("load-$hook_poll", array($this, 'screen_option_polls'));
490 add_action("load-$hook_poll", array($this, 'add_tabs'));
491
492 $hook_results_each = add_submenu_page(
493 'all_results_slug',
494 esc_html__('Results per poll', "poll-maker"),
495 esc_html__('Results per poll', "poll-maker"),
496 $capability,
497 $this->plugin_name . '-results-each',
498 array($this, 'display_plugin_results_each_page')
499 );
500 add_action("load-$hook_results_each", array($this, 'screen_option_each_results'));
501
502 }
503
504
505 public function add_plugin_dashboard_submenu() {
506 $capability = $this->poll_maker_capabilities();
507
508 $hook_polls = add_submenu_page(
509 $this->plugin_name,
510 esc_html__('Dashboard', "poll-maker"),
511 esc_html__('Dashboard', "poll-maker"),
512 $capability,
513 $this->plugin_name . "-dashboard",
514 array($this, 'display_plugin_dashboard_page')
515 );
516 }
517
518
519 public function add_plugin_polls_submenu() {
520 $capability = $this->poll_maker_capabilities();
521
522 $hook_polls = add_submenu_page(
523 $this->plugin_name,
524 esc_html__('All Polls', "poll-maker"),
525 esc_html__('All Polls', "poll-maker"),
526 $capability,
527 $this->plugin_name,
528 array($this, 'display_plugin_polls_page')
529 );
530 add_action("load-$hook_polls", array($this, 'screen_option_polls'));
531 add_action("load-$hook_polls", array($this, 'add_tabs'));
532 }
533
534 public function add_plugin_add_new_poll_submenu() {
535 $capability = $this->poll_maker_capabilities();
536
537 $hook_polls = add_submenu_page(
538 $this->plugin_name,
539 esc_html__('Add new', "poll-maker"),
540 esc_html__('Add new', "poll-maker"),
541 $capability,
542 $this->plugin_name . '-add-new',
543 array($this, 'display_plugin_add_new_poll_page')
544 );
545 }
546
547 public function add_plugin_categories_submenu() {
548 $capability = $this->poll_maker_capabilities();
549
550 $hook_cats = add_submenu_page(
551 $this->plugin_name,
552 esc_html__('Categories', "poll-maker"),
553 esc_html__('Categories', "poll-maker"),
554 $capability,
555 $this->plugin_name . '-cats',
556 array($this, 'display_plugin_cats_page')
557 );
558 add_action("load-$hook_cats", array($this, 'screen_option_cats'));
559 add_action("load-$hook_cats", array($this, 'add_tabs'));
560 }
561
562 public function add_plugin_results_submenu() {
563 /*
564 * Check unread results
565 *
566 */
567 global $wpdb;
568 $sql = "SELECT COUNT(unread) FROM {$wpdb->prefix}ayspoll_reports WHERE unread=1";
569 $unread_results = $wpdb->get_var($sql);
570 $show = $unread_results > 0 ? '' : "apm-no-results";
571
572 $capability = $this->poll_maker_capabilities();
573
574 $hook_results = add_submenu_page(
575 $this->plugin_name,
576 esc_html__('Results', "poll-maker"),
577 esc_html__('Results', "poll-maker") . " <span class=\"apm-badge badge badge-danger $show\">$unread_results</span>",
578 $capability,
579 $this->plugin_name . '-results',
580 array($this, 'display_plugin_results_page')
581 );
582 add_action("load-$hook_results", array($this, 'screen_option_results'));
583 add_action("load-$hook_results", array($this, 'add_tabs'));
584
585 $hook_all_results = add_submenu_page(
586 'all_results_slug',
587 esc_html__('Results', "poll-maker"),
588 $capability,
589 $this->capability,
590 $this->plugin_name . '-all-results',
591 array($this, 'display_plugin_all_results_page')
592 );
593
594 add_action("load-$hook_all_results", array($this, 'screen_option_all_poll_results'));
595
596 add_filter('parent_file', array($this,'poll_maker_select_submenu'));
597 }
598
599 public function add_plugin_formfields_submenu() {
600
601 $hook_formfields = add_submenu_page(
602 $this->plugin_name,
603 esc_html__('Custom Fields', "poll-maker"),
604 esc_html__('Custom Fields', "poll-maker"),
605 'manage_options',
606 $this->plugin_name . '-formfields',
607 array($this, 'display_plugin_formfields_page')
608 );
609 add_action("load-$hook_formfields", array($this, 'add_tabs'));
610 }
611
612 public function add_plugin_general_settings_submenu() {
613 $hook_settings = add_submenu_page($this->plugin_name,
614 esc_html__('General Settings', "poll-maker"),
615 esc_html__('General Settings', "poll-maker"),
616 'manage_options',
617 $this->plugin_name . '-settings',
618 array($this, 'display_plugin_settings_page')
619 );
620 add_action("load-$hook_settings", array($this, 'screen_option_settings'));
621 add_action("load-$hook_settings", array($this, 'add_tabs'));
622 }
623
624 public function add_plugin_how_to_use_submenu() {
625 $hook_pro_features = add_submenu_page(
626 $this->plugin_name,
627 esc_html__('How to use', "poll-maker"),
628 esc_html__('How to use', "poll-maker"),
629 'manage_options',
630 $this->plugin_name . '-how-to-use',
631 array($this, 'display_plugin_how_to_use_page')
632 );
633 add_action("load-$hook_pro_features", array($this, 'add_tabs'));
634 }
635
636 public function add_plugin_pro_features_submenu() {
637 $hook_pro_features = add_submenu_page(
638 $this->plugin_name,
639 esc_html__('PRO features', "poll-maker"),
640 esc_html__('PRO features', "poll-maker"),
641 'manage_options',
642 $this->plugin_name . '-pro-features',
643 array($this, 'display_plugin_pro_features_page')
644 );
645 add_action("load-$hook_pro_features", array($this, 'add_tabs'));
646 }
647
648 public function add_plugin_featured_plugins_submenu(){
649 $hook_pro_features = add_submenu_page( $this->plugin_name,
650 esc_html__('Our products', "poll-maker"),
651 esc_html__('Our products', "poll-maker"),
652 'manage_options',
653 $this->plugin_name . '-featured-plugins',
654 array($this, 'display_plugin_featured_plugins_page')
655 );
656 add_action("load-$hook_pro_features", array($this, 'add_tabs'));
657 }
658
659 /**
660 * Add settings action link to the plugins page.
661 *
662 * @since 1.0.0
663 */
664
665 public function add_action_links( $links ) {
666 /*
667 * Documentation : https://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name)
668 */
669 $poll_ajax_deactivate_plugin_nonce = wp_create_nonce( 'poll-maker-ajax-deactivate-plugin-nonce' );
670
671 $settings_link = array(
672 '<a href="' . admin_url('admin.php?page=' . $this->plugin_name) . '">' .esc_html__('Settings', "poll-maker") . '</a>',
673 '<a href="https://poll-plugin.com/wordpress-poll-plugin-free-demo/" target="_blank">' .esc_html__('Demo', "poll-maker") . '</a>',
674 '<a href="https://ays-pro.com/wordpress/poll-maker?utm_source=dashboard&utm_medium=poll-free&utm_campaign=plugins-buy-now-button" class="ays-poll-upgrade-plugin-btn" style="font-weight:bold;color:#01A32A;" target="_blank">' .esc_html__('Upgrade 50% Sale', "poll-maker") . '</a><input type="hidden" id="ays_poll_maker_ajax_deactivate_plugin_nonce" name="ays_poll_maker_ajax_deactivate_plugin_nonce" value="' . $poll_ajax_deactivate_plugin_nonce .'">',
675 );
676
677 return array_merge($settings_link, $links);
678
679 }
680
681 public function add_poll_row_meta( $links, $file ) {
682 if ( POLL_MAKER_AYS_BASENAME == $file ) {
683 $row_meta = array(
684 'ays-poll-support' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/poll-maker/' ) . '" target="_blank">' . esc_html__( 'Free Support', "poll-maker" ) . '</a>',
685 'ays-poll-documentation' => '<a href="' . esc_url( 'https://ays-pro.com/wordpress-poll-maker-user-manual' ) . '" target="_blank">' . esc_html__( 'Documentation', "poll-maker" ) . '</a>',
686 'ays-poll-rate-us' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/poll-maker/reviews/?rate=5#new-post' ) . '" target="_blank">' . esc_html__( 'Rate us', "poll-maker" ) . '</a>',
687 'ays-poll-video-tutorial' => '<a href="' . esc_url( 'https://www.youtube.com/channel/UC-1vioc90xaKjE7stq30wmA' ) . '" target="_blank">' . esc_html__( 'Video tutorial', "poll-maker" ) . '</a>',
688 );
689
690 return array_merge( $links, $row_meta );
691 }
692 return $links;
693 }
694
695 /**
696 * Render the settings page for this plugin.
697 *
698 * @since 1.0.0
699 */
700 public function display_plugin_dashboard_page() {
701 if ( ! class_exists( 'Poll_Maker_Ays_Welcome' ) ) {
702 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-poll-maker-ays-welcome.php';
703 }
704 $welcome_page = new Poll_Maker_Ays_Welcome();
705 $welcome_page->output(true);
706 }
707
708 /**
709 * Render the settings page for this plugin.
710 *
711 * @since 1.0.0
712 */
713
714 public function display_plugin_polls_page() {
715 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
716
717 switch ( $action ) {
718 case 'add':
719 include_once 'partials/poll-maker-ays-polls-actions.php';
720 break;
721 case 'edit':
722 include_once 'partials/poll-maker-ays-polls-actions.php';
723 break;
724 default:
725 include_once 'partials/poll-maker-ays-admin-display.php';
726 }
727 }
728
729 public function display_plugin_add_new_poll_page() {
730 $add_new_poll_url = admin_url('admin.php?page=' . $this->plugin_name . '&action=add');
731 wp_redirect($add_new_poll_url);
732 }
733
734 public function display_plugin_cats_page() {
735 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
736
737 switch ( $action ) {
738 case 'add':
739 include_once 'partials/categories/actions/poll-maker-ays-categories-actions.php';
740 break;
741 case 'edit':
742 include_once 'partials/categories/actions/poll-maker-ays-categories-actions.php';
743 break;
744 default:
745 include_once 'partials/categories/poll-maker-ays-categories-display.php';
746 }
747 }
748
749 public function display_plugin_results_page() {
750 include_once 'partials/results/poll-maker-ays-results-display.php';
751 }
752
753 public function display_plugin_results_each_page() {
754 include_once 'partials/results/poll-maker-ays-each-results-display.php';
755 }
756
757 public function display_plugin_formfields_page() {
758 include_once 'partials/features/poll-maker-formfields_page-display.php';
759 }
760
761 public function display_plugin_pro_features_page() {
762 include_once 'partials/features/poll-maker-pro-features-display.php';
763 }
764
765 public function display_plugin_how_to_use_page() {
766 include_once 'partials/features/poll-maker-how-to-use-display.php';
767 }
768
769 public function display_plugin_featured_plugins_page(){
770 include_once('partials/features/poll-maker-featured-display.php');
771 }
772
773 public static function set_screen( $status, $option, $value ) {
774 return $value;
775 }
776
777 public function screen_option_polls() {
778 $option = 'per_page';
779 $args = array(
780 'label' =>esc_html__('Polls', "poll-maker"),
781 'default' => 20,
782 'option' => 'polls_per_page',
783 );
784
785 add_screen_option($option, $args);
786 $this->polls_obj = new Polls_List_Table($this->plugin_name);
787 $this->settings_obj = new Poll_Maker_Settings_Actions($this->plugin_name);
788
789 }
790
791 public function screen_option_cats() {
792 $option = 'per_page';
793 $args = array(
794 'label' =>esc_html__('Categories', "poll-maker"),
795 'default' => 5,
796 'option' => 'poll_cats_per_page',
797 );
798
799 add_screen_option($option, $args);
800 $this->cats_obj = new Pma_Categories_List_Table($this->plugin_name);
801 $this->settings_obj = new Poll_Maker_Settings_Actions($this->plugin_name);
802 }
803
804 public function screen_option_results() {
805 $option = 'per_page';
806 $args = array(
807 'label' =>esc_html__('Results', "poll-maker"),
808 'default' => 50,
809 'option' => 'poll_results_per_page',
810 );
811
812 add_screen_option($option, $args);
813 $this->results_obj = new Pma_Results_List_Table($this->plugin_name);
814 // $this->answer_results_obj = new Poll_Answer_Results($this->plugin_name);
815 }
816
817 public function screen_option_each_results() {
818 $option = 'per_page';
819 $args = array(
820 'label' =>esc_html__('Results per poll', "poll-maker"),
821 'default' => 50,
822 'option' => 'poll_each_results_per_page',
823 );
824
825 add_screen_option($option, $args);
826 $this->each_results_obj = new Pma_Each_Results_List_Table($this->plugin_name);
827 }
828
829 public function register_poll_ays_widget() {
830 global $wpdb;
831 $poll_table = esc_sql($wpdb->prefix . "ayspoll_polls");
832 $sql = "SELECT COUNT(*) FROM ".$poll_table;
833
834 $c = $wpdb->get_var($sql);
835 if ($c == 0) {
836 return;
837 } else {
838 register_widget('Poll_Maker_Widget');
839 }
840 }
841
842 public function poll_maker_el_widgets_registered() {
843 wp_enqueue_style($this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'css/admin.css', array(), $this->version, 'all');
844 // We check if the Elementor plugin has been installed / activated.
845 if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) {
846 // get our own widgets up and running:
847 // copied from widgets-manager.php
848 if ( class_exists( 'Elementor\Plugin' ) ) {
849 if ( is_callable( 'Elementor\Plugin', 'instance' ) ) {
850 $elementor = Elementor\Plugin::instance();
851 if ( isset( $elementor->widgets_manager ) ) {
852 if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
853 if ( method_exists( $elementor->widgets_manager, 'register' ) ) {
854 $widget_file = 'plugins/elementor/poll_maker_elementor.php';
855 $template_file = locate_template( $widget_file );
856 if ( !$template_file || !is_readable( $template_file ) ) {
857 $template_file = POLL_MAKER_AYS_DIR.'pb_templates/poll_maker_elementor.php';
858 }
859 if ( $template_file && is_readable( $template_file ) ) {
860 require_once $template_file;
861 Elementor\Plugin::instance()->widgets_manager->register( new Elementor\Widget_Poll_Maker_Elementor() );
862 }
863 }
864 } else {
865 if ( method_exists( $elementor->widgets_manager, 'register_widget_type' ) ) {
866 $widget_file = 'plugins/elementor/poll_maker_elementor.php';
867 $template_file = locate_template( $widget_file );
868 if ( !$template_file || !is_readable( $template_file ) ) {
869 $template_file = POLL_MAKER_AYS_DIR.'pb_templates/poll_maker_elementor.php';
870 }
871 if ( $template_file && is_readable( $template_file ) ) {
872 require_once $template_file;
873 Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Elementor\Widget_Poll_Maker_Elementor() );
874 }
875 }
876 }
877 }
878 }
879 }
880 }
881 }
882
883 public function apm_deactivate_plugin_option() {
884 // Run a security check.
885 if (isset($_REQUEST['_ajax_nonce'])) {
886 check_ajax_referer('poll-maker-ajax-deactivate-plugin-nonce', sanitize_key($_REQUEST['_ajax_nonce']));
887 } else {
888 // For multisite, if nonce is missing
889 if (function_exists('is_multisite') && is_multisite()) {
890 // Skip nonce verification for multisite
891 } else {
892 wp_send_json_error('Nonce verification failed');
893 wp_die();
894 }
895 }
896 // Check for permissions.
897 if ( ! current_user_can( 'manage_options' ) ) {
898 ob_end_clean();
899 $ob_get_clean = ob_get_clean();
900 echo json_encode(array(
901 'option' => ''
902 ));
903 wp_die();
904 }
905
906 if( is_user_logged_in() ) {
907 $request_value = esc_sql( sanitize_text_field( $_REQUEST['upgrade_plugin'] ) );
908 $upgrade_option = get_option('ays_poll_maker_upgrade_plugin','');
909 if($upgrade_option === ''){
910 add_option('ays_poll_maker_upgrade_plugin',$request_value);
911 }else{
912 update_option('ays_poll_maker_upgrade_plugin',$request_value);
913 }
914 ob_end_clean();
915 $ob_get_clean = ob_get_clean();
916 echo json_encode(array(
917 'option' => get_option('ays_poll_maker_upgrade_plugin', '')
918 ));
919 wp_die();
920 } else {
921 ob_end_clean();
922 $ob_get_clean = ob_get_clean();
923 echo json_encode(array(
924 'option' => ''
925 ));
926 wp_die();
927 }
928 }
929
930 public function apm_show_results() {
931 // Run a security check.
932 check_ajax_referer( 'poll-maker-ajax-show-details-report-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
933
934 // Check for permissions.
935 if ( ! current_user_can( 'manage_options' ) ) {
936 ob_end_clean();
937 $ob_get_clean = ob_get_clean();
938 echo json_encode(array("success" => false));
939 wp_die();
940 }
941
942 global $wpdb;
943 $results_table = $wpdb->prefix . "ayspoll_reports";
944 // $polls_obj = new Polls_List_Table($this->plugin_name);
945 if (isset($_POST['action']) && $_POST['action'] == 'apm_show_results') {
946
947 $id = isset($_POST['result']) ? absint($_POST['result']) : 0;
948 $is_details = isset($_POST['is_details']) && absint($_POST['is_details']) > 0 ? true : false;
949 $row = '';
950 $wpdb->update($results_table,
951 array('unread' => 0),
952 array('id' => $id),
953 array('%d'),
954 array('%d')
955 );
956 if ($id > 0 && $is_details) {
957 $result = $wpdb->get_row("SELECT * FROM $results_table WHERE id=$id", "ARRAY_A");
958 $multivote_res = false;
959 $result['multi_answer_id'] = json_decode($result['multi_answer_ids']);
960 if (isset($result['multi_answer_id']) && count($result['multi_answer_id']) > 1) {
961 $multivote_res = true;
962 }
963 $multivote_answers = array();
964 if ($multivote_res) {
965 foreach ($result['multi_answer_id'] as $m_key => $m_val) {
966 $multi_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}ayspoll_answers WHERE id=".$m_val, "ARRAY_A");
967 $multivote_answers[] = $multi_answer['answer'];
968 }
969 $answ_poll_id = $multi_answer['poll_id'];
970 } else {
971 $answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}ayspoll_answers WHERE id={$result['answer_id']}", "ARRAY_A");
972 $multivote_answers[] = $answer['answer'];
973 $answ_poll_id = $answer['poll_id'];
974 }
975
976 $poll = $this->get_poll_by_id($answ_poll_id);
977 $user_ip = $result['user_ip'];
978 $info = ($result['other_info'] == '' || $result['other_info'] === null || $result['other_info'] === 0) ? array() : json_decode($result['other_info'], true);
979
980 $time = $result['vote_date'];
981 $user_email = $result['user_email'];
982 $country = '';
983 $region = '';
984 $city = '';
985 $json = isset($user_ip) && $user_ip != '' ? json_decode(file_get_contents("http://ipinfo.io/{$user_ip}/json")) : null;
986
987 if ($json !== null) {
988 $country = isset($json->country) && $json->country != '' ? $json->country : '';
989 $region = isset($json->region) && $json->region != '' ? $json->region : '';
990 $city = isset($json->city) && $json->city != '' ? $json->city : '';
991 }
992 $from = "$city, $region, $country, $user_ip";
993 $row = '<tr><td colspan="4"><h1>' .esc_html__('Poll Information', "poll-maker") . "</h1></td></tr>
994 <tr class='ays_result_element'>
995 <td>".esc_html__('Poll Title', "poll-maker")."</td>
996 <td>{$poll['title']}</td>
997 <td></td>
998 <td></td>
999 </tr>";
1000 $row .= "<tr class='ays_result_element'>
1001 <td>".esc_html__('Poll Type', "poll-maker")."</td>
1002 <td>" . ucfirst($poll['type']) . "</td>
1003 <td></td>
1004 <td></td>
1005 </tr>";
1006 switch ( $poll['type'] ) {
1007 case 'choosing':
1008 $row .= "<tr class='ays_result_element'>
1009 <td>".esc_html__('Answer', "poll-maker")."</td>
1010 <td>" . (in_array($poll['answers'][0]['answer'], $multivote_answers) ? "<b><em>" . stripslashes($poll['answers'][0]['answer']) . "</em></b>" : stripslashes($poll['answers'][0]['answer'])) . "</td>
1011 <td></td>
1012 <td></td>
1013 </tr>";
1014 foreach ( $poll['answers'] as $index => $ans ) {
1015 if ($index == 0) {
1016 continue;
1017 }
1018 $row .= "<tr class='ays_result_element'>
1019 <td></td>
1020 <td>" . (in_array($ans['answer'], $multivote_answers) ? "<b><em>" . stripslashes($ans['answer']) . "</em></b>" : stripslashes($ans['answer'])) . "</td>
1021 <td></td>
1022 <td></td>
1023 </tr>";
1024 }
1025 break;
1026 case 'text':
1027 $row .= "<tr class='ays_result_element'>
1028 <td>".esc_html__('Answer', "poll-maker")."</td>
1029 <td><b><em>" . $answer['answer'] . "</em></b></td>
1030 <td></td>
1031 <td></td>
1032 </tr>";
1033 break;
1034 case 'rating':
1035 $row .= "<tr class='ays_result_element'>
1036 <td>".esc_html__('Answer', "poll-maker")."</td>
1037 <td><div class='apm-rating-res'>";
1038 if ($poll['view_type'] == 'star') {
1039 foreach ( $poll['answers'] as $ans ) {
1040 $row .= "<i class='" . ($ans['answer'] <= $answer['answer'] ? "ays_poll_fas" : "ays_poll_far") . " ays_poll_fa-star'></i>";
1041 }
1042 } elseif ('emoji') {
1043 $emoji = array(
1044 "ays_poll_fa-dizzy",
1045 "ays_poll_fa-smile",
1046 "ays_poll_fa-meh",
1047 "ays_poll_fa-frown",
1048 "ays_poll_fa-tired",
1049 );
1050 foreach ( $poll['answers'] as $i => $ans ) {
1051 $index = (count($poll['answers']) / 2 - $i + 1.5);
1052 $row .= "<i class='" . ($ans['answer'] == $answer['answer'] ? "ays_poll_fas " : "ays_poll_far ") . $emoji[$index] . "'></i>";
1053 }
1054 }
1055 $row .= "</div></td>
1056 <td></td>
1057 <td></td>
1058 </tr>";
1059 break;
1060 case 'voting':
1061 $row .= "<tr class='ays_result_element'>
1062 <td>".esc_html__('Answer', "poll-maker")."</td>
1063 <td><div class='apm-rating-res'>";
1064 $icons = array(
1065 'hand' => array(
1066 "ays_poll_fa-thumbs-up",
1067 "ays_poll_fa-thumbs-down",
1068 ),
1069 'emoji' => array(
1070 "ays_poll_fa-smile",
1071 "ays_poll_fa-frown",
1072 ),
1073 );
1074 $view = $poll['view_type'];
1075 $row .= "<i class='" . (1 == $answer['answer'] ? "ays_poll_fas " : "ays_poll_far ") . $icons[$view][0] . "'></i>
1076 <i class='" . (-1 == $answer['answer'] ? "ays_poll_fas " : "ays_poll_far ") . $icons[$view][1] . "'></i>";
1077 $row .= "</div></td>
1078 <td></td>
1079 <td></td>
1080 </tr>";
1081 break;
1082 }
1083 $row .= "<tr class='ays_result_element'>
1084 <td>".esc_html__('Answer Datetime', "poll-maker")."</td>
1085 <td>" . (date('H:i:s d.m.Y', strtotime($time))) . "</td>
1086 <td></td>
1087 <td></td>
1088 </tr>";
1089 $row .= "<tr class='hr-line'><td colspan='4'><hr></td></tr>";
1090 $row .= '<tr><td colspan="4"><h1>' .esc_html__('User Information', "poll-maker") . "</h1></td></tr>";
1091 if ($json !== null) {
1092 $row .= "<tr class='ays_result_element'>
1093 <td>".esc_html__('User IP', "poll-maker")."</td>
1094 <td>$from</td>
1095 <td></td>
1096 <td></td>
1097 </tr>";
1098 }
1099 if(!empty($user_email)){
1100 $row .= "<tr class='ays_result_element'>
1101 <td>".esc_html__('User E-mail', "poll-maker")."</td>
1102 <td>$user_email</td>
1103 <td></td>
1104 <td></td>
1105 </tr>";
1106 }
1107 foreach ( $info as $key => $value ) {
1108 if ( ($key == 'not_show_user_id') || ($key == 'email' && !empty($user_email)) ) {
1109 continue;
1110 }
1111
1112 $row .= "<tr class='ays_result_element'>
1113 <td>". esc_html__( $key, "poll-maker") ."</td>
1114 <td>". $value ."</td>
1115 <td></td>
1116 <td></td>
1117 </tr>";
1118 }
1119 }
1120 ob_end_clean();
1121 $ob_get_clean = ob_get_clean();
1122 echo json_encode([
1123 "status" => true,
1124 "rows" => $row,
1125 ]);
1126 wp_die();
1127 }
1128 }
1129
1130 public function get_poll_by_id( $id, $decode = true ) {
1131 global $wpdb;
1132
1133 $sql = "SELECT * FROM {$wpdb->prefix}ayspoll_polls WHERE id=" . absint(intval($id));
1134 $poll = $wpdb->get_row($sql, 'ARRAY_A');
1135 if (empty($poll)) {
1136 return array();
1137 }
1138 $sql = "SELECT * FROM {$wpdb->prefix}ayspoll_answers WHERE poll_id=" . absint(intval($id)) . " ORDER BY id ASC";
1139 $poll['answers'] = $wpdb->get_results($sql, 'ARRAY_A');
1140
1141 if ($decode) {
1142 $json = $poll['styles'];
1143 $poll['styles'] = !empty($poll['styles']) ? json_decode($poll['styles'], true) : array();
1144 $poll['categories'] = trim($poll['categories'], ',');
1145 $cats = explode(',', $poll['categories']);
1146 $poll['categories'] = !empty($cats) ? $cats : [];
1147 $all_fields = $this->get_all_formfields();
1148 if (isset($poll['styles']['fields'])) {
1149 $poll['fields'] = array();
1150 $fields = explode(',', $poll['styles']['fields']);
1151 foreach ( $fields as $field ) {
1152 $index = array_search($field, array_column($all_fields, 'slug'));
1153 if ($index !== false) {
1154 $poll['fields'][] = $all_fields[$index];
1155 }
1156 }
1157 }
1158 if (isset($poll['styles']['required_fields'])) {
1159 $poll['required_fields'] = array();
1160 $fields = explode(',', $poll['styles']['required_fields']);
1161 foreach ( $fields as $field ) {
1162 $index = array_search($field, array_column($all_fields, 'slug'));
1163 if ($index !== false) {
1164 $poll['required_fields'][] = $all_fields[$index];
1165 }
1166 }
1167 }
1168 }
1169
1170 return $poll;
1171 }
1172
1173 public function get_all_formfields() {
1174 global $wpdb;
1175 $all = array(
1176 array(
1177 "id" => 0,
1178 "name" => "Name",
1179 "type" => "text",
1180 "slug" => "apm-name",
1181 "published" => 1,
1182 ),
1183 array(
1184 "id" => 0,
1185 "name" => "E-mail",
1186 "type" => "email",
1187 "slug" => "apm-email",
1188 "published" => 1,
1189 ),
1190 array(
1191 "id" => 0,
1192 "name" => "Phone",
1193 "type" => "tel",
1194 "slug" => "apm_phone",
1195 "published" => 1,
1196 ),
1197 );
1198
1199 return $all;
1200 }
1201
1202 public function screen_option_settings() {
1203 $this->polls_obj = new Polls_List_Table($this->plugin_name);
1204 $this->settings_obj = new Poll_Maker_Settings_Actions($this->plugin_name);
1205 }
1206
1207 public function display_plugin_settings_page() {
1208 include_once('partials/settings/poll-maker-settings.php');
1209 }
1210
1211 public function ays_get_mailchimp_lists( $username, $api_key ) {
1212 if (!empty($api_key) && strpos($api_key, '-') !== false) {
1213 $api_postfix = explode("-", $api_key)[1];
1214
1215 $curl = curl_init();
1216
1217 curl_setopt_array($curl, array(
1218 CURLOPT_URL => "https://" . $api_postfix . ".api.mailchimp.com/3.0/lists",
1219 CURLOPT_RETURNTRANSFER => true,
1220 CURLOPT_ENCODING => "",
1221 CURLOPT_MAXREDIRS => 10,
1222 CURLOPT_TIMEOUT => 30,
1223 CURLOPT_SSL_VERIFYPEER => false,
1224 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
1225 CURLOPT_CUSTOMREQUEST => "GET",
1226 CURLOPT_USERPWD => "$username:$api_key",
1227 CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
1228 // CURLOPT_POSTFIELDS => "undefined=",
1229 CURLOPT_HTTPHEADER => array(
1230 "Content-Type: application/json",
1231 "cache-control: no-cache"
1232 ),
1233 ));
1234
1235 $response = curl_exec($curl);
1236 $err = curl_error($curl);
1237
1238 curl_close($curl);
1239
1240 if ($err) {
1241 echo "cURL Error";
1242 } else {
1243 return json_decode($response, true);
1244 }
1245 }
1246
1247 return array();
1248 }
1249
1250 public function ays_poll_create_author() {
1251
1252 // Check for permissions.
1253 if ( !Poll_Maker_Data::check_user_capability() ) {
1254 ob_end_clean();
1255 $ob_get_clean = ob_get_clean();
1256 echo json_encode(array(
1257 'results' => array()
1258 ));
1259 wp_die();
1260 }
1261
1262 $search = isset($_REQUEST['search']) && $_REQUEST['search'] != '' ? sanitize_text_field($_REQUEST['search']) : null;
1263 $checked = isset($_REQUEST['val']) && $_REQUEST['val'] != '' ? sanitize_text_field($_REQUEST['val']) : null;
1264 $args = array(
1265 'fields' => array('ID', 'display_name', 'user_email', 'user_login', 'user_nicename')
1266 );
1267
1268 if ($search !== null) {
1269 $args['search'] = '*' . esc_attr($search) . '*';
1270 $args['search_columns'] = array('ID', 'user_login', 'user_nicename', 'user_email', 'display_name');
1271 }
1272
1273 $user_query = new WP_User_Query($args);
1274 $users = $user_query->get_results();
1275 $response = array(
1276 'results' => array()
1277 );
1278
1279 if(empty($args)){
1280 $reports_users = '';
1281 }
1282
1283 foreach ($users as $key => $user) {
1284 if ($checked !== null) {
1285 if ($user->ID == $checked) {
1286 continue;
1287 }else{
1288 $response['results'][] = array(
1289 'id' => $user->ID,
1290 'text' => $user->display_name
1291 );
1292 }
1293 }else{
1294 $response['results'][] = array(
1295 'id' => $user->ID,
1296 'text' => $user->display_name,
1297 );
1298 }
1299 }
1300
1301 ob_end_clean();
1302 echo json_encode($response);
1303 wp_die();
1304 }
1305
1306 public static function validateDate($date, $format = 'Y-m-d H:i:s'){
1307 $d = DateTime::createFromFormat($format, $date);
1308 return $d && $d->format($format) == $date;
1309 }
1310
1311 public static function is_classic_editor_plugin_active() {
1312 if ( ! function_exists( 'is_plugin_active' ) ) {
1313 include_once ABSPATH . 'wp-admin/includes/plugin.php';
1314 }
1315
1316 if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
1317 return true;
1318 }
1319
1320 return false;
1321 }
1322
1323 public static function is_active_gutenberg() {
1324 // Gutenberg plugin is installed and activated.
1325 $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
1326 // Block editor since 5.0.
1327 $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
1328
1329 if ( ! $gutenberg && ! $block_editor ) {
1330 return false;
1331 }
1332
1333 if ( self::is_classic_editor_plugin_active() ) {
1334 $editor_option = get_option( 'classic-editor-replace' );
1335 $block_editor_active = array( 'no-replace', 'block' );
1336
1337 return in_array( $editor_option, $block_editor_active, true );
1338 }
1339
1340 return true;
1341 }
1342
1343 public static function ays_restriction_string($type, $x, $length){
1344 $output = "";
1345 switch($type){
1346 case "char":
1347 if(strlen($x)<=$length){
1348 $output = $x;
1349 } else {
1350 $output = substr($x,0,$length) . '...';
1351 }
1352 break;
1353 case "word":
1354 $res = explode(" ", $x);
1355 if(count($res)<=$length){
1356 $output = implode(" ",$res);
1357 } else {
1358 $res = array_slice($res,0,$length);
1359 $output = implode(" ",$res) . '...';
1360 }
1361 break;
1362 }
1363 return $output;
1364 }
1365
1366 public static function get_listtables_title_length( $listtable_name ) {
1367 global $wpdb;
1368
1369 $settings_table = $wpdb->prefix . "ayspoll_settings";
1370 $sql = "SELECT meta_value FROM ".$settings_table." WHERE meta_key = 'options'";
1371 $result = $wpdb->get_var($sql);
1372 $options = ($result == "") ? array() : json_decode($result, true);
1373
1374 $listtable_title_length = 5;
1375 if(! empty($options) ){
1376 switch ( $listtable_name ) {
1377 case 'polls':
1378 $listtable_title_length = (isset($options['poll_title_length']) && intval($options['poll_title_length']) != 0) ? absint(intval($options['poll_title_length'])) : 5;
1379 break;
1380 case 'categories':
1381 $listtable_title_length = (isset($options['poll_category_title_length']) && intval($options['poll_category_title_length']) != 0) ? absint(intval($options['poll_category_title_length'])) : 5;
1382 break;
1383 case 'results':
1384 $listtable_title_length = (isset($options['poll_results_title_length']) && intval($options['poll_results_title_length']) != 0) ? absint(intval($options['poll_results_title_length'])) : 5;
1385 break;
1386 default:
1387 $listtable_title_length = 5;
1388 break;
1389 }
1390 return $listtable_title_length;
1391 }
1392 return $listtable_title_length;
1393 }
1394
1395 public function poll_maker_select_submenu($file) {
1396 global $plugin_page;
1397 if ("poll-maker-ays-results-each" == $plugin_page) {
1398 $plugin_page = $this->plugin_name."-results";
1399 }
1400
1401 return $file;
1402 }
1403
1404 protected function poll_maker_capabilities(){
1405 global $wpdb;
1406 $sql = "SELECT meta_value FROM {$wpdb->prefix}ayspoll_settings WHERE `meta_key` = 'user_roles'";
1407 $result = $wpdb->get_var($sql);
1408
1409 $capability = 'manage_options';
1410 if($result !== null){
1411 $ays_user_roles = json_decode($result, true);
1412 if(is_user_logged_in()){
1413 $current_user = wp_get_current_user();
1414 $current_user_roles = $current_user->roles;
1415 $ishmar = 0;
1416 foreach($current_user_roles as $r){
1417 if(in_array($r, $ays_user_roles)){
1418 $ishmar++;
1419 }
1420 }
1421 if($ishmar > 0){
1422 $capability = "read";
1423 }
1424 }
1425 }
1426 return $capability;
1427 }
1428
1429 public function ays_poll_exclude_custom_post_type_from_sitemap($exclude, $type){
1430 if($type == 'ays-poll-maker'){
1431 return $type;
1432 }
1433 }
1434
1435 public function ays_poll_add_checklist_guide(){
1436
1437 if(!empty($_REQUEST['page']) && sanitize_text_field( $_REQUEST['page'] ) != $this->plugin_name . "-getting-started"){
1438 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
1439 $current_user_id = get_current_user_id();
1440 $completed_steps = get_user_meta($current_user_id, 'ays_poll_checklist_completed_steps', true);
1441
1442 // Make sure we always get an array
1443 if (!is_array($completed_steps)) {
1444 $completed_steps = array();
1445 }
1446
1447 $popup_closed = get_user_meta($current_user_id, 'ays_poll_checklist_popup_closed', true);
1448
1449 $checklist_steps = array(
1450 array(
1451 'title' => esc_html__('Add a New Poll', 'poll-maker'),
1452 ),
1453 array(
1454 'title' => esc_html__('Add Options', 'poll-maker'),
1455 ),
1456 array(
1457 'title' => esc_html__('Save the Poll', 'poll-maker'),
1458 ),
1459 array(
1460 'title' => esc_html__('Copy the Shortcode', 'poll-maker'),
1461 'img_style' => 'object-fit:contain; height:auto;',
1462 ),
1463 );
1464 ?>
1465 <div class="ays-poll-checklist-panel" id="ays-poll-checklist-container" style="<?php echo ($popup_closed) ? 'display: none;' : ''; ?>">
1466 <header class="ays-poll-checklist-header">
1467 <h3><?php echo esc_html__('Create a Poll with 4 Easy Steps', 'poll-maker'); ?></h3>
1468
1469 <!-- Minimize Button -->
1470 <button class="ays-poll-checklist-minimize-btn" aria-label="Minimize">
1471 <svg class="ays-poll-checklist-minimize-icon-expanded" width="24" height="24" viewBox="0 0 24 24" fill="none">
1472 <path d="M6 12h12" stroke="#000" stroke-width="2" stroke-linecap="round"/>
1473 </svg>
1474 <svg class="ays-poll-checklist-minimize-icon-collapsed" style="display:none;" width="24" height="24" viewBox="0 0 24 24">
1475 <path fill-rule="evenodd" clip-rule="evenodd" d="M4 3.25H8C8.41421 3.25 8.75 3.58579 8.75 4C8.75 4.41421 8.41421 4.75 8 4.75H5.81066L10.5303 9.46967C10.8232 9.76256 10.8232 10.2374 10.5303 10.5303C10.2374 10.8232 9.76256 10.8232 9.46967 10.5303L4.75 5.81066V8C4.75 8.41421 4.41421 8.75 4 8.75C3.58579 8.75 3.25 8.41421 3.25 8V4C3.25 3.58579 3.58579 3.25 4 3.25ZM13.4697 13.4697C13.7626 13.1768 14.2374 13.1768 14.5303 13.4697L19.25 18.1893V16C19.25 15.5858 19.5858 15.25 20 15.25C20.4142 15.25 20.75 15.5858 20.75 16V20C20.75 20.4142 20.4142 20.75 20 20.75H16C15.5858 20.75 15.25 20.4142 15.25 20C15.25 19.5858 15.5858 19.25 16 19.25H18.1893L13.4697 14.5303C13.1768 14.2374 13.1768 13.7626 13.4697 13.4697Z"></path>
1476 </svg>
1477 </button>
1478
1479 <!-- Close Button -->
1480 <button class="ays-poll-checklist-close-btn" aria-label="Close"><svg width="24" height="24" class="" focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M18.5303 5.46967C18.8232 5.76256 18.8232 6.23744 18.5303 6.53033L6.53033 18.5303C6.23744 18.8232 5.76256 18.8232 5.46967 18.5303C5.17678 18.2374 5.17678 17.7626 5.46967 17.4697L17.4697 5.46967C17.7626 5.17678 18.2374 5.17678 18.5303 5.46967Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M5.46967 5.46967C5.76256 5.17678 6.23744 5.17678 6.53033 5.46967L18.5303 17.4697C18.8232 17.7626 18.8232 18.2374 18.5303 18.5303C18.2374 18.8232 17.7626 18.8232 17.4697 18.5303L5.46967 6.53033C5.17678 6.23744 5.17678 5.76256 5.46967 5.46967Z"></path></svg></button>
1481 </header>
1482
1483 <div class="ays-poll-checklist-progress">
1484 <div class="ays-poll-checklist-progress-bar"><span style="width: 0%"></span></div>
1485 <span class="ays-poll-checklist-progress-text">0%</span>
1486 </div>
1487
1488 <ul class="ays-poll-checklist-items">
1489 <?php foreach ($checklist_steps as $index => $step):
1490 $is_checked = in_array($index, $completed_steps);
1491 ?>
1492 <li class="ays-poll-checklist-step<?php echo $is_checked ? ' completed' : ''; ?>" data-step="<?php echo esc_attr($index); ?>">
1493 <div class="ays-poll-checklist-header-row">
1494 <label>
1495 <input type="checkbox" <?php checked($is_checked); ?> />
1496 <span class="ays-poll-checklist-step-title"><?php echo esc_html($step['title']); ?></span>
1497 </label>
1498 </div>
1499 </li>
1500 <?php endforeach; ?>
1501 </ul>
1502 <style>
1503 #ays-poll-checklist-container.ays-poll-checklist-panel{max-width:100%;background:#fff;font-family:Arial,sans-serif;overflow:hidden;margin:0 auto;color:#0c0d0e;box-shadow:rgba(0,0,0,.2) 0 3px 5px -1px,rgba(0,0,0,.14) 0 5px 8px 0,rgba(0,0,0,.12) 0 1px 14px 0;position:fixed;width:360px;bottom:40px;inset-inline-end:40px;z-index:99999;max-height:730px;overflow-y:auto;transition:box-shadow .3s cubic-bezier(.4, 0, .2, 1);border-radius:4px}#ays-poll-checklist-container .ays-poll-checklist-header{box-shadow:none;display:flex;flex-direction:row;align-items:center;width:100%;box-sizing:border-box;flex-shrink:0;position:sticky;z-index:1100;top:0;left:auto;right:0;color:rgba(0,0,0,.87);background-color:#fff;transition:box-shadow .3s cubic-bezier(.4, 0, .2, 1);padding:16px}#ays-poll-checklist-container .ays-poll-checklist-header-row{-webkit-tap-highlight-color:transparent;background-color:transparent;user-select:none;vertical-align:middle;appearance:none;display:flex;-webkit-box-flex:1;flex-grow:1;-webkit-box-pack:start;justify-content:space-between;-webkit-box-align:center;align-items:center;position:relative;min-width:0;box-sizing:border-box;text-align:left;padding:0;color:#0c0d0e;outline:0;border:0;margin:0;border-radius:0;text-decoration:none;transition:background-color 150ms cubic-bezier(.4, 0, .2, 1)}#ays-poll-checklist-container .ays-poll-checklist-header h3{box-sizing:content-box;display:inline;height:auto;padding:0;width:auto;text-transform:none;margin:0;font-weight:600;line-height:1.3;font-family:Arial,sans-serif;font-size:1rem;letter-spacing:.00938em;-webkit-box-flex:1;flex-grow:1}#ays-poll-checklist-container .ays-poll-checklist-close-btn,#ays-poll-checklist-container .ays-poll-checklist-minimize-btn{border:none;background:0 0;font-size:20px;cursor:pointer;outline:unset;transition:background-color .3s ease-in-out;border-radius:4px}#ays-poll-checklist-container .ays-poll-checklist-close-btn:hover,#ays-poll-checklist-container .ays-poll-checklist-minimize-btn:hover{background-color:rgba(0,0,0,.04)}#ays-poll-checklist-container .ays-poll-checklist-progress{display:flex;align-items:center;padding:12px 16px;border-bottom:1px solid #eee}#ays-poll-checklist-container .ays-poll-checklist-progress-bar{flex:1;background:#eee;height:6px;border-radius:4px;margin-right:10px;overflow:hidden}#ays-poll-checklist-container .ays-poll-checklist-progress-bar span{display:block;height:100%;background:#00a0d2;transition:width .3s ease-in-out}#ays-poll-checklist-container .ays-poll-checklist-progress-text{font-size:13px;min-width:30px}#ays-poll-checklist-container .ays-poll-checklist-items{list-style:none;padding:0;margin:0}#ays-poll-checklist-container .ays-poll-checklist-step{padding:12px 16px;border-bottom:1px solid #f0f0f0;transition:background .2s}#ays-poll-checklist-container .ays-poll-checklist-step:hover{background-color:#f9f9f9}#ays-poll-checklist-container .ays-poll-checklist-step label{display:flex;align-items:center;cursor:pointer}#ays-poll-checklist-container .ays-poll-checklist-step input[type=checkbox]{margin-right:10px}#ays-poll-checklist-container .ays-poll-checklist-step.completed label span{text-decoration:line-through;opacity:.6}#ays-poll-checklist-container .ays-poll-checklist-step-title{margin:0;font-family:Arial,sans-serif;font-weight:400;font-size:.875rem;letter-spacing:.01071em;display:block}#ays-poll-checklist-container .ays-poll-checklist-step-content{display:none;margin-top:12px}#ays-poll-checklist-container .ays-poll-checklist-step-content img{width:100%;max-width:100%;border-radius:4px;margin-bottom:0;height:180px;object-fit:contain}#wpwrap #wpfooter #ays-poll-checklist-container .ays-poll-checklist-step-content p{margin:0;font-size:13px;padding:16px 0}#ays-poll-checklist-container .ays-poll-checklist-step-content a:not(.ays-poll-checklist-primary-action){color:#0073aa;text-decoration:underline}#ays-poll-checklist-container .ays-poll-checklist-actions{display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:end;justify-content:flex-end;padding-bottom:12px}#ays-poll-checklist-container .ays-poll-checklist-mark-done,#ays-poll-checklist-container .ays-poll-checklist-primary-action{display:inline-flex;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;user-select:none;vertical-align:middle;appearance:none;text-transform:none;font-family:Arial,sans-serif;font-weight:500;font-size:.8125rem;line-height:1.75;letter-spacing:.02857em;min-width:64px;box-shadow:none;outline:0;text-decoration:none;padding:4px 10px;transition:background-color 250ms cubic-bezier(.4, 0, .2, 1),box-shadow 250ms cubic-bezier(.4, 0, .2, 1),border-color 250ms cubic-bezier(.4, 0, .2, 1),color 250ms cubic-bezier(.4, 0, .2, 1);white-space:nowrap;cursor:pointer}#ays-poll-checklist-container .ays-poll-checklist-mark-done{-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;background-color:transparent;color:#515962;border:0;margin:0;border-radius:4px}#ays-poll-checklist-container .ays-poll-checklist-mark-done:hover{color:#515962;text-decoration:none;background-color:rgba(81,89,98,.04)}#ays-poll-checklist-container .ays-poll-checklist-primary-action{-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;color:#fff;background-color:#00a0d2;border:0 initial initial;border-image:initial;margin:0 0 0 8px;border-radius:4px}#ays-poll-checklist-container .ays-poll-checklist-toggle-step{background:0 0;border:none;font-size:16px;cursor:pointer;transform:rotate(0);transition:transform .2s}#ays-poll-checklist-container .ays-poll-checklist-toggle-step.open{transform:rotate(180deg)}#ays-poll-checklist-container.ays-poll-checklist-panel.ays-poll-checklist-minimized .ays-poll-checklist-items{display:none}.ays-poll-launch-icon::after{content:"";width:8px;height:8px;background-color:#d179f2;border-radius:50%;position:absolute;top:0;right:0}.ays-poll-checklist-open-icon{position:absolute;bottom:36px;right:20px;cursor:pointer}@media (max-width:1280px){div#ays-poll-checklist-container.ays-poll-checklist-panel{max-height:580px;width:300px;bottom:20px;inset-inline-end:20px}div#ays-poll-checklist-container .ays-poll-checklist-step-content img{height:150px}}@media (max-width:782px){#ays-poll-checklist-container.ays-poll-checklist-panel,.ays-poll-checklist-open-icon{display:none}}@media (max-width:480px){#ays-poll-checklist-container.ays-poll-checklist-panel{border-radius:0;max-width:100%}#ays-poll-checklist-container .ays-poll-checklist-header h3{font-size:16px}#ays-poll-checklist-container .ays-poll-checklist-step-content p{font-size:13px}#ays-poll-checklist-container .ays-poll-checklist-actions{flex-direction:column}}
1504 </style>
1505 </div>
1506 <?php
1507 }
1508 }
1509
1510 }
1511
1512 public function ays_poll_save_checklist_progress() {
1513 check_ajax_referer('ays_poll_nonce', 'nonce');
1514
1515 $user_can_capability = self::poll_maker_capabilities();
1516
1517 // Check for permissions.
1518 if ( ! current_user_can( $user_can_capability ) ) {
1519 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1520 }
1521
1522 if( !is_user_logged_in() ) {
1523 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1524 }
1525
1526 $user_id = get_current_user_id();
1527 $steps = isset($_POST['steps']) ? array_map('sanitize_text_field', $_POST['steps']) : array();
1528
1529 update_user_meta($user_id, 'ays_poll_checklist_completed_steps', $steps);
1530
1531 wp_send_json_success(array('saved' => true));
1532 }
1533
1534 public function ays_poll_checklist_close_popup() {
1535 check_ajax_referer('ays_poll_nonce', 'nonce');
1536
1537 $user_can_capability = self::poll_maker_capabilities();
1538
1539 // Check for permissions.
1540 if ( ! current_user_can( $user_can_capability ) ) {
1541 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1542 }
1543
1544 if (is_user_logged_in()) {
1545 $user_id = get_current_user_id();
1546 update_user_meta($user_id, 'ays_poll_checklist_popup_closed', 1);
1547 wp_send_json_success( esc_html__( 'Popup marked as closed.', 'poll-maker' ) );
1548 }
1549
1550 wp_send_json_error( esc_html__( 'User not logged in.', 'poll-maker' ) );
1551 }
1552
1553 public function ays_poll_checklist_reopen_callback() {
1554 check_ajax_referer('ays_poll_nonce', 'nonce');
1555
1556 $user_can_capability = self::poll_maker_capabilities();
1557
1558 // Check for permissions.
1559 if ( ! current_user_can( $user_can_capability ) ) {
1560 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1561 }
1562
1563 if (is_user_logged_in()) {
1564 $user_id = get_current_user_id();
1565 delete_user_meta($user_id, 'ays_poll_checklist_popup_closed');
1566 wp_send_json_success('Popup reopened.');
1567 }
1568
1569 wp_send_json_error( esc_html__( 'User not logged in.', 'poll-maker' ) );
1570 }
1571
1572 public function get_next_or_prev_row_by_id( $id, $type = "next", $table = "ayspoll_polls" ) {
1573 global $wpdb;
1574
1575 if ( is_null( $table ) || empty( $table ) ) {
1576 return null;
1577 }
1578
1579 $ays_table = esc_sql( $wpdb->prefix . $table );
1580
1581 $where = array();
1582 $where_condition = "";
1583
1584 $id = (isset( $id ) && $id != "" && absint($id) != 0) ? absint( sanitize_text_field( $id ) ) : null;
1585 $type = (isset( $type ) && $type != "") ? sanitize_text_field( $type ) : "next";
1586
1587 if ( is_null( $id ) || $id == 0 ) {
1588 return null;
1589 }
1590
1591 switch ( $type ) {
1592 case 'prev':
1593 $where[] = ' `id` < ' . $id . ' ORDER BY `id` DESC ';
1594 break;
1595 case 'next':
1596 default:
1597 $where[] = ' `id` > ' . $id;
1598 break;
1599 }
1600
1601 if( ! empty($where) ){
1602 $where_condition = " WHERE " . implode( " AND ", $where );
1603 }
1604
1605 $sql = "SELECT `id` FROM {$ays_table} ". $where_condition ." LIMIT 1;";
1606 $results = $wpdb->get_row( $sql, 'ARRAY_A' );
1607
1608 return $results;
1609
1610 }
1611
1612 public function poll_maker_admin_footer($a){
1613 if(isset($_REQUEST['page'])){
1614 if(false !== strpos($_REQUEST['page'], $this->plugin_name)){
1615 ?>
1616 <div class="ays-poll-footer-support-box">
1617 <span class="ays-poll-footer-link-row"><a href="https://wordpress.org/support/plugin/poll-maker/" target="_blank"><?php echo esc_html__( "Support", "poll-maker"); ?></a></span>
1618 <span class="ays-poll-footer-slash-row">/</span>
1619 <span class="ays-poll-footer-link-row"><a href="https://ays-pro.com/wordpress-poll-maker-user-manual" target="_blank"><?php echo esc_html__( "Docs", "poll-maker"); ?></a></span>
1620 <span class="ays-poll-footer-slash-row">/</span>
1621 <span class="ays-poll-footer-link-row"><a href="https://ays-demo.com/poll-maker-plugin-survey/" target="_blank"><?php echo esc_html__( "Suggest a Feature", "poll-maker"); ?></a></span>
1622 </div>
1623 <p style="font-size:13px;text-align:center;font-style:italic;">
1624 <span style="margin-left:0px;margin-right:10px;" class="ays_heart_beat"><i class="ays_fa ays_poll_fa_heart_o animated"></i></span>
1625 <span><?php echo esc_html__( "If you love our plugin, please do big favor and rate us on WordPress.org", "poll-maker"); ?></span>
1626 <a target="_blank" class="ays-rated-link" href='http://bit.ly/3l5I2iG'>
1627 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1628 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1629 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1630 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1631 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1632 </a>
1633 <span class="ays_heart_beat"><i class="ays_fa ays_poll_fa_heart_o animated"></i></span>
1634 </p>
1635 <?php
1636 }
1637 }
1638 }
1639
1640 // Sales baner function
1641 public function ays_poll_sale_baner(){
1642 if(isset($_POST['ays_poll_sale_btn_black_friday'])){
1643 $sale_date = sanitize_text_field($_POST['ays_poll_sale_btn_black_friday']);
1644 update_option('ays_poll_sale_notification_'.$sale_date, 1);
1645 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1646 }
1647
1648 // if (isset($_POST['ays_poll_sale_btn']) && isset( $_POST[$this->plugin_name . '-sale-banner'] )
1649 // && wp_verify_nonce( $_POST[$this->plugin_name . '-sale-banner'], $this->plugin_name . '-sale-banner' ) && current_user_can('manage_options')) {
1650 // $sale_date = 'plugin_sale';
1651 // update_option('ays_poll_sale_btn_'.$sale_date, 1);
1652 // update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1653 // }
1654
1655 if(isset($_POST['ays_poll_sale_btn_poll_countdown_for_two_months'])){
1656 $sale_date = sanitize_text_field($_POST['ays_poll_sale_btn_poll_countdown_for_two_months']);
1657 $dismiss_two_months = true;
1658 update_option('ays_poll_sale_notification_two_months_'.$sale_date, 1);
1659 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1660 }
1661
1662 $one_day = 60*60*24;
1663 $poll_sales = array(
1664 'plugin_sale' => array(
1665 'status' => 'active',
1666 'time' => ($one_day * 5),
1667 ),
1668 'mega_bundle' => array(
1669 'status' => 'inactive',
1670 'time' => ($one_day * 5),
1671 ),
1672 'new_mega_bundle' => array(
1673 'status' => 'inactive',
1674 'time' => ($one_day * 7),
1675 ),
1676 'small_spring' => array(
1677 'status' => 'inactive',
1678 'time' => ($one_day * 7),
1679 ),
1680 'mega_bundle_new' => array(
1681 'status' => 'inactive',
1682 'time' => ($one_day * 7),
1683 ),
1684 'business_bundle' => array(
1685 'status' => 'inactive',
1686 'time' => ($one_day * 7),
1687 ),
1688 'black_friday' => array(
1689 'status' => 'inactive',
1690 'time' => ($one_day * 5),
1691 ),
1692 'winter_bundle' => array(
1693 'status' => 'inactive',
1694 'time' => ($one_day * 5),
1695 ),
1696 'poll_countdown' => array(
1697 'status' => 'inactive',
1698 'time' => ($one_day * 5),
1699 ),
1700 'halloween_bundle' => array(
1701 'status' => 'inactive',
1702 'time' => ($one_day * 5),
1703 ),
1704 'christmas_message' => array(
1705 'status' => 'inactive',
1706 'time' => ($one_day * 7),
1707 ),
1708 );
1709
1710 if (isset($_GET['page']) && strpos($_GET['page'], POLL_MAKER_AYS_NAME) !== false) {
1711 foreach($poll_sales as $sale => $status){
1712 $ays_poll_sale_date = '';
1713 if(isset($status['status']) && $status['status'] == 'active'){
1714 $ays_poll_sale_date = get_option('ays_poll_sale_date_'.$sale);
1715 $ays_poll_two_months_flag = intval(get_option('ays_poll_sale_notification_two_months_'.$sale));
1716 $current_date = current_time( 'mysql' );
1717 $date_diff = strtotime($current_date) - intval(strtotime($ays_poll_sale_date)) ;
1718 $val = isset($status['time']) ? $status['time'] : $one_day * 5;
1719 if($ays_poll_two_months_flag > 0){
1720 $val = $one_day * 60;
1721 }
1722
1723 $days_diff = $date_diff / $val;
1724 if(intval($days_diff) > 0 ){
1725 update_option('ays_poll_sale_notification_'.$sale, 0);
1726 update_option('ays_poll_sale_btn_'.$sale, 0);
1727 update_option('ays_poll_sale_notification_two_months_'.$sale, 0);
1728 }
1729 $ays_poll_flag = intval(get_option('ays_poll_sale_notification_'.$sale));
1730 $ays_poll_flag += intval(get_option('ays_poll_sale_btn_'.$sale));
1731 $ays_poll_flag += $ays_poll_two_months_flag;
1732 if($ays_poll_flag == 0){
1733 $ays_poll_sale_message = 'ays_poll_sale_message_'.$sale;
1734 if ( $this->get_max_id('polls') > 1 ){
1735 // $this->ays_poll_new_halloween_bundle_message_2025();
1736 // $this->ays_poll_black_friday_message();
1737 // $this->ays_poll_christmas_banner_message_2025();
1738 $this->ays_poll_new_mega_bundle_message_2026();
1739 }
1740 }
1741 }
1742 }
1743 }
1744 }
1745
1746 public function ays_poll_dismiss_button(){
1747
1748 $data = array(
1749 'status' => false,
1750 );
1751
1752 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ays_poll_dismiss_button') {
1753 if( (isset( $_REQUEST['_ajax_nonce'] ) && wp_verify_nonce( $_REQUEST['_ajax_nonce'], POLL_MAKER_AYS_NAME . '-sale-banner' )) && current_user_can( 'manage_options' )){
1754 $sale_date = 'plugin_sale';
1755 update_option('ays_poll_sale_btn_'.$sale_date, 1);
1756 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1757 $data['status'] = true;
1758 }
1759 }
1760
1761 ob_end_clean();
1762 $ob_get_clean = ob_get_clean();
1763 echo json_encode($data);
1764 wp_die();
1765
1766 }
1767
1768 // Christmas Banner 2025
1769 public function ays_poll_christmas_banner_message_2025(){
1770 $content = array();
1771
1772 $svg_icon = '<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">
1773 <path fill-rule="evenodd" clip-rule="evenodd" d="M10.0445 0C10.4587 0 10.7945 0.33579 10.7945 0.75V2.93934L12.5141 1.21967C12.807 0.92678 13.2819 0.92678 13.5748 1.21967C13.8677 1.51256 13.8677 1.98744 13.5748 2.28033L10.7945 5.06066V9.451L14.5965 7.25588L15.6142 3.45788C15.7214 3.05778 16.1326 2.82034 16.5327 2.92755C16.9328 3.03475 17.1703 3.44601 17.0631 3.84611L16.4336 6.19522L18.3296 5.10055C18.6884 4.89344 19.147 5.01635 19.3542 5.37507C19.5613 5.73379 19.4384 6.19248 19.0796 6.39959L17.1836 7.49426L19.5327 8.1237C19.9328 8.23091 20.1703 8.64216 20.0631 9.0423C19.9558 9.4424 19.5446 9.6798 19.1445 9.5726L15.3465 8.55492L11.5445 10.75L15.3467 12.9452L19.1447 11.9275C19.5448 11.8203 19.956 12.0578 20.0633 12.4579C20.1705 12.858 19.933 13.2692 19.5329 13.3764L17.1838 14.0059L19.0798 15.1005C19.4386 15.3077 19.5615 15.7663 19.3544 16.1251C19.1472 16.4838 18.6886 16.6067 18.3298 16.3996L16.4338 15.3049L17.0633 17.654C17.1705 18.0541 16.933 18.4654 16.5329 18.5726C16.1328 18.6798 15.7216 18.4424 15.6144 18.0423L14.5967 14.2443L10.7945 12.049V16.4393L13.5748 19.2197C13.8677 19.5126 13.8677 19.9874 13.5748 20.2803C13.2819 20.5732 12.807 20.5732 12.5141 20.2803L10.7945 18.5607V20.75C10.7945 21.1642 10.4587 21.5 10.0445 21.5C9.63033 21.5 9.29453 21.1642 9.29453 20.75V18.5607L7.57484 20.2803C7.28195 20.5732 6.80707 20.5732 6.51418 20.2803C6.22129 19.9874 6.22129 19.5126 6.51418 19.2197L9.29453 16.4393V12.049L5.4923 14.2443L4.47463 18.0423C4.36742 18.4424 3.95617 18.6798 3.55607 18.5726C3.15597 18.4654 2.91853 18.0541 3.02574 17.654L3.65518 15.3049L1.75916 16.3996C1.40044 16.6067 0.941743 16.4838 0.734643 16.1251C0.527533 15.7663 0.650443 15.3077 1.00916 15.1005L2.90518 14.0059L0.556073 13.3764C0.155973 13.2692 -0.081467 12.858 0.0257431 12.4579C0.132943 12.0578 0.544203 11.8203 0.944303 11.9275L4.7423 12.9452L8.54453 10.75L4.74249 8.55492L0.944493 9.5726C0.544393 9.6798 0.133143 9.4424 0.0259331 9.0423C-0.0812669 8.64216 0.156163 8.23091 0.556263 8.1237L2.90538 7.49426L1.00935 6.39959C0.650633 6.19248 0.527733 5.73379 0.734833 5.37507C0.941943 5.01635 1.40063 4.89344 1.75935 5.10055L3.65538 6.19522L3.02593 3.84611C2.91873 3.44601 3.15616 3.03475 3.55626 2.92755C3.95636 2.82034 4.36762 3.05778 4.47482 3.45788L5.49249 7.25588L9.29453 9.451V5.06066L6.51418 2.28033C6.22129 1.98744 6.22129 1.51256 6.51418 1.21967C6.80707 0.92678 7.28195 0.92678 7.57484 1.21967L9.29453 2.93934V0.75C9.29453 0.33579 9.63033 0 10.0445 0Z" fill="white" fill-opacity="0.2"/>
1774 </svg>
1775 ';
1776
1777 $ays_poll_cta_button_link = esc_url('https://ays-pro.com/wordpress/poll-maker?utm_source=dashboard&utm_medium=poll-free&utm_campaign=christmas-sale-banner-' . POLL_MAKER_AYS_VERSION);
1778
1779 $content[] = '<div id="ays-poll-christmas-banner-main" class="notice notice-success is-dismissible ays-poll-christmas-banner-info ays_poll_dicount_info">';
1780 $content[] = '<div id="ays-poll-christmas-banner-month" class="ays-poll-christmas-banner-month">';
1781
1782 // Background effects
1783 $content[] = '<div class="ays-poll-christmas-banner-bg-effects">';
1784 $content[] = '<div class="ays-poll-christmas-banner-bg-gradient-1"></div>';
1785 $content[] = '<div class="ays-poll-christmas-banner-bg-gradient-2"></div>';
1786
1787 // Snowflakes
1788 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 5%; animation-delay: 0s; animation-duration: 8s;">'. $svg_icon .'</div>';
1789 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 15%; animation-delay: 2s; animation-duration: 10s;">'. $svg_icon .'</div>';
1790 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 25%; animation-delay: 4s; animation-duration: 9s;">'. $svg_icon .'</div>';
1791 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 75%; animation-delay: 1s; animation-duration: 11s;">'. $svg_icon .'</div>';
1792 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 85%; animation-delay: 3s; animation-duration: 8s;">'. $svg_icon .'</div>';
1793 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 92%; animation-delay: 5s; animation-duration: 10s;">'. $svg_icon .'</div>';
1794
1795 // Sparkles
1796 $content[] = '<svg class="ays-poll-christmas-banner-sparkle" style="top: 20%; left: 8%; animation-delay: 0s; width: 14px; height: 14px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">';
1797 $content[] = '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>';
1798 $content[] = '</svg>';
1799 $content[] = '<svg class="ays-poll-christmas-banner-sparkle" style="top: 60%; left: 3%; animation-delay: 0.5s; width: 10px; height: 10px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">';
1800 $content[] = '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>';
1801 $content[] = '</svg>';
1802 $content[] = '<svg class="ays-poll-christmas-banner-sparkle" style="top: 30%; right: 12%; animation-delay: 1s; width: 12px; height: 12px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">';
1803 $content[] = '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>';
1804 $content[] = '</svg>';
1805 $content[] = '</div>';
1806
1807 // Main content
1808 $content[] = '<div class="ays-poll-christmas-banner-content">';
1809 $content[] = '<div class="ays-poll-christmas-banner-left">';
1810 // Gift icon with hat
1811 $content[] = '<div class="ays-poll-christmas-banner-gift-wrapper">';
1812 $content[] = '<svg class="ays-poll-christmas-banner-gift-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">';
1813 $content[] = '<rect x="3" y="8" width="18" height="4" rx="1"></rect>';
1814 $content[] = '<path d="M12 8v13"></path>';
1815 $content[] = '<path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path>';
1816 $content[] = '<path d="M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"></path>';
1817 $content[] = '</svg>';
1818 $content[] = '<div class="ays-poll-christmas-banner-hat">';
1819 $content[] = '<svg viewBox="0 0 24 24" fill="none" class="ays-poll-christmas-banner-hat-svg">';
1820 $content[] = '<path d="M12 2L4 14h16L12 2z" fill="hsl(0 80% 45%)"></path>';
1821 $content[] = '<path d="M4 14c0 2 3.5 3 8 3s8-1 8-3" fill="hsl(0 0% 100%)"></path>';
1822 $content[] = '<circle cx="12" cy="3" r="2" fill="hsl(0 0% 100%)"></circle>';
1823 $content[] = '</svg>';
1824 $content[] = '</div>';
1825 $content[] = '</div>';
1826
1827 $content[] = '<div class="ays-poll-christmas-banner-special-label">';
1828 $content[] = '<div class="ays-poll-christmas-banner-special-label-name">';
1829 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-christmas-banner-special-label-name-link" target="_blank">';
1830 $content[] = __( 'Poll Maker', "poll-maker" );
1831 $content[] = '</a>';
1832 $content[] = '</div>';
1833
1834 $content[] = '<div>✦ ' . __( 'CHRISTMAS SPECIAL', "poll-maker" ) . ' ✦</div>';
1835 $content[] = '</div>';
1836 $content[] = '</div>';
1837
1838 $content[] = '<div class="ays-poll-christmas-banner-center">';
1839 $content[] = '<div class="ays-poll-christmas-banner-discount-text">25% OFF</div>';
1840 $content[] = '<div class="ays-poll-christmas-banner-limited-offer">' . __( 'Limited time offer', "poll-maker" ) . '</div>';
1841 $content[] = '</div>';
1842
1843 $content[] = '<div class="ays-poll-christmas-banner-right">';
1844 $content[] = '<div class="ays-poll-christmas-banner-coupon-box" onclick="aysPollChristmasCopyToClipboard(\'XMAS25\')" title="' . __( 'Click to copy', "poll-maker" ) . '">';
1845 $content[] = '<span class="ays-poll-christmas-banner-coupon-text">XMAS25</span>';
1846 $content[] = '<svg class="ays-poll-christmas-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
1847 $content[] = '<path d="M13.5 2.5H6.5C5.67 2.5 5 3.17 5 4V10C5 10.83 5.67 11.5 6.5 11.5H13.5C14.33 11.5 15 10.83 15 10V4C15 3.17 14.33 2.5 13.5 2.5ZM13.5 10H6.5V4H13.5V10ZM2.5 6.5V12.5C2.5 13.33 3.17 14 4 14H10V12.5H4V6.5H2.5Z" fill="white"/>';
1848 $content[] = '</svg>';
1849 $content[] = '</div>';
1850
1851 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-christmas-banner-buy-now-btn" target="_blank">';
1852 $content[] = __( 'Buy Now', "poll-maker" );
1853 $content[] = '</a>';
1854 $content[] = '</div>';
1855 $content[] = '</div>';
1856
1857 $content[] = '</div>';
1858
1859 if( current_user_can( 'manage_options' ) ){
1860 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
1861 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
1862 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="color: darkgrey; font-size: 11px; padding: 0 .75rem;">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
1863 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
1864 $content[] = '</form>';
1865 $content[] = '</div>';
1866 }
1867
1868 $content[] = '</div>';
1869
1870 $content[] = '<script>';
1871 $content[] = "
1872 function aysPollChristmasCopyToClipboard(text) {
1873 var textarea = document.createElement('textarea');
1874 textarea.value = text;
1875 textarea.style.position = 'fixed';
1876 textarea.style.opacity = '0';
1877 document.body.appendChild(textarea);
1878
1879 textarea.select();
1880 textarea.setSelectionRange(0, 99999);
1881
1882 try {
1883 document.execCommand('copy');
1884 aysPollChristmasShowCopyNotification('" . __( 'Coupon code copied!', "poll-maker" ) . "');
1885 } catch (err) {
1886 console.error('Failed to copy text: ', err);
1887 }
1888
1889 document.body.removeChild(textarea);
1890 }
1891
1892 function aysPollChristmasShowCopyNotification(message) {
1893 var existingNotification = document.querySelector('.ays-poll-christmas-banner-copy-notification');
1894 if (existingNotification) {
1895 document.body.removeChild(existingNotification);
1896 }
1897
1898 var notification = document.createElement('div');
1899 notification.className = 'ays-poll-christmas-banner-copy-notification';
1900 notification.textContent = message;
1901 document.body.appendChild(notification);
1902
1903 setTimeout(function() {
1904 notification.classList.add('show');
1905 }, 10);
1906
1907 setTimeout(function() {
1908 notification.classList.remove('show');
1909 setTimeout(function() {
1910 if (notification.parentNode) {
1911 document.body.removeChild(notification);
1912 }
1913 }, 300);
1914 }, 2000);
1915 }";
1916 $content[] = '</script>';
1917
1918 $content[] = '<style>';
1919 $content[] = '
1920 /* Christmas banner start */
1921
1922 div#ays-poll-christmas-banner-main .btn-link {
1923 background-color: transparent;
1924 display: inline-block;
1925 font-weight: 400;
1926 text-align: center;
1927 white-space: nowrap;
1928 vertical-align: middle;
1929 -webkit-user-select: none;
1930 -moz-user-select: none;
1931 -ms-user-select: none;
1932 user-select: none;
1933 border: 1px solid transparent;
1934 padding: .375rem .75rem;
1935 font-size: 12px;
1936 line-height: 1.5;
1937 border-radius: .25rem;
1938 color: rgba(255, 255, 255, .6);
1939 }
1940
1941 div#ays-poll-christmas-banner-main.ays-poll-christmas-banner-info {
1942 background: linear-gradient(to right, hsl(0, 70%, 28%), hsl(0, 65%, 38%), hsl(0, 70%, 28%));
1943 padding: unset;
1944 border-left: 0;
1945 position: relative;
1946 }
1947
1948 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-month {
1949 position: relative;
1950 padding: 15px 40px;
1951 overflow: hidden;
1952 }
1953
1954 /* Background effects */
1955 .ays-poll-christmas-banner-bg-effects {
1956 position: absolute;
1957 top: 0;
1958 left: 0;
1959 right: 0;
1960 bottom: 0;
1961 pointer-events: none;
1962 z-index: 1;
1963 }
1964
1965 .ays-poll-christmas-banner-bg-gradient-1 {
1966 position: absolute;
1967 top: 0;
1968 left: 30%;
1969 width: 40%;
1970 height: 100%;
1971 background: radial-gradient(circle, rgba(202, 43, 43, 0.5) 0%, transparent 60%);
1972 opacity: 0.4;
1973 }
1974
1975 .ays-poll-christmas-banner-bg-gradient-2 {
1976 position: absolute;
1977 top: 0;
1978 right: 15%;
1979 width: 35%;
1980 height: 100%;
1981 background: radial-gradient(circle, rgba(246, 201, 85, 0.15) 0%, transparent 50%);
1982 opacity: 0.3;
1983 }
1984
1985 .ays-poll-christmas-banner-snowflake {
1986 position: absolute;
1987 color: rgba(255, 255, 255, 0.2);
1988 font-size: 20px;
1989 animation: ays-poll-christmas-snowfall linear infinite;
1990 top: -10px;
1991 }
1992
1993 @keyframes ays-poll-christmas-snowfall {
1994 0% {
1995 transform: translateY(-10px) rotate(0deg);
1996 opacity: 0;
1997 }
1998 10% {
1999 opacity: 0.8;
2000 }
2001 90% {
2002 opacity: 0.8;
2003 }
2004 100% {
2005 transform: translateY(100%) rotate(360deg);
2006 opacity: 0;
2007 }
2008 }
2009
2010 .ays-poll-christmas-banner-sparkle {
2011 position: absolute;
2012 color: hsl(43, 90%, 65%);
2013 animation: ays-poll-christmas-twinkle 2s ease-in-out infinite;
2014 }
2015
2016 @keyframes ays-poll-christmas-twinkle {
2017 0%, 100% {
2018 opacity: 0.3;
2019 transform: scale(0.8);
2020 }
2021 50% {
2022 opacity: 1;
2023 transform: scale(1.2);
2024 }
2025 }
2026
2027 /* Main content */
2028 .ays-poll-christmas-banner-content {
2029 position: relative;
2030 display: flex;
2031 align-items: center;
2032 justify-content: space-between;
2033 z-index: 2;
2034 }
2035
2036 /* Left section */
2037 .ays-poll-christmas-banner-left {
2038 display: flex;
2039 align-items: center;
2040 gap: 50px;
2041 }
2042
2043 .ays-poll-christmas-banner-gift-wrapper {
2044 position: relative;
2045 animation: ays-poll-christmas-float 3s ease-in-out infinite;
2046 }
2047
2048 .ays-poll-christmas-banner-gift-icon {
2049 width: 48px;
2050 height: 48px;
2051 color: rgba(255, 247, 237, 0.9);
2052 }
2053
2054 @keyframes ays-poll-christmas-float {
2055 0%, 100% {
2056 transform: translateY(0);
2057 }
2058 50% {
2059 transform: translateY(-5px);
2060 }
2061 }
2062
2063 .ays-poll-christmas-banner-hat {
2064 position: absolute;
2065 top: -12px;
2066 right: -4px;
2067 width: 24px;
2068 height: 24px;
2069 }
2070
2071 .ays-poll-christmas-banner-hat-svg {
2072 width: 100%;
2073 height: 100%;
2074 }
2075
2076 .ays-poll-christmas-banner-special-label {
2077 color: hsl(43, 90%, 65%);
2078 font-size: 14px;
2079 font-weight: 500;
2080 text-transform: uppercase;
2081 letter-spacing: 1px;
2082 /* font-family: "Outfit", sans-serif; */
2083 }
2084
2085 .ays-poll-christmas-banner-special-label-name {
2086 color: #fffaf0;
2087 text-align: center;
2088 }
2089
2090 div#ays-poll-christmas-banner-main .ays-poll-christmas-banner-special-label-name-link {
2091 color: #fffaf0;
2092 box-shadow: unset;
2093 }
2094
2095 /* Center section */
2096 .ays-poll-christmas-banner-center {
2097 display: flex;
2098 flex-direction: row;
2099 text-align: center;
2100 justify-content: center;
2101 align-items: center;
2102 gap: 30px;
2103 }
2104
2105 .ays-poll-christmas-banner-discount-text {
2106 font-family: "Outfit", sans-serif;
2107 font-weight: 800;
2108 font-size: 30px;
2109 color: hsl(40, 100%, 97%);
2110 letter-spacing: -1px;
2111 line-height: 1;
2112 }
2113
2114 .ays-poll-christmas-banner-limited-offer {
2115 color: rgba(255, 247, 237, 0.7);
2116 font-size: 13px;
2117 font-weight: 500;
2118 }
2119
2120 /* Right section */
2121 .ays-poll-christmas-banner-right {
2122 display: flex;
2123 align-items: center;
2124 gap: 20px;
2125 }
2126
2127 .ays-poll-christmas-banner-coupon-box {
2128 border: 2px dashed rgba(255, 255, 255, 0.4);
2129 padding: 8px 16px;
2130 border-radius: 6px;
2131 background: rgba(255, 255, 255, 0.1);
2132 cursor: pointer;
2133 transition: all 0.3s;
2134 display: flex;
2135 align-items: center;
2136 gap: 8px;
2137 backdrop-filter: blur(10px);
2138 }
2139
2140 .ays-poll-christmas-banner-coupon-box:hover {
2141 background: rgba(255, 255, 255, 0.2);
2142 border-color: rgba(255, 255, 255, 0.6);
2143 transform: translateY(-1px);
2144 }
2145
2146 .ays-poll-christmas-banner-coupon-text {
2147 font-size: 16px;
2148 font-weight: 700;
2149 letter-spacing: 1px;
2150 color: #fff;
2151 font-family: monospace;
2152 }
2153
2154 .ays-poll-christmas-banner-copy-icon {
2155 opacity: 0.8;
2156 transition: opacity 0.3s;
2157 }
2158
2159 .ays-poll-christmas-banner-coupon-box:hover .ays-poll-christmas-banner-copy-icon {
2160 opacity: 1;
2161 }
2162
2163 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-buy-now-btn {
2164 background-color: #fbe19f;
2165 color: hsl(0, 72%, 35%);
2166 padding: 10px 30px;
2167 border-radius: 9999px;
2168 font-size: 16px;
2169 font-weight: 600;
2170 font-family: "Outfit", sans-serif;
2171 border: none;
2172 cursor: pointer;
2173 transition: all 0.3s;
2174 text-decoration: none;
2175 display: flex;
2176 align-items: center;
2177 gap: 6px;
2178 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 30px rgba(246, 201, 85, 0.2);
2179 }
2180
2181 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-buy-now-btn:hover {
2182 background-color: #f2d58c;
2183 transform: scale(1.05);
2184 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 40px rgba(246, 201, 85, 0.3);
2185 }
2186
2187 .ays-poll-christmas-banner-btn-arrow {
2188 display: inline-block;
2189 transition: transform 0.3s;
2190 }
2191
2192 .ays-poll-christmas-banner-buy-now-btn:hover .ays-poll-christmas-banner-btn-arrow {
2193 transform: translateX(4px);
2194 }
2195
2196 /* Notification */
2197 .ays-poll-christmas-banner-copy-notification {
2198 position: fixed;
2199 top: 50%;
2200 left: 50%;
2201 transform: translate(-50%, -50%);
2202 background: rgba(0, 0, 0, 0.8);
2203 color: #fff;
2204 padding: 12px 24px;
2205 border-radius: 8px;
2206 font-size: 14px;
2207 z-index: 10000;
2208 opacity: 0;
2209 transition: opacity 0.3s;
2210 }
2211
2212 .ays-poll-christmas-banner-copy-notification.show {
2213 opacity: 1;
2214 }
2215
2216 /* Dismiss button */
2217 #ays-poll-christmas-banner-main #ays-poll-christmas-banner-dismiss-content {
2218 display: flex;
2219 justify-content: center;
2220 }
2221
2222 #ays-poll-christmas-banner-main #ays-poll-christmas-banner-dismiss-content .ays-button {
2223 margin: 0 !important;
2224 font-size: 13px;
2225 color: rgba(150, 147, 147, 0.69);
2226 }
2227
2228 /* Responsive */
2229 @media (max-width: 1024px) {
2230 .ays-poll-christmas-banner-discount-text {
2231 font-size: 40px;
2232 }
2233 .ays-poll-christmas-banner-content {
2234 flex-wrap: wrap;
2235 }
2236 }
2237
2238 @media (max-width: 768px) {
2239 #ays-poll-christmas-banner-main {
2240 display: none !important;
2241 }
2242 }
2243 /* Christmas banner end */
2244 ';
2245 $content[] = '</style>';
2246
2247 $content = implode( '', $content );
2248
2249 echo $content;
2250
2251 }
2252
2253 // Black Friday
2254 public function ays_poll_black_friday_message(){
2255
2256 $content = array();
2257
2258 $ays_poll_cta_button_link = esc_url('https://ays-pro.com/wordpress/poll-maker?utm_source=dashboard&utm_medium=poll-free&utm_campaign=black-friday-sale-banner-' . POLL_MAKER_AYS_VERSION);
2259
2260 $content[] = '<div id="ays-poll-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_poll_dicount_info">';
2261 $content[] = '<div id="ays-poll-dicount-black-friday-month" class="ays_poll_dicount_month">';
2262 $content[] = '<div class="ays-poll-dicount-black-friday-box">';
2263 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box ays-poll-dicount-black-friday-wrap-box-80" style="width: 70%;">';
2264 $content[] = '<div class="">';
2265 $content[] = '<div class="ays-poll-dicount-black-friday-title-row" >' . __( 'Coupon Code', "poll-maker" ) .' ' . '</div>';
2266 $content[] = '<div class="ays-poll-dicount-black-friday-title-row">';
2267
2268 $content[] = '
2269 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-wrapper">
2270 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-box" onclick="aysPollHalloweenCopyToClipboard(\'FREE2PROBF\')" title="' . __( 'Click to copy', "poll-maker" ) . '">
2271 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-text">FREE2PROBF</span>
2272 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-poll-dicount-black-friday-banner-2025-copy-icon">
2273 <path d="M13.5 2.5H6.5C5.67 2.5 5 3.17 5 4V10C5 10.83 5.67 11.5 6.5 11.5H13.5C14.33 11.5 15 10.83 15 10V4C15 3.17 14.33 2.5 13.5 2.5ZM13.5 10H6.5V4H13.5V10ZM2.5 6.5V12.5C2.5 13.33 3.17 14 4 14H10V12.5H4V6.5H2.5Z" fill="white"/>
2274 </svg>
2275 </span>
2276 </span>';
2277 $content[] = '</div> ';
2278 $content[] = '</div>';
2279
2280 $content[] = '</div>';
2281
2282 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box ays-poll-dicount-black-friday-wrap-text-box">';
2283 $content[] = '<div class="ays-poll-dicount-black-friday-text-row">' . '30% off' . '</div>';
2284 $content[] = '</div>';
2285
2286 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box" style="width: 25%;">';
2287 $content[] = '<div id="ays-poll-countdown-main-container">';
2288 $content[] = '<div class="ays-poll-countdown-container">';
2289 $content[] = '<div id="ays-poll-countdown" style="display: block;">';
2290 $content[] = '<ul>';
2291 $content[] = '<li><span id="ays-poll-countdown-days"></span>' . __( 'Days', "poll-maker" ) . '</li>';
2292 $content[] = '<li><span id="ays-poll-countdown-hours"></span>' . __( 'Hours', "poll-maker" ) . '</li>';
2293 $content[] = '<li><span id="ays-poll-countdown-minutes"></span>' . __( 'Minutes', "poll-maker" ) . '</li>';
2294 $content[] = '<li><span id="ays-poll-countdown-seconds"></span>' . __( 'Seconds', "poll-maker" ) . '</li>';
2295 $content[] = '</ul>';
2296 $content[] = '</div>';
2297 $content[] = '<div id="ays-poll-countdown-content" class="emoji" style="display: none;">';
2298 $content[] = '<span></span>';
2299 $content[] = '<span></span>';
2300 $content[] = '<span></span>';
2301 $content[] = '<span></span>';
2302 $content[] = '</div>';
2303 $content[] = '</div>';
2304 $content[] = '</div>';
2305 $content[] = '</div>';
2306
2307 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box" style="width: 25%;">';
2308 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-dicount-black-friday-button-buy-now" target="_blank">' . __( 'Get Your Deal', "poll-maker" ) . '</a>';
2309 $content[] = '</div>';
2310 $content[] = '</div>';
2311 $content[] = '</div>';
2312
2313 $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form-black-friday">';
2314 $content[] = '<form action="" method="POST">';
2315 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2316 if( current_user_can( 'manage_options' ) ){
2317 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
2318 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2319 }
2320 $content[] = '</div>';
2321 $content[] = '</form>';
2322 $content[] = '</div>';
2323 $content[] = '</div>';
2324
2325 $content[] = '<script>';
2326 $content[] = "
2327 function aysPollHalloweenCopyToClipboard(text) {
2328 // Create a temporary textarea element
2329 var textarea = document.createElement('textarea');
2330 textarea.value = text;
2331 textarea.style.position = 'fixed';
2332 textarea.style.opacity = '0';
2333 document.body.appendChild(textarea);
2334
2335 // Select and copy the text
2336 textarea.select();
2337 textarea.setSelectionRange(0, 99999); // For mobile devices
2338
2339 try {
2340 document.execCommand('copy');
2341 aysPollHalloweenShowCopyNotification('Coupon code copied!');
2342 } catch (err) {
2343 console.error('Failed to copy text: ', err);
2344 }
2345
2346 // Remove the temporary textarea
2347 document.body.removeChild(textarea);
2348 }
2349
2350 function aysPollHalloweenShowCopyNotification(message) {
2351 // Check if notification already exists
2352 var existingNotification = document.querySelector('.ays-poll-discount-black-friday-banner-2025-copy-notification');
2353 if (existingNotification) {
2354 document.body.removeChild(existingNotification);
2355 }
2356
2357 // Create notification element
2358 var notification = document.createElement('div');
2359 notification.className = 'ays-poll-discount-black-friday-banner-2025-copy-notification';
2360 notification.textContent = message;
2361 document.body.appendChild(notification);
2362
2363 // Show notification with animation
2364 setTimeout(function() {
2365 notification.classList.add('show');
2366 }, 10);
2367
2368 // Hide and remove notification after 2 seconds
2369 setTimeout(function() {
2370 notification.classList.remove('show');
2371 setTimeout(function() {
2372 if (notification.parentNode) {
2373 document.body.removeChild(notification);
2374 }
2375 }, 300);
2376 }, 2000);
2377 }";
2378 $content[] = '</script>';
2379
2380 $content[] = '<style>';
2381 $content[] = '
2382 /* Black friday banner start */
2383 div#ays-poll-dicount-black-friday-month-main *{color:#fff}div#ays-poll-dicount-black-friday-month-main div#ays-poll-dicount-black-friday-month a.ays-poll-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-poll-dicount-black-friday-month-main .btn-link{background-color:transparent;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:12px;line-height:1.5;border-radius:.25rem;color:rgba(255,255,255,.6)}div#ays-poll-dicount-black-friday-month-main.ays_poll_dicount_info{background-image:linear-gradient(45deg,#1e101d,#c60af4);padding:unset;border-left:0}#ays-poll-dicount-black-friday-month-main .ays_poll_dicount_month{position:relative;background-image:url("'. esc_attr(POLL_MAKER_AYS_ADMIN_URL) .'/images/black-friday-plugins-background-image.webp");background-position:center right;background-repeat:no-repeat;background-size:100% 100%}#ays-poll-dicount-black-friday-month-main .ays_poll_dicount_month img{width:80px}#ays-poll-dicount-black-friday-month-main .ays-poll-sale-banner-link{display:flex;justify-content:center;align-items:center;width:200px}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-sale{font-style:normal;font-weight:600;font-size:24px;text-align:center;color:#b2ff00;text-transform:uppercase}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box{font-size:14px;padding:12px;text-align:center;width:50%;white-space:nowrap}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-color{color:#971821}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-text-decoration{text-decoration:underline}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box .ays-button,#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box .ays-buy-now-button{background:#971821;border-color:#fff;display:flex;justify-content:center;align-items:center;padding:5px 15px;font-size:16px;border-radius:5px}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-poll-dicount-black-friday-month-main #ays-poll-dismiss-buttons-content{display:flex;justify-content:center}#ays-poll-dicount-black-friday-month-main #ays-poll-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#969393b0}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-opacity-box{width:19%}#ays-poll-dicount-black-friday-month-main .ays-buy-now-opacity-button{padding:40px 15px;display:flex;justify-content:center;align-items:center;opacity:0}#ays-poll-countdown-main-container .ays-poll-countdown-container{margin:0 auto;text-align:center}#ays-poll-countdown-main-container #ays-poll-countdown-headline{letter-spacing:.125rem;text-transform:uppercase;font-size:18px;font-weight:400;margin:0;padding:9px 0 4px;line-height:1.3}#ays-poll-countdown-main-container li,#ays-poll-countdown-main-container ul{margin:0;font-weight:600}#ays-poll-countdown-main-container li{display:inline-block;font-size:10px;list-style-type:none;padding:10px;text-transform:uppercase}#ays-poll-countdown-main-container li span{display:block;font-size:22px;min-height:33px}#ays-poll-countdown-main-container .emoji{display:none;padding:1rem}#ays-poll-countdown-main-container .emoji span{font-size:25px;padding:0 .5rem}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-box{display:flex;justify-content:space-between;align-items:center;width:95%;margin:auto}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-title-row{text-align:center;padding-right:50px;font-style:normal;font-weight:900;font-size:19px;color:#fff;}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-buy-now{border:none;outline:0;padding:10px 20px;font-size:22px;text-transform:uppercase;font-weight:700;text-decoration:none;background:linear-gradient(180deg,#dd0bef 0,#82008d 100%);border-radius:16px}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-text-row{text-transform:uppercase;text-shadow:-1.5px 0 #dd0bef,0 1.5px #dd0bef,1.5px 0 #dd0bef,0 -1.5px #dd0bef;font-weight:900;font-style:normal;font-size:40px;line-height:40px;color:#fff}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-text-box{position:absolute;width:25%;top:10px;bottom:0;right:0;left:0;margin:0 auto}#ays-poll-countdown ul{padding:0}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-banner-2025-coupon-box{border:2px dashed rgba(255,255,255,.4);padding:0 12px;border-radius:6px;background:rgba(255,255,255,.1);cursor:pointer;transition:.3s;display:flex;align-items:center;justify-content:center;gap:6px;backdrop-filter:blur(10px);width:fit-content;margin:0 auto}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-banner-2025-coupon-box:hover{background:rgba(255,255,255,.2);border-color:rgba(255,255,255,.6);transform:translateY(-1px)}#ays-poll-dicount-black-friday-month-main .ays-poll-discount-black-friday-banner-2025-coupon-text{font-size:14px;font-weight:700;letter-spacing:1px;color:#fff;font-family:monospace}#ays-poll-dicount-black-friday-month-main .ays-poll-discount-black-friday-banner-2025-copy-icon{opacity:.8;transition:opacity .3s}#ays-poll-dicount-black-friday-month-main .ays-poll-discount-black-friday-banner-banner-2025-coupon-box:hover .ays-poll-discount-black-friday-banner-2025-copy-icon,.ays-poll-discount-black-friday-banner-2025-copy-notification.show{opacity:1}.ays-poll-discount-black-friday-banner-2025-copy-notification{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,.8);color:#fff;padding:12px 24px;border-radius:8px;font-size:14px;z-index:10000;opacity:0;transition:opacity .3s}@media screen and (max-width:1400px) and (min-width:1200px){div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-title-row{font-size:15px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-text-row{font-size:27px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-box{width:100%}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-buy-now{font-size:13px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box-80{width:80%!important}}@media all and (max-width:1200px){div#ays-poll-dicount-black-friday-month-main .ays_poll_dicount_month{background:unset}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-text-row{font-size:30px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-box{width:100%}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-buy-now{font-size:15px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box-80{width:80%!important}}@media all and (max-width:1200px) and (min-width:1150px){div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-title-row{font-size:15px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-buy-now{font-size:10px}}@media all and (max-width:1150px){div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box-80{width:80%!important}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-box{flex-direction:column}div#ays-poll-dicount-black-friday-month-main{padding-right:0}div#ays-poll-dicount-black-friday-month-main .ays_poll_dicount_month{display:flex;align-items:center;justify-content:space-between;align-content:center;flex-wrap:wrap;flex-direction:column;padding:10px 0}div#ays-poll-dicount-black-friday-month-main div.ays-poll-dicount-black-friday-wrap-box{width:100%!important;text-align:center}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-title-row,div#ays-poll-dicount-black-friday-month-main #ays-poll-countdown-main-container ul{padding:0;font-size:13px}#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-sale,div#ays-poll-countdown-main-container li{font-size:15px}div#ays-poll-countdown-main-container li span{font-size:25px}div#ays-poll-dicount-black-friday-month-main div.ays-poll-dicount-black-friday-wrap-text-box{position:unset}#ays-poll-countdown-main-container #ays-poll-countdown-headline{font-size:15px;font-weight:600}#ays-poll-countdown-main-container ul{font-weight:500}#ays-poll-countdown-main-container li span{font-size:20px}#ays-poll-dicount-black-friday-month-main .ays-button{margin:0 auto!important}div#ays-poll-dicount-black-friday-month-main.ays_poll_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:contain;display:flex;justify-content:center;background-image:linear-gradient(45deg,#1e101d,#c60af4)}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-poll-dicount-black-friday-month-main .ays-poll-dicount-black-friday-button-buy-now{padding:10px 18px;font-size:15px}}@media all and (max-width:768px){#ays-poll-dicount-black-friday-month-main{display:none!important}}
2384 ';
2385 $content[] = '</style>';
2386
2387 $content = implode( '', $content );
2388
2389 echo $content;
2390 }
2391
2392 // New Mega Bundle 2026
2393 public function ays_poll_new_mega_bundle_message_2026(){
2394
2395 $content = array();
2396
2397 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2398 $now_date = date('M d, Y H:i:s', $date);
2399
2400 $poll_banner_date = strtotime( $this->ays_poll_update_banner_time() );
2401
2402 $diff = $poll_banner_date - $date;
2403
2404 $style_attr = '';
2405 if( $diff < 0 ){
2406 $style_attr = 'style="display:none;"';
2407 }
2408
2409 $poll_cta_button_link = esc_url( 'https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=poll-free&utm_campaign=mega-bundle-sale-banner-' . POLL_MAKER_AYS_VERSION );
2410
2411 $content[] = '<div id="ays-poll-new-mega-bundle-dicount-month-main" class="ays-poll-admin-notice notice notice-success is-dismissible ays_poll_dicount_info">';
2412 $content[] = '<div id="ays-poll-dicount-month" class="ays_poll_dicount_month">';
2413
2414 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-text-box">';
2415 $content[] = '<div>';
2416 $content[] = '<div class="ays-poll-dicount-logo-box">';
2417 $content[] = '<a href="' . $poll_cta_button_link . '" target="_blank" class="ays-poll-sale-banner-link"><img src="' . POLL_MAKER_AYS_ADMIN_URL . '/images/mega_bundle_logo_box.png"></a>';
2418
2419 $content[] = '<div>';
2420 $content[] = '<span class="ays-poll-new-mega-bundle-title">';
2421 $content[] = sprintf(
2422 /* translators: 1: opening link wrapper with <a> tag, 2: closing </a> tag */
2423 __( '%1$s Mega Bundle %2$s (Quiz + Survey + Poll)', 'poll-maker' ),
2424 '<span style="display:inline-block; margin-right:5px;"><a href="' . esc_url( $poll_cta_button_link ) . '" target="_blank" rel="noopener noreferrer" style="color:#ffffff !important; text-decoration: underline;">',
2425 '</a></span>'
2426 );
2427 $content[] = '</span>';
2428 $content[] = '</br>';
2429 $content[] = '<span class="ays-poll-new-mega-bundle-desc">';
2430 $content[] = __( "30 Day Money Back Guarantee", 'poll-maker' );
2431 $content[] = '</span>';
2432 $content[] = '</div>';
2433
2434 $content[] = '<div class="ays-poll-new-mega-bundle-title-icon-row" style="display: inline-block;">';
2435 $content[] = '<img src="' . POLL_MAKER_AYS_ADMIN_URL . '/images/ays-poll-banner-50.svg" class="ays-poll-new-mega-bundle-mobile-image-display-none" style="width: 70px;">';
2436 $content[] = '</div>';
2437
2438 $content[] = '</div>';
2439
2440 $content[] = '<div class="ays-poll-new-mega-bundle-mobile-image-display-block display_none">';
2441 $content[] = '<img src="' . POLL_MAKER_AYS_ADMIN_URL . '/images/ays-poll-banner-50.svg" style="width: 70px;">';
2442 $content[] = '</div>';
2443 $content[] = '</div>';
2444
2445 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form">';
2446
2447 $content[] = '<form action="" method="POST">';
2448 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2449 if( current_user_can( 'manage_options' ) ){
2450 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
2451 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2452 }
2453 $content[] = '</div>';
2454 $content[] = '</form>';
2455
2456 $content[] = '</div>';
2457
2458 $content[] = '</div>';
2459
2460 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-countdown-box">';
2461
2462 $content[] = '<div id="ays-poll-maker-countdown-main-container">';
2463 $content[] = '<div class="ays-poll-maker-countdown-container">';
2464
2465 $content[] = '<div ' . $style_attr . ' id="ays-poll-countdown">';
2466
2467 $content[] = '<ul>';
2468
2469 $content[] = '<li><span id="ays-poll-countdown-days"></span></li>';
2470 $content[] = '<li><span id="ays-poll-countdown-hours"></span></li>';
2471 $content[] = '<li><span id="ays-poll-countdown-minutes"></span></li>';
2472 $content[] = '<li><span id="ays-poll-countdown-seconds"></span></li>';
2473 $content[] = '</ul>';
2474 $content[] = '</div>';
2475
2476 $content[] = '<div id="ays-poll-countdown-content" class="emoji">';
2477 $content[] = '</div>';
2478
2479 $content[] = '</div>';
2480 $content[] = '</div>';
2481
2482 $content[] = '</div>';
2483
2484 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-button-box">';
2485 $content[] = '<a href="'. $poll_cta_button_link .'" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now', 'poll-maker' ) . '</a>';
2486 $content[] = '<span class="ays-poll-dicount-one-time-text">';
2487 $content[] = __( "One-time payment", 'poll-maker' );
2488 $content[] = '</span>';
2489 $content[] = '</div>';
2490 $content[] = '</div>';
2491 $content[] = '</div>';
2492
2493 // /* New Mega Bundle Banner Quiz | Start */
2494 $content[] = '<style id="ays-poll-mega-bundle-styles-inline-css">';
2495 $content[] = '
2496 div#ays-poll-new-mega-bundle-dicount-month-main{border:0;background:#fff;border-radius:20px;box-shadow:unset;position:relative;z-index:1;min-height:80px}div#ays-poll-new-mega-bundle-dicount-month-main.ays_poll_dicount_info button{display:flex;align-items:center}div#ays-poll-new-mega-bundle-dicount-month-main div#ays-poll-dicount-month a.ays-poll-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-poll-new-mega-bundle-dicount-month-main .btn-link{color:#007bff;background-color:transparent;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem}div#ays-poll-new-mega-bundle-dicount-month-main.ays_poll_dicount_info{background-image:url("'. POLL_MAKER_AYS_ADMIN_URL .'/images/ays-poll-banner-background-50.svg");background-position:center right;background-repeat:no-repeat;background-size:cover;background-color:#5551ff;padding:1px 38px 1px 12px}#ays-poll-new-mega-bundle-dicount-month-main .ays_poll_dicount_month{display:flex;align-items:center;justify-content:space-between;color:#fff}#ays-poll-new-mega-bundle-dicount-month-main .ays_poll_dicount_month img{width:60px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-sale-banner-link{display:flex;justify-content:center;align-items:center;width:60px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box{font-size:14px;padding:12px;text-align:center}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{text-align:left;width:auto;display:flex;justify-content:space-around;align-items:flex-start}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:30%;display:flex;justify-content:center;align-items:center}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{width:20%;display:flex;justify-content:center;align-items:center;flex-direction:column}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-poll-dicount-logo-box{display:flex;justify-content:flex-start;align-items:center;gap:20px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-title{color:#fdfdfd;font-size:19px;font-style:normal;font-weight:600;line-height:normal}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-title-icon-row{display:inline-block}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-desc{display:inline-block;color:#fff;font-size:15px;font-style:normal;font-weight:400;line-height:normal;margin-top:10px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-color{color:#971821}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-text-decoration{text-decoration:underline}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-button,#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{background:#971821;border-color:#fff;display:flex;justify-content:center;align-items:center;padding:5px 15px;font-size:16px;border-radius:5px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-poll-new-mega-bundle-dicount-month-main #ays-poll-dismiss-buttons-content{display:flex;justify-content:center}#ays-poll-new-mega-bundle-dicount-month-main #ays-poll-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#fff}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-opacity-box{width:19%}#ays-poll-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{padding:40px 15px;display:flex;justify-content:center;align-items:center;opacity:0}#ays-poll-maker-countdown-main-container .ays-poll-maker-countdown-container{margin:0 auto;text-align:center}#ays-poll-maker-countdown-main-container #ays-poll-countdown-headline{letter-spacing:.125rem;text-transform:uppercase;font-size:18px;font-weight:400;margin:0;padding:9px 0 4px;line-height:1.3}#ays-poll-maker-countdown-main-container li,#ays-poll-maker-countdown-main-container ul{margin:0}#ays-poll-maker-countdown-main-container li{display:inline-block;font-size:14px;list-style-type:none;padding:14px;text-transform:lowercase}#ays-poll-maker-countdown-main-container li span{display:flex;justify-content:center;align-items:center;font-size:22px;min-height:40px;min-width:40px;border-radius:4.273px;border:.534px solid #f4f4f4;background:#9896ed;color:#fff}#ays-poll-maker-countdown-main-container .emoji{display:none;padding:1rem}#ays-poll-maker-countdown-main-container .emoji span{font-size:30px;padding:0 .5rem}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box li{position:relative}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box li span:after{content:":";color:#fff;position:absolute;top:0;right:-5px;font-size:40px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box li span#ays-poll-countdown-seconds:after{content:unset}#ays-poll-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{display:flex;align-items:center;border-radius:6.409px;background:#f66123;padding:12px 32px;color:#fff;font-size:15px;font-style:normal;line-height:normal;margin:0!important}div#ays-poll-new-mega-bundle-dicount-month-main button.notice-dismiss:before{color:#fff;content:"\f00d";font-family:fontawesome;font-size:22px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-new-mega-bundle-guaranteeicon{width:30px;margin-right:5px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-one-time-text{color:#fff;font-size:12px;font-style:normal;font-weight:600;line-height:normal}@media all and (max-width:768px){div#ays-poll-new-mega-bundle-dicount-month-main.ays_poll_dicount_info.notice{display:none!important;background-position:bottom right;background-repeat:no-repeat;background-size:cover;border-radius:32px}div#ays-poll-new-mega-bundle-dicount-month-main{padding-right:0}div#ays-poll-new-mega-bundle-dicount-month-main .ays_poll_dicount_month{display:flex;align-items:center;justify-content:space-between;align-content:center;flex-wrap:wrap;flex-direction:column;padding:10px 0}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box{width:100%!important;text-align:center}#ays-poll-maker-countdown-main-container #ays-poll-countdown-headline{font-size:15px;font-weight:600}#ays-poll-maker-countdown-main-container ul{font-weight:500}div#ays-poll-maker-countdown-main-container li{padding:10px}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-new-mega-bundle-mobile-image-display-none{display:none!important}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-new-mega-bundle-mobile-image-display-block{display:block!important;margin-top:5px}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:100%!important;text-align:center;flex-direction:column;margin-top:20px;justify-content:center;align-items:center}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box li span:after{top:unset}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:100%;display:flex;justify-content:center;align-items:center}#ays-poll-new-mega-bundle-dicount-month-main .ays-button{margin:0 auto!important}#ays-poll-new-mega-bundle-dicount-month-main #ays-poll-dismiss-buttons-content .ays-button{padding-left:unset!important}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-poll-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{display:none}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dismiss-buttons-container-for-form{position:static!important}.comparison .product img{width:70px}.ays-poll-features-wrap .comparison a.price-buy{padding:8px 5px;font-size:11px}}@media screen and (max-width:1350px) and (min-width:768px){div#ays-poll-new-mega-bundle-dicount-month-main.ays_poll_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box strong{font-size:15px}#ays-poll-maker-countdown-main-container li{font-size:11px}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-opacity-box{display:none}}@media screen and (max-width:1680px) and (min-width:1551px){div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:29%}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:30%}}@media screen and (max-width:1410px){#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-coupon-row{width:150px}}@media screen and (max-width:1550px) and (min-width:1400px){div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:35%}}@media screen and (max-width:1400px) and (min-width:1250px){div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:35%}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:40%}}@media screen and (max-width:1274px){#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-title{font-size:15px}}@media screen and (max-width:1200px){#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{margin-bottom:16px}#ays-poll-maker-countdown-main-container ul{padding-left:0}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-coupon-row{width:120px;font-size:18px}#ays-poll-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 20px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box{font-size:12px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-desc{font-size:13px}}@media screen and (max-width:1076px) and (min-width:769px){#ays-poll-maker-countdown-main-container li{padding:10px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-coupon-row{width:100px;font-size:16px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{margin-bottom:16px}#ays-poll-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 15px}#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box{font-size:11px;padding:12px 0}}@media screen and (max-width:1250px) and (min-width:769px){div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:45%}div#ays-poll-new-mega-bundle-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:35%}}';
2497 $content[] = '</style>';
2498 // /* New Mega Bundle Banner Quiz | End */
2499
2500 $content = implode( '', $content );
2501 echo ($content);
2502 }
2503
2504 // Halloween Bundle 2025
2505 public function ays_poll_new_halloween_bundle_message_2025(){
2506
2507 $content = array();
2508
2509 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2510 $now_date = date('M d, Y H:i:s', $date);
2511
2512 $start_date = strtotime('2025-09-08');
2513 $end_date = strtotime('2025-10-31');
2514 $diff_end = $end_date - $date;
2515
2516 $style_attr = '';
2517 if( $diff_end < 0 ){
2518 $style_attr = 'style="display:none;"';
2519 }
2520
2521 $ays_poll_cta_button_link = esc_url('https://ays-pro.com/halloween-bundle?utm_source=dashboard&utm_medium=poll-free&utm_campaign=poll-halloween-banner-' . POLL_MAKER_AYS_VERSION);
2522
2523 $content[] = '
2524 <div id="ays-poll-halloween-banner-2025-main" class="ays-poll-halloween-banner-2025-main notice notice-success is-dismissible">
2525 <div class="ays-poll-halloween-banner-2025-content">
2526 <div class="ays-poll-halloween-banner-2025-left">
2527 <div class="ays-poll-halloween-banner-2025-text">
2528 <h2 class="ays-poll-halloween-banner-2025-title">Boo! Grab Your <a href="'. $ays_poll_cta_button_link .'" class="" target="_blank">Halloween Deal</a> <br/> Before It Vanishes!</h2>
2529 <p class="ays-poll-halloween-banner-2025-subtitle">Don’t get spooked by missing out!<br/> Get 50% off our exclusive Halloween Bundle (Survey + SCCP + Poll Maker + Popup Box) while the magic lasts!</p>
2530 </div>
2531 </div>
2532
2533 <div class="ays-poll-halloween-banner-2025-center">';
2534
2535 $content[] = '<div id="ays-poll-halloween-banner-2025-countdown" class="ays-poll-halloween-banner-2025-countdown" ' . $style_attr . '>';
2536 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-timer">';
2537 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2538 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-days">00</div>';
2539 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('days', 'poll-maker') . '</div>';
2540 $content[] = '</div>';
2541 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2542 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2543 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-hours">00</div>';
2544 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('hours', 'poll-maker') . '</div>';
2545 $content[] = '</div>';
2546 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2547 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2548 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-minutes">00</div>';
2549 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('minutes', 'poll-maker') . '</div>';
2550 $content[] = '</div>';
2551 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2552 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2553 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-seconds">00</div>';
2554 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('seconds', 'poll-maker') . '</div>';
2555 $content[] = '</div>';
2556 $content[] = '</div>';
2557 $content[] = '</div>';
2558
2559 $content[] = '</div>
2560
2561 <div class="ays-poll-halloween-banner-2025-right">
2562 <div class="ays-poll-halloween-banner-2025-pumpkin">
2563 <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2564 <g clip-path="url(#clip0_177_40)">
2565 <path d="M32.664 8.519C29.364 5.134 23.42 4.75 18 4.75C12.58 4.75 6.636 5.134 3.336 8.519C0.582 11.344 0 15.751 0 19.791C0 25.054 1.982 31.102 6.357 34.035C9.364 36.051 13.95 35.871 18 35.871C22.05 35.871 26.636 36.051 29.643 34.035C34.018 31.101 36 25.054 36 19.791C36 15.751 35.418 11.344 32.664 8.519Z" fill="#F4900C"/>
2566 <path d="M20.783 5.44401C20.852 5.86401 20.561 6.20801 20.136 6.20801H15.685C15.259 6.20801 14.968 5.86401 15.038 5.44401L15.783 0.972008C15.853 0.551008 16.259 0.208008 16.685 0.208008H19.136C19.562 0.208008 19.968 0.552008 20.037 0.972008L20.783 5.44401Z" fill="#3F7123"/>
2567 <path d="M20.6541 21.159L19.0561 18.563C18.7651 18.021 18.3831 17.75 17.9991 17.746C17.6161 17.75 17.2331 18.021 16.9421 18.563L15.3441 21.159C14.7571 22.252 16.2171 22.875 17.9981 22.875C19.7791 22.875 21.2411 22.251 20.6541 21.159ZM30.1621 24.351C30.1171 24.276 30.0361 24.23 29.9481 24.23H29.1071C29.0391 24.23 28.9731 24.258 28.9261 24.307L26.6951 26.641L23.9971 24.472C23.9461 24.431 23.8801 24.414 23.8121 24.419C23.7461 24.426 23.6851 24.46 23.6441 24.513L21.2361 27.575L18.1821 24.309C18.1691 24.295 18.1491 24.292 18.1341 24.281C18.1191 24.271 18.1091 24.254 18.0911 24.247C18.0851 24.245 18.0781 24.247 18.0721 24.245C18.0481 24.238 18.0251 24.24 18.0001 24.24C17.9751 24.24 17.9521 24.238 17.9281 24.246C17.9221 24.248 17.9151 24.245 17.9081 24.248C17.8901 24.255 17.8811 24.272 17.8651 24.282C17.8491 24.292 17.8301 24.295 17.8171 24.309L14.7641 27.575L12.3551 24.513C12.3141 24.46 12.2531 24.426 12.1871 24.419C12.1211 24.413 12.0541 24.431 12.0021 24.472L9.30411 26.641L7.07411 24.307C7.02711 24.258 6.96211 24.23 6.89311 24.23H6.05211C5.96511 24.23 5.88311 24.276 5.83811 24.351C5.79311 24.426 5.79011 24.519 5.83111 24.596L8.58511 29.815C8.61911 29.879 8.6781 29.925 8.7491 29.942C8.8201 29.959 8.8941 29.944 8.9521 29.902L10.9861 28.444L13.9901 32.077C14.0331 32.13 14.0961 32.162 14.1641 32.167L14.1831 32.168C14.2451 32.168 14.3041 32.146 14.3501 32.105L18.0001 28.836L21.6501 32.104C21.6961 32.145 21.7551 32.167 21.8171 32.167L21.8361 32.166C21.9041 32.161 21.9671 32.129 22.0101 32.076L25.0151 28.443L27.0491 29.901C27.1091 29.944 27.1821 29.961 27.2521 29.941C27.3221 29.924 27.3821 29.879 27.4151 29.815L30.1701 24.596C30.2101 24.519 30.2081 24.426 30.1621 24.351ZM27.9761 15.421C28.1051 17.548 27.1921 19.227 24.7711 19.374C22.3511 19.52 21.2421 17.963 21.1131 15.837C20.9841 13.711 22.3451 10.717 24.2401 10.603C26.1361 10.487 27.8481 13.294 27.9761 15.421ZM8.02411 15.421C7.89511 17.548 8.80811 19.227 11.2291 19.374C13.6491 19.52 14.7581 17.963 14.8871 15.837C15.0161 13.711 13.6551 10.717 11.7601 10.603C9.86511 10.489 8.15211 13.294 8.02411 15.421Z" fill="#642116"/>
2568 </g>
2569 <defs>
2570 <clipPath id="clip0_177_40">
2571 <rect width="36" height="36" fill="white"/>
2572 </clipPath>
2573 </defs>
2574 </svg>
2575 </div>
2576
2577
2578
2579 <div class="ays-poll-halloween-banner-2025-discount-section">
2580 <div class="ays-poll-halloween-banner-2025-discount">50% OFF</div>
2581 <div class="ays-poll-halloween-banner-2025-coupon-wrapper">
2582 <div class="ays-poll-halloween-banner-2025-coupon-box" onclick="aysPollHalloweenCopyToClipboard(\'HALLOWEEN25\')" title="' . __( 'Click to copy', "poll-maker" ) . '">
2583 <span class="ays-poll-halloween-banner-2025-coupon-text">HALLOWEEN25</span>
2584 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-poll-halloween-banner-2025-copy-icon">
2585 <path d="M13.5 2.5H6.5C5.67 2.5 5 3.17 5 4V10C5 10.83 5.67 11.5 6.5 11.5H13.5C14.33 11.5 15 10.83 15 10V4C15 3.17 14.33 2.5 13.5 2.5ZM13.5 10H6.5V4H13.5V10ZM2.5 6.5V12.5C2.5 13.33 3.17 14 4 14H10V12.5H4V6.5H2.5Z" fill="white"/>
2586 </svg>
2587 </div>
2588 </div>
2589 <a href="'. $ays_poll_cta_button_link .'" class="ays-poll-halloween-banner-2025-upgrade" target="_blank">Buy Now</a>
2590 </div>';
2591
2592 if( current_user_can( 'manage_options' ) ){
2593 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2594 $content[] = '<form action="" method="POST" style="position: absolute; bottom: -5px; right: 0; color: #fff;">';
2595 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
2596 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2597 $content[] = '</form>';
2598 $content[] = '</div>';
2599 }
2600
2601 $content[] = '
2602 </div>
2603 </div>
2604 </div>';
2605
2606 $content[] = '<style id="ays-poll-progress-banner-styles-inline-css">';
2607 $content[] = '
2608 .ays-poll-halloween-banner-2025-main {
2609 background: linear-gradient(135deg, #1A0F2E 100%, #2D1B4E 0%);
2610 background-image: url("' . esc_attr( POLL_MAKER_AYS_ADMIN_URL ) . '/images/halloween-banner-background-image-remove.png"), linear-gradient(135deg, #2D1B4E 0%, #1A0F2E 100%);
2611 background-position: left center, center;
2612 background-repeat: no-repeat, no-repeat;
2613 background-size: auto 100%, cover;
2614 padding: 20px 30px 20px 130px;
2615 border-radius: 12px;
2616 color: white;
2617 margin: 20px 0;
2618 border: 0;
2619 box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
2620 overflow: hidden;
2621 }
2622
2623 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-content {
2624 display: flex;
2625 align-items: center;
2626 justify-content: space-between;
2627 gap: 30px;
2628 }
2629
2630 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-left {
2631 display: flex;
2632 align-items: center;
2633 gap: 20px;
2634 }
2635
2636 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-center {
2637 display: flex;
2638 align-items: center;
2639 justify-content: center;
2640 flex: 1;
2641 max-width: 350px;
2642 }
2643
2644 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-right {
2645 display: flex;
2646 align-items: center;
2647 gap: 15px;
2648 flex-shrink: 0;
2649 }
2650
2651 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-icon {
2652 flex-shrink: 0;
2653 }
2654
2655 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin svg {
2656 display: inline !important;
2657 border: none !important;
2658 box-shadow: none !important;
2659 height: 1em !important;
2660 width: 1em !important;
2661 margin: 0 0.07em !important;
2662 vertical-align: -0.1em !important;
2663 background: none !important;
2664 padding: 0 !important;
2665 }
2666
2667 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-orb {
2668 width: 80px;
2669 height: 80px;
2670 background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
2671 border-radius: 50%;
2672 display: flex;
2673 align-items: center;
2674 justify-content: center;
2675 box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
2676 border: 3px solid rgba(168, 85, 247, 0.4);
2677 }
2678
2679 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-question {
2680 font-size: 48px;
2681 font-weight: 700;
2682 color: #E9D5FF;
2683 }
2684
2685 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat {
2686 font-size: 20px;
2687 opacity: 0.8;
2688 }
2689
2690 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat-1 {
2691 margin-left: -100px;
2692 margin-top: -40px;
2693 }
2694
2695 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat-2 {
2696 margin-left: -110px;
2697 margin-top: 35px;
2698 }
2699
2700 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle {
2701 font-size: 12px;
2702 opacity: 0.7;
2703 }
2704
2705 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-1 {
2706 margin-left: -95px;
2707 margin-top: -60px;
2708 }
2709
2710 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-2 {
2711 margin-left: -70px;
2712 margin-top: -15px;
2713 }
2714
2715 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-3 {
2716 margin-left: -120px;
2717 margin-top: 10px;
2718 }
2719
2720 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-text {
2721 flex: 1;
2722 }
2723
2724 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2725 font-size: 24px;
2726 font-weight: 700;
2727 margin: 0 0 8px 0;
2728 line-height: 1.2;
2729 color: #fff;
2730 text-transform: uppercase;
2731 letter-spacing: 1px;
2732 }
2733
2734 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title a {
2735 color: #FB923C;
2736 text-decoration: underline;
2737 }
2738
2739 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle {
2740 font-size: 16px;
2741 margin: 0;
2742 opacity: 0.9;
2743 font-weight: 400;
2744 color: #E9D5FF;
2745 }
2746
2747 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-description {
2748 font-size: 14px;
2749 margin: 0;
2750 opacity: 0.85;
2751 line-height: 1.5;
2752 color: #D8B4FE;
2753 }
2754
2755 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2756 font-size: 64px;
2757 filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.8));
2758 flex-shrink: 0;
2759 }
2760
2761 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount-section {
2762 display: flex;
2763 flex-direction: column;
2764 align-items: center;
2765 gap: 10px;
2766 }
2767
2768 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount {
2769 font-size: 36px;
2770 font-weight: 700;
2771 color: #FB923C;
2772 text-shadow: 0 0 20px rgba(251, 146, 60, 0.6);
2773 margin: 0;
2774 line-height: 1;
2775 }
2776
2777 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-wrapper {
2778 display:none;
2779 margin-bottom: 5px;
2780 }
2781
2782 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box {
2783 border: 2px dashed rgba(255, 255, 255, 0.4);
2784 padding: 6px 12px;
2785 border-radius: 6px;
2786 background: rgba(255, 255, 255, 0.1);
2787 cursor: pointer;
2788 transition: all 0.3s ease;
2789 display: flex;
2790 align-items: center;
2791 gap: 6px;
2792 backdrop-filter: blur(10px);
2793 }
2794
2795 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box:hover {
2796 background: rgba(255, 255, 255, 0.2);
2797 border-color: rgba(255, 255, 255, 0.6);
2798 transform: translateY(-1px);
2799 }
2800
2801 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-text {
2802 font-size: 14px;
2803 font-weight: 700;
2804 letter-spacing: 1px;
2805 color: #fff;
2806 font-family: monospace;
2807 }
2808
2809 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-copy-icon {
2810 opacity: 0.8;
2811 transition: opacity 0.3s ease;
2812 }
2813
2814 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box:hover .ays-poll-halloween-banner-2025-copy-icon {
2815 opacity: 1;
2816 }
2817
2818 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade {
2819 background: linear-gradient(135deg, #FB923C 0%, #F97316 100%);
2820 color: white;
2821 border: none;
2822 padding: 12px 28px;
2823 border-radius: 8px;
2824 font-size: 16px;
2825 font-weight: 600;
2826 cursor: pointer;
2827 transition: all 0.3s ease;
2828 box-shadow: 0 4px 16px rgba(251, 146, 60, 0.5);
2829 text-decoration: none;
2830 display: inline-flex;
2831 align-items: center;
2832 text-align: center;
2833 }
2834
2835 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade:hover {
2836 transform: translateY(-2px);
2837 box-shadow: 0 6px 20px rgba(251, 146, 60, 0.7);
2838 text-decoration: none;
2839 color: white;
2840 }
2841
2842 .ays-poll-halloween-banner-2025-main .notice-dismiss:before {
2843 color: #fff;
2844 }
2845
2846 .ays-poll-halloween-banner-2025-copy-notification {
2847 position: fixed;
2848 top: 50%;
2849 left: 50%;
2850 transform: translate(-50%, -50%);
2851 background: rgba(0, 0, 0, 0.8);
2852 color: white;
2853 padding: 12px 24px;
2854 border-radius: 8px;
2855 font-size: 14px;
2856 z-index: 10000;
2857 opacity: 0;
2858 transition: opacity 0.3s ease;
2859 }
2860
2861 .ays-poll-halloween-banner-2025-copy-notification.show {
2862 opacity: 1;
2863 }
2864
2865 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-timer {
2866 display: flex;
2867 align-items: center;
2868 justify-content: center;
2869 gap: 8px;
2870 }
2871
2872 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-item {
2873 background: rgba(255, 255, 255, 0.15);
2874 border-radius: 8px;
2875 padding: 8px 12px;
2876 min-width: 60px;
2877 backdrop-filter: blur(10px);
2878 }
2879
2880 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-value {
2881 font-size: 24px;
2882 font-weight: 700;
2883 line-height: 1;
2884 margin-bottom: 4px;
2885 color: #fff;
2886 text-align: center;
2887 }
2888
2889 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-label {
2890 font-size: 11px;
2891 opacity: 0.8;
2892 text-transform: lowercase;
2893 text-align: center;
2894 }
2895
2896 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-separator {
2897 font-size: 24px;
2898 font-weight: 700;
2899 opacity: 0.6;
2900 margin: 0 4px;
2901 }
2902
2903 @media (min-width: 1200px) {
2904 .ays-poll-halloween-banner-2025-main .wp-core-ui .notice.is-dismissible {
2905 padding-right: 60px;
2906 }
2907 }
2908
2909 @media (max-width: 1200px) {
2910
2911 div.ays-poll-halloween-banner-2025-main {
2912 padding: 20px 30px;
2913 }
2914
2915 div.ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2916 display: none;
2917 }
2918
2919 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle,
2920 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2921 text-align: center;
2922 }
2923
2924 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-content {
2925 flex-wrap: wrap;
2926 gap: 20px;
2927 }
2928
2929 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-left {
2930 width: 100%;
2931 }
2932
2933 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-center {
2934 width: 100%;
2935 max-width: 100%;
2936 text-align: center;
2937 }
2938
2939 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-right {
2940 width: 100%;
2941 justify-content: center;
2942 }
2943 }
2944
2945 @media (max-width: 786px) {
2946 #ays-poll-halloween-banner-2025-main {
2947 display: none !important;
2948 }
2949 }
2950
2951 @media (max-width: 768px) {
2952 .ays-poll-halloween-banner-2025-main {
2953 padding: 15px 20px;
2954 margin: 15px 0;
2955 }
2956
2957 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2958 font-size: 20px;
2959 }
2960
2961 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle {
2962 font-size: 14px;
2963 }
2964
2965 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-description {
2966 font-size: 13px;
2967 }
2968
2969 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2970 font-size: 48px;
2971 }
2972
2973 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount {
2974 font-size: 28px;
2975 }
2976
2977 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade {
2978 padding: 10px 20px;
2979 font-size: 14px;
2980 }
2981 }
2982
2983 @media (max-width: 480px) {
2984 .ays-poll-halloween-banner-2025-main {
2985 padding: 12px 15px;
2986 }
2987
2988 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-orb {
2989 width: 60px;
2990 height: 60px;
2991 }
2992
2993 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-question {
2994 font-size: 36px;
2995 }
2996
2997 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2998 font-size: 18px;
2999 }
3000
3001 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-text {
3002 font-size: 12px;
3003 }
3004 }
3005 ';
3006
3007 $content[] = '</style>';
3008
3009 $content[] = '<script>';
3010 $content[] = "
3011 function aysPollHalloweenCopyToClipboard(text) {
3012 // Create a temporary textarea element
3013 var textarea = document.createElement('textarea');
3014 textarea.value = text;
3015 textarea.style.position = 'fixed';
3016 textarea.style.opacity = '0';
3017 document.body.appendChild(textarea);
3018
3019 // Select and copy the text
3020 textarea.select();
3021 textarea.setSelectionRange(0, 99999); // For mobile devices
3022
3023 try {
3024 document.execCommand('copy');
3025 aysPollHalloweenShowCopyNotification('Coupon code copied!');
3026 } catch (err) {
3027 console.error('Failed to copy text: ', err);
3028 }
3029
3030 // Remove the temporary textarea
3031 document.body.removeChild(textarea);
3032 }
3033
3034 function aysPollHalloweenShowCopyNotification(message) {
3035 // Check if notification already exists
3036 var existingNotification = document.querySelector('.ays-poll-halloween-banner-2025-copy-notification');
3037 if (existingNotification) {
3038 document.body.removeChild(existingNotification);
3039 }
3040
3041 // Create notification element
3042 var notification = document.createElement('div');
3043 notification.className = 'ays-poll-halloween-banner-2025-copy-notification';
3044 notification.textContent = message;
3045 document.body.appendChild(notification);
3046
3047 // Show notification with animation
3048 setTimeout(function() {
3049 notification.classList.add('show');
3050 }, 10);
3051
3052 // Hide and remove notification after 2 seconds
3053 setTimeout(function() {
3054 notification.classList.remove('show');
3055 setTimeout(function() {
3056 if (notification.parentNode) {
3057 document.body.removeChild(notification);
3058 }
3059 }, 300);
3060 }, 2000);
3061 }
3062
3063 (function() {
3064 var endDate = new Date('". date('Y-m-d H:i:s', $end_date) ."').getTime();
3065
3066 function updateCountdown() {
3067 var now = new Date().getTime();
3068 var distance = endDate - now;
3069
3070 if (distance < 0) {
3071 clearInterval(updateCountdown);
3072 document.getElementById('ays-poll-halloween-banner-2025-progress-banner-countdown').style.display = 'none';
3073 return;
3074 }
3075
3076 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
3077 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
3078 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
3079 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
3080
3081 function padZero(num) {
3082 return num < 10 ? '0' + num : num;
3083 }
3084
3085 document.getElementById('ays-poll-halloween-banner-2025-days').textContent = padZero(days);
3086 document.getElementById('ays-poll-halloween-banner-2025-hours').textContent = padZero(hours);
3087 document.getElementById('ays-poll-halloween-banner-2025-minutes').textContent = padZero(minutes);
3088 document.getElementById('ays-poll-halloween-banner-2025-seconds').textContent = padZero(seconds);
3089 }
3090
3091 updateCountdown();
3092 setInterval(updateCountdown, 1000);
3093 })()";
3094 $content[] = '</script>';
3095
3096 $content = implode( '', $content );
3097 echo ($content);
3098 }
3099
3100 // Fox LMS Pro Banner
3101 public function ays_poll_discounted_licenses_banner_message(){
3102
3103 $content = array();
3104
3105 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
3106 $now_date = date('M d, Y H:i:s', $date);
3107
3108 $start_date = strtotime('2025-09-21');
3109 $end_date = strtotime('2025-10-21');
3110 $diff_end = $end_date - $date;
3111
3112 $style_attr = '';
3113 if( $diff_end < 0 ){
3114 $style_attr = 'style="display:none;"';
3115 }
3116
3117 $total_licenses = 50;
3118 $progression_pattern = array(3, 2, 1, 4, 2, 3, 1, 2, 4, 3, 2, 1, 3, 2, 4, 1, 3, 2, 2, 3, 1, 2);
3119 $days_passed = floor(($date - $start_date) / (24 * 60 * 60));
3120 $used_licenses = 0;
3121
3122 for ($i = 0; $i < min($days_passed, count($progression_pattern)); $i++) {
3123 $used_licenses += $progression_pattern[$i];
3124 }
3125 $used_licenses = min($used_licenses, $total_licenses);
3126 $remaining_licenses = $total_licenses - $used_licenses;
3127 $progress_percentage = ($used_licenses / $total_licenses) * 100;
3128
3129 $ays_poll_cta_button_link = esc_url('https://ays-pro.com/wordpress/poll-maker?utm_source=dashboard&utm_medium=poll-free&utm_campaign=poll-maker-license-banner-' . POLL_MAKER_AYS_VERSION);
3130
3131 $content[] = '<div id="ays-poll-progress-banner-main" class="ays-poll-progress-banner-main ays-poll-admin-notice notice notice-success is-dismissible" ' . $style_attr . '>';
3132 $content[] = '<div class="ays-poll-progress-banner-content">';
3133 $content[] = '<div class="ays-poll-progress-banner-left">';
3134 $content[] = '<div class="ays-poll-progress-banner-icon">';
3135 $content[] = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
3136 <path d="M1.33325 22.6668L11.9999 13.3335L33.3333 14.6668L34.6666 36.0002L25.3333 46.6668C25.3333 46.6668 25.3346 38.6682 17.3333 30.6668C9.33192 22.6655 1.33325 22.6668 1.33325 22.6668Z" fill="#A0041E"/>
3137 <path d="M1.29739 46.6665C1.29739 46.6665 1.24939 36.0278 5.27739 31.9998C9.30539 27.9718 20.0001 28.2492 20.0001 28.2492C20.0001 28.2492 19.9987 38.6665 15.9987 42.6665C11.9987 46.6665 1.29739 46.6665 1.29739 46.6665Z" fill="#FFAC33"/>
3138 <path d="M11.9986 41.3332C14.9441 41.3332 17.3319 38.9454 17.3319 35.9998C17.3319 33.0543 14.9441 30.6665 11.9986 30.6665C9.0531 30.6665 6.66528 33.0543 6.66528 35.9998C6.66528 38.9454 9.0531 41.3332 11.9986 41.3332Z" fill="#FFCC4D"/>
3139 <path d="M47.9986 0C47.9986 0 34.6653 0 18.6653 13.3333C10.6653 20 10.6653 32 13.3319 34.6667C15.9986 37.3333 27.9986 37.3333 34.6653 29.3333C47.9986 13.3333 47.9986 0 47.9986 0Z" fill="#55ACEE"/>
3140 <path d="M35.9987 6.6665C33.8347 6.6665 31.9814 7.96117 31.144 9.81317C31.8134 9.5105 32.5507 9.33317 33.332 9.33317C36.2774 9.33317 38.6654 11.7212 38.6654 14.6665C38.6654 15.4478 38.488 16.1852 38.1867 16.8532C40.0387 16.0172 41.332 14.1638 41.332 11.9998C41.332 9.0545 38.944 6.6665 35.9987 6.6665Z" fill="black"/>
3141 <path d="M10.6667 37.3332C10.6667 37.3332 10.6667 31.9998 12.0001 30.6665C13.3334 29.3332 29.3347 16.0012 30.6667 17.3332C31.9987 18.6652 18.6654 34.6665 17.3321 35.9998C15.9987 37.3332 10.6667 37.3332 10.6667 37.3332Z" fill="#A0041E"/>
3142 </svg>';
3143 $content[] = '</div>';
3144 $content[] = '<div class="ays-poll-progress-banner-text">';
3145 $content[] = '<h2 class="ays-poll-progress-banner-title">' . sprintf( __('Get the Pro Version of %s Poll Maker%s – 20%% OFF', 'poll-maker'), '<a href="'. $ays_poll_cta_button_link .'" target="_blank">', '</a>' ) . '</h2>';
3146 $content[] = '<p class="ays-poll-progress-banner-subtitle">' . __('Unlock advanced features + 30 day Money Back Guarantee', 'poll-maker') . '</p>';
3147 $content[] = '</div>';
3148 $content[] = '</div>';
3149
3150 $content[] = '<div class="ays-poll-progress-banner-center">';
3151 $content[] = '<div class="ays-poll-progress-banner-coupon">';
3152 $content[] = '<div class="ays-poll-progress-banner-coupon-box" onclick="pollCopyToClipboard(\'FREE2PRO20\')" title="' . __('Click to copy', 'poll-maker') . '">';
3153 $content[] = '<span class="ays-poll-progress-banner-coupon-text">FREE2PRO20</span>';
3154 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-poll-progress-banner-copy-icon">';
3155 $content[] = '<path d="M13.5 2.5H6.5C5.67 2.5 5 3.17 5 4V10C5 10.83 5.67 11.5 6.5 11.5H13.5C14.33 11.5 15 10.83 15 10V4C15 3.17 14.33 2.5 13.5 2.5ZM13.5 10H6.5V4H13.5V10ZM2.5 6.5V12.5C2.5 13.33 3.17 14 4 14H10V12.5H4V6.5H2.5Z" fill="white"/>';
3156 $content[] = '</svg>';
3157 $content[] = '</div>';
3158 $content[] = '</div>';
3159
3160 $content[] = '<div class="ays-poll-progress-banner-progress">';
3161 $content[] = '<p class="ays-poll-progress-banner-progress-text">' . __('Only', 'poll-maker') . ' <span id="remaining-licenses">' . $remaining_licenses . '</span> ' . __('of 50 discounted licenses left', 'poll-maker') . '</p>';
3162 $content[] = '<div class="ays-poll-progress-banner-progress-bar">';
3163 $content[] = '<div class="ays-poll-progress-banner-progress-fill" id="progress-fill" style="width: ' . $progress_percentage . '%;"></div>';
3164 $content[] = '</div>';
3165 $content[] = '</div>';
3166 $content[] = '</div>';
3167
3168 $content[] = '<div class="ays-poll-progress-banner-right">';
3169 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-progress-banner-upgrade" target="_blank">';
3170 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">';
3171 $content[] = '<path d="M14.6392 6.956C14.5743 6.78222 14.4081 6.66667 14.2223 6.66667H8.85565L11.9512 0.648C12.0485 0.458667 11.9983 0.227111 11.8308 0.0955556C11.7499 0.0315556 11.6525 0 11.5556 0C11.4521 0 11.3485 0.0364444 11.2654 0.108L8.00009 2.928L1.48765 8.55244C1.3472 8.67378 1.29653 8.86978 1.36142 9.04356C1.42631 9.21733 1.59209 9.33333 1.77787 9.33333H7.14454L4.04898 15.352C3.95165 15.5413 4.00187 15.7729 4.16942 15.9044C4.25031 15.9684 4.34765 16 4.44453 16C4.54809 16 4.65165 15.9636 4.73476 15.892L8.00009 13.072L14.5125 7.44756C14.6534 7.32622 14.7036 7.13022 14.6392 6.956Z" fill="white"/>';
3172 $content[] = '</svg>';
3173 $content[] = ' ' . __('Upgrade Now', 'poll-maker');
3174 $content[] = '</a>';
3175 $content[] = '</div>';
3176 $content[] = '</div>';
3177
3178 if( current_user_can( 'manage_options' ) ){
3179 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
3180 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
3181 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
3182 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
3183 $content[] = '</form>';
3184 $content[] = '</div>';
3185 }
3186 $content[] = '</div>';
3187
3188 // Fox LMS Pro Banner Styles
3189 $content[] = '<style id="ays-poll-progress-banner-styles-inline-css">';
3190 $content[] = '
3191 .ays-poll-progress-banner-main {
3192 background: linear-gradient(135deg, #6344ED 0%, #8C2ABE 100%);
3193 padding: 20px 30px;
3194 border-radius: 16px;
3195 color: white;
3196 position: relative;
3197 margin: 20px 0;
3198 box-shadow: 0 8px 32px rgba(99, 68, 237, 0.3);
3199 border: 0;
3200 }
3201
3202 .ays-poll-progress-banner-main .ays-poll-progress-banner-content {
3203 display: flex;
3204 align-items: center;
3205 justify-content: space-between;
3206 gap: 30px;
3207 }
3208
3209 .ays-poll-progress-banner-main .ays-poll-progress-banner-left {
3210 display: flex;
3211 align-items: center;
3212 gap: 20px;
3213 flex: 1;
3214 }
3215
3216 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3217 display: flex;
3218 align-items: center;
3219 gap: 15px;
3220 flex: 1;
3221 }
3222
3223 .ays-poll-progress-banner-main .ays-poll-progress-banner-right {
3224 display: flex;
3225 align-items: center;
3226 gap: 20px;
3227 flex-shrink: 0;
3228 }
3229
3230 .ays-poll-progress-banner-main .ays-poll-progress-banner-icon {
3231 font-size: 32px;
3232 filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
3233 }
3234
3235 .ays-poll-progress-banner-main .ays-poll-progress-banner-title {
3236 font-size: 21px;
3237 font-weight: 700;
3238 margin: 0 0 8px 0;
3239 line-height: 1.2;
3240 color: #fff;
3241 }
3242
3243 .ays-poll-progress-banner-main .ays-poll-progress-banner-title a {
3244 text-decoration: underline;
3245 color: #fff;
3246 }
3247
3248 .ays-poll-progress-banner-main .ays-poll-progress-banner-subtitle {
3249 font-size: 16px;
3250 margin: 0;
3251 opacity: 0.9;
3252 font-weight: 400;
3253 }
3254
3255 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon {
3256 margin-bottom: 5px;
3257 }
3258
3259 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box {
3260 border: 2px dotted rgba(255, 255, 255, 0.6);
3261 padding: 8px 16px;
3262 border-radius: 8px;
3263 background: rgba(255, 255, 255, 0.1);
3264 cursor: pointer;
3265 transition: all 0.3s ease;
3266 display: flex;
3267 align-items: center;
3268 gap: 8px;
3269 backdrop-filter: blur(10px);
3270 }
3271
3272 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box:hover {
3273 background: rgba(255, 255, 255, 0.2);
3274 border-color: rgba(255, 255, 255, 0.8);
3275 transform: translateY(-1px);
3276 }
3277
3278 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-text {
3279 font-size: 16px;
3280 font-weight: 700;
3281 letter-spacing: 1px;
3282 color: #fff;
3283 font-family: monospace;
3284 }
3285
3286 .ays-poll-progress-banner-main .ays-poll-progress-banner-copy-icon {
3287 opacity: 0.8;
3288 transition: opacity 0.3s ease;
3289 }
3290
3291 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box:hover .ays-poll-progress-banner-copy-icon {
3292 opacity: 1;
3293 }
3294
3295 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress {
3296 text-align: center;
3297 width: 100%;
3298 }
3299
3300 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-text {
3301 font-size: 14px;
3302 margin: 0 0 10px 0;
3303 opacity: 0.9;
3304 }
3305
3306 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3307 width: 300px;
3308 height: 10px;
3309 background: rgba(255, 255, 255, 0.2);
3310 border-radius: 4px;
3311 overflow: hidden;
3312 margin: 0 auto;
3313 }
3314
3315 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-fill {
3316 height: 100%;
3317 background: linear-gradient(90deg, #4ADE80 0%, #22C55E 100%);
3318 border-radius: 4px;
3319 transition: width 0.8s ease;
3320 width: 70%;
3321 }
3322
3323 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade {
3324 background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
3325 color: white;
3326 border: none;
3327 padding: 12px 24px;
3328 border-radius: 8px;
3329 font-size: 16px;
3330 font-weight: 600;
3331 cursor: pointer;
3332 transition: all 0.3s ease;
3333 box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
3334 text-decoration: none;
3335 display: inline-flex;
3336 align-items: center;
3337 gap: 8px;
3338 }
3339
3340 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade:hover {
3341 transform: translateY(-2px);
3342 box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
3343 text-decoration: none;
3344 color: white;
3345 }
3346
3347 .ays-poll-progress-banner-main .notice-dismiss:before {
3348 color: #fff;
3349 }
3350
3351 /* Copy notification */
3352 .ays-poll-copy-notification {
3353 position: fixed;
3354 top: 50%;
3355 left: 50%;
3356 transform: translate(-50%, -50%);
3357 background: rgba(0, 0, 0, 0.8);
3358 color: white;
3359 padding: 12px 24px;
3360 border-radius: 8px;
3361 font-size: 14px;
3362 z-index: 10000;
3363 opacity: 0;
3364 transition: opacity 0.3s ease;
3365 }
3366
3367 .ays-poll-copy-notification.show {
3368 opacity: 1;
3369 }
3370
3371 @media (max-width: 1400px) {
3372 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3373 flex-direction: column;
3374 }
3375 }
3376
3377 @media (max-width: 1200px) {
3378 .ays-poll-progress-banner-main .ays-poll-progress-banner-content {
3379 flex-direction: column;
3380 gap: 20px;
3381 }
3382
3383 .ays-poll-progress-banner-main .ays-poll-progress-banner-left {
3384 width: 100%;
3385 justify-content: center;
3386 text-align: center;
3387 flex-direction: column;
3388 }
3389
3390 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3391 width: 100%;
3392 }
3393
3394 .ays-poll-progress-banner-main .ays-poll-progress-banner-right {
3395 width: 100%;
3396 justify-content: center;
3397 }
3398 }
3399
3400 @media (max-width: 768px) {
3401 #ays-poll-progress-banner-main {
3402 display: none !important;
3403 }
3404
3405 .ays-poll-progress-banner-main {
3406 padding: 15px 20px;
3407 margin: 15px 0;
3408 }
3409
3410 .ays-poll-progress-banner-main .ays-poll-progress-banner-title {
3411 font-size: 18px;
3412 }
3413
3414 .ays-poll-progress-banner-main .ays-poll-progress-banner-subtitle {
3415 font-size: 14px;
3416 }
3417
3418 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3419 width: 100%;
3420 max-width: 280px;
3421 }
3422
3423 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade {
3424 padding: 10px 20px;
3425 font-size: 14px;
3426 }
3427 }
3428
3429 @media (max-width: 480px) {
3430 .ays-poll-progress-banner-main {
3431 padding: 12px 15px;
3432 }
3433
3434 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-text {
3435 font-size: 14px;
3436 }
3437
3438 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3439 max-width: 250px;
3440 }
3441 }
3442 ';
3443
3444 $content[] = '</style>';
3445
3446 $content = implode( '', $content );
3447 echo ($content);
3448
3449 }
3450
3451 public function ays_poll_sale_message_poll_pro(){
3452 $content = array();
3453
3454 $poll_cta_button_link = esc_url( 'https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=poll-free&utm_campaign=mega-bundle-sale-banner-' . POLL_MAKER_AYS_VERSION );
3455
3456 $content[] = '<div id="ays-poll-dicount-month-main" class="ays-poll-admin-notice notice notice-success is-dismissible ays_poll_dicount_info">';
3457 $content[] = '<div id="ays-poll-dicount-month" class="ays_poll_dicount_month">';
3458
3459 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-text-box">';
3460 $content[] = '<div>';
3461 $content[] = '<span class="ays-poll-new-poll-pro-title">';
3462
3463 $content[] = __( "<span><a href='". $poll_cta_button_link ."' target='_blank' style='color:#ffffff; text-decoration: underline;'>Mega Bundle</a> (Quiz + Survey + Poll)</span>", 'poll-maker' );
3464
3465 $content[] = '</span>';
3466 $content[] = '</br>';
3467 $content[] = '<div class="ays-poll-new-poll-pro-mobile-image-display-block display_none">';
3468 $content[] = '<span class="ays-poll-sale-baner-mega-bundle-sale-text">50%</span>';
3469 $content[] = '<img src="' . esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/line.webp" style="width: 70px;">';
3470 $content[] = '</div>';
3471 $content[] = '<span class="ays-poll-new-poll-pro-desc">';
3472 $content[] = '<img class="ays-poll-new-poll-pro-guaranteeicon" src="' . esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/poll-maker-guaranteeicon.svg" style="width:30px;margin-right:5px">';
3473 $content[] =esc_html__( "30 Days Money Back Guarantee", "poll-maker" );
3474 $content[] = '</span>';
3475 $content[] = '</div>';
3476 $content[] = '<div style="display:flex;flex-wrap:wrap;width:min-content;">';
3477 $content[] = '<span class="ays-poll-sale-baner-mega-bundle-sale-text">50%</span>';
3478 $content[] = '<img src="' . esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/line.webp" class="ays-poll-new-mega-bundle-mobile-image-display-none" style="width: 70px;">';
3479 $content[] = '</div>';
3480 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form">';
3481
3482 $content[] = '<form action="" method="POST">';
3483 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
3484 if( current_user_can( 'manage_options' ) ){
3485 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
3486 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
3487 }
3488 $content[] = '</div>';
3489 $content[] = '</form>';
3490
3491 $content[] = '</div>';
3492
3493 $content[] = '</div>';
3494
3495 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-countdown-box">';
3496
3497 $content[] = '<div id="ays-poll-maker-countdown-main-container">';
3498 $content[] = '<div class="ays-poll-maker-countdown-container">';
3499
3500 $content[] = '<div id="ays-poll-countdown">';
3501
3502 $content[] = '<ul>';
3503 $content[] = '<li><span id="ays-poll-countdown-days"></span>days</li>';
3504 $content[] = '<li><span id="ays-poll-countdown-hours"></span>Hours</li>';
3505 $content[] = '<li><span id="ays-poll-countdown-minutes"></span>Minutes</li>';
3506 $content[] = '<li><span id="ays-poll-countdown-seconds"></span>Seconds</li>';
3507 $content[] = '</ul>';
3508
3509 $content[] = '</div>';
3510
3511 $content[] = '<div id="ays-poll-countdown-content" class="emoji">';
3512 $content[] = '<span>🚀</span>';
3513 $content[] = '<span>⌛</span>';
3514 $content[] = '<span>🔥</span>';
3515 $content[] = '<span>💣</span>';
3516 $content[] = '</div>';
3517
3518 $content[] = '</div>';
3519 $content[] = '</div>';
3520
3521 $content[] = '</div>';
3522
3523 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-button-box">';
3524
3525 $content[] = '<a href="'. $poll_cta_button_link .'" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now', 'poll-maker' ) . '</a>';
3526
3527 $content[] = '<span class="ays-poll-dicount-one-time-text">';
3528 $content[] =esc_html__( "One-time payment", "poll-maker" );
3529 $content[] = '</span>';
3530 $content[] = '</div>';
3531 $content[] = '</div>';
3532 $content[] = '</div>';
3533 $background_image = POLL_MAKER_AYS_ADMIN_URL . '/images/ays-poll-banner-background-50.svg';
3534 $close_banner_image = POLL_MAKER_AYS_ADMIN_URL . '/images/icons/ays-poll-close-banner-white.svg';
3535
3536 $content[] = '<style id="ays_poll_sale_message_poll_pro-inline-css">';
3537 $content[] = 'div#ays-poll-dicount-month-main{border:0;background:#fff;border-radius:20px;box-shadow:unset;position:relative;z-index:1;min-height:80px}.ays-poll-dicount-sale-name-discount-box,div#ays-poll-dicount-month-main.ays_poll_dicount_info button{display:flex;align-items:center}div#ays-poll-dicount-month-main div#ays-poll-dicount-month a.ays-poll-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-poll-dicount-month-main .btn-link{color:#007bff;background-color:transparent;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem}div#ays-poll-dicount-month-main.ays_poll_dicount_info{background-image:url("'. $background_image . '");background-position:center right;background-repeat:no-repeat;background-color:#5551ff; background-size:cover}#ays-poll-dicount-month-main .ays_poll_dicount_month{display:flex;align-items:center;justify-content:space-between;color:#fff}#ays-poll-dicount-month-main .ays_poll_dicount_month img{width:80px}#ays-poll-dicount-month-main .ays-poll-sale-banner-link{display:flex;justify-content:center;align-items:center;width:200px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box{font-size:14px;text-align:center;padding:12px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{text-align:left;width:25%;display:flex;justify-content:space-around;align-items:flex-start}.ays-poll-dicount-sale-name-discount-box div{margin-left:10px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:40%;display:flex;justify-content:center;align-items:center}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{width:20%;display:flex;justify-content:center;align-items:center;flex-direction:column}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-poll-pro-title{color:#fdfdfd;font-size:16.8px;font-style:normal;font-weight:600;line-height:normal}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-sale-baner-mega-bundle-sale-text{font-size:23px;font-weight:700;padding-left:5px;text-shadow:2px 1.3px 0 #f66123;-webkit-text-stroke-width:1px;-webkit-text-stroke-color:#4944FF;-moz-text-stroke-width:1px;-moz-text-stroke-color:#4944FF}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-poll-pro-desc{display:inline-block;color:#fff;font-size:15px;font-style:normal;font-weight:400;line-height:normal;margin-top:10px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-color{color:#971821}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-text-decoration{text-decoration:underline}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box .ays-button,#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{background:#971821;border-color:#fff;display:flex;justify-content:center;align-items:center;padding:5px 15px;font-size:16px;border-radius:5px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-poll-dicount-month-main #ays-poll-dismiss-buttons-content{display:flex;justify-content:center}#ays-poll-dicount-month-main #ays-poll-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#fff}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-opacity-box{width:19%}#ays-poll-dicount-month-main .ays-buy-now-opacity-button{padding:40px 15px;display:flex;justify-content:center;align-items:center;opacity:0}#ays-poll-maker-countdown-main-container .ays-poll-maker-countdown-container{margin:0 auto;text-align:center}#ays-poll-maker-countdown-main-container #ays-poll-countdown-headline{letter-spacing:.125rem;text-transform:uppercase;font-size:18px;font-weight:400;margin:0;padding:9px 0 4px;line-height:1.3}#ays-poll-maker-countdown-main-container li,#ays-poll-maker-countdown-main-container ul{margin:0}#ays-poll-maker-countdown-main-container li{display:inline-block;font-size:14px;list-style-type:none;padding:14px;text-transform:lowercase}#ays-poll-maker-countdown-main-container li span{display:flex;justify-content:center;align-items:center;font-size:40px;min-height:62px;min-width:62px;border-radius:4.273px;border:.534px solid #f4f4f4;background:#9896ed}#ays-poll-maker-countdown-main-container .emoji{display:none;padding:1rem}#ays-poll-maker-countdown-main-container .emoji span{font-size:30px;padding:0 .5rem}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box li{position:relative}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box li span:after{content:":";color:#fff;position:absolute;top:10px;right:-5px;font-size:40px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box li span#ays-poll-countdown-seconds:after{content:unset}#ays-poll-dicount-month-main #ays-button-top-buy-now{display:flex;align-items:center;border-radius:6.409px;background:#f66123;padding:12px 32px;color:#fff;font-size:12.818px;font-style:normal;font-weight:800;line-height:normal;margin:0!important}div#ays-poll-dicount-month-main button.notice-dismiss:before{color:#fff;content:"";background-image:url("'.$close_banner_image.'");font-size:22px;font-weight:700;font-family:sans-serif}#ays-poll-dicount-month-main .ays-poll-new-mega-bundle-guaranteeicon{width:30px;margin-right:5px}#ays-poll-dicount-month-main .ays-poll-dicount-one-time-text{color:#fff;font-size:12px;font-style:normal;font-weight:600;line-height:normal}@media all and (max-width:1024px){#ays-poll-dicount-month-main{display:none!important}}@media all and (max-width:768px){div#ays-poll-dicount-month-main{padding-right:0}div#ays-poll-dicount-month-main .ays_poll_dicount_month{display:flex;align-items:center;justify-content:space-between;align-content:center;flex-wrap:wrap;flex-direction:column;padding:10px 0}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box{width:100%!important;text-align:center}#ays-poll-maker-countdown-main-container #ays-poll-countdown-headline{font-size:15px;font-weight:600}#ays-poll-maker-countdown-main-container ul{font-weight:500}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:100%!important;text-align:center;flex-direction:column;margin-top:20px;justify-content:center;align-items:center}.ays-poll-dicount-sale-name-discount-box{display:block}.ays-poll-dicount-sale-name-discount-box div{margin-left:0}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box li span:after{top:unset}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:100%}#ays-poll-dicount-month-main .ays-button{margin:0 auto!important}div#ays-poll-dicount-month-main.ays_poll_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}#ays-poll-dicount-month-main #ays-poll-dismiss-buttons-content .ays-button{padding-left:unset!important}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-poll-dicount-month-main .ays-buy-now-opacity-button{display:none}#ays-poll-dicount-month-main .ays-poll-dismiss-buttons-container-for-form{position:static!important}.comparison .product img{width:70px}.ays-poll-features-wrap .comparison a.price-buy{padding:8px 5px;font-size:11px}}@media screen and (max-width:1305px) and (min-width:768px){div#ays-poll-dicount-month-main.ays_poll_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box strong{font-size:15px}#ays-poll-maker-countdown-main-container li{font-size:11px}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-opacity-box{display:none}}@media screen and (max-width:1680px) and (min-width:1551px){div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:29%}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:30%}}@media screen and (max-width:1550px) and (min-width:1400px){div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:31%}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:35%}}@media screen and (max-width:1274px){div#ays-poll-maker-countdown-main-container li span{font-size:25px;min-height:40px;min-width:40px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-poll-pro-title{font-size:15px}}@media screen and (max-width:1200px){#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{margin-bottom:16px}#ays-poll-maker-countdown-main-container ul{padding-left:0}#ays-poll-dicount-month-main .ays-poll-coupon-row{width:120px;font-size:18px}#ays-poll-dicount-month-main #ays-button-top-buy-now{padding:12px 20px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box{font-size:12px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box .ays-poll-new-mega-bundle-desc{font-size:13px}}@media screen and (max-width:1076px) and (min-width:769px){#ays-poll-maker-countdown-main-container li{padding:10px}#ays-poll-dicount-month-main .ays-poll-coupon-row{width:100px;font-size:16px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-button-box{margin-bottom:16px}#ays-poll-dicount-month-main #ays-button-top-buy-now{padding:12px 15px}#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box{font-size:11px;padding:12px 0}}@media screen and (max-width:1250px) and (min-width:769px){div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-countdown-box{width:45%}div#ays-poll-dicount-month-main .ays-poll-dicount-wrap-box.ays-poll-dicount-wrap-text-box{width:35%}div#ays-poll-maker-countdown-main-container li span{font-size:30px;min-height:50px;min-width:50px}}';
3538 $content[] = '</style>';
3539
3540 $content = implode( '', $content );
3541 echo ( $content );
3542 }
3543
3544 public function add_tabs() {
3545 $screen = get_current_screen();
3546
3547 if ( ! $screen) {
3548 return;
3549 }
3550
3551 $title = esc_html__( 'General Information:', "poll-maker");
3552 $content_text = '<div>
3553 <span>'. esc_html__( "The WordPress Poll Maker plugin is here to help you quickly create advanced-level online polls and make your WordPress website more interactive. Use it to conduct elections, surveys and etc. Easily generate poll types like;", "poll-maker") .'</span>
3554 </div>
3555 <br>
3556 <div>
3557 <span><strong>'. esc_html__( "Choosing", "poll-maker") .'</strong> – '. esc_html__( "create many options and let your users choose, or add their custom answers.", "poll-maker") .'</span>
3558 </div>
3559 <div>
3560 <span><strong>'. esc_html__( "Rating", "poll-maker") .'</strong> – '. esc_html__( "with this poll type, the visitors will be able to weigh via a 1-5 star rating system or emojis via the graphical interface.", "poll-maker") .'</span>
3561 </div>
3562 <div>
3563 <span><strong>'. esc_html__( "Voting", "poll-maker") .'</strong> – '. esc_html__( "make the participants evaluate your product by using like/dislike buttons or smiley/frown emojis.", "poll-maker") .'</span>
3564 </div>
3565 <div>
3566 <span><strong>'. esc_html__( "Versus", "poll-maker") .'</strong> – '. esc_html__( "Select two statements or images that are opposed to each other, and make your users choose the perfect one.", "poll-maker") .'</span>
3567 </div>
3568 <div>
3569 <span><strong>'. esc_html__( "Range", "poll-maker") .'</strong> – '. esc_html__( "the users will be able to choose the answer across the 0-100 scale.", "poll-maker") .'</span>
3570 </div>
3571 <div>
3572 <span><strong>'. esc_html__( "Text", "poll-maker") .'</strong> – '. esc_html__( "with this poll type the visitors should write down their own answers on the text boundaries.", "poll-maker") .'</span>
3573 </div>
3574 <div>
3575 <span><strong>'. esc_html__( "Dropdown", "poll-maker") .'</strong> – '. esc_html__( "the users will choose the multiple-choice answers from a list of answers appeared in a dropdown form.", "poll-maker") .'</span>
3576 </div>
3577 <br>
3578 <div>
3579 <span>'. esc_html__( "Increase engagement of your website with the integrated, formatting, image, audio, video poll question types feature.", "poll-maker") .'</span>
3580 </div>';
3581
3582 $sidebar_content = '<p><strong>'. esc_html__( 'For more information:', "poll-maker") .'</strong></p>' .
3583 '<p>
3584 <a href="https://www.youtube.com/watch?v=RDKZXFmG6Pc" target="_blank">' .esc_html__( 'YouTube video tutorials' , "poll-maker" ) . '</a>
3585 </p>' .
3586 '<p>
3587 <a href="https://ays-pro.com/wordpress-poll-maker-user-manual" target="_blank">' .esc_html__( 'Documentation', "poll-maker" ) . '</a>
3588 </p>' .
3589 '<p>
3590 <a href="https://ays-pro.com/wordpress/poll-maker" target="_blank">' .esc_html__( 'Poll Maker plugin pro version', "poll-maker" ) . '</a>
3591 </p>' .
3592 '<p>
3593 <a href="https://poll-plugin.com/wordpress-poll-plugin-pro-demo/" target="_blank">' .esc_html__( 'Poll Maker plugin demo', "poll-maker" ) . '</a>
3594 </p>';
3595
3596
3597 $content = '<h2>' .esc_html__( 'Poll Maker Information', "poll-maker") . '</h2>';
3598 $content .= '<div>' . $content_text . '</div>';
3599
3600 $help_tab_content = array(
3601 'id' => 'poll_maker_help_tab',
3602 'title' => $title,
3603 'content' => $content
3604 );
3605
3606 $screen->add_help_tab($help_tab_content);
3607
3608 $screen->set_help_sidebar($sidebar_content);
3609 }
3610
3611 /**
3612 * Recursive sanitation for an array
3613 *
3614 * @param $array
3615 *
3616 * @return mixed
3617 */
3618 public static function recursive_sanitize_text_field($array) {
3619 foreach ( $array as $key => &$value ) {
3620 if ( is_array( $value ) ) {
3621 $value = self::recursive_sanitize_text_field($value);
3622 } else {
3623 $value = sanitize_text_field( $value );
3624 }
3625 }
3626 return $array;
3627 }
3628
3629 public static function get_max_id( $table ) {
3630 global $wpdb;
3631 $db_table = $wpdb->prefix . 'ayspoll_'.$table;;
3632
3633 $sql = "SELECT MAX(id) FROM {$db_table}";
3634
3635 $result = intval( $wpdb->get_var( $sql ) );
3636
3637 return $result;
3638 }
3639
3640 public function ays_poll_generate_message_vars_html( $poll_message_vars ) {
3641 $content = array();
3642 $var_counter = 0;
3643
3644 $allowed_tags = array(
3645 'div' => array(
3646 'class' => true
3647 ),
3648 'span' => array(),
3649 'a' => array(
3650 'class' => true,
3651 'data-toggle' => true,
3652 'data-html' => true,
3653 'title' => true
3654 ),
3655 'i' => array(
3656 'class' => true
3657 ),
3658 'label' => array(
3659 'class' => true
3660 ),
3661 'input' => array(
3662 'type' => true,
3663 'class' => true,
3664 'hidden' => true,
3665 'id' => true,
3666 'name' => true,
3667 'value' => true
3668 )
3669 );
3670
3671 $content[] = '<div class="ays-poll-message-vars-box">';
3672 $content[] = '<div class="ays-poll-message-vars-icon">';
3673 $content[] = '<div>';
3674 $content[] = '<i class="ays_poll_fa ays_fa_link"></i>';
3675 $content[] = '</div>';
3676 $content[] = '<div>';
3677 $content[] = '<span>'.esc_html__("Message Variables" , "poll-maker") .'</span>';
3678 $content[] = '<a class="ays_help" data-toggle="tooltip" data-html="true" title="'.esc_html__("Insert your preferred message variable into the editor by clicking." , "poll-maker") .'">';
3679 $content[] = '<i class="fas fa-info-circle"></i>';
3680 $content[] = '</a>';
3681 $content[] = '</div>';
3682 $content[] = '</div>';
3683 $content[] = '<div class="ays-poll-message-vars-data">';
3684 foreach($poll_message_vars as $var => $var_name){
3685 $var_counter++;
3686 $content[] = '<label class="ays-poll-message-vars-each-data-label">';
3687 $content[] = '<input type="radio" class="ays-poll-message-vars-each-data-checker" hidden id="ays_poll_message_var_count_'. $var_counter .'" name="ays_poll_message_var_count">';
3688 $content[] = '<div class="ays-poll-message-vars-each-data">';
3689 $content[] = '<input type="hidden" class="ays-poll-message-vars-each-var" value="'. $var .'">';
3690 $content[] = '<span>'. $var_name .'</span>';
3691 $content[] = '</div>';
3692 $content[] = '</label>';
3693 }
3694 $content[] = '</div>';
3695 $content[] = '</div>';
3696
3697 $content = implode( '', $content );
3698
3699 return wp_kses( $content, $allowed_tags );
3700 }
3701
3702 /**
3703 * Determine if the plugin/addon installations are allowed.
3704 *
3705 * @since 1.3.9
3706 *
3707 * @param string $type Should be `plugin` or `addon`.
3708 *
3709 * @return bool
3710 */
3711 public static function ays_poll_can_install( $type ) {
3712
3713 return self::ays_poll_can_do( 'install', $type );
3714 }
3715
3716 /**
3717 * Determine if the plugin/addon activations are allowed.
3718 *
3719 * @since 1.3.9
3720 *
3721 * @param string $type Should be `plugin` or `addon`.
3722 *
3723 * @return bool
3724 */
3725 public static function ays_poll_can_activate( $type ) {
3726
3727 return self::ays_poll_can_do( 'activate', $type );
3728 }
3729
3730 /**
3731 * Determine if the plugin/addon installations/activations are allowed.
3732 *
3733 * @since 1.3.9
3734 *
3735 * @param string $what Should be 'activate' or 'install'.
3736 * @param string $type Should be `plugin` or `addon`.
3737 *
3738 * @return bool
3739 */
3740 public static function ays_poll_can_do( $what, $type ) {
3741
3742 if ( ! in_array( $what, array( 'install', 'activate' ), true ) ) {
3743 return false;
3744 }
3745
3746 if ( ! in_array( $type, array( 'plugin', 'addon' ), true ) ) {
3747 return false;
3748 }
3749
3750 $capability = $what . '_plugins';
3751
3752 if ( ! current_user_can( $capability ) ) {
3753 return false;
3754 }
3755
3756 // Determine whether file modifications are allowed and it is activation permissions checking.
3757 if ( $what === 'install' && ! wp_is_file_mod_allowed( 'ays_poll_can_install' ) ) {
3758 return false;
3759 }
3760
3761 // All plugin checks are done.
3762 if ( $type === 'plugin' ) {
3763 return true;
3764 }
3765 return false;
3766 }
3767
3768 /**
3769 * Activate plugin.
3770 *
3771 * @since 1.0.0
3772 * @since 1.3.9 Updated the permissions checking.
3773 */
3774 public function ays_poll_activate_plugin() {
3775
3776 // Run a security check.
3777 check_ajax_referer( $this->plugin_name . '-install-plugin-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
3778
3779 // Check for permissions.
3780 if ( ! current_user_can( 'activate_plugins' ) ) {
3781 wp_send_json_error( esc_html__( 'Plugin activation is disabled for you on this site.', $this->plugin_name ) );
3782 }
3783
3784 $type = 'addon';
3785
3786 if ( isset( $_POST['plugin'] ) ) {
3787
3788 if ( ! empty( $_POST['type'] ) ) {
3789 $type = sanitize_key( $_POST['type'] );
3790 }
3791
3792 $plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
3793 $activate = activate_plugins( $plugin );
3794
3795 if ( ! is_wp_error( $activate ) ) {
3796 if ( $type === 'plugin' ) {
3797 wp_send_json_success( esc_html__( 'Plugin activated.', $this->plugin_name ) );
3798 } else {
3799 ( esc_html__( 'Addon activated.', $this->plugin_name ) );
3800 }
3801 }
3802 }
3803
3804 if ( $type === 'plugin' ) {
3805 wp_send_json_error( esc_html__( 'Could not activate the plugin. Please activate it on the Plugins page.', $this->plugin_name ) );
3806 }
3807
3808 wp_send_json_error( esc_html__( 'Could not activate the addon. Please activate it on the Plugins page.', $this->plugin_name ) );
3809 }
3810
3811 /**
3812 * Install addon.
3813 *
3814 * @since 1.0.0
3815 * @since 1.3.9 Updated the permissions checking.
3816 */
3817 public function ays_poll_install_plugin() {
3818
3819 // Run a security check.
3820 check_ajax_referer( $this->plugin_name . '-install-plugin-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
3821
3822 $generic_error = esc_html__( 'There was an error while performing your request.', $this->plugin_name );
3823 $type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : '';
3824
3825 // Check if new installations are allowed.
3826 if ( ! self::ays_poll_can_install( $type ) ) {
3827 wp_send_json_error( $generic_error );
3828 }
3829
3830 $error = $type === 'plugin'
3831 ? esc_html__( 'Could not install the plugin. Please download and install it manually.', $this->plugin_name )
3832 : "";
3833
3834 $plugin_url = ! empty( $_POST['plugin'] ) ? esc_url_raw( wp_unslash( $_POST['plugin'] ) ) : '';
3835
3836 if ( empty( $plugin_url ) ) {
3837 wp_send_json_error( $error );
3838 }
3839
3840 // Prepare variables.
3841 $url = esc_url_raw(
3842 add_query_arg(
3843 [
3844 'page' => 'poll-maker-ays-featured-plugins',
3845 ],
3846 admin_url( 'admin.php' )
3847 )
3848 );
3849
3850 ob_start();
3851 $creds = request_filesystem_credentials( $url, '', false, false, null );
3852
3853 // Hide the filesystem credentials form.
3854 ob_end_clean();
3855
3856 // Check for file system permissions.
3857 if ( $creds === false ) {
3858 wp_send_json_error( $error );
3859 }
3860
3861 if ( ! WP_Filesystem( $creds ) ) {
3862 wp_send_json_error( $error );
3863 }
3864
3865 /*
3866 * We do not need any extra credentials if we have gotten this far, so let's install the plugin.
3867 */
3868 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-upgrader.php';
3869 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-install-skin.php';
3870 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-skin.php';
3871
3872
3873 // Do not allow WordPress to search/download translations, as this will break JS output.
3874 remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
3875
3876 // Create the plugin upgrader with our custom skin.
3877 $installer = new PollMaker\Helpers\PollMakerPluginSilentUpgrader( new Poll_Maker_Install_Skin() );
3878
3879 // Error check.
3880 if ( ! method_exists( $installer, 'install' ) ) {
3881 wp_send_json_error( $error );
3882 }
3883
3884 $installer->install( $plugin_url );
3885
3886 // Flush the cache and return the newly installed plugin basename.
3887 wp_cache_flush();
3888
3889 $plugin_basename = $installer->plugin_info();
3890
3891 if ( empty( $plugin_basename ) ) {
3892 wp_send_json_error( $error );
3893 }
3894
3895 $result = array(
3896 'msg' => $generic_error,
3897 'is_activated' => false,
3898 'basename' => $plugin_basename,
3899 );
3900
3901 // Check for permissions.
3902 if ( ! current_user_can( 'activate_plugins' ) ) {
3903 $result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed.', $this->plugin_name ) : "";
3904
3905 wp_send_json_success( $result );
3906 }
3907
3908 // Activate the plugin silently.
3909 $activated = activate_plugin( $plugin_basename );
3910 remove_action( 'activated_plugin', array( 'gallery_p_gallery_activation_redirect_method', 'ays_sccp_activation_redirect_method' ), 100 );
3911
3912 if ( ! is_wp_error( $activated ) ) {
3913
3914 $result['is_activated'] = true;
3915 $result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed and activated.', $this->plugin_name ) : esc_html__( 'Addon installed and activated.', $this->plugin_name );
3916
3917 wp_send_json_success( $result );
3918 }
3919
3920 // Fallback error just in case.
3921 wp_send_json_error( $result );
3922 }
3923
3924 /**
3925 * List of AM plugins that we propose to install.
3926 *
3927 * @since 1.3.9
3928 *
3929 * @return array
3930 */
3931 protected function poll_get_am_plugins() {
3932 if ( !isset( $_SESSION ) ) {
3933 session_start();
3934 }
3935
3936 $images_url = POLL_MAKER_AYS_ADMIN_URL . '/images/icons/';
3937
3938 $plugin_slug = array(
3939 'fox-lms',
3940 'quiz-maker',
3941 'survey-maker',
3942 'ays-popup-box',
3943 'gallery-photo-gallery',
3944 'secure-copy-content-protection',
3945 'personal-dictionary',
3946 'chart-builder',
3947 'easy-form',
3948 );
3949
3950 $plugin_url_arr = array();
3951 foreach ($plugin_slug as $key => $slug) {
3952 if ( isset( $_SESSION['ays_poll_our_product_links'] ) && !empty( $_SESSION['ays_poll_our_product_links'] )
3953 && isset( $_SESSION['ays_poll_our_product_links'][$slug] ) && !empty( $_SESSION['ays_poll_our_product_links'][$slug] ) ) {
3954 $plugin_url = (isset( $_SESSION['ays_poll_our_product_links'][$slug] ) && $_SESSION['ays_poll_our_product_links'][$slug] != "") ? esc_url( $_SESSION['ays_poll_our_product_links'][$slug] ) : "";
3955 } else {
3956 $latest_version = $this->ays_poll_get_latest_plugin_version($slug);
3957 $plugin_url = 'https://downloads.wordpress.org/plugin/'. $slug .'.zip';
3958 if ( $latest_version != '' ) {
3959 $plugin_url = 'https://downloads.wordpress.org/plugin/'. $slug .'.'. $latest_version .'.zip';
3960 $_SESSION['ays_poll_our_product_links'][$slug] = $plugin_url;
3961 }
3962 }
3963
3964 $plugin_url_arr[$slug] = $plugin_url;
3965 }
3966
3967 $plugins_array = array(
3968 'fox-lms/fox-lms.php' => array(
3969 'icon' => $images_url . 'icon-fox-lms-128x128.png',
3970 'name' => __( 'Fox LMS', 'poll-maker' ),
3971 'desc' => __( 'Build and manage online courses directly on your WordPress site.', 'poll-maker' ),
3972 'desc_hidden' => __( 'With the FoxLMS plugin, you can create, sell, and organize courses, lessons, and quizzes, transforming your website into a dynamic e-learning platform.', 'poll-maker' ),
3973 'wporg' => 'https://wordpress.org/plugins/fox-lms/',
3974 'buy_now' => 'https://foxlms.com/pricing/?utm_source=dashboard&utm_medium=poll-free&utm_campaign=fox-lms-our-products-page',
3975 'url' => $plugin_url_arr['fox-lms'],
3976 ),
3977 'quiz-maker/quiz-maker.php' => array(
3978 'icon' => $images_url . 'icon-quiz-128x128.png',
3979 'name' => __( 'Quiz Maker', 'poll-maker' ),
3980 'desc' => __( 'With our Quiz Maker plugin it’s easy to make a quiz in a short time.', 'poll-maker' ),
3981 'desc_hidden' => __( 'You to add images to your quiz, order unlimited questions. Also you can style your quiz to satisfy your visitors.', 'poll-maker' ),
3982 'wporg' => 'https://wordpress.org/plugins/quiz-maker/',
3983 'buy_now' => 'https://ays-pro.com/wordpress/quiz-maker/',
3984 'url' => $plugin_url_arr['quiz-maker'],
3985 ),
3986 'survey-maker/survey-maker.php' => array(
3987 'icon' => $images_url . 'icon-survey-128x128.png',
3988 'name' => __( 'Survey Maker', 'poll-maker' ),
3989 'desc' => __( 'Make amazing online surveys and get real-time feedback quickly and easily.', 'poll-maker' ),
3990 'desc_hidden' => __( 'Learn what your website visitors want, need, and expect with the help of Survey Maker. Build surveys without limiting your needs.', 'poll-maker' ),
3991 'wporg' => 'https://wordpress.org/plugins/survey-maker/',
3992 'buy_now' => 'https://ays-pro.com/wordpress/survey-maker',
3993 'url' => $plugin_url_arr['survey-maker'],
3994 ),
3995 'ays-popup-box/ays-pb.php' => array(
3996 'icon' => $images_url . 'icon-popup-128x128.png',
3997 'name' => __( 'Popup Box', 'poll-maker' ),
3998 'desc' => __( 'Popup everything you want! Create informative and promotional popups all in one plugin.', 'poll-maker' ),
3999 'desc_hidden' => __( 'Attract your visitors and convert them into email subscribers and paying customers.', 'poll-maker' ),
4000 'wporg' => 'https://wordpress.org/plugins/ays-popup-box/',
4001 'buy_now' => 'https://ays-pro.com/wordpress/popup-box/',
4002 'url' => $plugin_url_arr['ays-popup-box'],
4003 ),
4004 'gallery-photo-gallery/gallery-photo-gallery.php' => array(
4005 'icon' => $images_url . 'icon-gallery-128x128.png',
4006 'name' => __( 'Gallery Photo Gallery', 'poll-maker' ),
4007 'desc' => __( 'Create unlimited galleries and include unlimited images in those galleries.', 'poll-maker' ),
4008 'desc_hidden' => __( 'Represent images in an attractive way. Attract people with your own single and multiple free galleries from your photo library.', 'poll-maker' ),
4009 'wporg' => 'https://wordpress.org/plugins/gallery-photo-gallery/',
4010 'buy_now' => 'https://ays-pro.com/wordpress/photo-gallery/',
4011 'url' => $plugin_url_arr['gallery-photo-gallery'],
4012 ),
4013 'secure-copy-content-protection/secure-copy-content-protection.php' => array(
4014 'icon' => $images_url . 'icon-sccp-128x128.png',
4015 'name' => __( 'Secure Copy Content Protection', 'poll-maker' ),
4016 'desc' => __( 'Disable the right click, copy paste, content selection and copy shortcut keys on your website.', 'poll-maker' ),
4017 'desc_hidden' => __( 'Protect web content from being plagiarized. Prevent plagiarism from your website with this easy to use plugin.', 'poll-maker' ),
4018 'wporg' => 'https://wordpress.org/plugins/secure-copy-content-protection/',
4019 'buy_now' => 'https://ays-pro.com/wordpress/secure-copy-content-protection/',
4020 'url' => $plugin_url_arr['secure-copy-content-protection'],
4021 ),
4022 'personal-dictionary/personal-dictionary.php' => array(
4023 'icon' => $images_url . 'pd-logo-128x128.png',
4024 'name' => __( 'Personal Dictionary', 'poll-maker' ),
4025 'desc' => __( 'Allow your students to create personal dictionary, study and memorize the words.', 'poll-maker' ),
4026 'desc_hidden' => __( 'Allow your users to create their own digital dictionaries and learn new words and terms as fastest as possible.', 'poll-maker' ),
4027 'wporg' => 'https://wordpress.org/plugins/personal-dictionary/',
4028 'buy_now' => 'https://ays-pro.com/wordpress/personal-dictionary/',
4029 'url' => $plugin_url_arr['personal-dictionary'],
4030 ),
4031 'chart-builder/chart-builder.php' => array(
4032 'icon' => $images_url . 'chartify-150x150.png',
4033 'name' => __( 'Chart Builder', 'poll-maker' ),
4034 'desc' => __( 'Chart Builder plugin allows you to create beautiful charts', 'poll-maker' ),
4035 'desc_hidden' => __( ' and graphs easily and quickly.', 'poll-maker' ),
4036 'wporg' => 'https://wordpress.org/plugins/chart-builder/',
4037 'buy_now' => 'https://ays-pro.com/wordpress/chart-builder/',
4038 'url' => $plugin_url_arr['chart-builder'],
4039 ),
4040 'easy-form/easy-form.php' => array(
4041 'icon' => $images_url . 'easyform-150x150.png',
4042 'name' => __( 'Easy Form', 'poll-maker' ),
4043 'desc' => __( 'Choose the best WordPress form builder plugin. ', 'poll-maker' ),
4044 'desc_hidden' => __( 'Create contact forms, payment forms, surveys, and many more custom forms. Build forms easily with us.', 'poll-maker' ),
4045 'wporg' => 'https://wordpress.org/plugins/easy-form/',
4046 'buy_now' => 'https://ays-pro.com/wordpress/easy-form',
4047 'url' => $plugin_url_arr['easy-form'],
4048 ),
4049 );
4050
4051 return $plugins_array;
4052 }
4053
4054 protected function ays_poll_get_latest_plugin_version( $slug ){
4055
4056 if ( is_null( $slug ) || empty($slug) ) {
4057 return "";
4058 }
4059
4060 $version_latest = "";
4061
4062 if ( ! function_exists( 'plugins_api' ) ) {
4063 require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
4064 }
4065
4066 // set the arguments to get latest info from repository via API ##
4067 $args = array(
4068 'slug' => $slug,
4069 'fields' => array(
4070 'version' => true,
4071 )
4072 );
4073
4074 /** Prepare our query */
4075 $call_api = plugins_api( 'plugin_information', $args );
4076
4077 /** Check for Errors & Display the results */
4078 if ( is_wp_error( $call_api ) ) {
4079 $api_error = $call_api->get_error_message();
4080 } else {
4081
4082 //echo $call_api; // everything ##
4083 if ( ! empty( $call_api->version ) ) {
4084 $version_latest = $call_api->version;
4085 }
4086 }
4087
4088 return $version_latest;
4089 }
4090
4091 /**
4092 * Get AM plugin data to display in the Addons section of About tab.
4093 *
4094 * @since 6.4.0.4
4095 *
4096 * @param string $plugin Plugin slug.
4097 * @param array $details Plugin details.
4098 * @param array $all_plugins List of all plugins.
4099 *
4100 * @return array
4101 */
4102 protected function poll_get_plugin_data( $plugin, $details, $all_plugins ) {
4103
4104 $have_pro = ( ! empty( $details['pro'] ) && ! empty( $details['pro']['plug'] ) );
4105 $show_pro = false;
4106
4107 $plugin_data = array();
4108
4109 if ( $have_pro ) {
4110 if ( array_key_exists( $plugin, $all_plugins ) ) {
4111 if ( is_plugin_active( $plugin ) ) {
4112 $show_pro = true;
4113 }
4114 }
4115 if ( array_key_exists( $details['pro']['plug'], $all_plugins ) ) {
4116 $show_pro = true;
4117 }
4118 if ( $show_pro ) {
4119 $plugin = $details['pro']['plug'];
4120 $details = $details['pro'];
4121 }
4122 }
4123
4124 if ( array_key_exists( $plugin, $all_plugins ) ) {
4125 if ( is_plugin_active( $plugin ) ) {
4126 // Status text/status.
4127 $plugin_data['status_class'] = 'status-active';
4128 $plugin_data['status_text'] = esc_html__( 'Active', 'poll-maker' );
4129 // Button text/status.
4130 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info disabled';
4131 $plugin_data['action_text'] = esc_html__( 'Activated', 'poll-maker' );
4132 $plugin_data['plugin_src'] = esc_attr( $plugin );
4133 } else {
4134 // Status text/status.
4135 $plugin_data['status_class'] = 'status-installed';
4136 $plugin_data['status_text'] = esc_html__( 'Inactive', 'poll-maker' );
4137 // Button text/status.
4138 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info';
4139 $plugin_data['action_text'] = esc_html__( 'Activate', 'poll-maker' );
4140 $plugin_data['plugin_src'] = esc_attr( $plugin );
4141 }
4142 } else {
4143 // Doesn't exist, install.
4144 // Status text/status.
4145 $plugin_data['status_class'] = 'status-missing';
4146
4147 if ( isset( $details['act'] ) && 'go-to-url' === $details['act'] ) {
4148 $plugin_data['status_class'] = 'status-go-to-url';
4149 }
4150 $plugin_data['status_text'] = esc_html__( 'Not Installed', 'poll-maker' );
4151 // Button text/status.
4152 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info';
4153 $plugin_data['action_text'] = esc_html__( 'Install Plugin', 'poll-maker' );
4154 $plugin_data['plugin_src'] = esc_url( $details['url'] );
4155 }
4156
4157 $plugin_data['details'] = $details;
4158
4159 return $plugin_data;
4160 }
4161
4162 /**
4163 * Display the Addons section of About tab.
4164 *
4165 * @since 1.3.9
4166 */
4167 public function poll_output_about_addons() {
4168
4169 if ( ! function_exists( 'get_plugins' ) ) {
4170 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4171 }
4172
4173 $all_plugins = get_plugins();
4174 $am_plugins = $this->poll_get_am_plugins();
4175 $can_install_plugins = self::ays_poll_can_install( 'plugin' );
4176 $can_activate_plugins = self::ays_poll_can_activate( 'plugin' );
4177
4178 $content = '';
4179 $content.= '<div class="ays-poll-cards-block">';
4180 foreach ( $am_plugins as $plugin => $details ){
4181
4182 $plugin_data = $this->poll_get_plugin_data( $plugin, $details, $all_plugins );
4183 $plugin_ready_to_activate = $can_activate_plugins
4184 && isset( $plugin_data['status_class'] )
4185 && $plugin_data['status_class'] === 'status-installed';
4186 $plugin_not_activated = ! isset( $plugin_data['status_class'] )
4187 || $plugin_data['status_class'] !== 'status-active';
4188
4189 $plugin_action_class = ( isset( $plugin_data['action_class'] ) && esc_attr( $plugin_data['action_class'] ) != "" ) ? esc_attr( $plugin_data['action_class'] ) : "";
4190
4191 $plugin_action_class_disbaled = "";
4192 if ( strpos($plugin_action_class, 'status-active') !== false ) {
4193 $plugin_action_class_disbaled = "disbaled='true'";
4194 }
4195
4196 $content .= '
4197 <div class="ays-poll-card">
4198 <div class="ays-poll-card__content flexible">
4199 <div class="ays-poll-card__content-img-box">
4200 <img class="ays-poll-card__img" src="'. esc_url( $plugin_data['details']['icon'] ) .'" alt="'. esc_attr( $plugin_data['details']['name'] ) .'">
4201 </div>
4202 <div class="ays-poll-card__text-block">
4203 <h5 class="ays-poll-card__title">'. esc_html( $plugin_data['details']['name'] ) .'</h5>
4204 <p class="ays-poll-card__text">'. wp_kses_post( $plugin_data['details']['desc'] ) .'
4205 <span class="ays-poll-card__text-hidden">
4206 '. wp_kses_post( $plugin_data['details']['desc_hidden'] ) .'
4207 </span>
4208 </p>
4209 </div>
4210 </div>
4211 <div class="ays-poll-card__footer">';
4212 if ( $can_install_plugins || $plugin_ready_to_activate || ! $details['wporg'] ) {
4213 $content .= '<button class="'. esc_attr( $plugin_data['action_class'] ) .'" data-plugin="'. esc_attr( $plugin_data['plugin_src'] ) .'" data-type="plugin" '. $plugin_action_class_disbaled .'>
4214 '. wp_kses_post( $plugin_data['action_text'] ) .'
4215 </button>';
4216 }
4217 elseif ( $plugin_not_activated ) {
4218 $content .= '<a href="'. esc_url( $details['wporg'] ) .'" target="_blank" rel="noopener noreferrer">
4219 '. esc_html_e( 'WordPress.org', $this->plugin_name ) .'
4220 <span aria-hidden="true" class="dashicons dashicons-external"></span>
4221 </a>';
4222 }
4223 $content .='
4224 <a target="_blank" href="'. esc_url( $plugin_data['details']['buy_now'] ) .'" class="ays-poll-card__btn-primary">'. __('Buy Now', 'poll-maker') .'</a>
4225 </div>
4226 </div>';
4227 }
4228 $install_plugin_nonce = wp_create_nonce( $this->plugin_name . '-install-plugin-nonce' );
4229 $content .= '<input type="hidden" id="ays_poll_ajax_install_plugin_nonce" name="ays_poll_ajax_install_plugin_nonce" value="'. $install_plugin_nonce .'">';
4230 $content .= '</div>';
4231
4232 echo $content;
4233 }
4234
4235 public function ays_poll_update_banner_time(){
4236
4237 $date = time() + ( 3 * 24 * 60 * 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
4238 // $date = time() + ( 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); // for testing | 1 min
4239 $next_3_days = date('M d, Y H:i:s', $date);
4240
4241 $ays_poll_banner_time = get_option('ays_poll_banner_time');
4242
4243 if ( !$ays_poll_banner_time || is_null( $ays_poll_banner_time ) ) {
4244 update_option('ays_poll_banner_time', $next_3_days );
4245 }
4246
4247 $get_ays_poll_banner_time = get_option('ays_poll_banner_time');
4248
4249 $val = 60*60*24*0.5; // half day
4250 // $val = 60; // for testing | 1 min
4251
4252 $current_date = current_time( 'mysql' );
4253 $date_diff = strtotime($current_date) - intval(strtotime($get_ays_poll_banner_time));
4254
4255 $days_diff = $date_diff / $val;
4256 if(intval($days_diff) > 0 ){
4257 update_option('ays_poll_banner_time', $next_3_days);
4258 $get_ays_poll_banner_time = get_option('ays_poll_banner_time');
4259 }
4260
4261 return $get_ays_poll_banner_time;
4262 }
4263
4264 public static function ays_poll_check_if_current_image_exists($image_url) {
4265 global $wpdb;
4266
4267 $res = true;
4268 if( !isset($image_url) ){
4269 $res = false;
4270 }
4271
4272 if ( isset($image_url) && !empty( $image_url ) ) {
4273
4274 $re = '/-\d+[Xx]\d+\./';
4275 $subst = '.';
4276
4277 $image_url = preg_replace($re, $subst, $image_url, 1);
4278
4279 $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
4280 if ( is_null( $attachment ) || empty( $attachment ) ) {
4281 $res = false;
4282 }
4283 }
4284
4285 return $res;
4286 }
4287
4288 public function ays_poll_maker_quick_start() {
4289 global $wpdb;
4290 error_reporting(0);
4291
4292 // Run a security check.
4293 check_ajax_referer( 'poll-maker-ajax-quick-poll-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
4294
4295 // Check for permissions.
4296 if ( !Poll_Maker_Data::check_user_capability() ) {
4297 ob_end_clean();
4298 $ob_get_clean = ob_get_clean();
4299 echo json_encode(array(
4300 'status' => false,
4301 'poll_id' => 0
4302 ));
4303 wp_die();
4304 }
4305
4306 $polls_table = esc_sql($wpdb->prefix . "ayspoll_polls");
4307 $answers_table = esc_sql($wpdb->prefix . "ayspoll_answers");
4308
4309 $title = stripslashes( sanitize_text_field($_REQUEST['ays-poll-title']) );
4310 $question = wp_kses_post( $_REQUEST['ays_poll_question'] );
4311
4312 $answers = self::recursive_sanitize_text_field($_REQUEST['ays-poll-answers']);
4313
4314 $allow_multivote = isset($_REQUEST['allow_multivote_switch']) && $_REQUEST['allow_multivote_switch'] == 'on' ? "on" : "off";
4315 $allow_not_vote = isset($_REQUEST['allow-not-vote']) && 'on' == $_REQUEST['allow-not-vote'] ? 1 : 0;
4316 $show_author = isset($_REQUEST['quick-poll-show_poll_author']) && 1 == $_REQUEST['quick-poll-show_poll_author'] ? 1 : 0;
4317 $show_title = isset($_REQUEST['quick-poll-show-title']) && $_REQUEST['quick-poll-show-title'] == 'off' ? 0 : 1;
4318 $show_creation_date = isset($_REQUEST['quick-poll-show-creation-date']) && $_REQUEST['quick-poll-show-creation-date'] == 'on' ? 1 : 0;
4319 $hide_results = isset($_REQUEST['quick-poll-hide-results']) && 1 == $_REQUEST['quick-poll-hide-results'] ? 1 : 0;
4320 $randomize_answers = isset($_REQUEST['quick-poll-randomize-answers']) && $_REQUEST['quick-poll-randomize-answers'] == 'on' ? 'on' : 'off';
4321 $enable_restart_button = isset($_REQUEST['quick-poll-enable-restart-button']) && $_REQUEST['quick-poll-enable-restart-button'] == 'on' ? 1 : 0;
4322 $res_rgba = isset($_REQUEST['quick-poll-res-rgba']) && $_REQUEST['quick-poll-res-rgba'] == 'on' ? 'on' : 'off';
4323
4324 if ($allow_multivote === 'on') {
4325 $multivote_min_count = sanitize_text_field($_REQUEST['quick-poll-multivote-min-count']);
4326 $multivote_max_count = sanitize_text_field($_REQUEST['quick-poll-multivote-max-count']);
4327 } else {
4328 $multivote_min_count = 1;
4329 $multivote_max_count = 1;
4330 }
4331
4332 $create_date = current_time( 'mysql' );
4333
4334 $user_id = get_current_user_id();
4335 $user = get_userdata($user_id);
4336 $author = array(
4337 'id' => $user->ID,
4338 'name' => $user->data->display_name
4339 );
4340 $options = json_encode(
4341 array(
4342 "poll_version" => POLL_MAKER_AYS_VERSION,
4343 "poll_enable_copy_protection" => "off",
4344 "poll_question_text_to_speech" => "off",
4345 "main_color" => "#0C6291",
4346 "text_color" => "#0C6291",
4347 "icon_color" => "#0C6291",
4348 "bg_color" => "#FBFEF9",
4349 "answer_bg_color" => "#FBFEF9",
4350 "answer_hover_color" => "#0C6291",
4351 "answer_border_side" => "all_sides",
4352 "title_bg_color" => "",
4353 "icon_size" => 24,
4354 "width" => 600,
4355 "width_for_mobile" => 0,
4356 "btn_text" => "Vote",
4357 "see_res_btn_text" => "See Results",
4358 "border_style" => "ridge",
4359 "border_radius" => "0",
4360 "border_width" => "1",
4361 "box_shadow_color" => "#000000",
4362 "enable_box_shadow" => "off",
4363 "enable_answer_style" => "on",
4364 "bg_image" => false,
4365 "info_form" => 0,
4366 "fields" => "apm-name,apm-email,apm_phone",
4367 "required_fields" => "apm-name,apm-email,apm_phone",
4368 "info_form_title" => "<h5>Please fill out the form:<\/h5>\n",
4369 "hide_results" => $hide_results,
4370 "hide_result_message" => 0,
4371 "hide_results_text" => "<p>Thanks for your answer!<\/p>\n",
4372 "result_message" => "",
4373 "allow_not_vote" => $allow_not_vote,
4374 "show_social" => 0,
4375 "poll_social_buttons_heading" => "",
4376 "poll_show_social_ln" => "on",
4377 "poll_show_social_fb" => "on",
4378 "poll_show_social_tr" => "on",
4379 "poll_show_social_vk" => "off",
4380 "enable_social_links" => "off",
4381 "poll_social_links_heading" => "",
4382 "social_links" => array(
4383 "linkedin_link" => "",
4384 "facebook_link" => "",
4385 "twitter_link" => "",
4386 "vkontakte_link" => "",
4387 "youtube_link" => "",
4388 "tiktok_link" => ""
4389 ),
4390 "load_effect" => "load_gif",
4391 "load_gif" => "plg_pro1",
4392 "custom_load" => false,
4393 "limit_users" => 0,
4394 "limit_users_method" => "ip",
4395 "limitation_message" => "<p>You have already voted<\/p>\n",
4396 "redirect_url" => false,
4397 "redirection_delay" => 0,
4398 "user_role" => "",
4399 "enable_restriction_pass" => 0,
4400 "restriction_pass_message" => "<p>You don\\'t have permissions for passing the poll<\/p>\n",
4401 "enable_logged_users" => 0,
4402 "enable_logged_users_message" => "<p>You must sign in for passing the poll<\/p>\n",
4403 "notify_email_on" => 0,
4404 "notify_email" => "",
4405 "published" => 1,
4406 "enable_pass_count" => "on",
4407 "result_sort_type" => "none",
4408 "create_date" => $create_date,
4409 "redirect_users" => 0,
4410 "redirect_after_vote_url" => false,
4411 "redirect_after_vote_delay" => 0,
4412 "activeInterval" => "2022-09-17",
4413 "deactiveInterval" => "2022-09-17",
4414 "activeIntervalSec" => "",
4415 "deactiveIntervalSec" => "",
4416 "active_date_message" => "<p>The poll has expired!<\/p>\n",
4417 "active_date_message_soon" => "<p style=\\\"text-align => center;\\\">The poll will be available soon!<\/p>\n",
4418 "vote_reason" => 0,
4419 "show_chart_type" => "google_bar_chart",
4420 "active_date_check" => "",
4421 "enable_restart_button" => $enable_restart_button,
4422 "enable_vote_btn" => 1,
4423 "show_votes_count" => 1,
4424 "attempts_count" => "1",
4425 "poll_main_url" => '',
4426 "show_create_date" => $show_creation_date,
4427 "show_author" => $show_author,
4428 "author" => $author,
4429 "show_res_percent" => 1,
4430 "show_result_btn_schedule" => 0,
4431 "ays_poll_show_timer" => 0,
4432 "show_bottom_timer" => 0,
4433 "ays_show_timer_type" => "countdown",
4434 "show_login_form" => "off",
4435 "poll_allow_answer" => 0,
4436 "poll_allow_answer_require" => 1,
4437 "versus_icon_type" => "default",
4438 "versus_icon_position" => "center",
4439 "versus_answers_label" => 0,
4440 "result_in_rgba" => $res_rgba,
4441 "enable_mailchimp" => "off",
4442 "enable_background_gradient" => "off",
4443 "background_gradient_color_1" => "#103251",
4444 "background_gradient_color_2" => "#607593",
4445 "poll_gradient_direction" => "vertical",
4446 "redirect_after_submit" => 0,
4447 "mailchimp_list" => "",
4448 "poll_direction" => "ltr",
4449 "poll_allow_multivote" => $allow_multivote,
4450 "multivote_answer_min_count" => $multivote_min_count,
4451 "poll_allow_multivote_count" => $multivote_max_count,
4452 "monitor_list" => "",
4453 "enable_monitor" => "off",
4454 "slack_conversation" => "",
4455 "enable_slack" => "off",
4456 "active_camp_list" => "",
4457 "active_camp_automation" => "",
4458 "enable_active_camp" => "off",
4459 "enable_zapier" => "off",
4460 "randomize_answers" => $randomize_answers,
4461 "enable_asnwers_sound" => "off",
4462 "enable_password" => "off",
4463 "password_poll" => "",
4464 "poll_password_message" => "Please enter password",
4465 "poll_enable_password_visibility" => "off",
4466 "background_size" => "cover",
4467 "disable_answer_hover" => 0,
4468 "custom_class" => "",
4469 "enable_poll_title_text_shadow" => "off",
4470 "poll_title_text_shadow" => "rgba(255,255,255,0)",
4471 "poll_title_text_shadow_x_offset" => 2,
4472 "poll_title_text_shadow_y_offset" => 2,
4473 "poll_title_text_shadow_z_offset" => 0,
4474 "poll_bg_image_position" => "center center",
4475 "poll_bg_img_in_finish_page" => "off",
4476 "ays_add_post_for_poll" => "off",
4477 "show_answer_message" => "off",
4478 "show_answers_caption" => "on",
4479 "answers_grid_column_mobile" => "on",
4480 "enable_vote_limitation" => "off",
4481 "vote_limitation" => "",
4482 "limitation_time_period" => "minute",
4483 "enable_tackers_count" => "off",
4484 "tackers_count" => "",
4485 "ays_enable_mail_user" => "off",
4486 "vote_notification_email_msg" => "",
4487 "poll_answer_icon_check" => "off",
4488 "answers_icon" => "radio",
4489 "buttons_size" => "medium",
4490 "buttons_font_size" => "17",
4491 "poll_buttons_mobile_font_size" => "17",
4492 "buttons_left_right_padding" => "20",
4493 "buttons_top_bottom_padding" => "10",
4494 "buttons_border_radius" => "3",
4495 "redirect_after_submit_drpdwn" => 0,
4496 "user_add_answer_dropdown" => 0,
4497 "enable_google_sheets" => "off",
4498 "spreadsheet_id" => "",
4499 "enable_view_more_button" => "off",
4500 "poll_view_more_button_count" => 0,
4501 "poll_min_height" => "",
4502 "answer_sort_type" => "default",
4503 "answer_font_size" => "16",
4504 "poll_answer_font_size_mobile" => "16",
4505 "show_passed_users" => "off",
4506 "logo_image" => "",
4507 "allow_collect_user_info" => "off",
4508 "poll_send_mail_type" => "custom",
4509 "poll_sendgrid_email_from" => "",
4510 "poll_sendgrid_email_name" => "",
4511 "poll_sendgrid_template_id" => "",
4512 "limit_country" => "AD",
4513 "show_votes_before_voting" => "off",
4514 "show_votes_before_voting_by" => "by_count",
4515 "fake_votes" => "off",
4516 "dont_show_poll_cont" => "off",
4517 "see_result_button" => "on",
4518 "see_result_radio" => "ays_see_result_button",
4519 "loader_font_size" => "",
4520 "show_answers_numbering" => "none",
4521 "effect_message" => "",
4522 "enable_mad_mimi" => "off",
4523 "mad_mimi_list" => "",
4524 "poll_show_passed_users_count" => 3,
4525 "question_font_size" => 16,
4526 "question_font_size_mobile" => 16,
4527 "poll_question_image_height" => "",
4528 "poll_mobile_max_width" => "",
4529 "poll_title_font_size" => "18",
4530 "poll_title_font_size_mobile" => "20",
4531 "poll_title_alignment" => "center",
4532 "poll_title_alignment_mobile" => "center",
4533 "poll_enable_answer_image_after_voting" => "off",
4534 "poll_text_type_length_enable" => "off",
4535 "poll_text_type_limit_type" => "characters",
4536 "poll_text_type_limit_length" => "",
4537 "poll_text_type_limit_message" => "off",
4538 "poll_text_type_placeholder" => "Your answer",
4539 "poll_text_type_width" => "",
4540 "poll_text_type_width_type" => "percent",
4541 "poll_answer_padding" => 10,
4542 "poll_answer_margin" => 10,
4543 "answers_border" => "on",
4544 "answers_border_width" => 1,
4545 "answers_border_style" => "solid",
4546 "answers_border_color" => "#444",
4547 "poll_answer_enable_box_shadow" => "off",
4548 "answers_box_shadow_color" => "#000",
4549 "poll_answer_box_shadow_x_offset" => 0,
4550 "poll_answer_box_shadow_y_offset" => 0,"poll_answer_box_shadow_z_offset" => 10,
4551 "poll_answer_image_height" => 150,
4552 "poll_answer_image_height_for_mobile" => "150",
4553 "poll_answer_image_border_radius" => 0,
4554 "ans_img_caption_style" => "outside",
4555 "ans_img_caption_position" => "bottom",
4556 "answers_font_size" => 15,
4557 "poll_answer_object_fit" => "cover",
4558 "answers_grid_column" => 2,
4559 "poll_answer_border_radius" => 0,
4560 "enable_getResponse" => "off",
4561 "getResponse_list" => "",
4562 "enable_mailerLite" => "off",
4563 "mailerLite_group_id" => "",
4564 "enable_convertKit" => "off",
4565 "poll_convertKit_form_id" => "",
4566 "enable_mailpoet" => "off",
4567 "mailpoet_list" => "",
4568 "poll_logo_url" => "",
4569 "poll_enable_logo_url" => "off",
4570 "poll_logo_url_new_tab" => "off",
4571 "poll_send_mail_to_site_admin" => "on",
4572 "poll_email_configuration_from_email" => "",
4573 "poll_email_configuration_from_name" => "",
4574 "poll_email_configuration_from_subject" => "",
4575 "poll_email_configuration_replyto_email" => "",
4576 "poll_email_configuration_replyto_name" => "",
4577 "display_fields_labels" => "off",
4578 "autofill_user_data" => "off",
4579 "poll_create_author" => 1
4580 ));
4581
4582 $wpdb->insert($polls_table, array(
4583 "title" => $title,
4584 "question" => $question,
4585 "type" => "choosing",
4586 "view_type" => "list",
4587 "categories" => ",1,",
4588 "show_title" => $show_title,
4589 "styles" => $options,
4590 "theme_id" => 1,
4591 ));
4592
4593 $poll_id = $wpdb->insert_id;
4594
4595 foreach ($answers as $answer_key => $answer) {
4596 $wpdb->insert($answers_table, array(
4597 "poll_id" => $poll_id,
4598 "answer" => $answer,
4599 "votes" => 0,
4600 "ordering" => (intval($answer_key) + 1),
4601 "user_added" => 0,
4602 "show_user_added" => 1,
4603 ));
4604 }
4605
4606 $post_type_args = array(
4607 'poll_id' => $poll_id,
4608 'author_id' => !empty($user->ID) ? $user->ID : get_current_user_id(),
4609 'poll_title' => $poll_title,
4610 );
4611
4612 $custom_post_id = Poll_Maker_Custom_Post_Type::ays_poll_add_custom_post($post_type_args);
4613
4614 $preview_url = "#";
4615 if(!empty($custom_post_id)){
4616 $custom_post_url = array(
4617 'post_type' => 'ays-poll-maker',
4618 'p' => $custom_post_id,
4619 'preview' => 'true',
4620 );
4621 $custom_post_url_ready = http_build_query($custom_post_url);
4622 $preview_url = get_home_url();
4623 $preview_url .= '/?' . $custom_post_url_ready;
4624 }
4625
4626 echo json_encode(array(
4627 'status' => true,
4628 'poll_id' => $poll_id,
4629 'preview_url' => $preview_url,
4630 ));
4631 wp_die();
4632 }
4633
4634 public function ays_poll_black_friady_popup_box(){
4635
4636 if(!empty($_REQUEST['page']) && sanitize_text_field( $_REQUEST['page'] ) != $this->plugin_name . "-dashboard"){
4637 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
4638
4639 $flag = true;
4640
4641 if( isset($_COOKIE['aysPollBlackFridayPopupCount']) && intval($_COOKIE['aysPollBlackFridayPopupCount']) >= 2 ){
4642 $flag = false;
4643 }
4644
4645 $ays_poll_cta_button_link = esc_url('https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=poll-free&utm_campaign=mega-bundle-popup-black-friday-sale-' . POLL_MAKER_AYS_VERSION);
4646
4647 if( $flag ){
4648 ?>
4649 <div class="ays-poll-black-friday-popup-overlay" style="opacity: 0; visibility: hidden; display: none;">
4650 <div class="ays-poll-black-friday-popup-dialog">
4651 <div class="ays-poll-black-friday-popup-content">
4652 <div class="ays-poll-black-friday-popup-background-pattern">
4653 <div class="ays-poll-black-friday-popup-pattern-row">
4654 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4655 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4656 </div>
4657 <div class="ays-poll-black-friday-popup-pattern-row">
4658 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4659 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4660 </div>
4661 <div class="ays-poll-black-friday-popup-pattern-row">
4662 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4663 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4664 </div>
4665 <div class="ays-poll-black-friday-popup-pattern-row">
4666 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4667 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4668 </div>
4669 </div>
4670
4671 <button class="ays-poll-black-friday-popup-close" aria-label="Close">
4672 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
4673 <path d="M18 6 6 18"></path>
4674 <path d="m6 6 12 12"></path>
4675 </svg>
4676 </button>
4677
4678 <div class="ays-poll-black-friday-popup-badge">
4679 <div class="ays-poll-black-friday-popup-badge-content">
4680 <div class="ays-poll-black-friday-popup-badge-text-sm"><?php echo esc_html__( 'Up to', 'poll-maker' ); ?></div>
4681 <div class="ays-poll-black-friday-popup-badge-text-lg">50%</div>
4682 <div class="ays-poll-black-friday-popup-badge-text-md"><?php echo esc_html__( 'OFF', 'poll-maker' ); ?></div>
4683 </div>
4684 </div>
4685
4686 <div class="ays-poll-black-friday-popup-main-content">
4687 <div class="ays-poll-black-friday-popup-hashtag"><?php echo esc_html__( '#BLACKFRIDAY', 'poll-maker' ); ?></div>
4688 <h1 class="ays-poll-black-friday-popup-title-mega"><?php echo esc_html__( 'MEGA', 'poll-maker' ); ?></h1>
4689 <h1 class="ays-poll-black-friday-popup-title-bundle"><?php echo esc_html__( 'BUNDLE', 'poll-maker' ); ?></h1>
4690 <div class="ays-poll-black-friday-popup-offer-label">
4691 <h2 class="ays-poll-black-friday-popup-offer-text"><?php echo esc_html__( 'BLACK FRIDAY OFFER', 'poll-maker' ); ?></h2>
4692 </div>
4693 <p class="ays-poll-black-friday-popup-description"><?php echo esc_html__( 'Get our exclusive plugins in one bundle', 'poll-maker' ); ?></p>
4694 <a href="<?php echo esc_url($ays_poll_cta_button_link); ?>" target="_blank" class="ays-poll-black-friday-popup-cta-btn"><?php echo esc_html__( 'Get Mega Bundle', 'poll-maker' ); ?></a>
4695 </div>
4696 </div>
4697 </div>
4698 </div>
4699 <script type="text/javascript">
4700 (function() {
4701 var overlay = document.querySelector('.ays-poll-black-friday-popup-overlay');
4702 var closeBtn = document.querySelector('.ays-poll-black-friday-popup-close');
4703 var learnMoreBtn = document.querySelector('.ays-poll-black-friday-popup-learn-more');
4704 var ctaBtn = document.querySelector('.ays-poll-black-friday-popup-cta-btn');
4705
4706 // Cookie helper functions
4707 function setCookie(name, value, days) {
4708 var expires = "";
4709 if (days) {
4710 var date = new Date();
4711 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
4712 expires = "; expires=" + date.toUTCString();
4713 }
4714 document.cookie = name + "=" + (value || "") + expires + "; path=/";
4715 }
4716
4717 function getCookie(name) {
4718 var nameEQ = name + "=";
4719 var ca = document.cookie.split(';');
4720 for (var i = 0; i < ca.length; i++) {
4721 var c = ca[i];
4722 while (c.charAt(0) == ' ') c = c.substring(1, c.length);
4723 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
4724 }
4725 return null;
4726 }
4727
4728 // Get current show count from cookie
4729 var showCount = parseInt(getCookie('aysPollBlackFridayPopupCount') || '0', 10);
4730 var maxShows = 2;
4731
4732 // Show popup function
4733 function showPopup() {
4734 if (overlay && showCount < maxShows) {
4735 overlay.classList.add('ays-poll-black-friday-popup-active');
4736 showCount++;
4737 // Update cookie with new count (expires in 30 days)
4738 setCookie('aysPollBlackFridayPopupCount', showCount.toString(), 30);
4739 }
4740 }
4741
4742 // Close popup function
4743 function closePopup(e) {
4744 if (e) {
4745 e.preventDefault();
4746 e.stopPropagation();
4747 }
4748 if (overlay) {
4749 overlay.classList.remove('ays-poll-black-friday-popup-active');
4750 }
4751 }
4752
4753 // Determine timing based on show count
4754 if (showCount === 0) {
4755 // First time - show after 30 seconds
4756 setTimeout(function() {
4757 showPopup();
4758 }, 30000);
4759 } else if (showCount === 1) {
4760 // Second time - show after 200 seconds
4761 setTimeout(function() {
4762 showPopup();
4763 }, 200000);
4764 }
4765 // If showCount >= 2, don't show popup at all
4766
4767 // Close button
4768 if (closeBtn) {
4769 closeBtn.addEventListener('click', function(e) {
4770 closePopup(e);
4771 });
4772 }
4773
4774 // Learn more button
4775 if (learnMoreBtn) {
4776 learnMoreBtn.addEventListener('click', function(e) {
4777 closePopup(e);
4778 });
4779 }
4780
4781 // CTA button (optional - if you want it to close popup too)
4782 if (ctaBtn) {
4783 ctaBtn.addEventListener('click', function(e) {
4784 // You can add redirect logic here if needed
4785 // window.location.href = 'your-url';
4786 });
4787 }
4788
4789 // Close on overlay click
4790 if (overlay) {
4791 overlay.addEventListener('click', function(e) {
4792 if (e.target === overlay) {
4793 closePopup(e);
4794 }
4795 });
4796 }
4797
4798 // Close on Escape key
4799 document.addEventListener('keydown', function(e) {
4800 if (e.key === 'Escape' && overlay && overlay.classList.contains('ays-poll-black-friday-popup-active')) {
4801 closePopup();
4802 }
4803 });
4804 })();
4805 </script>
4806 <style>
4807 .ays-poll-black-friday-popup-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999;background-color:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;transition:opacity .2s,visibility .2s}.ays-poll-black-friday-popup-overlay.ays-poll-black-friday-popup-active{display:flex!important;opacity:1!important;visibility:visible!important}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-dialog{position:relative;max-width:470px;width:100%;border-radius:8px;overflow:hidden;background:0 0;box-shadow:0 25px 50px -12px rgba(0,0,0,.25);transform:scale(.95);transition:transform .2s}.ays-poll-black-friday-popup-overlay.ays-poll-black-friday-popup-active .ays-poll-black-friday-popup-dialog{transform:scale(1)}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-content{position:relative;width:470px;height:410px;background:linear-gradient(to right bottom,#c056f5,#f042f0,#7d7de8);overflow:hidden}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-background-pattern{position:absolute;top:0;left:0;right:0;bottom:0;opacity:.07;pointer-events:none;transform:rotate(-12deg) translateY(32px);overflow:hidden}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-pattern-row{display:flex;gap:16px;margin-bottom:16px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-pattern-text{color:#fff;font-weight:900;font-size:96px;white-space:nowrap;line-height:1}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-close{position:absolute;top:16px;right:16px;z-index:9999;background:0 0;border:none;color:rgba(255,255,255,.8);cursor:pointer;padding:4px;transition:color .2s;line-height:0}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-close:hover,.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-learn-more:hover{color:#fff}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge{position:absolute;top:32px;right:32px;width:96px;height:96px;background-color:#d4fc79;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 25px 50px -12px rgba(0,0,0,.25);animation:3s ease-in-out infinite ays-poll-black-friday-popup-float}@keyframes ays-poll-black-friday-popup-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-content{text-align:center}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-sm{color:#1a1a1a;font-weight:900;font-size:24px;line-height:1}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-lg{color:#1a1a1a;font-weight:900;font-size:30px;line-height:1;margin-top:4px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-md{color:#1a1a1a;font-weight:900;font-size:20px;line-height:1}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-main-content{position:relative;z-index:10;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 48px;text-align:center}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-hashtag{color:rgba(255,255,255,.9);font-weight:700;font-size:14px;margin-bottom:16px;letter-spacing:.1em}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-mega{color:#fff;font-weight:900;font-size:60px;line-height:1;margin:0 0 12px;text-shadow:0 4px 6px rgba(0,0,0,.1)}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-bundle{color:#fff;font-weight:900;font-size:60px;line-height:1;margin:0 0 24px;text-shadow:0 4px 6px rgba(0,0,0,.1)}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-offer-label{background-color:#000;padding:12px 32px;margin-bottom:24px;display:inline-block}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-offer-text{color:#fff;font-weight:700;font-size:20px;letter-spacing:.05em;margin:0}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-description{color:rgba(255,255,255,.95);font-size:18px;font-weight:500;margin:0 0 32px!important}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-cta-btn{display:inline-flex;align-items:center;justify-content:center;height:48px;background-color:#fff;color:#a855f7;font-size:18px;font-weight:700;border:none;border-radius:24px;padding:0 40px;cursor:pointer;box-shadow:0 20px 25px -5px rgba(0,0,0,.1);transition:.2s;text-decoration:none}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-cta-btn:hover{background-color:rgba(255,255,255,.9);box-shadow:0 25px 50px -12px rgba(0,0,0,.25);transform:scale(1.05)}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-learn-more{background:0 0;border:none;color:rgba(255,255,255,.9);font-size:14px;text-decoration:underline;text-underline-offset:4px;cursor:pointer;padding:8px;margin-top:16px;transition:color .2s}@media (max-width:768px){.ays-poll-black-friday-popup-overlay{display:none!important}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-content{width:90vw;max-width:400px;height:380px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-main-content{padding:0 32px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge{width:80px;height:80px;top:24px;right:24px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-sm{font-size:20px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-lg{font-size:26px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-md,.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-offer-text{font-size:18px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-bundle,.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-mega{font-size:48px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-description{font-size:16px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-pattern-text{font-size:72px}}@media (max-width:480px){.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-content{width:95vw;max-width:340px;height:360px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-main-content{padding:0 24px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge{width:70px;height:70px;top:20px;right:20px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-sm,.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-offer-text{font-size:16px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-lg{font-size:22px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-badge-text-md{font-size:14px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-hashtag{font-size:12px;margin-bottom:12px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-bundle,.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-title-mega{font-size:40px;margin-bottom:8px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-offer-label{padding:10px 24px;margin-bottom:20px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-description{font-size:15px;margin-bottom:24px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-cta-btn{font-size:16px;height:44px;padding:0 32px}.ays-poll-black-friday-popup-overlay .ays-poll-black-friday-popup-pattern-text{font-size:60px}}
4808 </style>
4809 <?php
4810 }
4811 }
4812 }
4813 }
4814
4815 }