PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.4.9
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.4.9
6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 All 152 releases
poll-maker / admin / class-poll-maker-ays-admin.php

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

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