PluginProbe
Survey Maker by AYS / 5.2.4.1
Survey Maker by AYS v5.2.4.1
5.2.4.1 5.2.4.0 5.2.3.9 5.2.3.8 5.2.3.7 5.2.3.6 5.2.3.5 5.2.3.4 5.2.3.3 5.2.3.2 5.2.3.1 5.2.3.0 5.2.2.9 5.2.2.8 5.2.2.7 5.2.2.6 5.2.2.5 5.2.2.4 5.2.2.3 5.2.2.2 5.2.2.1 5.2.2.0 5.2.1.9 5.2.1.8 5.2.0.8 All 154 releases
← All changes | public/class-survey-maker-public.php +558 -134 5.2.0.8 → 5.2.4.1 View file →
@@ -133,8 +133,9 @@
133 133
134 134 wp_localize_script( $this->plugin_name . '-plugin', 'aysSurveyMakerAjaxPublic', array(
135 135 'ajaxUrl' => admin_url('admin-ajax.php'),
136 136 'warningIcon' => SURVEY_MAKER_PUBLIC_URL . "/images/warning.svg",
137 + 'ajaxNonce' => wp_create_nonce( 'ays_survey_ajax_nonce' ),
137 138 'autofill_nonce' => wp_create_nonce('survey_maker_autofill_nonce')
138 139 ) );
139 140 wp_localize_script( $this->plugin_name, 'aysSurveyLangObj', array(
140 141 'notAnsweredText' => __( 'You have not answered this question', "survey-maker" ),
@@ -159,8 +160,9 @@
159 160 public function enqueue_scripts_popups() {
160 161 wp_enqueue_script( $this->plugin_name . '-popups', plugin_dir_url( __FILE__ ) . 'js/survey-maker-public-popups.js', array( 'jquery' ), $this->version, false );
161 162 wp_localize_script( $this->plugin_name . '-popups', 'aysSurveyMakerPopupsAjaxPublic', array(
162 163 'ajaxUrl' => admin_url('admin-ajax.php'),
164 + 'ajaxNonce' => wp_create_nonce( 'ays_survey_ajax_nonce' ),
163 165 ) );
164 166 }
165 167
166 168 public function ays_survey_ajax(){
@@ -165,8 +167,14 @@
165 167
166 168 public function ays_survey_ajax(){
167 169 global $wpdb;
168 170
171 + if ( 'POST' !== strtoupper( isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : '' ) ) {
172 + wp_send_json_error( array( 'message' => __( 'Invalid request method.', 'survey-maker' ) ), 405 );
173 + }
174 +
175 + check_ajax_referer( 'ays_survey_ajax_nonce', '_ajax_nonce' );
176 +
169 177 $results = array(
170 178 "status" => false
171 179 );
172 180 $function = isset($_REQUEST['function']) ? $_REQUEST['function'] : null;
@@ -188,16 +196,14 @@
188 196 }
189 197
190 198 ob_end_clean();
191 199 $ob_get_clean = ob_get_clean();
192 - echo json_encode( $results );
193 - wp_die();
200 + wp_send_json( $results );
194 201 }
195 202
196 203 ob_end_clean();
197 204 $ob_get_clean = ob_get_clean();
198 - echo json_encode( $results );
199 - wp_die();
205 + wp_send_json( $results );
200 206 }
201 207
202 208 public function ays_finish_survey( $data ){
203 209 $unique_id = isset($data['unique_id']) ? $data['unique_id'] : null;
@@ -223,14 +229,25 @@
223 229
224 230 $answered_questions = isset( $data[ $name_prefix . 'answers-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'answers-' . $unique_id ] ) ? $data[ $name_prefix . 'answers-' . $unique_id ] : array();
225 231 $questions_data = isset( $data[ $name_prefix . 'questions-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'questions-' . $unique_id ] ) ? $data[ $name_prefix . 'questions-' . $unique_id ] : array();
226 232
227 - $survey_additional_wp_data = isset($data[ $valid_name_prefix . 'additional_wp_data' ]) && $data[ $valid_name_prefix . 'additional_wp_data' ] != '' ? json_decode(base64_decode($data[ $valid_name_prefix . 'additional_wp_data' ]) , true) : array();
233 + $survey_additional_wp_data = array();
234 + if ( isset( $data[ $valid_name_prefix . 'additional_wp_data' ] ) && is_string( $data[ $valid_name_prefix . 'additional_wp_data' ] ) && '' !== $data[ $valid_name_prefix . 'additional_wp_data' ] ) {
235 + $decoded_additional_wp_data = base64_decode( wp_unslash( $data[ $valid_name_prefix . 'additional_wp_data' ] ), true );
236 + if ( false !== $decoded_additional_wp_data ) {
237 + $decoded_additional_wp_data = json_decode( $decoded_additional_wp_data, true );
238 + if ( is_array( $decoded_additional_wp_data ) ) {
239 + $survey_additional_wp_data = $decoded_additional_wp_data;
240 + }
241 + }
242 + }
228 243
229 - $survey_current_page_link = isset( $data['ays_'.$valid_name_prefix.'_current_page_link'] ) && $data['ays_'.$valid_name_prefix.'_current_page_link'] != '' ? sanitize_url( $data['ays_'.$valid_name_prefix.'_current_page_link'] ) : "";
244 + $survey_current_page_link = isset( $data['ays-survey-current_page_link'] ) && $data['ays-survey-current_page_link'] != '' ? sanitize_url( $data['ays-survey-current_page_link'] ) : "";
230 245
231 - $survey_current_page_link_html = "<a href='". esc_sql( $survey_current_page_link ) ."' target='_blank' class='ays-survey-current-page-link-a-tag'>". __( "Survey link", "survey-maker" ) ."</a>";
246 + $survey_current_page_title = isset( $data['ays-survey-current_page_title'] ) && $data['ays-survey-current_page_title'] != '' ? sanitize_text_field( $data['ays-survey-current_page_title'] ) : "";
232 247
248 + $survey_current_page_link_html = "<a href='". esc_sql( $survey_current_page_link ) ."' target='_blank' class='ays-survey-current-page-link-a-tag'>". __( "Survey link", "survey-maker" ) ."</a>";
249 +
233 250 // Survey modified date
234 251 $survey_modified_date = (isset($survey->date_modified) && $survey->date_modified != '') ? esc_attr( $survey->date_modified ) : "";
235 252 if( $survey_modified_date != "" ){
236 253 $survey_modified_date = date_i18n( get_option( 'date_format' ), strtotime( $survey_modified_date ) );
@@ -251,8 +268,9 @@
251 268 }else{
252 269 $user_email = '';
253 270 }
254 271 }
272 + $user_email = is_scalar( $user_email ) ? sanitize_email( $user_email ) : '';
255 273
256 274 $user_name = '';
257 275 if( isset( $data[ $name_prefix . 'user-name-' . $unique_id ] ) && !empty( $data[ $name_prefix . 'user-name-' . $unique_id ] ) ){
258 276 if( is_array( $data[ $name_prefix . 'user-name-' . $unique_id ] ) ){
@@ -268,8 +286,9 @@
268 286 }else{
269 287 $user_name = '';
270 288 }
271 289 }
290 + $user_name = is_scalar( $user_name ) ? sanitize_text_field( $user_name ) : '';
272 291
273 292 $result_unique_code = strtoupper( uniqid() );
274 293
275 294 $setting_options = Survey_Maker_Data::get_setting_data( 'options' );
@@ -323,8 +342,22 @@
323 342
324 343 // User Wordpress role
325 344 $user_wordpress_roles = (isset( $survey_user_information['user_wordpress_roles'] ) && $survey_user_information['user_wordpress_roles'] != "") ? $survey_user_information['user_wordpress_roles'] : '';
326 345
346 + // User Website URL
347 + $user_website_url = (isset( $survey_user_information['user_website_url'] ) && $survey_user_information['user_website_url'] != "") ? $survey_user_information['user_website_url'] : '';
348 +
349 + if ( ! empty( $user_website_url ) ) {
350 + $user_website_url = '<a href="'. $user_website_url .'" target="_blank">'. $user_website_url .'</a>';
351 + }
352 +
353 + // User Registered
354 + $user_data = wp_get_current_user();
355 + $user_registered = '';
356 + if ( is_user_logged_in() ) {
357 + $user_registered = $user_data->user_registered;
358 + }
359 +
327 360 // User ip address
328 361 $user_ip_address = (isset( $survey_user_information['user_ip_address'] ) && $survey_user_information['user_ip_address'] != "") ? $survey_user_information['user_ip_address'] : '';
329 362
330 363 // User wordpress email
@@ -350,15 +383,31 @@
350 383 // Get survey author
351 384 $current_survey_user_data = get_userdata( $survey->author_id );
352 385 $current_survey_author = '';
353 386 $current_survey_author_email = '';
387 + $current_survey_author_nickname = '';
388 + $current_survey_author_display_name = '';
389 + $current_survey_author_website_url = '';
390 + $current_survey_author_registered = '';
354 391 if ( isset( $current_survey_user_data ) && $current_survey_user_data ) {
355 392 // Get survey author name
356 393 $current_survey_author = ( isset( $current_survey_user_data->data->display_name ) && $current_survey_user_data->data->display_name != '' ) ? sanitize_text_field( $current_survey_user_data->data->display_name ) : "";
357 394 // Get survey author email
358 395 $current_survey_author_email = ( isset( $current_survey_user_data->data->user_email ) && $current_survey_user_data->data->user_email != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_email ) : "";
396 + // Get survey author nickname
397 + $current_survey_author_nickname = ( isset( $current_survey_user_data->data->user_nicename ) && $current_survey_user_data->data->user_nicename != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_nicename ) : "";
398 + // Get survey author display name
399 + $current_survey_author_display_name = ( isset( $current_survey_user_data->data->display_name ) && $current_survey_user_data->data->display_name != '' ) ? sanitize_text_field( $current_survey_user_data->data->display_name ) : "";
400 + // Get survey author Website URL
401 + $current_survey_author_website_url = ( isset( $current_survey_user_data->data->user_url ) && $current_survey_user_data->data->user_url != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_url ) : "";
402 + // Get survey author Website URL
403 + $current_survey_author_registered = ( isset( $current_survey_user_data->data->user_registered ) && $current_survey_user_data->data->user_registered != '' ) ? sanitize_text_field( $current_survey_user_data->data->user_registered ) : "";
359 404 }
360 405
406 + if ( ! empty( $current_survey_author_website_url ) ) {
407 + $current_survey_author_website_url = '<a href="'. $current_survey_author_website_url .'" target="_blank">'. $current_survey_author_website_url .'</a>';
408 + }
409 +
361 410 $super_admin_email = "";
362 411 $wp_all_admins = get_users('role=Administrator');
363 412 if(!empty($wp_all_admins)){
364 413 $super_admin_email = isset($wp_all_admins[0]) ? $wp_all_admins[0]->data->user_email : '';
@@ -369,79 +418,124 @@
369 418 $survey_current_post_author_nickname = '';
370 419 $survey_current_post_author_display_name = '';
371 420 $survey_current_post_author_first_name = '';
372 421 $survey_current_post_author_last_name = '';
422 + $survey_current_post_author_website_url = '';
423 + $survey_current_post_author_roles = '';
373 424 $survey_current_post_title = '';
374 - if(!empty($survey_additional_wp_data)){
375 - if(isset($survey_additional_wp_data['survey_post_type']) && $survey_additional_wp_data['survey_post_type'] == 'post'){
376 - $survey_current_post_id = isset($survey_additional_wp_data['survey_post_id']) && $survey_additional_wp_data['survey_post_id'] != '' ? $survey_additional_wp_data['survey_post_id'] : '';
425 + if ( ! empty( $survey_additional_wp_data ) ) {
426 + $sanitize_additional_text = static function( $value ) {
427 + return is_scalar( $value ) ? esc_html( sanitize_text_field( wp_unslash( (string) $value ) ) ) : '';
428 + };
429 +
430 + $survey_post_type = isset( $survey_additional_wp_data['survey_post_type'] ) && is_scalar( $survey_additional_wp_data['survey_post_type'] ) ? sanitize_key( wp_unslash( (string) $survey_additional_wp_data['survey_post_type'] ) ) : '';
431 + if ( 'post' === $survey_post_type ) {
432 + $survey_current_post_id = isset( $survey_additional_wp_data['survey_post_id'] ) && is_scalar( $survey_additional_wp_data['survey_post_id'] ) ? absint( $survey_additional_wp_data['survey_post_id'] ) : '';
377 433 }
378 434
379 - $survey_current_post_author_email = isset($survey_additional_wp_data['survey_post_author_email']) && $survey_additional_wp_data['survey_post_author_email'] != '' ? esc_attr($survey_additional_wp_data['survey_post_author_email']) : '';
380 - $survey_current_post_author_nickname = isset($survey_additional_wp_data['survey_current_post_author_nickname']) && $survey_additional_wp_data['survey_current_post_author_nickname'] != '' ? esc_attr($survey_additional_wp_data['survey_current_post_author_nickname']) : '';
381 - $survey_current_post_author_display_name = isset($survey_additional_wp_data['survey_current_post_author_display_name']) && $survey_additional_wp_data['survey_current_post_author_display_name'] != '' ? esc_attr($survey_additional_wp_data['survey_current_post_author_display_name']) : '';
382 - $survey_current_post_author_first_name = isset($survey_additional_wp_data['survey_current_post_author_first_name']) && $survey_additional_wp_data['survey_current_post_author_first_name'] != '' ? esc_attr($survey_additional_wp_data['survey_current_post_author_first_name']) : '';
383 - $survey_current_post_author_last_name = isset($survey_additional_wp_data['survey_current_post_author_last_name']) && $survey_additional_wp_data['survey_current_post_author_last_name'] != '' ? esc_attr($survey_additional_wp_data['survey_current_post_author_last_name']) : '';
384 - $survey_current_post_title = isset($survey_additional_wp_data['survey_current_post_title']) && $survey_additional_wp_data['survey_current_post_title'] != '' ? esc_attr($survey_additional_wp_data['survey_current_post_title']) : '';
435 + $survey_current_post_author_email = isset( $survey_additional_wp_data['survey_post_author_email'] ) && is_scalar( $survey_additional_wp_data['survey_post_author_email'] ) ? esc_html( sanitize_email( wp_unslash( (string) $survey_additional_wp_data['survey_post_author_email'] ) ) ) : '';
436 + $survey_current_post_author_nickname = isset( $survey_additional_wp_data['survey_current_post_author_nickname'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_nickname'] ) : '';
437 + $survey_current_post_author_display_name = isset( $survey_additional_wp_data['survey_current_post_author_display_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_display_name'] ) : '';
438 + $survey_current_post_author_first_name = isset( $survey_additional_wp_data['survey_current_post_author_first_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_first_name'] ) : '';
439 + $survey_current_post_author_last_name = isset( $survey_additional_wp_data['survey_current_post_author_last_name'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_author_last_name'] ) : '';
440 + $survey_current_post_author_website_url = isset( $survey_additional_wp_data['survey_current_post_author_website_url'] ) && is_scalar( $survey_additional_wp_data['survey_current_post_author_website_url'] ) ? esc_url_raw( wp_unslash( (string) $survey_additional_wp_data['survey_current_post_author_website_url'] ) ) : '';
441 + $survey_current_post_author_roles = isset( $survey_additional_wp_data['survey_current_post_author_roles'] ) ? $survey_additional_wp_data['survey_current_post_author_roles'] : '';
442 + $survey_current_post_title = isset( $survey_additional_wp_data['survey_current_post_title'] ) ? $sanitize_additional_text( $survey_additional_wp_data['survey_current_post_title'] ) : '';
385 443 }
386 444
445 + if ( ! empty( $survey_current_post_author_website_url ) ) {
446 + $survey_current_post_author_website_url = '<a href="' . esc_url( $survey_current_post_author_website_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $survey_current_post_author_website_url ) . '</a>';
447 + }
448 +
449 + if ( is_array( $survey_current_post_author_roles ) ) {
450 + $survey_current_post_author_roles = array_filter( $survey_current_post_author_roles, 'is_scalar' );
451 + $survey_current_post_author_roles = array_map( static function( $role ) {
452 + return sanitize_text_field( wp_unslash( (string) $role ) );
453 + }, $survey_current_post_author_roles );
454 + $survey_current_post_author_roles = implode( ', ', $survey_current_post_author_roles );
455 + }
456 + $survey_current_post_author_roles = is_scalar( $survey_current_post_author_roles ) ? esc_html( sanitize_text_field( wp_unslash( (string) $survey_current_post_author_roles ) ) ) : '';
457 +
387 458 $get_site_title = get_bloginfo('name');
388 459 $get_site_description = get_bloginfo('description');
389 460
461 + // Survey category title
462 + $survey_category_title = "";
463 +
464 + $survey_cats = $survey->category_ids;
465 + $survey_category_ids = isset( $survey_cats ) && $survey_cats != "" ? sanitize_text_field( $survey_cats ) : '';
466 +
467 + if ( $survey_category_ids != '' ) {
468 + $categories = self::get_survey_category_by_ids($survey_category_ids);
469 + $category_names = wp_list_pluck( $categories, 'title' );
470 +
471 + $survey_category_title = implode( ', ', $category_names );
472 + }
473 +
390 474 $detectedDevice = Survey_Maker_Data::ays_survey_detected_device_chart();
391 475
392 476 $message_data = array(
393 - 'survey_title' => stripslashes($survey->title),
394 - 'survey_id' => stripslashes($survey->id),
395 - 'post_id' => $survey_current_post_id,
396 - 'user_name' => $user_name,
397 - 'user_email' => $user_email,
398 - 'user_wordpress_email' => $user_wordpress_email,
399 - 'user_id' => $user_id,
400 - 'questions_count' => $survey_question_count,
401 - 'current_date' => $survey_current_date,
402 - 'current_time' => $survey_current_time_only,
403 - 'current_day' => $survey_current_day,
404 - 'current_month' => $survey_current_month,
405 - 'unique_code' => $result_unique_code,
406 - 'sections_count' => $survey_sections_count,
407 - 'users_count' => $survey_passed_users_count,
408 - 'users_first_name' => $user_first_name,
409 - 'users_last_name' => $user_last_name,
410 - 'users_nick_name' => $user_nick_name,
411 - 'users_display_name' => $user_display_name,
412 - 'users_ip_address' => $user_ip_address,
413 - 'user_wordpress_roles' => $user_wordpress_roles,
414 - 'creation_date' => date_i18n( get_option( 'date_format' ), strtotime( sanitize_text_field( $survey->date_created ) ) ),
415 - 'modified_date' => $survey_modified_date,
416 - 'current_survey_author' => $current_survey_author,
417 - 'current_survey_author_email' => $current_survey_author_email,
418 - 'current_survey_page_link' => $survey_current_page_link_html,
419 - 'admin_email' => $super_admin_email,
420 - 'home_page_url' => $wp_home_page_url,
421 - 'post_author_email' => $survey_current_post_author_email,
422 - 'post_author_nickname' => $survey_current_post_author_nickname,
423 - 'post_author_display_name' => $survey_current_post_author_display_name,
424 - 'post_author_first_name' => $survey_current_post_author_first_name,
425 - 'post_author_last_name' => $survey_current_post_author_last_name,
426 - 'post_title' => $survey_current_post_title,
427 - 'site_title' => $get_site_title,
428 - 'site_description' => $get_site_description,
429 - );
477 + 'survey_title' => stripslashes($survey->title),
478 + 'survey_category_title' => $survey_category_title,
479 + 'survey_id' => stripslashes($survey->id),
480 + 'post_id' => $survey_current_post_id,
481 + 'user_name' => $user_name,
482 + 'user_email' => $user_email,
483 + 'user_wordpress_email' => $user_wordpress_email,
484 + 'user_id' => $user_id,
485 + 'user_registered' => $user_registered,
486 + 'questions_count' => $survey_question_count,
487 + 'current_date' => $survey_current_date,
488 + 'current_time' => $survey_current_time_only,
489 + 'current_day' => $survey_current_day,
490 + 'current_month' => $survey_current_month,
491 + 'unique_code' => $result_unique_code,
492 + 'sections_count' => $survey_sections_count,
493 + 'users_count' => $survey_passed_users_count,
494 + 'users_first_name' => $user_first_name,
495 + 'users_last_name' => $user_last_name,
496 + 'users_nick_name' => $user_nick_name,
497 + 'users_display_name' => $user_display_name,
498 + 'users_ip_address' => $user_ip_address,
499 + 'user_wordpress_roles' => $user_wordpress_roles,
500 + 'user_website_url' => $user_website_url,
501 + 'creation_date' => date_i18n( get_option( 'date_format' ), strtotime( sanitize_text_field( $survey->date_created ) ) ),
502 + 'modified_date' => $survey_modified_date,
503 + 'current_survey_author' => $current_survey_author,
504 + 'current_survey_author_email' => $current_survey_author_email,
505 + 'current_survey_author_nickname' => $current_survey_author_nickname,
506 + 'current_survey_author_display_name' => $current_survey_author_display_name,
507 + 'current_survey_author_website_url' => $current_survey_author_website_url,
508 + 'current_survey_author_registered' => $current_survey_author_registered,
509 + 'current_survey_page_link' => $survey_current_page_link_html,
510 + 'current_survey_page_title' => $survey_current_page_title,
511 + 'admin_email' => $super_admin_email,
512 + 'home_page_url' => $wp_home_page_url,
513 + 'post_author_email' => $survey_current_post_author_email,
514 + 'post_author_nickname' => $survey_current_post_author_nickname,
515 + 'post_author_display_name' => $survey_current_post_author_display_name,
516 + 'post_author_first_name' => $survey_current_post_author_first_name,
517 + 'post_author_last_name' => $survey_current_post_author_last_name,
518 + 'post_author_website_url' => $survey_current_post_author_website_url,
519 + 'post_author_roles' => $survey_current_post_author_roles,
520 + 'post_title' => $survey_current_post_title,
521 + 'site_title' => $get_site_title,
522 + 'site_description' => $get_site_description,
523 + );
430 524
431 525 $send_data = array(
432 - 'questions_data' => $questions_data,
433 - 'answered_questions' => $answered_questions,
434 - 'survey' => $survey,
435 - 'questions_ids' => $survey->question_ids,
436 - 'user_id' => $user_id,
437 - 'user_ip' => $user_ip,
438 - 'user_name' => $user_name,
439 - 'user_email' => $user_email,
440 - 'start_date' => current_time( 'mysql' ),
441 - 'end_date' => current_time( 'mysql' ),
442 - 'unique_code' => $result_unique_code,
443 - 'detectedDevice' => $detectedDevice,
526 + 'questions_data' => $questions_data,
527 + 'answered_questions' => $answered_questions,
528 + 'survey' => $survey,
529 + 'questions_ids' => $survey->question_ids,
530 + 'user_id' => $user_id,
531 + 'user_ip' => $user_ip,
532 + 'user_name' => $user_name,
533 + 'user_email' => $user_email,
534 + 'start_date' => current_time( 'mysql' ),
535 + 'end_date' => current_time( 'mysql' ),
536 + 'unique_code' => $result_unique_code,
537 + 'detectedDevice' => $detectedDevice,
444 538 );
445 539 $check_limitations = false;
446 540 if(isset($options['survey_limit_users']) && $options['survey_limit_users']){
447 541 $limit_users_by = isset($options['survey_limit_users_by']) && $options['survey_limit_users_by'] != "" ? $options['survey_limit_users_by'] : "";
@@ -565,9 +659,9 @@
565 659
566 660 $question_answer = '';
567 661 if( isset( $answered_questions[$qid] ) ){
568 662 if( isset( $answered_questions[$qid]['other'] ) ){
569 - $user_variant = $answered_questions[$qid]['other'];
663 + $user_variant = sanitize_text_field( $answered_questions[$qid]['other'] );
570 664 unset( $answered_questions[$qid]['other'] );
571 665 }
572 666
573 667 if( is_array( $answered_questions[$qid] ) ){
@@ -594,11 +688,11 @@
594 688 if( is_array( $question_answer ) ){
595 689 if( !in_array( '0', $question_answer ) ){
596 690 $user_variant = '';
597 691 }
598 - $user_answer = implode(',', $question_answer);
692 + $user_answer = implode(',', array_map( 'absint', $question_answer ));
599 693 }else{
600 - $user_answer = $question_answer;
694 + $user_answer = absint( $question_answer );
601 695 if( '0' != $question_answer ){
602 696 $user_variant = '';
603 697 }
604 698 }
@@ -607,40 +701,46 @@
607 701 case "select":
608 702 $user_answer = '';
609 703 break;
610 704 case "text":
705 + $user_answer = is_scalar( $question_answer ) ? sanitize_textarea_field( $question_answer ) : '';
706 + $answer_id = 0;
707 + break;
611 708 case "star":
612 - $user_answer = $question_answer;
709 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
613 710 $answer_id = 0;
614 711 break;
615 712 case "short_text":
616 - $user_answer = $question_answer;
713 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
617 714 $answer_id = 0;
618 715 break;
619 716 case "number":
620 717 case "phone":
621 718 case "date":
719 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
720 + $answer_id = 0;
721 + break;
622 722 case "time":
623 - $user_answer = $question_answer;
723 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
624 724 $answer_id = 0;
625 725 break;
626 726 case "date_time":
627 - if(is_array($question_answer) && ($question_answer['date'] != '' || $question_answer['time'] != '')){
628 - $question_answer['date'] = $question_answer['date'] != '' ? stripslashes ( sanitize_text_field( $question_answer['date'] ) ) : '-';
629 - $question_answer['time'] = $question_answer['time'] != '' ? stripslashes ( sanitize_text_field( $question_answer['time'] ) ) : '-';
630 - $user_answer = implode(" " , $question_answer);
727 + if( is_array( $question_answer ) ){
728 + $question_answer_date = isset( $question_answer['date'] ) && is_scalar( $question_answer['date'] ) && $question_answer['date'] != '' ? stripslashes( sanitize_text_field( $question_answer['date'] ) ) : '-';
729 + $question_answer_time = isset( $question_answer['time'] ) && is_scalar( $question_answer['time'] ) && $question_answer['time'] != '' ? stripslashes( sanitize_text_field( $question_answer['time'] ) ) : '-';
730 + $user_answer = $question_answer_date != '-' || $question_answer_time != '-' ? $question_answer_date . ' ' . $question_answer_time : '';
631 731 }
632 732 else{
633 - $user_answer = $question_answer;
733 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
634 734 }
635 735 $answer_id = 0;
636 736 break;
637 737 case "name":
638 - $user_answer = $question_answer;
738 + $user_answer = is_scalar( $question_answer ) ? sanitize_text_field( $question_answer ) : '';
639 739 $answer_id = 0;
640 740 break;
641 741 case "email":
642 - $user_answer = $question_answer;
742 + $user_answer = is_scalar( $question_answer ) ? sanitize_email( $question_answer ) : '';
643 743 $answer_id = 0;
644 744 break;
645 745 default:
646 746 $user_answer = '';
@@ -1001,9 +1101,12 @@
1001 1101 foreach ($sections as $section_key => $section) {
1002 1102 $sections[$section_key]['title'] = (isset($section['title']) && $section['title'] != '') ? stripslashes( esc_html( $section['title'] ) ) : '';
1003 1103
1004 1104 if ( $this->options[ $this->name_prefix . 'allow_html_in_section_description' ] ) {
1005 - $sections[$section_key]['description'] = (isset($section['description']) && $section['description'] != '') ? nl2br( wp_kses( stripslashes( $section['description'] ), Survey_Maker_Data::ays_survey_allowed_html()) ) : '';
1105 +
1106 + $survey_allowed_html = Survey_Maker_Data::ays_survey_custom_allowed_html();
1107 +
1108 + $sections[$section_key]['description'] = (isset($section['description']) && $section['description'] != '') ? nl2br( wp_kses( $section['description'], $survey_allowed_html ) ) : '';
1006 1109 } else {
1007 1110 $sections[$section_key]['description'] = (isset($section['description']) && $section['description'] != '') ? nl2br( esc_html( $section['description'] ) ) : '';
1008 1111 }
1009 1112
@@ -1042,8 +1145,13 @@
1042 1145 //Admin note
1043 1146 $opts['enable_admin_note'] = ( isset( $opts['enable_admin_note'] ) && $opts['enable_admin_note'] == 'on' ) ? true : false;
1044 1147 $opts['admin_note'] = isset( $opts['admin_note'] ) && $opts['admin_note'] != '' ? stripslashes( esc_attr( $opts['admin_note'] ) ) : '';
1045 1148
1149 + $opts['enable_value_prefix'] = (isset($opts['enable_value_prefix']) && $opts['enable_value_prefix'] == 'on') ? true : false;
1150 + $opts['value_prefix'] = isset( $opts['value_prefix'] ) && $opts['value_prefix'] != '' ? stripslashes( esc_attr( $opts['value_prefix'] ) ) : '';
1151 + $opts['enable_value_suffix'] = (isset($opts['enable_value_suffix']) && $opts['enable_value_suffix'] == 'on') ? true : false;
1152 + $opts['value_suffix'] = isset( $opts['value_suffix'] ) && $opts['value_suffix'] != '' ? stripslashes( esc_attr( $opts['value_suffix'] ) ) : '';
1153 +
1046 1154 if( $section_questions[$question_key]['type'] == 'checkbox' ){
1047 1155 $this->options[ 'survey_checkbox_options' ][$question['id']]['enable_max_selection_count'] = $opts['enable_max_selection_count'];
1048 1156 $this->options[ 'survey_checkbox_options' ][$question['id']]['max_selection_count'] = $opts['max_selection_count'];
1049 1157 $this->options[ 'survey_checkbox_options' ][$question['id']]['min_selection_count'] = $opts['min_selection_count'];
@@ -1188,8 +1296,11 @@
1188 1296 $ays_survey_protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
1189 1297 $current_survey_page_link = esc_url( $ays_survey_protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1190 1298 $content[] = '<input type="hidden" name="'. $this->html_name_prefix .'current_page_link" value="'. $current_survey_page_link .'">';
1191 1299
1300 + $current_survey_page_title = get_the_title();
1301 + $content[] = '<input type="hidden" name="'. $this->html_name_prefix .'current_page_title" value="'. $current_survey_page_title .'">';
1302 +
1192 1303 if( !$limit && !$is_expired ){
1193 1304 $content[] = $this->create_sections( $sections );
1194 1305 }else{
1195 1306 if( $is_expired && !$limit ){
@@ -1219,9 +1330,60 @@
1219 1330
1220 1331 $content = array();
1221 1332 $content[] = '<div class="' . $this->html_class_prefix . 'sections">';
1222 1333
1223 -
1334 + if(isset($this->options[ $this->name_prefix .'enable_password']) && $this->options[ $this->name_prefix .'enable_password'] ){
1335 + $ays_survey_show_password_flag = true;
1336 +
1337 + $password_type = 'general';
1338 + $general_psw_input = $this->options[$this->name_prefix .'password_survey'];
1339 + // $active_psw = $this->options['options'][ $this->name_prefix .'generated_passwords'][ $this->name_prefix .'active_passwords'];
1340 +
1341 + if( $password_type == 'general' && $general_psw_input == '' ){
1342 + $ays_survey_show_password_flag = false;
1343 + }else{
1344 + $ays_survey_show_password_flag = true;
1345 + }
1346 +
1347 + if($ays_survey_show_password_flag){
1348 + $if_generated = isset($this->options[ $this->name_prefix .'password_type']) && $this->options[ $this->name_prefix .'password_type'] == 'generated_password' ? 'name="' . $this->html_class_prefix . 'password"' : '';
1349 + $content[] = '<div class="' . $this->html_class_prefix . 'section">';
1350 +
1351 + $content[] = '<div class="' . $this->html_class_prefix . 'section-content">';
1352 +
1353 + $content[] = '<div style="margin-bottom:10px;">';
1354 + $content[] = '<div>';
1355 + $content[] = $this->options[ $this->name_prefix .'password_message'];
1356 + $content[] = '</div>';
1357 + $content[] = '</div>';
1358 + $content[] = '<div style="margin-bottom:10px;">';
1359 + $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
1360 + $content[] = '<input class="' . $this->html_class_prefix . 'remove-default-border ' . $this->html_class_prefix . 'password ' . $this->html_class_prefix . 'question-input ' .
1361 + $this->html_class_prefix . 'input" type="password" autocomplete="off" tabindex="0" placeholder="Please enter password" '.$if_generated.'/>';
1362 + $content[] = '<div class="' . $this->html_class_prefix . 'input-underline" style="margin:0;"></div>';
1363 + $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation" style="margin:0;"></div>';
1364 + $content[] = '</div>';
1365 + $content[] = '</div>';
1366 +
1367 + $content[] = '<div class="' . $this->html_class_prefix . 'check-password-block">';
1368 +
1369 + $content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">';
1370 + $content[] = '<div class="' . $this->html_class_prefix . 'section-button-container" tabindex="0">';
1371 + $content[] = '<div class="' . $this->html_class_prefix . 'section-button-content">';
1372 +
1373 + $content[] = '<input type="button" class="' . $this->html_class_prefix . 'section-button ays-check-survey-password" value="Check" />';
1374 +
1375 + $content[] = '</div>';
1376 + $content[] = '</div>';
1377 + $content[] = '</div>';
1378 +
1379 + $content[] = '</div>';
1380 + $content[] = '</div>';
1381 +
1382 + $content[] = '</div>';
1383 + }
1384 + }
1385 +
1224 1386 if( $this->options[ $this->name_prefix . 'enable_start_page'] === true ){
1225 1387 $content[] = '<div class="' . $this->html_class_prefix . 'section ' . $this->html_class_prefix . 'section-start-page">';
1226 1388
1227 1389 $content[] = '<div class="' . $this->html_class_prefix . 'section-content ' . $this->options[ $this->name_prefix .'start_page_custom_class'] . '">';
@@ -1259,8 +1421,11 @@
1259 1421 $survey_current_post_author_nickname = get_the_author_meta('user_nicename');
1260 1422 $survey_current_post_author_display_name = get_the_author_meta( 'display_name', $author_id );
1261 1423 $survey_current_post_author_first_name = get_the_author_meta( 'first_name', $author_id );
1262 1424 $survey_current_post_author_last_name = get_the_author_meta( 'last_name', $author_id );
1425 + $survey_current_post_author_website_url = get_the_author_meta( 'url', $author_id );
1426 + $survey_current_post_author_roles = get_the_author_meta( 'roles', $author_id );
1427 +
1263 1428 $survey_current_post_title = get_the_title();
1264 1429
1265 1430 $survey_additional_wp_data = array(
1266 1431 'survey_post_type' => get_post_type(),
@@ -1269,8 +1434,10 @@
1269 1434 'survey_current_post_author_nickname' => $survey_current_post_author_nickname,
1270 1435 'survey_current_post_author_display_name' => $survey_current_post_author_display_name,
1271 1436 'survey_current_post_author_first_name' => $survey_current_post_author_first_name,
1272 1437 'survey_current_post_author_last_name' => $survey_current_post_author_last_name,
1438 + 'survey_current_post_author_website_url' => $survey_current_post_author_website_url,
1439 + 'survey_current_post_author_roles' => $survey_current_post_author_roles,
1273 1440 'survey_current_post_title' => $survey_current_post_title,
1274 1441 );
1275 1442
1276 1443 $additional_data = base64_encode(json_encode($survey_additional_wp_data));
@@ -1452,13 +1619,67 @@
1452 1619
1453 1620 $content[] = '</div>';
1454 1621
1455 1622 $footer_class_with_bar = "";
1623 + $footer_class_with_terms = "";
1624 + $enable_terms_and_conditions = $this->options[ $this->name_prefix . 'enable_terms_and_conditions' ];
1625 + $terms_and_conditions_data = $this->options[ $this->name_prefix . 'terms_and_conditions_data' ];
1456 1626 if($this->options[ $this->name_prefix . 'enable_progress_bar' ] == "on"){
1457 1627 $footer_class_with_bar = "ays-survey-footer-with-live-bar";
1458 1628 }
1459 - $content[] = '<div class="' . $this->html_class_prefix . 'section-footer '.$footer_class_with_bar.'">';
1460 1629
1630 + $enable_terms_and_conditions_required_message = $this->options['enable_terms_and_conditions_required_message'];
1631 + if($enable_terms_and_conditions){
1632 +
1633 + $footer_class_with_terms = "ays-survey-footer-with-terms-and-conds";
1634 + }
1635 +
1636 + $content[] = '<div class="' . $this->html_class_prefix . 'section-footer '.$footer_class_with_bar.' '.$footer_class_with_terms.'">';
1637 +
1638 + if( $last ){
1639 + if( $enable_terms_and_conditions ) {
1640 + $content[] = '<div data-required="true" data-all-terms-check="true" data-type="checkbox" class="' . $this->html_class_prefix . 'section-terms-and-conditions-container">';
1641 + $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-content">';
1642 + $padding_for_bussines = $this->options[ $this->name_prefix . 'is_business' ] ? 'style="padding:0 10px 3px;"' : '';
1643 + foreach ($terms_and_conditions_data as $tc_text => $tc_text_value) {
1644 + if( $tc_text_value['messages'] != '' ){
1645 + $content[] = '<div class="' . $this->html_class_prefix . 'terms-and-conditions-content-box" '.$padding_for_bussines.'>';
1646 + $content[] = '<label class="' . $this->html_class_prefix . 'answer-label ' . $this->html_class_prefix . 'answer-label-terms-conditions">';
1647 + if($this->options[ $this->name_prefix . 'is_business' ]){
1648 + $content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions ' . $this->html_class_prefix . 'business-theme-answers">';
1649 + $content[] = '<span class="' . $this->html_name_prefix . 'maker-checkmark ' . $this->html_name_prefix . 'maker-checkmark-checkbox" style="top:18px"></span>';
1650 + }else{
1651 + $content[] = '<input type="checkbox" class="' . $this->html_class_prefix . 'is-checked-terms-and-conditions">';
1652 + }
1653 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-label-content">';
1654 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content">';
1655 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-ink"></div>';
1656 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-1">';
1657 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-2">';
1658 + $content[] = '<div class="' . $this->html_class_prefix . 'answer-icon-content-3"></div>';
1659 + $content[] = '</div>';
1660 + $content[] = '</div>';
1661 + $content[] = '</div>';
1662 + $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions">';
1663 + $content[] = '<span class="">' . stripslashes(($tc_text_value['messages'])) . '</span>';
1664 + $content[] = '</div>';
1665 + $content[] = '</div>';
1666 + $content[] = '</label>';
1667 +
1668 + $content[] = '</div>';
1669 + }
1670 + }
1671 + $content[] = '</div>';
1672 + if($enable_terms_and_conditions_required_message){
1673 + $content[] = '<div class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message-content" style="display:none;">';
1674 + $content[] = '<p class="' . $this->html_class_prefix . 'section-terms-and-conditions-required-message">';
1675 + $content[] = '<span class="">' . __('By clicking on the checkbox, you agree to our Terms and Conditions', "survey-maker") . '</span>';
1676 + $content[] = '</p>';
1677 + $content[] = '</div>';
1678 + }
1679 + $content[] = '</div>';
1680 + }
1681 + }
1461 1682 $content[] = '<div class="' . $this->html_class_prefix . 'section-buttons">';
1462 1683
1463 1684 if( ! $first ){
1464 1685 if( $this->options[ $this->name_prefix . 'enable_previous_button' ] ){
@@ -2141,8 +2362,21 @@
2141 2362 $content = array();
2142 2363 // Input types placeholders
2143 2364 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2144 2365
2366 + $enable_value_prefix = $question['options']['enable_value_prefix'];
2367 + $value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : '';
2368 +
2369 + $enable_value_suffix = $question['options']['enable_value_suffix'];
2370 + $value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : '';
2371 +
2372 + $answer_box_prefix_suffix_css_class = "";
2373 + $answer_container_prefix_suffix_css_class = "";
2374 + if( $value_prefix != "" || $value_suffix != "" ){
2375 + $answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix';
2376 + }
2377 + $answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix';
2378 +
2145 2379 $enable_word_limit = isset($question['options']['enable_word_limitation']) && $question['options']['enable_word_limitation'] ? true : false;
2146 2380 $show_limit = isset($question['options']['limit_counter']) && $question['options']['limit_counter'] == "on" ? true : false;
2147 2381 $limit_length = isset($question['options']['limit_length']) && $question['options']['limit_length'] != "" ? $question['options']['limit_length'] : "";
2148 2382 $limit_by = "Character";
@@ -2170,11 +2404,15 @@
2170 2404 if( $minimal_theme ){
2171 2405 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2172 2406 }
2173 2407
2174 - $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2408 + $content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">';
2175 2409
2176 - $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2410 + $content[] = '<div class="' . $this->html_class_prefix . 'question-box '. $answer_box_prefix_suffix_css_class .'">';
2411 + if( $value_prefix != "" ){
2412 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>';
2413 + }
2414 +
2177 2415 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2178 2416
2179 2417 $content[] = '<input class="
2180 2418 ' . $minimal_class . '
@@ -2192,16 +2430,21 @@
2192 2430 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2193 2431 }
2194 2432
2195 2433 $content[] = '</div>';
2196 - if($limit_checker){
2197 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2198 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2199 - $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2200 - $content[] .= '</div>';
2201 - $content[] .= '</div>';
2434 + if( $value_suffix != "" ){
2435 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>';
2202 2436 }
2437 +
2203 2438 $content[] = '</div>';
2439 +
2440 + if($limit_checker){
2441 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2442 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2443 + $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2444 + $content[] .= '</div>';
2445 + $content[] .= '</div>';
2446 + }
2204 2447
2205 2448 $content[] = '</div>';
2206 2449
2207 2450 $content = implode( '', $content );
@@ -2213,8 +2456,21 @@
2213 2456 $content = array();
2214 2457 // Input types placeholders
2215 2458 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2216 2459
2460 + $enable_value_prefix = $question['options']['enable_value_prefix'];
2461 + $value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : '';
2462 +
2463 + $enable_value_suffix = $question['options']['enable_value_suffix'];
2464 + $value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : '';
2465 +
2466 + $answer_box_prefix_suffix_css_class = "";
2467 + $answer_container_prefix_suffix_css_class = "";
2468 + if( $value_prefix != "" || $value_suffix != "" ){
2469 + $answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix';
2470 + }
2471 + $answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix';
2472 +
2217 2473 $enable_number_limit = isset($question['options']['enable_number_limitation']) && $question['options']['enable_number_limitation'] == "on" ? true : false;
2218 2474 $enable_number_limit_message = isset($question['options']['enable_number_error_message']) && $question['options']['enable_number_error_message'] == "on" ? true : false;
2219 2475 $number_limit_message = isset($question['options']['number_error_message']) && $question['options']['number_error_message'] != "" ? stripslashes(esc_attr($question['options']['number_error_message'])) : "";
2220 2476
@@ -2246,11 +2502,15 @@
2246 2502 if( $minimal_theme ){
2247 2503 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2248 2504 }
2249 2505
2250 - $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2506 + $content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">';
2251 2507
2252 - $content[] = '<div class="' . $this->html_class_prefix . 'question-box">';
2508 + $content[] = '<div class="' . $this->html_class_prefix . 'question-box '. $answer_box_prefix_suffix_css_class .'">';
2509 + if( $value_prefix != "" ){
2510 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>';
2511 + }
2512 +
2253 2513 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2254 2514
2255 2515 $content[] = '<input class="
2256 2516 ' . $minimal_class . '
@@ -2266,23 +2526,30 @@
2266 2526 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2267 2527 }
2268 2528
2269 2529 $content[] = '</div>';
2270 - if($enable_number_limit_message){
2271 - $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2272 - $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2273 - $content[] = $number_limit_message;
2274 - $content[] = '</span>';
2275 - $content[] = '</div>';
2530 +
2531 + if( $value_suffix != "" ){
2532 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>';
2276 2533 }
2277 - if($limit_checker){
2278 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2279 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2280 - $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2281 - $content[] .= '</div>';
2534 +
2535 + $content[] = '</div>';
2536 +
2537 + if($enable_number_limit_message){
2538 + $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2539 + $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2540 + $content[] = $number_limit_message;
2541 + $content[] = '</span>';
2542 + $content[] = '</div>';
2543 + }
2544 + if($limit_checker){
2545 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2546 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2547 + $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2282 2548 $content[] .= '</div>';
2283 - }
2284 - $content[] = '</div>';
2549 + $content[] .= '</div>';
2550 + }
2551 +
2285 2552 $content[] = '</div>';
2286 2553
2287 2554 $content = implode( '', $content );
2288 2555
@@ -2294,8 +2561,21 @@
2294 2561 $content = array();
2295 2562 // Input types placeholders
2296 2563 $survey_input_type_placeholder = isset($question['options']['placeholder']) && $question['options']['placeholder'] != "" ? $question['options']['placeholder'] : '';
2297 2564
2565 + $enable_value_prefix = $question['options']['enable_value_prefix'];
2566 + $value_prefix = $enable_value_prefix ? stripslashes(sanitize_text_field($question['options']['value_prefix'])) : '';
2567 +
2568 + $enable_value_suffix = $question['options']['enable_value_suffix'];
2569 + $value_suffix = $enable_value_suffix ? stripslashes(sanitize_text_field($question['options']['value_suffix'])) : '';
2570 +
2571 + $answer_box_prefix_suffix_css_class = "";
2572 + $answer_container_prefix_suffix_css_class = "";
2573 + if( $value_prefix != "" || $value_suffix != "" ){
2574 + $answer_box_prefix_suffix_css_class = $this->html_class_prefix . 'question-box-text-types-prefix-suffix';
2575 + }
2576 + $answer_container_prefix_suffix_css_class = $this->html_class_prefix . 'answer-box-text-types-prefix-suffix';
2577 +
2298 2578 //Input types value
2299 2579 $enable_url_parameter = isset($question['options']['enable_url_parameter']) && $question['options']['enable_url_parameter'] == true ? true : false;
2300 2580 $url_parameter = $enable_url_parameter && isset($question['options']['url_parameter']) && $question['options']['url_parameter'] != "" ? $question['options']['url_parameter'] : '';
2301 2581 $survey_input_type_value = isset($_GET[$url_parameter]) && $_GET[$url_parameter] ? $_GET[$url_parameter] : '';
@@ -2331,11 +2611,15 @@
2331 2611 if( $minimal_theme ){
2332 2612 $minimal_class = $this->html_class_prefix . "minimal-theme-textarea-input";
2333 2613 }
2334 2614
2335 - $content[] = '<div class="' . $this->html_class_prefix . 'answer">';
2615 + $content[] = '<div class="' . $this->html_class_prefix . 'answer '. $answer_container_prefix_suffix_css_class .'">';
2336 2616
2337 - $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-box-text-types-short">';
2617 + $content[] = '<div class="' . $this->html_class_prefix . 'question-box ' . $this->html_class_prefix . 'question-box-text-types-short '. $answer_box_prefix_suffix_css_class .'">';
2618 + if( $value_prefix != "" ){
2619 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-prefix">' . $value_prefix . '</div>';
2620 + }
2621 +
2338 2622 $content[] = '<div class="' . $this->html_class_prefix . 'question-input-box">';
2339 2623
2340 2624 $content[] = '<input class="' . $minimal_class . ' '.$number_limit_class.' ' . $this->html_class_prefix . 'answer-text-inputs ' . $this->html_class_prefix . 'answer-text-inputs-default" type="text" tabindex="0" step="any" style="min-height: 24px;"
2341 2625 placeholder="'. __( $survey_input_type_placeholder, "survey-maker" ) .'"
@@ -2346,27 +2630,32 @@
2346 2630 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline"></div>';
2347 2631 $content[] = '<div class="' . $this->html_class_prefix . 'input-underline-animation"></div>';
2348 2632 }
2349 2633
2350 - if($enable_number_limit_message){
2351 - $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2352 - $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2353 - $content[] = $number_limit_message;
2354 - $content[] = '</span>';
2355 - $content[] = '</div>';
2356 - }
2634 + $content[] = '</div>';
2357 2635
2358 - if($limit_checker){
2359 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2360 - $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2361 - $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2362 - $content[] .= '</div>';
2363 - $content[] .= '</div>';
2364 - }
2636 + if( $value_suffix != "" ){
2637 + $content[] = '<div class="' . $this->html_class_prefix . 'question-answer-suffix">' . $value_suffix . '</div>';
2638 + }
2365 2639
2640 + $content[] = '</div>';
2641 +
2642 + if($enable_number_limit_message){
2643 + $content[] = '<div class="' . $this->html_class_prefix . 'number-limit-message-box ' . $this->html_class_prefix . 'question-text-error-message" style="display: none;">';
2644 + $content[] = '<span class="' . $this->html_class_prefix . 'number-limit-message-text">';
2645 + $content[] = $number_limit_message;
2646 + $content[] = '</span>';
2366 2647 $content[] = '</div>';
2367 - $content[] = '</div>';
2648 + }
2368 2649
2650 + if($limit_checker){
2651 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-conteiner">';
2652 + $content[] .= '<div class="'.$this->html_class_prefix.'question-text-message">';
2653 + $content[] .= '<span class="'.$this->html_class_prefix.'question-text-message-span">'. $limit_length . '</span> ' . $limit_by;
2654 + $content[] .= '</div>';
2655 + $content[] .= '</div>';
2656 + }
2657 +
2369 2658 $content[] = '</div>';
2370 2659
2371 2660 $content = implode( '', $content );
2372 2661
@@ -2729,19 +3018,21 @@
2729 3018
2730 3019 $content[] = '
2731 3020 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
2732 3021 width: ' . $width . ';
3022 + box-sizing: border-box;
2733 3023 }
2734 3024
2735 3025 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header {
2736 - border-top-color: ' . $this->options[ $this->name_prefix . 'color' ] . ';
3026 + border-top-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important;
2737 3027 }
2738 3028
2739 3029 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
2740 - border-left-color: ' . $this->options[ $this->name_prefix . 'color' ] . ';
3030 + border-left-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important;
2741 3031 }
2742 3032
2743 3033 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header,
3034 + #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container,
2744 3035 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question {
2745 3036 background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . ';
2746 3037 }
2747 3038
@@ -2790,8 +3081,9 @@
2790 3081 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'loader-with-text,
2791 3082 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'restricted-message,
2792 3083 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-desc,
2793 3084 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-questions-count,
3085 + #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-terms-and-conditions-container,
2794 3086 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'question-title,
2795 3087 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-title-row,
2796 3088 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'thank-you-page > div p {
2797 3089 color: ' . $this->options[ $this->name_prefix . 'text_color' ] . ';
@@ -2888,10 +3180,15 @@
2888 3180 padding-bottom: ' . $this->options[ $this->name_prefix . 'buttons_top_bottom_padding' ] . 'px;
2889 3181 background-color: ' . $this->options[ $this->name_prefix . 'buttons_bg_color' ] . ';
2890 3182 letter-spacing: ' . $this->options[ $this->name_prefix . 'buttons_text_letter_spacing' ] . 'px;
2891 3183 height: initial;
3184 + color: #333 !important;
2892 3185 }
2893 3186
3187 + #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container .' . $this->html_class_prefix . 'section-button-content .' . $this->html_class_prefix . 'section-button:hover {
3188 + color: rgba(51,51,51,0.7) !important;
3189 + }
3190 +
2894 3191 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-buttons .' . $this->html_class_prefix . 'section-button-container {
2895 3192 border-radius: ' . $this->options[ $this->name_prefix . 'buttons_border_radius' ] . 'px;
2896 3193 background-color: ' . $this->options[ $this->name_prefix . 'background_color' ] . ';
2897 3194 }
@@ -3055,8 +3352,12 @@
3055 3352 '.$answers_list_width.'
3056 3353 '.$answers_list_direction.'
3057 3354 '.$answers_grid_min_width.'
3058 3355 }
3356 +
3357 + #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question[data-type="date"] .' . $this->html_class_prefix . 'answer{
3358 + width: 100%;
3359 + }
3059 3360
3060 3361 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'sections .' . $this->html_class_prefix . 'question .' . $this->html_class_prefix . 'answer.' . $this->html_class_prefix . 'other-answer-container{
3061 3362 '.$other_answer_box_width.'
3062 3363 }
@@ -3434,9 +3735,16 @@
3434 3735 public function ays_survey_get_user_information() {
3435 3736 $output = array();
3436 3737 if(isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'survey_maker_autofill_nonce')){
3437 3738 if(is_user_logged_in()) {
3438 - $output = wp_get_current_user();
3739 + $user = wp_get_current_user();
3740 +
3741 + $output = array(
3742 + 'data' => array(
3743 + 'display_name' => $user->display_name,
3744 + 'user_email' => $user->user_email,
3745 + )
3746 + );
3439 3747 } else {
3440 3748 $output = array();
3441 3749 }
3442 3750 }
@@ -3442,8 +3750,28 @@
3442 3750 }
3443 3751 return $output;
3444 3752 }
3445 3753
3754 + public static function get_survey_category_by_ids($ids){
3755 + global $wpdb;
3756 +
3757 + $ids = array_map('intval', explode(',', $ids));
3758 + $ids = array_filter($ids);
3759 +
3760 + if (empty($ids)) {
3761 + return [];
3762 + }
3763 +
3764 + $ids_sql = implode(',', $ids);
3765 +
3766 + $sql = "SELECT *
3767 + FROM {$wpdb->prefix}ayssurvey_survey_categories
3768 + WHERE id IN ($ids_sql)
3769 + ORDER BY FIELD(id, $ids_sql)";
3770 +
3771 + return $wpdb->get_results($sql, ARRAY_A);
3772 + }
3773 +
3446 3774 public function ays_survey_popup_set_cookie(){
3447 3775 if( isset( $_REQUEST['id'] ) && $_REQUEST['id'] != '' ){
3448 3776 $id = sanitize_text_field( $_REQUEST['id'] );
3449 3777 }else{
@@ -3540,9 +3868,9 @@
3540 3868 $question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius_mobile' ];
3541 3869 $content .= '
3542 3870 @media screen and (max-width: 640px){
3543 3871 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
3544 - max-width: '. $mobile_max_width .';
3872 + max-width: min('. $mobile_max_width .', calc(100vw - 20px));
3545 3873 }
3546 3874
3547 3875 #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' {
3548 3876 width: ' . $mobile_width . ';
@@ -3827,18 +4155,28 @@
3827 4155 // Title border radius mobile
3828 4156 $survey_popup_title_border_radius_mobile = (isset($options["popup_title_border_radius_mobile"]) && $options["popup_title_border_radius_mobile"] != "") ? absint ( intval( $options["popup_title_border_radius_mobile"] ) ) : 0;
3829 4157
3830 4158 // Width
3831 - $popup_survey_width = (isset($options['width']) && $options['width'] != '') ? absint ( intval( $options['width'] ) ) : 800;
4159 + $popup_survey_width = (isset($options['width']) && $options['width'] != '') ? absint ( intval( $options['width'] ) ) : '';
4160 + // Width by percentage or pixels
4161 + $popup_survey_width_by = (isset($options['width_by_percentage_px']) && $options['width_by_percentage_px'] != '' && $popup_survey_width != '') ? stripslashes ( esc_attr( $options['width_by_percentage_px'] ) ) : 'pixels';
4162 +
3832 4163 // Mobile width
3833 4164 $options['width_mobile'] = isset($options['width_mobile']) ? $options['width_mobile'] : $popup_survey_width;
3834 - $popup_survey_width_mobile = (isset($options['width_mobile']) && $options['width_mobile'] != '') ? absint ( intval( $options['width_mobile'] ) ) : 800;
4165 + $popup_survey_width_mobile = (isset($options['width_mobile']) && $options['width_mobile'] != '') ? absint ( intval( $options['width_mobile'] ) ) : '';
4166 + // Mobile width by percentage or pixels
4167 + $popup_survey_width_mobile_by = (isset($options['width_mobile_by_percentage_px']) && $options['width_mobile_by_percentage_px'] != '' && $popup_survey_width_mobile != '') ? stripslashes ( esc_attr( $options['width_mobile_by_percentage_px'] ) ) : 'pixels';
3835 4168
3836 4169 // Height
3837 - $popup_survey_height = (isset($options['height']) && $options['height'] != '') ? absint ( intval( $options['height'] ) ) : 450;
4170 + $popup_survey_height = (isset($options['height']) && $options['height'] != '') ? absint ( intval( $options['height'] ) ) : '';
4171 + // Height by percentage or pixels
4172 + $popup_survey_height_by = (isset($options['height_by_percentage_px']) && $options['height_by_percentage_px'] != '' && $popup_survey_height != '') ? stripslashes ( esc_attr( $options['height_by_percentage_px'] ) ) : 'pixels';
4173 +
3838 4174 // Height mobile
3839 4175 $options['height_mobile'] = isset($options['height_mobile']) ? $options['height_mobile'] : $popup_survey_height;
3840 - $popup_survey_height_mobile = (isset($options['height_mobile']) && $options['height_mobile'] != '') ? absint ( intval( $options['height_mobile'] ) ) : 450;
4176 + $popup_survey_height_mobile = (isset($options['height_mobile']) && $options['height_mobile'] != '') ? absint ( intval( $options['height_mobile'] ) ) : '';
4177 + // Mobile height by percentage or pixels
4178 + $popup_survey_height_mobile_by = (isset($options['height_mobile_by_percentage_px']) && $options['height_mobile_by_percentage_px'] != '' && $popup_survey_height_mobile != '') ? stripslashes ( esc_attr( $options['height_mobile_by_percentage_px'] ) ) : 'pixels';
3841 4179
3842 4180 // Popup Position
3843 4181 $popup_position = (isset($options['popup_position']) && $options['popup_position'] != 'center-center') ? $options['popup_position'] : 'center-center';
3844 4182
@@ -3849,8 +4187,23 @@
3849 4187
3850 4188 // Hide popup after close
3851 4189 $hide_popup_after_close = (isset($options['hide_popup_after_close']) && $options['hide_popup_after_close'] == 'on') ? esc_attr($options['hide_popup_after_close']) : 'off';
3852 4190
4191 + // Hide popup on mobile
4192 + $options['hide_popup_on_mobile'] = isset( $options['hide_popup_on_mobile'] ) ? esc_attr($options['hide_popup_on_mobile']) : "off";
4193 + $hide_popup_on_mobile = (isset($options['hide_popup_on_mobile']) && $options['hide_popup_on_mobile'] == 'on') ? true : false;
4194 +
4195 + // Hide popup on PC
4196 + $options['hide_popup_on_pc'] = isset( $options['hide_popup_on_pc'] ) ? esc_attr($options['hide_popup_on_pc']) : "off";
4197 + $hide_popup_on_pc = (isset($options['hide_popup_on_pc']) && $options['hide_popup_on_pc'] == 'on') ? true : false;
4198 +
4199 + // Hide popup on tablet
4200 + $options['hide_popup_on_tablet'] = isset( $options['hide_popup_on_tablet'] ) ? esc_attr($options['hide_popup_on_tablet']) : "off";
4201 + $hide_popup_on_tablet = (isset($options['hide_popup_on_tablet']) && $options['hide_popup_on_tablet'] == 'on') ? true : false;
4202 +
4203 + // Close by clicking outside the box
4204 + $close_popup_overlay_outside_click = (isset($options['close_popup_overlay_outside_click']) && $options['close_popup_overlay_outside_click'] == 'on') ? esc_attr($options['close_popup_overlay_outside_click']) : 'off';
4205 +
3853 4206 // $survey_bg = (isset($survey_options['survey_background_color']) && $survey_options['survey_background_color'] != '') ? $survey_options['survey_background_color'] : '#ffffff';
3854 4207 // $survey_theme = (isset($survey_options['survey_theme']) && $survey_options['survey_theme'] != '') ? $survey_options['survey_theme'] : 'classic_light';
3855 4208 // $is_minimal = $survey_theme == 'minimal' ? true : false;
3856 4209 // $is_modern = $survey_theme == 'modern' ? true : false;
@@ -3878,8 +4231,11 @@
3878 4231
3879 4232 // Popup selector
3880 4233 $popup_selector = (isset($options["popup_selector"]) && $options["popup_selector"] != "") ? stripslashes( esc_attr($options["popup_selector"])) : "";
3881 4234
4235 + // Popup animation
4236 + $popup_animation = (isset($options["popup_animation"]) && $options["popup_animation"] != "") ? esc_attr($options["popup_animation"]) : "none";
4237 +
3882 4238 // Close by pressing the ESC
3883 4239 $survey_popup_enable_close_by_esc = (isset($options["popup_enable_close_by_esc"]) && $options["popup_enable_close_by_esc"] != '') ? $options["popup_enable_close_by_esc"] : 'off';
3884 4240
3885 4241
@@ -3924,8 +4280,25 @@
3924 4280 // }
3925 4281 // }
3926 4282 // }
3927 4283
4284 + if($hide_popup_on_mobile){
4285 + if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === true){
4286 + $show_popup = false;
4287 + }
4288 + }
4289 + if($hide_popup_on_pc){
4290 + if(Survey_Maker_Data::ays_survey_pb_detect_mobile_device() === false && Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === false){
4291 + $show_popup = false;
4292 + }
4293 + }
4294 +
4295 + if($hide_popup_on_tablet){
4296 + if(Survey_Maker_Data::ays_survey_pb_detect_tablet_device() === true){
4297 + $show_popup = false;
4298 + }
4299 + }
4300 +
3928 4301 switch($popup_trigger_type){
3929 4302 case 'on_click':
3930 4303 $display_popup_on_load = 'display_none_not_important';
3931 4304 break;
@@ -3934,13 +4307,15 @@
3934 4307 $display_popup_on_load = '';
3935 4308 break;
3936 4309 }
3937 4310
4311 + $popup_animation_class = in_array($popup_animation, array('fade', 'slide-down', 'slide-up', 'zoom-in', 'bounce'), true) && $popup_trigger_type != 'on_click' ? 'ays-popup-animation-' . $popup_animation : '';
4312 +
3938 4313 if( ! isset( $_COOKIE[ 'ays_survey_popup_cookie_name_' . $popup['id'] ] ) && ! isset( $_COOKIE[ 'ays_survey_popup_hide_after_click_close_' . $popup['id'] ] ) ){
3939 4314 if ($show_popup) {
3940 4315 $shortcode2 = '[ays_survey id="'. $popup['survey_id'] .'"]';
3941 4316 // $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']."' data-id='".$popup['id']."'>
3942 - $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']." ".$display_popup_on_load."' data-id='".$popup['id']."' data-close-popup='".$survey_enable_popup_close_after_finish."'>
4317 + $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']." ".$display_popup_on_load." ".$popup_animation_class."' data-id='".$popup['id']."' data-close-popup='".$survey_enable_popup_close_after_finish."'>
3943 4318 <div class='ays-survey-popup-btn-close'>
3944 4319 <img class='ays-survey-popup-btn-close-icon' src='". SURVEY_MAKER_PUBLIC_URL ."/images/cross.svg'>
3945 4320 </div>";
3946 4321 $popup_survey_view .= "<div class='ays-survey-popup-content'>";
@@ -4068,13 +4443,17 @@
4068 4443 }
4069 4444
4070 4445 $hide_popup_on_mobile_class = $survey_popup_hide_title_on_mobile ? 'display: none;' : '';
4071 4446
4447 + $popup_width_css = ($popup_survey_width > 0 ? $popup_survey_width . ($popup_survey_width_by == 'percentage' ? '%' : 'px') : '100%');
4448 + $popup_height_css = ($popup_survey_height > 0 ? $popup_survey_height . ($popup_survey_height_by == 'percentage' ? '%' : 'px') : '100%');
4449 +
4072 4450 $popup_survey_view .= '
4073 4451 <style>
4074 4452 .ays-survey-popup-modal-' . $popup['id'] . ' {
4075 - width: ' . $popup_survey_width . 'px;
4076 - height: ' . $popup_survey_height . 'px;
4453 + width: ' . $popup_width_css . ';
4454 + box-sizing: border-box;
4455 + height: ' . $popup_height_css . ';
4077 4456 background-color: ' . $popup_bg_color . ';
4078 4457 top: ' . $ays_survey_popup_conteiner_pos_top . ';
4079 4458 left: ' . $ays_survey_popup_conteiner_pos_left . ';
4080 4459 right: ' . $ays_survey_popup_conteiner_pos_right . ';
@@ -4097,10 +4476,11 @@
4097 4476 }
4098 4477
4099 4478 @media screen and (max-width: 640px){
4100 4479 div.ays-survey-popup-modal-' . $popup['id'] . ' {
4101 - width: ' . $popup_survey_width_mobile . 'px;
4102 - height: ' . $popup_survey_height_mobile . 'px;
4480 + width: ' . ($popup_survey_width_mobile > 0 ? $popup_survey_width_mobile . ($popup_survey_width_mobile_by == 'percentage' ? '%' : 'px') : '100%') . ';
4481 + max-width: calc(100vw - 20px);
4482 + height: ' . ($popup_survey_height_mobile > 0 ? $popup_survey_height_mobile . ($popup_survey_height_mobile_by == 'percentage' ? '%' : 'px') : '100%') . ';
4103 4483 background-color: ' . $popup_bg_color_mobile . ';
4104 4484 }
4105 4485 .ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{
4106 4486 font-size: '.$survey_popup_title_mobile_font_size.'px;
@@ -4116,8 +4496,50 @@
4116 4496
4117 4497 </style>
4118 4498 ';
4119 4499
4500 + $popup_survey_view .= '<style type="text/css">';
4501 + $popup_survey_view .= "
4502 + @keyframes ays-popup-fade-in {
4503 + from { opacity: 0; }
4504 + to { opacity: 1; }
4505 + }
4506 + @keyframes ays-popup-slide-down {
4507 + from { opacity: 0; transform: translateY(-50px); }
4508 + to { opacity: 1; transform: translateY(0); }
4509 + }
4510 + @keyframes ays-popup-slide-up {
4511 + from { opacity: 0; transform: translateY(50px); }
4512 + to { opacity: 1; transform: translateY(0); }
4513 + }
4514 + @keyframes ays-popup-zoom-in {
4515 + from { opacity: 0; transform: scale(0.8); }
4516 + to { opacity: 1; transform: scale(1); }
4517 + }
4518 + @keyframes ays-popup-bounce {
4519 + 0% { opacity: 0; transform: scale(0.3); }
4520 + 50% { opacity: 1; transform: scale(1.05); }
4521 + 70% { transform: scale(0.9); }
4522 + 100% { transform: scale(1); }
4523 + }
4524 + .ays-survey-popup-survey-window.ays-popup-animation-fade {
4525 + animation: ays-popup-fade-in 0.3s ease-in-out;
4526 + }
4527 + .ays-survey-popup-survey-window.ays-popup-animation-slide-down {
4528 + animation: ays-popup-slide-down 0.4s ease-out;
4529 + }
4530 + .ays-survey-popup-survey-window.ays-popup-animation-slide-up {
4531 + animation: ays-popup-slide-up 0.4s ease-out;
4532 + }
4533 + .ays-survey-popup-survey-window.ays-popup-animation-zoom-in {
4534 + animation: ays-popup-zoom-in 0.3s ease-out;
4535 + }
4536 + .ays-survey-popup-survey-window.ays-popup-animation-bounce {
4537 + animation: ays-popup-bounce 0.5s ease-out;
4538 + }
4539 + ";
4540 + $popup_survey_view .= '</style>';
4541 +
4120 4542 $popup_survey_view .= '<script type="text/javascript">';
4121 4543
4122 4544 $popup_survey_view .= "
4123 4545 if(typeof aysSurveyPopupsOptions === 'undefined'){
@@ -4130,8 +4552,10 @@
4130 4552 'enable_popup_close_after_finish' => $survey_enable_popup_close_after_finish,
4131 4553 'popup_close_after_finish_delay' => $survey_popup_close_after_finish_delay,
4132 4554 'popup_selector' => $popup_selector,
4133 4555 'popupEnableCloseByEsc' => $survey_popup_enable_close_by_esc,
4556 + 'closePopupOverlayOutsideClick' => $close_popup_overlay_outside_click,
4557 + 'popup_animation' => $popup_animation,
4134 4558
4135 4559 ) ) ) . "';";
4136 4560 $popup_survey_view .= '</script>';
4137 4561 $popup_survey_view .= '</div>';