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

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

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