PluginProbe
Survey Maker by AYS / 5.2.0.8
Survey Maker by AYS v5.2.0.8
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.0.8, at admin/class-survey-maker-admin.php

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