PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.3.6
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.3.6
6.5.1 6.5.0 6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 All 154 releases
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.6, at admin/class-poll-maker-ays-admin.php

4,811 lines 257.1 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 <[email protected]>
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 if(isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit'])) {
1440 return;
1441 }
1442 $current_user_id = get_current_user_id();
1443 $completed_steps = get_user_meta($current_user_id, 'ays_poll_checklist_completed_steps', true);
1444
1445 // Make sure we always get an array
1446 if (!is_array($completed_steps)) {
1447 $completed_steps = array();
1448 }
1449
1450 $popup_closed = get_user_meta($current_user_id, 'ays_poll_checklist_popup_closed', true);
1451
1452 $checklist_steps = array(
1453 array(
1454 'title' => esc_html__('Add a New Poll', 'poll-maker'),
1455 ),
1456 array(
1457 'title' => esc_html__('Add Options', 'poll-maker'),
1458 ),
1459 array(
1460 'title' => esc_html__('Save the Poll', 'poll-maker'),
1461 ),
1462 array(
1463 'title' => esc_html__('Copy the Shortcode', 'poll-maker'),
1464 'img_style' => 'object-fit:contain; height:auto;',
1465 ),
1466 );
1467 ?>
1468 <div class="ays-poll-checklist-panel" id="ays-poll-checklist-container" style="<?php echo ($popup_closed) ? 'display: none;' : ''; ?>">
1469 <header class="ays-poll-checklist-header">
1470 <h3><?php echo esc_html__('Create a Poll with 4 Easy Steps', 'poll-maker'); ?></h3>
1471
1472 <!-- Minimize Button -->
1473 <button class="ays-poll-checklist-minimize-btn" aria-label="Minimize">
1474 <svg class="ays-poll-checklist-minimize-icon-expanded" width="24" height="24" viewBox="0 0 24 24" fill="none">
1475 <path d="M6 12h12" stroke="#000" stroke-width="2" stroke-linecap="round"/>
1476 </svg>
1477 <svg class="ays-poll-checklist-minimize-icon-collapsed" style="display:none;" width="24" height="24" viewBox="0 0 24 24">
1478 <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>
1479 </svg>
1480 </button>
1481
1482 <!-- Close Button -->
1483 <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>
1484 </header>
1485
1486 <ol class="ays-poll-checklist-items">
1487 <?php foreach ($checklist_steps as $index => $step):
1488 $is_checked = in_array($index, $completed_steps);
1489 ?>
1490 <li class="ays-poll-checklist-step<?php echo $is_checked ? ' completed' : ''; ?>" data-step="<?php echo esc_attr($index); ?>">
1491 <div class="ays-poll-checklist-header-row">
1492 <span class="ays-poll-checklist-step-number"><?php echo esc_html($index + 1 . '.'); ?></span>
1493 <span class="ays-poll-checklist-step-title"><?php echo esc_html($step['title']); ?></span>
1494 </div>
1495 </li>
1496 <?php endforeach; ?>
1497 </ol>
1498 <style>
1499 #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:300px;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;-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-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.completed label span{text-decoration:line-through;opacity:.6}#ays-poll-checklist-container .ays-poll-checklist-step-title{margin:0;margin-left:5px;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}}
1500 </style>
1501 </div>
1502 <?php
1503 }
1504 }
1505
1506 }
1507
1508 public function ays_poll_save_checklist_progress() {
1509 check_ajax_referer('ays_poll_nonce', 'nonce');
1510
1511 $user_can_capability = self::poll_maker_capabilities();
1512
1513 // Check for permissions.
1514 if ( ! current_user_can( $user_can_capability ) ) {
1515 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1516 }
1517
1518 if( !is_user_logged_in() ) {
1519 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1520 }
1521
1522 $user_id = get_current_user_id();
1523 $steps = isset($_POST['steps']) ? array_map('sanitize_text_field', $_POST['steps']) : array();
1524
1525 update_user_meta($user_id, 'ays_poll_checklist_completed_steps', $steps);
1526
1527 wp_send_json_success(array('saved' => true));
1528 }
1529
1530 public function ays_poll_checklist_close_popup() {
1531 check_ajax_referer('ays_poll_nonce', 'nonce');
1532
1533 $user_can_capability = self::poll_maker_capabilities();
1534
1535 // Check for permissions.
1536 if ( ! current_user_can( $user_can_capability ) ) {
1537 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1538 }
1539
1540 if (is_user_logged_in()) {
1541 $user_id = get_current_user_id();
1542 update_user_meta($user_id, 'ays_poll_checklist_popup_closed', 1);
1543 wp_send_json_success( esc_html__( 'Popup marked as closed.', 'poll-maker' ) );
1544 }
1545
1546 wp_send_json_error( esc_html__( 'User not logged in.', 'poll-maker' ) );
1547 }
1548
1549 public function ays_poll_checklist_reopen_callback() {
1550 check_ajax_referer('ays_poll_nonce', 'nonce');
1551
1552 $user_can_capability = self::poll_maker_capabilities();
1553
1554 // Check for permissions.
1555 if ( ! current_user_can( $user_can_capability ) ) {
1556 wp_send_json_error( esc_html__( 'Something went wrong', 'poll-maker' ) );
1557 }
1558
1559 if (is_user_logged_in()) {
1560 $user_id = get_current_user_id();
1561 delete_user_meta($user_id, 'ays_poll_checklist_popup_closed');
1562 wp_send_json_success('Popup reopened.');
1563 }
1564
1565 wp_send_json_error( esc_html__( 'User not logged in.', 'poll-maker' ) );
1566 }
1567
1568 public function get_next_or_prev_row_by_id( $id, $type = "next", $table = "ayspoll_polls" ) {
1569 global $wpdb;
1570
1571 if ( is_null( $table ) || empty( $table ) ) {
1572 return null;
1573 }
1574
1575 $ays_table = esc_sql( $wpdb->prefix . $table );
1576
1577 $where = array();
1578 $where_condition = "";
1579
1580 $id = (isset( $id ) && $id != "" && absint($id) != 0) ? absint( sanitize_text_field( $id ) ) : null;
1581 $type = (isset( $type ) && $type != "") ? sanitize_text_field( $type ) : "next";
1582
1583 if ( is_null( $id ) || $id == 0 ) {
1584 return null;
1585 }
1586
1587 switch ( $type ) {
1588 case 'prev':
1589 $where[] = ' `id` < ' . $id . ' ORDER BY `id` DESC ';
1590 break;
1591 case 'next':
1592 default:
1593 $where[] = ' `id` > ' . $id;
1594 break;
1595 }
1596
1597 if( ! empty($where) ){
1598 $where_condition = " WHERE " . implode( " AND ", $where );
1599 }
1600
1601 $sql = "SELECT `id` FROM {$ays_table} ". $where_condition ." LIMIT 1;";
1602 $results = $wpdb->get_row( $sql, 'ARRAY_A' );
1603
1604 return $results;
1605
1606 }
1607
1608 public function poll_maker_admin_footer($a){
1609 if(isset($_REQUEST['page'])){
1610 if(false !== strpos($_REQUEST['page'], $this->plugin_name)){
1611 ?>
1612 <div class="ays-poll-footer-support-box">
1613 <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>
1614 <span class="ays-poll-footer-slash-row">/</span>
1615 <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>
1616 <span class="ays-poll-footer-slash-row">/</span>
1617 <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>
1618 </div>
1619 <p style="font-size:13px;text-align:center;font-style:italic;">
1620 <span style="margin-left:0px;margin-right:10px;" class="ays_heart_beat"><i class="ays_fa ays_poll_fa_heart_o animated"></i></span>
1621 <span><?php echo esc_html__( "If you love our plugin, please do big favor and rate us on WordPress.org", "poll-maker"); ?></span>
1622 <a target="_blank" class="ays-rated-link" href='http://bit.ly/3l5I2iG'>
1623 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1624 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1625 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1626 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1627 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1628 </a>
1629 <span class="ays_heart_beat"><i class="ays_fa ays_poll_fa_heart_o animated"></i></span>
1630 </p>
1631 <?php
1632 }
1633 }
1634 }
1635
1636 // Sales baner function
1637 public function ays_poll_sale_baner(){
1638 if(isset($_POST['ays_poll_sale_btn_black_friday'])){
1639 $sale_date = sanitize_text_field($_POST['ays_poll_sale_btn_black_friday']);
1640 update_option('ays_poll_sale_notification_'.$sale_date, 1);
1641 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1642 }
1643
1644 // if (isset($_POST['ays_poll_sale_btn']) && isset( $_POST[$this->plugin_name . '-sale-banner'] )
1645 // && wp_verify_nonce( $_POST[$this->plugin_name . '-sale-banner'], $this->plugin_name . '-sale-banner' ) && current_user_can('manage_options')) {
1646 // $sale_date = 'plugin_sale';
1647 // update_option('ays_poll_sale_btn_'.$sale_date, 1);
1648 // update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1649 // }
1650
1651 if(isset($_POST['ays_poll_sale_btn_poll_countdown_for_two_months'])){
1652 $sale_date = sanitize_text_field($_POST['ays_poll_sale_btn_poll_countdown_for_two_months']);
1653 $dismiss_two_months = true;
1654 update_option('ays_poll_sale_notification_two_months_'.$sale_date, 1);
1655 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1656 }
1657
1658 $one_day = 60*60*24;
1659 $poll_sales = array(
1660 'plugin_sale' => array(
1661 'status' => 'active',
1662 'time' => ($one_day * 5),
1663 ),
1664 'mega_bundle' => array(
1665 'status' => 'inactive',
1666 'time' => ($one_day * 5),
1667 ),
1668 'new_mega_bundle' => array(
1669 'status' => 'inactive',
1670 'time' => ($one_day * 7),
1671 ),
1672 'small_spring' => array(
1673 'status' => 'inactive',
1674 'time' => ($one_day * 7),
1675 ),
1676 'mega_bundle_new' => array(
1677 'status' => 'inactive',
1678 'time' => ($one_day * 7),
1679 ),
1680 'business_bundle' => array(
1681 'status' => 'inactive',
1682 'time' => ($one_day * 7),
1683 ),
1684 'black_friday' => array(
1685 'status' => 'inactive',
1686 'time' => ($one_day * 5),
1687 ),
1688 'winter_bundle' => array(
1689 'status' => 'inactive',
1690 'time' => ($one_day * 5),
1691 ),
1692 'poll_countdown' => array(
1693 'status' => 'inactive',
1694 'time' => ($one_day * 5),
1695 ),
1696 'halloween_bundle' => array(
1697 'status' => 'inactive',
1698 'time' => ($one_day * 5),
1699 ),
1700 'christmas_message' => array(
1701 'status' => 'inactive',
1702 'time' => ($one_day * 7),
1703 ),
1704 );
1705
1706 if (isset($_GET['page']) && strpos($_GET['page'], POLL_MAKER_AYS_NAME) !== false) {
1707 foreach($poll_sales as $sale => $status){
1708 $ays_poll_sale_date = '';
1709 if(isset($status['status']) && $status['status'] == 'active'){
1710 $ays_poll_sale_date = get_option('ays_poll_sale_date_'.$sale);
1711 $ays_poll_two_months_flag = intval(get_option('ays_poll_sale_notification_two_months_'.$sale));
1712 $current_date = current_time( 'mysql' );
1713 $date_diff = strtotime($current_date) - intval(strtotime($ays_poll_sale_date)) ;
1714 $val = isset($status['time']) ? $status['time'] : $one_day * 5;
1715 if($ays_poll_two_months_flag > 0){
1716 $val = $one_day * 60;
1717 }
1718
1719 $days_diff = $date_diff / $val;
1720 if(intval($days_diff) > 0 ){
1721 update_option('ays_poll_sale_notification_'.$sale, 0);
1722 update_option('ays_poll_sale_btn_'.$sale, 0);
1723 update_option('ays_poll_sale_notification_two_months_'.$sale, 0);
1724 }
1725 $ays_poll_flag = intval(get_option('ays_poll_sale_notification_'.$sale));
1726 $ays_poll_flag += intval(get_option('ays_poll_sale_btn_'.$sale));
1727 $ays_poll_flag += $ays_poll_two_months_flag;
1728 if($ays_poll_flag == 0){
1729 $ays_poll_sale_message = 'ays_poll_sale_message_'.$sale;
1730 if ( $this->get_max_id('polls') > 1 ){
1731 // $this->ays_poll_new_halloween_bundle_message_2025();
1732 // $this->ays_poll_black_friday_message();
1733 // $this->ays_poll_christmas_banner_message_2025();
1734 $this->ays_poll_new_mega_bundle_message_2026();
1735 }
1736 }
1737 }
1738 }
1739 }
1740 }
1741
1742 public function ays_poll_dismiss_button(){
1743
1744 $data = array(
1745 'status' => false,
1746 );
1747
1748 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ays_poll_dismiss_button') {
1749 if( (isset( $_REQUEST['_ajax_nonce'] ) && wp_verify_nonce( $_REQUEST['_ajax_nonce'], POLL_MAKER_AYS_NAME . '-sale-banner' )) && current_user_can( 'manage_options' )){
1750 $sale_date = 'plugin_sale';
1751 update_option('ays_poll_sale_btn_'.$sale_date, 1);
1752 update_option('ays_poll_sale_date_'.$sale_date, current_time( 'mysql' ));
1753 $data['status'] = true;
1754 }
1755 }
1756
1757 ob_end_clean();
1758 $ob_get_clean = ob_get_clean();
1759 echo json_encode($data);
1760 wp_die();
1761
1762 }
1763
1764 // Christmas Banner 2025
1765 public function ays_poll_christmas_banner_message_2025(){
1766 $content = array();
1767
1768 $svg_icon = '<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">
1769 <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"/>
1770 </svg>
1771 ';
1772
1773 $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);
1774
1775 $content[] = '<div id="ays-poll-christmas-banner-main" class="notice notice-success is-dismissible ays-poll-christmas-banner-info ays_poll_dicount_info">';
1776 $content[] = '<div id="ays-poll-christmas-banner-month" class="ays-poll-christmas-banner-month">';
1777
1778 // Background effects
1779 $content[] = '<div class="ays-poll-christmas-banner-bg-effects">';
1780 $content[] = '<div class="ays-poll-christmas-banner-bg-gradient-1"></div>';
1781 $content[] = '<div class="ays-poll-christmas-banner-bg-gradient-2"></div>';
1782
1783 // Snowflakes
1784 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 5%; animation-delay: 0s; animation-duration: 8s;">'. $svg_icon .'</div>';
1785 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 15%; animation-delay: 2s; animation-duration: 10s;">'. $svg_icon .'</div>';
1786 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 25%; animation-delay: 4s; animation-duration: 9s;">'. $svg_icon .'</div>';
1787 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 75%; animation-delay: 1s; animation-duration: 11s;">'. $svg_icon .'</div>';
1788 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 85%; animation-delay: 3s; animation-duration: 8s;">'. $svg_icon .'</div>';
1789 $content[] = '<div class="ays-poll-christmas-banner-snowflake" style="left: 92%; animation-delay: 5s; animation-duration: 10s;">'. $svg_icon .'</div>';
1790
1791 // Sparkles
1792 $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">';
1793 $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"/>';
1794 $content[] = '</svg>';
1795 $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">';
1796 $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"/>';
1797 $content[] = '</svg>';
1798 $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">';
1799 $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"/>';
1800 $content[] = '</svg>';
1801 $content[] = '</div>';
1802
1803 // Main content
1804 $content[] = '<div class="ays-poll-christmas-banner-content">';
1805 $content[] = '<div class="ays-poll-christmas-banner-left">';
1806 // Gift icon with hat
1807 $content[] = '<div class="ays-poll-christmas-banner-gift-wrapper">';
1808 $content[] = '<svg class="ays-poll-christmas-banner-gift-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">';
1809 $content[] = '<rect x="3" y="8" width="18" height="4" rx="1"></rect>';
1810 $content[] = '<path d="M12 8v13"></path>';
1811 $content[] = '<path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path>';
1812 $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>';
1813 $content[] = '</svg>';
1814 $content[] = '<div class="ays-poll-christmas-banner-hat">';
1815 $content[] = '<svg viewBox="0 0 24 24" fill="none" class="ays-poll-christmas-banner-hat-svg">';
1816 $content[] = '<path d="M12 2L4 14h16L12 2z" fill="hsl(0 80% 45%)"></path>';
1817 $content[] = '<path d="M4 14c0 2 3.5 3 8 3s8-1 8-3" fill="hsl(0 0% 100%)"></path>';
1818 $content[] = '<circle cx="12" cy="3" r="2" fill="hsl(0 0% 100%)"></circle>';
1819 $content[] = '</svg>';
1820 $content[] = '</div>';
1821 $content[] = '</div>';
1822
1823 $content[] = '<div class="ays-poll-christmas-banner-special-label">';
1824 $content[] = '<div class="ays-poll-christmas-banner-special-label-name">';
1825 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-christmas-banner-special-label-name-link" target="_blank">';
1826 $content[] = __( 'Poll Maker', "poll-maker" );
1827 $content[] = '</a>';
1828 $content[] = '</div>';
1829
1830 $content[] = '<div>✦ ' . __( 'CHRISTMAS SPECIAL', "poll-maker" ) . ' ✦</div>';
1831 $content[] = '</div>';
1832 $content[] = '</div>';
1833
1834 $content[] = '<div class="ays-poll-christmas-banner-center">';
1835 $content[] = '<div class="ays-poll-christmas-banner-discount-text">25% OFF</div>';
1836 $content[] = '<div class="ays-poll-christmas-banner-limited-offer">' . __( 'Limited time offer', "poll-maker" ) . '</div>';
1837 $content[] = '</div>';
1838
1839 $content[] = '<div class="ays-poll-christmas-banner-right">';
1840 $content[] = '<div class="ays-poll-christmas-banner-coupon-box" onclick="aysPollChristmasCopyToClipboard(\'XMAS25\')" title="' . __( 'Click to copy', "poll-maker" ) . '">';
1841 $content[] = '<span class="ays-poll-christmas-banner-coupon-text">XMAS25</span>';
1842 $content[] = '<svg class="ays-poll-christmas-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
1843 $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"/>';
1844 $content[] = '</svg>';
1845 $content[] = '</div>';
1846
1847 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-christmas-banner-buy-now-btn" target="_blank">';
1848 $content[] = __( 'Buy Now', "poll-maker" );
1849 $content[] = '</a>';
1850 $content[] = '</div>';
1851 $content[] = '</div>';
1852
1853 $content[] = '</div>';
1854
1855 if( current_user_can( 'manage_options' ) ){
1856 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
1857 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
1858 $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>';
1859 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
1860 $content[] = '</form>';
1861 $content[] = '</div>';
1862 }
1863
1864 $content[] = '</div>';
1865
1866 $content[] = '<script>';
1867 $content[] = "
1868 function aysPollChristmasCopyToClipboard(text) {
1869 var textarea = document.createElement('textarea');
1870 textarea.value = text;
1871 textarea.style.position = 'fixed';
1872 textarea.style.opacity = '0';
1873 document.body.appendChild(textarea);
1874
1875 textarea.select();
1876 textarea.setSelectionRange(0, 99999);
1877
1878 try {
1879 document.execCommand('copy');
1880 aysPollChristmasShowCopyNotification('" . __( 'Coupon code copied!', "poll-maker" ) . "');
1881 } catch (err) {
1882 console.error('Failed to copy text: ', err);
1883 }
1884
1885 document.body.removeChild(textarea);
1886 }
1887
1888 function aysPollChristmasShowCopyNotification(message) {
1889 var existingNotification = document.querySelector('.ays-poll-christmas-banner-copy-notification');
1890 if (existingNotification) {
1891 document.body.removeChild(existingNotification);
1892 }
1893
1894 var notification = document.createElement('div');
1895 notification.className = 'ays-poll-christmas-banner-copy-notification';
1896 notification.textContent = message;
1897 document.body.appendChild(notification);
1898
1899 setTimeout(function() {
1900 notification.classList.add('show');
1901 }, 10);
1902
1903 setTimeout(function() {
1904 notification.classList.remove('show');
1905 setTimeout(function() {
1906 if (notification.parentNode) {
1907 document.body.removeChild(notification);
1908 }
1909 }, 300);
1910 }, 2000);
1911 }";
1912 $content[] = '</script>';
1913
1914 $content[] = '<style>';
1915 $content[] = '
1916 /* Christmas banner start */
1917
1918 div#ays-poll-christmas-banner-main .btn-link {
1919 background-color: transparent;
1920 display: inline-block;
1921 font-weight: 400;
1922 text-align: center;
1923 white-space: nowrap;
1924 vertical-align: middle;
1925 -webkit-user-select: none;
1926 -moz-user-select: none;
1927 -ms-user-select: none;
1928 user-select: none;
1929 border: 1px solid transparent;
1930 padding: .375rem .75rem;
1931 font-size: 12px;
1932 line-height: 1.5;
1933 border-radius: .25rem;
1934 color: rgba(255, 255, 255, .6);
1935 }
1936
1937 div#ays-poll-christmas-banner-main.ays-poll-christmas-banner-info {
1938 background: linear-gradient(to right, hsl(0, 70%, 28%), hsl(0, 65%, 38%), hsl(0, 70%, 28%));
1939 padding: unset;
1940 border-left: 0;
1941 position: relative;
1942 }
1943
1944 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-month {
1945 position: relative;
1946 padding: 15px 40px;
1947 overflow: hidden;
1948 }
1949
1950 /* Background effects */
1951 .ays-poll-christmas-banner-bg-effects {
1952 position: absolute;
1953 top: 0;
1954 left: 0;
1955 right: 0;
1956 bottom: 0;
1957 pointer-events: none;
1958 z-index: 1;
1959 }
1960
1961 .ays-poll-christmas-banner-bg-gradient-1 {
1962 position: absolute;
1963 top: 0;
1964 left: 30%;
1965 width: 40%;
1966 height: 100%;
1967 background: radial-gradient(circle, rgba(202, 43, 43, 0.5) 0%, transparent 60%);
1968 opacity: 0.4;
1969 }
1970
1971 .ays-poll-christmas-banner-bg-gradient-2 {
1972 position: absolute;
1973 top: 0;
1974 right: 15%;
1975 width: 35%;
1976 height: 100%;
1977 background: radial-gradient(circle, rgba(246, 201, 85, 0.15) 0%, transparent 50%);
1978 opacity: 0.3;
1979 }
1980
1981 .ays-poll-christmas-banner-snowflake {
1982 position: absolute;
1983 color: rgba(255, 255, 255, 0.2);
1984 font-size: 20px;
1985 animation: ays-poll-christmas-snowfall linear infinite;
1986 top: -10px;
1987 }
1988
1989 @keyframes ays-poll-christmas-snowfall {
1990 0% {
1991 transform: translateY(-10px) rotate(0deg);
1992 opacity: 0;
1993 }
1994 10% {
1995 opacity: 0.8;
1996 }
1997 90% {
1998 opacity: 0.8;
1999 }
2000 100% {
2001 transform: translateY(100%) rotate(360deg);
2002 opacity: 0;
2003 }
2004 }
2005
2006 .ays-poll-christmas-banner-sparkle {
2007 position: absolute;
2008 color: hsl(43, 90%, 65%);
2009 animation: ays-poll-christmas-twinkle 2s ease-in-out infinite;
2010 }
2011
2012 @keyframes ays-poll-christmas-twinkle {
2013 0%, 100% {
2014 opacity: 0.3;
2015 transform: scale(0.8);
2016 }
2017 50% {
2018 opacity: 1;
2019 transform: scale(1.2);
2020 }
2021 }
2022
2023 /* Main content */
2024 .ays-poll-christmas-banner-content {
2025 position: relative;
2026 display: flex;
2027 align-items: center;
2028 justify-content: space-between;
2029 z-index: 2;
2030 }
2031
2032 /* Left section */
2033 .ays-poll-christmas-banner-left {
2034 display: flex;
2035 align-items: center;
2036 gap: 50px;
2037 }
2038
2039 .ays-poll-christmas-banner-gift-wrapper {
2040 position: relative;
2041 animation: ays-poll-christmas-float 3s ease-in-out infinite;
2042 }
2043
2044 .ays-poll-christmas-banner-gift-icon {
2045 width: 48px;
2046 height: 48px;
2047 color: rgba(255, 247, 237, 0.9);
2048 }
2049
2050 @keyframes ays-poll-christmas-float {
2051 0%, 100% {
2052 transform: translateY(0);
2053 }
2054 50% {
2055 transform: translateY(-5px);
2056 }
2057 }
2058
2059 .ays-poll-christmas-banner-hat {
2060 position: absolute;
2061 top: -12px;
2062 right: -4px;
2063 width: 24px;
2064 height: 24px;
2065 }
2066
2067 .ays-poll-christmas-banner-hat-svg {
2068 width: 100%;
2069 height: 100%;
2070 }
2071
2072 .ays-poll-christmas-banner-special-label {
2073 color: hsl(43, 90%, 65%);
2074 font-size: 14px;
2075 font-weight: 500;
2076 text-transform: uppercase;
2077 letter-spacing: 1px;
2078 /* font-family: "Outfit", sans-serif; */
2079 }
2080
2081 .ays-poll-christmas-banner-special-label-name {
2082 color: #fffaf0;
2083 text-align: center;
2084 }
2085
2086 div#ays-poll-christmas-banner-main .ays-poll-christmas-banner-special-label-name-link {
2087 color: #fffaf0;
2088 box-shadow: unset;
2089 }
2090
2091 /* Center section */
2092 .ays-poll-christmas-banner-center {
2093 display: flex;
2094 flex-direction: row;
2095 text-align: center;
2096 justify-content: center;
2097 align-items: center;
2098 gap: 30px;
2099 }
2100
2101 .ays-poll-christmas-banner-discount-text {
2102 font-family: "Outfit", sans-serif;
2103 font-weight: 800;
2104 font-size: 30px;
2105 color: hsl(40, 100%, 97%);
2106 letter-spacing: -1px;
2107 line-height: 1;
2108 }
2109
2110 .ays-poll-christmas-banner-limited-offer {
2111 color: rgba(255, 247, 237, 0.7);
2112 font-size: 13px;
2113 font-weight: 500;
2114 }
2115
2116 /* Right section */
2117 .ays-poll-christmas-banner-right {
2118 display: flex;
2119 align-items: center;
2120 gap: 20px;
2121 }
2122
2123 .ays-poll-christmas-banner-coupon-box {
2124 border: 2px dashed rgba(255, 255, 255, 0.4);
2125 padding: 8px 16px;
2126 border-radius: 6px;
2127 background: rgba(255, 255, 255, 0.1);
2128 cursor: pointer;
2129 transition: all 0.3s;
2130 display: flex;
2131 align-items: center;
2132 gap: 8px;
2133 backdrop-filter: blur(10px);
2134 }
2135
2136 .ays-poll-christmas-banner-coupon-box:hover {
2137 background: rgba(255, 255, 255, 0.2);
2138 border-color: rgba(255, 255, 255, 0.6);
2139 transform: translateY(-1px);
2140 }
2141
2142 .ays-poll-christmas-banner-coupon-text {
2143 font-size: 16px;
2144 font-weight: 700;
2145 letter-spacing: 1px;
2146 color: #fff;
2147 font-family: monospace;
2148 }
2149
2150 .ays-poll-christmas-banner-copy-icon {
2151 opacity: 0.8;
2152 transition: opacity 0.3s;
2153 }
2154
2155 .ays-poll-christmas-banner-coupon-box:hover .ays-poll-christmas-banner-copy-icon {
2156 opacity: 1;
2157 }
2158
2159 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-buy-now-btn {
2160 background-color: #fbe19f;
2161 color: hsl(0, 72%, 35%);
2162 padding: 10px 30px;
2163 border-radius: 9999px;
2164 font-size: 16px;
2165 font-weight: 600;
2166 font-family: "Outfit", sans-serif;
2167 border: none;
2168 cursor: pointer;
2169 transition: all 0.3s;
2170 text-decoration: none;
2171 display: flex;
2172 align-items: center;
2173 gap: 6px;
2174 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 30px rgba(246, 201, 85, 0.2);
2175 }
2176
2177 #ays-poll-christmas-banner-main .ays-poll-christmas-banner-buy-now-btn:hover {
2178 background-color: #f2d58c;
2179 transform: scale(1.05);
2180 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 40px rgba(246, 201, 85, 0.3);
2181 }
2182
2183 .ays-poll-christmas-banner-btn-arrow {
2184 display: inline-block;
2185 transition: transform 0.3s;
2186 }
2187
2188 .ays-poll-christmas-banner-buy-now-btn:hover .ays-poll-christmas-banner-btn-arrow {
2189 transform: translateX(4px);
2190 }
2191
2192 /* Notification */
2193 .ays-poll-christmas-banner-copy-notification {
2194 position: fixed;
2195 top: 50%;
2196 left: 50%;
2197 transform: translate(-50%, -50%);
2198 background: rgba(0, 0, 0, 0.8);
2199 color: #fff;
2200 padding: 12px 24px;
2201 border-radius: 8px;
2202 font-size: 14px;
2203 z-index: 10000;
2204 opacity: 0;
2205 transition: opacity 0.3s;
2206 }
2207
2208 .ays-poll-christmas-banner-copy-notification.show {
2209 opacity: 1;
2210 }
2211
2212 /* Dismiss button */
2213 #ays-poll-christmas-banner-main #ays-poll-christmas-banner-dismiss-content {
2214 display: flex;
2215 justify-content: center;
2216 }
2217
2218 #ays-poll-christmas-banner-main #ays-poll-christmas-banner-dismiss-content .ays-button {
2219 margin: 0 !important;
2220 font-size: 13px;
2221 color: rgba(150, 147, 147, 0.69);
2222 }
2223
2224 /* Responsive */
2225 @media (max-width: 1024px) {
2226 .ays-poll-christmas-banner-discount-text {
2227 font-size: 40px;
2228 }
2229 .ays-poll-christmas-banner-content {
2230 flex-wrap: wrap;
2231 }
2232 }
2233
2234 @media (max-width: 768px) {
2235 #ays-poll-christmas-banner-main {
2236 display: none !important;
2237 }
2238 }
2239 /* Christmas banner end */
2240 ';
2241 $content[] = '</style>';
2242
2243 $content = implode( '', $content );
2244
2245 echo $content;
2246
2247 }
2248
2249 // Black Friday
2250 public function ays_poll_black_friday_message(){
2251
2252 $content = array();
2253
2254 $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);
2255
2256 $content[] = '<div id="ays-poll-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_poll_dicount_info">';
2257 $content[] = '<div id="ays-poll-dicount-black-friday-month" class="ays_poll_dicount_month">';
2258 $content[] = '<div class="ays-poll-dicount-black-friday-box">';
2259 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box ays-poll-dicount-black-friday-wrap-box-80" style="width: 70%;">';
2260 $content[] = '<div class="">';
2261 $content[] = '<div class="ays-poll-dicount-black-friday-title-row" >' . __( 'Coupon Code', "poll-maker" ) .' ' . '</div>';
2262 $content[] = '<div class="ays-poll-dicount-black-friday-title-row">';
2263
2264 $content[] = '
2265 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-wrapper">
2266 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-box" onclick="aysPollHalloweenCopyToClipboard(\'FREE2PROBF\')" title="' . __( 'Click to copy', "poll-maker" ) . '">
2267 <span class="ays-poll-dicount-black-friday-banner-2025-coupon-text">FREE2PROBF</span>
2268 <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">
2269 <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"/>
2270 </svg>
2271 </span>
2272 </span>';
2273 $content[] = '</div> ';
2274 $content[] = '</div>';
2275
2276 $content[] = '</div>';
2277
2278 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box ays-poll-dicount-black-friday-wrap-text-box">';
2279 $content[] = '<div class="ays-poll-dicount-black-friday-text-row">' . '30% off' . '</div>';
2280 $content[] = '</div>';
2281
2282 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box" style="width: 25%;">';
2283 $content[] = '<div id="ays-poll-countdown-main-container">';
2284 $content[] = '<div class="ays-poll-countdown-container">';
2285 $content[] = '<div id="ays-poll-countdown" style="display: block;">';
2286 $content[] = '<ul>';
2287 $content[] = '<li><span id="ays-poll-countdown-days"></span>' . __( 'Days', "poll-maker" ) . '</li>';
2288 $content[] = '<li><span id="ays-poll-countdown-hours"></span>' . __( 'Hours', "poll-maker" ) . '</li>';
2289 $content[] = '<li><span id="ays-poll-countdown-minutes"></span>' . __( 'Minutes', "poll-maker" ) . '</li>';
2290 $content[] = '<li><span id="ays-poll-countdown-seconds"></span>' . __( 'Seconds', "poll-maker" ) . '</li>';
2291 $content[] = '</ul>';
2292 $content[] = '</div>';
2293 $content[] = '<div id="ays-poll-countdown-content" class="emoji" style="display: none;">';
2294 $content[] = '<span></span>';
2295 $content[] = '<span></span>';
2296 $content[] = '<span></span>';
2297 $content[] = '<span></span>';
2298 $content[] = '</div>';
2299 $content[] = '</div>';
2300 $content[] = '</div>';
2301 $content[] = '</div>';
2302
2303 $content[] = '<div class="ays-poll-dicount-black-friday-wrap-box" style="width: 25%;">';
2304 $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>';
2305 $content[] = '</div>';
2306 $content[] = '</div>';
2307 $content[] = '</div>';
2308
2309 $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form-black-friday">';
2310 $content[] = '<form action="" method="POST">';
2311 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2312 if( current_user_can( 'manage_options' ) ){
2313 $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>';
2314 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2315 }
2316 $content[] = '</div>';
2317 $content[] = '</form>';
2318 $content[] = '</div>';
2319 $content[] = '</div>';
2320
2321 $content[] = '<script>';
2322 $content[] = "
2323 function aysPollHalloweenCopyToClipboard(text) {
2324 // Create a temporary textarea element
2325 var textarea = document.createElement('textarea');
2326 textarea.value = text;
2327 textarea.style.position = 'fixed';
2328 textarea.style.opacity = '0';
2329 document.body.appendChild(textarea);
2330
2331 // Select and copy the text
2332 textarea.select();
2333 textarea.setSelectionRange(0, 99999); // For mobile devices
2334
2335 try {
2336 document.execCommand('copy');
2337 aysPollHalloweenShowCopyNotification('Coupon code copied!');
2338 } catch (err) {
2339 console.error('Failed to copy text: ', err);
2340 }
2341
2342 // Remove the temporary textarea
2343 document.body.removeChild(textarea);
2344 }
2345
2346 function aysPollHalloweenShowCopyNotification(message) {
2347 // Check if notification already exists
2348 var existingNotification = document.querySelector('.ays-poll-discount-black-friday-banner-2025-copy-notification');
2349 if (existingNotification) {
2350 document.body.removeChild(existingNotification);
2351 }
2352
2353 // Create notification element
2354 var notification = document.createElement('div');
2355 notification.className = 'ays-poll-discount-black-friday-banner-2025-copy-notification';
2356 notification.textContent = message;
2357 document.body.appendChild(notification);
2358
2359 // Show notification with animation
2360 setTimeout(function() {
2361 notification.classList.add('show');
2362 }, 10);
2363
2364 // Hide and remove notification after 2 seconds
2365 setTimeout(function() {
2366 notification.classList.remove('show');
2367 setTimeout(function() {
2368 if (notification.parentNode) {
2369 document.body.removeChild(notification);
2370 }
2371 }, 300);
2372 }, 2000);
2373 }";
2374 $content[] = '</script>';
2375
2376 $content[] = '<style>';
2377 $content[] = '
2378 /* Black friday banner start */
2379 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}}
2380 ';
2381 $content[] = '</style>';
2382
2383 $content = implode( '', $content );
2384
2385 echo $content;
2386 }
2387
2388 // New Mega Bundle 2026
2389 public function ays_poll_new_mega_bundle_message_2026(){
2390
2391 $content = array();
2392
2393 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2394 $now_date = date('M d, Y H:i:s', $date);
2395
2396 $poll_banner_date = strtotime( $this->ays_poll_update_banner_time() );
2397
2398 $diff = $poll_banner_date - $date;
2399
2400 $style_attr = '';
2401 if( $diff < 0 ){
2402 $style_attr = 'style="display:none;"';
2403 }
2404
2405 $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 );
2406
2407 $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">';
2408 $content[] = '<div id="ays-poll-dicount-month" class="ays_poll_dicount_month">';
2409
2410 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-text-box">';
2411 $content[] = '<div>';
2412 $content[] = '<div class="ays-poll-dicount-logo-box">';
2413 $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>';
2414
2415 $content[] = '<div>';
2416 $content[] = '<span class="ays-poll-new-mega-bundle-title">';
2417 $content[] = sprintf(
2418 /* translators: 1: opening link wrapper with <a> tag, 2: closing </a> tag */
2419 __( '%1$s Mega Bundle %2$s (Quiz + Survey + Poll)', 'poll-maker' ),
2420 '<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;">',
2421 '</a></span>'
2422 );
2423 $content[] = '</span>';
2424 $content[] = '</br>';
2425 $content[] = '<span class="ays-poll-new-mega-bundle-desc">';
2426 $content[] = __( "30 Day Money Back Guarantee", 'poll-maker' );
2427 $content[] = '</span>';
2428 $content[] = '</div>';
2429
2430 $content[] = '<div class="ays-poll-new-mega-bundle-title-icon-row" style="display: inline-block;">';
2431 $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;">';
2432 $content[] = '</div>';
2433
2434 $content[] = '</div>';
2435
2436 $content[] = '<div class="ays-poll-new-mega-bundle-mobile-image-display-block display_none">';
2437 $content[] = '<img src="' . POLL_MAKER_AYS_ADMIN_URL . '/images/ays-poll-banner-50.svg" style="width: 70px;">';
2438 $content[] = '</div>';
2439 $content[] = '</div>';
2440
2441 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form">';
2442
2443 $content[] = '<form action="" method="POST">';
2444 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2445 if( current_user_can( 'manage_options' ) ){
2446 $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>';
2447 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2448 }
2449 $content[] = '</div>';
2450 $content[] = '</form>';
2451
2452 $content[] = '</div>';
2453
2454 $content[] = '</div>';
2455
2456 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-countdown-box">';
2457
2458 $content[] = '<div id="ays-poll-maker-countdown-main-container">';
2459 $content[] = '<div class="ays-poll-maker-countdown-container">';
2460
2461 $content[] = '<div ' . $style_attr . ' id="ays-poll-countdown">';
2462
2463 $content[] = '<ul>';
2464
2465 $content[] = '<li><span id="ays-poll-countdown-days"></span></li>';
2466 $content[] = '<li><span id="ays-poll-countdown-hours"></span></li>';
2467 $content[] = '<li><span id="ays-poll-countdown-minutes"></span></li>';
2468 $content[] = '<li><span id="ays-poll-countdown-seconds"></span></li>';
2469 $content[] = '</ul>';
2470 $content[] = '</div>';
2471
2472 $content[] = '<div id="ays-poll-countdown-content" class="emoji">';
2473 $content[] = '</div>';
2474
2475 $content[] = '</div>';
2476 $content[] = '</div>';
2477
2478 $content[] = '</div>';
2479
2480 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-button-box">';
2481 $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>';
2482 $content[] = '<span class="ays-poll-dicount-one-time-text">';
2483 $content[] = __( "One-time payment", 'poll-maker' );
2484 $content[] = '</span>';
2485 $content[] = '</div>';
2486 $content[] = '</div>';
2487 $content[] = '</div>';
2488
2489 // /* New Mega Bundle Banner Quiz | Start */
2490 $content[] = '<style id="ays-poll-mega-bundle-styles-inline-css">';
2491 $content[] = '
2492 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%}}';
2493 $content[] = '</style>';
2494 // /* New Mega Bundle Banner Quiz | End */
2495
2496 $content = implode( '', $content );
2497 echo ($content);
2498 }
2499
2500 // Halloween Bundle 2025
2501 public function ays_poll_new_halloween_bundle_message_2025(){
2502
2503 $content = array();
2504
2505 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2506 $now_date = date('M d, Y H:i:s', $date);
2507
2508 $start_date = strtotime('2025-09-08');
2509 $end_date = strtotime('2025-10-31');
2510 $diff_end = $end_date - $date;
2511
2512 $style_attr = '';
2513 if( $diff_end < 0 ){
2514 $style_attr = 'style="display:none;"';
2515 }
2516
2517 $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);
2518
2519 $content[] = '
2520 <div id="ays-poll-halloween-banner-2025-main" class="ays-poll-halloween-banner-2025-main notice notice-success is-dismissible">
2521 <div class="ays-poll-halloween-banner-2025-content">
2522 <div class="ays-poll-halloween-banner-2025-left">
2523 <div class="ays-poll-halloween-banner-2025-text">
2524 <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>
2525 <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>
2526 </div>
2527 </div>
2528
2529 <div class="ays-poll-halloween-banner-2025-center">';
2530
2531 $content[] = '<div id="ays-poll-halloween-banner-2025-countdown" class="ays-poll-halloween-banner-2025-countdown" ' . $style_attr . '>';
2532 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-timer">';
2533 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2534 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-days">00</div>';
2535 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('days', 'poll-maker') . '</div>';
2536 $content[] = '</div>';
2537 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2538 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2539 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-hours">00</div>';
2540 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('hours', 'poll-maker') . '</div>';
2541 $content[] = '</div>';
2542 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2543 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2544 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-minutes">00</div>';
2545 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('minutes', 'poll-maker') . '</div>';
2546 $content[] = '</div>';
2547 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-separator">:</div>';
2548 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-item">';
2549 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-value" id="ays-poll-halloween-banner-2025-seconds">00</div>';
2550 $content[] = '<div class="ays-poll-halloween-banner-2025-countdown-label">' . __('seconds', 'poll-maker') . '</div>';
2551 $content[] = '</div>';
2552 $content[] = '</div>';
2553 $content[] = '</div>';
2554
2555 $content[] = '</div>
2556
2557 <div class="ays-poll-halloween-banner-2025-right">
2558 <div class="ays-poll-halloween-banner-2025-pumpkin">
2559 <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2560 <g clip-path="url(#clip0_177_40)">
2561 <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"/>
2562 <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"/>
2563 <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"/>
2564 </g>
2565 <defs>
2566 <clipPath id="clip0_177_40">
2567 <rect width="36" height="36" fill="white"/>
2568 </clipPath>
2569 </defs>
2570 </svg>
2571 </div>
2572
2573
2574
2575 <div class="ays-poll-halloween-banner-2025-discount-section">
2576 <div class="ays-poll-halloween-banner-2025-discount">50% OFF</div>
2577 <div class="ays-poll-halloween-banner-2025-coupon-wrapper">
2578 <div class="ays-poll-halloween-banner-2025-coupon-box" onclick="aysPollHalloweenCopyToClipboard(\'HALLOWEEN25\')" title="' . __( 'Click to copy', "poll-maker" ) . '">
2579 <span class="ays-poll-halloween-banner-2025-coupon-text">HALLOWEEN25</span>
2580 <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">
2581 <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"/>
2582 </svg>
2583 </div>
2584 </div>
2585 <a href="'. $ays_poll_cta_button_link .'" class="ays-poll-halloween-banner-2025-upgrade" target="_blank">Buy Now</a>
2586 </div>';
2587
2588 if( current_user_can( 'manage_options' ) ){
2589 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
2590 $content[] = '<form action="" method="POST" style="position: absolute; bottom: -5px; right: 0; color: #fff;">';
2591 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
2592 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
2593 $content[] = '</form>';
2594 $content[] = '</div>';
2595 }
2596
2597 $content[] = '
2598 </div>
2599 </div>
2600 </div>';
2601
2602 $content[] = '<style id="ays-poll-progress-banner-styles-inline-css">';
2603 $content[] = '
2604 .ays-poll-halloween-banner-2025-main {
2605 background: linear-gradient(135deg, #1A0F2E 100%, #2D1B4E 0%);
2606 background-image: url("' . esc_attr( POLL_MAKER_AYS_ADMIN_URL ) . '/images/halloween-banner-background-image-remove.png"), linear-gradient(135deg, #2D1B4E 0%, #1A0F2E 100%);
2607 background-position: left center, center;
2608 background-repeat: no-repeat, no-repeat;
2609 background-size: auto 100%, cover;
2610 padding: 20px 30px 20px 130px;
2611 border-radius: 12px;
2612 color: white;
2613 margin: 20px 0;
2614 border: 0;
2615 box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
2616 overflow: hidden;
2617 }
2618
2619 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-content {
2620 display: flex;
2621 align-items: center;
2622 justify-content: space-between;
2623 gap: 30px;
2624 }
2625
2626 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-left {
2627 display: flex;
2628 align-items: center;
2629 gap: 20px;
2630 }
2631
2632 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-center {
2633 display: flex;
2634 align-items: center;
2635 justify-content: center;
2636 flex: 1;
2637 max-width: 350px;
2638 }
2639
2640 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-right {
2641 display: flex;
2642 align-items: center;
2643 gap: 15px;
2644 flex-shrink: 0;
2645 }
2646
2647 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-icon {
2648 flex-shrink: 0;
2649 }
2650
2651 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin svg {
2652 display: inline !important;
2653 border: none !important;
2654 box-shadow: none !important;
2655 height: 1em !important;
2656 width: 1em !important;
2657 margin: 0 0.07em !important;
2658 vertical-align: -0.1em !important;
2659 background: none !important;
2660 padding: 0 !important;
2661 }
2662
2663 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-orb {
2664 width: 80px;
2665 height: 80px;
2666 background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
2667 border-radius: 50%;
2668 display: flex;
2669 align-items: center;
2670 justify-content: center;
2671 box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
2672 border: 3px solid rgba(168, 85, 247, 0.4);
2673 }
2674
2675 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-question {
2676 font-size: 48px;
2677 font-weight: 700;
2678 color: #E9D5FF;
2679 }
2680
2681 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat {
2682 font-size: 20px;
2683 opacity: 0.8;
2684 }
2685
2686 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat-1 {
2687 margin-left: -100px;
2688 margin-top: -40px;
2689 }
2690
2691 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-bat-2 {
2692 margin-left: -110px;
2693 margin-top: 35px;
2694 }
2695
2696 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle {
2697 font-size: 12px;
2698 opacity: 0.7;
2699 }
2700
2701 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-1 {
2702 margin-left: -95px;
2703 margin-top: -60px;
2704 }
2705
2706 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-2 {
2707 margin-left: -70px;
2708 margin-top: -15px;
2709 }
2710
2711 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-sparkle-3 {
2712 margin-left: -120px;
2713 margin-top: 10px;
2714 }
2715
2716 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-text {
2717 flex: 1;
2718 }
2719
2720 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2721 font-size: 24px;
2722 font-weight: 700;
2723 margin: 0 0 8px 0;
2724 line-height: 1.2;
2725 color: #fff;
2726 text-transform: uppercase;
2727 letter-spacing: 1px;
2728 }
2729
2730 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title a {
2731 color: #FB923C;
2732 text-decoration: underline;
2733 }
2734
2735 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle {
2736 font-size: 16px;
2737 margin: 0;
2738 opacity: 0.9;
2739 font-weight: 400;
2740 color: #E9D5FF;
2741 }
2742
2743 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-description {
2744 font-size: 14px;
2745 margin: 0;
2746 opacity: 0.85;
2747 line-height: 1.5;
2748 color: #D8B4FE;
2749 }
2750
2751 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2752 font-size: 64px;
2753 filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.8));
2754 flex-shrink: 0;
2755 }
2756
2757 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount-section {
2758 display: flex;
2759 flex-direction: column;
2760 align-items: center;
2761 gap: 10px;
2762 }
2763
2764 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount {
2765 font-size: 36px;
2766 font-weight: 700;
2767 color: #FB923C;
2768 text-shadow: 0 0 20px rgba(251, 146, 60, 0.6);
2769 margin: 0;
2770 line-height: 1;
2771 }
2772
2773 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-wrapper {
2774 display:none;
2775 margin-bottom: 5px;
2776 }
2777
2778 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box {
2779 border: 2px dashed rgba(255, 255, 255, 0.4);
2780 padding: 6px 12px;
2781 border-radius: 6px;
2782 background: rgba(255, 255, 255, 0.1);
2783 cursor: pointer;
2784 transition: all 0.3s ease;
2785 display: flex;
2786 align-items: center;
2787 gap: 6px;
2788 backdrop-filter: blur(10px);
2789 }
2790
2791 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box:hover {
2792 background: rgba(255, 255, 255, 0.2);
2793 border-color: rgba(255, 255, 255, 0.6);
2794 transform: translateY(-1px);
2795 }
2796
2797 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-text {
2798 font-size: 14px;
2799 font-weight: 700;
2800 letter-spacing: 1px;
2801 color: #fff;
2802 font-family: monospace;
2803 }
2804
2805 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-copy-icon {
2806 opacity: 0.8;
2807 transition: opacity 0.3s ease;
2808 }
2809
2810 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-box:hover .ays-poll-halloween-banner-2025-copy-icon {
2811 opacity: 1;
2812 }
2813
2814 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade {
2815 background: linear-gradient(135deg, #FB923C 0%, #F97316 100%);
2816 color: white;
2817 border: none;
2818 padding: 12px 28px;
2819 border-radius: 8px;
2820 font-size: 16px;
2821 font-weight: 600;
2822 cursor: pointer;
2823 transition: all 0.3s ease;
2824 box-shadow: 0 4px 16px rgba(251, 146, 60, 0.5);
2825 text-decoration: none;
2826 display: inline-flex;
2827 align-items: center;
2828 text-align: center;
2829 }
2830
2831 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade:hover {
2832 transform: translateY(-2px);
2833 box-shadow: 0 6px 20px rgba(251, 146, 60, 0.7);
2834 text-decoration: none;
2835 color: white;
2836 }
2837
2838 .ays-poll-halloween-banner-2025-main .notice-dismiss:before {
2839 color: #fff;
2840 }
2841
2842 .ays-poll-halloween-banner-2025-copy-notification {
2843 position: fixed;
2844 top: 50%;
2845 left: 50%;
2846 transform: translate(-50%, -50%);
2847 background: rgba(0, 0, 0, 0.8);
2848 color: white;
2849 padding: 12px 24px;
2850 border-radius: 8px;
2851 font-size: 14px;
2852 z-index: 10000;
2853 opacity: 0;
2854 transition: opacity 0.3s ease;
2855 }
2856
2857 .ays-poll-halloween-banner-2025-copy-notification.show {
2858 opacity: 1;
2859 }
2860
2861 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-timer {
2862 display: flex;
2863 align-items: center;
2864 justify-content: center;
2865 gap: 8px;
2866 }
2867
2868 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-item {
2869 background: rgba(255, 255, 255, 0.15);
2870 border-radius: 8px;
2871 padding: 8px 12px;
2872 min-width: 60px;
2873 backdrop-filter: blur(10px);
2874 }
2875
2876 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-value {
2877 font-size: 24px;
2878 font-weight: 700;
2879 line-height: 1;
2880 margin-bottom: 4px;
2881 color: #fff;
2882 text-align: center;
2883 }
2884
2885 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-label {
2886 font-size: 11px;
2887 opacity: 0.8;
2888 text-transform: lowercase;
2889 text-align: center;
2890 }
2891
2892 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-countdown-separator {
2893 font-size: 24px;
2894 font-weight: 700;
2895 opacity: 0.6;
2896 margin: 0 4px;
2897 }
2898
2899 @media (min-width: 1200px) {
2900 .ays-poll-halloween-banner-2025-main .wp-core-ui .notice.is-dismissible {
2901 padding-right: 60px;
2902 }
2903 }
2904
2905 @media (max-width: 1200px) {
2906
2907 div.ays-poll-halloween-banner-2025-main {
2908 padding: 20px 30px;
2909 }
2910
2911 div.ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2912 display: none;
2913 }
2914
2915 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle,
2916 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2917 text-align: center;
2918 }
2919
2920 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-content {
2921 flex-wrap: wrap;
2922 gap: 20px;
2923 }
2924
2925 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-left {
2926 width: 100%;
2927 }
2928
2929 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-center {
2930 width: 100%;
2931 max-width: 100%;
2932 text-align: center;
2933 }
2934
2935 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-right {
2936 width: 100%;
2937 justify-content: center;
2938 }
2939 }
2940
2941 @media (max-width: 786px) {
2942 #ays-poll-halloween-banner-2025-main {
2943 display: none !important;
2944 }
2945 }
2946
2947 @media (max-width: 768px) {
2948 .ays-poll-halloween-banner-2025-main {
2949 padding: 15px 20px;
2950 margin: 15px 0;
2951 }
2952
2953 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2954 font-size: 20px;
2955 }
2956
2957 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-subtitle {
2958 font-size: 14px;
2959 }
2960
2961 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-description {
2962 font-size: 13px;
2963 }
2964
2965 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-pumpkin {
2966 font-size: 48px;
2967 }
2968
2969 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-discount {
2970 font-size: 28px;
2971 }
2972
2973 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-upgrade {
2974 padding: 10px 20px;
2975 font-size: 14px;
2976 }
2977 }
2978
2979 @media (max-width: 480px) {
2980 .ays-poll-halloween-banner-2025-main {
2981 padding: 12px 15px;
2982 }
2983
2984 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-orb {
2985 width: 60px;
2986 height: 60px;
2987 }
2988
2989 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-question {
2990 font-size: 36px;
2991 }
2992
2993 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-title {
2994 font-size: 18px;
2995 }
2996
2997 .ays-poll-halloween-banner-2025-main .ays-poll-halloween-banner-2025-coupon-text {
2998 font-size: 12px;
2999 }
3000 }
3001 ';
3002
3003 $content[] = '</style>';
3004
3005 $content[] = '<script>';
3006 $content[] = "
3007 function aysPollHalloweenCopyToClipboard(text) {
3008 // Create a temporary textarea element
3009 var textarea = document.createElement('textarea');
3010 textarea.value = text;
3011 textarea.style.position = 'fixed';
3012 textarea.style.opacity = '0';
3013 document.body.appendChild(textarea);
3014
3015 // Select and copy the text
3016 textarea.select();
3017 textarea.setSelectionRange(0, 99999); // For mobile devices
3018
3019 try {
3020 document.execCommand('copy');
3021 aysPollHalloweenShowCopyNotification('Coupon code copied!');
3022 } catch (err) {
3023 console.error('Failed to copy text: ', err);
3024 }
3025
3026 // Remove the temporary textarea
3027 document.body.removeChild(textarea);
3028 }
3029
3030 function aysPollHalloweenShowCopyNotification(message) {
3031 // Check if notification already exists
3032 var existingNotification = document.querySelector('.ays-poll-halloween-banner-2025-copy-notification');
3033 if (existingNotification) {
3034 document.body.removeChild(existingNotification);
3035 }
3036
3037 // Create notification element
3038 var notification = document.createElement('div');
3039 notification.className = 'ays-poll-halloween-banner-2025-copy-notification';
3040 notification.textContent = message;
3041 document.body.appendChild(notification);
3042
3043 // Show notification with animation
3044 setTimeout(function() {
3045 notification.classList.add('show');
3046 }, 10);
3047
3048 // Hide and remove notification after 2 seconds
3049 setTimeout(function() {
3050 notification.classList.remove('show');
3051 setTimeout(function() {
3052 if (notification.parentNode) {
3053 document.body.removeChild(notification);
3054 }
3055 }, 300);
3056 }, 2000);
3057 }
3058
3059 (function() {
3060 var endDate = new Date('". date('Y-m-d H:i:s', $end_date) ."').getTime();
3061
3062 function updateCountdown() {
3063 var now = new Date().getTime();
3064 var distance = endDate - now;
3065
3066 if (distance < 0) {
3067 clearInterval(updateCountdown);
3068 document.getElementById('ays-poll-halloween-banner-2025-progress-banner-countdown').style.display = 'none';
3069 return;
3070 }
3071
3072 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
3073 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
3074 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
3075 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
3076
3077 function padZero(num) {
3078 return num < 10 ? '0' + num : num;
3079 }
3080
3081 document.getElementById('ays-poll-halloween-banner-2025-days').textContent = padZero(days);
3082 document.getElementById('ays-poll-halloween-banner-2025-hours').textContent = padZero(hours);
3083 document.getElementById('ays-poll-halloween-banner-2025-minutes').textContent = padZero(minutes);
3084 document.getElementById('ays-poll-halloween-banner-2025-seconds').textContent = padZero(seconds);
3085 }
3086
3087 updateCountdown();
3088 setInterval(updateCountdown, 1000);
3089 })()";
3090 $content[] = '</script>';
3091
3092 $content = implode( '', $content );
3093 echo ($content);
3094 }
3095
3096 // Fox LMS Pro Banner
3097 public function ays_poll_discounted_licenses_banner_message(){
3098
3099 $content = array();
3100
3101 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
3102 $now_date = date('M d, Y H:i:s', $date);
3103
3104 $start_date = strtotime('2025-09-21');
3105 $end_date = strtotime('2025-10-21');
3106 $diff_end = $end_date - $date;
3107
3108 $style_attr = '';
3109 if( $diff_end < 0 ){
3110 $style_attr = 'style="display:none;"';
3111 }
3112
3113 $total_licenses = 50;
3114 $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);
3115 $days_passed = floor(($date - $start_date) / (24 * 60 * 60));
3116 $used_licenses = 0;
3117
3118 for ($i = 0; $i < min($days_passed, count($progression_pattern)); $i++) {
3119 $used_licenses += $progression_pattern[$i];
3120 }
3121 $used_licenses = min($used_licenses, $total_licenses);
3122 $remaining_licenses = $total_licenses - $used_licenses;
3123 $progress_percentage = ($used_licenses / $total_licenses) * 100;
3124
3125 $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);
3126
3127 $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 . '>';
3128 $content[] = '<div class="ays-poll-progress-banner-content">';
3129 $content[] = '<div class="ays-poll-progress-banner-left">';
3130 $content[] = '<div class="ays-poll-progress-banner-icon">';
3131 $content[] = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
3132 <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"/>
3133 <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"/>
3134 <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"/>
3135 <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"/>
3136 <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"/>
3137 <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"/>
3138 </svg>';
3139 $content[] = '</div>';
3140 $content[] = '<div class="ays-poll-progress-banner-text">';
3141 $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>';
3142 $content[] = '<p class="ays-poll-progress-banner-subtitle">' . __('Unlock advanced features + 30 day Money Back Guarantee', 'poll-maker') . '</p>';
3143 $content[] = '</div>';
3144 $content[] = '</div>';
3145
3146 $content[] = '<div class="ays-poll-progress-banner-center">';
3147 $content[] = '<div class="ays-poll-progress-banner-coupon">';
3148 $content[] = '<div class="ays-poll-progress-banner-coupon-box" onclick="pollCopyToClipboard(\'FREE2PRO20\')" title="' . __('Click to copy', 'poll-maker') . '">';
3149 $content[] = '<span class="ays-poll-progress-banner-coupon-text">FREE2PRO20</span>';
3150 $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">';
3151 $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"/>';
3152 $content[] = '</svg>';
3153 $content[] = '</div>';
3154 $content[] = '</div>';
3155
3156 $content[] = '<div class="ays-poll-progress-banner-progress">';
3157 $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>';
3158 $content[] = '<div class="ays-poll-progress-banner-progress-bar">';
3159 $content[] = '<div class="ays-poll-progress-banner-progress-fill" id="progress-fill" style="width: ' . $progress_percentage . '%;"></div>';
3160 $content[] = '</div>';
3161 $content[] = '</div>';
3162 $content[] = '</div>';
3163
3164 $content[] = '<div class="ays-poll-progress-banner-right">';
3165 $content[] = '<a href="'. $ays_poll_cta_button_link .'" class="ays-poll-progress-banner-upgrade" target="_blank">';
3166 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">';
3167 $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"/>';
3168 $content[] = '</svg>';
3169 $content[] = ' ' . __('Upgrade Now', 'poll-maker');
3170 $content[] = '</a>';
3171 $content[] = '</div>';
3172 $content[] = '</div>';
3173
3174 if( current_user_can( 'manage_options' ) ){
3175 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
3176 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
3177 $content[] = '<button class="btn btn-link ays-button" name="ays_poll_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'poll-maker' ) .'</button>';
3178 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
3179 $content[] = '</form>';
3180 $content[] = '</div>';
3181 }
3182 $content[] = '</div>';
3183
3184 // Fox LMS Pro Banner Styles
3185 $content[] = '<style id="ays-poll-progress-banner-styles-inline-css">';
3186 $content[] = '
3187 .ays-poll-progress-banner-main {
3188 background: linear-gradient(135deg, #6344ED 0%, #8C2ABE 100%);
3189 padding: 20px 30px;
3190 border-radius: 16px;
3191 color: white;
3192 position: relative;
3193 margin: 20px 0;
3194 box-shadow: 0 8px 32px rgba(99, 68, 237, 0.3);
3195 border: 0;
3196 }
3197
3198 .ays-poll-progress-banner-main .ays-poll-progress-banner-content {
3199 display: flex;
3200 align-items: center;
3201 justify-content: space-between;
3202 gap: 30px;
3203 }
3204
3205 .ays-poll-progress-banner-main .ays-poll-progress-banner-left {
3206 display: flex;
3207 align-items: center;
3208 gap: 20px;
3209 flex: 1;
3210 }
3211
3212 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3213 display: flex;
3214 align-items: center;
3215 gap: 15px;
3216 flex: 1;
3217 }
3218
3219 .ays-poll-progress-banner-main .ays-poll-progress-banner-right {
3220 display: flex;
3221 align-items: center;
3222 gap: 20px;
3223 flex-shrink: 0;
3224 }
3225
3226 .ays-poll-progress-banner-main .ays-poll-progress-banner-icon {
3227 font-size: 32px;
3228 filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
3229 }
3230
3231 .ays-poll-progress-banner-main .ays-poll-progress-banner-title {
3232 font-size: 21px;
3233 font-weight: 700;
3234 margin: 0 0 8px 0;
3235 line-height: 1.2;
3236 color: #fff;
3237 }
3238
3239 .ays-poll-progress-banner-main .ays-poll-progress-banner-title a {
3240 text-decoration: underline;
3241 color: #fff;
3242 }
3243
3244 .ays-poll-progress-banner-main .ays-poll-progress-banner-subtitle {
3245 font-size: 16px;
3246 margin: 0;
3247 opacity: 0.9;
3248 font-weight: 400;
3249 }
3250
3251 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon {
3252 margin-bottom: 5px;
3253 }
3254
3255 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box {
3256 border: 2px dotted rgba(255, 255, 255, 0.6);
3257 padding: 8px 16px;
3258 border-radius: 8px;
3259 background: rgba(255, 255, 255, 0.1);
3260 cursor: pointer;
3261 transition: all 0.3s ease;
3262 display: flex;
3263 align-items: center;
3264 gap: 8px;
3265 backdrop-filter: blur(10px);
3266 }
3267
3268 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box:hover {
3269 background: rgba(255, 255, 255, 0.2);
3270 border-color: rgba(255, 255, 255, 0.8);
3271 transform: translateY(-1px);
3272 }
3273
3274 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-text {
3275 font-size: 16px;
3276 font-weight: 700;
3277 letter-spacing: 1px;
3278 color: #fff;
3279 font-family: monospace;
3280 }
3281
3282 .ays-poll-progress-banner-main .ays-poll-progress-banner-copy-icon {
3283 opacity: 0.8;
3284 transition: opacity 0.3s ease;
3285 }
3286
3287 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-box:hover .ays-poll-progress-banner-copy-icon {
3288 opacity: 1;
3289 }
3290
3291 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress {
3292 text-align: center;
3293 width: 100%;
3294 }
3295
3296 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-text {
3297 font-size: 14px;
3298 margin: 0 0 10px 0;
3299 opacity: 0.9;
3300 }
3301
3302 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3303 width: 300px;
3304 height: 10px;
3305 background: rgba(255, 255, 255, 0.2);
3306 border-radius: 4px;
3307 overflow: hidden;
3308 margin: 0 auto;
3309 }
3310
3311 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-fill {
3312 height: 100%;
3313 background: linear-gradient(90deg, #4ADE80 0%, #22C55E 100%);
3314 border-radius: 4px;
3315 transition: width 0.8s ease;
3316 width: 70%;
3317 }
3318
3319 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade {
3320 background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
3321 color: white;
3322 border: none;
3323 padding: 12px 24px;
3324 border-radius: 8px;
3325 font-size: 16px;
3326 font-weight: 600;
3327 cursor: pointer;
3328 transition: all 0.3s ease;
3329 box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
3330 text-decoration: none;
3331 display: inline-flex;
3332 align-items: center;
3333 gap: 8px;
3334 }
3335
3336 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade:hover {
3337 transform: translateY(-2px);
3338 box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
3339 text-decoration: none;
3340 color: white;
3341 }
3342
3343 .ays-poll-progress-banner-main .notice-dismiss:before {
3344 color: #fff;
3345 }
3346
3347 /* Copy notification */
3348 .ays-poll-copy-notification {
3349 position: fixed;
3350 top: 50%;
3351 left: 50%;
3352 transform: translate(-50%, -50%);
3353 background: rgba(0, 0, 0, 0.8);
3354 color: white;
3355 padding: 12px 24px;
3356 border-radius: 8px;
3357 font-size: 14px;
3358 z-index: 10000;
3359 opacity: 0;
3360 transition: opacity 0.3s ease;
3361 }
3362
3363 .ays-poll-copy-notification.show {
3364 opacity: 1;
3365 }
3366
3367 @media (max-width: 1400px) {
3368 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3369 flex-direction: column;
3370 }
3371 }
3372
3373 @media (max-width: 1200px) {
3374 .ays-poll-progress-banner-main .ays-poll-progress-banner-content {
3375 flex-direction: column;
3376 gap: 20px;
3377 }
3378
3379 .ays-poll-progress-banner-main .ays-poll-progress-banner-left {
3380 width: 100%;
3381 justify-content: center;
3382 text-align: center;
3383 flex-direction: column;
3384 }
3385
3386 .ays-poll-progress-banner-main .ays-poll-progress-banner-center {
3387 width: 100%;
3388 }
3389
3390 .ays-poll-progress-banner-main .ays-poll-progress-banner-right {
3391 width: 100%;
3392 justify-content: center;
3393 }
3394 }
3395
3396 @media (max-width: 768px) {
3397 #ays-poll-progress-banner-main {
3398 display: none !important;
3399 }
3400
3401 .ays-poll-progress-banner-main {
3402 padding: 15px 20px;
3403 margin: 15px 0;
3404 }
3405
3406 .ays-poll-progress-banner-main .ays-poll-progress-banner-title {
3407 font-size: 18px;
3408 }
3409
3410 .ays-poll-progress-banner-main .ays-poll-progress-banner-subtitle {
3411 font-size: 14px;
3412 }
3413
3414 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3415 width: 100%;
3416 max-width: 280px;
3417 }
3418
3419 .ays-poll-progress-banner-main .ays-poll-progress-banner-upgrade {
3420 padding: 10px 20px;
3421 font-size: 14px;
3422 }
3423 }
3424
3425 @media (max-width: 480px) {
3426 .ays-poll-progress-banner-main {
3427 padding: 12px 15px;
3428 }
3429
3430 .ays-poll-progress-banner-main .ays-poll-progress-banner-coupon-text {
3431 font-size: 14px;
3432 }
3433
3434 .ays-poll-progress-banner-main .ays-poll-progress-banner-progress-bar {
3435 max-width: 250px;
3436 }
3437 }
3438 ';
3439
3440 $content[] = '</style>';
3441
3442 $content = implode( '', $content );
3443 echo ($content);
3444
3445 }
3446
3447 public function ays_poll_sale_message_poll_pro(){
3448 $content = array();
3449
3450 $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 );
3451
3452 $content[] = '<div id="ays-poll-dicount-month-main" class="ays-poll-admin-notice notice notice-success is-dismissible ays_poll_dicount_info">';
3453 $content[] = '<div id="ays-poll-dicount-month" class="ays_poll_dicount_month">';
3454
3455 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-text-box">';
3456 $content[] = '<div>';
3457 $content[] = '<span class="ays-poll-new-poll-pro-title">';
3458
3459 $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' );
3460
3461 $content[] = '</span>';
3462 $content[] = '</br>';
3463 $content[] = '<div class="ays-poll-new-poll-pro-mobile-image-display-block display_none">';
3464 $content[] = '<span class="ays-poll-sale-baner-mega-bundle-sale-text">50%</span>';
3465 $content[] = '<img src="' . esc_url(POLL_MAKER_AYS_ADMIN_URL) . '/images/line.webp" style="width: 70px;">';
3466 $content[] = '</div>';
3467 $content[] = '<span class="ays-poll-new-poll-pro-desc">';
3468 $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">';
3469 $content[] =esc_html__( "30 Days Money Back Guarantee", "poll-maker" );
3470 $content[] = '</span>';
3471 $content[] = '</div>';
3472 $content[] = '<div style="display:flex;flex-wrap:wrap;width:min-content;">';
3473 $content[] = '<span class="ays-poll-sale-baner-mega-bundle-sale-text">50%</span>';
3474 $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;">';
3475 $content[] = '</div>';
3476 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-poll-dismiss-buttons-container-for-form">';
3477
3478 $content[] = '<form action="" method="POST">';
3479 $content[] = '<div id="ays-poll-dismiss-buttons-content">';
3480 if( current_user_can( 'manage_options' ) ){
3481 $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>';
3482 $content[] = wp_nonce_field( POLL_MAKER_AYS_NAME . '-sale-banner' , POLL_MAKER_AYS_NAME . '-sale-banner' );
3483 }
3484 $content[] = '</div>';
3485 $content[] = '</form>';
3486
3487 $content[] = '</div>';
3488
3489 $content[] = '</div>';
3490
3491 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-countdown-box">';
3492
3493 $content[] = '<div id="ays-poll-maker-countdown-main-container">';
3494 $content[] = '<div class="ays-poll-maker-countdown-container">';
3495
3496 $content[] = '<div id="ays-poll-countdown">';
3497
3498 $content[] = '<ul>';
3499 $content[] = '<li><span id="ays-poll-countdown-days"></span>days</li>';
3500 $content[] = '<li><span id="ays-poll-countdown-hours"></span>Hours</li>';
3501 $content[] = '<li><span id="ays-poll-countdown-minutes"></span>Minutes</li>';
3502 $content[] = '<li><span id="ays-poll-countdown-seconds"></span>Seconds</li>';
3503 $content[] = '</ul>';
3504
3505 $content[] = '</div>';
3506
3507 $content[] = '<div id="ays-poll-countdown-content" class="emoji">';
3508 $content[] = '<span>🚀</span>';
3509 $content[] = '<span>⌛</span>';
3510 $content[] = '<span>🔥</span>';
3511 $content[] = '<span>💣</span>';
3512 $content[] = '</div>';
3513
3514 $content[] = '</div>';
3515 $content[] = '</div>';
3516
3517 $content[] = '</div>';
3518
3519 $content[] = '<div class="ays-poll-dicount-wrap-box ays-poll-dicount-wrap-button-box">';
3520
3521 $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>';
3522
3523 $content[] = '<span class="ays-poll-dicount-one-time-text">';
3524 $content[] =esc_html__( "One-time payment", "poll-maker" );
3525 $content[] = '</span>';
3526 $content[] = '</div>';
3527 $content[] = '</div>';
3528 $content[] = '</div>';
3529 $background_image = POLL_MAKER_AYS_ADMIN_URL . '/images/ays-poll-banner-background-50.svg';
3530 $close_banner_image = POLL_MAKER_AYS_ADMIN_URL . '/images/icons/ays-poll-close-banner-white.svg';
3531
3532 $content[] = '<style id="ays_poll_sale_message_poll_pro-inline-css">';
3533 $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}}';
3534 $content[] = '</style>';
3535
3536 $content = implode( '', $content );
3537 echo ( $content );
3538 }
3539
3540 public function add_tabs() {
3541 $screen = get_current_screen();
3542
3543 if ( ! $screen) {
3544 return;
3545 }
3546
3547 $title = esc_html__( 'General Information:', "poll-maker");
3548 $content_text = '<div>
3549 <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>
3550 </div>
3551 <br>
3552 <div>
3553 <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>
3554 </div>
3555 <div>
3556 <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>
3557 </div>
3558 <div>
3559 <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>
3560 </div>
3561 <div>
3562 <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>
3563 </div>
3564 <div>
3565 <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>
3566 </div>
3567 <div>
3568 <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>
3569 </div>
3570 <div>
3571 <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>
3572 </div>
3573 <br>
3574 <div>
3575 <span>'. esc_html__( "Increase engagement of your website with the integrated, formatting, image, audio, video poll question types feature.", "poll-maker") .'</span>
3576 </div>';
3577
3578 $sidebar_content = '<p><strong>'. esc_html__( 'For more information:', "poll-maker") .'</strong></p>' .
3579 '<p>
3580 <a href="https://www.youtube.com/watch?v=RDKZXFmG6Pc" target="_blank">' .esc_html__( 'YouTube video tutorials' , "poll-maker" ) . '</a>
3581 </p>' .
3582 '<p>
3583 <a href="https://ays-pro.com/wordpress-poll-maker-user-manual" target="_blank">' .esc_html__( 'Documentation', "poll-maker" ) . '</a>
3584 </p>' .
3585 '<p>
3586 <a href="https://ays-pro.com/wordpress/poll-maker" target="_blank">' .esc_html__( 'Poll Maker plugin pro version', "poll-maker" ) . '</a>
3587 </p>' .
3588 '<p>
3589 <a href="https://poll-plugin.com/wordpress-poll-plugin-pro-demo/" target="_blank">' .esc_html__( 'Poll Maker plugin demo', "poll-maker" ) . '</a>
3590 </p>';
3591
3592
3593 $content = '<h2>' .esc_html__( 'Poll Maker Information', "poll-maker") . '</h2>';
3594 $content .= '<div>' . $content_text . '</div>';
3595
3596 $help_tab_content = array(
3597 'id' => 'poll_maker_help_tab',
3598 'title' => $title,
3599 'content' => $content
3600 );
3601
3602 $screen->add_help_tab($help_tab_content);
3603
3604 $screen->set_help_sidebar($sidebar_content);
3605 }
3606
3607 /**
3608 * Recursive sanitation for an array
3609 *
3610 * @param $array
3611 *
3612 * @return mixed
3613 */
3614 public static function recursive_sanitize_text_field($array) {
3615 foreach ( $array as $key => &$value ) {
3616 if ( is_array( $value ) ) {
3617 $value = self::recursive_sanitize_text_field($value);
3618 } else {
3619 $value = sanitize_text_field( $value );
3620 }
3621 }
3622 return $array;
3623 }
3624
3625 public static function get_max_id( $table ) {
3626 global $wpdb;
3627 $db_table = $wpdb->prefix . 'ayspoll_'.$table;;
3628
3629 $sql = "SELECT MAX(id) FROM {$db_table}";
3630
3631 $result = intval( $wpdb->get_var( $sql ) );
3632
3633 return $result;
3634 }
3635
3636 public function ays_poll_generate_message_vars_html( $poll_message_vars ) {
3637 $content = array();
3638 $var_counter = 0;
3639
3640 $allowed_tags = array(
3641 'div' => array(
3642 'class' => true
3643 ),
3644 'span' => array(),
3645 'a' => array(
3646 'class' => true,
3647 'data-toggle' => true,
3648 'data-html' => true,
3649 'title' => true
3650 ),
3651 'i' => array(
3652 'class' => true
3653 ),
3654 'label' => array(
3655 'class' => true
3656 ),
3657 'input' => array(
3658 'type' => true,
3659 'class' => true,
3660 'hidden' => true,
3661 'id' => true,
3662 'name' => true,
3663 'value' => true
3664 )
3665 );
3666
3667 $content[] = '<div class="ays-poll-message-vars-box">';
3668 $content[] = '<div class="ays-poll-message-vars-icon">';
3669 $content[] = '<div>';
3670 $content[] = '<i class="ays_poll_fa ays_fa_link"></i>';
3671 $content[] = '</div>';
3672 $content[] = '<div>';
3673 $content[] = '<span>'.esc_html__("Message Variables" , "poll-maker") .'</span>';
3674 $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") .'">';
3675 $content[] = '<i class="fas fa-info-circle"></i>';
3676 $content[] = '</a>';
3677 $content[] = '</div>';
3678 $content[] = '</div>';
3679 $content[] = '<div class="ays-poll-message-vars-data">';
3680 foreach($poll_message_vars as $var => $var_name){
3681 $var_counter++;
3682 $content[] = '<label class="ays-poll-message-vars-each-data-label">';
3683 $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">';
3684 $content[] = '<div class="ays-poll-message-vars-each-data">';
3685 $content[] = '<input type="hidden" class="ays-poll-message-vars-each-var" value="'. $var .'">';
3686 $content[] = '<span>'. $var_name .'</span>';
3687 $content[] = '</div>';
3688 $content[] = '</label>';
3689 }
3690 $content[] = '</div>';
3691 $content[] = '</div>';
3692
3693 $content = implode( '', $content );
3694
3695 return wp_kses( $content, $allowed_tags );
3696 }
3697
3698 /**
3699 * Determine if the plugin/addon installations are allowed.
3700 *
3701 * @since 1.3.9
3702 *
3703 * @param string $type Should be `plugin` or `addon`.
3704 *
3705 * @return bool
3706 */
3707 public static function ays_poll_can_install( $type ) {
3708
3709 return self::ays_poll_can_do( 'install', $type );
3710 }
3711
3712 /**
3713 * Determine if the plugin/addon activations are allowed.
3714 *
3715 * @since 1.3.9
3716 *
3717 * @param string $type Should be `plugin` or `addon`.
3718 *
3719 * @return bool
3720 */
3721 public static function ays_poll_can_activate( $type ) {
3722
3723 return self::ays_poll_can_do( 'activate', $type );
3724 }
3725
3726 /**
3727 * Determine if the plugin/addon installations/activations are allowed.
3728 *
3729 * @since 1.3.9
3730 *
3731 * @param string $what Should be 'activate' or 'install'.
3732 * @param string $type Should be `plugin` or `addon`.
3733 *
3734 * @return bool
3735 */
3736 public static function ays_poll_can_do( $what, $type ) {
3737
3738 if ( ! in_array( $what, array( 'install', 'activate' ), true ) ) {
3739 return false;
3740 }
3741
3742 if ( ! in_array( $type, array( 'plugin', 'addon' ), true ) ) {
3743 return false;
3744 }
3745
3746 $capability = $what . '_plugins';
3747
3748 if ( ! current_user_can( $capability ) ) {
3749 return false;
3750 }
3751
3752 // Determine whether file modifications are allowed and it is activation permissions checking.
3753 if ( $what === 'install' && ! wp_is_file_mod_allowed( 'ays_poll_can_install' ) ) {
3754 return false;
3755 }
3756
3757 // All plugin checks are done.
3758 if ( $type === 'plugin' ) {
3759 return true;
3760 }
3761 return false;
3762 }
3763
3764 /**
3765 * Activate plugin.
3766 *
3767 * @since 1.0.0
3768 * @since 1.3.9 Updated the permissions checking.
3769 */
3770 public function ays_poll_activate_plugin() {
3771
3772 // Run a security check.
3773 check_ajax_referer( $this->plugin_name . '-install-plugin-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
3774
3775 // Check for permissions.
3776 if ( ! current_user_can( 'activate_plugins' ) ) {
3777 wp_send_json_error( esc_html__( 'Plugin activation is disabled for you on this site.', $this->plugin_name ) );
3778 }
3779
3780 $type = 'addon';
3781
3782 if ( isset( $_POST['plugin'] ) ) {
3783
3784 if ( ! empty( $_POST['type'] ) ) {
3785 $type = sanitize_key( $_POST['type'] );
3786 }
3787
3788 $plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
3789 $activate = activate_plugins( $plugin );
3790
3791 if ( ! is_wp_error( $activate ) ) {
3792 if ( $type === 'plugin' ) {
3793 wp_send_json_success( esc_html__( 'Plugin activated.', $this->plugin_name ) );
3794 } else {
3795 ( esc_html__( 'Addon activated.', $this->plugin_name ) );
3796 }
3797 }
3798 }
3799
3800 if ( $type === 'plugin' ) {
3801 wp_send_json_error( esc_html__( 'Could not activate the plugin. Please activate it on the Plugins page.', $this->plugin_name ) );
3802 }
3803
3804 wp_send_json_error( esc_html__( 'Could not activate the addon. Please activate it on the Plugins page.', $this->plugin_name ) );
3805 }
3806
3807 /**
3808 * Install addon.
3809 *
3810 * @since 1.0.0
3811 * @since 1.3.9 Updated the permissions checking.
3812 */
3813 public function ays_poll_install_plugin() {
3814
3815 // Run a security check.
3816 check_ajax_referer( $this->plugin_name . '-install-plugin-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
3817
3818 $generic_error = esc_html__( 'There was an error while performing your request.', $this->plugin_name );
3819 $type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : '';
3820
3821 // Check if new installations are allowed.
3822 if ( ! self::ays_poll_can_install( $type ) ) {
3823 wp_send_json_error( $generic_error );
3824 }
3825
3826 $error = $type === 'plugin'
3827 ? esc_html__( 'Could not install the plugin. Please download and install it manually.', $this->plugin_name )
3828 : "";
3829
3830 $plugin_url = ! empty( $_POST['plugin'] ) ? esc_url_raw( wp_unslash( $_POST['plugin'] ) ) : '';
3831
3832 if ( empty( $plugin_url ) ) {
3833 wp_send_json_error( $error );
3834 }
3835
3836 // Prepare variables.
3837 $url = esc_url_raw(
3838 add_query_arg(
3839 [
3840 'page' => 'poll-maker-ays-featured-plugins',
3841 ],
3842 admin_url( 'admin.php' )
3843 )
3844 );
3845
3846 ob_start();
3847 $creds = request_filesystem_credentials( $url, '', false, false, null );
3848
3849 // Hide the filesystem credentials form.
3850 ob_end_clean();
3851
3852 // Check for file system permissions.
3853 if ( $creds === false ) {
3854 wp_send_json_error( $error );
3855 }
3856
3857 if ( ! WP_Filesystem( $creds ) ) {
3858 wp_send_json_error( $error );
3859 }
3860
3861 /*
3862 * We do not need any extra credentials if we have gotten this far, so let's install the plugin.
3863 */
3864 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-upgrader.php';
3865 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-install-skin.php';
3866 require_once POLL_MAKER_AYS_DIR . 'includes/admin/class-poll-maker-skin.php';
3867
3868
3869 // Do not allow WordPress to search/download translations, as this will break JS output.
3870 remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
3871
3872 // Create the plugin upgrader with our custom skin.
3873 $installer = new PollMaker\Helpers\PollMakerPluginSilentUpgrader( new Poll_Maker_Install_Skin() );
3874
3875 // Error check.
3876 if ( ! method_exists( $installer, 'install' ) ) {
3877 wp_send_json_error( $error );
3878 }
3879
3880 $installer->install( $plugin_url );
3881
3882 // Flush the cache and return the newly installed plugin basename.
3883 wp_cache_flush();
3884
3885 $plugin_basename = $installer->plugin_info();
3886
3887 if ( empty( $plugin_basename ) ) {
3888 wp_send_json_error( $error );
3889 }
3890
3891 $result = array(
3892 'msg' => $generic_error,
3893 'is_activated' => false,
3894 'basename' => $plugin_basename,
3895 );
3896
3897 // Check for permissions.
3898 if ( ! current_user_can( 'activate_plugins' ) ) {
3899 $result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed.', $this->plugin_name ) : "";
3900
3901 wp_send_json_success( $result );
3902 }
3903
3904 // Activate the plugin silently.
3905 $activated = activate_plugin( $plugin_basename );
3906 remove_action( 'activated_plugin', array( 'gallery_p_gallery_activation_redirect_method', 'ays_sccp_activation_redirect_method' ), 100 );
3907
3908 if ( ! is_wp_error( $activated ) ) {
3909
3910 $result['is_activated'] = true;
3911 $result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed and activated.', $this->plugin_name ) : esc_html__( 'Addon installed and activated.', $this->plugin_name );
3912
3913 wp_send_json_success( $result );
3914 }
3915
3916 // Fallback error just in case.
3917 wp_send_json_error( $result );
3918 }
3919
3920 /**
3921 * List of AM plugins that we propose to install.
3922 *
3923 * @since 1.3.9
3924 *
3925 * @return array
3926 */
3927 protected function poll_get_am_plugins() {
3928 if ( !isset( $_SESSION ) ) {
3929 session_start();
3930 }
3931
3932 $images_url = POLL_MAKER_AYS_ADMIN_URL . '/images/icons/';
3933
3934 $plugin_slug = array(
3935 'fox-lms',
3936 'quiz-maker',
3937 'survey-maker',
3938 'ays-popup-box',
3939 'gallery-photo-gallery',
3940 'secure-copy-content-protection',
3941 'personal-dictionary',
3942 'chart-builder',
3943 'easy-form',
3944 );
3945
3946 $plugin_url_arr = array();
3947 foreach ($plugin_slug as $key => $slug) {
3948 if ( isset( $_SESSION['ays_poll_our_product_links'] ) && !empty( $_SESSION['ays_poll_our_product_links'] )
3949 && isset( $_SESSION['ays_poll_our_product_links'][$slug] ) && !empty( $_SESSION['ays_poll_our_product_links'][$slug] ) ) {
3950 $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] ) : "";
3951 } else {
3952 $latest_version = $this->ays_poll_get_latest_plugin_version($slug);
3953 $plugin_url = 'https://downloads.wordpress.org/plugin/'. $slug .'.zip';
3954 if ( $latest_version != '' ) {
3955 $plugin_url = 'https://downloads.wordpress.org/plugin/'. $slug .'.'. $latest_version .'.zip';
3956 $_SESSION['ays_poll_our_product_links'][$slug] = $plugin_url;
3957 }
3958 }
3959
3960 $plugin_url_arr[$slug] = $plugin_url;
3961 }
3962
3963 $plugins_array = array(
3964 'fox-lms/fox-lms.php' => array(
3965 'icon' => $images_url . 'icon-fox-lms-128x128.png',
3966 'name' => __( 'Fox LMS', 'poll-maker' ),
3967 'desc' => __( 'Build and manage online courses directly on your WordPress site.', 'poll-maker' ),
3968 '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' ),
3969 'wporg' => 'https://wordpress.org/plugins/fox-lms/',
3970 'buy_now' => 'https://foxlms.com/pricing/?utm_source=dashboard&utm_medium=poll-free&utm_campaign=fox-lms-our-products-page',
3971 'url' => $plugin_url_arr['fox-lms'],
3972 ),
3973 'quiz-maker/quiz-maker.php' => array(
3974 'icon' => $images_url . 'icon-quiz-128x128.png',
3975 'name' => __( 'Quiz Maker', 'poll-maker' ),
3976 'desc' => __( 'With our Quiz Maker plugin it’s easy to make a quiz in a short time.', 'poll-maker' ),
3977 'desc_hidden' => __( 'You to add images to your quiz, order unlimited questions. Also you can style your quiz to satisfy your visitors.', 'poll-maker' ),
3978 'wporg' => 'https://wordpress.org/plugins/quiz-maker/',
3979 'buy_now' => 'https://ays-pro.com/wordpress/quiz-maker/',
3980 'url' => $plugin_url_arr['quiz-maker'],
3981 ),
3982 'survey-maker/survey-maker.php' => array(
3983 'icon' => $images_url . 'icon-survey-128x128.png',
3984 'name' => __( 'Survey Maker', 'poll-maker' ),
3985 'desc' => __( 'Make amazing online surveys and get real-time feedback quickly and easily.', 'poll-maker' ),
3986 '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' ),
3987 'wporg' => 'https://wordpress.org/plugins/survey-maker/',
3988 'buy_now' => 'https://ays-pro.com/wordpress/survey-maker',
3989 'url' => $plugin_url_arr['survey-maker'],
3990 ),
3991 'ays-popup-box/ays-pb.php' => array(
3992 'icon' => $images_url . 'icon-popup-128x128.png',
3993 'name' => __( 'Popup Box', 'poll-maker' ),
3994 'desc' => __( 'Popup everything you want! Create informative and promotional popups all in one plugin.', 'poll-maker' ),
3995 'desc_hidden' => __( 'Attract your visitors and convert them into email subscribers and paying customers.', 'poll-maker' ),
3996 'wporg' => 'https://wordpress.org/plugins/ays-popup-box/',
3997 'buy_now' => 'https://ays-pro.com/wordpress/popup-box/',
3998 'url' => $plugin_url_arr['ays-popup-box'],
3999 ),
4000 'gallery-photo-gallery/gallery-photo-gallery.php' => array(
4001 'icon' => $images_url . 'icon-gallery-128x128.png',
4002 'name' => __( 'Gallery Photo Gallery', 'poll-maker' ),
4003 'desc' => __( 'Create unlimited galleries and include unlimited images in those galleries.', 'poll-maker' ),
4004 'desc_hidden' => __( 'Represent images in an attractive way. Attract people with your own single and multiple free galleries from your photo library.', 'poll-maker' ),
4005 'wporg' => 'https://wordpress.org/plugins/gallery-photo-gallery/',
4006 'buy_now' => 'https://ays-pro.com/wordpress/photo-gallery/',
4007 'url' => $plugin_url_arr['gallery-photo-gallery'],
4008 ),
4009 'secure-copy-content-protection/secure-copy-content-protection.php' => array(
4010 'icon' => $images_url . 'icon-sccp-128x128.png',
4011 'name' => __( 'Secure Copy Content Protection', 'poll-maker' ),
4012 'desc' => __( 'Disable the right click, copy paste, content selection and copy shortcut keys on your website.', 'poll-maker' ),
4013 'desc_hidden' => __( 'Protect web content from being plagiarized. Prevent plagiarism from your website with this easy to use plugin.', 'poll-maker' ),
4014 'wporg' => 'https://wordpress.org/plugins/secure-copy-content-protection/',
4015 'buy_now' => 'https://ays-pro.com/wordpress/secure-copy-content-protection/',
4016 'url' => $plugin_url_arr['secure-copy-content-protection'],
4017 ),
4018 'personal-dictionary/personal-dictionary.php' => array(
4019 'icon' => $images_url . 'pd-logo-128x128.png',
4020 'name' => __( 'Personal Dictionary', 'poll-maker' ),
4021 'desc' => __( 'Allow your students to create personal dictionary, study and memorize the words.', 'poll-maker' ),
4022 'desc_hidden' => __( 'Allow your users to create their own digital dictionaries and learn new words and terms as fastest as possible.', 'poll-maker' ),
4023 'wporg' => 'https://wordpress.org/plugins/personal-dictionary/',
4024 'buy_now' => 'https://ays-pro.com/wordpress/personal-dictionary/',
4025 'url' => $plugin_url_arr['personal-dictionary'],
4026 ),
4027 'chart-builder/chart-builder.php' => array(
4028 'icon' => $images_url . 'chartify-150x150.png',
4029 'name' => __( 'Chart Builder', 'poll-maker' ),
4030 'desc' => __( 'Chart Builder plugin allows you to create beautiful charts', 'poll-maker' ),
4031 'desc_hidden' => __( ' and graphs easily and quickly.', 'poll-maker' ),
4032 'wporg' => 'https://wordpress.org/plugins/chart-builder/',
4033 'buy_now' => 'https://ays-pro.com/wordpress/chart-builder/',
4034 'url' => $plugin_url_arr['chart-builder'],
4035 ),
4036 'easy-form/easy-form.php' => array(
4037 'icon' => $images_url . 'easyform-150x150.png',
4038 'name' => __( 'Easy Form', 'poll-maker' ),
4039 'desc' => __( 'Choose the best WordPress form builder plugin. ', 'poll-maker' ),
4040 'desc_hidden' => __( 'Create contact forms, payment forms, surveys, and many more custom forms. Build forms easily with us.', 'poll-maker' ),
4041 'wporg' => 'https://wordpress.org/plugins/easy-form/',
4042 'buy_now' => 'https://ays-pro.com/wordpress/easy-form',
4043 'url' => $plugin_url_arr['easy-form'],
4044 ),
4045 );
4046
4047 return $plugins_array;
4048 }
4049
4050 protected function ays_poll_get_latest_plugin_version( $slug ){
4051
4052 if ( is_null( $slug ) || empty($slug) ) {
4053 return "";
4054 }
4055
4056 $version_latest = "";
4057
4058 if ( ! function_exists( 'plugins_api' ) ) {
4059 require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
4060 }
4061
4062 // set the arguments to get latest info from repository via API ##
4063 $args = array(
4064 'slug' => $slug,
4065 'fields' => array(
4066 'version' => true,
4067 )
4068 );
4069
4070 /** Prepare our query */
4071 $call_api = plugins_api( 'plugin_information', $args );
4072
4073 /** Check for Errors & Display the results */
4074 if ( is_wp_error( $call_api ) ) {
4075 $api_error = $call_api->get_error_message();
4076 } else {
4077
4078 //echo $call_api; // everything ##
4079 if ( ! empty( $call_api->version ) ) {
4080 $version_latest = $call_api->version;
4081 }
4082 }
4083
4084 return $version_latest;
4085 }
4086
4087 /**
4088 * Get AM plugin data to display in the Addons section of About tab.
4089 *
4090 * @since 6.4.0.4
4091 *
4092 * @param string $plugin Plugin slug.
4093 * @param array $details Plugin details.
4094 * @param array $all_plugins List of all plugins.
4095 *
4096 * @return array
4097 */
4098 protected function poll_get_plugin_data( $plugin, $details, $all_plugins ) {
4099
4100 $have_pro = ( ! empty( $details['pro'] ) && ! empty( $details['pro']['plug'] ) );
4101 $show_pro = false;
4102
4103 $plugin_data = array();
4104
4105 if ( $have_pro ) {
4106 if ( array_key_exists( $plugin, $all_plugins ) ) {
4107 if ( is_plugin_active( $plugin ) ) {
4108 $show_pro = true;
4109 }
4110 }
4111 if ( array_key_exists( $details['pro']['plug'], $all_plugins ) ) {
4112 $show_pro = true;
4113 }
4114 if ( $show_pro ) {
4115 $plugin = $details['pro']['plug'];
4116 $details = $details['pro'];
4117 }
4118 }
4119
4120 if ( array_key_exists( $plugin, $all_plugins ) ) {
4121 if ( is_plugin_active( $plugin ) ) {
4122 // Status text/status.
4123 $plugin_data['status_class'] = 'status-active';
4124 $plugin_data['status_text'] = esc_html__( 'Active', 'poll-maker' );
4125 // Button text/status.
4126 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info disabled';
4127 $plugin_data['action_text'] = esc_html__( 'Activated', 'poll-maker' );
4128 $plugin_data['plugin_src'] = esc_attr( $plugin );
4129 } else {
4130 // Status text/status.
4131 $plugin_data['status_class'] = 'status-installed';
4132 $plugin_data['status_text'] = esc_html__( 'Inactive', 'poll-maker' );
4133 // Button text/status.
4134 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info';
4135 $plugin_data['action_text'] = esc_html__( 'Activate', 'poll-maker' );
4136 $plugin_data['plugin_src'] = esc_attr( $plugin );
4137 }
4138 } else {
4139 // Doesn't exist, install.
4140 // Status text/status.
4141 $plugin_data['status_class'] = 'status-missing';
4142
4143 if ( isset( $details['act'] ) && 'go-to-url' === $details['act'] ) {
4144 $plugin_data['status_class'] = 'status-go-to-url';
4145 }
4146 $plugin_data['status_text'] = esc_html__( 'Not Installed', 'poll-maker' );
4147 // Button text/status.
4148 $plugin_data['action_class'] = $plugin_data['status_class'] . ' ays-poll-card__btn-info';
4149 $plugin_data['action_text'] = esc_html__( 'Install Plugin', 'poll-maker' );
4150 $plugin_data['plugin_src'] = esc_url( $details['url'] );
4151 }
4152
4153 $plugin_data['details'] = $details;
4154
4155 return $plugin_data;
4156 }
4157
4158 /**
4159 * Display the Addons section of About tab.
4160 *
4161 * @since 1.3.9
4162 */
4163 public function poll_output_about_addons() {
4164
4165 if ( ! function_exists( 'get_plugins' ) ) {
4166 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4167 }
4168
4169 $all_plugins = get_plugins();
4170 $am_plugins = $this->poll_get_am_plugins();
4171 $can_install_plugins = self::ays_poll_can_install( 'plugin' );
4172 $can_activate_plugins = self::ays_poll_can_activate( 'plugin' );
4173
4174 $content = '';
4175 $content.= '<div class="ays-poll-cards-block">';
4176 foreach ( $am_plugins as $plugin => $details ){
4177
4178 $plugin_data = $this->poll_get_plugin_data( $plugin, $details, $all_plugins );
4179 $plugin_ready_to_activate = $can_activate_plugins
4180 && isset( $plugin_data['status_class'] )
4181 && $plugin_data['status_class'] === 'status-installed';
4182 $plugin_not_activated = ! isset( $plugin_data['status_class'] )
4183 || $plugin_data['status_class'] !== 'status-active';
4184
4185 $plugin_action_class = ( isset( $plugin_data['action_class'] ) && esc_attr( $plugin_data['action_class'] ) != "" ) ? esc_attr( $plugin_data['action_class'] ) : "";
4186
4187 $plugin_action_class_disbaled = "";
4188 if ( strpos($plugin_action_class, 'status-active') !== false ) {
4189 $plugin_action_class_disbaled = "disbaled='true'";
4190 }
4191
4192 $content .= '
4193 <div class="ays-poll-card">
4194 <div class="ays-poll-card__content flexible">
4195 <div class="ays-poll-card__content-img-box">
4196 <img class="ays-poll-card__img" src="'. esc_url( $plugin_data['details']['icon'] ) .'" alt="'. esc_attr( $plugin_data['details']['name'] ) .'">
4197 </div>
4198 <div class="ays-poll-card__text-block">
4199 <h5 class="ays-poll-card__title">'. esc_html( $plugin_data['details']['name'] ) .'</h5>
4200 <p class="ays-poll-card__text">'. wp_kses_post( $plugin_data['details']['desc'] ) .'
4201 <span class="ays-poll-card__text-hidden">
4202 '. wp_kses_post( $plugin_data['details']['desc_hidden'] ) .'
4203 </span>
4204 </p>
4205 </div>
4206 </div>
4207 <div class="ays-poll-card__footer">';
4208 if ( $can_install_plugins || $plugin_ready_to_activate || ! $details['wporg'] ) {
4209 $content .= '<button class="'. esc_attr( $plugin_data['action_class'] ) .'" data-plugin="'. esc_attr( $plugin_data['plugin_src'] ) .'" data-type="plugin" '. $plugin_action_class_disbaled .'>
4210 '. wp_kses_post( $plugin_data['action_text'] ) .'
4211 </button>';
4212 }
4213 elseif ( $plugin_not_activated ) {
4214 $content .= '<a href="'. esc_url( $details['wporg'] ) .'" target="_blank" rel="noopener noreferrer">
4215 '. esc_html_e( 'WordPress.org', $this->plugin_name ) .'
4216 <span aria-hidden="true" class="dashicons dashicons-external"></span>
4217 </a>';
4218 }
4219 $content .='
4220 <a target="_blank" href="'. esc_url( $plugin_data['details']['buy_now'] ) .'" class="ays-poll-card__btn-primary">'. __('Buy Now', 'poll-maker') .'</a>
4221 </div>
4222 </div>';
4223 }
4224 $install_plugin_nonce = wp_create_nonce( $this->plugin_name . '-install-plugin-nonce' );
4225 $content .= '<input type="hidden" id="ays_poll_ajax_install_plugin_nonce" name="ays_poll_ajax_install_plugin_nonce" value="'. $install_plugin_nonce .'">';
4226 $content .= '</div>';
4227
4228 echo $content;
4229 }
4230
4231 public function ays_poll_update_banner_time(){
4232
4233 $date = time() + ( 3 * 24 * 60 * 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
4234 // $date = time() + ( 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); // for testing | 1 min
4235 $next_3_days = date('M d, Y H:i:s', $date);
4236
4237 $ays_poll_banner_time = get_option('ays_poll_banner_time');
4238
4239 if ( !$ays_poll_banner_time || is_null( $ays_poll_banner_time ) ) {
4240 update_option('ays_poll_banner_time', $next_3_days );
4241 }
4242
4243 $get_ays_poll_banner_time = get_option('ays_poll_banner_time');
4244
4245 $val = 60*60*24*0.5; // half day
4246 // $val = 60; // for testing | 1 min
4247
4248 $current_date = current_time( 'mysql' );
4249 $date_diff = strtotime($current_date) - intval(strtotime($get_ays_poll_banner_time));
4250
4251 $days_diff = $date_diff / $val;
4252 if(intval($days_diff) > 0 ){
4253 update_option('ays_poll_banner_time', $next_3_days);
4254 $get_ays_poll_banner_time = get_option('ays_poll_banner_time');
4255 }
4256
4257 return $get_ays_poll_banner_time;
4258 }
4259
4260 public static function ays_poll_check_if_current_image_exists($image_url) {
4261 global $wpdb;
4262
4263 $res = true;
4264 if( !isset($image_url) ){
4265 $res = false;
4266 }
4267
4268 if ( isset($image_url) && !empty( $image_url ) ) {
4269
4270 $re = '/-\d+[Xx]\d+\./';
4271 $subst = '.';
4272
4273 $image_url = preg_replace($re, $subst, $image_url, 1);
4274
4275 $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
4276 if ( is_null( $attachment ) || empty( $attachment ) ) {
4277 $res = false;
4278 }
4279 }
4280
4281 return $res;
4282 }
4283
4284 public function ays_poll_maker_quick_start() {
4285 global $wpdb;
4286 error_reporting(0);
4287
4288 // Run a security check.
4289 check_ajax_referer( 'poll-maker-ajax-quick-poll-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
4290
4291 // Check for permissions.
4292 if ( !Poll_Maker_Data::check_user_capability() ) {
4293 ob_end_clean();
4294 $ob_get_clean = ob_get_clean();
4295 echo json_encode(array(
4296 'status' => false,
4297 'poll_id' => 0
4298 ));
4299 wp_die();
4300 }
4301
4302 $polls_table = esc_sql($wpdb->prefix . "ayspoll_polls");
4303 $answers_table = esc_sql($wpdb->prefix . "ayspoll_answers");
4304
4305 $title = stripslashes( sanitize_text_field($_REQUEST['ays-poll-title']) );
4306 $question = wp_kses_post( $_REQUEST['ays_poll_question'] );
4307
4308 $answers = self::recursive_sanitize_text_field($_REQUEST['ays-poll-answers']);
4309
4310 $allow_multivote = isset($_REQUEST['allow_multivote_switch']) && $_REQUEST['allow_multivote_switch'] == 'on' ? "on" : "off";
4311 $allow_not_vote = isset($_REQUEST['allow-not-vote']) && 'on' == $_REQUEST['allow-not-vote'] ? 1 : 0;
4312 $show_author = isset($_REQUEST['quick-poll-show_poll_author']) && 1 == $_REQUEST['quick-poll-show_poll_author'] ? 1 : 0;
4313 $show_title = isset($_REQUEST['quick-poll-show-title']) && $_REQUEST['quick-poll-show-title'] == 'off' ? 0 : 1;
4314 $show_creation_date = isset($_REQUEST['quick-poll-show-creation-date']) && $_REQUEST['quick-poll-show-creation-date'] == 'on' ? 1 : 0;
4315 $hide_results = isset($_REQUEST['quick-poll-hide-results']) && 1 == $_REQUEST['quick-poll-hide-results'] ? 1 : 0;
4316 $randomize_answers = isset($_REQUEST['quick-poll-randomize-answers']) && $_REQUEST['quick-poll-randomize-answers'] == 'on' ? 'on' : 'off';
4317 $enable_restart_button = isset($_REQUEST['quick-poll-enable-restart-button']) && $_REQUEST['quick-poll-enable-restart-button'] == 'on' ? 1 : 0;
4318 $res_rgba = isset($_REQUEST['quick-poll-res-rgba']) && $_REQUEST['quick-poll-res-rgba'] == 'on' ? 'on' : 'off';
4319
4320 if ($allow_multivote === 'on') {
4321 $multivote_min_count = sanitize_text_field($_REQUEST['quick-poll-multivote-min-count']);
4322 $multivote_max_count = sanitize_text_field($_REQUEST['quick-poll-multivote-max-count']);
4323 } else {
4324 $multivote_min_count = 1;
4325 $multivote_max_count = 1;
4326 }
4327
4328 $create_date = current_time( 'mysql' );
4329
4330 $user_id = get_current_user_id();
4331 $user = get_userdata($user_id);
4332 $author = array(
4333 'id' => $user->ID,
4334 'name' => $user->data->display_name
4335 );
4336 $options = json_encode(
4337 array(
4338 "poll_version" => POLL_MAKER_AYS_VERSION,
4339 "poll_enable_copy_protection" => "off",
4340 "poll_question_text_to_speech" => "off",
4341 "main_color" => "#0C6291",
4342 "text_color" => "#0C6291",
4343 "icon_color" => "#0C6291",
4344 "bg_color" => "#FBFEF9",
4345 "answer_bg_color" => "#FBFEF9",
4346 "answer_hover_color" => "#0C6291",
4347 "answer_border_side" => "all_sides",
4348 "title_bg_color" => "",
4349 "icon_size" => 24,
4350 "width" => 600,
4351 "width_for_mobile" => 0,
4352 "btn_text" => "Vote",
4353 "see_res_btn_text" => "See Results",
4354 "border_style" => "ridge",
4355 "border_radius" => "0",
4356 "border_width" => "1",
4357 "box_shadow_color" => "#000000",
4358 "enable_box_shadow" => "off",
4359 "enable_answer_style" => "on",
4360 "bg_image" => false,
4361 "info_form" => 0,
4362 "fields" => "apm-name,apm-email,apm_phone",
4363 "required_fields" => "apm-name,apm-email,apm_phone",
4364 "info_form_title" => "<h5>Please fill out the form:<\/h5>\n",
4365 "hide_results" => $hide_results,
4366 "hide_result_message" => 0,
4367 "hide_results_text" => "<p>Thanks for your answer!<\/p>\n",
4368 "result_message" => "",
4369 "allow_not_vote" => $allow_not_vote,
4370 "show_social" => 0,
4371 "poll_social_buttons_heading" => "",
4372 "poll_show_social_ln" => "on",
4373 "poll_show_social_fb" => "on",
4374 "poll_show_social_tr" => "on",
4375 "poll_show_social_vk" => "off",
4376 "enable_social_links" => "off",
4377 "poll_social_links_heading" => "",
4378 "social_links" => array(
4379 "linkedin_link" => "",
4380 "facebook_link" => "",
4381 "twitter_link" => "",
4382 "vkontakte_link" => "",
4383 "youtube_link" => "",
4384 "tiktok_link" => ""
4385 ),
4386 "load_effect" => "load_gif",
4387 "load_gif" => "plg_pro1",
4388 "custom_load" => false,
4389 "limit_users" => 0,
4390 "limit_users_method" => "ip",
4391 "limitation_message" => "<p>You have already voted<\/p>\n",
4392 "redirect_url" => false,
4393 "redirection_delay" => 0,
4394 "user_role" => "",
4395 "enable_restriction_pass" => 0,
4396 "restriction_pass_message" => "<p>You don\\'t have permissions for passing the poll<\/p>\n",
4397 "enable_logged_users" => 0,
4398 "enable_logged_users_message" => "<p>You must sign in for passing the poll<\/p>\n",
4399 "notify_email_on" => 0,
4400 "notify_email" => "",
4401 "published" => 1,
4402 "enable_pass_count" => "on",
4403 "result_sort_type" => "none",
4404 "create_date" => $create_date,
4405 "redirect_users" => 0,
4406 "redirect_after_vote_url" => false,
4407 "redirect_after_vote_delay" => 0,
4408 "activeInterval" => "2022-09-17",
4409 "deactiveInterval" => "2022-09-17",
4410 "activeIntervalSec" => "",
4411 "deactiveIntervalSec" => "",
4412 "active_date_message" => "<p>The poll has expired!<\/p>\n",
4413 "active_date_message_soon" => "<p style=\\\"text-align => center;\\\">The poll will be available soon!<\/p>\n",
4414 "vote_reason" => 0,
4415 "show_chart_type" => "google_bar_chart",
4416 "active_date_check" => "",
4417 "enable_restart_button" => $enable_restart_button,
4418 "enable_vote_btn" => 1,
4419 "show_votes_count" => 1,
4420 "attempts_count" => "1",
4421 "poll_main_url" => '',
4422 "show_create_date" => $show_creation_date,
4423 "show_author" => $show_author,
4424 "author" => $author,
4425 "show_res_percent" => 1,
4426 "show_result_btn_schedule" => 0,
4427 "ays_poll_show_timer" => 0,
4428 "show_bottom_timer" => 0,
4429 "ays_show_timer_type" => "countdown",
4430 "show_login_form" => "off",
4431 "poll_allow_answer" => 0,
4432 "poll_allow_answer_require" => 1,
4433 "versus_icon_type" => "default",
4434 "versus_icon_position" => "center",
4435 "versus_answers_label" => 0,
4436 "result_in_rgba" => $res_rgba,
4437 "enable_mailchimp" => "off",
4438 "enable_background_gradient" => "off",
4439 "background_gradient_color_1" => "#103251",
4440 "background_gradient_color_2" => "#607593",
4441 "poll_gradient_direction" => "vertical",
4442 "redirect_after_submit" => 0,
4443 "mailchimp_list" => "",
4444 "poll_direction" => "ltr",
4445 "poll_allow_multivote" => $allow_multivote,
4446 "multivote_answer_min_count" => $multivote_min_count,
4447 "poll_allow_multivote_count" => $multivote_max_count,
4448 "monitor_list" => "",
4449 "enable_monitor" => "off",
4450 "slack_conversation" => "",
4451 "enable_slack" => "off",
4452 "active_camp_list" => "",
4453 "active_camp_automation" => "",
4454 "enable_active_camp" => "off",
4455 "enable_zapier" => "off",
4456 "randomize_answers" => $randomize_answers,
4457 "enable_asnwers_sound" => "off",
4458 "enable_password" => "off",
4459 "password_poll" => "",
4460 "poll_password_message" => "Please enter password",
4461 "poll_enable_password_visibility" => "off",
4462 "background_size" => "cover",
4463 "disable_answer_hover" => 0,
4464 "custom_class" => "",
4465 "enable_poll_title_text_shadow" => "off",
4466 "poll_title_text_shadow" => "rgba(255,255,255,0)",
4467 "poll_title_text_shadow_x_offset" => 2,
4468 "poll_title_text_shadow_y_offset" => 2,
4469 "poll_title_text_shadow_z_offset" => 0,
4470 "poll_bg_image_position" => "center center",
4471 "poll_bg_img_in_finish_page" => "off",
4472 "ays_add_post_for_poll" => "off",
4473 "show_answer_message" => "off",
4474 "show_answers_caption" => "on",
4475 "answers_grid_column_mobile" => "on",
4476 "enable_vote_limitation" => "off",
4477 "vote_limitation" => "",
4478 "limitation_time_period" => "minute",
4479 "enable_tackers_count" => "off",
4480 "tackers_count" => "",
4481 "ays_enable_mail_user" => "off",
4482 "vote_notification_email_msg" => "",
4483 "poll_answer_icon_check" => "off",
4484 "answers_icon" => "radio",
4485 "buttons_size" => "medium",
4486 "buttons_font_size" => "17",
4487 "poll_buttons_mobile_font_size" => "17",
4488 "buttons_left_right_padding" => "20",
4489 "buttons_top_bottom_padding" => "10",
4490 "buttons_border_radius" => "3",
4491 "redirect_after_submit_drpdwn" => 0,
4492 "user_add_answer_dropdown" => 0,
4493 "enable_google_sheets" => "off",
4494 "spreadsheet_id" => "",
4495 "enable_view_more_button" => "off",
4496 "poll_view_more_button_count" => 0,
4497 "poll_min_height" => "",
4498 "answer_sort_type" => "default",
4499 "answer_font_size" => "16",
4500 "poll_answer_font_size_mobile" => "16",
4501 "show_passed_users" => "off",
4502 "logo_image" => "",
4503 "allow_collect_user_info" => "off",
4504 "poll_send_mail_type" => "custom",
4505 "poll_sendgrid_email_from" => "",
4506 "poll_sendgrid_email_name" => "",
4507 "poll_sendgrid_template_id" => "",
4508 "limit_country" => "AD",
4509 "show_votes_before_voting" => "off",
4510 "show_votes_before_voting_by" => "by_count",
4511 "fake_votes" => "off",
4512 "dont_show_poll_cont" => "off",
4513 "see_result_button" => "on",
4514 "see_result_radio" => "ays_see_result_button",
4515 "loader_font_size" => "",
4516 "show_answers_numbering" => "none",
4517 "effect_message" => "",
4518 "enable_mad_mimi" => "off",
4519 "mad_mimi_list" => "",
4520 "poll_show_passed_users_count" => 3,
4521 "question_font_size" => 16,
4522 "question_font_size_mobile" => 16,
4523 "poll_question_image_height" => "",
4524 "poll_mobile_max_width" => "",
4525 "poll_title_font_size" => "18",
4526 "poll_title_font_size_mobile" => "20",
4527 "poll_title_alignment" => "center",
4528 "poll_title_alignment_mobile" => "center",
4529 "poll_enable_answer_image_after_voting" => "off",
4530 "poll_text_type_length_enable" => "off",
4531 "poll_text_type_limit_type" => "characters",
4532 "poll_text_type_limit_length" => "",
4533 "poll_text_type_limit_message" => "off",
4534 "poll_text_type_placeholder" => "Your answer",
4535 "poll_text_type_width" => "",
4536 "poll_text_type_width_type" => "percent",
4537 "poll_answer_padding" => 10,
4538 "poll_answer_margin" => 10,
4539 "answers_border" => "on",
4540 "answers_border_width" => 1,
4541 "answers_border_style" => "solid",
4542 "answers_border_color" => "#444",
4543 "poll_answer_enable_box_shadow" => "off",
4544 "answers_box_shadow_color" => "#000",
4545 "poll_answer_box_shadow_x_offset" => 0,
4546 "poll_answer_box_shadow_y_offset" => 0,"poll_answer_box_shadow_z_offset" => 10,
4547 "poll_answer_image_height" => 150,
4548 "poll_answer_image_height_for_mobile" => "150",
4549 "poll_answer_image_border_radius" => 0,
4550 "ans_img_caption_style" => "outside",
4551 "ans_img_caption_position" => "bottom",
4552 "answers_font_size" => 15,
4553 "poll_answer_object_fit" => "cover",
4554 "answers_grid_column" => 2,
4555 "poll_answer_border_radius" => 0,
4556 "enable_getResponse" => "off",
4557 "getResponse_list" => "",
4558 "enable_mailerLite" => "off",
4559 "mailerLite_group_id" => "",
4560 "enable_convertKit" => "off",
4561 "poll_convertKit_form_id" => "",
4562 "enable_mailpoet" => "off",
4563 "mailpoet_list" => "",
4564 "poll_logo_url" => "",
4565 "poll_enable_logo_url" => "off",
4566 "poll_logo_url_new_tab" => "off",
4567 "poll_send_mail_to_site_admin" => "on",
4568 "poll_email_configuration_from_email" => "",
4569 "poll_email_configuration_from_name" => "",
4570 "poll_email_configuration_from_subject" => "",
4571 "poll_email_configuration_replyto_email" => "",
4572 "poll_email_configuration_replyto_name" => "",
4573 "display_fields_labels" => "off",
4574 "autofill_user_data" => "off",
4575 "poll_create_author" => 1
4576 ));
4577
4578 $wpdb->insert($polls_table, array(
4579 "title" => $title,
4580 "question" => $question,
4581 "type" => "choosing",
4582 "view_type" => "list",
4583 "categories" => ",1,",
4584 "show_title" => $show_title,
4585 "styles" => $options,
4586 "theme_id" => 1,
4587 ));
4588
4589 $poll_id = $wpdb->insert_id;
4590
4591 foreach ($answers as $answer_key => $answer) {
4592 $wpdb->insert($answers_table, array(
4593 "poll_id" => $poll_id,
4594 "answer" => $answer,
4595 "votes" => 0,
4596 "ordering" => (intval($answer_key) + 1),
4597 "user_added" => 0,
4598 "show_user_added" => 1,
4599 ));
4600 }
4601
4602 $post_type_args = array(
4603 'poll_id' => $poll_id,
4604 'author_id' => !empty($user->ID) ? $user->ID : get_current_user_id(),
4605 'poll_title' => $poll_title,
4606 );
4607
4608 $custom_post_id = Poll_Maker_Custom_Post_Type::ays_poll_add_custom_post($post_type_args);
4609
4610 $preview_url = "#";
4611 if(!empty($custom_post_id)){
4612 $custom_post_url = array(
4613 'post_type' => 'ays-poll-maker',
4614 'p' => $custom_post_id,
4615 'preview' => 'true',
4616 );
4617 $custom_post_url_ready = http_build_query($custom_post_url);
4618 $preview_url = get_home_url();
4619 $preview_url .= '/?' . $custom_post_url_ready;
4620 }
4621
4622 echo json_encode(array(
4623 'status' => true,
4624 'poll_id' => $poll_id,
4625 'preview_url' => $preview_url,
4626 ));
4627 wp_die();
4628 }
4629
4630 public function ays_poll_black_friady_popup_box(){
4631
4632 if(!empty($_REQUEST['page']) && sanitize_text_field( $_REQUEST['page'] ) != $this->plugin_name . "-dashboard"){
4633 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
4634
4635 $flag = true;
4636
4637 if( isset($_COOKIE['aysPollBlackFridayPopupCount']) && intval($_COOKIE['aysPollBlackFridayPopupCount']) >= 2 ){
4638 $flag = false;
4639 }
4640
4641 $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);
4642
4643 if( $flag ){
4644 ?>
4645 <div class="ays-poll-black-friday-popup-overlay" style="opacity: 0; visibility: hidden; display: none;">
4646 <div class="ays-poll-black-friday-popup-dialog">
4647 <div class="ays-poll-black-friday-popup-content">
4648 <div class="ays-poll-black-friday-popup-background-pattern">
4649 <div class="ays-poll-black-friday-popup-pattern-row">
4650 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4651 <div class="ays-poll-black-friday-popup-pattern-text">SALE SALE SALE</div>
4652 </div>
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>
4666
4667 <button class="ays-poll-black-friday-popup-close" aria-label="Close">
4668 <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">
4669 <path d="M18 6 6 18"></path>
4670 <path d="m6 6 12 12"></path>
4671 </svg>
4672 </button>
4673
4674 <div class="ays-poll-black-friday-popup-badge">
4675 <div class="ays-poll-black-friday-popup-badge-content">
4676 <div class="ays-poll-black-friday-popup-badge-text-sm"><?php echo esc_html__( 'Up to', 'poll-maker' ); ?></div>
4677 <div class="ays-poll-black-friday-popup-badge-text-lg">50%</div>
4678 <div class="ays-poll-black-friday-popup-badge-text-md"><?php echo esc_html__( 'OFF', 'poll-maker' ); ?></div>
4679 </div>
4680 </div>
4681
4682 <div class="ays-poll-black-friday-popup-main-content">
4683 <div class="ays-poll-black-friday-popup-hashtag"><?php echo esc_html__( '#BLACKFRIDAY', 'poll-maker' ); ?></div>
4684 <h1 class="ays-poll-black-friday-popup-title-mega"><?php echo esc_html__( 'MEGA', 'poll-maker' ); ?></h1>
4685 <h1 class="ays-poll-black-friday-popup-title-bundle"><?php echo esc_html__( 'BUNDLE', 'poll-maker' ); ?></h1>
4686 <div class="ays-poll-black-friday-popup-offer-label">
4687 <h2 class="ays-poll-black-friday-popup-offer-text"><?php echo esc_html__( 'BLACK FRIDAY OFFER', 'poll-maker' ); ?></h2>
4688 </div>
4689 <p class="ays-poll-black-friday-popup-description"><?php echo esc_html__( 'Get our exclusive plugins in one bundle', 'poll-maker' ); ?></p>
4690 <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>
4691 </div>
4692 </div>
4693 </div>
4694 </div>
4695 <script type="text/javascript">
4696 (function() {
4697 var overlay = document.querySelector('.ays-poll-black-friday-popup-overlay');
4698 var closeBtn = document.querySelector('.ays-poll-black-friday-popup-close');
4699 var learnMoreBtn = document.querySelector('.ays-poll-black-friday-popup-learn-more');
4700 var ctaBtn = document.querySelector('.ays-poll-black-friday-popup-cta-btn');
4701
4702 // Cookie helper functions
4703 function setCookie(name, value, days) {
4704 var expires = "";
4705 if (days) {
4706 var date = new Date();
4707 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
4708 expires = "; expires=" + date.toUTCString();
4709 }
4710 document.cookie = name + "=" + (value || "") + expires + "; path=/";
4711 }
4712
4713 function getCookie(name) {
4714 var nameEQ = name + "=";
4715 var ca = document.cookie.split(';');
4716 for (var i = 0; i < ca.length; i++) {
4717 var c = ca[i];
4718 while (c.charAt(0) == ' ') c = c.substring(1, c.length);
4719 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
4720 }
4721 return null;
4722 }
4723
4724 // Get current show count from cookie
4725 var showCount = parseInt(getCookie('aysPollBlackFridayPopupCount') || '0', 10);
4726 var maxShows = 2;
4727
4728 // Show popup function
4729 function showPopup() {
4730 if (overlay && showCount < maxShows) {
4731 overlay.classList.add('ays-poll-black-friday-popup-active');
4732 showCount++;
4733 // Update cookie with new count (expires in 30 days)
4734 setCookie('aysPollBlackFridayPopupCount', showCount.toString(), 30);
4735 }
4736 }
4737
4738 // Close popup function
4739 function closePopup(e) {
4740 if (e) {
4741 e.preventDefault();
4742 e.stopPropagation();
4743 }
4744 if (overlay) {
4745 overlay.classList.remove('ays-poll-black-friday-popup-active');
4746 }
4747 }
4748
4749 // Determine timing based on show count
4750 if (showCount === 0) {
4751 // First time - show after 30 seconds
4752 setTimeout(function() {
4753 showPopup();
4754 }, 30000);
4755 } else if (showCount === 1) {
4756 // Second time - show after 200 seconds
4757 setTimeout(function() {
4758 showPopup();
4759 }, 200000);
4760 }
4761 // If showCount >= 2, don't show popup at all
4762
4763 // Close button
4764 if (closeBtn) {
4765 closeBtn.addEventListener('click', function(e) {
4766 closePopup(e);
4767 });
4768 }
4769
4770 // Learn more button
4771 if (learnMoreBtn) {
4772 learnMoreBtn.addEventListener('click', function(e) {
4773 closePopup(e);
4774 });
4775 }
4776
4777 // CTA button (optional - if you want it to close popup too)
4778 if (ctaBtn) {
4779 ctaBtn.addEventListener('click', function(e) {
4780 // You can add redirect logic here if needed
4781 // window.location.href = 'your-url';
4782 });
4783 }
4784
4785 // Close on overlay click
4786 if (overlay) {
4787 overlay.addEventListener('click', function(e) {
4788 if (e.target === overlay) {
4789 closePopup(e);
4790 }
4791 });
4792 }
4793
4794 // Close on Escape key
4795 document.addEventListener('keydown', function(e) {
4796 if (e.key === 'Escape' && overlay && overlay.classList.contains('ays-poll-black-friday-popup-active')) {
4797 closePopup();
4798 }
4799 });
4800 })();
4801 </script>
4802 <style>
4803 .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}}
4804 </style>
4805 <?php
4806 }
4807 }
4808 }
4809 }
4810
4811 }