PluginProbe
Survey Maker by AYS / 5.2.2.5
Survey Maker by AYS v5.2.2.5
5.2.4.1 5.2.4.0 5.2.3.9 5.2.3.8 5.2.3.7 5.2.3.6 5.2.3.5 5.2.3.4 5.2.3.3 5.2.3.2 5.2.3.1 5.2.3.0 5.2.2.9 5.2.2.8 5.2.2.7 5.2.2.6 5.2.2.5 5.2.2.4 5.2.2.3 5.2.2.2 5.2.2.1 5.2.2.0 5.2.1.9 5.2.1.8 5.2.0.8 All 154 releases
survey-maker / admin / class-survey-maker-admin.php

class-survey-maker-admin.php in Survey Maker by AYS 5.2.2.5, at admin/class-survey-maker-admin.php

5,351 lines 317.6 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 Survey_Maker
10 * @subpackage Survey_Maker/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 Survey_Maker
20 * @subpackage Survey_Maker/admin
21 * @author Survey Maker team <[email protected]>
22 */
23 class Survey_Maker_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 /**
44 * The surveys list table object.
45 *
46 * @since 1.0.0
47 * @access private
48 * @var object $surveys_obj The surveys list table object.
49 */
50 private $surveys_obj;
51
52 /**
53 * The surveys categories list table object.
54 *
55 * @since 1.0.0
56 * @access private
57 * @var object $surveys_categories_obj The surveys categories list table object.
58 */
59 private $surveys_categories_obj;
60
61 /**
62 * The survey questions list table object.
63 *
64 * @since 1.0.0
65 * @access private
66 * @var object $questions_obj The survey questions list table object.
67 */
68 private $questions_obj;
69
70 /**
71 * The survey questions categories list table object.
72 *
73 * @since 1.0.0
74 * @access private
75 * @var object $question_categories_obj The survey questions categories list table object.
76 */
77 private $question_categories_obj;
78
79 /**
80 * The survey submissions list table object.
81 *
82 * @since 1.0.0
83 * @access private
84 * @var object $results_obj The survey submissions list table object.
85 */
86 private $submissions_obj;
87
88 /**
89 * The survey questions categories list table object for each survey.
90 *
91 * @since 1.0.0
92 * @access private
93 * @var object $each_result_obj The survey submissions list table object for each survey.
94 */
95 private $each_submission_obj;
96
97 /**
98 * The settings object of this plugin.
99 *
100 * @since 1.0.0
101 * @access private
102 * @var object $settings_obj The settings object of this plugin.
103 */
104 private $settings_obj;
105
106 /**
107 * The capability of this plugin.
108 *
109 * @since 1.0.0
110 * @access private
111 * @var string $capability The capability for users access to this plugin.
112 */
113 private $capability;
114
115 private $popup_surveys_obj;
116 private $requests_obj;
117
118 /**
119 * Initialize the class and set its properties.
120 *
121 * @since 1.0.0
122 * @param string $plugin_name The name of this plugin.
123 * @param string $version The version of this plugin.
124 */
125 public function __construct( $plugin_name, $version ) {
126
127 $this->plugin_name = $plugin_name;
128 $this->version = $version;
129
130 add_filter('set-screen-option', array(__CLASS__, 'set_screen'), 10, 3);
131 // $per_page_array = array(
132 // 'quizes_per_page',
133 // 'questions_per_page',
134 // 'quiz_categories_per_page',
135 // 'question_categories_per_page',
136 // 'attributes_per_page',
137 // 'quiz_results_per_page',
138 // 'quiz_each_results_per_page',
139 // 'quiz_orders_per_page',
140 // );
141 // foreach($per_page_array as $option_name){
142 // add_filter('set_screen_option_'.$option_name, array(__CLASS__, 'set_screen'), 10, 3);
143 // }
144
145 }
146
147 /**
148 * Register the stylesheets for the admin area.
149 *
150 * @since 1.0.0
151 */
152 public function enqueue_styles( $hook_suffix ) {
153
154 wp_enqueue_style( $this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'css/admin.css', array(), $this->version, 'all');
155
156 if (false !== strpos($hook_suffix, "plugins.php")){
157 wp_enqueue_style( $this->plugin_name . '-sweetalert-css', SURVEY_MAKER_PUBLIC_URL . '/css/survey-maker-sweetalert2.min.css', array(), $this->version, 'all');
158 }
159
160 if (false === strpos($hook_suffix, $this->plugin_name))
161 return;
162
163 // You need styling for the datepicker. For simplicity I've linked to the jQuery UI CSS on a CDN.
164 // wp_register_style( 'jquery-ui', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css' );
165 // wp_enqueue_style( 'jquery-ui' );
166
167 wp_enqueue_style('wp-color-picker');
168 wp_enqueue_style( $this->plugin_name . '-banner.css', plugin_dir_url(__FILE__) . 'css/banner.css', array(), $this->version, 'all');
169 // wp_enqueue_style( $this->plugin_name . '-banner-black-friday.css', plugin_dir_url(__FILE__) . 'css/survey-maker-banner-black-friday-2024.css', array(), $this->version, 'all');
170 // wp_enqueue_style( $this->plugin_name . '-banner-black-friday.css', plugin_dir_url(__FILE__) . 'css/survey-maker-banner.css', array(), $this->version, 'all');
171 // wp_enqueue_style( $this->plugin_name . '-mega-bundle-banner-2025.css', plugin_dir_url(__FILE__) . 'css/survey-maker-mega-bundle-banner-2025.css', array(), $this->version, 'all');
172 // wp_enqueue_style( $this->plugin_name . '-banner-christmas.css', plugin_dir_url(__FILE__) . 'css/survey-maker-banner-christmas-2024.css', array(), $this->version, 'all');
173 wp_enqueue_style( $this->plugin_name . '-animate.css', plugin_dir_url(__FILE__) . 'css/animate.css', array(), $this->version, 'all');
174 wp_enqueue_style( $this->plugin_name . '-animations.css', plugin_dir_url(__FILE__) . 'css/animations.css', array(), $this->version, 'all');
175 // wp_enqueue_style( $this->plugin_name . '-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css', array(), $this->version, 'all');
176
177 wp_enqueue_style($this->plugin_name . '-font-awesome', SURVEY_MAKER_PUBLIC_URL . '/css/survey-maker-font-awesome.min.css', array(), $this->version, 'all');
178 wp_enqueue_style( $this->plugin_name . '-font-awesome-icons', plugin_dir_url(__FILE__) . 'css/ays-font-awesome.css', array(), $this->version, 'all');
179 wp_enqueue_style( $this->plugin_name . '-select2', SURVEY_MAKER_PUBLIC_URL . '/css/survey-maker-select2.min.css', array(), $this->version, 'all');
180 wp_enqueue_style( $this->plugin_name . '-transition', SURVEY_MAKER_PUBLIC_URL . '/css/transition.min.css', array(), $this->version, 'all');
181 wp_enqueue_style( $this->plugin_name . '-dropdown', SURVEY_MAKER_PUBLIC_URL . '/css/dropdown.min.css', array(), $this->version, 'all');
182 wp_enqueue_style( $this->plugin_name . '-popup', plugin_dir_url(__FILE__) . 'css/popup.min.css', array(), $this->version, 'all');
183 wp_enqueue_style( $this->plugin_name . '-bootstrap', plugin_dir_url(__FILE__) . 'css/bootstrap.min.css', array(), $this->version, 'all');
184 wp_enqueue_style( $this->plugin_name . '-data-bootstrap', plugin_dir_url(__FILE__) . 'css/dataTables.bootstrap4.min.css', array(), $this->version, 'all');
185 wp_enqueue_style( $this->plugin_name . '-datetimepicker', plugin_dir_url(__FILE__) . 'css/jquery-ui-timepicker-addon.css', array(), $this->version, 'all');
186
187 wp_enqueue_style( $this->plugin_name . "-general", plugin_dir_url( __FILE__ ) . 'css/survey-maker-general.css', array(), time(), 'all' );
188 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/survey-maker-admin.css', array(), time(), 'all' );
189 wp_enqueue_style( $this->plugin_name . "-admin-dashboard", plugin_dir_url( __FILE__ ) . 'css/survey-maker-admin-dashboard.css', array(), time(), 'all' );
190 wp_enqueue_style( $this->plugin_name . "-pro-features", plugin_dir_url( __FILE__ ) . 'css/survey-maker-pro-features.css', array(), time(), 'all' );
191 wp_enqueue_style( $this->plugin_name . "-loaders", plugin_dir_url(__FILE__) . 'css/loaders.css', array(), $this->version, 'all');
192 if( isset( $_GET['page'] ) && sanitize_key($_GET['page']) == $this->plugin_name . '-admin-dashboard' ){
193 wp_enqueue_style( $this->plugin_name . "-dashboard", plugin_dir_url( __FILE__ ) . 'css/survey-maker-dashboard.css', array(), $this->version, 'all' );
194 }
195
196 }
197
198 /**
199 * Register the JavaScript for the admin area.
200 *
201 * @since 1.0.0
202 */
203 public function enqueue_scripts( $hook_suffix ) {
204 global $wp_version;
205
206 $version1 = $wp_version;
207 $operator = '>=';
208 $version2 = '5.5';
209 $versionCompare = $this->aysSurveyMakerVersionCompare($version1, $operator, $version2);
210
211 // $check_terms_agreement = get_option('survey_maker_agree_terms');
212
213 // if($check_terms_agreement === 'true' && strpos($hook_suffix, $this->plugin_name) !== false){
214 // wp_enqueue_script( $this->plugin_name.'-hotjar', plugin_dir_url(__FILE__) . 'js/extras/survey-maker-hotjar.js', array(), $this->version, false);
215 // }
216
217 if ($versionCompare) {
218 wp_enqueue_script( $this->plugin_name.'-wp-load-scripts', plugin_dir_url(__FILE__) . 'js/survey-maker-wp-load-scripts.js', array(), $this->version, true);
219 }
220
221 if (false !== strpos($hook_suffix, "plugins.php")){
222 wp_enqueue_script( $this->plugin_name . '-sweetalert-js', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-sweetalert2.all.min.js', array('jquery'), $this->version, true );
223 wp_enqueue_script( $this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'js/admin.js', array( 'jquery' ), $this->version, true );
224 wp_localize_script( $this->plugin_name . '-admin', 'SurveyMakerAdmin', array(
225 'ajaxUrl' => admin_url( 'admin-ajax.php' )
226 ) );
227 }
228
229 if (false === strpos($hook_suffix, $this->plugin_name))
230 return;
231
232 $survey_banner_date = self::ays_survey_update_banner_time();
233 wp_enqueue_script( 'jquery' );
234 wp_enqueue_script( 'jquery-effects-core' );
235 wp_enqueue_script( 'jquery-ui-sortable' );
236 wp_enqueue_script( 'jquery-ui-datepicker' );
237 wp_enqueue_media();
238 wp_enqueue_script( $this->plugin_name . '-color-picker-alpha', plugin_dir_url(__FILE__) . 'js/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), $this->version, true );
239 $color_picker_strings = array(
240 'clear' => __( 'Clear', "survey-maker" ),
241 'clearAriaLabel' => __( 'Clear color', "survey-maker" ),
242 'defaultString' => __( 'Default', "survey-maker" ),
243 'defaultAriaLabel' => __( 'Select default color', "survey-maker" ),
244 'pick' => __( 'Select Color', "survey-maker" ),
245 'defaultLabel' => __( 'Color value', "survey-maker" ),
246 );
247 wp_localize_script( $this->plugin_name . '-color-picker-alpha', 'wpColorPickerL10n', $color_picker_strings );
248
249
250 /*
251 ==========================================
252 * Bootstrap
253 * select2
254 * jQuery DataTables
255 ==========================================
256 */
257 wp_enqueue_script( $this->plugin_name . "-popper", plugin_dir_url(__FILE__) . 'js/popper.min.js', array( 'jquery' ), $this->version, true );
258 wp_enqueue_script( $this->plugin_name . "-bootstrap", plugin_dir_url(__FILE__) . 'js/bootstrap.min.js', array( 'jquery' ), $this->version, true );
259 wp_enqueue_script( $this->plugin_name . '-select2js', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-select2.min.js', array('jquery'), $this->version, true);
260 wp_enqueue_script( $this->plugin_name . '-sweetalert-js', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-sweetalert2.all.min.js', array('jquery'), $this->version, true );
261 wp_enqueue_script( $this->plugin_name . '-datatable-min', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-datatable.min.js', array('jquery'), $this->version, true);
262 wp_enqueue_script( $this->plugin_name . '-transition-min', SURVEY_MAKER_PUBLIC_URL . '/js/transition.min.js', array('jquery'), $this->version, true);
263 wp_enqueue_script( $this->plugin_name . '-dropdown-min', SURVEY_MAKER_PUBLIC_URL . '/js/dropdown.min.js', array('jquery'), $this->version, true);
264 wp_enqueue_script( $this->plugin_name . "-db4.min.js", plugin_dir_url( __FILE__ ) . 'js/dataTables.bootstrap4.min.js', array( 'jquery' ), $this->version, true );
265 wp_enqueue_script( $this->plugin_name . "-datetimepicker", plugin_dir_url( __FILE__ ) . 'js/jquery-ui-timepicker-addon.js', array( 'jquery' ), $this->version, true );
266 wp_enqueue_script( $this->plugin_name . '-autosize', SURVEY_MAKER_PUBLIC_URL . '/js/survey-maker-autosize.js', array( 'jquery' ), $this->version, false );
267
268 /*
269 ================================================
270 Survey admin dashboard scripts (Google charts)
271 ================================================
272 */
273 if ( strpos($hook_suffix, 'each-submission') !== false ) {
274 wp_enqueue_script( $this->plugin_name . '-charts-google', plugin_dir_url(__FILE__) . 'js/google-chart.js', array('jquery'), $this->version, true);
275 wp_enqueue_script( $this->plugin_name . '-charts', plugin_dir_url(__FILE__) . 'js/partials/survey-maker-admin-submissions-charts.js', array('jquery'), $this->version, true);
276 }
277
278 /*
279 ================================================
280 Quiz admin dashboard scripts (and for AJAX)
281 ================================================
282 */
283 wp_enqueue_script( $this->plugin_name . "-survey-styles", plugin_dir_url(__FILE__) . 'js/partials/survey-maker-admin-survey-styles.js', array('jquery', 'wp-color-picker'), $this->version, true);
284 wp_enqueue_script( $this->plugin_name . "-functions", plugin_dir_url(__FILE__) . 'js/functions.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
285 wp_enqueue_script( $this->plugin_name . '-ajax', plugin_dir_url(__FILE__) . 'js/survey-maker-admin-ajax.js', array('jquery'), $this->version, true);
286 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/survey-maker-admin.js', array( 'jquery' ), $this->version, true );
287 wp_localize_script( $this->plugin_name, 'SurveyMakerAdmin', array(
288 'surveyBannerDate' => $survey_banner_date,
289 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
290 'nonce' => wp_create_nonce( 'ajax-nonce' ),
291 'inputAnswerText' => __( 'Your answer', "survey-maker" ),
292 // 'shortAnswerText' => __( 'Short answer text', "survey-maker" ),
293 // 'numberAnswerText' => __( 'Number answer text', "survey-maker" ),
294 'emailField' => __( 'Your email', "survey-maker" ),
295 'nameField' => __( 'Your name', "survey-maker" ),
296 'selectUserRoles' => __( 'Select user roles', "survey-maker" ),
297 'phoneAnswerText' => __( 'Phone', "survey-maker" ),
298 'addQuestion' => __( 'Add question', "survey-maker" ),
299 'addSection' => __( 'Add section', "survey-maker" ),
300 'duplicate' => __( 'Duplicate', "survey-maker" ),
301 'delete' => __( 'Delete', "survey-maker" ),
302 'addImage' => __( 'Add Image', "survey-maker" ),
303 'editImage' => __( 'Edit Image', "survey-maker" ),
304 'removeImage' => __( 'Remove Image', "survey-maker" ),
305 'collapseSectionQuestions' => __( 'Collapse section questions', "survey-maker" ),
306 'expandSectionQuestions' => __( 'Expand section questions', "survey-maker" ),
307 'selectQuestionDefaultType' => __( 'Select question default type', "survey-maker" ),
308 'chooseAnswer' => __( 'Choose answer', "survey-maker" ),
309 'yes' => __( 'Yes', "survey-maker" ),
310 'cancel' => __( 'Cancel', "survey-maker" ),
311 'questionDeleteConfirmation' => __( 'Are you sure you want to delete this question?', "survey-maker" ),
312 'sectionDeleteConfirmation' => __( 'Are you sure you want to delete this section?', "survey-maker" ),
313 'loadResource' => __( "Can't load resource.", "survey-maker" ),
314 'somethingWentWrong' => __( "Maybe something went wrong.", "survey-maker" ),
315 'dataDeleted' => __( "Maybe the data has been deleted.", "survey-maker" ),
316 'minimumCountOfQuestions' => __( 'Sorry minimum count of questions should be 1', "survey-maker" ),
317 'enableMaxSelectionCount' => __( 'Enable selection count', "survey-maker" ),
318 'enableSelectionCount' => __( 'Enable selection count', "survey-maker" ),
319 'disableSelectionCount' => __( 'Disable selection count', "survey-maker" ),
320 'enableMaxSelectionCount' => __( 'Enable selection count', "survey-maker" ),
321 'disableMaxSelectionCount' => __( 'Disable max selection count', "survey-maker" ),
322 'enableWordLimitation' => __( 'Enable word limitation', "survey-maker" ),
323 'disableWordLimitation' => __( 'Disable word limitation', "survey-maker" ),
324 'enableNumberLimitation' => __( 'Enable limitation', "survey-maker" ),
325 'disableNumberLimitation' => __( 'Disable limitation', "survey-maker" ),
326 'successfullySent' => __( 'Successfully sent', "survey-maker" ),
327 'failed' => __( 'Failed', "survey-maker" ),
328 'selectPage' => __( 'Select page', "survey-maker" ),
329 'selectPostType' => __( 'Select post type', "survey-maker" ),
330 'copied' => __( 'Copied!', "survey-maker"),
331 'clickForCopy' => __( 'Click for copy', "survey-maker"),
332 'moveToSection' => __( 'Move to section', "survey-maker"),
333 'confirmMessageTemplate' => __( 'If you choose one of these templates, your questions will be deleted.', "survey-maker"),
334 'okSurvey' => __( 'OK', "survey-maker"),
335 'icons' => array(
336 'radioButtonUnchecked' => SURVEY_MAKER_ADMIN_URL . '/images/icons/radio-button-unchecked.svg',
337 'checkboxUnchecked' => SURVEY_MAKER_ADMIN_URL . '/images/icons/checkbox-unchecked.svg',
338 ),
339 'nextSurveyPage' => __( 'Are you sure you want to go to the next survey page?', "survey-maker"),
340 'prevSurveyPage' => __( 'Are you sure you want to go to the previous question page?', "survey-maker"),
341 'addQuestionImageCaption' => __( 'Add a caption', "survey-maker"),
342 'closeQuestionImageCaption' => __( 'Close caption', "survey-maker"),
343 'deleteElementFromListTable' => __( 'Are you sure you want to delete?', "survey-maker"),
344 'maxInputVarsWarningMessage' => __( 'Note: The survey has reached the limit of %t inputs out of a maximum of %f. To save changes, please contact your hosting provider to increase the max_input_vars limit.', "survey-maker"),
345 'rating' => __( 'Rating', "survey-maker"),
346 'stars_count' => __( 'Stars count', "survey-maker"),
347 "preivewSurvey" => __( "Preview Survey", 'survey-maker' ),
348 'activate' => __( 'Activate', "survey-maker" ),
349 'activated' => __( 'Activated', "survey-maker" ),
350 'successCopyCoupon' => __( "Coupon code copied!", 'survey-maker' ),
351 'failedCopyCoupon' => __( "Failed to copy coupon code", 'survey-maker' ),
352
353 'generalTabDoc' => esc_html__( "How to configure questions", 'survey-maker' ),
354 'stylesTabDoc' => esc_html__( "How to customize styles", 'survey-maker' ),
355 'settingsTabDoc' => esc_html__( "How to configure survey settings", 'survey-maker' ),
356 'resultsSettingsTabDoc' => esc_html__( "How to customize survey results", 'survey-maker' ),
357 'limitationUsersTabDoc' => esc_html__( "How to set up user limitations", 'survey-maker' ),
358 'userDataTabDoc' => esc_html__( "How to set up the start page", 'survey-maker' ),
359 'emailTabDoc' => esc_html__( "How to configure survey emails", 'survey-maker' ),
360 'integrationTabDoc' => esc_html__( "How to set up integrations", 'survey-maker' ),
361 'conditionsTabDoc' => esc_html__( "How to use conditional results", 'survey-maker' ),
362 ) );
363 wp_localize_script($this->plugin_name . '-ajax', 'survey_maker_ajax', array(
364 'ajax_url' => admin_url('admin-ajax.php'),
365 "emptyEmailError" => __( 'Email field is empty', "survey-maker"),
366 'selectUser' => __( 'Select user', 'survey-maker'),
367 'searching' => __( "Searching...", 'survey-maker' ),
368 'pleaseEnterMore' => __( "Please enter 1 or more characters", 'survey-maker' ),
369 "invalidEmailError" => __( 'Invalid Email address', "survey-maker"),
370 "emptyWebsiteError" => __( 'Website field is empty', "survey-maker"),
371 "invalidWebsiteError" => __( 'Invalid website address', "survey-maker"),
372 "thankYouMessage" => __( 'Your request was successfully submitted. We will get in touch with you until November 10. Thank you!', "survey-maker"),
373 ));
374
375 }
376
377 public function ays_survey_add_body_class( $classes ) {
378 global $pagenow;
379
380 if ( $pagenow === 'admin.php' ) {
381 $page = isset( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
382
383 if ( strpos( $page, $this->plugin_name ) === 0 ) {
384 $classes .= ' ays-survey-plugin-admin';
385 }
386 }
387
388 return $classes;
389 }
390
391 /**
392 * De-register JavaScript files for the admin area.
393 *
394 * @since 1.0.0
395 */
396 public function disable_scripts($hook_suffix) {
397 if (false !== strpos($hook_suffix, $this->plugin_name)) {
398 if (is_plugin_active('ai-engine/ai-engine.php')) {
399 wp_deregister_script('mwai');
400 wp_deregister_script('mwai-vendor');
401 wp_dequeue_script('mwai');
402 wp_dequeue_script('mwai-vendor');
403 }
404 if (is_plugin_active('html5-video-player/html5-video-player.php')) {
405 wp_dequeue_style('h5vp-admin');
406 wp_dequeue_style('fs_common');
407 }
408 if (is_plugin_active('wp-social/wp-social.php')) {
409 wp_dequeue_style('wp_social_select2_css');
410 wp_deregister_script('wp_social_select2_js');
411 wp_dequeue_script('wp_social_select2_js');
412 }
413 if (is_plugin_active('real-media-library-lite/index.php')) {
414 wp_dequeue_style('real-media-library-lite-rml');
415 }
416
417 if (is_plugin_active('happyforms/happyforms.php')) {
418 wp_dequeue_style('happyforms-admin');
419 }
420
421 if (is_plugin_active('ultimate-viral-quiz/index.php')) {
422 wp_dequeue_style('select2');
423 wp_dequeue_style('dataTables');
424
425 wp_dequeue_script('sweetalert');
426 wp_dequeue_script('select2');
427 wp_dequeue_script('dataTables');
428 }
429
430 if (is_plugin_active('forms-by-made-it/madeit-form.php')) {
431 wp_dequeue_style('madeit-form-admin-style');
432 }
433
434 if (is_plugin_active('search-replace-for-block-editor/search-replace-for-block-editor.php')) {
435 wp_deregister_script('search-replace-for-block-editor');
436 wp_dequeue_script('search-replace-for-block-editor');
437 }
438
439
440 // Theme | Phlox 2.17.6
441 wp_dequeue_style('auxin-admin-style');
442
443 // Theme | Pixel Ebook Store
444 wp_dequeue_style('pixel-ebook-store-free-demo-content-style');
445
446 // Theme | Interactive Education
447 wp_dequeue_style('interactive-education-free-demo-content-style');
448
449
450
451 }
452 }
453
454 public function codemirror_enqueue_scripts($hook) {
455 if(strpos($hook, $this->plugin_name) !== false){
456 if(function_exists('wp_enqueue_code_editor')){
457 $cm_settings['codeEditor'] = wp_enqueue_code_editor(array(
458 'type' => 'text/css',
459 'codemirror' => array(
460 'inputStyle' => 'contenteditable',
461 'theme' => 'cobalt',
462 )
463 ));
464
465 wp_enqueue_script('wp-theme-plugin-editor');
466 wp_localize_script('wp-theme-plugin-editor', 'cm_settings', $cm_settings);
467
468 wp_enqueue_style('wp-codemirror');
469 }
470 }
471 }
472
473 public function aysSurveyMakerVersionCompare($version1, $operator, $version2) {
474
475 $_fv = intval ( trim ( str_replace ( '.', '', $version1 ) ) );
476 $_sv = intval ( trim ( str_replace ( '.', '', $version2 ) ) );
477
478 if (strlen ( $_fv ) > strlen ( $_sv )) {
479 $_sv = str_pad ( $_sv, strlen ( $_fv ), 0 );
480 }
481
482 if (strlen ( $_fv ) < strlen ( $_sv )) {
483 $_fv = str_pad ( $_fv, strlen ( $_sv ), 0 );
484 }
485
486 return version_compare ( ( string ) $_fv, ( string ) $_sv, $operator );
487 }
488
489 /**
490 * Register the administration menu for this plugin into the WordPress Dashboard menu.
491 *
492 * @since 1.0.0
493 */
494 public function add_plugin_admin_menu(){
495
496 /*
497 * Add a settings page for this plugin to the Settings menu.
498 *
499 * NOTE: Alternative menu locations are available via WordPress administration menu functions.
500 *
501 * Administration Menus: http://codex.wordpress.org/Administration_Menus
502 *
503 */
504
505 $setting_actions = new Survey_Maker_Settings_Actions($this->plugin_name);
506 $options = ($setting_actions->ays_get_setting('options') === false) ? array() : json_decode( stripcslashes( $setting_actions->ays_get_setting('options') ), true);
507
508 // Disable Survey Maker menu item notification
509 $options['survey_disable_survey_menu_notification'] = isset($options['survey_disable_survey_menu_notification']) ? esc_attr( $options['survey_disable_survey_menu_notification'] ) : 'off';
510 $survey_disable_survey_menu_notification = (isset($options['survey_disable_survey_menu_notification']) && esc_attr( $options['survey_disable_survey_menu_notification'] ) == "on") ? true : false;
511
512 if( $survey_disable_survey_menu_notification ){
513 $menu_item = 'Survey Maker';
514 } else {
515 global $wpdb;
516 // $sql = "SELECT COUNT(*) FROM " . esc_sql( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "submissions WHERE `read` = 0 OR `read` = 2 ";
517 $sql = $wpdb->prepare("
518 SELECT COUNT(*)
519 FROM " . esc_sql($wpdb->prefix . SURVEY_MAKER_DB_PREFIX) . "submissions AS s
520 INNER JOIN " . esc_sql($wpdb->prefix . SURVEY_MAKER_DB_PREFIX) . "surveys AS surv
521 ON s.survey_id = surv.id
522 WHERE (s.read = 0 OR s.read = 2)
523 AND surv.status != %s
524 ", 'trashed');
525 $unread_results_count = intval( $wpdb->get_var( $sql ) );
526 $menu_item = ($unread_results_count == 0) ? 'Survey Maker' : 'Survey Maker' . '<span class="ays-survey-menu-badge ays-survey-results-bage">' . $unread_results_count . '</span>';
527 }
528
529 $this->capability = $this->survey_maker_capabilities();
530 $capability = $this->capability;
531
532 $hook_survey_maker =add_menu_page(
533 'Survey Maker',
534 $menu_item,
535 $this->capability,
536 $this->plugin_name,
537 array($this, 'display_plugin_surveys_page'),
538 SURVEY_MAKER_ADMIN_URL . '/images/icons/survey-make-menu-logo.svg',
539 '6.21'
540 );
541 add_action( "load-$hook_survey_maker", array( $this, 'add_tabs' ));
542 }
543
544 public function add_plugin_surveys_submenu(){
545 $hook_survey_maker = add_submenu_page(
546 $this->plugin_name,
547 __('Surveys', "survey-maker"),
548 __('Surveys', "survey-maker"),
549 $this->capability,
550 $this->plugin_name,
551 array($this, 'display_plugin_surveys_page')
552 );
553
554 add_action("load-$hook_survey_maker", array($this, 'screen_option_surveys'));
555 add_action("load-$hook_survey_maker", array($this, 'add_tabs'));
556 }
557
558 public function add_plugin_export_import_submenu(){
559 $hook_exp_imp = add_submenu_page(
560 $this->plugin_name,
561 __('Export / Import', "survey-maker"),
562 __('Export / Import', "survey-maker"),
563 $this->capability,
564 $this->plugin_name . '-export-import',
565 array($this, 'display_plugin_export_import_page')
566 );
567
568 // add_action("load-$hook_exp_imp", array($this, 'screen_option_questions'));
569 add_action("load-$hook_exp_imp", array($this, 'add_tabs'));
570 }
571
572 public function add_plugin_survey_categories_submenu(){
573 $hook_survey_categories = add_submenu_page(
574 $this->plugin_name,
575 __('Survey Categories', "survey-maker"),
576 __('Survey Categories', "survey-maker"),
577 $this->capability,
578 $this->plugin_name . '-survey-categories',
579 array($this, 'display_plugin_survey_categories_page')
580 );
581
582 add_action("load-$hook_survey_categories", array($this, 'screen_option_survey_categories'));
583 add_action("load-$hook_survey_categories", array($this, 'add_tabs'));
584 }
585
586 public function add_plugin_submissions_submenu(){
587 global $wpdb;
588
589 $setting_actions = new Survey_Maker_Settings_Actions($this->plugin_name);
590 $options = ($setting_actions->ays_get_setting('options') === false) ? array() : json_decode( stripcslashes( $setting_actions->ays_get_setting('options') ), true);
591
592 // Disable Submissions menu item notification
593 $options['survey_disable_submission_menu_notification'] = isset($options['survey_disable_submission_menu_notification']) ? esc_attr( $options['survey_disable_submission_menu_notification'] ) : 'off';
594 $survey_disable_submission_menu_notification = (isset($options['survey_disable_submission_menu_notification']) && esc_attr( $options['survey_disable_submission_menu_notification'] ) == "on") ? true : false;
595
596 if( $survey_disable_submission_menu_notification ){
597 $results_text = __('Submissions', "survey-maker");
598 $menu_item = __('Submissions', "survey-maker");
599 } else {
600 // $sql = "SELECT COUNT(*) FROM " . esc_sql( $wpdb->prefix . SURVEY_MAKER_DB_PREFIX ) . "submissions WHERE `read` = 0 OR `read` = 2 ";
601 $sql = $wpdb->prepare("
602 SELECT COUNT(*)
603 FROM " . esc_sql($wpdb->prefix . SURVEY_MAKER_DB_PREFIX) . "submissions AS subs
604 INNER JOIN " . esc_sql($wpdb->prefix . SURVEY_MAKER_DB_PREFIX) . "surveys AS survs
605 ON subs.survey_id = survs.id
606 WHERE (subs.read = 0 OR subs.read = 2)
607 AND survs.status != %s
608 ", 'trashed');
609 $unread_results_count = intval( $wpdb->get_var( $sql ) );
610
611 $results_text = __('Submissions', "survey-maker");
612 $menu_item = ( $unread_results_count == 0 ) ? $results_text : $results_text . '<span class="ays-survey-menu-badge ays-survey-results-bage">' . $unread_results_count . '</span>';
613 }
614
615
616 $hook_submissions = add_submenu_page(
617 $this->plugin_name,
618 $results_text,
619 $menu_item,
620 $this->capability,
621 $this->plugin_name . '-submissions',
622 array($this, 'display_plugin_submissions_page')
623 );
624
625 add_action("load-$hook_submissions", array($this, 'screen_option_submissions'));
626 add_action("load-$hook_submissions", array($this, 'add_tabs'));
627
628 $hook_each_submission = add_submenu_page(
629 'each_submission_slug',
630 __('Each', "survey-maker"),
631 null,
632 $this->capability,
633 $this->plugin_name . '-each-submission',
634 array($this, 'display_plugin_each_submission_page')
635 );
636
637 add_action("load-$hook_each_submission", array($this, 'screen_option_each_survey_submission'));
638 add_action("load-$hook_each_submission", array($this, 'add_tabs'));
639
640 add_filter('parent_file', array($this,'survey_maker_select_submenu'));
641 }
642
643 public function add_plugin_dashboard_submenu(){
644 $hook_quizes = add_submenu_page(
645 $this->plugin_name,
646 __('How to use', "survey-maker"),
647 __('How to use', "survey-maker"),
648 $this->capability,
649 $this->plugin_name . '-dashboard',
650 array($this, 'display_plugin_setup_page')
651 );
652 add_action("load-$hook_quizes", array($this, 'add_tabs'));
653 }
654
655 public function add_plugin_general_settings_submenu(){
656 $hook_settings = add_submenu_page( $this->plugin_name,
657 __('General Settings', "survey-maker"),
658 __('General Settings', "survey-maker"),
659 'manage_options',
660 $this->plugin_name . '-settings',
661 array($this, 'display_plugin_settings_page')
662 );
663 add_action("load-$hook_settings", array($this, 'screen_option_settings'));
664 add_action("load-$hook_settings", array($this, 'add_tabs'));
665 }
666
667 public function add_plugin_featured_plugins_submenu(){
668 $hook_featured_plugins = add_submenu_page( $this->plugin_name,
669 __('Our products', "survey-maker"),
670 __('Our products', "survey-maker"),
671 $this->capability,
672 $this->plugin_name . '-our-products',
673 array($this, 'display_plugin_featured_plugins_page')
674 );
675 add_action("load-$hook_featured_plugins", array($this, 'add_tabs'));
676 }
677
678 public function add_plugin_survey_features_plugins_submenu(){
679 $hook_pro_features = add_submenu_page( $this->plugin_name,
680 __('PRO Features', "survey-maker"),
681 __('PRO Features', "survey-maker"),
682 $this->capability,
683 $this->plugin_name . '-survey-features',
684 array($this, 'display_plugin_features_page')
685 );
686 add_action("load-$hook_pro_features", array($this, 'add_tabs'));
687 }
688
689 public function add_plugin_subscribe_email(){
690 $hook_grab_your_gift = add_submenu_page(
691 $this->plugin_name,
692 __('Grab your GIFT', "survey-maker"),
693 __('Grab your GIFT', "survey-maker"),
694 'manage_options',
695 $this->plugin_name . '-survey-subscribe-email',
696 array($this, 'display_plugin_subscribe_email')
697 );
698
699 add_action("load-$hook_grab_your_gift", array( $this, 'add_tabs' ));
700 }
701
702 public function add_plugin_popup_surveys_submenu(){
703 $hook_popup_surveys = add_submenu_page(
704 $this->plugin_name,
705 __('Popup Survey', "survey-maker"),
706 __('Popup Survey', "survey-maker"),
707 $this->capability,
708 $this->plugin_name . '-popup-surveys',
709 array($this, 'display_plugin_popup_surveys_page')
710 );
711
712 add_action("load-$hook_popup_surveys", array($this, 'screen_option_popup_surveys'));
713 add_action("load-$hook_popup_surveys", array($this, 'add_tabs'));
714 }
715
716 public function add_plugin_admin_dashboard_menu(){
717
718 if (!doing_action('admin_menu')) {
719 return;
720 }
721
722 $menuHook = add_submenu_page(
723 $this->plugin_name,
724 __('Dashboard', 'survey-maker'),
725 __('Dashboard', 'survey-maker'),
726 'manage_options',
727 $this->plugin_name . '-admin-dashboard',
728 array($this, 'display_plugin_admin_dashboard_page'),
729 40
730 );
731
732 if (!$menuHook) {
733 return;
734 }
735
736 add_action("load-$menuHook", array($this, 'add_tabs'));
737 }
738
739 public function add_plugin_survey_front_requests_submenu(){
740 $hook_requests = add_submenu_page(
741 $this->plugin_name,
742 __('Frontend Requests', "survey-maker"),
743 __('Frontend Requests', "survey-maker"),
744 $this->capability,
745 $this->plugin_name . '-requests',
746 array($this, 'display_plugin_requests_page')
747 );
748 $this->requests_obj = new Survey_Requests_List_Table($this->plugin_name);
749
750 add_action("load-$hook_requests", array($this, 'add_tabs'));
751 }
752
753 public function survey_maker_select_submenu($file) {
754 global $plugin_page;
755 if ($this->plugin_name."-each-submission" == $plugin_page) {
756 $plugin_page = $this->plugin_name."-submissions";
757 }
758 return $file;
759 }
760
761 protected function survey_maker_capabilities(){
762 global $wpdb;
763 return 'manage_options';
764
765 // $sql = "SELECT meta_value FROM {$wpdb->prefix}aysquiz_settings WHERE `meta_key` = 'user_roles'";
766 // $result = $wpdb->get_var($sql);
767
768 // $capability = 'manage_options';
769 // if($result !== null){
770 // $ays_user_roles = json_decode($result, true);
771 // if(is_user_logged_in()){
772 // $current_user = wp_get_current_user();
773 // $current_user_roles = $current_user->roles;
774 // $ishmar = 0;
775 // foreach($current_user_roles as $r){
776 // if(in_array($r, $ays_user_roles)){
777 // $ishmar++;
778 // }
779 // }
780 // if($ishmar > 0){
781 // $capability = "read";
782 // }
783 // }
784 // }
785 // return $capability;
786 }
787
788
789 /**
790 * Add settings action link to the plugins page.
791 *
792 * @since 1.0.0
793 */
794 public function add_action_links($links){
795 /*
796 * Documentation : https://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name)
797 */
798
799 $survey_ajax_deactivate_plugin_nonce = wp_create_nonce( 'survey-maker-ajax-deactivate-plugin-nonce' );
800
801 $settings_link = array(
802 '<a href="' . admin_url('admin.php?page=' . $this->plugin_name) . '">' . __('Settings', "survey-maker") . '</a>',
803 '<a href="https://ays-demo.com/wordpress-survey-plugin-free-demo/" target="_blank">' . __('Demo', "survey-maker") . '</a>',
804 '<a href="https://ays-pro.com/wordpress/survey-maker?utm_source=survey-maker-free&utm_medium=dashboard&utm_campaign=buy-now-plugins" target="_blank" class="ays-survey-admin-upgrade-button">' . __('Upgrade', "survey-maker") . '</a>
805 <input type="hidden" id="ays_survey_ajax_deactivate_plugin_nonce" name="ays_survey_ajax_deactivate_plugin_nonce" value="' . $survey_ajax_deactivate_plugin_nonce .'">',
806 );
807 return array_merge($settings_link, $links);
808
809 }
810
811
812 public function add_survey_row_meta( $links, $file ) {
813 if ( SURVEY_MAKER_BASENAME == $file ) {
814 $row_meta = array(
815 'ays-survey-support' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/survey-maker/' ) . '" target="_blank">' . esc_html__( 'Free Support', "survey-maker" ) . '</a>',
816 'ays-survey-documentation' => '<a href="' . esc_url( 'https://ays-pro.com/wordpress-survey-maker-user-manual' ) . '" target="_blank">' . esc_html__( 'Documentation', "survey-maker" ) . '</a>',
817 'ays-survey-rate-us' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/survey-maker/reviews/?rate=5#new-post' ) . '" target="_blank">' . esc_html__( 'Rate us', "survey-maker" ) . '</a>',
818 'ays-survey-rate-us' => '<a href="' . esc_url( 'https://www.youtube.com/channel/UC-1vioc90xaKjE7stq30wmA' ) . '" target="_blank">' . esc_html__( 'Video tutorial', "survey-maker" ) . '</a>',
819 );
820
821 return array_merge( $links, $row_meta );
822 }
823 return $links;
824 }
825
826 /**
827 * Render the settings page for this plugin.
828 *
829 * @since 1.0.0
830 */
831 public function display_plugin_setup_page(){
832 include_once('partials/survey-maker-admin-display.php');
833 }
834
835 public function display_plugin_surveys_page(){
836 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
837 switch ($action) {
838 case 'add':
839 include_once('partials/surveys/actions/survey-maker-surveys-actions.php');
840 break;
841 case 'edit':
842 include_once('partials/surveys/actions/survey-maker-surveys-actions.php');
843 break;
844 default:
845 include_once('partials/surveys/survey-maker-surveys-display.php');
846 }
847 }
848
849 public function display_plugin_survey_categories_page(){
850 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
851
852 switch ($action) {
853 case 'add':
854 include_once('partials/surveys/actions/survey-maker-survey-categories-actions.php');
855 break;
856 case 'edit':
857 include_once('partials/surveys/actions/survey-maker-survey-categories-actions.php');
858 break;
859 default:
860 include_once('partials/surveys/survey-maker-survey-categories-display.php');
861 }
862 }
863
864
865 public function display_plugin_popup_surveys_page(){
866 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
867
868 switch ($action) {
869 case 'add':
870 include_once('partials/popup/actions/survey-maker-popup-surveys-actions.php');
871 break;
872 case 'edit':
873 include_once('partials/popup/actions/survey-maker-popup-surveys-actions.php');
874 break;
875 default:
876 include_once('partials/popup/survey-maker-popups-display.php');
877 }
878 }
879
880 public function display_plugin_requests_page(){
881 include_once('partials/requests/survey-maker-requests-display.php');
882 }
883
884 public function display_plugin_submissions_page(){
885
886 include_once('partials/submissions/survey-maker-submissions-display.php');
887 }
888
889 public function display_plugin_each_submission_page(){
890 include_once 'partials/submissions/survey-maker-each-submission-display.php';
891 }
892
893 public function display_plugin_settings_page(){
894 include_once('partials/settings/survey-maker-settings.php');
895 }
896
897 public function display_plugin_export_import_page(){
898 include_once('partials/export-import/survey-maker-export-import-display.php');
899 }
900
901 public function display_plugin_subscribe_email(){
902 include_once('partials/subscribe/survey-maker-subscribe-email-display.php');
903 }
904
905 public function display_plugin_featured_plugins_page(){
906 include_once('partials/features/survey-maker-plugin-featured-display.php');
907 }
908
909 public function display_plugin_features_page(){
910 include_once('partials/features/survey-maker-features-display.php');
911 }
912
913 public function display_plugin_popup_page(){
914 include_once('partials/popup/survey-maker-popups-display.php');
915 }
916
917 public function display_plugin_admin_dashboard_page(){
918 include_once('partials/dashboard/survey-maker-dashboard-display.php');
919 }
920
921 public static function set_screen($status, $option, $value){
922 return $value;
923 }
924
925 public function screen_option_surveys(){
926 $option = 'per_page';
927 $args = array(
928 'label' => __('Surveys', "survey-maker"),
929 'default' => 20,
930 'option' => 'surveys_per_page'
931 );
932
933 if( ! ( isset( $_GET['action'] ) && ( $_GET['action'] == 'add' || $_GET['action'] == 'edit' ) ) ){
934 add_screen_option($option, $args);
935 }
936
937 $this->surveys_obj = new Surveys_List_Table($this->plugin_name);
938 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
939 }
940
941 public function screen_option_survey_categories(){
942 $option = 'per_page';
943 $args = array(
944 'label' => __('Survey Categories', "survey-maker"),
945 'default' => 20,
946 'option' => 'survey_categories_per_page'
947 );
948
949 if( ! ( isset( $_GET['action'] ) && ( $_GET['action'] == 'add' || $_GET['action'] == 'edit' ) ) ){
950 add_screen_option($option, $args);
951 }
952
953 $this->surveys_categories_obj = new Survey_Categories_List_Table($this->plugin_name);
954 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
955 }
956
957 public function screen_option_popup_surveys(){
958 $option = 'per_page';
959 $args = array(
960 'label' => __('Popup Survey', "survey-maker"),
961 'default' => 20,
962 'option' => 'popup_survey_per_page'
963 );
964
965 if( ! ( isset( $_GET['action'] ) && ( $_GET['action'] == 'add' || $_GET['action'] == 'edit' ) ) ){
966 add_screen_option( $option, $args );
967 }
968
969 $this->popup_surveys_obj = new Popup_Survey_List_Table( $this->plugin_name );
970 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
971 }
972
973 public function screen_option_questions(){
974 $option = 'per_page';
975 $args = array(
976 'label' => __('Questions', "survey-maker"),
977 'default' => 20,
978 'option' => 'survey_questions_per_page'
979 );
980
981 add_screen_option($option, $args);
982 $this->questions_obj = new Survey_Questions_List_Table($this->plugin_name);
983 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
984 }
985
986 public function screen_option_questions_categories(){
987 $option = 'per_page';
988 $args = array(
989 'label' => __('Question Categories', "survey-maker"),
990 'default' => 20,
991 'option' => 'survey_question_categories_per_page'
992 );
993
994 add_screen_option($option, $args);
995 $this->question_categories_obj = new Survey_Question_Categories_List_Table($this->plugin_name);
996 }
997
998 public function screen_option_submissions(){
999 $option = 'per_page';
1000 $args = array(
1001 'label' => __('Submissions', "survey-maker"),
1002 'default' => 20,
1003 'option' => 'survey_submissions_results_per_page'
1004 );
1005
1006 add_screen_option($option, $args);
1007 $this->submissions_obj = new Submissions_List_Table( $this->plugin_name );
1008 }
1009
1010 public function screen_option_each_survey_submission() {
1011 $option = 'per_page';
1012 $args = array(
1013 'label' => __('Results', "survey-maker"),
1014 'default' => 50,
1015 'option' => 'survey_each_submission_results_per_page',
1016 );
1017
1018 add_screen_option($option, $args);
1019 $this->each_submission_obj = new Survey_Each_Submission_List_Table($this->plugin_name);
1020 }
1021
1022 public function screen_option_settings(){
1023 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
1024 }
1025
1026 public function deactivate_plugin_option(){
1027
1028 // Run a security check.
1029 check_ajax_referer( 'survey-maker-ajax-deactivate-plugin-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
1030
1031 // Check for permissions.
1032 if ( ! current_user_can( 'manage_options' ) ) {
1033 ob_end_clean();
1034 $ob_get_clean = ob_get_clean();
1035 echo json_encode(array(
1036 'option' => ''
1037 ));
1038 wp_die();
1039 }
1040
1041 if( is_user_logged_in() ) {
1042 $request_value = sanitize_text_field($_REQUEST['upgrade_plugin']);
1043 $upgrade_option = get_option( 'ays_survey_maker_upgrade_plugin', '' );
1044 if($upgrade_option === ''){
1045 add_option( 'ays_survey_maker_upgrade_plugin', $request_value );
1046 }else{
1047 update_option( 'ays_survey_maker_upgrade_plugin', $request_value );
1048 }
1049
1050 ob_end_clean();
1051 $ob_get_clean = ob_get_clean();
1052 echo json_encode(array(
1053 'option' => get_option( 'ays_survey_maker_upgrade_plugin', '' )
1054 ));
1055 wp_die();
1056 } else {
1057 ob_end_clean();
1058 $ob_get_clean = ob_get_clean();
1059 echo json_encode(array(
1060 'option' => ''
1061 ));
1062 wp_die();
1063 }
1064 }
1065
1066 public function survey_maker_admin_footer($a){
1067 if(isset($_REQUEST['page'])){
1068 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
1069 ?>
1070 <div class="ays-survey-footer-support-box">
1071 <span class="ays-survey-footer-link-row"><a href="https://wordpress.org/support/plugin/survey-maker/" target="_blank"><?php echo esc_html__( "Support", "survey-maker"); ?></a></span>
1072 <span class="ays-survey-footer-slash-row">/</span>
1073 <span class="ays-survey-footer-link-row"><a href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank"><?php echo esc_html__( "Docs", "survey-maker"); ?></a></span>
1074 <span class="ays-survey-footer-slash-row">/</span>
1075 <span class="ays-survey-footer-link-row"><a href="https://ays-demo.com/survey-maker-plugin-survey/" target="_blank"><?php echo esc_html__( "Suggest a Feature", "survey-maker"); ?></a></span>
1076 </div>
1077 <p class="ays-survey-footer-review-box" style="font-size:13px;text-align:center;font-style:italic;">
1078 <span style="margin-left:0px;margin-right:10px;" class="ays_heart_beat"><i class="ays_fa ays_fa_heart_o animated"></i></span>
1079 <span><?php echo esc_html__( "If you love our plugin, please do big favor and rate us on", "survey-maker"); ?> WordPress.org</span>
1080 <a target="_blank" href='https://wordpress.org/support/plugin/survey-maker/reviews/?rate=5#new-post'></a>
1081 <a target="_blank" class="ays-rated-link" href='https://wordpress.org/support/plugin/survey-maker/reviews'>
1082 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1083 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1084 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1085 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1086 <span class="ays-dashicons ays-dashicons-star-empty"></span>
1087 </a>
1088 <span class="ays_heart_beat"><i class="ays_fa ays_fa_heart_o animated"></i></span>
1089 </p>
1090 <?php
1091 }
1092 }
1093 }
1094
1095 public static function ays_restriction_string($type, $x, $length){
1096 $output = "";
1097 switch($type){
1098 case "char":
1099 if(strlen($x)<=$length){
1100 $output = $x;
1101 } else {
1102 $output = substr($x,0,$length) . '...';
1103 }
1104 break;
1105 case "word":
1106 $res = explode(" ", $x);
1107 if(count($res)<=$length){
1108 $output = implode(" ",$res);
1109 } else {
1110 $res = array_slice($res,0,$length);
1111 $output = implode(" ",$res) . '...';
1112 }
1113 break;
1114 }
1115 return $output;
1116 }
1117
1118 public static function validateDate($date, $format = 'Y-m-d H:i:s'){
1119 $d = DateTime::createFromFormat($format, $date);
1120 return $d && $d->format($format) == $date;
1121 }
1122
1123 public static function get_max_id( $table ) {
1124 global $wpdb;
1125 $db_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . $table;
1126
1127 $sql = "SELECT MAX(id) FROM {$db_table}";
1128
1129 $result = intval( $wpdb->get_var( $sql ) );
1130
1131 return $result;
1132 }
1133
1134 public function get_all_surveys(){
1135 global $wpdb;
1136 $surveys_table = $wpdb->prefix . "ayssurvey_surveys";
1137 $surveys = $wpdb->get_results("SELECT * FROM {$surveys_table}");
1138 return $surveys;
1139 }
1140
1141 public static function string_starts_with_number($string){
1142 $match = preg_match('/^\d/', $string);
1143 if($match === 1){
1144 return true;
1145 }else{
1146 return false;
1147 }
1148 }
1149
1150 public function get_question_answers( $question_id ) {
1151 global $wpdb;
1152
1153 $sql = "SELECT * FROM {$wpdb->prefix}ayssurvey_answers WHERE question_id=" . absint( $question_id );
1154
1155 $results = $wpdb->get_results( $sql, 'ARRAY_A' );
1156 foreach ($results as $key => &$result) {
1157 unset($result['id']);
1158 unset($result['question_id']);
1159 }
1160
1161 return $results;
1162 }
1163
1164 public function ays_survey_question_results( $survey_id, $submission_ids = null ){
1165 global $wpdb;
1166
1167 if($survey_id === null){
1168 return array(
1169 'total_count' => 0,
1170 'questions' => array()
1171 );
1172 }
1173
1174 $submitions_questiions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions_questions";
1175 $answer_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "answers";
1176 $question_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "questions";
1177 $submitions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions";
1178 $survey_section_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "sections";
1179 $surveys_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys";
1180
1181 $survey_options_sql = "SELECT options FROM {$surveys_table} WHERE id =". absint( $survey_id );
1182 $survey_options = $wpdb->get_var( $survey_options_sql );
1183
1184 $survey_options = isset( $survey_options ) && $survey_options != '' ? json_decode( $survey_options, true ) : array();
1185
1186 // Allow HTML in answers
1187 $survey_options[ 'survey_allow_html_in_answers' ] = isset($survey_options[ 'survey_allow_html_in_answers' ]) ? $survey_options[ 'survey_allow_html_in_answers' ] : 'off';
1188 $allow_html_in_answers = (isset($survey_options[ 'survey_allow_html_in_answers' ]) && $survey_options[ 'survey_allow_html_in_answers' ] == 'on') ? true : false;
1189
1190 $question_ids = "SELECT question_ids FROM {$surveys_table} WHERE id =". absint( $survey_id );
1191 $question_ids_results = $wpdb->get_var( $question_ids );
1192 $ays_question_id = ($question_ids_results != '') ? $question_ids_results : null;
1193
1194 if($ays_question_id == null){
1195 return array(
1196 'total_count' => 0,
1197 'questions' => array()
1198 );
1199 }
1200
1201 $questions_ids_arr = explode(',',$ays_question_id);
1202 $answer_id = "SELECT a.id, a.answer, COUNT(s_q.answer_id) AS answer_count
1203 FROM {$answer_table} AS a
1204 LEFT JOIN {$submitions_questiions_table} AS s_q
1205 ON a.id = s_q.answer_id
1206 WHERE s_q.survey_id=".absint( $survey_id ) ."
1207 GROUP BY a.id";
1208
1209 $answer_id_result = $wpdb->get_results($answer_id,'ARRAY_A');
1210
1211 $for_checkbox = "SELECT a.id, a.answer, COUNT(s_q.answer_id) AS answer_count
1212 FROM {$answer_table} AS a
1213 LEFT JOIN {$submitions_questiions_table} AS s_q
1214 ON a.id = s_q.answer_id OR FIND_IN_SET( a.id, s_q.user_answer )
1215 WHERE s_q.type = 'checkbox'
1216 AND s_q.survey_id=".absint( $survey_id ) ."
1217 GROUP BY a.id";
1218
1219 $for_checkbox_result = $wpdb->get_results($for_checkbox,'ARRAY_A');
1220
1221 $for_text_type = "SELECT a.id, a.answer, COUNT(s_q.id) AS answer_count
1222 FROM {$answer_table} AS a
1223 LEFT JOIN {$submitions_questiions_table} AS s_q
1224 ON a.id = s_q.answer_id OR FIND_IN_SET( a.id, s_q.user_answer )
1225 WHERE s_q.type IN ('name', 'email', 'text', 'short_text', 'number')
1226 AND s_q.survey_id=".absint( $survey_id ) ."
1227 GROUP BY a.id";
1228
1229 $for_text_type_result = $wpdb->get_results($for_checkbox,'ARRAY_A');
1230 $answer_count = array();
1231 $question_type = '';
1232 foreach ($answer_id_result as $key => $answer_count_by_id) {
1233 $ays_survey_answer_count = (isset($answer_count_by_id['answer_count']) && $answer_count_by_id['answer_count'] !="") ? absint(intval($answer_count_by_id['answer_count'])) : '';
1234 $answer_count[$answer_count_by_id['id']] = $ays_survey_answer_count;
1235 }
1236
1237 foreach ($for_checkbox_result as $key => $answer_count_by_id) {
1238 $ays_survey_answer_count = (isset($answer_count_by_id['answer_count']) && $answer_count_by_id['answer_count'] !="") ? absint(intval($answer_count_by_id['answer_count'])) : '';
1239 $answer_count[$answer_count_by_id['id']] = $ays_survey_answer_count;
1240 }
1241
1242 foreach ($for_text_type_result as $key => $answer_count_by_id) {
1243 $ays_survey_answer_count = (isset($answer_count_by_id['answer_count']) && $answer_count_by_id['answer_count'] !="") ? absint(intval($answer_count_by_id['answer_count'])) : '';
1244 $answer_count[$answer_count_by_id['id']] = $ays_survey_answer_count;
1245 }
1246
1247 $question_by_ids = Survey_Maker_Data::get_question_by_ids( $questions_ids_arr );
1248
1249 $select_answer_q_type = "SELECT type, user_answer, id, question_id
1250 FROM {$submitions_questiions_table}
1251 WHERE user_answer != ''
1252 AND type != 'checkbox'
1253 AND survey_id=". absint( $survey_id );
1254
1255 $submission_answer_other = "SELECT question_id, user_variant
1256 FROM {$submitions_questiions_table}
1257 WHERE user_variant != ''
1258 AND survey_id=". absint( $survey_id );
1259
1260 if( $submission_ids !== null ){
1261 if( is_array( $submission_ids ) ){
1262 $select_answer_q_type .= " AND submission_id IN (" . esc_sql( implode( ',', $submission_ids ) ) . ") ";
1263 $submission_answer_other .= " AND submission_id IN (" . esc_sql( implode( ',', $submission_ids ) ) . ") ";
1264 }
1265 }
1266
1267 $result_answers_q_type = $wpdb->get_results($select_answer_q_type,'ARRAY_A');
1268 $result_answers_other = $wpdb->get_results($submission_answer_other,'ARRAY_A');
1269 $text_answer = array();
1270 foreach($result_answers_q_type as $key => $result_answer_q_type){
1271 $text_answer[$result_answer_q_type['type']][$result_answer_q_type['question_id']][] = $result_answer_q_type['user_answer'];
1272 }
1273
1274 $other_answers = array();
1275 foreach($result_answers_other as $key => $result_answer_other){
1276 $other_answers[$result_answer_other['question_id']][] = $result_answer_other['user_variant'];
1277 }
1278
1279 $text_types = array(
1280 'text',
1281 'short_text',
1282 'number',
1283 'date',
1284 'time',
1285 'date_time',
1286 'star',
1287 'phone',
1288 'name',
1289 'email',
1290 );
1291
1292 //Question types different charts
1293 $ays_submissions_count = array();
1294 $question_results = array();
1295
1296 $total_count = 0;
1297 foreach ($question_by_ids as $key => $question) {
1298 $answers = $question->answers;
1299 $question_id = $question->id;
1300 $question_title = $question->question;
1301 $question_type = $question->type;
1302 //questions
1303 $question_results[$question_id]['question_id'] = $question_id;
1304 $question_results[$question_id]['question'] = $question_title;
1305 $ays_answer = array();
1306 $question_answer_ids = array();
1307 //
1308
1309 foreach ($answers as $key => $answer) {
1310 $answer_id = $answer->id;
1311 $answer_title = $answer->answer;
1312
1313 $ays_answer[$answer_id] = isset( $answer_count[$answer_id] ) ? $answer_count[$answer_id] : 0;
1314 $question_answer_ids[$answer_id] = $allow_html_in_answers ? sanitize_text_field( $answer_title ) : $answer_title;
1315 }
1316
1317 //sum of submissions count per questions
1318 if($question_type == "checkbox"){
1319 $sub_checkbox_count = $this->ays_survey_get_submission_count($question->id, $question_type, $survey_id);
1320 $sum_of_count = $sub_checkbox_count;
1321 }else{
1322 $sum_of_count = array_sum( array_values( $ays_answer ) );
1323 }
1324 $question_results[$question_id]['otherAnswers'] = isset( $other_answers[$question->id] ) ? $other_answers[$question->id] : array();
1325
1326 if( in_array( $question->type, $text_types ) ){
1327 $question_ls_options = json_decode($question->options, true);
1328 if($question->type == 'star'){
1329 $scale_from = isset($question_ls_options['star_1']) && $question_ls_options['star_1'] != "" ? stripslashes($question_ls_options['star_1']) : "";
1330 $scale_to = isset($question_ls_options['star_2']) && $question_ls_options['star_2'] != "" ? stripslashes($question_ls_options['star_2']) : "";
1331 $scale_length = isset($question_ls_options['star_scale_length']) && $question_ls_options['star_scale_length'] != "" ? $question_ls_options['star_scale_length'] : "";
1332 $question_results[$question_id]['labels'] = array(
1333 'from' => $scale_from,
1334 'to' => $scale_to,
1335 'length' => $scale_length
1336 );
1337 }
1338 $question_results[$question_id]['answers'] = isset( $text_answer[$question->type] ) ? $text_answer[$question->type] : '';
1339 $question_results[$question_id]['answerTitles'] = isset( $text_answer[$question->type] ) ? $text_answer[$question->type] : '';
1340 $question_results[$question_id]['sum_of_answers_count'] = isset( $text_answer[$question->type][$question->id] ) ? count( $text_answer[$question->type][$question->id] ) : 0;
1341 $question_results[$question_id]['sum_of_same_answers'] = isset( $text_answer[$question->type][$question->id] ) ? array_count_values( $text_answer[$question->type][$question->id] ) : 0;
1342 }else{
1343 $question_results[$question_id]['answers'] = $ays_answer;
1344 $question_results[$question_id]['answerTitles'] = $question_answer_ids;
1345 $question_results[$question_id]['sum_of_answers_count'] = $sum_of_count;
1346 if( $sum_of_count == 0 ){
1347 $question_results[$question_id]['answers'] = array();
1348 }
1349 }
1350
1351 // Answers for charts
1352 if( !empty( $question_results[$question_id]['otherAnswers'] ) ){
1353 $question_results[$question_id]['answers'][0] = count( $question_results[$question_id]['otherAnswers'] );
1354 $question_results[$question_id]['answerTitles'][0] = __( '"Other" answer(s)', "survey-maker" );
1355 $question_results[$question_id]['same_other_count'] = array_count_values( $question_results[$question_id]['otherAnswers'] );
1356
1357 if($question_type == "radio" || $question_type == "yesorno"){
1358 $question_results[$question_id]['sum_of_answers_count'] += count( $question_results[$question_id]['otherAnswers'] );
1359 }
1360
1361 }
1362 //
1363
1364 $total_count += intval( $question_results[$question_id]['sum_of_answers_count'] );
1365
1366 $question_results[$question_id]['question_type'] = $question->type;
1367 }
1368
1369 return array(
1370 'total_count' => $total_count,
1371 'questions' => $question_results
1372 );
1373 }
1374
1375 public function ays_survey_get_last_submission_id( $survey_id ){
1376 global $wpdb;
1377
1378 if($survey_id === null){
1379 return array();
1380 }
1381
1382 $submitions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions";
1383
1384 //submission of each result
1385 $submission = "SELECT * FROM {$submitions_table} WHERE survey_id=". absint( $survey_id ) ." ORDER BY id DESC LIMIT 1 ";
1386 $last_submission = $wpdb->get_row( $submission, 'ARRAY_A' );
1387
1388 if( $last_submission == null ){
1389 return array();
1390 }
1391 return $last_submission;
1392 }
1393
1394 public function ays_survey_individual_results_for_one_submission( $submission, $survey ){
1395 global $wpdb;
1396 $survey_id = isset( $survey['id'] ) ? absint( intval( $survey['id'] ) ) : null;
1397
1398 if( is_null( $survey_id ) || empty( $submission )){
1399 return array(
1400 'sections' => array()
1401 );
1402 }
1403
1404 $submitions_questiions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions_questions";
1405 $submitions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions";
1406
1407 $ays_individual_questions_for_one_submission = array();
1408 $question_answer_id = array();
1409 $submission_id = isset( $submission['id'] ) && $submission['id'] != '' ? $submission['id'] : null;
1410
1411 if( is_null( $submission_id ) ){
1412 return array(
1413 'sections' => array()
1414 );
1415 }
1416
1417 $checkbox_ids = '';
1418
1419 $individual_questions = "SELECT * FROM {$submitions_questiions_table} WHERE submission_id=" . absint( $submission_id );
1420 $individual_questions_results = $wpdb->get_results($individual_questions,'ARRAY_A');
1421
1422 // Get user info
1423 $which_needed = "id,user_ip,user_id,user_name,user_email,submission_date,options";
1424 $individual_users = "SELECT ".$which_needed." FROM ".$submitions_table." WHERE id=" . absint( $submission_id );
1425 $individual_users_results = $wpdb->get_row($individual_users,'ARRAY_A');
1426 $user_id = isset($individual_users_results['user_id']) && $individual_users_results['user_id'] != "" ? $individual_users_results['user_id'] : 0;
1427 $user_real_name = __("Guest" , "survey-maker");
1428 $user_real_email = "";
1429 if($user_id > 0){
1430 $user_data = get_userdata($user_id);
1431 $user_real_name = $user_data ? $user_data->data->display_name : __('Deleted User' , "survey-maker");
1432 $user_real_email = $user_data ? $user_data->data->user_email : '';
1433 }
1434 if(!isset($individual_users_results['user_name']) || (isset($individual_users_results['user_name']) && $individual_users_results['user_name'] == "")){
1435 $individual_users_results['user_name'] = $user_real_name;
1436 }
1437
1438 if(!isset($individual_users_results['user_email']) || (isset($individual_users_results['user_email']) && $individual_users_results['user_email'] == "")){
1439 $individual_users_results['user_email'] = $user_real_email;
1440 }
1441 $individual_users_results['user_name'] = stripslashes(nl2br( htmlentities($individual_users_results['user_name'])));
1442 // Survey questions IDs
1443 $question_ids = isset( $survey['question_ids'] ) && $survey['question_ids'] != '' ? $survey['question_ids'] : '';
1444
1445 // Section Ids
1446 $sections_ids = (isset( $survey['section_ids' ] ) && $survey['section_ids'] != '') ? $survey['section_ids'] : '';
1447
1448 $sections = Survey_Maker_Data::get_suervey_sections_with_questions( $sections_ids, $question_ids );
1449
1450 $text_types = array(
1451 'text',
1452 'short_text',
1453 'phone',
1454 'date',
1455 'time',
1456 'date_time',
1457 'star',
1458 'number',
1459 'name',
1460 'email',
1461 );
1462
1463 foreach ($individual_questions_results as $key => $individual_questions_result) {
1464 if($individual_questions_result['type'] == 'checkbox'){
1465 $checkbox_ids = $individual_questions_result['user_answer'] != '' ? explode(',', $individual_questions_result['user_answer']) : array();
1466 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = $checkbox_ids;
1467
1468 $question_answer_id[ $individual_questions_result['question_id'] ]['otherAnswer'] = isset($individual_questions_result['user_variant']) && $individual_questions_result['user_variant'] != '' ? stripslashes(htmlentities($individual_questions_result['user_variant'])) : '';
1469 }elseif( in_array( $individual_questions_result['type'], $text_types ) ){
1470
1471 if( $individual_questions_result['type'] == 'date' ){
1472 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = stripslashes(htmlentities($individual_questions_result['user_answer']));
1473
1474 if( $individual_questions_result['user_answer'] != '' ){
1475 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = date( 'd . m . Y', strtotime(nl2br(htmlentities($individual_questions_result['user_answer']))) );
1476 }else{
1477 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = '';
1478 }
1479 }
1480 elseif( $individual_questions_result['type'] == 'time' ){
1481 if( $individual_questions_result['user_answer'] != '' ){
1482 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = implode(" : ", explode( ":", $individual_questions_result['user_answer'] ));
1483 }else{
1484 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = '';
1485 }
1486 }
1487 elseif( $individual_questions_result['type'] == 'date_time' ){
1488 if( $individual_questions_result['user_answer'] != '' ){
1489 $user_date_time_answer = explode(" ", $individual_questions_result['user_answer'] );
1490 if((isset($user_date_time_answer[0]) && $user_date_time_answer[0] != '-') && (isset($user_date_time_answer[1]) && $user_date_time_answer[1] != '-')){
1491 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = date( 'd . m . Y', strtotime(nl2br(htmlentities($user_date_time_answer[0]))) ) . " " . implode(" : ", explode( ":", $user_date_time_answer[1] ));
1492 }
1493 }else{
1494 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = '';
1495 }
1496 }
1497 else{
1498 $question_answer_id[ $individual_questions_result['question_id'] ] = stripslashes(htmlentities($individual_questions_result['user_answer']));
1499 }
1500 }elseif($individual_questions_result['type'] == 'radio'){
1501
1502 $other_answer = isset($individual_questions_result['user_variant']) && $individual_questions_result['user_variant'] != '' ? stripslashes(htmlentities($individual_questions_result['user_variant'])) : '';
1503 $question_answer_id[ $individual_questions_result['question_id'] ]['otherAnswer'] = $other_answer;
1504 $question_answer_id[ $individual_questions_result['question_id'] ]['answer'] = $individual_questions_result['answer_id'];
1505 }else{
1506 $question_answer_id[ $individual_questions_result['question_id'] ] = $individual_questions_result['answer_id'];
1507 }
1508 }
1509
1510 $ays_individual_questions_for_one_submission['submission_id'] = $submission['id'];
1511 $ays_individual_questions_for_one_submission['questions'] = $question_answer_id;
1512 $ays_individual_questions_for_one_submission['sections'] = $sections;
1513 $ays_individual_questions_for_one_submission['user_info'] = $individual_users_results;
1514 return $ays_individual_questions_for_one_submission;
1515 }
1516
1517 public function get_submission_count_and_ids(){
1518 global $wpdb;
1519 $survey_id = isset($_GET['survey']) ? intval($_GET['survey']) : null;
1520
1521 if($survey_id === null){
1522 return false;
1523 }
1524 $submitions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions";
1525
1526 //submission of each result
1527 $submission_ids = "SELECT id,
1528 (SELECT COUNT(id) FROM {$submitions_table} i
1529 WHERE i.survey_id=j.survey_id) AS count_submission
1530 FROM {$submitions_table} j
1531 WHERE survey_id=". absint( $survey_id ) ."
1532 ORDER BY id";
1533 $submission_ids_result = $wpdb->get_results($submission_ids,'ARRAY_A');
1534 $submission_count = '';
1535 $submissions_id_arr = array();
1536 foreach ($submission_ids_result as $key => $submission_id_result) {
1537 $submission_id_count = $submission_id_result['count_submission'];
1538 $submission_count = intval($submission_id_count);
1539 $submissions_id_arr[] = $submission_id_result['id'];
1540 }
1541 $submissions_id_str = implode(',', $submissions_id_arr );
1542
1543 $submission_count_and_ids = array(
1544 'submission_count' => $submission_count,
1545 'submission_ids' => $submissions_id_str
1546 );
1547
1548 return $submission_count_and_ids;
1549 }
1550
1551 public function ays_survey_submission_report(){
1552 global $wpdb;
1553 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ays_survey_submission_report' && wp_verify_nonce( $_REQUEST['nonce'], 'ajax-nonce' )) {
1554
1555 $survey_id = (isset($_REQUEST['surveyId']) && $_REQUEST['surveyId'] != "") ? intval(sanitize_text_field($_REQUEST['surveyId'])) : null;
1556 if($survey_id === null){
1557 return false;
1558 }
1559
1560 $sql = "SELECT * FROM " . $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys WHERE id =" . absint( $survey_id );
1561 $survey = $wpdb->get_row( $sql, 'ARRAY_A' );
1562
1563 $submission_id = (isset($_REQUEST['submissionId']) && $_REQUEST['submissionId'] != '') ? absint( sanitize_text_field( $_REQUEST['submissionId'] ) ) : null;
1564 if($submission_id == null){
1565 return false;
1566 }
1567 $submission = array(
1568 'id' => $submission_id
1569 );
1570
1571 $results = $this->ays_survey_individual_results_for_one_submission( $submission, $survey );
1572 $individual_user_name = isset($results['user_info']['user_name']) && isset($results['user_info']['user_name']) ? $results['user_info']['user_name'] : "";
1573 $individual_user_email = isset($results['user_info']['user_email']) && isset($results['user_info']['user_email']) ? wp_kses_post($results['user_info']['user_email']) : "";
1574 $individual_user_ip = isset($results['user_info']['user_ip']) && isset($results['user_info']['user_ip']) ? esc_attr($results['user_info']['user_ip']) : "";
1575 $individual_user_date = isset($results['user_info']['submission_date']) && isset($results['user_info']['submission_date']) ? esc_attr($results['user_info']['submission_date']) : "";
1576 $individual_user_sub_id = isset($results['user_info']['id']) && isset($results['user_info']['id']) ? esc_attr($results['user_info']['id']) : "";
1577
1578 $individual_user_extra_data = isset($results['user_info']['options']) && $results['user_info']['options'] != '' ? json_decode(($results['user_info']['options']) , 'true') : array();
1579 $individual_user_device_type = isset($individual_user_extra_data['device']) && $individual_user_extra_data['device'] != '' ? esc_attr(ucfirst($individual_user_extra_data['device'])) : '';
1580
1581 $survey_data_clipboard = array(
1582 "user_name" => $individual_user_name,
1583 "user_email" => $individual_user_email,
1584 "user_ip" => $individual_user_ip,
1585 "user_date" => $individual_user_date,
1586 "user_sub_id" => $individual_user_sub_id,
1587 "user_device_type" => $individual_user_device_type,
1588 );
1589 $results['user_info']['user_device_type'] = $individual_user_device_type;
1590 ob_end_clean();
1591 $ob_get_clean = ob_get_clean();
1592 $response = array(
1593 'status' => true,
1594 'questions' => $results['questions'],
1595 'user_info' => $results['user_info'],
1596 'user_info_for_copy' => Survey_Maker_Data::ays_survey_copy_text_formater($survey_data_clipboard)
1597 );
1598 echo json_encode($response);
1599 wp_die();
1600 }
1601 ob_end_clean();
1602 $ob_get_clean = ob_get_clean();
1603 $response = array(
1604 'status' => false
1605 );
1606 echo json_encode($response);
1607 wp_die();
1608 }
1609
1610 // Survey Maker Elementor widget init
1611 public function survey_maker_el_widgets_registered() {
1612 // We check if the Elementor plugin has been installed / activated.
1613 if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) {
1614 // get our own widgets up and running:
1615 // copied from widgets-manager.php
1616 if ( class_exists( 'Elementor\Plugin' ) ) {
1617 if ( is_callable( 'Elementor\Plugin', 'instance' ) ) {
1618 $elementor = Elementor\Plugin::instance();
1619 if ( isset( $elementor->widgets_manager ) ) {
1620 if ( method_exists( $elementor->widgets_manager, 'register_widget_type' ) ) {
1621 wp_enqueue_style($this->plugin_name . '-admin', plugin_dir_url(__FILE__) . 'css/admin.css', array(), $this->version, 'all');
1622 wp_enqueue_style( SURVEY_MAKER_NAME . "-dropdown", SURVEY_MAKER_PUBLIC_URL . '/css/dropdown.min.css', array(), SURVEY_MAKER_VERSION, 'all' );
1623 $widget_file = 'plugins/elementor/survey-maker-elementor.php';
1624 $template_file = locate_template( $widget_file );
1625 if ( !$template_file || !is_readable( $template_file ) ) {
1626 $template_file = SURVEY_MAKER_DIR . 'pb_templates/survey-maker-elementor.php';
1627 }
1628 if ( $template_file && is_readable( $template_file ) ) {
1629 require_once $template_file;
1630 Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Elementor\Widget_Survey_Maker_Elementor() );
1631 }
1632 }
1633 }
1634 }
1635 }
1636 }
1637 }
1638
1639 // Get Submissions count ( Checkbox )
1640 public function ays_survey_get_submission_count($id, $type, $survey_id){
1641 global $wpdb;
1642 $submitions_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions";
1643 $submitions_q_table = $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions_questions";
1644 $results = array();
1645 if($type == 'checkbox'){
1646 $sql = "SELECT COUNT(submission_id) AS sub_count
1647 FROM {$submitions_q_table}
1648 WHERE question_id = ". absint( $id )."
1649 AND user_answer != ''
1650 AND type='". esc_sql( $type ) ."'
1651 AND survey_id=". absint( $survey_id );
1652 $results = $wpdb->get_row($sql,'ARRAY_A');
1653 }
1654 $submission_count = isset($results['sub_count']) && $results['sub_count'] != "" && $results['sub_count'] > 0 ? $results['sub_count'] : 0;
1655 return $submission_count;
1656 }
1657
1658 public function ays_survey_sale_baner(){
1659 /* OLD INFO OPEN AFTER HALLOWEN START */
1660 // if(isset($_POST['ays_survey_sale_btn'])){
1661 // update_option('ays_survey_sale_btn', 1);
1662 // update_option('ays_survey_maker_sale_date', current_time( 'mysql' ));
1663 // }
1664
1665 // if(isset($_POST['ays_survey_sale_btn_for_two_months'])){
1666 // update_option('ays_survey_sale_btn_for_two_months', 1);
1667 // update_option('ays_survey_maker_sale_date', current_time( 'mysql' ));
1668 // }
1669
1670 // $ays_survey_maker_sale_date = get_option('ays_survey_maker_sale_date');
1671 // $ays_survey_maker_sale_two_months = get_option('ays_survey_sale_btn_for_two_months');
1672
1673 // $val = 60*60*24*5;
1674 // if($ays_survey_maker_sale_two_months == 1){
1675 // $val = 60*60*24*61;
1676 // }
1677
1678 // $current_date = current_time( 'mysql' );
1679 // $date_diff = strtotime($current_date) - intval(strtotime($ays_survey_maker_sale_date)) ;
1680
1681 // $days_diff = $date_diff / $val;
1682
1683 // if(intval($days_diff) > 0 ){
1684 // update_option('ays_survey_sale_btn', 0);
1685 // update_option('ays_survey_sale_btn_for_two_months', 0);
1686 // }
1687
1688 // $ays_survey_maker_flag = intval(get_option('ays_survey_sale_btn'));
1689 // $ays_survey_maker_flag += intval(get_option('ays_survey_sale_btn_for_two_months'));
1690 // if( $ays_survey_maker_flag == 0 ){
1691 // if (isset($_GET['page']) && strpos($_GET['page'], SURVEY_MAKER_NAME) !== false) {
1692 // if( !(Survey_Maker_Admin::get_max_id('surveys') <= 1) ){
1693 // // $this->ays_survey_sale_message($ays_survey_maker_flag);
1694 // // $this->ays_survey_spring_bundle_small_message($ays_survey_maker_flag);
1695 // $this->ays_survey_maker_helloween_message($ays_survey_maker_flag);
1696 // }
1697 // }
1698 // }
1699 /* OLD INFO OPEN AFTER HALLOWEN END */
1700
1701 // ONLY FOR Black Friday
1702 if(isset($_POST['ays_survey_sale_btn']) &&
1703 (isset( $_POST[$this->plugin_name . '-sale-banner'] ) && wp_verify_nonce( $_POST[$this->plugin_name . '-sale-banner'], $this->plugin_name . '-sale-banner' )) &&
1704 current_user_can( 'manage_options' )){
1705
1706 update_option('ays_survey_sale_btn', 1);
1707 update_option('ays_survey_sale_date', current_time( 'mysql' ));
1708 }
1709
1710 $ays_survey_sale_date = get_option('ays_survey_sale_date');
1711
1712 $val = 60*60*24*5;
1713
1714 $current_date = current_time( 'mysql' );
1715 $date_diff = strtotime($current_date) - intval(strtotime($ays_survey_sale_date)) ;
1716
1717 $days_diff = $date_diff / $val;
1718
1719 if(intval($days_diff) > 0 ){
1720 update_option('ays_survey_sale_btn', 0);
1721 }
1722
1723
1724 $ays_survey_maker_flag = intval(get_option('ays_survey_sale_btn'));
1725 if( $ays_survey_maker_flag == 0 ){
1726 if (isset($_GET['page']) && strpos($_GET['page'], SURVEY_MAKER_NAME) !== false) {
1727 if(Survey_Maker_Admin::get_max_id('surveys') > 1){
1728 // $this->ays_survey_new_halloween_bundle_message_2025($ays_survey_maker_flag);
1729 // $this->ays_survey_black_friday_message($ays_survey_maker_flag);
1730 // $this->ays_survey_christmas_banner_message_2025($ays_survey_maker_flag);
1731 // $this->ays_survey_new_mega_bundle_message_2026($ays_survey_maker_flag);
1732 $this->ays_survey_footer_sale_banner_2026($ays_survey_maker_flag);
1733 }
1734 }
1735 }
1736
1737 }
1738
1739 // New Mega Bundle
1740 public function ays_quiz_new_mega_bundle_message_2025($ishmar){
1741 if($ishmar == 0 ){
1742 $content = array();
1743
1744 $survey_cta_button_link = esc_url('https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=mega-bundle-2025-sale-banner-' . SURVEY_MAKER_VERSION);
1745
1746 $content[] = '<div id="ays-survey-new-mega-bundle-2025-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
1747 $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
1748
1749 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
1750 $content[] = '<div>';
1751
1752 $content[] = '<span class="ays-survey-new-mega-bundle-2025-title">';
1753 $content[] = __( "<span><a href='". $survey_cta_button_link ."' target='_blank' style='color:#ffffff; text-decoration: underline;'>Mega Bundle</a></span> (Quiz + Survey + Poll)", 'survey-maker' );
1754 $content[] = '</span>';
1755
1756 $content[] = '</br>';
1757
1758 $content[] = '<span class="ays-survey-new-mega-bundle-2025-desc">';
1759 $content[] = __( "30 Day Money Back Guarantee", 'survey-maker' );
1760 $content[] = '</span>';
1761 $content[] = '</div>';
1762
1763 $content[] = '<div>';
1764 $content[] = '<img class="ays-survey-new-mega-bundle-guaranteeicon" src="' . SURVEY_MAKER_ADMIN_URL . '/images/ays-survey-mega-bundle-2025-discount.svg" style="width: 80px;">';
1765 $content[] = '</div>';
1766
1767 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
1768
1769 $content[] = '<form action="" method="POST">';
1770 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
1771 if( current_user_can( 'manage_options' ) ){
1772 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
1773 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
1774 }
1775 $content[] = '</div>';
1776 $content[] = '</form>';
1777
1778 $content[] = '</div>';
1779
1780 $content[] = '</div>';
1781
1782 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
1783
1784 $content[] = '<div id="ays-survey-maker-countdown-main-container">';
1785 $content[] = '<div class="ays-survey-maker-countdown-container">';
1786
1787 $content[] = '<div id="ays-survey-countdown">';
1788
1789 $content[] = '<ul>';
1790 $content[] = '<li><span id="ays-survey-countdown-days"></span>'. __( "Days", 'survey-maker' ) .'</li>';
1791 $content[] = '<li><span id="ays-survey-countdown-hours"></span>'. __( "Hours", 'survey-maker' ) .'</li>';
1792 $content[] = '<li><span id="ays-survey-countdown-minutes"></span>'. __( "Minutes", 'survey-maker' ) .'</li>';
1793 $content[] = '<li><span id="ays-survey-countdown-seconds"></span>'. __( "Seconds", 'survey-maker' ) .'</li>';
1794 $content[] = '</ul>';
1795 $content[] = '</div>';
1796
1797 $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
1798 $content[] = '<span></span>';
1799 $content[] = '<span></span>';
1800 $content[] = '<span></span>';
1801 $content[] = '<span></span>';
1802 $content[] = '</div>';
1803
1804 $content[] = '</div>';
1805 $content[] = '</div>';
1806
1807 $content[] = '</div>';
1808
1809 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
1810 $content[] = '<a href="'. $survey_cta_button_link .'" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now', 'survey-maker' ) . '</a>';
1811 $content[] = '<span class="ays-survey-dicount-one-time-text">';
1812 $content[] = __( "One-time payment", 'survey-maker' );
1813 $content[] = '</span>';
1814 $content[] = '</div>';
1815 $content[] = '</div>';
1816 $content[] = '</div>';
1817
1818 $content = implode( '', $content );
1819 echo wp_kses_post($content);
1820 }
1821 }
1822
1823 // New Mega Bundle 2026
1824 public static function ays_survey_new_mega_bundle_message_2026($ishmar){
1825 if( $ishmar == 0 ){
1826 $content = array();
1827
1828 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
1829 $now_date = date('M d, Y H:i:s', $date);
1830
1831 $survey_banner_date = strtotime( self::ays_survey_update_banner_time() );
1832
1833 $diff = $survey_banner_date - $date;
1834
1835 $style_attr = '';
1836 if( $diff < 0 ){
1837 $style_attr = 'style="display:none;"';
1838 }
1839
1840 $survey_cta_button_link = esc_url( 'https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=top-20-sale-banner-' . SURVEY_MAKER_VERSION );
1841
1842 $content[] = '<div id="ays-survey-new-mega-bundle-dicount-month-main" class="ays-survey-admin-notice notice notice-success is-dismissible ays_survey_dicount_info">';
1843 $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
1844
1845 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
1846 $content[] = '<div>';
1847 $content[] = '<div class="ays-survey-dicount-logo-box">';
1848 $content[] = '<a href="' . $survey_cta_button_link . '" target="_blank" class="ays-survey-sale-banner-link"><img src="' . SURVEY_MAKER_ADMIN_URL . '/images/ays-survey-banner-announcement-icon.svg"></a>';
1849
1850 $content[] = '<div>';
1851 $content[] = '<span class="ays-survey-new-mega-bundle-title">';
1852 $content[] = sprintf(
1853 /* translators: 1: opening link wrapper with <a> tag, 2: closing </a> tag */
1854 __( 'Upgrade to %1$s Survey Maker PRO %2$s', 'survey-maker' ),
1855 '<span style="display:inline-block; margin-right:5px;"><a href="' . esc_url( $survey_cta_button_link ) . '" target="_blank" rel="noopener noreferrer" style="color:#ffffff !important; text-decoration: underline;">',
1856 '</a></span>'
1857 );
1858 $content[] = '</span>';
1859 $content[] = '</br>';
1860 $content[] = '<span class="ays-survey-new-mega-bundle-desc">';
1861 $content[] = __( "30 Day Money Back Guarantee", 'survey-maker' );
1862 $content[] = '</span>';
1863 $content[] = '</div>';
1864
1865 $content[] = '<div class="ays-survey-new-mega-bundle-title-icon-row" style="display: inline-block;">';
1866 $content[] = '<img src="' . SURVEY_MAKER_ADMIN_URL . '/images/ays-survey-banner-sale-20.svg" class="ays-survey-new-mega-bundle-mobile-image-display-none" style="width: 70px;">';
1867 $content[] = '</div>';
1868
1869 $content[] = '</div>';
1870
1871 $content[] = '</div>';
1872
1873 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
1874
1875 $content[] = '<form action="" method="POST">';
1876 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
1877 if( current_user_can( 'manage_options' ) ){
1878 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
1879 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
1880 }
1881 $content[] = '</div>';
1882 $content[] = '</form>';
1883
1884 $content[] = '</div>';
1885
1886 $content[] = '</div>';
1887
1888 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
1889
1890 $content[] = '<div id="ays-survey-countdown-main-container">';
1891 $content[] = '<div class="ays-survey-countdown-container">';
1892
1893 $content[] = '<div ' . $style_attr . ' id="ays-survey-countdown">';
1894
1895 $content[] = '<ul>';
1896
1897 $content[] = '<li><span id="ays-survey-countdown-days"></span></li>';
1898 $content[] = '<li><span id="ays-survey-countdown-hours"></span></li>';
1899 $content[] = '<li><span id="ays-survey-countdown-minutes"></span></li>';
1900 $content[] = '<li><span id="ays-survey-countdown-seconds"></span></li>';
1901 $content[] = '</ul>';
1902 $content[] = '</div>';
1903
1904 $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
1905 $content[] = '</div>';
1906
1907 $content[] = '</div>';
1908 $content[] = '</div>';
1909
1910 $content[] = '</div>';
1911
1912 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
1913 $content[] = '<div class="ays-survey-dicount-banner-coupon-box" onclick="aysSurveyBundleCopyToClipboard(\'SURVEYPRO20\')" title="' . __( 'Click to copy coupon code', "survey-maker" ) . '">';
1914 $content[] = '<span class="ays-survey-dicount-banner-coupon-text">SURVEYPRO20</span>';
1915 $content[] = '<svg class="ays-survey-dicount-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
1916 $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"/>';
1917 $content[] = '</svg>';
1918 $content[] = '</div>';
1919 $content[] = '</div>';
1920
1921 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
1922 $content[] = '<a href="'. $survey_cta_button_link .'" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now', 'survey-maker' ) . '</a>';
1923 $content[] = '<span class="ays-survey-dicount-one-time-text">';
1924 $content[] = __( "One-time payment", 'survey-maker' );
1925 $content[] = '</span>';
1926 $content[] = '</div>';
1927 $content[] = '</div>';
1928 $content[] = '</div>';
1929
1930 $content[] = '<script>';
1931 $content[] = "
1932 function aysSurveyBundleCopyToClipboard(text) {
1933 var textarea = document.createElement('textarea');
1934 textarea.value = text;
1935 textarea.style.position = 'fixed';
1936 textarea.style.opacity = '0';
1937 document.body.appendChild(textarea);
1938
1939 textarea.select();
1940 textarea.setSelectionRange(0, 99999);
1941
1942 try {
1943 document.execCommand('copy');
1944 aysSurveyBundleShowCopyNotification('" . __( 'Coupon code copied!', "survey-maker" ) . "');
1945 } catch (err) {
1946 console.error('Failed to copy text: ', err);
1947 }
1948
1949 document.body.removeChild(textarea);
1950 }
1951
1952 function aysSurveyBundleShowCopyNotification(message) {
1953 var existingNotification = document.querySelector('.ays-survey-dicount-banner-copy-notification');
1954 if (existingNotification) {
1955 document.body.removeChild(existingNotification);
1956 }
1957
1958 var notification = document.createElement('div');
1959 notification.className = 'ays-survey-dicount-banner-copy-notification';
1960 notification.textContent = message;
1961 document.body.appendChild(notification);
1962
1963 setTimeout(function() {
1964 notification.classList.add('show');
1965 }, 10);
1966
1967 setTimeout(function() {
1968 notification.classList.remove('show');
1969 setTimeout(function() {
1970 if (notification.parentNode) {
1971 document.body.removeChild(notification);
1972 }
1973 }, 300);
1974 }, 2000);
1975 }";
1976 $content[] = '</script>';
1977
1978 // /* New Mega Bundle Banner Survey | Start */
1979 $content[] = '<style id="ays-survey-mega-bundle-styles-inline-css">';
1980 $content[] = '
1981 div#ays-survey-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-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info button{display:flex;align-items:center}div#ays-survey-new-mega-bundle-dicount-month-main div#ays-survey-dicount-month a.ays-survey-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-survey-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-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info{background-image:url("'. SURVEY_MAKER_ADMIN_URL .'/images/new-mega-bundle-logo-background-20.svg");background-position:center right;background-repeat:no-repeat;background-size:cover;background-color:#5551ff;padding:1px 38px 1px 12px}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month{display:flex;align-items:center;justify-content:space-between;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month img{width:60px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-sale-banner-link{display:flex;justify-content:center;align-items:center;width:60px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:14px;padding:12px;text-align:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{text-align:left;width:auto;display:flex;justify-content:space-around;align-items:flex-start}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:30%;display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{width:20%;display:flex;justify-content:center;align-items:center;flex-direction:column}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-logo-box{display:flex;justify-content:flex-start;align-items:center;gap:20px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title{color:#fdfdfd;font-size:19px;font-style:normal;font-weight:600;line-height:normal}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title-icon-row{display:inline-block}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-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-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-color{color:#971821}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-text-decoration{text-decoration:underline}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-button,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-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-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content{display:flex;justify-content:center}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{width:19%}#ays-survey-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-survey-countdown-main-container .ays-survey-countdown-container{margin:0 auto;text-align:center}#ays-survey-countdown-main-container #ays-survey-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-survey-countdown-main-container li,#ays-survey-countdown-main-container ul{margin:0}#ays-survey-countdown-main-container li{display:inline-block;font-size:14px;list-style-type:none;padding:14px;text-transform:lowercase}#ays-survey-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-survey-countdown-main-container .emoji{display:none;padding:1rem}#ays-survey-countdown-main-container .emoji span{font-size:30px;padding:0 .5rem}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li{position:relative}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{content:":";color:#fff;position:absolute;top:0;right:-5px;font-size:40px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span#ays-survey-countdown-seconds:after{content:unset}#ays-survey-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-survey-new-mega-bundle-dicount-month-main button.notice-dismiss:before{color:#fff;content:"\f00d";font-family:fontawesome;font-size:22px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-guaranteeicon{width:30px;margin-right:5px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-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-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{display:none!important;background-position:bottom right;background-repeat:no-repeat;background-size:cover;border-radius:32px}div#ays-survey-new-mega-bundle-dicount-month-main{padding-right:0}div#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_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-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{width:100%!important;text-align:center}#ays-survey-countdown-main-container #ays-survey-countdown-headline{font-size:15px;font-weight:600}#ays-survey-countdown-main-container ul{font-weight:500}div#ays-survey-countdown-main-container li{padding:10px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-mobile-image-display-none{display:none!important}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-mobile-image-display-block{display:block!important;margin-top:5px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:100%!important;text-align:center;flex-direction:column;margin-top:20px;justify-content:center;align-items:center}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{top:unset}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:100%;display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-button{margin:0 auto!important}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{padding-left:unset!important}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{display:none}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dismiss-buttons-container-for-form{position:static!important}.comparison .product img{width:70px}.ays-survey-features-wrap .comparison a.price-buy{padding:8px 5px;font-size:11px}}@media screen and (max-width:1350px) and (min-width:768px){div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box strong{font-size:15px}#ays-survey-countdown-main-container li{font-size:11px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{display:none}}@media screen and (max-width:1680px) and (min-width:1551px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:29%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:30%}}@media screen and (max-width:1410px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:150px}}@media screen and (max-width:1550px) and (min-width:1400px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:35%}}@media screen and (max-width:1400px) and (min-width:1250px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:35%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:40%}}@media screen and (max-width:1274px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title{font-size:15px}}@media screen and (max-width:1200px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{margin-bottom:16px}#ays-survey-countdown-main-container ul{padding-left:0}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:120px;font-size:18px}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 20px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:12px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-desc{font-size:13px}}@media screen and (max-width:1076px) and (min-width:769px){#ays-survey-countdown-main-container li{padding:10px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:100px;font-size:16px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{margin-bottom:16px}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 15px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:11px;padding:12px 0}}@media screen and (max-width:1250px) and (min-width:769px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:45%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:35%}}';
1982
1983 $content[] = '
1984 .ays-survey-dicount-banner-coupon-box {
1985 border: 2px dashed rgba(255, 255, 255, 0.4);
1986 padding: 8px 16px;
1987 border-radius: 6px;
1988 background: rgba(255, 255, 255, 0.1);
1989 cursor: pointer;
1990 transition: all 0.3s;
1991 display: flex;
1992 align-items: center;
1993 gap: 8px;
1994 backdrop-filter: blur(10px);
1995 }
1996
1997 .ays-survey-dicount-banner-coupon-box:hover {
1998 background: rgba(255, 255, 255, 0.2);
1999 border-color: rgba(255, 255, 255, 0.6);
2000 transform: translateY(-1px);
2001 }
2002
2003 .ays-survey-dicount-banner-coupon-text {
2004 font-size: 16px;
2005 font-weight: 700;
2006 letter-spacing: 1px;
2007 color: #fff;
2008 font-family: monospace;
2009 }
2010
2011 .ays-survey-dicount-banner-copy-icon {
2012 opacity: 0.8;
2013 transition: opacity 0.3s;
2014 }
2015
2016 .ays-survey-dicount-banner-coupon-box:hover .ays-survey-dicount-banner-copy-icon {
2017 opacity: 1;
2018 }
2019
2020 .ays-survey-dicount-banner-btn-arrow {
2021 display: inline-block;
2022 transition: transform 0.3s;
2023 }
2024
2025 .ays-survey-dicount-banner-buy-now-btn:hover .ays-survey-dicount-banner-btn-arrow {
2026 transform: translateX(4px);
2027 }
2028
2029 /* Notification */
2030 .ays-survey-dicount-banner-copy-notification {
2031 position: fixed;
2032 top: 50%;
2033 left: 50%;
2034 transform: translate(-50%, -50%);
2035 background: rgba(0, 0, 0, 0.8);
2036 color: #fff;
2037 padding: 12px 24px;
2038 border-radius: 8px;
2039 font-size: 14px;
2040 z-index: 10000;
2041 opacity: 0;
2042 transition: opacity 0.3s;
2043 }
2044
2045 .ays-survey-dicount-banner-copy-notification.show {
2046 opacity: 1;
2047 }';
2048 $content[] = '</style>';
2049 // /* New Mega Bundle Banner Survey | End */
2050
2051 $content = implode( '', $content );
2052 echo ($content);
2053 }
2054 }
2055
2056 // Christmas Banner 2025
2057 public static function ays_survey_christmas_banner_message_2025($ishmar){
2058 if($ishmar == 0 ){
2059 $content = array();
2060
2061 $svg_icon = '<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2062 <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"/>
2063 </svg>
2064 ';
2065
2066 $ays_survey_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=christmas-sale-banner-' . SURVEY_MAKER_VERSION);
2067
2068 $content[] = '<div id="ays-survey-christmas-banner-main" class="notice notice-success is-dismissible ays-survey-christmas-banner-info ays_survey_dicount_info">';
2069 $content[] = '<div id="ays-survey-christmas-banner-month" class="ays-survey-christmas-banner-month">';
2070
2071 // Background effects
2072 $content[] = '<div class="ays-survey-christmas-banner-bg-effects">';
2073 $content[] = '<div class="ays-survey-christmas-banner-bg-gradient-1"></div>';
2074 $content[] = '<div class="ays-survey-christmas-banner-bg-gradient-2"></div>';
2075
2076 // Snowflakes
2077 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 5%; animation-delay: 0s; animation-duration: 8s;">'. $svg_icon .'</div>';
2078 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 15%; animation-delay: 2s; animation-duration: 10s;">'. $svg_icon .'</div>';
2079 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 25%; animation-delay: 4s; animation-duration: 9s;">'. $svg_icon .'</div>';
2080 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 75%; animation-delay: 1s; animation-duration: 11s;">'. $svg_icon .'</div>';
2081 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 85%; animation-delay: 3s; animation-duration: 8s;">'. $svg_icon .'</div>';
2082 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 92%; animation-delay: 5s; animation-duration: 10s;">'. $svg_icon .'</div>';
2083
2084 // Sparkles
2085 $content[] = '<svg class="ays-survey-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">';
2086 $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"/>';
2087 $content[] = '</svg>';
2088 $content[] = '<svg class="ays-survey-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">';
2089 $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"/>';
2090 $content[] = '</svg>';
2091 $content[] = '<svg class="ays-survey-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">';
2092 $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"/>';
2093 $content[] = '</svg>';
2094 $content[] = '</div>';
2095
2096 // Main content
2097 $content[] = '<div class="ays-survey-christmas-banner-content">';
2098 $content[] = '<div class="ays-survey-christmas-banner-left">';
2099 // Gift icon with hat
2100 $content[] = '<div class="ays-survey-christmas-banner-gift-wrapper">';
2101 $content[] = '<svg class="ays-survey-christmas-banner-gift-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">';
2102 $content[] = '<rect x="3" y="8" width="18" height="4" rx="1"></rect>';
2103 $content[] = '<path d="M12 8v13"></path>';
2104 $content[] = '<path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path>';
2105 $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>';
2106 $content[] = '</svg>';
2107 $content[] = '<div class="ays-survey-christmas-banner-hat">';
2108 $content[] = '<svg viewBox="0 0 24 24" fill="none" class="ays-survey-christmas-banner-hat-svg">';
2109 $content[] = '<path d="M12 2L4 14h16L12 2z" fill="hsl(0 80% 45%)"></path>';
2110 $content[] = '<path d="M4 14c0 2 3.5 3 8 3s8-1 8-3" fill="hsl(0 0% 100%)"></path>';
2111 $content[] = '<circle cx="12" cy="3" r="2" fill="hsl(0 0% 100%)"></circle>';
2112 $content[] = '</svg>';
2113 $content[] = '</div>';
2114 $content[] = '</div>';
2115
2116 $content[] = '<div class="ays-survey-christmas-banner-special-label">';
2117 $content[] = '<div class="ays-survey-christmas-banner-special-label-name">';
2118 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-christmas-banner-special-label-name-link" target="_blank">';
2119 $content[] = __( 'Survey Maker', "survey-maker" );
2120 $content[] = '</a>';
2121 $content[] = '</div>';
2122
2123 $content[] = '<div>✦ ' . __( 'CHRISTMAS SPECIAL', "survey-maker" ) . ' ✦</div>';
2124 $content[] = '</div>';
2125 $content[] = '</div>';
2126
2127 $content[] = '<div class="ays-survey-christmas-banner-center">';
2128 $content[] = '<div class="ays-survey-christmas-banner-discount-text">25% OFF</div>';
2129 $content[] = '<div class="ays-survey-christmas-banner-limited-offer">' . __( 'Limited time offer', "survey-maker" ) . '</div>';
2130 $content[] = '</div>';
2131
2132 $content[] = '<div class="ays-survey-christmas-banner-right">';
2133 $content[] = '<div class="ays-survey-christmas-banner-coupon-box" onclick="aysSurveyChristmasCopyToClipboard(\'XMAS25\')" title="' . __( 'Click to copy', "survey-maker" ) . '">';
2134 $content[] = '<span class="ays-survey-christmas-banner-coupon-text">XMAS25</span>';
2135 $content[] = '<svg class="ays-survey-christmas-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
2136 $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"/>';
2137 $content[] = '</svg>';
2138 $content[] = '</div>';
2139
2140 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-christmas-banner-buy-now-btn" target="_blank">';
2141 $content[] = __( 'Buy Now', "survey-maker" );
2142 $content[] = '</a>';
2143 $content[] = '</div>';
2144 $content[] = '</div>';
2145
2146 $content[] = '</div>';
2147
2148 if( current_user_can( 'manage_options' ) ){
2149 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2150 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
2151 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="color: darkgrey; font-size: 11px; padding: 0 .75rem;">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
2152 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2153 $content[] = '</form>';
2154 $content[] = '</div>';
2155 }
2156
2157 $content[] = '</div>';
2158
2159 $content[] = '<script>';
2160 $content[] = "
2161 function aysSurveyChristmasCopyToClipboard(text) {
2162 var textarea = document.createElement('textarea');
2163 textarea.value = text;
2164 textarea.style.position = 'fixed';
2165 textarea.style.opacity = '0';
2166 document.body.appendChild(textarea);
2167
2168 textarea.select();
2169 textarea.setSelectionRange(0, 99999);
2170
2171 try {
2172 document.execCommand('copy');
2173 aysSurveyChristmasShowCopyNotification('" . __( 'Coupon code copied!', "survey-maker" ) . "');
2174 } catch (err) {
2175 console.error('Failed to copy text: ', err);
2176 }
2177
2178 document.body.removeChild(textarea);
2179 }
2180
2181 function aysSurveyChristmasShowCopyNotification(message) {
2182 var existingNotification = document.querySelector('.ays-survey-christmas-banner-copy-notification');
2183 if (existingNotification) {
2184 document.body.removeChild(existingNotification);
2185 }
2186
2187 var notification = document.createElement('div');
2188 notification.className = 'ays-survey-christmas-banner-copy-notification';
2189 notification.textContent = message;
2190 document.body.appendChild(notification);
2191
2192 setTimeout(function() {
2193 notification.classList.add('show');
2194 }, 10);
2195
2196 setTimeout(function() {
2197 notification.classList.remove('show');
2198 setTimeout(function() {
2199 if (notification.parentNode) {
2200 document.body.removeChild(notification);
2201 }
2202 }, 300);
2203 }, 2000);
2204 }";
2205 $content[] = '</script>';
2206
2207 $content[] = '<style>';
2208 $content[] = '
2209 /* Christmas banner start */
2210
2211 div#ays-survey-christmas-banner-main .btn-link {
2212 background-color: transparent;
2213 display: inline-block;
2214 font-weight: 400;
2215 text-align: center;
2216 white-space: nowrap;
2217 vertical-align: middle;
2218 -webkit-user-select: none;
2219 -moz-user-select: none;
2220 -ms-user-select: none;
2221 user-select: none;
2222 border: 1px solid transparent;
2223 padding: .375rem .75rem;
2224 font-size: 12px;
2225 line-height: 1.5;
2226 border-radius: .25rem;
2227 color: rgba(255, 255, 255, .6);
2228 }
2229
2230 div#ays-survey-christmas-banner-main.ays-survey-christmas-banner-info {
2231 background: linear-gradient(to right, hsl(0, 70%, 28%), hsl(0, 65%, 38%), hsl(0, 70%, 28%));
2232 padding: unset;
2233 border-left: 0;
2234 position: relative;
2235 }
2236
2237 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-month {
2238 position: relative;
2239 padding: 15px 40px;
2240 overflow: hidden;
2241 }
2242
2243 /* Background effects */
2244 .ays-survey-christmas-banner-bg-effects {
2245 position: absolute;
2246 top: 0;
2247 left: 0;
2248 right: 0;
2249 bottom: 0;
2250 pointer-events: none;
2251 z-index: 1;
2252 }
2253
2254 .ays-survey-christmas-banner-bg-gradient-1 {
2255 position: absolute;
2256 top: 0;
2257 left: 30%;
2258 width: 40%;
2259 height: 100%;
2260 background: radial-gradient(circle, rgba(202, 43, 43, 0.5) 0%, transparent 60%);
2261 opacity: 0.4;
2262 }
2263
2264 .ays-survey-christmas-banner-bg-gradient-2 {
2265 position: absolute;
2266 top: 0;
2267 right: 15%;
2268 width: 35%;
2269 height: 100%;
2270 background: radial-gradient(circle, rgba(246, 201, 85, 0.15) 0%, transparent 50%);
2271 opacity: 0.3;
2272 }
2273
2274 .ays-survey-christmas-banner-snowflake {
2275 position: absolute;
2276 color: rgba(255, 255, 255, 0.2);
2277 font-size: 20px;
2278 animation: ays-survey-christmas-snowfall linear infinite;
2279 top: -10px;
2280 }
2281
2282 @keyframes ays-survey-christmas-snowfall {
2283 0% {
2284 transform: translateY(-10px) rotate(0deg);
2285 opacity: 0;
2286 }
2287 10% {
2288 opacity: 0.8;
2289 }
2290 90% {
2291 opacity: 0.8;
2292 }
2293 100% {
2294 transform: translateY(100%) rotate(360deg);
2295 opacity: 0;
2296 }
2297 }
2298
2299 .ays-survey-christmas-banner-sparkle {
2300 position: absolute;
2301 color: hsl(43, 90%, 65%);
2302 animation: ays-survey-christmas-twinkle 2s ease-in-out infinite;
2303 }
2304
2305 @keyframes ays-survey-christmas-twinkle {
2306 0%, 100% {
2307 opacity: 0.3;
2308 transform: scale(0.8);
2309 }
2310 50% {
2311 opacity: 1;
2312 transform: scale(1.2);
2313 }
2314 }
2315
2316 /* Main content */
2317 .ays-survey-christmas-banner-content {
2318 position: relative;
2319 display: flex;
2320 align-items: center;
2321 justify-content: space-between;
2322 z-index: 2;
2323 }
2324
2325 /* Left section */
2326 .ays-survey-christmas-banner-left {
2327 display: flex;
2328 align-items: center;
2329 gap: 50px;
2330 }
2331
2332 .ays-survey-christmas-banner-gift-wrapper {
2333 position: relative;
2334 animation: ays-survey-christmas-float 3s ease-in-out infinite;
2335 }
2336
2337 .ays-survey-christmas-banner-gift-icon {
2338 width: 48px;
2339 height: 48px;
2340 color: rgba(255, 247, 237, 0.9);
2341 }
2342
2343 @keyframes ays-survey-christmas-float {
2344 0%, 100% {
2345 transform: translateY(0);
2346 }
2347 50% {
2348 transform: translateY(-5px);
2349 }
2350 }
2351
2352 .ays-survey-christmas-banner-hat {
2353 position: absolute;
2354 top: -12px;
2355 right: -4px;
2356 width: 24px;
2357 height: 24px;
2358 }
2359
2360 .ays-survey-christmas-banner-hat-svg {
2361 width: 100%;
2362 height: 100%;
2363 }
2364
2365 .ays-survey-christmas-banner-special-label {
2366 color: hsl(43, 90%, 65%);
2367 font-size: 14px;
2368 font-weight: 500;
2369 text-transform: uppercase;
2370 letter-spacing: 1px;
2371 /* font-family: "Outfit", sans-serif; */
2372 }
2373
2374 .ays-survey-christmas-banner-special-label-name {
2375 color: #fffaf0;
2376 text-align: center;
2377 }
2378
2379 div#ays-survey-christmas-banner-main .ays-survey-christmas-banner-special-label-name-link {
2380 color: #fffaf0;
2381 box-shadow: unset;
2382 }
2383
2384 /* Center section */
2385 .ays-survey-christmas-banner-center {
2386 display: flex;
2387 flex-direction: row;
2388 text-align: center;
2389 justify-content: center;
2390 align-items: center;
2391 gap: 30px;
2392 }
2393
2394 .ays-survey-christmas-banner-discount-text {
2395 font-family: "Outfit", sans-serif;
2396 font-weight: 800;
2397 font-size: 30px;
2398 color: hsl(40, 100%, 97%);
2399 letter-spacing: -1px;
2400 line-height: 1;
2401 }
2402
2403 .ays-survey-christmas-banner-limited-offer {
2404 color: rgba(255, 247, 237, 0.7);
2405 font-size: 13px;
2406 font-weight: 500;
2407 }
2408
2409 /* Right section */
2410 .ays-survey-christmas-banner-right {
2411 display: flex;
2412 align-items: center;
2413 gap: 20px;
2414 }
2415
2416 .ays-survey-christmas-banner-coupon-box {
2417 border: 2px dashed rgba(255, 255, 255, 0.4);
2418 padding: 8px 16px;
2419 border-radius: 6px;
2420 background: rgba(255, 255, 255, 0.1);
2421 cursor: pointer;
2422 transition: all 0.3s;
2423 display: flex;
2424 align-items: center;
2425 gap: 8px;
2426 backdrop-filter: blur(10px);
2427 }
2428
2429 .ays-survey-christmas-banner-coupon-box:hover {
2430 background: rgba(255, 255, 255, 0.2);
2431 border-color: rgba(255, 255, 255, 0.6);
2432 transform: translateY(-1px);
2433 }
2434
2435 .ays-survey-christmas-banner-coupon-text {
2436 font-size: 16px;
2437 font-weight: 700;
2438 letter-spacing: 1px;
2439 color: #fff;
2440 font-family: monospace;
2441 }
2442
2443 .ays-survey-christmas-banner-copy-icon {
2444 opacity: 0.8;
2445 transition: opacity 0.3s;
2446 }
2447
2448 .ays-survey-christmas-banner-coupon-box:hover .ays-survey-christmas-banner-copy-icon {
2449 opacity: 1;
2450 }
2451
2452 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-buy-now-btn {
2453 background-color: #fbe19f;
2454 color: hsl(0, 72%, 35%);
2455 padding: 10px 30px;
2456 border-radius: 9999px;
2457 font-size: 16px;
2458 font-weight: 600;
2459 font-family: "Outfit", sans-serif;
2460 border: none;
2461 cursor: pointer;
2462 transition: all 0.3s;
2463 text-decoration: none;
2464 display: flex;
2465 align-items: center;
2466 gap: 6px;
2467 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 30px rgba(246, 201, 85, 0.2);
2468 }
2469
2470 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-buy-now-btn:hover {
2471 background-color: #f2d58c;
2472 transform: scale(1.05);
2473 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 40px rgba(246, 201, 85, 0.3);
2474 }
2475
2476 .ays-survey-christmas-banner-btn-arrow {
2477 display: inline-block;
2478 transition: transform 0.3s;
2479 }
2480
2481 .ays-survey-christmas-banner-buy-now-btn:hover .ays-survey-christmas-banner-btn-arrow {
2482 transform: translateX(4px);
2483 }
2484
2485 /* Notification */
2486 .ays-survey-christmas-banner-copy-notification {
2487 position: fixed;
2488 top: 50%;
2489 left: 50%;
2490 transform: translate(-50%, -50%);
2491 background: rgba(0, 0, 0, 0.8);
2492 color: #fff;
2493 padding: 12px 24px;
2494 border-radius: 8px;
2495 font-size: 14px;
2496 z-index: 10000;
2497 opacity: 0;
2498 transition: opacity 0.3s;
2499 }
2500
2501 .ays-survey-christmas-banner-copy-notification.show {
2502 opacity: 1;
2503 }
2504
2505 /* Dismiss button */
2506 #ays-survey-christmas-banner-main #ays-survey-christmas-banner-dismiss-content {
2507 display: flex;
2508 justify-content: center;
2509 }
2510
2511 #ays-survey-christmas-banner-main #ays-survey-christmas-banner-dismiss-content .ays-button {
2512 margin: 0 !important;
2513 font-size: 13px;
2514 color: rgba(150, 147, 147, 0.69);
2515 }
2516
2517 /* Responsive */
2518 @media (max-width: 1024px) {
2519 .ays-survey-christmas-banner-discount-text {
2520 font-size: 40px;
2521 }
2522 .ays-survey-christmas-banner-content {
2523 flex-wrap: wrap;
2524 }
2525 }
2526
2527 @media (max-width: 768px) {
2528 #ays-survey-christmas-banner-main {
2529 display: none !important;
2530 }
2531 }
2532 /* Christmas banner end */
2533 ';
2534 $content[] = '</style>';
2535
2536 $content = implode( '', $content );
2537
2538 echo $content;
2539 }
2540 }
2541
2542 // Black Friday
2543 public static function ays_survey_black_friday_message($ishmar){
2544 if($ishmar == 0 ){
2545 $content = array();
2546
2547 $ays_survey_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=black-friday-sale-banner-' . SURVEY_MAKER_VERSION);
2548
2549 $content[] = '<div id="ays-survey-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
2550 $content[] = '<div id="ays-survey-dicount-black-friday-month" class="ays_survey_dicount_month">';
2551 $content[] = '<div class="ays-survey-dicount-black-friday-box">';
2552 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-box-80" style="width: 70%;">';
2553 $content[] = '<div class="">';
2554 $content[] = '<div class="ays-survey-dicount-black-friday-title-row" >' . __( 'Coupon Code', "survey-maker" ) .' ' . '</div>';
2555 $content[] = '<div class="ays-survey-dicount-black-friday-title-row">';
2556
2557 $content[] = '
2558 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-wrapper">
2559 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-box" onclick="aysSurveyHalloweenCopyToClipboard(\'FREE2PROBF\')" title="Click to copy">
2560 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-text">FREE2PROBF</span>
2561 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-survey-dicount-black-friday-banner-2025-copy-icon">
2562 <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"/>
2563 </svg>
2564 </span>
2565 </span>';
2566 $content[] = '</div> ';
2567 $content[] = '</div>';
2568
2569 $content[] = '</div>';
2570
2571 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-text-box">';
2572 $content[] = '<div class="ays-survey-dicount-black-friday-text-row">' . '30% off' . '</div>';
2573 $content[] = '</div>';
2574
2575 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
2576 $content[] = '<div id="ays-survey-countdown-main-container">';
2577 $content[] = '<div class="ays-survey-countdown-container">';
2578 $content[] = '<div id="ays-survey-countdown" style="display: block;">';
2579 $content[] = '<ul>';
2580 $content[] = '<li><span id="ays-survey-countdown-days"></span>' . __( 'Days', "survey-maker" ) . '</li>';
2581 $content[] = '<li><span id="ays-survey-countdown-hours"></span>' . __( 'Hours', "survey-maker" ) . '</li>';
2582 $content[] = '<li><span id="ays-survey-countdown-minutes"></span>' . __( 'Minutes', "survey-maker" ) . '</li>';
2583 $content[] = '<li><span id="ays-survey-countdown-seconds"></span>' . __( 'Seconds', "survey-maker" ) . '</li>';
2584 $content[] = '</ul>';
2585 $content[] = '</div>';
2586 $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
2587 $content[] = '<span></span>';
2588 $content[] = '<span></span>';
2589 $content[] = '<span></span>';
2590 $content[] = '<span></span>';
2591 $content[] = '</div>';
2592 $content[] = '</div>';
2593 $content[] = '</div>';
2594 $content[] = '</div>';
2595
2596 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
2597 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-dicount-black-friday-button-buy-now" target="_blank">' . __( 'Get Your Deal', "survey-maker" ) . '</a>';
2598 $content[] = '</div>';
2599 $content[] = '</div>';
2600 $content[] = '</div>';
2601
2602 $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-black-friday">';
2603 $content[] = '<form action="" method="POST">';
2604 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2605 if( current_user_can( 'manage_options' ) ){
2606 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
2607 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2608 }
2609 $content[] = '</div>';
2610 $content[] = '</form>';
2611 $content[] = '</div>';
2612 $content[] = '</div>';
2613
2614 $content[] = '<script>';
2615 $content[] = "
2616 function aysSurveyHalloweenCopyToClipboard(text) {
2617 // Create a temporary textarea element
2618 var textarea = document.createElement('textarea');
2619 textarea.value = text;
2620 textarea.style.position = 'fixed';
2621 textarea.style.opacity = '0';
2622 document.body.appendChild(textarea);
2623
2624 // Select and copy the text
2625 textarea.select();
2626 textarea.setSelectionRange(0, 99999); // For mobile devices
2627
2628 try {
2629 document.execCommand('copy');
2630 aysSurveyHalloweenShowCopyNotification('Coupon code copied!');
2631 } catch (err) {
2632 console.error('Failed to copy text: ', err);
2633 }
2634
2635 // Remove the temporary textarea
2636 document.body.removeChild(textarea);
2637 }
2638
2639 function aysSurveyHalloweenShowCopyNotification(message) {
2640 // Check if notification already exists
2641 var existingNotification = document.querySelector('.ays-survey-discount-black-friday-banner-2025-copy-notification');
2642 if (existingNotification) {
2643 document.body.removeChild(existingNotification);
2644 }
2645
2646 // Create notification element
2647 var notification = document.createElement('div');
2648 notification.className = 'ays-survey-discount-black-friday-banner-2025-copy-notification';
2649 notification.textContent = message;
2650 document.body.appendChild(notification);
2651
2652 // Show notification with animation
2653 setTimeout(function() {
2654 notification.classList.add('show');
2655 }, 10);
2656
2657 // Hide and remove notification after 2 seconds
2658 setTimeout(function() {
2659 notification.classList.remove('show');
2660 setTimeout(function() {
2661 if (notification.parentNode) {
2662 document.body.removeChild(notification);
2663 }
2664 }, 300);
2665 }, 2000);
2666 }";
2667 $content[] = '</script>';
2668
2669 $content[] = '<style>';
2670 $content[] = '
2671 /* Black friday banner start */
2672 div#ays-survey-dicount-black-friday-month-main *{color:#fff}div#ays-survey-dicount-black-friday-month-main div#ays-survey-dicount-black-friday-month a.ays-survey-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-survey-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-survey-dicount-black-friday-month-main.ays_survey_dicount_info{background-image:linear-gradient(45deg,#1e101d,#c60af4);padding:unset;border-left:0}#ays-survey-dicount-black-friday-month-main .ays_survey_dicount_month{position:relative;background-image:url("'. esc_attr(SURVEY_MAKER_ADMIN_URL) .'/images/black-friday-plugins-background-image.webp");background-position:center right;background-repeat:no-repeat;background-size:100% 100%}#ays-survey-dicount-black-friday-month-main .ays_survey_dicount_month img{width:80px}#ays-survey-dicount-black-friday-month-main .ays-survey-sale-banner-link{display:flex;justify-content:center;align-items:center;width:200px}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-sale{font-style:normal;font-weight:600;font-size:24px;text-align:center;color:#b2ff00;text-transform:uppercase}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box{font-size:14px;padding:12px;text-align:center;width:50%;white-space:nowrap}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-color{color:#971821}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-text-decoration{text-decoration:underline}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box .ays-button,#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-survey-dicount-black-friday-month-main .ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-survey-dicount-black-friday-month-main #ays-survey-dismiss-buttons-content{display:flex;justify-content:center}#ays-survey-dicount-black-friday-month-main #ays-survey-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#969393b0}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-opacity-box{width:19%}#ays-survey-dicount-black-friday-month-main .ays-buy-now-opacity-button{padding:40px 15px;display:flex;justify-content:center;align-items:center;opacity:0}#ays-survey-countdown-main-container .ays-survey-countdown-container{margin:0 auto;text-align:center}#ays-survey-countdown-main-container #ays-survey-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-survey-countdown-main-container li,#ays-survey-countdown-main-container ul{margin:0;font-weight:600}#ays-survey-countdown-main-container li{display:inline-block;font-size:10px;list-style-type:none;padding:10px;text-transform:uppercase}#ays-survey-countdown-main-container li span{display:block;font-size:22px;min-height:33px}#ays-survey-countdown-main-container .emoji{display:none;padding:1rem}#ays-survey-countdown-main-container .emoji span{font-size:25px;padding:0 .5rem}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-box{display:flex;justify-content:space-between;align-items:center;width:95%;margin:auto}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-title-row{text-align:center;padding-right:50px;font-style:normal;font-weight:900;font-size:19px;color:#fff;}#ays-survey-dicount-black-friday-month-main .ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-text-box{position:absolute;width:25%;top:10px;bottom:0;right:0;left:0;margin:0 auto}#ays-survey-countdown ul{padding:0}#ays-survey-dicount-black-friday-month-main .ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-discount-black-friday-banner-2025-coupon-text{font-size:14px;font-weight:700;letter-spacing:1px;color:#fff;font-family:monospace}#ays-survey-dicount-black-friday-month-main .ays-survey-discount-black-friday-banner-2025-copy-icon{opacity:.8;transition:opacity .3s}#ays-survey-dicount-black-friday-month-main .ays-survey-discount-black-friday-banner-banner-2025-coupon-box:hover .ays-survey-discount-black-friday-banner-2025-copy-icon,.ays-survey-discount-black-friday-banner-2025-copy-notification.show{opacity:1}.ays-survey-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-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-title-row{font-size:15px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-text-row{font-size:27px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-box{width:100%}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-buy-now{font-size:13px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box-80{width:80%!important}}@media all and (max-width:1200px){div#ays-survey-dicount-black-friday-month-main .ays_survey_dicount_month{background:unset}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-text-row{font-size:30px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-box{width:100%}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-buy-now{font-size:15px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box-80{width:80%!important}}@media all and (max-width:1200px) and (min-width:1150px){div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-title-row{font-size:15px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-buy-now{font-size:10px}}@media all and (max-width:1150px){div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box-80{width:80%!important}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-box{flex-direction:column}div#ays-survey-dicount-black-friday-month-main{padding-right:0}div#ays-survey-dicount-black-friday-month-main .ays_survey_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-survey-dicount-black-friday-month-main div.ays-survey-dicount-black-friday-wrap-box{width:100%!important;text-align:center}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-title-row,div#ays-survey-dicount-black-friday-month-main #ays-survey-countdown-main-container ul{padding:0;font-size:13px}#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-sale,div#ays-survey-countdown-main-container li{font-size:15px}div#ays-survey-countdown-main-container li span{font-size:25px}div#ays-survey-dicount-black-friday-month-main div.ays-survey-dicount-black-friday-wrap-text-box{position:unset}#ays-survey-countdown-main-container #ays-survey-countdown-headline{font-size:15px;font-weight:600}#ays-survey-countdown-main-container ul{font-weight:500}#ays-survey-countdown-main-container li span{font-size:20px}#ays-survey-dicount-black-friday-month-main .ays-button{margin:0 auto!important}div#ays-survey-dicount-black-friday-month-main.ays_survey_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-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-survey-dicount-black-friday-month-main .ays-survey-dicount-black-friday-button-buy-now{padding:10px 18px;font-size:15px}}@media all and (max-width:768px){#ays-survey-dicount-black-friday-month-main{display:none!important}}
2673 ';
2674 $content[] = '</style>';
2675
2676 $content = implode( '', $content );
2677
2678 echo $content;
2679 }
2680 }
2681
2682 // Halloween Bundle 2025
2683 public function ays_survey_new_halloween_bundle_message_2025($ishmar){
2684 if($ishmar == 0 ){
2685 $content = array();
2686
2687 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2688 $now_date = date('M d, Y H:i:s', $date);
2689
2690 $start_date = strtotime('2025-09-08 00:00:01');
2691 $end_date = strtotime('2025-11-07 23:59:59');
2692 $diff_end = $end_date - $date;
2693
2694 $style_attr = '';
2695 if( $diff_end < 0 ){
2696 $style_attr = 'style="display:none;"';
2697 }
2698
2699 $ays_survey_cta_button_link = esc_url('https://ays-pro.com/halloween-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=survey-halloween-banner-' . SURVEY_MAKER_VERSION);
2700
2701 $content[] = '
2702 <div id="ays-survey-halloween-banner-2025-main" class="ays-survey-halloween-banner-2025-main ays_survey_dicount_info notice notice-success is-dismissible">
2703 <div class="ays-survey-halloween-banner-2025-content">
2704 <div class="ays-survey-halloween-banner-2025-left">
2705 <div class="ays-survey-halloween-banner-2025-text">
2706 <h2 class="ays-survey-halloween-banner-2025-title">Boo! Grab Your <a href="'. $ays_survey_cta_button_link .'" class="" target="_blank">Halloween Deal</a> <br/> Before It Vanishes!</h2>
2707 <p class="ays-survey-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>
2708 </div>
2709 </div>
2710
2711 <div class="ays-survey-halloween-banner-2025-center">';
2712
2713 $content[] = '<div id="ays-survey-halloween-banner-2025-countdown" class="ays-survey-halloween-banner-2025-countdown" ' . $style_attr . '>';
2714 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-timer">';
2715 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2716 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-days">00</div>';
2717 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('days', 'survey-maker') . '</div>';
2718 $content[] = '</div>';
2719 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2720 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2721 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-hours">00</div>';
2722 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('hours', 'survey-maker') . '</div>';
2723 $content[] = '</div>';
2724 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2725 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2726 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-minutes">00</div>';
2727 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('minutes', 'survey-maker') . '</div>';
2728 $content[] = '</div>';
2729 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2730 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2731 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-seconds">00</div>';
2732 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('seconds', 'survey-maker') . '</div>';
2733 $content[] = '</div>';
2734 $content[] = '</div>';
2735 $content[] = '</div>';
2736
2737 $content[] = '</div>
2738
2739 <div class="ays-survey-halloween-banner-2025-right">
2740 <div class="ays-survey-halloween-banner-2025-pumpkin">
2741 <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2742 <g clip-path="url(#clip0_177_40)">
2743 <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"/>
2744 <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"/>
2745 <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"/>
2746 </g>
2747 <defs>
2748 <clipPath id="clip0_177_40">
2749 <rect width="36" height="36" fill="white"/>
2750 </clipPath>
2751 </defs>
2752 </svg>
2753 </div>
2754
2755
2756
2757 <div class="ays-survey-halloween-banner-2025-discount-section">
2758 <div class="ays-survey-halloween-banner-2025-discount">50% OFF</div>
2759 <div class="ays-survey-halloween-banner-2025-coupon-wrapper">
2760 <div class="ays-survey-halloween-banner-2025-coupon-box" onclick="aysSurveyHalloweenCopyToClipboard(\'HALLOWEEN25\')" title="Click to copy">
2761 <span class="ays-survey-halloween-banner-2025-coupon-text">HALLOWEEN25</span>
2762 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-survey-halloween-banner-2025-copy-icon">
2763 <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"/>
2764 </svg>
2765 </div>
2766 </div>
2767 <a href="'. $ays_survey_cta_button_link .'" class="ays-survey-halloween-banner-2025-upgrade" target="_blank">Buy Now</a>
2768 </div>';
2769
2770 if( current_user_can( 'manage_options' ) ){
2771 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2772 $content[] = '<form action="" method="POST" style="position: absolute; bottom: -5px; right: 0; color: #fff;">';
2773 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
2774 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2775 $content[] = '</form>';
2776 $content[] = '</div>';
2777 }
2778
2779 $content[] = '
2780 </div>
2781 </div>
2782 </div>';
2783
2784 $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">';
2785 $content[] = '
2786 .ays-survey-halloween-banner-2025-main {
2787 background: linear-gradient(135deg, #1A0F2E 100%, #2D1B4E 0%);
2788 background-image: url("' . esc_attr( SURVEY_MAKER_ADMIN_URL ) . '/images/halloween-banner-background-image-remove.png"), linear-gradient(135deg, #2D1B4E 0%, #1A0F2E 100%);
2789 background-position: left center, center;
2790 background-repeat: no-repeat, no-repeat;
2791 background-size: auto 100%, cover;
2792 padding: 20px 30px 20px 130px;
2793 border-radius: 12px;
2794 color: white;
2795 margin: 20px 0;
2796 border: 0;
2797 box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
2798 overflow: hidden;
2799 }
2800
2801 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-content {
2802 display: flex;
2803 align-items: center;
2804 justify-content: space-between;
2805 gap: 30px;
2806 }
2807
2808 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-left {
2809 display: flex;
2810 align-items: center;
2811 gap: 20px;
2812 }
2813
2814 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-center {
2815 display: flex;
2816 align-items: center;
2817 justify-content: center;
2818 flex: 1;
2819 max-width: 350px;
2820 }
2821
2822 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-right {
2823 display: flex;
2824 align-items: center;
2825 gap: 15px;
2826 flex-shrink: 0;
2827 }
2828
2829 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-icon {
2830 flex-shrink: 0;
2831 }
2832
2833 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin svg {
2834 display: inline !important;
2835 border: none !important;
2836 box-shadow: none !important;
2837 height: 1em !important;
2838 width: 1em !important;
2839 margin: 0 0.07em !important;
2840 vertical-align: -0.1em !important;
2841 background: none !important;
2842 padding: 0 !important;
2843 }
2844
2845 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-orb {
2846 width: 80px;
2847 height: 80px;
2848 background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
2849 border-radius: 50%;
2850 display: flex;
2851 align-items: center;
2852 justify-content: center;
2853 box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
2854 border: 3px solid rgba(168, 85, 247, 0.4);
2855 }
2856
2857 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-question {
2858 font-size: 48px;
2859 font-weight: 700;
2860 color: #E9D5FF;
2861 }
2862
2863 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat {
2864 font-size: 20px;
2865 opacity: 0.8;
2866 }
2867
2868 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat-1 {
2869 margin-left: -100px;
2870 margin-top: -40px;
2871 }
2872
2873 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat-2 {
2874 margin-left: -110px;
2875 margin-top: 35px;
2876 }
2877
2878 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle {
2879 font-size: 12px;
2880 opacity: 0.7;
2881 }
2882
2883 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-1 {
2884 margin-left: -95px;
2885 margin-top: -60px;
2886 }
2887
2888 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-2 {
2889 margin-left: -70px;
2890 margin-top: -15px;
2891 }
2892
2893 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-3 {
2894 margin-left: -120px;
2895 margin-top: 10px;
2896 }
2897
2898 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-text {
2899 flex: 1;
2900 }
2901
2902 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
2903 font-size: 24px;
2904 font-weight: 700;
2905 margin: 0 0 8px 0;
2906 line-height: 1.2;
2907 color: #fff;
2908 text-transform: uppercase;
2909 letter-spacing: 1px;
2910 }
2911
2912 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title a {
2913 color: #FB923C;
2914 text-decoration: underline;
2915 }
2916
2917 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle {
2918 font-size: 16px;
2919 margin: 0;
2920 opacity: 0.9;
2921 font-weight: 400;
2922 color: #E9D5FF;
2923 }
2924
2925 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-description {
2926 font-size: 14px;
2927 margin: 0;
2928 opacity: 0.85;
2929 line-height: 1.5;
2930 color: #D8B4FE;
2931 }
2932
2933 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
2934 font-size: 64px;
2935 filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.8));
2936 flex-shrink: 0;
2937 }
2938
2939 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount-section {
2940 display: flex;
2941 flex-direction: column;
2942 align-items: center;
2943 gap: 10px;
2944 }
2945
2946 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount {
2947 font-size: 36px;
2948 font-weight: 700;
2949 color: #FB923C;
2950 text-shadow: 0 0 20px rgba(251, 146, 60, 0.6);
2951 margin: 0;
2952 line-height: 1;
2953 }
2954
2955 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-wrapper {
2956 display:none;
2957 margin-bottom: 5px;
2958 }
2959
2960 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box {
2961 border: 2px dashed rgba(255, 255, 255, 0.4);
2962 padding: 6px 12px;
2963 border-radius: 6px;
2964 background: rgba(255, 255, 255, 0.1);
2965 cursor: pointer;
2966 transition: all 0.3s ease;
2967 display: flex;
2968 align-items: center;
2969 gap: 6px;
2970 backdrop-filter: blur(10px);
2971 }
2972
2973 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box:hover {
2974 background: rgba(255, 255, 255, 0.2);
2975 border-color: rgba(255, 255, 255, 0.6);
2976 transform: translateY(-1px);
2977 }
2978
2979 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-text {
2980 font-size: 14px;
2981 font-weight: 700;
2982 letter-spacing: 1px;
2983 color: #fff;
2984 font-family: monospace;
2985 }
2986
2987 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-copy-icon {
2988 opacity: 0.8;
2989 transition: opacity 0.3s ease;
2990 }
2991
2992 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box:hover .ays-survey-halloween-banner-2025-copy-icon {
2993 opacity: 1;
2994 }
2995
2996 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade {
2997 background: linear-gradient(135deg, #FB923C 0%, #F97316 100%);
2998 color: white;
2999 border: none;
3000 padding: 12px 28px;
3001 border-radius: 8px;
3002 font-size: 16px;
3003 font-weight: 600;
3004 cursor: pointer;
3005 transition: all 0.3s ease;
3006 box-shadow: 0 4px 16px rgba(251, 146, 60, 0.5);
3007 text-decoration: none;
3008 display: inline-flex;
3009 align-items: center;
3010 text-align: center;
3011 }
3012
3013 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade:hover {
3014 transform: translateY(-2px);
3015 box-shadow: 0 6px 20px rgba(251, 146, 60, 0.7);
3016 text-decoration: none;
3017 color: white;
3018 }
3019
3020 .ays-survey-halloween-banner-2025-main .notice-dismiss:before {
3021 color: #fff;
3022 }
3023
3024 .ays-survey-halloween-banner-2025-copy-notification {
3025 position: fixed;
3026 top: 50%;
3027 left: 50%;
3028 transform: translate(-50%, -50%);
3029 background: rgba(0, 0, 0, 0.8);
3030 color: white;
3031 padding: 12px 24px;
3032 border-radius: 8px;
3033 font-size: 14px;
3034 z-index: 10000;
3035 opacity: 0;
3036 transition: opacity 0.3s ease;
3037 }
3038
3039 .ays-survey-halloween-banner-2025-copy-notification.show {
3040 opacity: 1;
3041 }
3042
3043 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-timer {
3044 display: flex;
3045 align-items: center;
3046 justify-content: center;
3047 gap: 8px;
3048 }
3049
3050 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-item {
3051 background: rgba(255, 255, 255, 0.15);
3052 border-radius: 8px;
3053 padding: 8px 12px;
3054 min-width: 60px;
3055 backdrop-filter: blur(10px);
3056 }
3057
3058 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-value {
3059 font-size: 24px;
3060 font-weight: 700;
3061 line-height: 1;
3062 margin-bottom: 4px;
3063 color: #fff;
3064 text-align: center;
3065 }
3066
3067 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-label {
3068 font-size: 11px;
3069 opacity: 0.8;
3070 text-transform: lowercase;
3071 text-align: center;
3072 }
3073
3074 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-separator {
3075 font-size: 24px;
3076 font-weight: 700;
3077 opacity: 0.6;
3078 margin: 0 4px;
3079 }
3080
3081 @media (min-width: 1200px) {
3082 .ays-survey-halloween-banner-2025-main .wp-core-ui .notice.is-dismissible {
3083 padding-right: 60px;
3084 }
3085 }
3086
3087 @media (max-width: 1200px) {
3088
3089 div.ays-survey-halloween-banner-2025-main {
3090 padding: 20px 30px;
3091 }
3092
3093 div.ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
3094 display: none;
3095 }
3096
3097 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle,
3098 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3099 text-align: center;
3100 }
3101
3102 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-content {
3103 flex-wrap: wrap;
3104 gap: 20px;
3105 }
3106
3107 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-left {
3108 width: 100%;
3109 }
3110
3111 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-center {
3112 width: 100%;
3113 max-width: 100%;
3114 text-align: center;
3115 }
3116
3117 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-right {
3118 width: 100%;
3119 justify-content: center;
3120 }
3121 }
3122
3123 @media (max-width: 786px) {
3124 #ays-survey-halloween-banner-2025-main {
3125 display: none !important;
3126 }
3127 }
3128
3129 @media (max-width: 768px) {
3130 .ays-survey-halloween-banner-2025-main {
3131 padding: 15px 20px;
3132 margin: 15px 0;
3133 }
3134
3135 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3136 font-size: 20px;
3137 }
3138
3139 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle {
3140 font-size: 14px;
3141 }
3142
3143 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-description {
3144 font-size: 13px;
3145 }
3146
3147 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
3148 font-size: 48px;
3149 }
3150
3151 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount {
3152 font-size: 28px;
3153 }
3154
3155 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade {
3156 padding: 10px 20px;
3157 font-size: 14px;
3158 }
3159 }
3160
3161 @media (max-width: 480px) {
3162 .ays-survey-halloween-banner-2025-main {
3163 padding: 12px 15px;
3164 }
3165
3166 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-orb {
3167 width: 60px;
3168 height: 60px;
3169 }
3170
3171 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-question {
3172 font-size: 36px;
3173 }
3174
3175 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3176 font-size: 18px;
3177 }
3178
3179 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-text {
3180 font-size: 12px;
3181 }
3182 }
3183 ';
3184
3185 $content[] = '</style>';
3186
3187 $content[] = '<script>';
3188 $content[] = "
3189 function aysSurveyHalloweenCopyToClipboard(text) {
3190 // Create a temporary textarea element
3191 var textarea = document.createElement('textarea');
3192 textarea.value = text;
3193 textarea.style.position = 'fixed';
3194 textarea.style.opacity = '0';
3195 document.body.appendChild(textarea);
3196
3197 // Select and copy the text
3198 textarea.select();
3199 textarea.setSelectionRange(0, 99999); // For mobile devices
3200
3201 try {
3202 document.execCommand('copy');
3203 aysSurveyHalloweenShowCopyNotification('Coupon code copied!');
3204 } catch (err) {
3205 console.error('Failed to copy text: ', err);
3206 }
3207
3208 // Remove the temporary textarea
3209 document.body.removeChild(textarea);
3210 }
3211
3212 function aysSurveyHalloweenShowCopyNotification(message) {
3213 // Check if notification already exists
3214 var existingNotification = document.querySelector('.ays-survey-halloween-banner-2025-copy-notification');
3215 if (existingNotification) {
3216 document.body.removeChild(existingNotification);
3217 }
3218
3219 // Create notification element
3220 var notification = document.createElement('div');
3221 notification.className = 'ays-survey-halloween-banner-2025-copy-notification';
3222 notification.textContent = message;
3223 document.body.appendChild(notification);
3224
3225 // Show notification with animation
3226 setTimeout(function() {
3227 notification.classList.add('show');
3228 }, 10);
3229
3230 // Hide and remove notification after 2 seconds
3231 setTimeout(function() {
3232 notification.classList.remove('show');
3233 setTimeout(function() {
3234 if (notification.parentNode) {
3235 document.body.removeChild(notification);
3236 }
3237 }, 300);
3238 }, 2000);
3239 }
3240
3241 (function() {
3242 var endDate = new Date('". date('Y-m-d H:i:s', $end_date) ."').getTime();
3243
3244 function updateCountdown() {
3245 var now = new Date().getTime();
3246 var distance = endDate - now;
3247
3248 if (distance < 0) {
3249 clearInterval(updateCountdown);
3250 document.getElementById('ays-survey-halloween-banner-2025-progress-banner-countdown').style.display = 'none';
3251 return;
3252 }
3253
3254 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
3255 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
3256 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
3257 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
3258
3259 function padZero(num) {
3260 return num < 10 ? '0' + num : num;
3261 }
3262
3263 document.getElementById('ays-survey-halloween-banner-2025-days').textContent = padZero(days);
3264 document.getElementById('ays-survey-halloween-banner-2025-hours').textContent = padZero(hours);
3265 document.getElementById('ays-survey-halloween-banner-2025-minutes').textContent = padZero(minutes);
3266 document.getElementById('ays-survey-halloween-banner-2025-seconds').textContent = padZero(seconds);
3267 }
3268
3269 updateCountdown();
3270 setInterval(updateCountdown, 1000);
3271 })()";
3272 $content[] = '</script>';
3273
3274 $content = implode( '', $content );
3275 echo ($content);
3276 }
3277 }
3278
3279 // Fox LMS Pro Banner
3280 public function ays_survey_discounted_licenses_banner_message($ishmar){
3281 if($ishmar == 0 ){
3282 $content = array();
3283
3284 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
3285 $now_date = date('M d, Y H:i:s', $date);
3286
3287 $start_date = strtotime('2025-09-21');
3288 $end_date = strtotime('2025-10-21');
3289 $diff_end = $end_date - $date;
3290
3291 $style_attr = '';
3292 if( $diff_end < 0 ){
3293 $style_attr = 'style="display:none;"';
3294 }
3295
3296 $total_licenses = 50;
3297 $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);
3298 $days_passed = floor(($date - $start_date) / (24 * 60 * 60));
3299 $used_licenses = 0;
3300
3301 for ($i = 0; $i < min($days_passed, count($progression_pattern)); $i++) {
3302 $used_licenses += $progression_pattern[$i];
3303 }
3304 $used_licenses = min($used_licenses, $total_licenses);
3305 $remaining_licenses = $total_licenses - $used_licenses;
3306 $progress_percentage = ($used_licenses / $total_licenses) * 100;
3307
3308 $ays_survey_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=survey-maker-license-banner-' . SURVEY_MAKER_VERSION);
3309
3310 $content[] = '<div id="ays-survey-progress-banner-main" class="ays-survey-progress-banner-main ays_survey_dicount_info ays-survey-admin-notice notice notice-success is-dismissible" ' . $style_attr . '>';
3311 $content[] = '<div class="ays-survey-progress-banner-content">';
3312 $content[] = '<div class="ays-survey-progress-banner-left">';
3313 $content[] = '<div class="ays-survey-progress-banner-icon">';
3314 $content[] = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
3315 <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"/>
3316 <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"/>
3317 <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"/>
3318 <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"/>
3319 <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"/>
3320 <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"/>
3321 </svg>';
3322 $content[] = '</div>';
3323 $content[] = '<div class="ays-survey-progress-banner-text">';
3324 $content[] = '<h2 class="ays-survey-progress-banner-title">' . sprintf( __('Get the Pro Version of %s Survey Maker%s – 20%% OFF', 'survey-maker'), '<a href="'. $ays_survey_cta_button_link .'" target="_blank">', '</a>' ) . '</h2>';
3325 $content[] = '<p class="ays-survey-progress-banner-subtitle">' . __('Unlock advanced features + 30 day Money Back Guarantee', 'survey-maker') . '</p>';
3326 $content[] = '</div>';
3327 $content[] = '</div>';
3328
3329 $content[] = '<div class="ays-survey-progress-banner-center">';
3330 $content[] = '<div class="ays-survey-progress-banner-coupon">';
3331 $content[] = '<div class="ays-survey-progress-banner-coupon-box" onclick="surveyCopyToClipboard(\'FREE2PRO20\')" title="' . __('Click to copy', 'survey-maker') . '">';
3332 $content[] = '<span class="ays-survey-progress-banner-coupon-text">FREE2PRO20</span>';
3333 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="ays-survey-progress-banner-copy-icon">';
3334 $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"/>';
3335 $content[] = '</svg>';
3336 $content[] = '</div>';
3337 $content[] = '</div>';
3338
3339 $content[] = '<div class="ays-survey-progress-banner-progress">';
3340 $content[] = '<p class="ays-survey-progress-banner-progress-text">' . __('Only', 'survey-maker') . ' <span id="remaining-licenses">' . $remaining_licenses . '</span> ' . __('of 50 discounted licenses left', 'survey-maker') . '</p>';
3341 $content[] = '<div class="ays-survey-progress-banner-progress-bar">';
3342 $content[] = '<div class="ays-survey-progress-banner-progress-fill" id="progress-fill" style="width: ' . $progress_percentage . '%;"></div>';
3343 $content[] = '</div>';
3344 $content[] = '</div>';
3345 $content[] = '</div>';
3346
3347 $content[] = '<div class="ays-survey-progress-banner-right">';
3348 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-progress-banner-upgrade" target="_blank">';
3349 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">';
3350 $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"/>';
3351 $content[] = '</svg>';
3352 $content[] = ' ' . __('Upgrade Now', 'survey-maker');
3353 $content[] = '</a>';
3354 $content[] = '</div>';
3355 $content[] = '</div>';
3356
3357 if( current_user_can( 'manage_options' ) ){
3358 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3359 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
3360 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
3361 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
3362 $content[] = '</form>';
3363 $content[] = '</div>';
3364 }
3365 $content[] = '</div>';
3366
3367 // Fox LMS Pro Banner Styles
3368 $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">';
3369 $content[] = '
3370 .ays-survey-progress-banner-main {
3371 background: linear-gradient(135deg, #6344ED 0%, #8C2ABE 100%);
3372 padding: 20px 30px;
3373 border-radius: 16px;
3374 color: white;
3375 position: relative;
3376 margin: 20px 0;
3377 box-shadow: 0 8px 32px rgba(99, 68, 237, 0.3);
3378 border: 0;
3379 }
3380
3381 .ays-survey-progress-banner-main .ays-survey-progress-banner-content {
3382 display: flex;
3383 align-items: center;
3384 justify-content: space-between;
3385 gap: 30px;
3386 }
3387
3388 .ays-survey-progress-banner-main .ays-survey-progress-banner-left {
3389 display: flex;
3390 align-items: center;
3391 gap: 20px;
3392 flex: 1;
3393 }
3394
3395 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3396 display: flex;
3397 align-items: center;
3398 gap: 15px;
3399 flex: 1;
3400 }
3401
3402 .ays-survey-progress-banner-main .ays-survey-progress-banner-right {
3403 display: flex;
3404 align-items: center;
3405 gap: 20px;
3406 flex-shrink: 0;
3407 }
3408
3409 .ays-survey-progress-banner-main .ays-survey-progress-banner-icon {
3410 font-size: 32px;
3411 filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
3412 }
3413
3414 .ays-survey-progress-banner-main .ays-survey-progress-banner-title {
3415 font-size: 21px;
3416 font-weight: 700;
3417 margin: 0 0 8px 0;
3418 line-height: 1.2;
3419 color: #fff;
3420 }
3421
3422 .ays-survey-progress-banner-main .ays-survey-progress-banner-title a {
3423 text-decoration: underline;
3424 color: #fff;
3425 }
3426
3427 .ays-survey-progress-banner-main .ays-survey-progress-banner-subtitle {
3428 font-size: 16px;
3429 margin: 0;
3430 opacity: 0.9;
3431 font-weight: 400;
3432 }
3433
3434 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon {
3435 margin-bottom: 5px;
3436 }
3437
3438 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box {
3439 border: 2px dotted rgba(255, 255, 255, 0.6);
3440 padding: 8px 16px;
3441 border-radius: 8px;
3442 background: rgba(255, 255, 255, 0.1);
3443 cursor: pointer;
3444 transition: all 0.3s ease;
3445 display: flex;
3446 align-items: center;
3447 gap: 8px;
3448 backdrop-filter: blur(10px);
3449 }
3450
3451 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box:hover {
3452 background: rgba(255, 255, 255, 0.2);
3453 border-color: rgba(255, 255, 255, 0.8);
3454 transform: translateY(-1px);
3455 }
3456
3457 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-text {
3458 font-size: 16px;
3459 font-weight: 700;
3460 letter-spacing: 1px;
3461 color: #fff;
3462 font-family: monospace;
3463 }
3464
3465 .ays-survey-progress-banner-main .ays-survey-progress-banner-copy-icon {
3466 opacity: 0.8;
3467 transition: opacity 0.3s ease;
3468 }
3469
3470 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box:hover .ays-survey-progress-banner-copy-icon {
3471 opacity: 1;
3472 }
3473
3474 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress {
3475 text-align: center;
3476 width: 100%;
3477 }
3478
3479 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-text {
3480 font-size: 14px;
3481 margin: 0 0 10px 0;
3482 opacity: 0.9;
3483 }
3484
3485 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3486 width: 300px;
3487 height: 10px;
3488 background: rgba(255, 255, 255, 0.2);
3489 border-radius: 4px;
3490 overflow: hidden;
3491 margin: 0 auto;
3492 }
3493
3494 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-fill {
3495 height: 100%;
3496 background: linear-gradient(90deg, #4ADE80 0%, #22C55E 100%);
3497 border-radius: 4px;
3498 transition: width 0.8s ease;
3499 width: 70%;
3500 }
3501
3502 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade {
3503 background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
3504 color: white;
3505 border: none;
3506 padding: 12px 24px;
3507 border-radius: 8px;
3508 font-size: 16px;
3509 font-weight: 600;
3510 cursor: pointer;
3511 transition: all 0.3s ease;
3512 box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
3513 text-decoration: none;
3514 display: inline-flex;
3515 align-items: center;
3516 gap: 8px;
3517 }
3518
3519 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade:hover {
3520 transform: translateY(-2px);
3521 box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
3522 text-decoration: none;
3523 color: white;
3524 }
3525
3526 .ays-survey-progress-banner-main .notice-dismiss:before {
3527 color: #fff;
3528 }
3529
3530 /* Copy notification */
3531 .ays-survey-copy-notification {
3532 position: fixed;
3533 top: 50%;
3534 left: 50%;
3535 transform: translate(-50%, -50%);
3536 background: rgba(0, 0, 0, 0.8);
3537 color: white;
3538 padding: 12px 24px;
3539 border-radius: 8px;
3540 font-size: 14px;
3541 z-index: 10000;
3542 opacity: 0;
3543 transition: opacity 0.3s ease;
3544 }
3545
3546 .ays-survey-copy-notification.show {
3547 opacity: 1;
3548 }
3549
3550 @media (max-width: 1400px) {
3551 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3552 flex-direction: column;
3553 }
3554 }
3555
3556 @media (max-width: 1200px) {
3557 .ays-survey-progress-banner-main .ays-survey-progress-banner-content {
3558 flex-direction: column;
3559 gap: 20px;
3560 }
3561
3562 .ays-survey-progress-banner-main .ays-survey-progress-banner-left {
3563 width: 100%;
3564 justify-content: center;
3565 text-align: center;
3566 flex-direction: column;
3567 }
3568
3569 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3570 width: 100%;
3571 }
3572
3573 .ays-survey-progress-banner-main .ays-survey-progress-banner-right {
3574 width: 100%;
3575 justify-content: center;
3576 }
3577 }
3578
3579 @media (max-width: 768px) {
3580 #ays-survey-progress-banner-main {
3581 display: none !important;
3582 }
3583
3584 .ays-survey-progress-banner-main {
3585 padding: 15px 20px;
3586 margin: 15px 0;
3587 }
3588
3589 .ays-survey-progress-banner-main .ays-survey-progress-banner-title {
3590 font-size: 18px;
3591 }
3592
3593 .ays-survey-progress-banner-main .ays-survey-progress-banner-subtitle {
3594 font-size: 14px;
3595 }
3596
3597 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3598 width: 100%;
3599 max-width: 280px;
3600 }
3601
3602 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade {
3603 padding: 10px 20px;
3604 font-size: 14px;
3605 }
3606 }
3607
3608 @media (max-width: 480px) {
3609 .ays-survey-progress-banner-main {
3610 padding: 12px 15px;
3611 }
3612
3613 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-text {
3614 font-size: 14px;
3615 }
3616
3617 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3618 max-width: 250px;
3619 }
3620 }
3621 ';
3622
3623 $content[] = '</style>';
3624
3625 $content = implode( '', $content );
3626 echo ($content);
3627 }
3628 }
3629
3630 public function ays_survey_new_mega_bundle_message($ishmar){
3631 if($ishmar == 0 ){
3632 $content = array();
3633 $content[] = '<div id="ays-survey-new-mega-bundle-dicount-month-main" class="ays-survey-admin-notice notice notice-success is-dismissible ays_survey_dicount_info">';
3634 $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
3635
3636 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
3637
3638 $content[] = '<div class="ays-survey-dicount-wrap-text-box-texts">';
3639 $content[] = '<div>
3640 <a href="https://ays-pro.com/mega-bundle?utm_source=survey-maker-free&utm_medium=dashboard&utm_campaign=survey-mega-bundle-'.SURVEY_MAKER_VERSION.'" target="_blank" style="color:#ffffff; text-decoration: underline;">Mega Bundle </a> (Quiz + Survey + Poll)
3641 </div>
3642 <div style="position: relative;">
3643 <span class="ays-survey-sale-baner-mega-bundle-sale-text">50%</span>
3644 <img style="position: absolute;top: 30px;left: 0;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/line.webp">
3645 </div>';
3646 $content[] = '</div>';
3647
3648 $content[] = '<div style="font-size: 17px; display: flex; align-items: center; margin-top: 10px;">';
3649 $content[] = '<img style="width: 30px;height: 25px;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/guaranteeicon.webp">';
3650 $content[] = '<span style="padding-left: 8px"> 30 Day Money Back Guarantee</span>';
3651
3652 $content[] = '</div>';
3653
3654
3655
3656 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
3657
3658 $content[] = '<form action="" method="POST">';
3659 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3660 if( current_user_can( 'manage_options' ) ){
3661 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
3662 $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
3663 }
3664 $content[] = '</div>';
3665 $content[] = '</form>';
3666
3667 $content[] = '</div>';
3668
3669 $content[] = '</div>';
3670
3671 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
3672
3673 $content[] = '<div id="ays-survey-maker-countdown-main-container">';
3674 $content[] = '<div class="ays-survey-maker-countdown-container">';
3675
3676 $content[] = '<div id="ays-survey-countdown">';
3677
3678 // $content[] = '<div>';
3679 // $content[] = __( "Offer ends in:", "survey-maker" );
3680 // $content[] = '</div>';
3681
3682 $content[] = '<ul>';
3683 $content[] = '<li><span id="ays-survey-countdown-days"></span>days</li>';
3684 $content[] = '<li><span id="ays-survey-countdown-hours"></span>Hours</li>';
3685 $content[] = '<li><span id="ays-survey-countdown-minutes"></span>Minutes</li>';
3686 $content[] = '<li><span id="ays-survey-countdown-seconds"></span>Seconds</li>';
3687 $content[] = '</ul>';
3688 $content[] = '</div>';
3689
3690 $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
3691 $content[] = '<span>🚀</span>';
3692 $content[] = '<span>⌛</span>';
3693 $content[] = '<span>🔥</span>';
3694 $content[] = '<span>💣</span>';
3695 $content[] = '</div>';
3696
3697 $content[] = '</div>';
3698 $content[] = '</div>';
3699
3700 $content[] = '</div>';
3701
3702 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
3703 $content[] = '<a href="https://ays-pro.com/mega-bundle?utm_source=survey-maker-free&utm_medium=dashboard&utm_campaign=survey-mega-bundle-'.SURVEY_MAKER_VERSION.'" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now !', "survey-maker" ) . '</a>';
3704 $content[] = '<span >One-time payment</span>';
3705 $content[] = '</div>';
3706 $content[] = '</div>';
3707 $content[] = '</div>';
3708
3709 $new_mega_bundle_logo_background = SURVEY_MAKER_ADMIN_URL . '/images/new-mega-bundle-logo-background.svg';
3710
3711 $content[] = '<style id="ays-survey-new-mega-bundle-styles-inline-css">';
3712 $content[] = '#ays-survey-maker-countdown-main-container li span,#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now,#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content,#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-sale-banner-link,#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month,div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info button{display:flex;display:flex;display:flex;display:flex}div#ays-survey-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-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info button{align-items:center}div#ays-survey-new-mega-bundle-dicount-month-main div#ays-survey-dicount-month a.ays-survey-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-survey-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-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info{background-image:url("'.$new_mega_bundle_logo_background.'");background-position:center;background-repeat:no-repeat;background-size:cover;background-color:#5551ff}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month{align-items:center;justify-content:space-between;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month img{width:80px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-sale-banner-link{justify-content:center;align-items:center;width:200px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:14px;padding:12px;text-align:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{text-align:left;width:400px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:40%;justify-content:flex-start;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{justify-content:center;align-items:center;flex-direction:column}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box span{font-size:10px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-wrap-text-box-texts{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-color{color:#971821}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-text-decoration{text-decoration:underline}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{justify-content:flex-end;align-items:center;width:30%}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-button,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-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-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content{justify-content:center}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{width:19%}#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{padding:40px 15px;justify-content:center;align-items:center;opacity:0}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li{position:relative}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{content:":";color:#fff;position:absolute;top:10px;right:-5px;font-size:40px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span#ays-survey-countdown-seconds:after{content:unset}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{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}#ays-survey-maker-countdown-main-container li,#ays-survey-maker-countdown-main-container ul,#ays-survey-new-mega-bundle-dicount-month-main .button.ays-button{margin:0}div#ays-survey-new-mega-bundle-dicount-month-main button.notice-dismiss:before{color:#fff}@media all and (max-width:1024px){#ays-survey-new-mega-bundle-dicount-month-main{display:none!important}}@media all and (max-width:768px){div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{display:none!important;background-position:center;background-repeat:no-repeat;background-size:cover}div#ays-survey-new-mega-bundle-dicount-month-main{padding-right:0}div#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_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-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box,div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:100%;text-align:center}#ays-survey-maker-countdown-main-container #ays-survey-countdown-headline{font-size:15px;font-weight:600}#ays-survey-maker-countdown-main-container ul{font-weight:500}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:100%;display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-button{margin:0 auto!important}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{padding-left:unset!important}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{display:none}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dismiss-buttons-container-for-form{position:static!important}.comparison .product img{width:70px}.comparison a.price-buy{padding:5px 10px;font-size:11px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-wrap-text-box-texts{height:64px}#ays-survey-maker-countdown-main-container .ays-survey-maker-countdown-container #ays-survey-countdown>ul{display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{top:unset}#ays-survey-maker-countdown-main-container li{font-size:12px;padding:12px}#ays-survey-maker-countdown-main-container li span{font-size:26px;min-height:50px;min-width:50px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{width:100%}}@media screen and (max-width:1305px) and (min-width:768px){div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-wrap-text-box-texts{font-size:15px}#ays-survey-maker-countdown-main-container li{font-size:11px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{display:none}}@media screen and (max-width:436px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-wrap-text-box-texts{height:110px;margin-bottom:25px}}#ays-survey-maker-countdown-main-container .ays-survey-maker-countdown-container{color:#fff;margin:0 auto;text-align:center}#ays-survey-maker-countdown-main-container li span{justify-content:center;align-items:center;background:#9896ed;justify-content:center;align-items:center;font-size:23px;height:56px;width:53px;border-radius:8px;border:.534px solid #f4f4f4;color:#fff}#ays-survey-maker-countdown-main-container #ays-survey-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-survey-maker-countdown-main-container li{display:inline-block;font-size:14px;list-style-type:none;padding:14px;text-transform:capitalize;text-align:center;margin:auto}#ays-survey-maker-countdown-main-container .emoji{display:none;padding:1rem}#ays-survey-maker-countdown-main-container .emoji span{font-size:30px;padding:0 .5rem} .ays-survey-dicount-wrap-text-box-texts{font-size:17px;letter-spacing:.8px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-wrap:wrap}.ays-survey-sale-baner-mega-bundle-sale-text{font-size:23px;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}';
3713 $content[] = '</style>';
3714
3715
3716 $content = implode( '', $content );
3717 echo html_entity_decode(esc_html( $content ));
3718 }
3719 }
3720
3721 // Survey Footer Blue Banner Sale 20%
3722 public function ays_survey_footer_sale_banner_2026($ishmar){
3723 if($ishmar == 0 ){
3724 $content = array();
3725
3726 $survey_cta_button_link = esc_url('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=private-offer-20-off-' . SURVEY_MAKER_VERSION);
3727
3728 $content[] = '
3729 <div class="ays-survey-footer-banner-bottom-banner-wrapper" style="display: none;">
3730 <div class="ays-survey-footer-banner-bottom-banner-container">
3731 <div class="ays-survey-footer-banner-bottom-banner-content">
3732 <div class="ays-survey-footer-banner-bottom-banner-inner">
3733 <div class="ays-survey-footer-banner-bottom-banner-left">
3734 <div class="ays-survey-footer-banner-bottom-banner-icon">
3735 <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">
3736 <path d="M12 7v14"></path>
3737 <path d="M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8"></path>
3738 <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>
3739 <rect x="3" y="7" width="18" height="4" rx="1"></rect>
3740 </svg>
3741 </div>
3742 <span class="ays-survey-footer-banner-bottom-banner-title">'. esc_html__('Survey Maker by AYS', 'survey-maker') .'</span>
3743 </div>
3744 <span class="ays-survey-footer-banner-bottom-banner-separator"></span>
3745 <span class="ays-survey-footer-banner-bottom-banner-discount">'. esc_html__('20% Off', 'survey-maker') .'</span>
3746 <div class="ays-survey-footer-banner-bottom-banner-code" onclick="aysSurveyFooterBannerCopyToClipboard()" title="'. esc_html__('Copy Coupon Code', 'survey-maker') .'">
3747 <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">
3748 <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>
3749 <path d="M13 5v2"></path>
3750 <path d="M13 17v2"></path>
3751 <path d="M13 11v2"></path>
3752 </svg>
3753 <span>SURVEYPRO20</span>
3754 <button type="button" class="ays-survey-footer-banner-bottom-banner-copy" aria-label="'. esc_html__('Copy Coupon Code', 'survey-maker') .'">
3755 <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">
3756 <rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>
3757 <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>
3758 </svg>
3759 </button>
3760 </div>
3761 <button type="button" class="ays-survey-footer-banner-bottom-banner-cta">
3762 '. esc_html__('Get Deal', 'survey-maker') .'
3763 </button>
3764 <button type="button" class="ays-survey-footer-banner-bottom-banner-close" aria-label="'. esc_html__('Close popup', 'survey-maker') .'">
3765 <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">
3766 <path d="M18 6 6 18"></path>
3767 <path d="m6 6 12 12"></path>
3768 </svg>
3769 </button>
3770 </div>
3771 </div>
3772 </div>
3773 </div>';
3774
3775 $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">';
3776
3777 $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-survey-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-survey-footer-banner-bottom-banner-wrapper.ays-pro-banner-closing{animation:.32s cubic-bezier(.16,1,.3,1) forwards ays-pro-slide-down}.ays-survey-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-survey-footer-banner-bottom-banner-code,.ays-survey-footer-banner-bottom-banner-content,.ays-survey-footer-banner-bottom-banner-inner,.ays-survey-footer-banner-bottom-banner-left{display:flex;align-items:center}.ays-survey-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-survey-footer-banner-bottom-banner-left{gap:14px}.ays-survey-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-survey-footer-banner-bottom-banner-icon svg{width:24px;height:24px}.ays-survey-footer-banner-bottom-banner-discount,.ays-survey-footer-banner-bottom-banner-title{font-size:17px;font-weight:600;line-height:1.25;letter-spacing:0;white-space:nowrap;color:#fff}.ays-survey-footer-banner-bottom-banner-separator{display:block;width:1px;height:24px;background:rgba(255,255,255,.4)}.ays-survey-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-survey-footer-banner-bottom-banner-code:hover{background:rgba(255,255,255,.1);border-color:#fff}.ays-survey-footer-banner-bottom-banner-code button svg,.ays-survey-footer-banner-bottom-banner-code>svg{width:16px;height:16px}.ays-survey-footer-banner-bottom-banner-code span{font-size:14px;font-weight:600;line-height:1;letter-spacing:.05em;color:#fff}.ays-survey-footer-banner-bottom-banner-close,.ays-survey-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-survey-footer-banner-bottom-banner-close:hover,.ays-survey-footer-banner-bottom-banner-copy:hover{color:#fff;background:0 0}.ays-survey-footer-banner-bottom-banner-wrapper .ays-survey-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-survey-footer-banner-bottom-banner-wrapper .ays-survey-footer-banner-bottom-banner-cta:hover{background:rgba(255,255,255,.95);color:#2f6bff;transform:translateY(-1px)}.ays-survey-footer-banner-bottom-banner-close{width:22px;height:22px;margin-left:2px}.ays-survey-footer-banner-bottom-banner-close svg{width:20px;height:20px}.ays-survey-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-survey-footer-banner-copy-notification.show{opacity:1}@media (max-width:768px){.ays-survey-footer-banner-bottom-banner-wrapper{display:none}}';
3778 $content[] = '</style>';
3779
3780 $content[] = '<script>';
3781
3782 $content[] = "
3783 /**
3784 * Footer Banner JavaScript - ES5 Compatible
3785 * With delayed popup and visit tracking
3786 */
3787
3788 (function() {
3789 'use strict';
3790
3791 // Configuration
3792 var STORAGE_KEY = 'ays_survey_footer_banner_data';
3793 var POPUP_RULES = [
3794 { visit: 1, delay: 10000 }, // 1st visit: 10 seconds
3795 { visit: 2, delay: 10000 }, // 2nd visit: 10 seconds
3796 { visit: 3, delay: 15000 }, // 3th visit: 15 seconds
3797 { visit: 4, delay: 15000 }, // 4th visit: 15 seconds
3798 { visit: 5, delay: 20000 }, // 5th visit: 20 seconds
3799 { visit: 7, delay: 20000 }, // 7th visit: 20 seconds
3800 { visit: 10, delay: 30000 } // 10th visit: 30 seconds
3801 ];
3802 var MAX_SHOWS_PER_DAY = 7;
3803
3804 // Wait for DOM to be ready
3805 if (document.readyState === 'loading') {
3806 document.addEventListener('DOMContentLoaded', initBanner);
3807 } else {
3808 initBanner();
3809 }
3810
3811 function initBanner() {
3812 var banner = document.querySelector('.ays-survey-footer-banner-bottom-banner-wrapper');
3813 var closeButton = document.querySelector('.ays-survey-footer-banner-bottom-banner-close');
3814 var ctaButton = document.querySelector('.ays-survey-footer-banner-bottom-banner-cta');
3815
3816 if (!banner) {
3817 return;
3818 }
3819
3820 // Hide banner initially
3821 banner.style.display = 'none';
3822
3823 // Get or initialize banner data
3824 var bannerData = getBannerData();
3825
3826 // Check if we need to reset daily data
3827 if (shouldResetData(bannerData.lastResetDate)) {
3828 bannerData = resetDailyData();
3829 }
3830
3831 // Increment visit count
3832 bannerData.visitCount++;
3833 saveBannerData(bannerData);
3834
3835 // Check if banner should be shown
3836 var shouldShow = shouldShowBanner(bannerData);
3837
3838 if (shouldShow.show) {
3839 // Show banner after delay
3840 setTimeout(function() {
3841 banner.style.display = 'block';
3842
3843 // Increment show count
3844 bannerData.showCount++;
3845 saveBannerData(bannerData);
3846 }, shouldShow.delay);
3847 }
3848
3849 // Close button handler
3850 if (closeButton) {
3851 closeButton.addEventListener('click', function() {
3852 closeBanner(banner);
3853 });
3854 }
3855
3856 // CTA button handler
3857 if (ctaButton) {
3858 ctaButton.addEventListener('click', function() {
3859 window.open('https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=private-offer-20-off-". SURVEY_MAKER_VERSION ."#ays-pro-sm-plans-box-sg', '_blank');
3860 // Optionally close banner after click
3861 closeBanner(banner);
3862 });
3863 }
3864 }
3865
3866 /**
3867 * Get banner data from localStorage
3868 */
3869 function getBannerData() {
3870 try {
3871 var data = localStorage.getItem(STORAGE_KEY);
3872 if (data) {
3873 return JSON.parse(data);
3874 }
3875 } catch (e) {
3876 // localStorage not available or parsing error
3877 }
3878
3879 // Return default data
3880 return {
3881 visitCount: 0,
3882 showCount: 0,
3883 lastResetDate: getTodayDate()
3884 };
3885 }
3886
3887 /**
3888 * Save banner data to localStorage
3889 */
3890 function saveBannerData(data) {
3891 try {
3892 localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
3893 } catch (e) {
3894 // localStorage not available
3895 }
3896 }
3897
3898 /**
3899 * Check if data should be reset (new day)
3900 */
3901 function shouldResetData(lastResetDate) {
3902 var today = getTodayDate();
3903 return lastResetDate !== today;
3904 }
3905
3906 /**
3907 * Reset daily data
3908 */
3909 function resetDailyData() {
3910 var newData = {
3911 visitCount: 0,
3912 showCount: 0,
3913 lastResetDate: getTodayDate()
3914 };
3915 saveBannerData(newData);
3916 return newData;
3917 }
3918
3919 /**
3920 * Get today's date as string (YYYY-MM-DD)
3921 */
3922 function getTodayDate() {
3923 var date = new Date();
3924 var year = date.getFullYear();
3925 var month = String(date.getMonth() + 1).padStart(2, '0');
3926 var day = String(date.getDate()).padStart(2, '0');
3927 return year + '-' + month + '-' + day;
3928 }
3929
3930 /**
3931 * Check if banner should be shown based on rules
3932 */
3933 function shouldShowBanner(bannerData) {
3934 // Check if already shown max times today
3935 if (bannerData.showCount >= MAX_SHOWS_PER_DAY) {
3936 return { show: false, delay: 0 };
3937 }
3938
3939 // Check visit count against rules
3940 for (var i = 0; i < POPUP_RULES.length; i++) {
3941 var rule = POPUP_RULES[i];
3942 if (bannerData.visitCount === rule.visit) {
3943 return { show: true, delay: rule.delay };
3944 }
3945 }
3946
3947 return { show: false, delay: 0 };
3948 }
3949
3950 /**
3951 * Close banner with animation
3952 */
3953 function closeBanner(banner) {
3954 if (!banner) {
3955 return;
3956 }
3957
3958 // Add closing animation class
3959 banner.classList.add('ays-pro-banner-closing');
3960
3961 // Wait for animation to complete
3962 setTimeout(function() {
3963 banner.style.display = 'none';
3964 }, 400);
3965 }
3966
3967 // Polyfill for String.padStart (for older browsers)
3968 if (!String.prototype.padStart) {
3969 String.prototype.padStart = function(targetLength, padString) {
3970 targetLength = targetLength >> 0;
3971 padString = String(typeof padString !== 'undefined' ? padString : ' ');
3972 if (this.length >= targetLength) {
3973 return String(this);
3974 } else {
3975 targetLength = targetLength - this.length;
3976 if (targetLength > padString.length) {
3977 padString += padString.repeat(targetLength / padString.length);
3978 }
3979 return padString.slice(0, targetLength) + String(this);
3980 }
3981 };
3982 }
3983 })();
3984
3985 function aysSurveyFooterBannerCopyToClipboard() {
3986 var textarea = document.createElement('textarea');
3987 textarea.value = 'SURVEYPRO20';
3988 textarea.style.position = 'fixed';
3989 textarea.style.opacity = '0';
3990 document.body.appendChild(textarea);
3991
3992 textarea.select();
3993 textarea.setSelectionRange(0, 99999);
3994
3995 try {
3996 document.execCommand('copy');
3997 aysSurveyFooterBannerShowCopyNotification('". esc_html__('Coupon code copied', 'survey-maker') ."');
3998 } catch (err) {
3999 console.error('Failed to copy text: ', err);
4000 }
4001
4002 document.body.removeChild(textarea);
4003 }
4004
4005 function aysSurveyFooterBannerShowCopyNotification(message) {
4006 var existingNotification = document.querySelector('.ays-survey-footer-banner-copy-notification');
4007 if (existingNotification) {
4008 document.body.removeChild(existingNotification);
4009 }
4010
4011 var notification = document.createElement('div');
4012 notification.className = 'ays-survey-footer-banner-copy-notification';
4013 notification.textContent = message;
4014 document.body.appendChild(notification);
4015
4016 setTimeout(function() {
4017 notification.classList.add('show');
4018 }, 10);
4019
4020 setTimeout(function() {
4021 notification.classList.remove('show');
4022 setTimeout(function() {
4023 if (notification.parentNode) {
4024 document.body.removeChild(notification);
4025 }
4026 }, 300);
4027 }, 2000);
4028 }";
4029
4030 $content[] = '</script>';
4031
4032 $content = implode( '', $content );
4033 echo ($content);
4034 }
4035 }
4036
4037
4038 // public function ays_survey_new_mega_bundle_message_2024($ishmar){
4039 // if($ishmar == 0 ){
4040 // $content = array();
4041 // $content[] = '<div id="ays-survey-new-mega-bundle-dicount-month-main-2024" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4042 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
4043
4044 // $content[] = '<div class="ays-survey-discount-box-sale-image"></div>';
4045 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
4046
4047 // $content[] = '<div class="ays-survey-dicount-wrap-text-box-texts">';
4048 // $content[] = '<div>
4049 // <a href="https://ays-pro.com/mega-bundle?utm_source=survey-maker-free&utm_medium=dashboard&utm_campaign=survey-mega-bundle" target="_blank" style="color:#30499B;">
4050 // <span class="ays-survey-new-mega-bundle-limited-text">Limited</span> Offer for Mega bundle </a> <br>
4051
4052 // <span style="font-size: 19px ;">(Quiz + Survey + Poll)</span>
4053 // </div>';
4054 // $content[] = '</div>';
4055
4056 // $content[] = '<div style="font-size: 17px;">';
4057 // $content[] = '<img style="width: 24px;height: 24px;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/guarantee-new.png">';
4058 // $content[] = '<span style="padding-left: 4px; font-size: 14px; font-weight: 600;"> 30 Day Money Back Guarantee</span>';
4059
4060 // $content[] = '</div>';
4061
4062
4063
4064 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
4065
4066 // $content[] = '<form action="" method="POST">';
4067 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
4068 // if( current_user_can( 'manage_options' ) ){
4069 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0; color: #30499B;
4070 // ">Dismiss ad</button>';
4071 // $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
4072 // }
4073 // $content[] = '</div>';
4074 // $content[] = '</form>';
4075
4076 // $content[] = '</div>';
4077
4078 // $content[] = '</div>';
4079
4080 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
4081
4082 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
4083 // $content[] = '<div class="ays-survey-maker-countdown-container">';
4084
4085 // $content[] = '<div id="ays-survey-countdown">';
4086
4087 // $content[] = '<div style="font-weight: 500;">';
4088 // $content[] = __( "Offer ends in:", "survey-maker" );
4089 // $content[] = '</div>';
4090
4091 // $content[] = '<ul>';
4092 // $content[] = '<li><span id="ays-survey-countdown-days"></span>days</li>';
4093 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>Hours</li>';
4094 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>Minutes</li>';
4095 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>Seconds</li>';
4096 // $content[] = '</ul>';
4097 // $content[] = '</div>';
4098
4099 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
4100 // $content[] = '<span>🚀</span>';
4101 // $content[] = '<span>⌛</span>';
4102 // $content[] = '<span>🔥</span>';
4103 // $content[] = '<span>💣</span>';
4104 // $content[] = '</div>';
4105
4106 // $content[] = '</div>';
4107 // $content[] = '</div>';
4108
4109 // $content[] = '</div>';
4110
4111 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
4112 // $content[] = '<a href="https://ays-pro.com/mega-bundle?utm_source=survey-maker-free&utm_medium=dashboard&utm_campaign=survey-mega-bundle" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now !', "survey-maker" ) . '</a>';
4113 // $content[] = '<span >One-time payment</span>';
4114 // $content[] = '</div>';
4115 // $content[] = '</div>';
4116 // $content[] = '</div>';
4117
4118 // $content = implode( '', $content );
4119 // echo html_entity_decode(esc_html( $content ));
4120 // }
4121 // }
4122
4123 // // Black Friday 2024
4124 // public function ays_survey_black_friday_message_2024($ishmar){
4125 // if($ishmar == 0 ){
4126 // $content = array();
4127
4128 // $content[] = '<div id="ays-survey-black-friday-bundle-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4129 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
4130
4131 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
4132
4133 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
4134 // $content[] = '<div class="ays-survey-maker-countdown-container">';
4135
4136 // $content[] = '<div id="ays-survey-countdown">';
4137
4138 // $content[] = '<div>';
4139 // $content[] = __( "Offer ends in:", "survey-maker" );
4140 // $content[] = '</div>';
4141
4142 // $content[] = '<ul>';
4143 // $content[] = '<li><span id="ays-survey-countdown-days"></span>'. __( "Days", "survey-maker" ) .'</li>';
4144 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>'. __( "Hours", "survey-maker" ) .'</li>';
4145 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>'. __( "Minutes", "survey-maker" ) .'</li>';
4146 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>'. __( "Seconds", "survey-maker" ) .'</li>';
4147 // $content[] = '</ul>';
4148 // $content[] = '</div>';
4149
4150 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
4151 // $content[] = '<span>🚀</span>';
4152 // $content[] = '<span>⌛</span>';
4153 // $content[] = '<span>🔥</span>';
4154 // $content[] = '<span>💣</span>';
4155 // $content[] = '</div>';
4156
4157 // $content[] = '</div>';
4158 // $content[] = '</div>';
4159
4160 // $content[] = '</div>';
4161
4162 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
4163 // $content[] = '<div>';
4164
4165 // $content[] = '<span class="ays-survey-black-friday-bundle-title">';
4166 // $content[] = __( "<span><a href='https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=black-friday-mega-bundle-sale-banner' class='ays-survey-black-friday-bundle-title-link' target='_blank'>Black Friday Sale</a></span>", "survey-maker" );
4167 // $content[] = '</span>';
4168
4169 // $content[] = '</br>';
4170
4171 // $content[] = '<span class="ays-survey-black-friday-bundle-desc">';
4172 // $content[] = '<a class="ays-survey-black-friday-bundle-desc" href="https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=black-friday-mega-bundle-sale-banner" class="ays-survey-black-friday-bundle-title-link" target="_blank">';
4173 // $content[] = __( "50% OFF", "survey-maker" );
4174 // $content[] = '</a>';
4175 // $content[] = '</span>';
4176 // $content[] = '</div>';
4177
4178 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
4179
4180 // $content[] = '<form action="" method="POST">';
4181 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
4182 // if( current_user_can( 'manage_options' ) ){
4183 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_bf_btn" style="height: 32px; margin-left: 0;padding-left: 0">'. __( "Dismiss ad", "survey-maker" ) .'</button>';
4184 // $content[] = wp_nonce_field( 'survey-maker-sale-bf-banner' , 'survey-maker-sale-bf-banner' );
4185 // }
4186 // $content[] = '</div>';
4187 // $content[] = '</form>';
4188
4189 // $content[] = '</div>';
4190
4191 // $content[] = '</div>';
4192
4193 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-black-friday-bundle-coupon-text-box">';
4194 // // $content[] = '<div class="ays-survey-black-friday-bundle-coupon-row">';
4195 // // $content[] = 'bfdeal20off';
4196 // // $content[] = '</div>';
4197
4198 // $content[] = '<div class="ays-survey-black-friday-bundle-data-title">';
4199 // $content[] = '<a href="https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=black-friday-mega-bundle-sale-banner" class="ays-survey-black-friday-bundle-data-title-text" target="_blank">';
4200 // $content[] = __( 'MEGA BUNDLE', "survey-maker" );
4201 // $content[] = '</a>';
4202 // $content[] = '</div>';
4203 // $content[] = '</div>';
4204
4205 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
4206 // $content[] = '<a href="https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=black-friday-mega-bundle-sale-banner" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Get Your Deal', "survey-maker" ) . '</a>';
4207 // $content[] = '<span class="ays-survey-dicount-one-time-text">';
4208 // $content[] = __( "One-time payment", "survey-maker" );
4209 // $content[] = '</span>';
4210 // $content[] = '</div>';
4211 // $content[] = '</div>';
4212 // $content[] = '</div>';
4213
4214 // $content = implode( '', $content );
4215 // echo $content;
4216 // }
4217 // }
4218
4219 // Christmas Top Banner 2024
4220 // public function ays_survey_christmas_top_message_2024($ishmar){
4221 // if($ishmar == 0 ){
4222 // $content = array();
4223
4224 // $content[] = '<div id="ays-survey-christmas-top-bundle-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4225 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
4226
4227 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
4228
4229 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
4230 // $content[] = '<div class="ays-survey-maker-countdown-container">';
4231
4232 // $content[] = '<div id="ays-survey-countdown">';
4233
4234 // $content[] = '<div>';
4235 // $content[] = __( "Offer ends in:", "survey-maker" );
4236 // $content[] = '</div>';
4237
4238 // $content[] = '<ul>';
4239 // $content[] = '<li><span id="ays-survey-countdown-days"></span>'. __( "Days", "survey-maker" ) .'</li>';
4240 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>'. __( "Hours", "survey-maker" ) .'</li>';
4241 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>'. __( "Minutes", "survey-maker" ) .'</li>';
4242 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>'. __( "Seconds", "survey-maker" ) .'</li>';
4243 // $content[] = '</ul>';
4244 // $content[] = '</div>';
4245
4246 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
4247 // $content[] = '<span>🚀</span>';
4248 // $content[] = '<span>⌛</span>';
4249 // $content[] = '<span>🔥</span>';
4250 // $content[] = '<span>💣</span>';
4251 // $content[] = '</div>';
4252
4253 // $content[] = '</div>';
4254 // $content[] = '</div>';
4255
4256 // $content[] = '</div>';
4257
4258 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
4259 // $content[] = '<div>';
4260
4261 // $content[] = '<span class="ays-survey-christmas-top-bundle-title">';
4262 // $content[] = '<span>';
4263 // $content[] = sprintf('<a class="ays-survey-christmas-top-bundle-desc" href="https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=christmas-sale-banner%s" class="ays-survey-christmas-top-bundle-title-link" target="_blank">', SURVEY_MAKER_VERSION);
4264
4265 // $content[] = __( "Christmas Sale", "survey-maker" );
4266 // $content[] = '</a>';
4267 // $content[] = '</span>';
4268 // $content[] = '</br>';
4269
4270 // $content[] = '<span class="ays-survey-christmas-top-bundle-desc">';
4271 // $content[] = sprintf('<a class="ays-survey-christmas-top-bundle-desc" href="https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=christmas-sale-banner%s" class="ays-survey-christmas-top-bundle-title-link" target="_blank">', SURVEY_MAKER_VERSION);
4272 // $content[] = __( "20% Extra OFF", "survey-maker" );
4273 // $content[] = '</a>';
4274 // $content[] = '</span>';
4275 // $content[] = '</div>';
4276
4277 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
4278
4279 // $content[] = '<form action="" method="POST">';
4280 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
4281 // if( current_user_can( 'manage_options' ) ){
4282 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">'. __( "Dismiss ad", "survey-maker" ) .'</button>';
4283 // $content[] = wp_nonce_field( "survey-maker" . '-sale-banner' , "survey-maker" . '-sale-banner' );
4284 // }
4285 // $content[] = '</div>';
4286 // $content[] = '</form>';
4287
4288 // $content[] = '</div>';
4289
4290 // $content[] = '</div>';
4291
4292 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-christmas-top-bundle-coupon-text-box">';
4293 // $content[] = '<div class="ays-survey-christmas-top-bundle-coupon-row">';
4294 // $content[] = 'xmas20off';
4295 // $content[] = '</div>';
4296
4297 // $content[] = '<div class="ays-survey-christmas-top-bundle-text-row">';
4298 // $content[] = __( '20% Extra Discount Coupon', "survey-maker" );
4299 // $content[] = '</div>';
4300 // $content[] = '</div>';
4301
4302 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
4303 // $content[] = sprintf('<a href="https://ays-pro.com/wordpress/survey-maker?utm_source=dashboard&utm_medium=survey-free&utm_campaign=christmas-sale-banner%s" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">', SURVEY_MAKER_VERSION);
4304 // $content[] = __( 'Get Your Deal', "survey-maker" );
4305 // $content[] = '</a>';
4306 // $content[] = '<span class="ays-survey-dicount-one-time-text">';
4307 // $content[] = __( "One-time payment", "survey-maker" );
4308 // $content[] = '</span>';
4309 // $content[] = '</div>';
4310 // $content[] = '</div>';
4311 // $content[] = '</div>';
4312
4313 // $content = implode( '', $content );
4314 // echo $content;
4315 // }
4316 // }
4317
4318
4319
4320 // Black Friday
4321 // public function ays_survey_black_friday_message($ishmar){
4322 // if($ishmar == 0 ){
4323 // $content = array();
4324
4325 // $content[] = '<div id="ays-survey-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_chart_dicount_info">';
4326 // $content[] = '<div id="ays-survey-dicount-black-friday-month" class="ays_chart_dicount_month">';
4327 // $content[] = '<div class="ays-survey-dicount-black-friday-box">';
4328 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-box-80" style="width: 70%;">';
4329 // $content[] = '<div class="ays-survey-dicount-black-friday-title-row">' . __( 'Limited Time', "survey-maker" ) .' '. '<a href="https://ays-pro.com/mega-bundle?utm_medium=survey-free&utm_campaign=black-friday-sale-banner&utm_source=dashboard" class="ays-survey-dicount-black-friday-button-sale" target="_blank">' . __( 'Sale', "chart-builder" ) . '</a>' . '</div>';
4330 // $content[] = '<div class="ays-survey-dicount-black-friday-title-row">' . __( 'Mega bundle', "survey-maker" ) . ' (Quiz+Survey+Poll)!</div> ';
4331 // $content[] = '</div>';
4332
4333 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-text-box">';
4334 // $content[] = '<div class="ays-survey-dicount-black-friday-text-row">' . __( '50% off', "survey-maker" ) . '</div>';
4335 // $content[] = '</div>';
4336
4337 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
4338 // $content[] = '<div id="ays-survey-countdown-main-container">';
4339 // $content[] = '<div class="ays-survey-countdown-container">';
4340 // $content[] = '<div id="ays-survey-countdown" style="display: block;">';
4341 // $content[] = '<ul>';
4342 // $content[] = '<li><span id="ays-survey-countdown-days">0</span>' . __( 'Days', "survey-maker" ) . '</li>';
4343 // $content[] = '<li><span id="ays-survey-countdown-hours">0</span>' . __( 'Hours', "survey-maker" ) . '</li>';
4344 // $content[] = '<li><span id="ays-survey-countdown-minutes">0</span>' . __( 'Minutes', "survey-maker" ) . '</li>';
4345 // $content[] = '<li><span id="ays-survey-countdown-seconds">0</span>' . __( 'Seconds', "survey-maker" ) . '</li>';
4346 // $content[] = '</ul>';
4347 // $content[] = '</div>';
4348 // $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
4349 // $content[] = '<span>🚀</span>';
4350 // $content[] = '<span>⌛</span>';
4351 // $content[] = '<span>🔥</span>';
4352 // $content[] = '<span>💣</span>';
4353 // $content[] = '</div>';
4354 // $content[] = '</div>';
4355 // $content[] = '</div>';
4356 // $content[] = '</div>';
4357
4358 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
4359 // $content[] = '<a href="https://ays-pro.com/mega-bundle?utm_medium=survey-free&utm_campaign=black-friday-sale-banner&utm_source=dashboard" class="ays-survey-dicount-black-friday-button-buy-now" target="_blank">' . __( 'Get Your Deal', "survey-maker" ) . '</a>';
4360 // $content[] = '</div>';
4361 // $content[] = '</div>';
4362 // $content[] = '</div>';
4363
4364 // $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-black-friday">';
4365 // $content[] = '<form action="" method="POST">';
4366 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
4367 // if( current_user_can( 'manage_options' ) ){
4368 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
4369 // $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
4370 // }
4371 // $content[] = '</div>';
4372 // $content[] = '</form>';
4373 // $content[] = '</div>';
4374 // $content[] = '</div>';
4375
4376 // $content = implode( '', $content );
4377
4378 // echo $content;
4379 // }
4380 // }
4381
4382 // Christmas banner
4383 // public static function ays_survey_christmas_message($ishmar){
4384 // if($ishmar == 0 ){
4385 // $content = array();
4386
4387 // $content[] = '<div id="ays-survey-dicount-christmas-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4388 // $content[] = '<div id="ays-survey-dicount-christmas-month" class="ays_survey_dicount_month">';
4389 // $content[] = '<div class="ays-survey-dicount-christmas-box">';
4390 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box ays-survey-dicount-christmas-wrap-box-80">';
4391 // $content[] = '<div class="ays-survey-dicount-christmas-title-row">' . __( 'Limited Time', "survey-maker" ) .' '. '<a href="https://ays-pro.com/wordpress/survey-maker" class="ays-survey-dicount-christmas-button-sale" target="_blank">20%</a>' . ' SALE</div>';
4392 // $content[] = '<div class="ays-survey-dicount-christmas-title-row">' . __( 'Survey Maker Plugin', "survey-maker" ) . '</div>';
4393 // $content[] = '</div>';
4394
4395 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box" style="width: 25%;">';
4396 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
4397 // $content[] = '<div class="ays-survey-countdown-container">';
4398 // $content[] = '<div id="ays-survey-countdown" style="display: block;">';
4399 // $content[] = '<ul>';
4400 // $content[] = '<li><span id="ays-survey-countdown-days"></span>' . __( 'Days', "survey-maker" ) . '</li>';
4401 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>' . __( 'Hours', "survey-maker" ) . '</li>';
4402 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>' . __( 'Minutes', "survey-maker" ) . '</li>';
4403 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>' . __( 'Seconds', "survey-maker" ) . '</li>';
4404 // $content[] = '</ul>';
4405 // $content[] = '</div>';
4406 // $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
4407 // $content[] = '<span>🚀</span>';
4408 // $content[] = '<span>⌛</span>';
4409 // $content[] = '<span>🔥</span>';
4410 // $content[] = '<span>💣</span>';
4411 // $content[] = '</div>';
4412 // $content[] = '</div>';
4413 // $content[] = '</div>';
4414 // $content[] = '</div>';
4415
4416 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box" style="width: 25%;">';
4417 // $content[] = '<a href="https://ays-pro.com/wordpress/survey-maker" class="ays-survey-dicount-christmas-button-buy-now" target="_blank">' . __( 'BUY NOW', "survey-maker" ) . '!</a>';
4418 // $content[] = '</div>';
4419 // $content[] = '</div>';
4420 // $content[] = '</div>';
4421
4422 // $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-christmas">';
4423 // $content[] = '<form action="" method="POST">';
4424 // $content[] = '<div id="ays-survey-dismiss-buttons-content-christmas">';
4425 // $content[] = '<button class="btn btn-link ays-button-christmas" name="ays_survey_sale_btn" style="">' . __( 'Dismiss ad', "survey-maker" ) . '</button>';
4426 // $content[] = '</div>';
4427 // $content[] = '</form>';
4428 // $content[] = '</div>';
4429 // $content[] = '</div>';
4430
4431 // $content = implode( '', $content );
4432
4433 // echo $content;
4434 // }
4435 // }
4436
4437 public function ays_survey_add_survey_template() {
4438 global $wpdb;
4439
4440 $template_file_name = (isset($_REQUEST['template_file_name']) && $_REQUEST['template_file_name'] != "") ? sanitize_text_field($_REQUEST['template_file_name'] ) : null;
4441
4442 switch($template_file_name){
4443 case 'customer-feedback-form':
4444 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/customer-feedback-form.json");
4445 break;
4446 case 'employee-satisfaction-survey':
4447 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/employee-satisfaction-survey.json");
4448 break;
4449 case 'event-evaluation-survey':
4450 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/event-evaluation-survey.json");
4451 break;
4452 case 'product-research-survey':
4453 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/product-research-survey.json");
4454 break;
4455 case 'restaurant-evaluation-survey':
4456 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/restaurant-evaluation-survey.json");
4457 break;
4458 case 'market-research-survey':
4459 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/market-research-survey.json");
4460 break;
4461 case 'brand-awareness-survey':
4462 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/brand-awareness-survey.json");
4463 break;
4464 case 'user-persona-survey':
4465 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/user-persona-survey.json");
4466 break;
4467 }
4468
4469 $response = array();
4470 $json = json_decode($json, true);
4471 $json_key = isset($json['ays_survey_key']) ? $json['ays_survey_key'] : false;
4472
4473 if($json_key) {
4474 $response = array(
4475 'status' => true,
4476 'data' => $json
4477 );
4478
4479 echo json_encode( $response );
4480 wp_die();
4481 }else{
4482 $response = array(
4483 'status' => false
4484 );
4485
4486 echo json_encode( $response );
4487 wp_die();
4488 }
4489 }
4490
4491 // public static function ays_survey_spring_bundle_small_message($ishmar){
4492 // if($ishmar == 0 ){
4493 // $content = array();
4494
4495 // $content[] = '<div id="ays-survey-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4496 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
4497 // $content[] = '<a href="https://ays-pro.com/mega-bundle" target="_blank" class="ays-survey-sale-banner-link"><img src="' . SURVEY_MAKER_ADMIN_URL . '/images/mega_bundle_logo_box.png"></a>';
4498
4499 // $content[] = '<div class="ays-survey-dicount-wrap-box">';
4500 // $content[] = '<p>';
4501 // $content[] = '<strong>';
4502 // $content[] = __( "Spring is here! <span class='ays-survey-dicount-wrap-color'>50%</span> SALE on <span><a href='https://ays-pro.com/mega-bundle' target='_blank' class='ays-survey-dicount-wrap-color ays-survey-dicount-wrap-text-decoration'>Mega Bundle</a></span><span style='display: block;'>Quiz + Survey + Poll</span>", SURVEY_MAKER_ADMIN_URL );
4503 // $content[] = '</strong>';
4504 // $content[] = '</p>';
4505 // $content[] = '</div>';
4506
4507 // $content[] = '<div class="ays-survey-dicount-wrap-box">';
4508
4509 // $content[] = '<div id="ays-survey-countdown-main-container">';
4510
4511 // $content[] = '<form action="" method="POST" class="ays-survey-btn-form">';
4512 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn_small_spring" style="height: 32px; margin-left: 0;padding-left: 0">Dismiss ad</button>';
4513 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn_spring_small_for_two_months" style="height: 32px; padding-left: 0">Dismiss ad for 2 months</button>';
4514 // $content[] = '</form>';
4515
4516 // $content[] = '</div>';
4517
4518 // $content[] = '</div>';
4519
4520 // $content[] = '<a href="https://ays-pro.com/mega-bundle" class="button button-primary ays-button" id="ays-button-top-buy-now" target="_blank">' . __( 'Buy Now !', SURVEY_MAKER_ADMIN_URL ) . '</a>';
4521 // $content[] = '</div>';
4522 // $content[] = '</div>';
4523
4524 // $content = implode( '', $content );
4525 // echo $content;
4526 // }
4527 // }
4528
4529 public function ays_survey_maker_live_preview_content(){
4530
4531 $content = isset($_REQUEST['content']) && $_REQUEST['content'] != '' ? wp_kses_post( $_REQUEST['content'] ) : null;
4532 if($content === null){
4533 ob_end_clean();
4534 $ob_get_clean = ob_get_clean();
4535 echo json_encode(array(
4536 'status' => false,
4537 ));
4538 }
4539 // $content = Survey_Maker_Data::ays_autoembed( $content );
4540 $content = stripslashes( wpautop( $content ) );
4541 ob_end_clean();
4542 $ob_get_clean = ob_get_clean();
4543 echo json_encode(array(
4544 'status' => true,
4545 'content' => $content,
4546 ));
4547 wp_die();
4548 }
4549
4550 public function add_tabs() {
4551 $screen = get_current_screen();
4552
4553 if ( ! $screen) {
4554 return;
4555 }
4556
4557 $title = __( 'General Information:', "survey-maker");
4558 $content_text = 'Get real-time feedback with the Survey Maker plugin. You are free to generate unlimited online surveys with unlimited questions and sections. Easily create your customer satisfaction surveys, employee engagement forms, market researches, event planning questionnaires with this plugin.
4559 <br><br>Increase users’ track to your WordPress website with the Survey Maker features. Build smarter surveys with LogicJump, advance your questionnaires with Conditional Results, earn money with Paid Surveys, generate leads super easily, get valuable feedback.';
4560
4561 $sidebar_content = '<p><strong>' . __( 'For more information:', "survey-maker") . '</strong></p>' .
4562 '<p>
4563 <a href="https://www.youtube.com/watch?v=Q1qi649acb0" target="_blank">' . __( 'YouTube video tutorials' , "survey-maker" ) . '</a>
4564 </p>' .
4565 '<p>
4566 <a href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank">' . __( 'Documentation', "survey-maker" ) . '</a>
4567 </p>' .
4568 '<p>
4569 <a href="https://ays-pro.com/wordpress/survey-maker" target="_blank">' . __( 'Survey Maker plugin pro version', "survey-maker" ) . '</a>
4570 </p>' .
4571 '<p>
4572 <a href="https://ays-demo.com/wordpress-survey-plugin-pro-demo/" target="_blank">' . __( 'Survey Maker plugin demo', "survey-maker" ) . '</a>
4573 </p>';
4574
4575
4576 $content = '<h2>' . __( 'Survey Maker Information', "survey-maker") . '</h2>'
4577 .'<p>' .sprintf(__( '%s', "survey-maker" ), $content_text).'</p>';
4578
4579 $help_tab_content = array(
4580 'id' => 'survey_maker_help_tab',
4581 'title' => $title,
4582 'content' => $content
4583 );
4584
4585 $screen->add_help_tab($help_tab_content);
4586
4587 $screen->set_help_sidebar($sidebar_content);
4588 }
4589
4590 public function get_next_or_prev_survey_by_id( $id, $type = "next" ) {
4591 global $wpdb;
4592
4593 $surveys_table = esc_sql( $wpdb->prefix . "ayssurvey_surveys" );
4594
4595 $where = array();
4596 $where_condition = "";
4597
4598 $id = (isset( $id ) && $id != "" && absint($id) != 0) ? absint( sanitize_text_field( $id ) ) : null;
4599 $type = (isset( $type ) && $type != "") ? sanitize_text_field( $type ) : "next";
4600
4601 if ( is_null( $id ) || $id == 0 ) {
4602 return null;
4603 }
4604
4605 switch ( $type ) {
4606 case 'prev':
4607 $where[] = ' `id` < ' . $id . ' ORDER BY `id` DESC ';
4608 break;
4609 case 'next':
4610 default:
4611 $where[] = ' `id` > ' . $id;
4612 break;
4613 }
4614
4615 if( ! empty($where) ){
4616 $where_condition = " WHERE " . implode( " AND ", $where );
4617 }
4618
4619 $sql = "SELECT `id` FROM {$surveys_table} ". $where_condition ." LIMIT 1;";
4620 $results = $wpdb->get_row( $sql, 'ARRAY_A' );
4621
4622 return $results;
4623
4624 }
4625
4626 public static function ays_survey_update_banner_time(){
4627
4628 $date = time() + ( 3 * 24 * 60 * 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
4629 // $date = time() + ( 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); // for testing | 1 min
4630 $next_3_days = date('M d, Y H:i:s', $date);
4631
4632 $ays_survey_banner_time = get_option('ays_survey_banner_time');
4633
4634 if ( !$ays_survey_banner_time || is_null( $ays_survey_banner_time ) ) {
4635 update_option('ays_survey_banner_time', $next_3_days );
4636 }
4637
4638 $get_ays_survey_banner_time = get_option('ays_survey_banner_time');
4639
4640 $val = 60*60*24*0.5; // half day
4641 // $val = 60; // for testing | 1 min
4642
4643 $current_date = current_time( 'mysql' );
4644 $date_diff = strtotime($current_date) - intval(strtotime($get_ays_survey_banner_time));
4645
4646 $days_diff = $date_diff / $val;
4647 if(intval($days_diff) > 0 ){
4648 update_option('ays_survey_banner_time', $next_3_days);
4649 }
4650
4651 return $get_ays_survey_banner_time;
4652 }
4653
4654 //---------------- Survey submisson open results in popup ----------------
4655
4656
4657 public function ays_survey_show_results(){
4658
4659 // Run a security check.
4660 check_ajax_referer( 'survey-maker-ajax-results-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
4661
4662 global $wpdb;
4663 if( !is_user_logged_in() ) {
4664 echo json_encode( array(
4665 'status' => false,
4666 'rows' => ""
4667 ) );
4668
4669 };
4670
4671 // Check for permissions.
4672 if ( ! current_user_can( 'manage_options' ) ) {
4673 ob_end_clean();
4674 $ob_get_clean = ob_get_clean();
4675 echo json_encode(array(
4676 'status' => false,
4677 "rows" => ""
4678 ));
4679 wp_die();
4680 }
4681
4682 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ays_survey_show_results' && isset($_REQUEST['survey_id']) && !empty($_REQUEST['survey_id'])) {
4683
4684 ob_start();
4685
4686 $survey_id = absint(intval($_REQUEST['survey_id']));
4687
4688
4689 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
4690
4691 $filters = array();
4692
4693 $submission_count_and_ids = Survey_Maker_Data::get_submission_count_and_ids( $survey_id, $filters );
4694 $submission_ids_arr = ( isset( $submission_count_and_ids['submission_ids_arr'] ) && ! empty( $submission_count_and_ids['submission_ids_arr'] ) ) ? Survey_Maker_Data::recursive_sanitize_text_field( $submission_count_and_ids['submission_ids_arr'] ) : array();
4695 $filters['filter_submission_ids'] = $submission_ids_arr;
4696
4697
4698 $sql = "SELECT * FROM " . $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys WHERE id =" . absint( $survey_id );
4699 $survey_name = $wpdb->get_row( $sql, 'ARRAY_A' );
4700
4701 $survey_options = isset( $survey_name['options'] ) && $survey_name['options'] != '' ? json_decode( $survey_name['options'], true ) : array();
4702
4703 $survey_for_charts = isset( $survey_options['survey_color'] ) && $survey_options['survey_color'] != '' ? esc_attr($survey_options['survey_color']) : "rgb(255, 87, 34)";
4704 $survey_for_charts_text_color = isset( $survey_options['survey_text_color'] ) && $survey_options['survey_text_color'] != '' ? esc_attr($survey_options['survey_text_color']) : "rgb(255, 87, 34)";
4705 if(isset( $survey_options['survey_color'] ) && $survey_options['survey_color'] == 'rgba(0,0,0,0)'){
4706 $survey_for_charts = "rgba(0,0,0,1)";
4707 }
4708 if($survey_for_charts_text_color == 'rgba(0,0,0,0)'){
4709 $survey_for_charts_text_color = "rgba(0,0,0,1)";
4710 }
4711 // Allow HTML in answers
4712 $survey_options[ 'survey_allow_html_in_answers' ] = isset($survey_options[ 'survey_allow_html_in_answers' ]) ? $survey_options[ 'survey_allow_html_in_answers' ] : 'off';
4713 $allow_html_in_answers = (isset($survey_options[ 'survey_allow_html_in_answers' ]) && $survey_options[ 'survey_allow_html_in_answers' ] == 'on') ? true : false;
4714
4715 // Allow HTML in description
4716 $survey_options[ 'survey_allow_html_in_section_description' ] = isset($survey_options[ 'survey_allow_html_in_section_description' ]) ? $survey_options[ 'survey_allow_html_in_section_description' ] : 'off';
4717 $survey_allow_html_in_section_description = (isset($survey_options[ 'survey_allow_html_in_section_description' ]) && $survey_options[ 'survey_allow_html_in_section_description' ] == 'on') ? true : false;
4718
4719 $user_id = get_current_user_id();
4720
4721 $author_id = isset( $survey_name['author_id'] ) && $survey_name['author_id'] != "" ? intval( $survey_name['author_id'] ) : 0;
4722 $survey_title = isset( $survey_name['title'] ) && $survey_name['title'] != "" ? esc_html__( $survey_name['title'], "survey-maker" ) : "";
4723
4724 $owner = false;
4725 if( $user_id == $author_id ){
4726 $owner = true;
4727 }
4728
4729 if( !$owner ){
4730 $url = esc_url_raw( remove_query_arg( array( 'page', 'survey' ) ) ) . "?page=survey-maker-submissions";
4731 wp_redirect( $url );
4732 }
4733
4734 $gen_options = ($this->settings_obj->ays_get_setting('options') === false) ? array() : json_decode($this->settings_obj->ays_get_setting('options'), true);
4735
4736 $submission_id = (isset($_REQUEST['submission_id']) && $_REQUEST['submission_id'] != '') ? absint( sanitize_text_field( $_REQUEST['submission_id'] ) ) : null;
4737 if($submission_id == null){
4738
4739 return array(
4740 'status' => false,
4741 'rows' => ""
4742 );
4743 }
4744 $submission = array(
4745 'id' => $submission_id
4746 );
4747
4748
4749 $ays_survey_individual_questions = $this->ays_survey_individual_results_for_one_submission( $submission, $survey_name );
4750
4751 // Show question title as HTML
4752 $survey_options[ 'survey_show_questions_as_html' ] = isset($survey_options[ 'survey_show_questions_as_html' ]) ? $survey_options[ 'survey_show_questions_as_html' ] : 'on';
4753 $survey_show_questions_as_html = $survey_options[ 'survey_show_questions_as_html' ] == 'on' ? true : false;
4754
4755 // Get user info
4756 $individual_user_name = "";
4757 $individual_user_email = "";
4758 $individual_user_ip = "";
4759 $individual_user_date = "";
4760 $individual_user_sub_id = "";
4761 $individual_user_password = "";
4762 $dashboard_admin_note = "";
4763 $individual_user_device_type = "";
4764 if( isset($ays_survey_individual_questions['user_info']) && is_array( $ays_survey_individual_questions['user_info']) ){
4765 $individual_user_name = isset($ays_survey_individual_questions['user_info']['user_name']) && isset($ays_survey_individual_questions['user_info']['user_name']) ? stripslashes( $ays_survey_individual_questions['user_info']['user_name'] ) : "";
4766 $individual_user_email = isset($ays_survey_individual_questions['user_info']['user_email']) && isset($ays_survey_individual_questions['user_info']['user_email']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['user_email'] ) ) : "";
4767 $individual_user_ip = isset($ays_survey_individual_questions['user_info']['user_ip']) && isset($ays_survey_individual_questions['user_info']['user_ip']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['user_ip'] ) ) : "";
4768 $individual_user_date = isset($ays_survey_individual_questions['user_info']['submission_date']) && isset($ays_survey_individual_questions['user_info']['submission_date']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['submission_date'] ) ) : "";
4769 $individual_user_sub_id = isset($ays_survey_individual_questions['user_info']['id']) && isset($ays_survey_individual_questions['user_info']['id']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['id'] ) ) : "";
4770 $individual_user_password = isset($ays_survey_individual_questions['user_info']['password']) && isset($ays_survey_individual_questions['user_info']['password']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['password'] ) ) : "";
4771 $individual_user_extra_data = isset($ays_survey_individual_questions['user_info']['options']) && $ays_survey_individual_questions['user_info']['options'] != '' ? json_decode(($ays_survey_individual_questions['user_info']['options']) , 'true') : array();
4772 $individual_user_device_type = isset($individual_user_extra_data['device']) && $individual_user_extra_data['device'] != '' ? esc_attr($individual_user_extra_data['device']) : '';
4773 $dashboard_admin_note = isset($ays_survey_individual_questions['user_info']['admin_note']) && isset($ays_survey_individual_questions['user_info']['admin_note']) ? stripslashes( esc_attr( $ays_survey_individual_questions['user_info']['admin_note'] ) ) : "";
4774 }
4775
4776 $text_types = array(
4777 'text',
4778 'short_text',
4779 'number',
4780 'phone',
4781 'name',
4782 'hidden',
4783 'email',
4784 'date',
4785 'time',
4786 'date_time',
4787 );
4788
4789 $submissions_count = 0;
4790 if(intval($submission_count_and_ids['submission_count']) > 0){
4791 $submissions_count = $submission_count_and_ids['submission_count'];
4792 }
4793
4794 $export_disabled = 'disabled';
4795 if( $submissions_count > 0 ){
4796 $export_disabled = '';
4797 }
4798
4799 $survey_data_clipboard = array(
4800 "user_name" => $individual_user_name,
4801 "user_email" => $individual_user_email,
4802 "user_ip" => $individual_user_ip,
4803 "user_date" => $individual_user_date,
4804 "user_sub_id" => $individual_user_sub_id,
4805 "user_device_type" => $individual_user_device_type,
4806 );
4807
4808 if($individual_user_password){
4809 $survey_data_clipboard['user_password'] = $individual_user_password;
4810 }
4811
4812 $survey_data_formated_for_clipboard = Survey_Maker_Data::ays_survey_copy_text_formater($survey_data_clipboard);
4813
4814
4815 Survey_Maker_Data::get_template_part( 'partials/submissions/partials/survey-maker-each-submission-individual', '', get_defined_vars() );
4816
4817 $wpdb->get_var("UPDATE " . $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions SET `read`= 1 WHERE `id`= $submission_id");
4818
4819 $html = ob_get_clean();
4820
4821 echo json_encode( array(
4822 'status' => true,
4823 'rows' => $html
4824 ) );
4825 wp_die();
4826 }
4827
4828 echo json_encode( array(
4829 'status' => false,
4830 'rows' => ""
4831 ) );
4832
4833 }
4834
4835 public function ays_survey_author_user_search() {
4836 $content_text = array(
4837 'results' => array()
4838 );
4839
4840 if( current_user_can( 'manage_options' ) ){
4841 $search = isset($_REQUEST['search']) && $_REQUEST['search'] != '' ? sanitize_text_field( $_REQUEST['search'] ) : null;
4842 $checked = isset($_REQUEST['val']) && $_REQUEST['val'] !='' ? sanitize_text_field( $_REQUEST['val'] ) : null;
4843
4844 $args = 'search=';
4845 if($search !== null){
4846 $args .= '*';
4847 $args .= $search;
4848 $args .= '*';
4849 }
4850
4851 $users = get_users($args);
4852
4853 foreach ($users as $key => $value) {
4854 if ($checked !== null) {
4855 if ( !is_array( $checked ) ) {
4856 $checked2 = $checked;
4857 $checked = array();
4858 $checked[] = absint($checked2);
4859 }
4860 if (in_array($value->ID, $checked)) {
4861 continue;
4862 }else{
4863 $content_text['results'][] = array(
4864 'id' => $value->ID,
4865 'text' => $value->data->display_name,
4866 );
4867 }
4868 }else{
4869 $content_text['results'][] = array(
4870 'id' => $value->ID,
4871 'text' => $value->data->display_name,
4872 );
4873 }
4874 }
4875 }
4876
4877 ob_end_clean();
4878 echo json_encode($content_text);
4879 wp_die();
4880 }
4881
4882 // public function ays_survey_subscribe_email(){
4883 // $subscribe_email = isset($_REQUEST['email']) && $_REQUEST['email'] != "" ? sanitize_email($_REQUEST['email']) : "";
4884 // $subscribe_website = isset($_REQUEST['website']) && $_REQUEST['website'] != "" ? sanitize_url($_REQUEST['website']) : "";
4885 // // $url = "http://localhost/survey-grab-gift/";
4886 // $url = "https://ays-pro.com/add-on-email/survey-grab-gift/";
4887 // if($subscribe_email != "" && $subscribe_website != ''){
4888 // $current_date = date("Y-m-d");
4889 // $current_user_ip = Survey_Maker_Data::get_user_ip();
4890 // $send_request = wp_remote_post($url, array(
4891 // 'headers' => array("Content-Type: application/json; charset=UTF-8"),
4892 // 'body' => json_encode( array(
4893 // "email" => $subscribe_email,
4894 // "website" => $subscribe_website,
4895 // "user_ip" => $current_user_ip,
4896 // "subscirbe_date" => $current_date
4897 // ) ),
4898 // ) );
4899 // $response = wp_remote_retrieve_body($send_request);
4900 // $response = json_decode($response, true);
4901 // if(isset($response) && is_array($response)){
4902 // $response_code = isset($response['code']) && $response['code'] != "" ? $response['code'] : "";
4903 // $response_message = isset($response['msg']) && $response['msg'] != "" ? $response['msg'] : "";
4904 // $response_status = $response_code > 0 ? true : false;
4905 // echo json_encode(array(
4906 // "status" => $response_code,
4907 // "message" => $response_message
4908 // ));
4909 // wp_die();
4910 // }
4911 // else{
4912 // echo json_encode(array(
4913 // "status" => false,
4914 // "message" => "Something went wrong. Please try again"
4915 // ));
4916 // wp_die();
4917 // }
4918 // }
4919 // }
4920
4921 /**
4922 * Check if plugin can be installed
4923 */
4924 public function ays_survey_can_install($plugin_slug) {
4925 if (!function_exists('get_plugins')) {
4926 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4927 }
4928
4929 $plugins = get_plugins();
4930 foreach ($plugins as $plugin_file => $plugin_data) {
4931 if (strpos($plugin_file, $plugin_slug) !== false) {
4932 return false; // Plugin already exists
4933 }
4934 }
4935 return true; // Plugin can be installed
4936 }
4937
4938 /**
4939 * Check if plugin can be activated
4940 */
4941 public function ays_survey_can_activate($plugin_slug) {
4942 if (!function_exists('get_plugins')) {
4943 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4944 }
4945
4946 $plugins = get_plugins();
4947 foreach ($plugins as $plugin_file => $plugin_data) {
4948 if (strpos($plugin_file, $plugin_slug) !== false) {
4949 return !is_plugin_active($plugin_file); // Can activate if not already active
4950 }
4951 }
4952 return false; // Plugin doesn't exist
4953 }
4954
4955 /**
4956 * Install plugin via AJAX
4957 */
4958 public function ays_survey_install_plugin() {
4959 if (!current_user_can('install_plugins')) {
4960 wp_die(json_encode(array('success' => false, 'message' => 'Insufficient permissions')));
4961 }
4962
4963 if (!wp_verify_nonce($_POST['nonce'], 'ajax-nonce')) {
4964 wp_die(json_encode(array('success' => false, 'message' => 'Security check failed')));
4965 }
4966
4967 $plugin_slug = sanitize_text_field($_POST['plugin_slug']);
4968
4969 if (!function_exists('plugins_api')) {
4970 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4971 }
4972 if (!class_exists('WP_Upgrader')) {
4973 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4974 }
4975
4976 $api = plugins_api('plugin_information', array('slug' => $plugin_slug));
4977
4978 if (is_wp_error($api)) {
4979 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Plugin not found'))));
4980 }
4981
4982 $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
4983 $result = $upgrader->install($api->download_link);
4984
4985 if ($result) {
4986 // Load plugin.php for get_plugins() and activate_plugin() if not loaded yet
4987 if ( ! function_exists( 'get_plugins' ) ) {
4988 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4989 }
4990
4991 // Clear plugins cache to ensure the newly installed plugin is visible
4992 if ( function_exists( 'wp_clean_plugins_cache' ) ) {
4993 wp_clean_plugins_cache();
4994 }
4995
4996 $plugins = get_plugins();
4997 $plugin_file = '';
4998
4999 foreach ( $plugins as $file => $plugin_data ) {
5000 if ( strpos( $file, $plugin_slug ) !== false ) {
5001 $plugin_file = $file;
5002 break;
5003 }
5004 }
5005
5006 if ( empty( $plugin_file ) ) {
5007 wp_die( json_encode( array( 'success' => false, 'message' => esc_html__('Plugin main file not found')) ) );
5008 }
5009
5010 // Ensure activate_plugin() is available
5011 if ( ! function_exists( 'activate_plugin' ) ) {
5012 require_once ABSPATH . 'wp-admin/includes/plugin.php';
5013 }
5014
5015 $activate = activate_plugin( $plugin_file );
5016
5017 if ( is_wp_error( $activate ) ) {
5018 wp_die( json_encode( array( 'success' => false, 'message' => $activate->get_error_message() ) ) );
5019 }
5020
5021 wp_die( json_encode( array( 'success' => true, 'message' => esc_html__('Plugin installed and activated successfully')) ) );
5022
5023 } else {
5024 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Installation failed'))));
5025 }
5026 }
5027
5028 /**
5029 * Activate plugin via AJAX
5030 */
5031 public function ays_survey_activate_plugin() {
5032 if (!current_user_can('activate_plugins')) {
5033 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Insufficient permissions'))));
5034 }
5035
5036 if (!wp_verify_nonce($_POST['nonce'], 'ajax-nonce')) {
5037 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Security check failed'))));
5038 }
5039
5040 $plugin_slug = sanitize_text_field($_POST['plugin_slug']);
5041
5042 if (!function_exists('get_plugins')) {
5043 require_once ABSPATH . 'wp-admin/includes/plugin.php';
5044 }
5045
5046 $plugins = get_plugins();
5047 $plugin_file = '';
5048
5049 foreach ($plugins as $file => $plugin_data) {
5050 if (strpos($file, $plugin_slug) !== false) {
5051 $plugin_file = $file;
5052 break;
5053 }
5054 }
5055
5056 if (empty($plugin_file)) {
5057 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Plugin not found'))));
5058 }
5059
5060 $result = activate_plugin($plugin_file);
5061
5062 if (is_wp_error($result)) {
5063 wp_die(json_encode(array('success' => false, 'message' => $result->get_error_message())));
5064 } else {
5065 wp_die(json_encode(array('success' => true, 'message' => esc_html__('Plugin activated successfully'))));
5066 }
5067 }
5068
5069 /**
5070 * Get AYS plugins data
5071 */
5072 public function get_am_plugins() {
5073 return array(
5074 'quiz-maker' => array(
5075 'name' => 'Quiz Maker',
5076 'slug' => 'quiz-maker',
5077 'description' => 'Create engaging quizzes with multiple question types'
5078 ),
5079 'poll-maker' => array(
5080 'name' => 'Poll Maker',
5081 'slug' => 'poll-maker',
5082 'description' => 'Build interactive polls for your audience'
5083 ),
5084 'popup-box' => array(
5085 'name' => 'Popup Box',
5086 'slug' => 'ays-popup-box',
5087 'description' => 'Create beautiful popups and modals'
5088 ),
5089 'gallery-photo-gallery' => array(
5090 'name' => 'Gallery Photo Gallery',
5091 'slug' => 'gallery-photo-gallery',
5092 'description' => 'Showcase your photos in stunning galleries'
5093 ),
5094 'secure-copy-content-protection' => array(
5095 'name' => 'Secure Copy Content Protection',
5096 'slug' => 'secure-copy-content-protection',
5097 'description' => 'Protect your content from copying'
5098 ),
5099 'ays-chatgpt-assistant' => array(
5100 'name' => 'ChatGPT Assistant',
5101 'slug' => 'ays-chatgpt-assistant',
5102 'description' => 'AI-powered chat assistant for your website'
5103 ),
5104 'personal-dictionary' => array(
5105 'name' => 'Personal Dictionary',
5106 'slug' => 'personal-dictionary',
5107 'description' => 'Create and manage custom dictionaries'
5108 ),
5109 'chartify' => array(
5110 'name' => 'Chartify',
5111 'slug' => 'chart-builder',
5112 'description' => 'Build beautiful charts and graphs'
5113 )
5114 );
5115 }
5116
5117 public function ays_survey_disable_all_notice_from_plugin() {
5118 if (!function_exists('get_current_screen')) {
5119 return;
5120 }
5121
5122 $screen = get_current_screen();
5123
5124 if (empty($screen) || strpos($screen->id, $this->plugin_name) === false) {
5125 return;
5126 }
5127
5128 global $wp_filter;
5129
5130 // Keep plugin-specific notices
5131 $our_plugin_notices = array();
5132
5133 $exclude_functions = [
5134 'survey_maker_general_admin_notice',
5135 ];
5136
5137 if (!empty($wp_filter['admin_notices'])) {
5138 foreach ($wp_filter['admin_notices']->callbacks as $priority => $callbacks) {
5139 foreach ($callbacks as $key => $callback) {
5140 // For class-based methods
5141 if (
5142 is_array($callback['function']) &&
5143 is_object($callback['function'][0]) &&
5144 get_class($callback['function'][0]) === __CLASS__
5145 ) {
5146 $our_plugin_notices[$priority][$key] = $callback;
5147 }
5148 // For standalone functions
5149 elseif (
5150 is_string($callback['function']) &&
5151 in_array($callback['function'], $exclude_functions)
5152 ) {
5153 $our_plugin_notices[$priority][$key] = $callback;
5154 }
5155 }
5156 }
5157 }
5158
5159 // Remove all notices
5160 remove_all_actions('admin_notices');
5161 remove_all_actions('all_admin_notices');
5162
5163 // Re-add only your plugin's notices
5164 foreach ($our_plugin_notices as $priority => $callbacks) {
5165 foreach ($callbacks as $callback) {
5166 add_action('admin_notices', $callback['function'], $priority);
5167 }
5168 }
5169 }
5170
5171 public function ays_survey_black_friady_popup_box(){
5172 if(!empty($_REQUEST['page']) && sanitize_text_field( $_REQUEST['page'] ) != $this->plugin_name . "-admin-dashboard"){
5173 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
5174
5175 $flag = true;
5176
5177 if( isset($_COOKIE['aysSurveyBlackFridayPopupCount']) && intval($_COOKIE['aysSurveyBlackFridayPopupCount']) >= 2 ){
5178 $flag = false;
5179 }
5180
5181 $ays_survey_cta_button_link = esc_url('https://ays-pro.com/mega-bundle?utm_source=dashboard&utm_medium=survey-free&utm_campaign=mega-bundle-popup-black-friday-sale-' . SURVEY_MAKER_VERSION);
5182
5183 if( $flag ){
5184 ?>
5185 <div class="ays-survey-black-friday-popup-overlay" style="opacity: 0; visibility: hidden; display: none;">
5186 <div class="ays-survey-black-friday-popup-dialog">
5187 <div class="ays-survey-black-friday-popup-content">
5188 <div class="ays-survey-black-friday-popup-background-pattern">
5189 <div class="ays-survey-black-friday-popup-pattern-row">
5190 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5191 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5192 </div>
5193 <div class="ays-survey-black-friday-popup-pattern-row">
5194 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5195 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5196 </div>
5197 <div class="ays-survey-black-friday-popup-pattern-row">
5198 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5199 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5200 </div>
5201 <div class="ays-survey-black-friday-popup-pattern-row">
5202 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5203 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
5204 </div>
5205 </div>
5206
5207 <button class="ays-survey-black-friday-popup-close" aria-label="Close">
5208 <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">
5209 <path d="M18 6 6 18"></path>
5210 <path d="m6 6 12 12"></path>
5211 </svg>
5212 </button>
5213
5214 <div class="ays-survey-black-friday-popup-badge">
5215 <div class="ays-survey-black-friday-popup-badge-content">
5216 <div class="ays-survey-black-friday-popup-badge-text-sm"><?php echo esc_html__( 'Up to', 'survey-maker' ); ?></div>
5217 <div class="ays-survey-black-friday-popup-badge-text-lg">50%</div>
5218 <div class="ays-survey-black-friday-popup-badge-text-md"><?php echo esc_html__( 'OFF', 'survey-maker' ); ?></div>
5219 </div>
5220 </div>
5221
5222 <div class="ays-survey-black-friday-popup-main-content">
5223 <div class="ays-survey-black-friday-popup-hashtag"><?php echo esc_html__( '#BLACKFRIDAY', 'survey-maker' ); ?></div>
5224 <h1 class="ays-survey-black-friday-popup-title-mega"><?php echo esc_html__( 'MEGA', 'survey-maker' ); ?></h1>
5225 <h1 class="ays-survey-black-friday-popup-title-bundle"><?php echo esc_html__( 'BUNDLE', 'survey-maker' ); ?></h1>
5226 <div class="ays-survey-black-friday-popup-offer-label">
5227 <h2 class="ays-survey-black-friday-popup-offer-text"><?php echo esc_html__( 'BLACK FRIDAY OFFER', 'survey-maker' ); ?></h2>
5228 </div>
5229 <p class="ays-survey-black-friday-popup-description"><?php echo esc_html__( 'Get our exclusive plugins in one bundle', 'survey-maker' ); ?></p>
5230 <a href="<?php echo esc_url($ays_survey_cta_button_link); ?>" target="_blank" class="ays-survey-black-friday-popup-cta-btn"><?php echo esc_html__( 'Get Mega Bundle', 'survey-maker' ); ?></a>
5231 </div>
5232 </div>
5233 </div>
5234 </div>
5235 <script type="text/javascript">
5236 (function() {
5237 var overlay = document.querySelector('.ays-survey-black-friday-popup-overlay');
5238 var closeBtn = document.querySelector('.ays-survey-black-friday-popup-close');
5239 var learnMoreBtn = document.querySelector('.ays-survey-black-friday-popup-learn-more');
5240 var ctaBtn = document.querySelector('.ays-survey-black-friday-popup-cta-btn');
5241
5242 // Cookie helper functions
5243 function setCookie(name, value, days) {
5244 var expires = "";
5245 if (days) {
5246 var date = new Date();
5247 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
5248 expires = "; expires=" + date.toUTCString();
5249 }
5250 document.cookie = name + "=" + (value || "") + expires + "; path=/";
5251 }
5252
5253 function getCookie(name) {
5254 var nameEQ = name + "=";
5255 var ca = document.cookie.split(';');
5256 for (var i = 0; i < ca.length; i++) {
5257 var c = ca[i];
5258 while (c.charAt(0) == ' ') c = c.substring(1, c.length);
5259 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
5260 }
5261 return null;
5262 }
5263
5264 // Get current show count from cookie
5265 var showCount = parseInt(getCookie('aysSurveyBlackFridayPopupCount') || '0', 10);
5266 var maxShows = 2;
5267
5268 // Show popup function
5269 function showPopup() {
5270 if (overlay && showCount < maxShows) {
5271 overlay.classList.add('ays-survey-black-friday-popup-active');
5272 showCount++;
5273 // Update cookie with new count (expires in 30 days)
5274 setCookie('aysSurveyBlackFridayPopupCount', showCount.toString(), 30);
5275 }
5276 }
5277
5278 // Close popup function
5279 function closePopup(e) {
5280 if (e) {
5281 e.preventDefault();
5282 e.stopPropagation();
5283 }
5284 if (overlay) {
5285 overlay.classList.remove('ays-survey-black-friday-popup-active');
5286 }
5287 }
5288
5289 // Determine timing based on show count
5290 if (showCount === 0) {
5291 // First time - show after 30 seconds
5292 setTimeout(function() {
5293 showPopup();
5294 }, 30000);
5295 } else if (showCount === 1) {
5296 // Second time - show after 200 seconds
5297 setTimeout(function() {
5298 showPopup();
5299 }, 200000);
5300 }
5301 // If showCount >= 2, don't show popup at all
5302
5303 // Close button
5304 if (closeBtn) {
5305 closeBtn.addEventListener('click', function(e) {
5306 closePopup(e);
5307 });
5308 }
5309
5310 // Learn more button
5311 if (learnMoreBtn) {
5312 learnMoreBtn.addEventListener('click', function(e) {
5313 closePopup(e);
5314 });
5315 }
5316
5317 // CTA button (optional - if you want it to close popup too)
5318 if (ctaBtn) {
5319 ctaBtn.addEventListener('click', function(e) {
5320 // You can add redirect logic here if needed
5321 // window.location.href = 'your-url';
5322 });
5323 }
5324
5325 // Close on overlay click
5326 if (overlay) {
5327 overlay.addEventListener('click', function(e) {
5328 if (e.target === overlay) {
5329 closePopup(e);
5330 }
5331 });
5332 }
5333
5334 // Close on Escape key
5335 document.addEventListener('keydown', function(e) {
5336 if (e.key === 'Escape' && overlay && overlay.classList.contains('ays-survey-black-friday-popup-active')) {
5337 closePopup();
5338 }
5339 });
5340 })();
5341 </script>
5342 <style>
5343 .ays-survey-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-survey-black-friday-popup-overlay.ays-survey-black-friday-popup-active{display:flex!important;opacity:1!important;visibility:visible!important}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay.ays-survey-black-friday-popup-active .ays-survey-black-friday-popup-dialog{transform:scale(1)}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-content{position:relative;width:470px;height:410px;background:linear-gradient(to right bottom,#c056f5,#f042f0,#7d7de8);overflow:hidden}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-pattern-row{display:flex;gap:16px;margin-bottom:16px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-pattern-text{color:#fff;font-weight:900;font-size:96px;white-space:nowrap;line-height:1}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-close:hover,.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-learn-more:hover{color:#fff}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-float}@keyframes ays-survey-black-friday-popup-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-content{text-align:center}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-sm{color:#1a1a1a;font-weight:900;font-size:24px;line-height:1}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-lg{color:#1a1a1a;font-weight:900;font-size:30px;line-height:1;margin-top:4px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-md{color:#1a1a1a;font-weight:900;font-size:20px;line-height:1}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-hashtag{color:rgba(255,255,255,.9);font-weight:700;font-size:14px;margin-bottom:16px;letter-spacing:.1em}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-offer-label{background-color:#000;padding:12px 32px;margin-bottom:24px;display:inline-block}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-offer-text{color:#fff;font-weight:700;font-size:20px;letter-spacing:.05em;margin:0}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-description{color:rgba(255,255,255,.95);font-size:18px;font-weight:500;margin:0 0 32px!important}.ays-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay .ays-survey-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-survey-black-friday-popup-overlay{display:none!important}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-content{width:90vw;max-width:400px;height:380px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-main-content{padding:0 32px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge{width:80px;height:80px;top:24px;right:24px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-sm{font-size:20px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-lg{font-size:26px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-md,.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-offer-text{font-size:18px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-title-bundle,.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-title-mega{font-size:48px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-description{font-size:16px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-pattern-text{font-size:72px}}@media (max-width:480px){.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-content{width:95vw;max-width:340px;height:360px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-main-content{padding:0 24px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge{width:70px;height:70px;top:20px;right:20px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-sm,.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-offer-text{font-size:16px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-lg{font-size:22px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-badge-text-md{font-size:14px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-hashtag{font-size:12px;margin-bottom:12px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-title-bundle,.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-title-mega{font-size:40px;margin-bottom:8px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-offer-label{padding:10px 24px;margin-bottom:20px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-description{font-size:15px;margin-bottom:24px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-cta-btn{font-size:16px;height:44px;padding:0 32px}.ays-survey-black-friday-popup-overlay .ays-survey-black-friday-popup-pattern-text{font-size:60px}}
5344 </style>
5345 <?php
5346 }
5347 }
5348 }
5349 }
5350 }
5351