PluginProbe
Survey Maker by AYS / 5.2.2.1
Survey Maker by AYS v5.2.2.1
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.1, at admin/class-survey-maker-admin.php

5,024 lines 298.0 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=top-20-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/ays-survey-banner-announcement-icon.svg"></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 __( 'Upgrade to %1$s Survey Maker PRO %2$s', '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-20.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[] = '<div class="ays-survey-dicount-banner-coupon-box" onclick="aysSurveyBundleCopyToClipboard(\'SURVEYPRO20\')" title="' . __( 'Click to copy coupon code', "survey-maker" ) . '">';
1903 $content[] = '<span class="ays-survey-dicount-banner-coupon-text">SURVEYPRO20</span>';
1904 $content[] = '<svg class="ays-survey-dicount-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
1905 $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"/>';
1906 $content[] = '</svg>';
1907 $content[] = '</div>';
1908 $content[] = '</div>';
1909
1910 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
1911 $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>';
1912 $content[] = '<span class="ays-survey-dicount-one-time-text">';
1913 $content[] = __( "One-time payment", 'survey-maker' );
1914 $content[] = '</span>';
1915 $content[] = '</div>';
1916 $content[] = '</div>';
1917 $content[] = '</div>';
1918
1919 $content[] = '<script>';
1920 $content[] = "
1921 function aysSurveyBundleCopyToClipboard(text) {
1922 var textarea = document.createElement('textarea');
1923 textarea.value = text;
1924 textarea.style.position = 'fixed';
1925 textarea.style.opacity = '0';
1926 document.body.appendChild(textarea);
1927
1928 textarea.select();
1929 textarea.setSelectionRange(0, 99999);
1930
1931 try {
1932 document.execCommand('copy');
1933 aysSurveyBundleShowCopyNotification('" . __( 'Coupon code copied!', "survey-maker" ) . "');
1934 } catch (err) {
1935 console.error('Failed to copy text: ', err);
1936 }
1937
1938 document.body.removeChild(textarea);
1939 }
1940
1941 function aysSurveyBundleShowCopyNotification(message) {
1942 var existingNotification = document.querySelector('.ays-survey-dicount-banner-copy-notification');
1943 if (existingNotification) {
1944 document.body.removeChild(existingNotification);
1945 }
1946
1947 var notification = document.createElement('div');
1948 notification.className = 'ays-survey-dicount-banner-copy-notification';
1949 notification.textContent = message;
1950 document.body.appendChild(notification);
1951
1952 setTimeout(function() {
1953 notification.classList.add('show');
1954 }, 10);
1955
1956 setTimeout(function() {
1957 notification.classList.remove('show');
1958 setTimeout(function() {
1959 if (notification.parentNode) {
1960 document.body.removeChild(notification);
1961 }
1962 }, 300);
1963 }, 2000);
1964 }";
1965 $content[] = '</script>';
1966
1967 // /* New Mega Bundle Banner Survey | Start */
1968 $content[] = '<style id="ays-survey-mega-bundle-styles-inline-css">';
1969 $content[] = '
1970 div#ays-survey-new-mega-bundle-dicount-month-main{border:0;background:#fff;border-radius:20px;box-shadow:unset;position:relative;z-index:1;min-height:80px}div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info button{display:flex;align-items:center}div#ays-survey-new-mega-bundle-dicount-month-main div#ays-survey-dicount-month a.ays-survey-sale-banner-link:focus{outline:0;box-shadow:0}div#ays-survey-new-mega-bundle-dicount-month-main .btn-link{color:#007bff;background-color:transparent;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem}div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info{background-image:url("'. SURVEY_MAKER_ADMIN_URL .'/images/new-mega-bundle-logo-background-20.svg");background-position:center right;background-repeat:no-repeat;background-size:cover;background-color:#5551ff;padding:1px 38px 1px 12px}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month{display:flex;align-items:center;justify-content:space-between;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month img{width:60px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-sale-banner-link{display:flex;justify-content:center;align-items:center;width:60px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:14px;padding:12px;text-align:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{text-align:left;width:auto;display:flex;justify-content:space-around;align-items:flex-start}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:30%;display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{width:20%;display:flex;justify-content:center;align-items:center;flex-direction:column}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-survey-dicount-logo-box{display:flex;justify-content:flex-start;align-items:center;gap:20px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title{color:#fdfdfd;font-size:19px;font-style:normal;font-weight:600;line-height:normal}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title-icon-row{display:inline-block}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-desc{display:inline-block;color:#fff;font-size:15px;font-style:normal;font-weight:400;line-height:normal;margin-top:10px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box strong{font-size:17px;font-weight:700;letter-spacing:.8px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-color{color:#971821}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-text-decoration{text-decoration:underline}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{display:flex;justify-content:flex-end;align-items:center;width:30%}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-button,#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{align-items:center;font-weight:500}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{background:#971821;border-color:#fff;display:flex;justify-content:center;align-items:center;padding:5px 15px;font-size:16px;border-radius:5px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button:hover{background:#7d161d;border-color:#971821}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content{display:flex;justify-content:center}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{margin:0!important;font-size:13px;color:#fff}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{width:19%}#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{padding:40px 15px;display:flex;justify-content:center;align-items:center;opacity:0}#ays-survey-countdown-main-container .ays-survey-countdown-container{margin:0 auto;text-align:center}#ays-survey-countdown-main-container #ays-survey-countdown-headline{letter-spacing:.125rem;text-transform:uppercase;font-size:18px;font-weight:400;margin:0;padding:9px 0 4px;line-height:1.3}#ays-survey-countdown-main-container li,#ays-survey-countdown-main-container ul{margin:0}#ays-survey-countdown-main-container li{display:inline-block;font-size:14px;list-style-type:none;padding:14px;text-transform:lowercase}#ays-survey-countdown-main-container li span{display:flex;justify-content:center;align-items:center;font-size:22px;min-height:40px;min-width:40px;border-radius:4.273px;border:.534px solid #f4f4f4;background:#9896ed;color:#fff}#ays-survey-countdown-main-container .emoji{display:none;padding:1rem}#ays-survey-countdown-main-container .emoji span{font-size:30px;padding:0 .5rem}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li{position:relative}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{content:":";color:#fff;position:absolute;top:0;right:-5px;font-size:40px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span#ays-survey-countdown-seconds:after{content:unset}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{display:flex;align-items:center;border-radius:6.409px;background:#f66123;padding:12px 32px;color:#fff;font-size:15px;font-style:normal;line-height:normal;margin:0!important}div#ays-survey-new-mega-bundle-dicount-month-main button.notice-dismiss:before{color:#fff;content:"\f00d";font-family:fontawesome;font-size:22px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-guaranteeicon{width:30px;margin-right:5px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-one-time-text{color:#fff;font-size:12px;font-style:normal;font-weight:600;line-height:normal}@media all and (max-width:768px){div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{display:none!important;background-position:bottom right;background-repeat:no-repeat;background-size:cover;border-radius:32px}div#ays-survey-new-mega-bundle-dicount-month-main{padding-right:0}div#ays-survey-new-mega-bundle-dicount-month-main .ays_survey_dicount_month{display:flex;align-items:center;justify-content:space-between;align-content:center;flex-wrap:wrap;flex-direction:column;padding:10px 0}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{width:100%!important;text-align:center}#ays-survey-countdown-main-container #ays-survey-countdown-headline{font-size:15px;font-weight:600}#ays-survey-countdown-main-container ul{font-weight:500}div#ays-survey-countdown-main-container li{padding:10px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-mobile-image-display-none{display:none!important}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-new-mega-bundle-mobile-image-display-block{display:block!important;margin-top:5px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:100%!important;text-align:center;flex-direction:column;margin-top:20px;justify-content:center;align-items:center}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box li span:after{top:unset}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:100%;display:flex;justify-content:center;align-items:center}#ays-survey-new-mega-bundle-dicount-month-main .ays-button{margin:0 auto!important}#ays-survey-new-mega-bundle-dicount-month-main #ays-survey-dismiss-buttons-content .ays-button{padding-left:unset!important}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-buy-now-button-box{justify-content:center}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box .ays-buy-now-button{font-size:14px;padding:5px 10px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-buy-now-opacity-button{display:none}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dismiss-buttons-container-for-form{position:static!important}.comparison .product img{width:70px}.ays-survey-features-wrap .comparison a.price-buy{padding:8px 5px;font-size:11px}}@media screen and (max-width:1350px) and (min-width:768px){div#ays-survey-new-mega-bundle-dicount-month-main.ays_survey_dicount_info.notice{background-position:bottom right;background-repeat:no-repeat;background-size:cover}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box strong{font-size:15px}#ays-survey-countdown-main-container li{font-size:11px}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-opacity-box{display:none}}@media screen and (max-width:1680px) and (min-width:1551px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:29%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:30%}}@media screen and (max-width:1410px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:150px}}@media screen and (max-width:1550px) and (min-width:1400px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:35%}}@media screen and (max-width:1400px) and (min-width:1250px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:35%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:40%}}@media screen and (max-width:1274px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-title{font-size:15px}}@media screen and (max-width:1200px){#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{margin-bottom:16px}#ays-survey-countdown-main-container ul{padding-left:0}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:120px;font-size:18px}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 20px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:12px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box .ays-survey-new-mega-bundle-desc{font-size:13px}}@media screen and (max-width:1076px) and (min-width:769px){#ays-survey-countdown-main-container li{padding:10px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-coupon-row{width:100px;font-size:16px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-button-box{margin-bottom:16px}#ays-survey-new-mega-bundle-dicount-month-main #ays-button-top-buy-now{padding:12px 15px}#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box{font-size:11px;padding:12px 0}}@media screen and (max-width:1250px) and (min-width:769px){div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-countdown-box{width:45%}div#ays-survey-new-mega-bundle-dicount-month-main .ays-survey-dicount-wrap-box.ays-survey-dicount-wrap-text-box{width:35%}}';
1971
1972 $content[] = '
1973 .ays-survey-dicount-banner-coupon-box {
1974 border: 2px dashed rgba(255, 255, 255, 0.4);
1975 padding: 8px 16px;
1976 border-radius: 6px;
1977 background: rgba(255, 255, 255, 0.1);
1978 cursor: pointer;
1979 transition: all 0.3s;
1980 display: flex;
1981 align-items: center;
1982 gap: 8px;
1983 backdrop-filter: blur(10px);
1984 }
1985
1986 .ays-survey-dicount-banner-coupon-box:hover {
1987 background: rgba(255, 255, 255, 0.2);
1988 border-color: rgba(255, 255, 255, 0.6);
1989 transform: translateY(-1px);
1990 }
1991
1992 .ays-survey-dicount-banner-coupon-text {
1993 font-size: 16px;
1994 font-weight: 700;
1995 letter-spacing: 1px;
1996 color: #fff;
1997 font-family: monospace;
1998 }
1999
2000 .ays-survey-dicount-banner-copy-icon {
2001 opacity: 0.8;
2002 transition: opacity 0.3s;
2003 }
2004
2005 .ays-survey-dicount-banner-coupon-box:hover .ays-survey-dicount-banner-copy-icon {
2006 opacity: 1;
2007 }
2008
2009 .ays-survey-dicount-banner-btn-arrow {
2010 display: inline-block;
2011 transition: transform 0.3s;
2012 }
2013
2014 .ays-survey-dicount-banner-buy-now-btn:hover .ays-survey-dicount-banner-btn-arrow {
2015 transform: translateX(4px);
2016 }
2017
2018 /* Notification */
2019 .ays-survey-dicount-banner-copy-notification {
2020 position: fixed;
2021 top: 50%;
2022 left: 50%;
2023 transform: translate(-50%, -50%);
2024 background: rgba(0, 0, 0, 0.8);
2025 color: #fff;
2026 padding: 12px 24px;
2027 border-radius: 8px;
2028 font-size: 14px;
2029 z-index: 10000;
2030 opacity: 0;
2031 transition: opacity 0.3s;
2032 }
2033
2034 .ays-survey-dicount-banner-copy-notification.show {
2035 opacity: 1;
2036 }';
2037 $content[] = '</style>';
2038 // /* New Mega Bundle Banner Survey | End */
2039
2040 $content = implode( '', $content );
2041 echo ($content);
2042 }
2043 }
2044
2045 // Christmas Banner 2025
2046 public static function ays_survey_christmas_banner_message_2025($ishmar){
2047 if($ishmar == 0 ){
2048 $content = array();
2049
2050 $svg_icon = '<svg width="21" height="22" viewBox="0 0 21 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2051 <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"/>
2052 </svg>
2053 ';
2054
2055 $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);
2056
2057 $content[] = '<div id="ays-survey-christmas-banner-main" class="notice notice-success is-dismissible ays-survey-christmas-banner-info ays_survey_dicount_info">';
2058 $content[] = '<div id="ays-survey-christmas-banner-month" class="ays-survey-christmas-banner-month">';
2059
2060 // Background effects
2061 $content[] = '<div class="ays-survey-christmas-banner-bg-effects">';
2062 $content[] = '<div class="ays-survey-christmas-banner-bg-gradient-1"></div>';
2063 $content[] = '<div class="ays-survey-christmas-banner-bg-gradient-2"></div>';
2064
2065 // Snowflakes
2066 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 5%; animation-delay: 0s; animation-duration: 8s;">'. $svg_icon .'</div>';
2067 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 15%; animation-delay: 2s; animation-duration: 10s;">'. $svg_icon .'</div>';
2068 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 25%; animation-delay: 4s; animation-duration: 9s;">'. $svg_icon .'</div>';
2069 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 75%; animation-delay: 1s; animation-duration: 11s;">'. $svg_icon .'</div>';
2070 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 85%; animation-delay: 3s; animation-duration: 8s;">'. $svg_icon .'</div>';
2071 $content[] = '<div class="ays-survey-christmas-banner-snowflake" style="left: 92%; animation-delay: 5s; animation-duration: 10s;">'. $svg_icon .'</div>';
2072
2073 // Sparkles
2074 $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">';
2075 $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"/>';
2076 $content[] = '</svg>';
2077 $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">';
2078 $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"/>';
2079 $content[] = '</svg>';
2080 $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">';
2081 $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"/>';
2082 $content[] = '</svg>';
2083 $content[] = '</div>';
2084
2085 // Main content
2086 $content[] = '<div class="ays-survey-christmas-banner-content">';
2087 $content[] = '<div class="ays-survey-christmas-banner-left">';
2088 // Gift icon with hat
2089 $content[] = '<div class="ays-survey-christmas-banner-gift-wrapper">';
2090 $content[] = '<svg class="ays-survey-christmas-banner-gift-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">';
2091 $content[] = '<rect x="3" y="8" width="18" height="4" rx="1"></rect>';
2092 $content[] = '<path d="M12 8v13"></path>';
2093 $content[] = '<path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path>';
2094 $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>';
2095 $content[] = '</svg>';
2096 $content[] = '<div class="ays-survey-christmas-banner-hat">';
2097 $content[] = '<svg viewBox="0 0 24 24" fill="none" class="ays-survey-christmas-banner-hat-svg">';
2098 $content[] = '<path d="M12 2L4 14h16L12 2z" fill="hsl(0 80% 45%)"></path>';
2099 $content[] = '<path d="M4 14c0 2 3.5 3 8 3s8-1 8-3" fill="hsl(0 0% 100%)"></path>';
2100 $content[] = '<circle cx="12" cy="3" r="2" fill="hsl(0 0% 100%)"></circle>';
2101 $content[] = '</svg>';
2102 $content[] = '</div>';
2103 $content[] = '</div>';
2104
2105 $content[] = '<div class="ays-survey-christmas-banner-special-label">';
2106 $content[] = '<div class="ays-survey-christmas-banner-special-label-name">';
2107 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-christmas-banner-special-label-name-link" target="_blank">';
2108 $content[] = __( 'Survey Maker', "survey-maker" );
2109 $content[] = '</a>';
2110 $content[] = '</div>';
2111
2112 $content[] = '<div>✦ ' . __( 'CHRISTMAS SPECIAL', "survey-maker" ) . ' ✦</div>';
2113 $content[] = '</div>';
2114 $content[] = '</div>';
2115
2116 $content[] = '<div class="ays-survey-christmas-banner-center">';
2117 $content[] = '<div class="ays-survey-christmas-banner-discount-text">25% OFF</div>';
2118 $content[] = '<div class="ays-survey-christmas-banner-limited-offer">' . __( 'Limited time offer', "survey-maker" ) . '</div>';
2119 $content[] = '</div>';
2120
2121 $content[] = '<div class="ays-survey-christmas-banner-right">';
2122 $content[] = '<div class="ays-survey-christmas-banner-coupon-box" onclick="aysSurveyChristmasCopyToClipboard(\'XMAS25\')" title="' . __( 'Click to copy', "survey-maker" ) . '">';
2123 $content[] = '<span class="ays-survey-christmas-banner-coupon-text">XMAS25</span>';
2124 $content[] = '<svg class="ays-survey-christmas-banner-copy-icon" width="16" height="16" viewBox="0 0 16 16" fill="none">';
2125 $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"/>';
2126 $content[] = '</svg>';
2127 $content[] = '</div>';
2128
2129 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-christmas-banner-buy-now-btn" target="_blank">';
2130 $content[] = __( 'Buy Now', "survey-maker" );
2131 $content[] = '</a>';
2132 $content[] = '</div>';
2133 $content[] = '</div>';
2134
2135 $content[] = '</div>';
2136
2137 if( current_user_can( 'manage_options' ) ){
2138 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2139 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
2140 $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>';
2141 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2142 $content[] = '</form>';
2143 $content[] = '</div>';
2144 }
2145
2146 $content[] = '</div>';
2147
2148 $content[] = '<script>';
2149 $content[] = "
2150 function aysSurveyChristmasCopyToClipboard(text) {
2151 var textarea = document.createElement('textarea');
2152 textarea.value = text;
2153 textarea.style.position = 'fixed';
2154 textarea.style.opacity = '0';
2155 document.body.appendChild(textarea);
2156
2157 textarea.select();
2158 textarea.setSelectionRange(0, 99999);
2159
2160 try {
2161 document.execCommand('copy');
2162 aysSurveyChristmasShowCopyNotification('" . __( 'Coupon code copied!', "survey-maker" ) . "');
2163 } catch (err) {
2164 console.error('Failed to copy text: ', err);
2165 }
2166
2167 document.body.removeChild(textarea);
2168 }
2169
2170 function aysSurveyChristmasShowCopyNotification(message) {
2171 var existingNotification = document.querySelector('.ays-survey-christmas-banner-copy-notification');
2172 if (existingNotification) {
2173 document.body.removeChild(existingNotification);
2174 }
2175
2176 var notification = document.createElement('div');
2177 notification.className = 'ays-survey-christmas-banner-copy-notification';
2178 notification.textContent = message;
2179 document.body.appendChild(notification);
2180
2181 setTimeout(function() {
2182 notification.classList.add('show');
2183 }, 10);
2184
2185 setTimeout(function() {
2186 notification.classList.remove('show');
2187 setTimeout(function() {
2188 if (notification.parentNode) {
2189 document.body.removeChild(notification);
2190 }
2191 }, 300);
2192 }, 2000);
2193 }";
2194 $content[] = '</script>';
2195
2196 $content[] = '<style>';
2197 $content[] = '
2198 /* Christmas banner start */
2199
2200 div#ays-survey-christmas-banner-main .btn-link {
2201 background-color: transparent;
2202 display: inline-block;
2203 font-weight: 400;
2204 text-align: center;
2205 white-space: nowrap;
2206 vertical-align: middle;
2207 -webkit-user-select: none;
2208 -moz-user-select: none;
2209 -ms-user-select: none;
2210 user-select: none;
2211 border: 1px solid transparent;
2212 padding: .375rem .75rem;
2213 font-size: 12px;
2214 line-height: 1.5;
2215 border-radius: .25rem;
2216 color: rgba(255, 255, 255, .6);
2217 }
2218
2219 div#ays-survey-christmas-banner-main.ays-survey-christmas-banner-info {
2220 background: linear-gradient(to right, hsl(0, 70%, 28%), hsl(0, 65%, 38%), hsl(0, 70%, 28%));
2221 padding: unset;
2222 border-left: 0;
2223 position: relative;
2224 }
2225
2226 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-month {
2227 position: relative;
2228 padding: 15px 40px;
2229 overflow: hidden;
2230 }
2231
2232 /* Background effects */
2233 .ays-survey-christmas-banner-bg-effects {
2234 position: absolute;
2235 top: 0;
2236 left: 0;
2237 right: 0;
2238 bottom: 0;
2239 pointer-events: none;
2240 z-index: 1;
2241 }
2242
2243 .ays-survey-christmas-banner-bg-gradient-1 {
2244 position: absolute;
2245 top: 0;
2246 left: 30%;
2247 width: 40%;
2248 height: 100%;
2249 background: radial-gradient(circle, rgba(202, 43, 43, 0.5) 0%, transparent 60%);
2250 opacity: 0.4;
2251 }
2252
2253 .ays-survey-christmas-banner-bg-gradient-2 {
2254 position: absolute;
2255 top: 0;
2256 right: 15%;
2257 width: 35%;
2258 height: 100%;
2259 background: radial-gradient(circle, rgba(246, 201, 85, 0.15) 0%, transparent 50%);
2260 opacity: 0.3;
2261 }
2262
2263 .ays-survey-christmas-banner-snowflake {
2264 position: absolute;
2265 color: rgba(255, 255, 255, 0.2);
2266 font-size: 20px;
2267 animation: ays-survey-christmas-snowfall linear infinite;
2268 top: -10px;
2269 }
2270
2271 @keyframes ays-survey-christmas-snowfall {
2272 0% {
2273 transform: translateY(-10px) rotate(0deg);
2274 opacity: 0;
2275 }
2276 10% {
2277 opacity: 0.8;
2278 }
2279 90% {
2280 opacity: 0.8;
2281 }
2282 100% {
2283 transform: translateY(100%) rotate(360deg);
2284 opacity: 0;
2285 }
2286 }
2287
2288 .ays-survey-christmas-banner-sparkle {
2289 position: absolute;
2290 color: hsl(43, 90%, 65%);
2291 animation: ays-survey-christmas-twinkle 2s ease-in-out infinite;
2292 }
2293
2294 @keyframes ays-survey-christmas-twinkle {
2295 0%, 100% {
2296 opacity: 0.3;
2297 transform: scale(0.8);
2298 }
2299 50% {
2300 opacity: 1;
2301 transform: scale(1.2);
2302 }
2303 }
2304
2305 /* Main content */
2306 .ays-survey-christmas-banner-content {
2307 position: relative;
2308 display: flex;
2309 align-items: center;
2310 justify-content: space-between;
2311 z-index: 2;
2312 }
2313
2314 /* Left section */
2315 .ays-survey-christmas-banner-left {
2316 display: flex;
2317 align-items: center;
2318 gap: 50px;
2319 }
2320
2321 .ays-survey-christmas-banner-gift-wrapper {
2322 position: relative;
2323 animation: ays-survey-christmas-float 3s ease-in-out infinite;
2324 }
2325
2326 .ays-survey-christmas-banner-gift-icon {
2327 width: 48px;
2328 height: 48px;
2329 color: rgba(255, 247, 237, 0.9);
2330 }
2331
2332 @keyframes ays-survey-christmas-float {
2333 0%, 100% {
2334 transform: translateY(0);
2335 }
2336 50% {
2337 transform: translateY(-5px);
2338 }
2339 }
2340
2341 .ays-survey-christmas-banner-hat {
2342 position: absolute;
2343 top: -12px;
2344 right: -4px;
2345 width: 24px;
2346 height: 24px;
2347 }
2348
2349 .ays-survey-christmas-banner-hat-svg {
2350 width: 100%;
2351 height: 100%;
2352 }
2353
2354 .ays-survey-christmas-banner-special-label {
2355 color: hsl(43, 90%, 65%);
2356 font-size: 14px;
2357 font-weight: 500;
2358 text-transform: uppercase;
2359 letter-spacing: 1px;
2360 /* font-family: "Outfit", sans-serif; */
2361 }
2362
2363 .ays-survey-christmas-banner-special-label-name {
2364 color: #fffaf0;
2365 text-align: center;
2366 }
2367
2368 div#ays-survey-christmas-banner-main .ays-survey-christmas-banner-special-label-name-link {
2369 color: #fffaf0;
2370 box-shadow: unset;
2371 }
2372
2373 /* Center section */
2374 .ays-survey-christmas-banner-center {
2375 display: flex;
2376 flex-direction: row;
2377 text-align: center;
2378 justify-content: center;
2379 align-items: center;
2380 gap: 30px;
2381 }
2382
2383 .ays-survey-christmas-banner-discount-text {
2384 font-family: "Outfit", sans-serif;
2385 font-weight: 800;
2386 font-size: 30px;
2387 color: hsl(40, 100%, 97%);
2388 letter-spacing: -1px;
2389 line-height: 1;
2390 }
2391
2392 .ays-survey-christmas-banner-limited-offer {
2393 color: rgba(255, 247, 237, 0.7);
2394 font-size: 13px;
2395 font-weight: 500;
2396 }
2397
2398 /* Right section */
2399 .ays-survey-christmas-banner-right {
2400 display: flex;
2401 align-items: center;
2402 gap: 20px;
2403 }
2404
2405 .ays-survey-christmas-banner-coupon-box {
2406 border: 2px dashed rgba(255, 255, 255, 0.4);
2407 padding: 8px 16px;
2408 border-radius: 6px;
2409 background: rgba(255, 255, 255, 0.1);
2410 cursor: pointer;
2411 transition: all 0.3s;
2412 display: flex;
2413 align-items: center;
2414 gap: 8px;
2415 backdrop-filter: blur(10px);
2416 }
2417
2418 .ays-survey-christmas-banner-coupon-box:hover {
2419 background: rgba(255, 255, 255, 0.2);
2420 border-color: rgba(255, 255, 255, 0.6);
2421 transform: translateY(-1px);
2422 }
2423
2424 .ays-survey-christmas-banner-coupon-text {
2425 font-size: 16px;
2426 font-weight: 700;
2427 letter-spacing: 1px;
2428 color: #fff;
2429 font-family: monospace;
2430 }
2431
2432 .ays-survey-christmas-banner-copy-icon {
2433 opacity: 0.8;
2434 transition: opacity 0.3s;
2435 }
2436
2437 .ays-survey-christmas-banner-coupon-box:hover .ays-survey-christmas-banner-copy-icon {
2438 opacity: 1;
2439 }
2440
2441 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-buy-now-btn {
2442 background-color: #fbe19f;
2443 color: hsl(0, 72%, 35%);
2444 padding: 10px 30px;
2445 border-radius: 9999px;
2446 font-size: 16px;
2447 font-weight: 600;
2448 font-family: "Outfit", sans-serif;
2449 border: none;
2450 cursor: pointer;
2451 transition: all 0.3s;
2452 text-decoration: none;
2453 display: flex;
2454 align-items: center;
2455 gap: 6px;
2456 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 30px rgba(246, 201, 85, 0.2);
2457 }
2458
2459 #ays-survey-christmas-banner-main .ays-survey-christmas-banner-buy-now-btn:hover {
2460 background-color: #f2d58c;
2461 transform: scale(1.05);
2462 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), 0 0 40px rgba(246, 201, 85, 0.3);
2463 }
2464
2465 .ays-survey-christmas-banner-btn-arrow {
2466 display: inline-block;
2467 transition: transform 0.3s;
2468 }
2469
2470 .ays-survey-christmas-banner-buy-now-btn:hover .ays-survey-christmas-banner-btn-arrow {
2471 transform: translateX(4px);
2472 }
2473
2474 /* Notification */
2475 .ays-survey-christmas-banner-copy-notification {
2476 position: fixed;
2477 top: 50%;
2478 left: 50%;
2479 transform: translate(-50%, -50%);
2480 background: rgba(0, 0, 0, 0.8);
2481 color: #fff;
2482 padding: 12px 24px;
2483 border-radius: 8px;
2484 font-size: 14px;
2485 z-index: 10000;
2486 opacity: 0;
2487 transition: opacity 0.3s;
2488 }
2489
2490 .ays-survey-christmas-banner-copy-notification.show {
2491 opacity: 1;
2492 }
2493
2494 /* Dismiss button */
2495 #ays-survey-christmas-banner-main #ays-survey-christmas-banner-dismiss-content {
2496 display: flex;
2497 justify-content: center;
2498 }
2499
2500 #ays-survey-christmas-banner-main #ays-survey-christmas-banner-dismiss-content .ays-button {
2501 margin: 0 !important;
2502 font-size: 13px;
2503 color: rgba(150, 147, 147, 0.69);
2504 }
2505
2506 /* Responsive */
2507 @media (max-width: 1024px) {
2508 .ays-survey-christmas-banner-discount-text {
2509 font-size: 40px;
2510 }
2511 .ays-survey-christmas-banner-content {
2512 flex-wrap: wrap;
2513 }
2514 }
2515
2516 @media (max-width: 768px) {
2517 #ays-survey-christmas-banner-main {
2518 display: none !important;
2519 }
2520 }
2521 /* Christmas banner end */
2522 ';
2523 $content[] = '</style>';
2524
2525 $content = implode( '', $content );
2526
2527 echo $content;
2528 }
2529 }
2530
2531 // Black Friday
2532 public static function ays_survey_black_friday_message($ishmar){
2533 if($ishmar == 0 ){
2534 $content = array();
2535
2536 $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);
2537
2538 $content[] = '<div id="ays-survey-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
2539 $content[] = '<div id="ays-survey-dicount-black-friday-month" class="ays_survey_dicount_month">';
2540 $content[] = '<div class="ays-survey-dicount-black-friday-box">';
2541 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-box-80" style="width: 70%;">';
2542 $content[] = '<div class="">';
2543 $content[] = '<div class="ays-survey-dicount-black-friday-title-row" >' . __( 'Coupon Code', "survey-maker" ) .' ' . '</div>';
2544 $content[] = '<div class="ays-survey-dicount-black-friday-title-row">';
2545
2546 $content[] = '
2547 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-wrapper">
2548 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-box" onclick="aysSurveyHalloweenCopyToClipboard(\'FREE2PROBF\')" title="Click to copy">
2549 <span class="ays-survey-dicount-black-friday-banner-2025-coupon-text">FREE2PROBF</span>
2550 <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">
2551 <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"/>
2552 </svg>
2553 </span>
2554 </span>';
2555 $content[] = '</div> ';
2556 $content[] = '</div>';
2557
2558 $content[] = '</div>';
2559
2560 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-text-box">';
2561 $content[] = '<div class="ays-survey-dicount-black-friday-text-row">' . '30% off' . '</div>';
2562 $content[] = '</div>';
2563
2564 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
2565 $content[] = '<div id="ays-survey-countdown-main-container">';
2566 $content[] = '<div class="ays-survey-countdown-container">';
2567 $content[] = '<div id="ays-survey-countdown" style="display: block;">';
2568 $content[] = '<ul>';
2569 $content[] = '<li><span id="ays-survey-countdown-days"></span>' . __( 'Days', "survey-maker" ) . '</li>';
2570 $content[] = '<li><span id="ays-survey-countdown-hours"></span>' . __( 'Hours', "survey-maker" ) . '</li>';
2571 $content[] = '<li><span id="ays-survey-countdown-minutes"></span>' . __( 'Minutes', "survey-maker" ) . '</li>';
2572 $content[] = '<li><span id="ays-survey-countdown-seconds"></span>' . __( 'Seconds', "survey-maker" ) . '</li>';
2573 $content[] = '</ul>';
2574 $content[] = '</div>';
2575 $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
2576 $content[] = '<span></span>';
2577 $content[] = '<span></span>';
2578 $content[] = '<span></span>';
2579 $content[] = '<span></span>';
2580 $content[] = '</div>';
2581 $content[] = '</div>';
2582 $content[] = '</div>';
2583 $content[] = '</div>';
2584
2585 $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
2586 $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>';
2587 $content[] = '</div>';
2588 $content[] = '</div>';
2589 $content[] = '</div>';
2590
2591 $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-black-friday">';
2592 $content[] = '<form action="" method="POST">';
2593 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2594 if( current_user_can( 'manage_options' ) ){
2595 $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>';
2596 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2597 }
2598 $content[] = '</div>';
2599 $content[] = '</form>';
2600 $content[] = '</div>';
2601 $content[] = '</div>';
2602
2603 $content[] = '<script>';
2604 $content[] = "
2605 function aysSurveyHalloweenCopyToClipboard(text) {
2606 // Create a temporary textarea element
2607 var textarea = document.createElement('textarea');
2608 textarea.value = text;
2609 textarea.style.position = 'fixed';
2610 textarea.style.opacity = '0';
2611 document.body.appendChild(textarea);
2612
2613 // Select and copy the text
2614 textarea.select();
2615 textarea.setSelectionRange(0, 99999); // For mobile devices
2616
2617 try {
2618 document.execCommand('copy');
2619 aysSurveyHalloweenShowCopyNotification('Coupon code copied!');
2620 } catch (err) {
2621 console.error('Failed to copy text: ', err);
2622 }
2623
2624 // Remove the temporary textarea
2625 document.body.removeChild(textarea);
2626 }
2627
2628 function aysSurveyHalloweenShowCopyNotification(message) {
2629 // Check if notification already exists
2630 var existingNotification = document.querySelector('.ays-survey-discount-black-friday-banner-2025-copy-notification');
2631 if (existingNotification) {
2632 document.body.removeChild(existingNotification);
2633 }
2634
2635 // Create notification element
2636 var notification = document.createElement('div');
2637 notification.className = 'ays-survey-discount-black-friday-banner-2025-copy-notification';
2638 notification.textContent = message;
2639 document.body.appendChild(notification);
2640
2641 // Show notification with animation
2642 setTimeout(function() {
2643 notification.classList.add('show');
2644 }, 10);
2645
2646 // Hide and remove notification after 2 seconds
2647 setTimeout(function() {
2648 notification.classList.remove('show');
2649 setTimeout(function() {
2650 if (notification.parentNode) {
2651 document.body.removeChild(notification);
2652 }
2653 }, 300);
2654 }, 2000);
2655 }";
2656 $content[] = '</script>';
2657
2658 $content[] = '<style>';
2659 $content[] = '
2660 /* Black friday banner start */
2661 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}}
2662 ';
2663 $content[] = '</style>';
2664
2665 $content = implode( '', $content );
2666
2667 echo $content;
2668 }
2669 }
2670
2671 // Halloween Bundle 2025
2672 public function ays_survey_new_halloween_bundle_message_2025($ishmar){
2673 if($ishmar == 0 ){
2674 $content = array();
2675
2676 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
2677 $now_date = date('M d, Y H:i:s', $date);
2678
2679 $start_date = strtotime('2025-09-08 00:00:01');
2680 $end_date = strtotime('2025-11-07 23:59:59');
2681 $diff_end = $end_date - $date;
2682
2683 $style_attr = '';
2684 if( $diff_end < 0 ){
2685 $style_attr = 'style="display:none;"';
2686 }
2687
2688 $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);
2689
2690 $content[] = '
2691 <div id="ays-survey-halloween-banner-2025-main" class="ays-survey-halloween-banner-2025-main ays_survey_dicount_info notice notice-success is-dismissible">
2692 <div class="ays-survey-halloween-banner-2025-content">
2693 <div class="ays-survey-halloween-banner-2025-left">
2694 <div class="ays-survey-halloween-banner-2025-text">
2695 <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>
2696 <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>
2697 </div>
2698 </div>
2699
2700 <div class="ays-survey-halloween-banner-2025-center">';
2701
2702 $content[] = '<div id="ays-survey-halloween-banner-2025-countdown" class="ays-survey-halloween-banner-2025-countdown" ' . $style_attr . '>';
2703 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-timer">';
2704 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2705 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-days">00</div>';
2706 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('days', 'survey-maker') . '</div>';
2707 $content[] = '</div>';
2708 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2709 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2710 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-hours">00</div>';
2711 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('hours', 'survey-maker') . '</div>';
2712 $content[] = '</div>';
2713 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2714 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2715 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-minutes">00</div>';
2716 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('minutes', 'survey-maker') . '</div>';
2717 $content[] = '</div>';
2718 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-separator">:</div>';
2719 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-item">';
2720 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-value" id="ays-survey-halloween-banner-2025-seconds">00</div>';
2721 $content[] = '<div class="ays-survey-halloween-banner-2025-countdown-label">' . __('seconds', 'survey-maker') . '</div>';
2722 $content[] = '</div>';
2723 $content[] = '</div>';
2724 $content[] = '</div>';
2725
2726 $content[] = '</div>
2727
2728 <div class="ays-survey-halloween-banner-2025-right">
2729 <div class="ays-survey-halloween-banner-2025-pumpkin">
2730 <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2731 <g clip-path="url(#clip0_177_40)">
2732 <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"/>
2733 <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"/>
2734 <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"/>
2735 </g>
2736 <defs>
2737 <clipPath id="clip0_177_40">
2738 <rect width="36" height="36" fill="white"/>
2739 </clipPath>
2740 </defs>
2741 </svg>
2742 </div>
2743
2744
2745
2746 <div class="ays-survey-halloween-banner-2025-discount-section">
2747 <div class="ays-survey-halloween-banner-2025-discount">50% OFF</div>
2748 <div class="ays-survey-halloween-banner-2025-coupon-wrapper">
2749 <div class="ays-survey-halloween-banner-2025-coupon-box" onclick="aysSurveyHalloweenCopyToClipboard(\'HALLOWEEN25\')" title="Click to copy">
2750 <span class="ays-survey-halloween-banner-2025-coupon-text">HALLOWEEN25</span>
2751 <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">
2752 <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"/>
2753 </svg>
2754 </div>
2755 </div>
2756 <a href="'. $ays_survey_cta_button_link .'" class="ays-survey-halloween-banner-2025-upgrade" target="_blank">Buy Now</a>
2757 </div>';
2758
2759 if( current_user_can( 'manage_options' ) ){
2760 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
2761 $content[] = '<form action="" method="POST" style="position: absolute; bottom: -5px; right: 0; color: #fff;">';
2762 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
2763 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
2764 $content[] = '</form>';
2765 $content[] = '</div>';
2766 }
2767
2768 $content[] = '
2769 </div>
2770 </div>
2771 </div>';
2772
2773 $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">';
2774 $content[] = '
2775 .ays-survey-halloween-banner-2025-main {
2776 background: linear-gradient(135deg, #1A0F2E 100%, #2D1B4E 0%);
2777 background-image: url("' . esc_attr( SURVEY_MAKER_ADMIN_URL ) . '/images/halloween-banner-background-image-remove.png"), linear-gradient(135deg, #2D1B4E 0%, #1A0F2E 100%);
2778 background-position: left center, center;
2779 background-repeat: no-repeat, no-repeat;
2780 background-size: auto 100%, cover;
2781 padding: 20px 30px 20px 130px;
2782 border-radius: 12px;
2783 color: white;
2784 margin: 20px 0;
2785 border: 0;
2786 box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
2787 overflow: hidden;
2788 }
2789
2790 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-content {
2791 display: flex;
2792 align-items: center;
2793 justify-content: space-between;
2794 gap: 30px;
2795 }
2796
2797 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-left {
2798 display: flex;
2799 align-items: center;
2800 gap: 20px;
2801 }
2802
2803 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-center {
2804 display: flex;
2805 align-items: center;
2806 justify-content: center;
2807 flex: 1;
2808 max-width: 350px;
2809 }
2810
2811 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-right {
2812 display: flex;
2813 align-items: center;
2814 gap: 15px;
2815 flex-shrink: 0;
2816 }
2817
2818 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-icon {
2819 flex-shrink: 0;
2820 }
2821
2822 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin svg {
2823 display: inline !important;
2824 border: none !important;
2825 box-shadow: none !important;
2826 height: 1em !important;
2827 width: 1em !important;
2828 margin: 0 0.07em !important;
2829 vertical-align: -0.1em !important;
2830 background: none !important;
2831 padding: 0 !important;
2832 }
2833
2834 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-orb {
2835 width: 80px;
2836 height: 80px;
2837 background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
2838 border-radius: 50%;
2839 display: flex;
2840 align-items: center;
2841 justify-content: center;
2842 box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
2843 border: 3px solid rgba(168, 85, 247, 0.4);
2844 }
2845
2846 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-question {
2847 font-size: 48px;
2848 font-weight: 700;
2849 color: #E9D5FF;
2850 }
2851
2852 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat {
2853 font-size: 20px;
2854 opacity: 0.8;
2855 }
2856
2857 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat-1 {
2858 margin-left: -100px;
2859 margin-top: -40px;
2860 }
2861
2862 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-bat-2 {
2863 margin-left: -110px;
2864 margin-top: 35px;
2865 }
2866
2867 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle {
2868 font-size: 12px;
2869 opacity: 0.7;
2870 }
2871
2872 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-1 {
2873 margin-left: -95px;
2874 margin-top: -60px;
2875 }
2876
2877 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-2 {
2878 margin-left: -70px;
2879 margin-top: -15px;
2880 }
2881
2882 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-sparkle-3 {
2883 margin-left: -120px;
2884 margin-top: 10px;
2885 }
2886
2887 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-text {
2888 flex: 1;
2889 }
2890
2891 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
2892 font-size: 24px;
2893 font-weight: 700;
2894 margin: 0 0 8px 0;
2895 line-height: 1.2;
2896 color: #fff;
2897 text-transform: uppercase;
2898 letter-spacing: 1px;
2899 }
2900
2901 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title a {
2902 color: #FB923C;
2903 text-decoration: underline;
2904 }
2905
2906 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle {
2907 font-size: 16px;
2908 margin: 0;
2909 opacity: 0.9;
2910 font-weight: 400;
2911 color: #E9D5FF;
2912 }
2913
2914 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-description {
2915 font-size: 14px;
2916 margin: 0;
2917 opacity: 0.85;
2918 line-height: 1.5;
2919 color: #D8B4FE;
2920 }
2921
2922 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
2923 font-size: 64px;
2924 filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.8));
2925 flex-shrink: 0;
2926 }
2927
2928 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount-section {
2929 display: flex;
2930 flex-direction: column;
2931 align-items: center;
2932 gap: 10px;
2933 }
2934
2935 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount {
2936 font-size: 36px;
2937 font-weight: 700;
2938 color: #FB923C;
2939 text-shadow: 0 0 20px rgba(251, 146, 60, 0.6);
2940 margin: 0;
2941 line-height: 1;
2942 }
2943
2944 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-wrapper {
2945 display:none;
2946 margin-bottom: 5px;
2947 }
2948
2949 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box {
2950 border: 2px dashed rgba(255, 255, 255, 0.4);
2951 padding: 6px 12px;
2952 border-radius: 6px;
2953 background: rgba(255, 255, 255, 0.1);
2954 cursor: pointer;
2955 transition: all 0.3s ease;
2956 display: flex;
2957 align-items: center;
2958 gap: 6px;
2959 backdrop-filter: blur(10px);
2960 }
2961
2962 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box:hover {
2963 background: rgba(255, 255, 255, 0.2);
2964 border-color: rgba(255, 255, 255, 0.6);
2965 transform: translateY(-1px);
2966 }
2967
2968 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-text {
2969 font-size: 14px;
2970 font-weight: 700;
2971 letter-spacing: 1px;
2972 color: #fff;
2973 font-family: monospace;
2974 }
2975
2976 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-copy-icon {
2977 opacity: 0.8;
2978 transition: opacity 0.3s ease;
2979 }
2980
2981 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-box:hover .ays-survey-halloween-banner-2025-copy-icon {
2982 opacity: 1;
2983 }
2984
2985 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade {
2986 background: linear-gradient(135deg, #FB923C 0%, #F97316 100%);
2987 color: white;
2988 border: none;
2989 padding: 12px 28px;
2990 border-radius: 8px;
2991 font-size: 16px;
2992 font-weight: 600;
2993 cursor: pointer;
2994 transition: all 0.3s ease;
2995 box-shadow: 0 4px 16px rgba(251, 146, 60, 0.5);
2996 text-decoration: none;
2997 display: inline-flex;
2998 align-items: center;
2999 text-align: center;
3000 }
3001
3002 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade:hover {
3003 transform: translateY(-2px);
3004 box-shadow: 0 6px 20px rgba(251, 146, 60, 0.7);
3005 text-decoration: none;
3006 color: white;
3007 }
3008
3009 .ays-survey-halloween-banner-2025-main .notice-dismiss:before {
3010 color: #fff;
3011 }
3012
3013 .ays-survey-halloween-banner-2025-copy-notification {
3014 position: fixed;
3015 top: 50%;
3016 left: 50%;
3017 transform: translate(-50%, -50%);
3018 background: rgba(0, 0, 0, 0.8);
3019 color: white;
3020 padding: 12px 24px;
3021 border-radius: 8px;
3022 font-size: 14px;
3023 z-index: 10000;
3024 opacity: 0;
3025 transition: opacity 0.3s ease;
3026 }
3027
3028 .ays-survey-halloween-banner-2025-copy-notification.show {
3029 opacity: 1;
3030 }
3031
3032 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-timer {
3033 display: flex;
3034 align-items: center;
3035 justify-content: center;
3036 gap: 8px;
3037 }
3038
3039 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-item {
3040 background: rgba(255, 255, 255, 0.15);
3041 border-radius: 8px;
3042 padding: 8px 12px;
3043 min-width: 60px;
3044 backdrop-filter: blur(10px);
3045 }
3046
3047 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-value {
3048 font-size: 24px;
3049 font-weight: 700;
3050 line-height: 1;
3051 margin-bottom: 4px;
3052 color: #fff;
3053 text-align: center;
3054 }
3055
3056 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-label {
3057 font-size: 11px;
3058 opacity: 0.8;
3059 text-transform: lowercase;
3060 text-align: center;
3061 }
3062
3063 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-countdown-separator {
3064 font-size: 24px;
3065 font-weight: 700;
3066 opacity: 0.6;
3067 margin: 0 4px;
3068 }
3069
3070 @media (min-width: 1200px) {
3071 .ays-survey-halloween-banner-2025-main .wp-core-ui .notice.is-dismissible {
3072 padding-right: 60px;
3073 }
3074 }
3075
3076 @media (max-width: 1200px) {
3077
3078 div.ays-survey-halloween-banner-2025-main {
3079 padding: 20px 30px;
3080 }
3081
3082 div.ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
3083 display: none;
3084 }
3085
3086 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle,
3087 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3088 text-align: center;
3089 }
3090
3091 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-content {
3092 flex-wrap: wrap;
3093 gap: 20px;
3094 }
3095
3096 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-left {
3097 width: 100%;
3098 }
3099
3100 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-center {
3101 width: 100%;
3102 max-width: 100%;
3103 text-align: center;
3104 }
3105
3106 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-right {
3107 width: 100%;
3108 justify-content: center;
3109 }
3110 }
3111
3112 @media (max-width: 786px) {
3113 #ays-survey-halloween-banner-2025-main {
3114 display: none !important;
3115 }
3116 }
3117
3118 @media (max-width: 768px) {
3119 .ays-survey-halloween-banner-2025-main {
3120 padding: 15px 20px;
3121 margin: 15px 0;
3122 }
3123
3124 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3125 font-size: 20px;
3126 }
3127
3128 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-subtitle {
3129 font-size: 14px;
3130 }
3131
3132 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-description {
3133 font-size: 13px;
3134 }
3135
3136 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-pumpkin {
3137 font-size: 48px;
3138 }
3139
3140 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-discount {
3141 font-size: 28px;
3142 }
3143
3144 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-upgrade {
3145 padding: 10px 20px;
3146 font-size: 14px;
3147 }
3148 }
3149
3150 @media (max-width: 480px) {
3151 .ays-survey-halloween-banner-2025-main {
3152 padding: 12px 15px;
3153 }
3154
3155 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-orb {
3156 width: 60px;
3157 height: 60px;
3158 }
3159
3160 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-question {
3161 font-size: 36px;
3162 }
3163
3164 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-title {
3165 font-size: 18px;
3166 }
3167
3168 .ays-survey-halloween-banner-2025-main .ays-survey-halloween-banner-2025-coupon-text {
3169 font-size: 12px;
3170 }
3171 }
3172 ';
3173
3174 $content[] = '</style>';
3175
3176 $content[] = '<script>';
3177 $content[] = "
3178 function aysSurveyHalloweenCopyToClipboard(text) {
3179 // Create a temporary textarea element
3180 var textarea = document.createElement('textarea');
3181 textarea.value = text;
3182 textarea.style.position = 'fixed';
3183 textarea.style.opacity = '0';
3184 document.body.appendChild(textarea);
3185
3186 // Select and copy the text
3187 textarea.select();
3188 textarea.setSelectionRange(0, 99999); // For mobile devices
3189
3190 try {
3191 document.execCommand('copy');
3192 aysSurveyHalloweenShowCopyNotification('Coupon code copied!');
3193 } catch (err) {
3194 console.error('Failed to copy text: ', err);
3195 }
3196
3197 // Remove the temporary textarea
3198 document.body.removeChild(textarea);
3199 }
3200
3201 function aysSurveyHalloweenShowCopyNotification(message) {
3202 // Check if notification already exists
3203 var existingNotification = document.querySelector('.ays-survey-halloween-banner-2025-copy-notification');
3204 if (existingNotification) {
3205 document.body.removeChild(existingNotification);
3206 }
3207
3208 // Create notification element
3209 var notification = document.createElement('div');
3210 notification.className = 'ays-survey-halloween-banner-2025-copy-notification';
3211 notification.textContent = message;
3212 document.body.appendChild(notification);
3213
3214 // Show notification with animation
3215 setTimeout(function() {
3216 notification.classList.add('show');
3217 }, 10);
3218
3219 // Hide and remove notification after 2 seconds
3220 setTimeout(function() {
3221 notification.classList.remove('show');
3222 setTimeout(function() {
3223 if (notification.parentNode) {
3224 document.body.removeChild(notification);
3225 }
3226 }, 300);
3227 }, 2000);
3228 }
3229
3230 (function() {
3231 var endDate = new Date('". date('Y-m-d H:i:s', $end_date) ."').getTime();
3232
3233 function updateCountdown() {
3234 var now = new Date().getTime();
3235 var distance = endDate - now;
3236
3237 if (distance < 0) {
3238 clearInterval(updateCountdown);
3239 document.getElementById('ays-survey-halloween-banner-2025-progress-banner-countdown').style.display = 'none';
3240 return;
3241 }
3242
3243 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
3244 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
3245 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
3246 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
3247
3248 function padZero(num) {
3249 return num < 10 ? '0' + num : num;
3250 }
3251
3252 document.getElementById('ays-survey-halloween-banner-2025-days').textContent = padZero(days);
3253 document.getElementById('ays-survey-halloween-banner-2025-hours').textContent = padZero(hours);
3254 document.getElementById('ays-survey-halloween-banner-2025-minutes').textContent = padZero(minutes);
3255 document.getElementById('ays-survey-halloween-banner-2025-seconds').textContent = padZero(seconds);
3256 }
3257
3258 updateCountdown();
3259 setInterval(updateCountdown, 1000);
3260 })()";
3261 $content[] = '</script>';
3262
3263 $content = implode( '', $content );
3264 echo ($content);
3265 }
3266 }
3267
3268 // Fox LMS Pro Banner
3269 public function ays_survey_discounted_licenses_banner_message($ishmar){
3270 if($ishmar == 0 ){
3271 $content = array();
3272
3273 $date = time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
3274 $now_date = date('M d, Y H:i:s', $date);
3275
3276 $start_date = strtotime('2025-09-21');
3277 $end_date = strtotime('2025-10-21');
3278 $diff_end = $end_date - $date;
3279
3280 $style_attr = '';
3281 if( $diff_end < 0 ){
3282 $style_attr = 'style="display:none;"';
3283 }
3284
3285 $total_licenses = 50;
3286 $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);
3287 $days_passed = floor(($date - $start_date) / (24 * 60 * 60));
3288 $used_licenses = 0;
3289
3290 for ($i = 0; $i < min($days_passed, count($progression_pattern)); $i++) {
3291 $used_licenses += $progression_pattern[$i];
3292 }
3293 $used_licenses = min($used_licenses, $total_licenses);
3294 $remaining_licenses = $total_licenses - $used_licenses;
3295 $progress_percentage = ($used_licenses / $total_licenses) * 100;
3296
3297 $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);
3298
3299 $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 . '>';
3300 $content[] = '<div class="ays-survey-progress-banner-content">';
3301 $content[] = '<div class="ays-survey-progress-banner-left">';
3302 $content[] = '<div class="ays-survey-progress-banner-icon">';
3303 $content[] = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
3304 <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"/>
3305 <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"/>
3306 <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"/>
3307 <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"/>
3308 <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"/>
3309 <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"/>
3310 </svg>';
3311 $content[] = '</div>';
3312 $content[] = '<div class="ays-survey-progress-banner-text">';
3313 $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>';
3314 $content[] = '<p class="ays-survey-progress-banner-subtitle">' . __('Unlock advanced features + 30 day Money Back Guarantee', 'survey-maker') . '</p>';
3315 $content[] = '</div>';
3316 $content[] = '</div>';
3317
3318 $content[] = '<div class="ays-survey-progress-banner-center">';
3319 $content[] = '<div class="ays-survey-progress-banner-coupon">';
3320 $content[] = '<div class="ays-survey-progress-banner-coupon-box" onclick="surveyCopyToClipboard(\'FREE2PRO20\')" title="' . __('Click to copy', 'survey-maker') . '">';
3321 $content[] = '<span class="ays-survey-progress-banner-coupon-text">FREE2PRO20</span>';
3322 $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">';
3323 $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"/>';
3324 $content[] = '</svg>';
3325 $content[] = '</div>';
3326 $content[] = '</div>';
3327
3328 $content[] = '<div class="ays-survey-progress-banner-progress">';
3329 $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>';
3330 $content[] = '<div class="ays-survey-progress-banner-progress-bar">';
3331 $content[] = '<div class="ays-survey-progress-banner-progress-fill" id="progress-fill" style="width: ' . $progress_percentage . '%;"></div>';
3332 $content[] = '</div>';
3333 $content[] = '</div>';
3334 $content[] = '</div>';
3335
3336 $content[] = '<div class="ays-survey-progress-banner-right">';
3337 $content[] = '<a href="'. $ays_survey_cta_button_link .'" class="ays-survey-progress-banner-upgrade" target="_blank">';
3338 $content[] = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">';
3339 $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"/>';
3340 $content[] = '</svg>';
3341 $content[] = ' ' . __('Upgrade Now', 'survey-maker');
3342 $content[] = '</a>';
3343 $content[] = '</div>';
3344 $content[] = '</div>';
3345
3346 if( current_user_can( 'manage_options' ) ){
3347 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3348 $content[] = '<form action="" method="POST" style="position: absolute; bottom: 0; right: 0; color: #fff;">';
3349 $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="color: darkgrey; font-size: 11px;">'. __( "Dismiss ad", 'survey-maker' ) .'</button>';
3350 $content[] = wp_nonce_field( SURVEY_MAKER_NAME . '-sale-banner' , SURVEY_MAKER_NAME . '-sale-banner' );
3351 $content[] = '</form>';
3352 $content[] = '</div>';
3353 }
3354 $content[] = '</div>';
3355
3356 // Fox LMS Pro Banner Styles
3357 $content[] = '<style id="ays-survey-progress-banner-styles-inline-css">';
3358 $content[] = '
3359 .ays-survey-progress-banner-main {
3360 background: linear-gradient(135deg, #6344ED 0%, #8C2ABE 100%);
3361 padding: 20px 30px;
3362 border-radius: 16px;
3363 color: white;
3364 position: relative;
3365 margin: 20px 0;
3366 box-shadow: 0 8px 32px rgba(99, 68, 237, 0.3);
3367 border: 0;
3368 }
3369
3370 .ays-survey-progress-banner-main .ays-survey-progress-banner-content {
3371 display: flex;
3372 align-items: center;
3373 justify-content: space-between;
3374 gap: 30px;
3375 }
3376
3377 .ays-survey-progress-banner-main .ays-survey-progress-banner-left {
3378 display: flex;
3379 align-items: center;
3380 gap: 20px;
3381 flex: 1;
3382 }
3383
3384 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3385 display: flex;
3386 align-items: center;
3387 gap: 15px;
3388 flex: 1;
3389 }
3390
3391 .ays-survey-progress-banner-main .ays-survey-progress-banner-right {
3392 display: flex;
3393 align-items: center;
3394 gap: 20px;
3395 flex-shrink: 0;
3396 }
3397
3398 .ays-survey-progress-banner-main .ays-survey-progress-banner-icon {
3399 font-size: 32px;
3400 filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
3401 }
3402
3403 .ays-survey-progress-banner-main .ays-survey-progress-banner-title {
3404 font-size: 21px;
3405 font-weight: 700;
3406 margin: 0 0 8px 0;
3407 line-height: 1.2;
3408 color: #fff;
3409 }
3410
3411 .ays-survey-progress-banner-main .ays-survey-progress-banner-title a {
3412 text-decoration: underline;
3413 color: #fff;
3414 }
3415
3416 .ays-survey-progress-banner-main .ays-survey-progress-banner-subtitle {
3417 font-size: 16px;
3418 margin: 0;
3419 opacity: 0.9;
3420 font-weight: 400;
3421 }
3422
3423 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon {
3424 margin-bottom: 5px;
3425 }
3426
3427 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box {
3428 border: 2px dotted rgba(255, 255, 255, 0.6);
3429 padding: 8px 16px;
3430 border-radius: 8px;
3431 background: rgba(255, 255, 255, 0.1);
3432 cursor: pointer;
3433 transition: all 0.3s ease;
3434 display: flex;
3435 align-items: center;
3436 gap: 8px;
3437 backdrop-filter: blur(10px);
3438 }
3439
3440 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box:hover {
3441 background: rgba(255, 255, 255, 0.2);
3442 border-color: rgba(255, 255, 255, 0.8);
3443 transform: translateY(-1px);
3444 }
3445
3446 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-text {
3447 font-size: 16px;
3448 font-weight: 700;
3449 letter-spacing: 1px;
3450 color: #fff;
3451 font-family: monospace;
3452 }
3453
3454 .ays-survey-progress-banner-main .ays-survey-progress-banner-copy-icon {
3455 opacity: 0.8;
3456 transition: opacity 0.3s ease;
3457 }
3458
3459 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-box:hover .ays-survey-progress-banner-copy-icon {
3460 opacity: 1;
3461 }
3462
3463 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress {
3464 text-align: center;
3465 width: 100%;
3466 }
3467
3468 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-text {
3469 font-size: 14px;
3470 margin: 0 0 10px 0;
3471 opacity: 0.9;
3472 }
3473
3474 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3475 width: 300px;
3476 height: 10px;
3477 background: rgba(255, 255, 255, 0.2);
3478 border-radius: 4px;
3479 overflow: hidden;
3480 margin: 0 auto;
3481 }
3482
3483 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-fill {
3484 height: 100%;
3485 background: linear-gradient(90deg, #4ADE80 0%, #22C55E 100%);
3486 border-radius: 4px;
3487 transition: width 0.8s ease;
3488 width: 70%;
3489 }
3490
3491 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade {
3492 background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
3493 color: white;
3494 border: none;
3495 padding: 12px 24px;
3496 border-radius: 8px;
3497 font-size: 16px;
3498 font-weight: 600;
3499 cursor: pointer;
3500 transition: all 0.3s ease;
3501 box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
3502 text-decoration: none;
3503 display: inline-flex;
3504 align-items: center;
3505 gap: 8px;
3506 }
3507
3508 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade:hover {
3509 transform: translateY(-2px);
3510 box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
3511 text-decoration: none;
3512 color: white;
3513 }
3514
3515 .ays-survey-progress-banner-main .notice-dismiss:before {
3516 color: #fff;
3517 }
3518
3519 /* Copy notification */
3520 .ays-survey-copy-notification {
3521 position: fixed;
3522 top: 50%;
3523 left: 50%;
3524 transform: translate(-50%, -50%);
3525 background: rgba(0, 0, 0, 0.8);
3526 color: white;
3527 padding: 12px 24px;
3528 border-radius: 8px;
3529 font-size: 14px;
3530 z-index: 10000;
3531 opacity: 0;
3532 transition: opacity 0.3s ease;
3533 }
3534
3535 .ays-survey-copy-notification.show {
3536 opacity: 1;
3537 }
3538
3539 @media (max-width: 1400px) {
3540 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3541 flex-direction: column;
3542 }
3543 }
3544
3545 @media (max-width: 1200px) {
3546 .ays-survey-progress-banner-main .ays-survey-progress-banner-content {
3547 flex-direction: column;
3548 gap: 20px;
3549 }
3550
3551 .ays-survey-progress-banner-main .ays-survey-progress-banner-left {
3552 width: 100%;
3553 justify-content: center;
3554 text-align: center;
3555 flex-direction: column;
3556 }
3557
3558 .ays-survey-progress-banner-main .ays-survey-progress-banner-center {
3559 width: 100%;
3560 }
3561
3562 .ays-survey-progress-banner-main .ays-survey-progress-banner-right {
3563 width: 100%;
3564 justify-content: center;
3565 }
3566 }
3567
3568 @media (max-width: 768px) {
3569 #ays-survey-progress-banner-main {
3570 display: none !important;
3571 }
3572
3573 .ays-survey-progress-banner-main {
3574 padding: 15px 20px;
3575 margin: 15px 0;
3576 }
3577
3578 .ays-survey-progress-banner-main .ays-survey-progress-banner-title {
3579 font-size: 18px;
3580 }
3581
3582 .ays-survey-progress-banner-main .ays-survey-progress-banner-subtitle {
3583 font-size: 14px;
3584 }
3585
3586 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3587 width: 100%;
3588 max-width: 280px;
3589 }
3590
3591 .ays-survey-progress-banner-main .ays-survey-progress-banner-upgrade {
3592 padding: 10px 20px;
3593 font-size: 14px;
3594 }
3595 }
3596
3597 @media (max-width: 480px) {
3598 .ays-survey-progress-banner-main {
3599 padding: 12px 15px;
3600 }
3601
3602 .ays-survey-progress-banner-main .ays-survey-progress-banner-coupon-text {
3603 font-size: 14px;
3604 }
3605
3606 .ays-survey-progress-banner-main .ays-survey-progress-banner-progress-bar {
3607 max-width: 250px;
3608 }
3609 }
3610 ';
3611
3612 $content[] = '</style>';
3613
3614 $content = implode( '', $content );
3615 echo ($content);
3616 }
3617 }
3618
3619 public function ays_survey_new_mega_bundle_message($ishmar){
3620 if($ishmar == 0 ){
3621 $content = array();
3622 $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">';
3623 $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
3624
3625 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
3626
3627 $content[] = '<div class="ays-survey-dicount-wrap-text-box-texts">';
3628 $content[] = '<div>
3629 <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)
3630 </div>
3631 <div style="position: relative;">
3632 <span class="ays-survey-sale-baner-mega-bundle-sale-text">50%</span>
3633 <img style="position: absolute;top: 30px;left: 0;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/line.webp">
3634 </div>';
3635 $content[] = '</div>';
3636
3637 $content[] = '<div style="font-size: 17px; display: flex; align-items: center; margin-top: 10px;">';
3638 $content[] = '<img style="width: 30px;height: 25px;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/guaranteeicon.webp">';
3639 $content[] = '<span style="padding-left: 8px"> 30 Day Money Back Guarantee</span>';
3640
3641 $content[] = '</div>';
3642
3643
3644
3645 $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
3646
3647 $content[] = '<form action="" method="POST">';
3648 $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3649 if( current_user_can( 'manage_options' ) ){
3650 $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>';
3651 $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
3652 }
3653 $content[] = '</div>';
3654 $content[] = '</form>';
3655
3656 $content[] = '</div>';
3657
3658 $content[] = '</div>';
3659
3660 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
3661
3662 $content[] = '<div id="ays-survey-maker-countdown-main-container">';
3663 $content[] = '<div class="ays-survey-maker-countdown-container">';
3664
3665 $content[] = '<div id="ays-survey-countdown">';
3666
3667 // $content[] = '<div>';
3668 // $content[] = __( "Offer ends in:", "survey-maker" );
3669 // $content[] = '</div>';
3670
3671 $content[] = '<ul>';
3672 $content[] = '<li><span id="ays-survey-countdown-days"></span>days</li>';
3673 $content[] = '<li><span id="ays-survey-countdown-hours"></span>Hours</li>';
3674 $content[] = '<li><span id="ays-survey-countdown-minutes"></span>Minutes</li>';
3675 $content[] = '<li><span id="ays-survey-countdown-seconds"></span>Seconds</li>';
3676 $content[] = '</ul>';
3677 $content[] = '</div>';
3678
3679 $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
3680 $content[] = '<span>🚀</span>';
3681 $content[] = '<span>⌛</span>';
3682 $content[] = '<span>🔥</span>';
3683 $content[] = '<span>💣</span>';
3684 $content[] = '</div>';
3685
3686 $content[] = '</div>';
3687 $content[] = '</div>';
3688
3689 $content[] = '</div>';
3690
3691 $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
3692 $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>';
3693 $content[] = '<span >One-time payment</span>';
3694 $content[] = '</div>';
3695 $content[] = '</div>';
3696 $content[] = '</div>';
3697
3698 $new_mega_bundle_logo_background = SURVEY_MAKER_ADMIN_URL . '/images/new-mega-bundle-logo-background.svg';
3699
3700 $content[] = '<style id="ays-survey-new-mega-bundle-styles-inline-css">';
3701 $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}';
3702 $content[] = '</style>';
3703
3704
3705 $content = implode( '', $content );
3706 echo html_entity_decode(esc_html( $content ));
3707 }
3708 }
3709
3710
3711 // public function ays_survey_new_mega_bundle_message_2024($ishmar){
3712 // if($ishmar == 0 ){
3713 // $content = array();
3714 // $content[] = '<div id="ays-survey-new-mega-bundle-dicount-month-main-2024" class="notice notice-success is-dismissible ays_survey_dicount_info">';
3715 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
3716
3717 // $content[] = '<div class="ays-survey-discount-box-sale-image"></div>';
3718 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
3719
3720 // $content[] = '<div class="ays-survey-dicount-wrap-text-box-texts">';
3721 // $content[] = '<div>
3722 // <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;">
3723 // <span class="ays-survey-new-mega-bundle-limited-text">Limited</span> Offer for Mega bundle </a> <br>
3724
3725 // <span style="font-size: 19px ;">(Quiz + Survey + Poll)</span>
3726 // </div>';
3727 // $content[] = '</div>';
3728
3729 // $content[] = '<div style="font-size: 17px;">';
3730 // $content[] = '<img style="width: 24px;height: 24px;" src="' . esc_attr(SURVEY_MAKER_ADMIN_URL) . '/images/icons/guarantee-new.png">';
3731 // $content[] = '<span style="padding-left: 4px; font-size: 14px; font-weight: 600;"> 30 Day Money Back Guarantee</span>';
3732
3733 // $content[] = '</div>';
3734
3735
3736
3737 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
3738
3739 // $content[] = '<form action="" method="POST">';
3740 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3741 // if( current_user_can( 'manage_options' ) ){
3742 // $content[] = '<button class="btn btn-link ays-button" name="ays_survey_sale_btn" style="height: 32px; margin-left: 0;padding-left: 0; color: #30499B;
3743 // ">Dismiss ad</button>';
3744 // $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
3745 // }
3746 // $content[] = '</div>';
3747 // $content[] = '</form>';
3748
3749 // $content[] = '</div>';
3750
3751 // $content[] = '</div>';
3752
3753 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
3754
3755 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
3756 // $content[] = '<div class="ays-survey-maker-countdown-container">';
3757
3758 // $content[] = '<div id="ays-survey-countdown">';
3759
3760 // $content[] = '<div style="font-weight: 500;">';
3761 // $content[] = __( "Offer ends in:", "survey-maker" );
3762 // $content[] = '</div>';
3763
3764 // $content[] = '<ul>';
3765 // $content[] = '<li><span id="ays-survey-countdown-days"></span>days</li>';
3766 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>Hours</li>';
3767 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>Minutes</li>';
3768 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>Seconds</li>';
3769 // $content[] = '</ul>';
3770 // $content[] = '</div>';
3771
3772 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
3773 // $content[] = '<span>🚀</span>';
3774 // $content[] = '<span>⌛</span>';
3775 // $content[] = '<span>🔥</span>';
3776 // $content[] = '<span>💣</span>';
3777 // $content[] = '</div>';
3778
3779 // $content[] = '</div>';
3780 // $content[] = '</div>';
3781
3782 // $content[] = '</div>';
3783
3784 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
3785 // $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>';
3786 // $content[] = '<span >One-time payment</span>';
3787 // $content[] = '</div>';
3788 // $content[] = '</div>';
3789 // $content[] = '</div>';
3790
3791 // $content = implode( '', $content );
3792 // echo html_entity_decode(esc_html( $content ));
3793 // }
3794 // }
3795
3796 // // Black Friday 2024
3797 // public function ays_survey_black_friday_message_2024($ishmar){
3798 // if($ishmar == 0 ){
3799 // $content = array();
3800
3801 // $content[] = '<div id="ays-survey-black-friday-bundle-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
3802 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
3803
3804 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
3805
3806 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
3807 // $content[] = '<div class="ays-survey-maker-countdown-container">';
3808
3809 // $content[] = '<div id="ays-survey-countdown">';
3810
3811 // $content[] = '<div>';
3812 // $content[] = __( "Offer ends in:", "survey-maker" );
3813 // $content[] = '</div>';
3814
3815 // $content[] = '<ul>';
3816 // $content[] = '<li><span id="ays-survey-countdown-days"></span>'. __( "Days", "survey-maker" ) .'</li>';
3817 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>'. __( "Hours", "survey-maker" ) .'</li>';
3818 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>'. __( "Minutes", "survey-maker" ) .'</li>';
3819 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>'. __( "Seconds", "survey-maker" ) .'</li>';
3820 // $content[] = '</ul>';
3821 // $content[] = '</div>';
3822
3823 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
3824 // $content[] = '<span>🚀</span>';
3825 // $content[] = '<span>⌛</span>';
3826 // $content[] = '<span>🔥</span>';
3827 // $content[] = '<span>💣</span>';
3828 // $content[] = '</div>';
3829
3830 // $content[] = '</div>';
3831 // $content[] = '</div>';
3832
3833 // $content[] = '</div>';
3834
3835 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
3836 // $content[] = '<div>';
3837
3838 // $content[] = '<span class="ays-survey-black-friday-bundle-title">';
3839 // $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" );
3840 // $content[] = '</span>';
3841
3842 // $content[] = '</br>';
3843
3844 // $content[] = '<span class="ays-survey-black-friday-bundle-desc">';
3845 // $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">';
3846 // $content[] = __( "50% OFF", "survey-maker" );
3847 // $content[] = '</a>';
3848 // $content[] = '</span>';
3849 // $content[] = '</div>';
3850
3851 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
3852
3853 // $content[] = '<form action="" method="POST">';
3854 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3855 // if( current_user_can( 'manage_options' ) ){
3856 // $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>';
3857 // $content[] = wp_nonce_field( 'survey-maker-sale-bf-banner' , 'survey-maker-sale-bf-banner' );
3858 // }
3859 // $content[] = '</div>';
3860 // $content[] = '</form>';
3861
3862 // $content[] = '</div>';
3863
3864 // $content[] = '</div>';
3865
3866 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-black-friday-bundle-coupon-text-box">';
3867 // // $content[] = '<div class="ays-survey-black-friday-bundle-coupon-row">';
3868 // // $content[] = 'bfdeal20off';
3869 // // $content[] = '</div>';
3870
3871 // $content[] = '<div class="ays-survey-black-friday-bundle-data-title">';
3872 // $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">';
3873 // $content[] = __( 'MEGA BUNDLE', "survey-maker" );
3874 // $content[] = '</a>';
3875 // $content[] = '</div>';
3876 // $content[] = '</div>';
3877
3878 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
3879 // $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>';
3880 // $content[] = '<span class="ays-survey-dicount-one-time-text">';
3881 // $content[] = __( "One-time payment", "survey-maker" );
3882 // $content[] = '</span>';
3883 // $content[] = '</div>';
3884 // $content[] = '</div>';
3885 // $content[] = '</div>';
3886
3887 // $content = implode( '', $content );
3888 // echo $content;
3889 // }
3890 // }
3891
3892 // Christmas Top Banner 2024
3893 // public function ays_survey_christmas_top_message_2024($ishmar){
3894 // if($ishmar == 0 ){
3895 // $content = array();
3896
3897 // $content[] = '<div id="ays-survey-christmas-top-bundle-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
3898 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
3899
3900 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-countdown-box">';
3901
3902 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
3903 // $content[] = '<div class="ays-survey-maker-countdown-container">';
3904
3905 // $content[] = '<div id="ays-survey-countdown">';
3906
3907 // $content[] = '<div>';
3908 // $content[] = __( "Offer ends in:", "survey-maker" );
3909 // $content[] = '</div>';
3910
3911 // $content[] = '<ul>';
3912 // $content[] = '<li><span id="ays-survey-countdown-days"></span>'. __( "Days", "survey-maker" ) .'</li>';
3913 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>'. __( "Hours", "survey-maker" ) .'</li>';
3914 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>'. __( "Minutes", "survey-maker" ) .'</li>';
3915 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>'. __( "Seconds", "survey-maker" ) .'</li>';
3916 // $content[] = '</ul>';
3917 // $content[] = '</div>';
3918
3919 // $content[] = '<div id="ays-survey-countdown-content" class="emoji">';
3920 // $content[] = '<span>🚀</span>';
3921 // $content[] = '<span>⌛</span>';
3922 // $content[] = '<span>🔥</span>';
3923 // $content[] = '<span>💣</span>';
3924 // $content[] = '</div>';
3925
3926 // $content[] = '</div>';
3927 // $content[] = '</div>';
3928
3929 // $content[] = '</div>';
3930
3931 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-text-box">';
3932 // $content[] = '<div>';
3933
3934 // $content[] = '<span class="ays-survey-christmas-top-bundle-title">';
3935 // $content[] = '<span>';
3936 // $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);
3937
3938 // $content[] = __( "Christmas Sale", "survey-maker" );
3939 // $content[] = '</a>';
3940 // $content[] = '</span>';
3941 // $content[] = '</br>';
3942
3943 // $content[] = '<span class="ays-survey-christmas-top-bundle-desc">';
3944 // $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);
3945 // $content[] = __( "20% Extra OFF", "survey-maker" );
3946 // $content[] = '</a>';
3947 // $content[] = '</span>';
3948 // $content[] = '</div>';
3949
3950 // $content[] = '<div style="position: absolute;right: 10px;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form">';
3951
3952 // $content[] = '<form action="" method="POST">';
3953 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
3954 // if( current_user_can( 'manage_options' ) ){
3955 // $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>';
3956 // $content[] = wp_nonce_field( "survey-maker" . '-sale-banner' , "survey-maker" . '-sale-banner' );
3957 // }
3958 // $content[] = '</div>';
3959 // $content[] = '</form>';
3960
3961 // $content[] = '</div>';
3962
3963 // $content[] = '</div>';
3964
3965 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-christmas-top-bundle-coupon-text-box">';
3966 // $content[] = '<div class="ays-survey-christmas-top-bundle-coupon-row">';
3967 // $content[] = 'xmas20off';
3968 // $content[] = '</div>';
3969
3970 // $content[] = '<div class="ays-survey-christmas-top-bundle-text-row">';
3971 // $content[] = __( '20% Extra Discount Coupon', "survey-maker" );
3972 // $content[] = '</div>';
3973 // $content[] = '</div>';
3974
3975 // $content[] = '<div class="ays-survey-dicount-wrap-box ays-survey-dicount-wrap-button-box">';
3976 // $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);
3977 // $content[] = __( 'Get Your Deal', "survey-maker" );
3978 // $content[] = '</a>';
3979 // $content[] = '<span class="ays-survey-dicount-one-time-text">';
3980 // $content[] = __( "One-time payment", "survey-maker" );
3981 // $content[] = '</span>';
3982 // $content[] = '</div>';
3983 // $content[] = '</div>';
3984 // $content[] = '</div>';
3985
3986 // $content = implode( '', $content );
3987 // echo $content;
3988 // }
3989 // }
3990
3991
3992
3993 // Black Friday
3994 // public function ays_survey_black_friday_message($ishmar){
3995 // if($ishmar == 0 ){
3996 // $content = array();
3997
3998 // $content[] = '<div id="ays-survey-dicount-black-friday-month-main" class="notice notice-success is-dismissible ays_chart_dicount_info">';
3999 // $content[] = '<div id="ays-survey-dicount-black-friday-month" class="ays_chart_dicount_month">';
4000 // $content[] = '<div class="ays-survey-dicount-black-friday-box">';
4001 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-box-80" style="width: 70%;">';
4002 // $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>';
4003 // $content[] = '<div class="ays-survey-dicount-black-friday-title-row">' . __( 'Mega bundle', "survey-maker" ) . ' (Quiz+Survey+Poll)!</div> ';
4004 // $content[] = '</div>';
4005
4006 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box ays-survey-dicount-black-friday-wrap-text-box">';
4007 // $content[] = '<div class="ays-survey-dicount-black-friday-text-row">' . __( '50% off', "survey-maker" ) . '</div>';
4008 // $content[] = '</div>';
4009
4010 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
4011 // $content[] = '<div id="ays-survey-countdown-main-container">';
4012 // $content[] = '<div class="ays-survey-countdown-container">';
4013 // $content[] = '<div id="ays-survey-countdown" style="display: block;">';
4014 // $content[] = '<ul>';
4015 // $content[] = '<li><span id="ays-survey-countdown-days">0</span>' . __( 'Days', "survey-maker" ) . '</li>';
4016 // $content[] = '<li><span id="ays-survey-countdown-hours">0</span>' . __( 'Hours', "survey-maker" ) . '</li>';
4017 // $content[] = '<li><span id="ays-survey-countdown-minutes">0</span>' . __( 'Minutes', "survey-maker" ) . '</li>';
4018 // $content[] = '<li><span id="ays-survey-countdown-seconds">0</span>' . __( 'Seconds', "survey-maker" ) . '</li>';
4019 // $content[] = '</ul>';
4020 // $content[] = '</div>';
4021 // $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
4022 // $content[] = '<span>🚀</span>';
4023 // $content[] = '<span>⌛</span>';
4024 // $content[] = '<span>🔥</span>';
4025 // $content[] = '<span>💣</span>';
4026 // $content[] = '</div>';
4027 // $content[] = '</div>';
4028 // $content[] = '</div>';
4029 // $content[] = '</div>';
4030
4031 // $content[] = '<div class="ays-survey-dicount-black-friday-wrap-box" style="width: 25%;">';
4032 // $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>';
4033 // $content[] = '</div>';
4034 // $content[] = '</div>';
4035 // $content[] = '</div>';
4036
4037 // $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-black-friday">';
4038 // $content[] = '<form action="" method="POST">';
4039 // $content[] = '<div id="ays-survey-dismiss-buttons-content">';
4040 // if( current_user_can( 'manage_options' ) ){
4041 // $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>';
4042 // $content[] = wp_nonce_field( $this->plugin_name . '-sale-banner' , $this->plugin_name . '-sale-banner' );
4043 // }
4044 // $content[] = '</div>';
4045 // $content[] = '</form>';
4046 // $content[] = '</div>';
4047 // $content[] = '</div>';
4048
4049 // $content = implode( '', $content );
4050
4051 // echo $content;
4052 // }
4053 // }
4054
4055 // Christmas banner
4056 // public static function ays_survey_christmas_message($ishmar){
4057 // if($ishmar == 0 ){
4058 // $content = array();
4059
4060 // $content[] = '<div id="ays-survey-dicount-christmas-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4061 // $content[] = '<div id="ays-survey-dicount-christmas-month" class="ays_survey_dicount_month">';
4062 // $content[] = '<div class="ays-survey-dicount-christmas-box">';
4063 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box ays-survey-dicount-christmas-wrap-box-80">';
4064 // $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>';
4065 // $content[] = '<div class="ays-survey-dicount-christmas-title-row">' . __( 'Survey Maker Plugin', "survey-maker" ) . '</div>';
4066 // $content[] = '</div>';
4067
4068 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box" style="width: 25%;">';
4069 // $content[] = '<div id="ays-survey-maker-countdown-main-container">';
4070 // $content[] = '<div class="ays-survey-countdown-container">';
4071 // $content[] = '<div id="ays-survey-countdown" style="display: block;">';
4072 // $content[] = '<ul>';
4073 // $content[] = '<li><span id="ays-survey-countdown-days"></span>' . __( 'Days', "survey-maker" ) . '</li>';
4074 // $content[] = '<li><span id="ays-survey-countdown-hours"></span>' . __( 'Hours', "survey-maker" ) . '</li>';
4075 // $content[] = '<li><span id="ays-survey-countdown-minutes"></span>' . __( 'Minutes', "survey-maker" ) . '</li>';
4076 // $content[] = '<li><span id="ays-survey-countdown-seconds"></span>' . __( 'Seconds', "survey-maker" ) . '</li>';
4077 // $content[] = '</ul>';
4078 // $content[] = '</div>';
4079 // $content[] = '<div id="ays-survey-countdown-content" class="emoji" style="display: none;">';
4080 // $content[] = '<span>🚀</span>';
4081 // $content[] = '<span>⌛</span>';
4082 // $content[] = '<span>🔥</span>';
4083 // $content[] = '<span>💣</span>';
4084 // $content[] = '</div>';
4085 // $content[] = '</div>';
4086 // $content[] = '</div>';
4087 // $content[] = '</div>';
4088
4089 // $content[] = '<div class="ays-survey-dicount-christmas-wrap-box" style="width: 25%;">';
4090 // $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>';
4091 // $content[] = '</div>';
4092 // $content[] = '</div>';
4093 // $content[] = '</div>';
4094
4095 // $content[] = '<div style="position: absolute;right: 0;bottom: 1px;" class="ays-survey-dismiss-buttons-container-for-form-christmas">';
4096 // $content[] = '<form action="" method="POST">';
4097 // $content[] = '<div id="ays-survey-dismiss-buttons-content-christmas">';
4098 // $content[] = '<button class="btn btn-link ays-button-christmas" name="ays_survey_sale_btn" style="">' . __( 'Dismiss ad', "survey-maker" ) . '</button>';
4099 // $content[] = '</div>';
4100 // $content[] = '</form>';
4101 // $content[] = '</div>';
4102 // $content[] = '</div>';
4103
4104 // $content = implode( '', $content );
4105
4106 // echo $content;
4107 // }
4108 // }
4109
4110 public function ays_survey_add_survey_template() {
4111 global $wpdb;
4112
4113 $template_file_name = (isset($_REQUEST['template_file_name']) && $_REQUEST['template_file_name'] != "") ? sanitize_text_field($_REQUEST['template_file_name'] ) : null;
4114
4115 switch($template_file_name){
4116 case 'customer-feedback-form':
4117 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/customer-feedback-form.json");
4118 break;
4119 case 'employee-satisfaction-survey':
4120 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/employee-satisfaction-survey.json");
4121 break;
4122 case 'event-evaluation-survey':
4123 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/event-evaluation-survey.json");
4124 break;
4125 case 'product-research-survey':
4126 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/product-research-survey.json");
4127 break;
4128 case 'restaurant-evaluation-survey':
4129 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/restaurant-evaluation-survey.json");
4130 break;
4131 case 'market-research-survey':
4132 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/market-research-survey.json");
4133 break;
4134 case 'brand-awareness-survey':
4135 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/brand-awareness-survey.json");
4136 break;
4137 case 'user-persona-survey':
4138 $json = file_get_contents(SURVEY_MAKER_ADMIN_PATH . "/partials/surveys/templates/user-persona-survey.json");
4139 break;
4140 }
4141
4142 $response = array();
4143 $json = json_decode($json, true);
4144 $json_key = isset($json['ays_survey_key']) ? $json['ays_survey_key'] : false;
4145
4146 if($json_key) {
4147 $response = array(
4148 'status' => true,
4149 'data' => $json
4150 );
4151
4152 echo json_encode( $response );
4153 wp_die();
4154 }else{
4155 $response = array(
4156 'status' => false
4157 );
4158
4159 echo json_encode( $response );
4160 wp_die();
4161 }
4162 }
4163
4164 // public static function ays_survey_spring_bundle_small_message($ishmar){
4165 // if($ishmar == 0 ){
4166 // $content = array();
4167
4168 // $content[] = '<div id="ays-survey-dicount-month-main" class="notice notice-success is-dismissible ays_survey_dicount_info">';
4169 // $content[] = '<div id="ays-survey-dicount-month" class="ays_survey_dicount_month">';
4170 // $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>';
4171
4172 // $content[] = '<div class="ays-survey-dicount-wrap-box">';
4173 // $content[] = '<p>';
4174 // $content[] = '<strong>';
4175 // $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 );
4176 // $content[] = '</strong>';
4177 // $content[] = '</p>';
4178 // $content[] = '</div>';
4179
4180 // $content[] = '<div class="ays-survey-dicount-wrap-box">';
4181
4182 // $content[] = '<div id="ays-survey-countdown-main-container">';
4183
4184 // $content[] = '<form action="" method="POST" class="ays-survey-btn-form">';
4185 // $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>';
4186 // $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>';
4187 // $content[] = '</form>';
4188
4189 // $content[] = '</div>';
4190
4191 // $content[] = '</div>';
4192
4193 // $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>';
4194 // $content[] = '</div>';
4195 // $content[] = '</div>';
4196
4197 // $content = implode( '', $content );
4198 // echo $content;
4199 // }
4200 // }
4201
4202 public function ays_survey_maker_live_preview_content(){
4203
4204 $content = isset($_REQUEST['content']) && $_REQUEST['content'] != '' ? wp_kses_post( $_REQUEST['content'] ) : null;
4205 if($content === null){
4206 ob_end_clean();
4207 $ob_get_clean = ob_get_clean();
4208 echo json_encode(array(
4209 'status' => false,
4210 ));
4211 }
4212 // $content = Survey_Maker_Data::ays_autoembed( $content );
4213 $content = stripslashes( wpautop( $content ) );
4214 ob_end_clean();
4215 $ob_get_clean = ob_get_clean();
4216 echo json_encode(array(
4217 'status' => true,
4218 'content' => $content,
4219 ));
4220 wp_die();
4221 }
4222
4223 public function add_tabs() {
4224 $screen = get_current_screen();
4225
4226 if ( ! $screen) {
4227 return;
4228 }
4229
4230 $title = __( 'General Information:', "survey-maker");
4231 $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.
4232 <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.';
4233
4234 $sidebar_content = '<p><strong>' . __( 'For more information:', "survey-maker") . '</strong></p>' .
4235 '<p>
4236 <a href="https://www.youtube.com/watch?v=Q1qi649acb0" target="_blank">' . __( 'YouTube video tutorials' , "survey-maker" ) . '</a>
4237 </p>' .
4238 '<p>
4239 <a href="https://ays-pro.com/wordpress-survey-maker-user-manual" target="_blank">' . __( 'Documentation', "survey-maker" ) . '</a>
4240 </p>' .
4241 '<p>
4242 <a href="https://ays-pro.com/wordpress/survey-maker" target="_blank">' . __( 'Survey Maker plugin pro version', "survey-maker" ) . '</a>
4243 </p>' .
4244 '<p>
4245 <a href="https://ays-demo.com/wordpress-survey-plugin-pro-demo/" target="_blank">' . __( 'Survey Maker plugin demo', "survey-maker" ) . '</a>
4246 </p>';
4247
4248
4249 $content = '<h2>' . __( 'Survey Maker Information', "survey-maker") . '</h2>'
4250 .'<p>' .sprintf(__( '%s', "survey-maker" ), $content_text).'</p>';
4251
4252 $help_tab_content = array(
4253 'id' => 'survey_maker_help_tab',
4254 'title' => $title,
4255 'content' => $content
4256 );
4257
4258 $screen->add_help_tab($help_tab_content);
4259
4260 $screen->set_help_sidebar($sidebar_content);
4261 }
4262
4263 public function get_next_or_prev_survey_by_id( $id, $type = "next" ) {
4264 global $wpdb;
4265
4266 $surveys_table = esc_sql( $wpdb->prefix . "ayssurvey_surveys" );
4267
4268 $where = array();
4269 $where_condition = "";
4270
4271 $id = (isset( $id ) && $id != "" && absint($id) != 0) ? absint( sanitize_text_field( $id ) ) : null;
4272 $type = (isset( $type ) && $type != "") ? sanitize_text_field( $type ) : "next";
4273
4274 if ( is_null( $id ) || $id == 0 ) {
4275 return null;
4276 }
4277
4278 switch ( $type ) {
4279 case 'prev':
4280 $where[] = ' `id` < ' . $id . ' ORDER BY `id` DESC ';
4281 break;
4282 case 'next':
4283 default:
4284 $where[] = ' `id` > ' . $id;
4285 break;
4286 }
4287
4288 if( ! empty($where) ){
4289 $where_condition = " WHERE " . implode( " AND ", $where );
4290 }
4291
4292 $sql = "SELECT `id` FROM {$surveys_table} ". $where_condition ." LIMIT 1;";
4293 $results = $wpdb->get_row( $sql, 'ARRAY_A' );
4294
4295 return $results;
4296
4297 }
4298
4299 public static function ays_survey_update_banner_time(){
4300
4301 $date = time() + ( 3 * 24 * 60 * 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS);
4302 // $date = time() + ( 60 ) + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS); // for testing | 1 min
4303 $next_3_days = date('M d, Y H:i:s', $date);
4304
4305 $ays_survey_banner_time = get_option('ays_survey_banner_time');
4306
4307 if ( !$ays_survey_banner_time || is_null( $ays_survey_banner_time ) ) {
4308 update_option('ays_survey_banner_time', $next_3_days );
4309 }
4310
4311 $get_ays_survey_banner_time = get_option('ays_survey_banner_time');
4312
4313 $val = 60*60*24*0.5; // half day
4314 // $val = 60; // for testing | 1 min
4315
4316 $current_date = current_time( 'mysql' );
4317 $date_diff = strtotime($current_date) - intval(strtotime($get_ays_survey_banner_time));
4318
4319 $days_diff = $date_diff / $val;
4320 if(intval($days_diff) > 0 ){
4321 update_option('ays_survey_banner_time', $next_3_days);
4322 }
4323
4324 return $get_ays_survey_banner_time;
4325 }
4326
4327 //---------------- Survey submisson open results in popup ----------------
4328
4329
4330 public function ays_survey_show_results(){
4331
4332 // Run a security check.
4333 check_ajax_referer( 'survey-maker-ajax-results-nonce', sanitize_key( $_REQUEST['_ajax_nonce'] ) );
4334
4335 global $wpdb;
4336 if( !is_user_logged_in() ) {
4337 echo json_encode( array(
4338 'status' => false,
4339 'rows' => ""
4340 ) );
4341
4342 };
4343
4344 // Check for permissions.
4345 if ( ! current_user_can( 'manage_options' ) ) {
4346 ob_end_clean();
4347 $ob_get_clean = ob_get_clean();
4348 echo json_encode(array(
4349 'status' => false,
4350 "rows" => ""
4351 ));
4352 wp_die();
4353 }
4354
4355 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ays_survey_show_results' && isset($_REQUEST['survey_id']) && !empty($_REQUEST['survey_id'])) {
4356
4357 ob_start();
4358
4359 $survey_id = absint(intval($_REQUEST['survey_id']));
4360
4361
4362 $this->settings_obj = new Survey_Maker_Settings_Actions($this->plugin_name);
4363
4364 $filters = array();
4365
4366 $submission_count_and_ids = Survey_Maker_Data::get_submission_count_and_ids( $survey_id, $filters );
4367 $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();
4368 $filters['filter_submission_ids'] = $submission_ids_arr;
4369
4370
4371 $sql = "SELECT * FROM " . $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "surveys WHERE id =" . absint( $survey_id );
4372 $survey_name = $wpdb->get_row( $sql, 'ARRAY_A' );
4373
4374 $survey_options = isset( $survey_name['options'] ) && $survey_name['options'] != '' ? json_decode( $survey_name['options'], true ) : array();
4375
4376 $survey_for_charts = isset( $survey_options['survey_color'] ) && $survey_options['survey_color'] != '' ? esc_attr($survey_options['survey_color']) : "rgb(255, 87, 34)";
4377 $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)";
4378 if(isset( $survey_options['survey_color'] ) && $survey_options['survey_color'] == 'rgba(0,0,0,0)'){
4379 $survey_for_charts = "rgba(0,0,0,1)";
4380 }
4381 if($survey_for_charts_text_color == 'rgba(0,0,0,0)'){
4382 $survey_for_charts_text_color = "rgba(0,0,0,1)";
4383 }
4384 // Allow HTML in answers
4385 $survey_options[ 'survey_allow_html_in_answers' ] = isset($survey_options[ 'survey_allow_html_in_answers' ]) ? $survey_options[ 'survey_allow_html_in_answers' ] : 'off';
4386 $allow_html_in_answers = (isset($survey_options[ 'survey_allow_html_in_answers' ]) && $survey_options[ 'survey_allow_html_in_answers' ] == 'on') ? true : false;
4387
4388 // Allow HTML in description
4389 $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';
4390 $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;
4391
4392 $user_id = get_current_user_id();
4393
4394 $author_id = isset( $survey_name['author_id'] ) && $survey_name['author_id'] != "" ? intval( $survey_name['author_id'] ) : 0;
4395 $survey_title = isset( $survey_name['title'] ) && $survey_name['title'] != "" ? esc_html__( $survey_name['title'], "survey-maker" ) : "";
4396
4397 $owner = false;
4398 if( $user_id == $author_id ){
4399 $owner = true;
4400 }
4401
4402 if( !$owner ){
4403 $url = esc_url_raw( remove_query_arg( array( 'page', 'survey' ) ) ) . "?page=survey-maker-submissions";
4404 wp_redirect( $url );
4405 }
4406
4407 $gen_options = ($this->settings_obj->ays_get_setting('options') === false) ? array() : json_decode($this->settings_obj->ays_get_setting('options'), true);
4408
4409 $submission_id = (isset($_REQUEST['submission_id']) && $_REQUEST['submission_id'] != '') ? absint( sanitize_text_field( $_REQUEST['submission_id'] ) ) : null;
4410 if($submission_id == null){
4411
4412 return array(
4413 'status' => false,
4414 'rows' => ""
4415 );
4416 }
4417 $submission = array(
4418 'id' => $submission_id
4419 );
4420
4421
4422 $ays_survey_individual_questions = $this->ays_survey_individual_results_for_one_submission( $submission, $survey_name );
4423
4424 // Show question title as HTML
4425 $survey_options[ 'survey_show_questions_as_html' ] = isset($survey_options[ 'survey_show_questions_as_html' ]) ? $survey_options[ 'survey_show_questions_as_html' ] : 'on';
4426 $survey_show_questions_as_html = $survey_options[ 'survey_show_questions_as_html' ] == 'on' ? true : false;
4427
4428 // Get user info
4429 $individual_user_name = "";
4430 $individual_user_email = "";
4431 $individual_user_ip = "";
4432 $individual_user_date = "";
4433 $individual_user_sub_id = "";
4434 $individual_user_password = "";
4435 $dashboard_admin_note = "";
4436 $individual_user_device_type = "";
4437 if( isset($ays_survey_individual_questions['user_info']) && is_array( $ays_survey_individual_questions['user_info']) ){
4438 $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'] ) : "";
4439 $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'] ) ) : "";
4440 $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'] ) ) : "";
4441 $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'] ) ) : "";
4442 $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'] ) ) : "";
4443 $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'] ) ) : "";
4444 $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();
4445 $individual_user_device_type = isset($individual_user_extra_data['device']) && $individual_user_extra_data['device'] != '' ? esc_attr($individual_user_extra_data['device']) : '';
4446 $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'] ) ) : "";
4447 }
4448
4449 $text_types = array(
4450 'text',
4451 'short_text',
4452 'number',
4453 'phone',
4454 'name',
4455 'hidden',
4456 'email',
4457 'date',
4458 'time',
4459 'date_time',
4460 );
4461
4462 $submissions_count = 0;
4463 if(intval($submission_count_and_ids['submission_count']) > 0){
4464 $submissions_count = $submission_count_and_ids['submission_count'];
4465 }
4466
4467 $export_disabled = 'disabled';
4468 if( $submissions_count > 0 ){
4469 $export_disabled = '';
4470 }
4471
4472 $survey_data_clipboard = array(
4473 "user_name" => $individual_user_name,
4474 "user_email" => $individual_user_email,
4475 "user_ip" => $individual_user_ip,
4476 "user_date" => $individual_user_date,
4477 "user_sub_id" => $individual_user_sub_id,
4478 "user_device_type" => $individual_user_device_type,
4479 );
4480
4481 if($individual_user_password){
4482 $survey_data_clipboard['user_password'] = $individual_user_password;
4483 }
4484
4485 $survey_data_formated_for_clipboard = Survey_Maker_Data::ays_survey_copy_text_formater($survey_data_clipboard);
4486
4487
4488 Survey_Maker_Data::get_template_part( 'partials/submissions/partials/survey-maker-each-submission-individual', '', get_defined_vars() );
4489
4490 $wpdb->get_var("UPDATE " . $wpdb->prefix . SURVEY_MAKER_DB_PREFIX . "submissions SET `read`= 1 WHERE `id`= $submission_id");
4491
4492 $html = ob_get_clean();
4493
4494 echo json_encode( array(
4495 'status' => true,
4496 'rows' => $html
4497 ) );
4498 wp_die();
4499 }
4500
4501 echo json_encode( array(
4502 'status' => false,
4503 'rows' => ""
4504 ) );
4505
4506 }
4507
4508 public function ays_survey_author_user_search() {
4509 $content_text = array(
4510 'results' => array()
4511 );
4512
4513 if( current_user_can( 'manage_options' ) ){
4514 $search = isset($_REQUEST['search']) && $_REQUEST['search'] != '' ? sanitize_text_field( $_REQUEST['search'] ) : null;
4515 $checked = isset($_REQUEST['val']) && $_REQUEST['val'] !='' ? sanitize_text_field( $_REQUEST['val'] ) : null;
4516
4517 $args = 'search=';
4518 if($search !== null){
4519 $args .= '*';
4520 $args .= $search;
4521 $args .= '*';
4522 }
4523
4524 $users = get_users($args);
4525
4526 foreach ($users as $key => $value) {
4527 if ($checked !== null) {
4528 if ( !is_array( $checked ) ) {
4529 $checked2 = $checked;
4530 $checked = array();
4531 $checked[] = absint($checked2);
4532 }
4533 if (in_array($value->ID, $checked)) {
4534 continue;
4535 }else{
4536 $content_text['results'][] = array(
4537 'id' => $value->ID,
4538 'text' => $value->data->display_name,
4539 );
4540 }
4541 }else{
4542 $content_text['results'][] = array(
4543 'id' => $value->ID,
4544 'text' => $value->data->display_name,
4545 );
4546 }
4547 }
4548 }
4549
4550 ob_end_clean();
4551 echo json_encode($content_text);
4552 wp_die();
4553 }
4554
4555 // public function ays_survey_subscribe_email(){
4556 // $subscribe_email = isset($_REQUEST['email']) && $_REQUEST['email'] != "" ? sanitize_email($_REQUEST['email']) : "";
4557 // $subscribe_website = isset($_REQUEST['website']) && $_REQUEST['website'] != "" ? sanitize_url($_REQUEST['website']) : "";
4558 // // $url = "http://localhost/survey-grab-gift/";
4559 // $url = "https://ays-pro.com/add-on-email/survey-grab-gift/";
4560 // if($subscribe_email != "" && $subscribe_website != ''){
4561 // $current_date = date("Y-m-d");
4562 // $current_user_ip = Survey_Maker_Data::get_user_ip();
4563 // $send_request = wp_remote_post($url, array(
4564 // 'headers' => array("Content-Type: application/json; charset=UTF-8"),
4565 // 'body' => json_encode( array(
4566 // "email" => $subscribe_email,
4567 // "website" => $subscribe_website,
4568 // "user_ip" => $current_user_ip,
4569 // "subscirbe_date" => $current_date
4570 // ) ),
4571 // ) );
4572 // $response = wp_remote_retrieve_body($send_request);
4573 // $response = json_decode($response, true);
4574 // if(isset($response) && is_array($response)){
4575 // $response_code = isset($response['code']) && $response['code'] != "" ? $response['code'] : "";
4576 // $response_message = isset($response['msg']) && $response['msg'] != "" ? $response['msg'] : "";
4577 // $response_status = $response_code > 0 ? true : false;
4578 // echo json_encode(array(
4579 // "status" => $response_code,
4580 // "message" => $response_message
4581 // ));
4582 // wp_die();
4583 // }
4584 // else{
4585 // echo json_encode(array(
4586 // "status" => false,
4587 // "message" => "Something went wrong. Please try again"
4588 // ));
4589 // wp_die();
4590 // }
4591 // }
4592 // }
4593
4594 /**
4595 * Check if plugin can be installed
4596 */
4597 public function ays_survey_can_install($plugin_slug) {
4598 if (!function_exists('get_plugins')) {
4599 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4600 }
4601
4602 $plugins = get_plugins();
4603 foreach ($plugins as $plugin_file => $plugin_data) {
4604 if (strpos($plugin_file, $plugin_slug) !== false) {
4605 return false; // Plugin already exists
4606 }
4607 }
4608 return true; // Plugin can be installed
4609 }
4610
4611 /**
4612 * Check if plugin can be activated
4613 */
4614 public function ays_survey_can_activate($plugin_slug) {
4615 if (!function_exists('get_plugins')) {
4616 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4617 }
4618
4619 $plugins = get_plugins();
4620 foreach ($plugins as $plugin_file => $plugin_data) {
4621 if (strpos($plugin_file, $plugin_slug) !== false) {
4622 return !is_plugin_active($plugin_file); // Can activate if not already active
4623 }
4624 }
4625 return false; // Plugin doesn't exist
4626 }
4627
4628 /**
4629 * Install plugin via AJAX
4630 */
4631 public function ays_survey_install_plugin() {
4632 if (!current_user_can('install_plugins')) {
4633 wp_die(json_encode(array('success' => false, 'message' => 'Insufficient permissions')));
4634 }
4635
4636 if (!wp_verify_nonce($_POST['nonce'], 'ajax-nonce')) {
4637 wp_die(json_encode(array('success' => false, 'message' => 'Security check failed')));
4638 }
4639
4640 $plugin_slug = sanitize_text_field($_POST['plugin_slug']);
4641
4642 if (!function_exists('plugins_api')) {
4643 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
4644 }
4645 if (!class_exists('WP_Upgrader')) {
4646 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
4647 }
4648
4649 $api = plugins_api('plugin_information', array('slug' => $plugin_slug));
4650
4651 if (is_wp_error($api)) {
4652 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Plugin not found'))));
4653 }
4654
4655 $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
4656 $result = $upgrader->install($api->download_link);
4657
4658 if ($result) {
4659 // Load plugin.php for get_plugins() and activate_plugin() if not loaded yet
4660 if ( ! function_exists( 'get_plugins' ) ) {
4661 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4662 }
4663
4664 // Clear plugins cache to ensure the newly installed plugin is visible
4665 if ( function_exists( 'wp_clean_plugins_cache' ) ) {
4666 wp_clean_plugins_cache();
4667 }
4668
4669 $plugins = get_plugins();
4670 $plugin_file = '';
4671
4672 foreach ( $plugins as $file => $plugin_data ) {
4673 if ( strpos( $file, $plugin_slug ) !== false ) {
4674 $plugin_file = $file;
4675 break;
4676 }
4677 }
4678
4679 if ( empty( $plugin_file ) ) {
4680 wp_die( json_encode( array( 'success' => false, 'message' => esc_html__('Plugin main file not found')) ) );
4681 }
4682
4683 // Ensure activate_plugin() is available
4684 if ( ! function_exists( 'activate_plugin' ) ) {
4685 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4686 }
4687
4688 $activate = activate_plugin( $plugin_file );
4689
4690 if ( is_wp_error( $activate ) ) {
4691 wp_die( json_encode( array( 'success' => false, 'message' => $activate->get_error_message() ) ) );
4692 }
4693
4694 wp_die( json_encode( array( 'success' => true, 'message' => esc_html__('Plugin installed and activated successfully')) ) );
4695
4696 } else {
4697 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Installation failed'))));
4698 }
4699 }
4700
4701 /**
4702 * Activate plugin via AJAX
4703 */
4704 public function ays_survey_activate_plugin() {
4705 if (!current_user_can('activate_plugins')) {
4706 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Insufficient permissions'))));
4707 }
4708
4709 if (!wp_verify_nonce($_POST['nonce'], 'ajax-nonce')) {
4710 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Security check failed'))));
4711 }
4712
4713 $plugin_slug = sanitize_text_field($_POST['plugin_slug']);
4714
4715 if (!function_exists('get_plugins')) {
4716 require_once ABSPATH . 'wp-admin/includes/plugin.php';
4717 }
4718
4719 $plugins = get_plugins();
4720 $plugin_file = '';
4721
4722 foreach ($plugins as $file => $plugin_data) {
4723 if (strpos($file, $plugin_slug) !== false) {
4724 $plugin_file = $file;
4725 break;
4726 }
4727 }
4728
4729 if (empty($plugin_file)) {
4730 wp_die(json_encode(array('success' => false, 'message' => esc_html__('Plugin not found'))));
4731 }
4732
4733 $result = activate_plugin($plugin_file);
4734
4735 if (is_wp_error($result)) {
4736 wp_die(json_encode(array('success' => false, 'message' => $result->get_error_message())));
4737 } else {
4738 wp_die(json_encode(array('success' => true, 'message' => esc_html__('Plugin activated successfully'))));
4739 }
4740 }
4741
4742 /**
4743 * Get AYS plugins data
4744 */
4745 public function get_am_plugins() {
4746 return array(
4747 'quiz-maker' => array(
4748 'name' => 'Quiz Maker',
4749 'slug' => 'quiz-maker',
4750 'description' => 'Create engaging quizzes with multiple question types'
4751 ),
4752 'poll-maker' => array(
4753 'name' => 'Poll Maker',
4754 'slug' => 'poll-maker',
4755 'description' => 'Build interactive polls for your audience'
4756 ),
4757 'popup-box' => array(
4758 'name' => 'Popup Box',
4759 'slug' => 'ays-popup-box',
4760 'description' => 'Create beautiful popups and modals'
4761 ),
4762 'gallery-photo-gallery' => array(
4763 'name' => 'Gallery Photo Gallery',
4764 'slug' => 'gallery-photo-gallery',
4765 'description' => 'Showcase your photos in stunning galleries'
4766 ),
4767 'secure-copy-content-protection' => array(
4768 'name' => 'Secure Copy Content Protection',
4769 'slug' => 'secure-copy-content-protection',
4770 'description' => 'Protect your content from copying'
4771 ),
4772 'ays-chatgpt-assistant' => array(
4773 'name' => 'ChatGPT Assistant',
4774 'slug' => 'ays-chatgpt-assistant',
4775 'description' => 'AI-powered chat assistant for your website'
4776 ),
4777 'personal-dictionary' => array(
4778 'name' => 'Personal Dictionary',
4779 'slug' => 'personal-dictionary',
4780 'description' => 'Create and manage custom dictionaries'
4781 ),
4782 'chartify' => array(
4783 'name' => 'Chartify',
4784 'slug' => 'chart-builder',
4785 'description' => 'Build beautiful charts and graphs'
4786 )
4787 );
4788 }
4789
4790 public function ays_survey_disable_all_notice_from_plugin() {
4791 if (!function_exists('get_current_screen')) {
4792 return;
4793 }
4794
4795 $screen = get_current_screen();
4796
4797 if (empty($screen) || strpos($screen->id, $this->plugin_name) === false) {
4798 return;
4799 }
4800
4801 global $wp_filter;
4802
4803 // Keep plugin-specific notices
4804 $our_plugin_notices = array();
4805
4806 $exclude_functions = [
4807 'survey_maker_general_admin_notice',
4808 ];
4809
4810 if (!empty($wp_filter['admin_notices'])) {
4811 foreach ($wp_filter['admin_notices']->callbacks as $priority => $callbacks) {
4812 foreach ($callbacks as $key => $callback) {
4813 // For class-based methods
4814 if (
4815 is_array($callback['function']) &&
4816 is_object($callback['function'][0]) &&
4817 get_class($callback['function'][0]) === __CLASS__
4818 ) {
4819 $our_plugin_notices[$priority][$key] = $callback;
4820 }
4821 // For standalone functions
4822 elseif (
4823 is_string($callback['function']) &&
4824 in_array($callback['function'], $exclude_functions)
4825 ) {
4826 $our_plugin_notices[$priority][$key] = $callback;
4827 }
4828 }
4829 }
4830 }
4831
4832 // Remove all notices
4833 remove_all_actions('admin_notices');
4834 remove_all_actions('all_admin_notices');
4835
4836 // Re-add only your plugin's notices
4837 foreach ($our_plugin_notices as $priority => $callbacks) {
4838 foreach ($callbacks as $callback) {
4839 add_action('admin_notices', $callback['function'], $priority);
4840 }
4841 }
4842 }
4843
4844 public function ays_survey_black_friady_popup_box(){
4845 if(!empty($_REQUEST['page']) && sanitize_text_field( $_REQUEST['page'] ) != $this->plugin_name . "-admin-dashboard"){
4846 if(false !== strpos( sanitize_text_field( $_REQUEST['page'] ), $this->plugin_name)){
4847
4848 $flag = true;
4849
4850 if( isset($_COOKIE['aysSurveyBlackFridayPopupCount']) && intval($_COOKIE['aysSurveyBlackFridayPopupCount']) >= 2 ){
4851 $flag = false;
4852 }
4853
4854 $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);
4855
4856 if( $flag ){
4857 ?>
4858 <div class="ays-survey-black-friday-popup-overlay" style="opacity: 0; visibility: hidden; display: none;">
4859 <div class="ays-survey-black-friday-popup-dialog">
4860 <div class="ays-survey-black-friday-popup-content">
4861 <div class="ays-survey-black-friday-popup-background-pattern">
4862 <div class="ays-survey-black-friday-popup-pattern-row">
4863 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4864 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4865 </div>
4866 <div class="ays-survey-black-friday-popup-pattern-row">
4867 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4868 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4869 </div>
4870 <div class="ays-survey-black-friday-popup-pattern-row">
4871 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4872 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4873 </div>
4874 <div class="ays-survey-black-friday-popup-pattern-row">
4875 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4876 <div class="ays-survey-black-friday-popup-pattern-text">SALE SALE SALE</div>
4877 </div>
4878 </div>
4879
4880 <button class="ays-survey-black-friday-popup-close" aria-label="Close">
4881 <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">
4882 <path d="M18 6 6 18"></path>
4883 <path d="m6 6 12 12"></path>
4884 </svg>
4885 </button>
4886
4887 <div class="ays-survey-black-friday-popup-badge">
4888 <div class="ays-survey-black-friday-popup-badge-content">
4889 <div class="ays-survey-black-friday-popup-badge-text-sm"><?php echo esc_html__( 'Up to', 'survey-maker' ); ?></div>
4890 <div class="ays-survey-black-friday-popup-badge-text-lg">50%</div>
4891 <div class="ays-survey-black-friday-popup-badge-text-md"><?php echo esc_html__( 'OFF', 'survey-maker' ); ?></div>
4892 </div>
4893 </div>
4894
4895 <div class="ays-survey-black-friday-popup-main-content">
4896 <div class="ays-survey-black-friday-popup-hashtag"><?php echo esc_html__( '#BLACKFRIDAY', 'survey-maker' ); ?></div>
4897 <h1 class="ays-survey-black-friday-popup-title-mega"><?php echo esc_html__( 'MEGA', 'survey-maker' ); ?></h1>
4898 <h1 class="ays-survey-black-friday-popup-title-bundle"><?php echo esc_html__( 'BUNDLE', 'survey-maker' ); ?></h1>
4899 <div class="ays-survey-black-friday-popup-offer-label">
4900 <h2 class="ays-survey-black-friday-popup-offer-text"><?php echo esc_html__( 'BLACK FRIDAY OFFER', 'survey-maker' ); ?></h2>
4901 </div>
4902 <p class="ays-survey-black-friday-popup-description"><?php echo esc_html__( 'Get our exclusive plugins in one bundle', 'survey-maker' ); ?></p>
4903 <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>
4904 </div>
4905 </div>
4906 </div>
4907 </div>
4908 <script type="text/javascript">
4909 (function() {
4910 var overlay = document.querySelector('.ays-survey-black-friday-popup-overlay');
4911 var closeBtn = document.querySelector('.ays-survey-black-friday-popup-close');
4912 var learnMoreBtn = document.querySelector('.ays-survey-black-friday-popup-learn-more');
4913 var ctaBtn = document.querySelector('.ays-survey-black-friday-popup-cta-btn');
4914
4915 // Cookie helper functions
4916 function setCookie(name, value, days) {
4917 var expires = "";
4918 if (days) {
4919 var date = new Date();
4920 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
4921 expires = "; expires=" + date.toUTCString();
4922 }
4923 document.cookie = name + "=" + (value || "") + expires + "; path=/";
4924 }
4925
4926 function getCookie(name) {
4927 var nameEQ = name + "=";
4928 var ca = document.cookie.split(';');
4929 for (var i = 0; i < ca.length; i++) {
4930 var c = ca[i];
4931 while (c.charAt(0) == ' ') c = c.substring(1, c.length);
4932 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
4933 }
4934 return null;
4935 }
4936
4937 // Get current show count from cookie
4938 var showCount = parseInt(getCookie('aysSurveyBlackFridayPopupCount') || '0', 10);
4939 var maxShows = 2;
4940
4941 // Show popup function
4942 function showPopup() {
4943 if (overlay && showCount < maxShows) {
4944 overlay.classList.add('ays-survey-black-friday-popup-active');
4945 showCount++;
4946 // Update cookie with new count (expires in 30 days)
4947 setCookie('aysSurveyBlackFridayPopupCount', showCount.toString(), 30);
4948 }
4949 }
4950
4951 // Close popup function
4952 function closePopup(e) {
4953 if (e) {
4954 e.preventDefault();
4955 e.stopPropagation();
4956 }
4957 if (overlay) {
4958 overlay.classList.remove('ays-survey-black-friday-popup-active');
4959 }
4960 }
4961
4962 // Determine timing based on show count
4963 if (showCount === 0) {
4964 // First time - show after 30 seconds
4965 setTimeout(function() {
4966 showPopup();
4967 }, 30000);
4968 } else if (showCount === 1) {
4969 // Second time - show after 200 seconds
4970 setTimeout(function() {
4971 showPopup();
4972 }, 200000);
4973 }
4974 // If showCount >= 2, don't show popup at all
4975
4976 // Close button
4977 if (closeBtn) {
4978 closeBtn.addEventListener('click', function(e) {
4979 closePopup(e);
4980 });
4981 }
4982
4983 // Learn more button
4984 if (learnMoreBtn) {
4985 learnMoreBtn.addEventListener('click', function(e) {
4986 closePopup(e);
4987 });
4988 }
4989
4990 // CTA button (optional - if you want it to close popup too)
4991 if (ctaBtn) {
4992 ctaBtn.addEventListener('click', function(e) {
4993 // You can add redirect logic here if needed
4994 // window.location.href = 'your-url';
4995 });
4996 }
4997
4998 // Close on overlay click
4999 if (overlay) {
5000 overlay.addEventListener('click', function(e) {
5001 if (e.target === overlay) {
5002 closePopup(e);
5003 }
5004 });
5005 }
5006
5007 // Close on Escape key
5008 document.addEventListener('keydown', function(e) {
5009 if (e.key === 'Escape' && overlay && overlay.classList.contains('ays-survey-black-friday-popup-active')) {
5010 closePopup();
5011 }
5012 });
5013 })();
5014 </script>
5015 <style>
5016 .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}}
5017 </style>
5018 <?php
5019 }
5020 }
5021 }
5022 }
5023 }
5024