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

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

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