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

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

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