PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.4.4
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.4.4
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.4.4, at admin/class-poll-maker-ays-admin.php

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