PluginProbe
Survey Maker by AYS / 5.2.3.6
Survey Maker by AYS v5.2.3.6
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.6, at admin/class-survey-maker-admin.php

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