PluginProbe
Survey Maker by AYS / 5.2.3.2
Survey Maker by AYS v5.2.3.2
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.3.2, at admin/class-survey-maker-admin.php

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