| @@ -240,12 +240,14 @@ | ||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $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'] ) : ""; | |
| 245 | 245 | |
| 246 | - $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'] ) : ""; | |
| 247 | 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 | + | |
| 248 | 250 | // Survey modified date |
| 249 | 251 | $survey_modified_date = (isset($survey->date_modified) && $survey->date_modified != '') ? esc_attr( $survey->date_modified ) : ""; |
| 250 | 252 | if( $survey_modified_date != "" ){ |
| 251 | 253 | $survey_modified_date = date_i18n( get_option( 'date_format' ), strtotime( $survey_modified_date ) ); |
| @@ -455,12 +457,26 @@ | ||
| 455 | 457 | |
| 456 | 458 | $get_site_title = get_bloginfo('name'); |
| 457 | 459 | $get_site_description = get_bloginfo('description'); |
| 458 | 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 | + | |
| 459 | 474 | $detectedDevice = Survey_Maker_Data::ays_survey_detected_device_chart(); |
| 460 | 475 | |
| 461 | 476 | $message_data = array( |
| 462 | 477 | 'survey_title' => stripslashes($survey->title), |
| 478 | + 'survey_category_title' => $survey_category_title, | |
| 463 | 479 | 'survey_id' => stripslashes($survey->id), |
| 464 | 480 | 'post_id' => $survey_current_post_id, |
| 465 | 481 | 'user_name' => $user_name, |
| 466 | 482 | 'user_email' => $user_email, |
| @@ -490,8 +506,9 @@ | ||
| 490 | 506 | 'current_survey_author_display_name' => $current_survey_author_display_name, |
| 491 | 507 | 'current_survey_author_website_url' => $current_survey_author_website_url, |
| 492 | 508 | 'current_survey_author_registered' => $current_survey_author_registered, |
| 493 | 509 | 'current_survey_page_link' => $survey_current_page_link_html, |
| 510 | + 'current_survey_page_title' => $survey_current_page_title, | |
| 494 | 511 | 'admin_email' => $super_admin_email, |
| 495 | 512 | 'home_page_url' => $wp_home_page_url, |
| 496 | 513 | 'post_author_email' => $survey_current_post_author_email, |
| 497 | 514 | 'post_author_nickname' => $survey_current_post_author_nickname, |
| @@ -1279,8 +1296,11 @@ | ||
| 1279 | 1296 | $ays_survey_protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; |
| 1280 | 1297 | $current_survey_page_link = esc_url( $ays_survey_protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
| 1281 | 1298 | $content[] = '<input type="hidden" name="'. $this->html_name_prefix .'current_page_link" value="'. $current_survey_page_link .'">'; |
| 1282 | 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 | + | |
| 1283 | 1303 | if( !$limit && !$is_expired ){ |
| 1284 | 1304 | $content[] = $this->create_sections( $sections ); |
| 1285 | 1305 | }else{ |
| 1286 | 1306 | if( $is_expired && !$limit ){ |
| @@ -2998,8 +3018,9 @@ | ||
| 2998 | 3018 | |
| 2999 | 3019 | $content[] = ' |
| 3000 | 3020 | #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3001 | 3021 | width: ' . $width . '; |
| 3022 | + box-sizing: border-box; | |
| 3002 | 3023 | } |
| 3003 | 3024 | |
| 3004 | 3025 | #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' .' . $this->html_class_prefix . 'section-header { |
| 3005 | 3026 | border-top-color: ' . $this->options[ $this->name_prefix . 'color' ] . ' !important; |
| @@ -3729,8 +3750,28 @@ | ||
| 3729 | 3750 | } |
| 3730 | 3751 | return $output; |
| 3731 | 3752 | } |
| 3732 | 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 | + | |
| 3733 | 3774 | public function ays_survey_popup_set_cookie(){ |
| 3734 | 3775 | if( isset( $_REQUEST['id'] ) && $_REQUEST['id'] != '' ){ |
| 3735 | 3776 | $id = sanitize_text_field( $_REQUEST['id'] ); |
| 3736 | 3777 | }else{ |
| @@ -3827,9 +3868,9 @@ | ||
| 3827 | 3868 | $question_border_radius = $this->options[ $this->name_prefix . 'question_border_radius_mobile' ]; |
| 3828 | 3869 | $content .= ' |
| 3829 | 3870 | @media screen and (max-width: 640px){ |
| 3830 | 3871 | #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3831 | - max-width: '. $mobile_max_width .'; | |
| 3872 | + max-width: min('. $mobile_max_width .', calc(100vw - 20px)); | |
| 3832 | 3873 | } |
| 3833 | 3874 | |
| 3834 | 3875 | #' . $this->html_class_prefix . 'container-' . $this->unique_id_in_class . ' { |
| 3835 | 3876 | width: ' . $mobile_width . '; |
| @@ -4114,33 +4155,28 @@ | ||
| 4114 | 4155 | // Title border radius mobile |
| 4115 | 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; |
| 4116 | 4157 | |
| 4117 | 4158 | // Width |
| 4118 | - $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'] ) ) : ''; | |
| 4119 | 4160 | // Width by percentage or pixels |
| 4120 | - $popup_survey_width_by = (isset($options['width_by_percentage_px']) && $options['width_by_percentage_px'] != '') ? stripslashes ( esc_attr( $options['width_by_percentage_px'] ) ) : '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'; | |
| 4121 | 4162 | |
| 4122 | - if( $popup_survey_width == '' || absint( $popup_survey_width ) == 0 ){ | |
| 4123 | - $popup_survey_width = '100'; | |
| 4124 | - $popup_survey_width_by = 'percentage'; | |
| 4125 | - } | |
| 4126 | - | |
| 4127 | 4163 | // Mobile width |
| 4128 | 4164 | $options['width_mobile'] = isset($options['width_mobile']) ? $options['width_mobile'] : $popup_survey_width; |
| 4129 | - $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'] ) ) : ''; | |
| 4130 | 4166 | // Mobile width by percentage or pixels |
| 4131 | - $popup_survey_width_mobile_by = (isset($options['width_mobile_by_percentage_px']) && $options['width_mobile_by_percentage_px'] != '') ? stripslashes ( esc_attr( $options['width_mobile_by_percentage_px'] ) ) : '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'; | |
| 4132 | 4168 | |
| 4133 | - if( $popup_survey_width_mobile == '' || absint( $popup_survey_width_mobile ) == 0 ){ | |
| 4134 | - $popup_survey_width_mobile = '100'; | |
| 4135 | - $popup_survey_width_mobile_by = 'percentage'; | |
| 4136 | - } | |
| 4169 | + // Height | |
| 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'; | |
| 4137 | 4173 | |
| 4138 | - // Height | |
| 4139 | - $popup_survey_height = (isset($options['height']) && $options['height'] != '') ? absint ( intval( $options['height'] ) ) : 450; | |
| 4140 | 4174 | // Height mobile |
| 4141 | 4175 | $options['height_mobile'] = isset($options['height_mobile']) ? $options['height_mobile'] : $popup_survey_height; |
| 4142 | - $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'; | |
| 4143 | 4179 | |
| 4144 | 4180 | // Popup Position |
| 4145 | 4181 | $popup_position = (isset($options['popup_position']) && $options['popup_position'] != 'center-center') ? $options['popup_position'] : 'center-center'; |
| 4146 | 4182 | |
| @@ -4195,8 +4231,11 @@ | ||
| 4195 | 4231 | |
| 4196 | 4232 | // Popup selector |
| 4197 | 4233 | $popup_selector = (isset($options["popup_selector"]) && $options["popup_selector"] != "") ? stripslashes( esc_attr($options["popup_selector"])) : ""; |
| 4198 | 4234 | |
| 4235 | + // Popup animation | |
| 4236 | + $popup_animation = (isset($options["popup_animation"]) && $options["popup_animation"] != "") ? esc_attr($options["popup_animation"]) : "none"; | |
| 4237 | + | |
| 4199 | 4238 | // Close by pressing the ESC |
| 4200 | 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'; |
| 4201 | 4240 | |
| 4202 | 4241 | |
| @@ -4268,13 +4307,15 @@ | ||
| 4268 | 4307 | $display_popup_on_load = ''; |
| 4269 | 4308 | break; |
| 4270 | 4309 | } |
| 4271 | 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 | + | |
| 4272 | 4313 | if( ! isset( $_COOKIE[ 'ays_survey_popup_cookie_name_' . $popup['id'] ] ) && ! isset( $_COOKIE[ 'ays_survey_popup_hide_after_click_close_' . $popup['id'] ] ) ){ |
| 4273 | 4314 | if ($show_popup) { |
| 4274 | 4315 | $shortcode2 = '[ays_survey id="'. $popup['survey_id'] .'"]'; |
| 4275 | 4316 | // $popup_survey_view = "<div class='ays-survey-popup-survey-window ays-survey-popup-modal-".$popup['id']."' data-id='".$popup['id']."'> |
| 4276 | - $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."'> | |
| 4277 | 4318 | <div class='ays-survey-popup-btn-close'> |
| 4278 | 4319 | <img class='ays-survey-popup-btn-close-icon' src='". SURVEY_MAKER_PUBLIC_URL ."/images/cross.svg'> |
| 4279 | 4320 | </div>"; |
| 4280 | 4321 | $popup_survey_view .= "<div class='ays-survey-popup-content'>"; |
| @@ -4402,13 +4443,17 @@ | ||
| 4402 | 4443 | } |
| 4403 | 4444 | |
| 4404 | 4445 | $hide_popup_on_mobile_class = $survey_popup_hide_title_on_mobile ? 'display: none;' : ''; |
| 4405 | 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 | + | |
| 4406 | 4450 | $popup_survey_view .= ' |
| 4407 | 4451 | <style> |
| 4408 | 4452 | .ays-survey-popup-modal-' . $popup['id'] . ' { |
| 4409 | - width: ' . $popup_survey_width . ($popup_survey_width_by == 'percentage' ? '%' : 'px') . '; | |
| 4410 | - height: ' . $popup_survey_height . 'px; | |
| 4453 | + width: ' . $popup_width_css . '; | |
| 4454 | + box-sizing: border-box; | |
| 4455 | + height: ' . $popup_height_css . '; | |
| 4411 | 4456 | background-color: ' . $popup_bg_color . '; |
| 4412 | 4457 | top: ' . $ays_survey_popup_conteiner_pos_top . '; |
| 4413 | 4458 | left: ' . $ays_survey_popup_conteiner_pos_left . '; |
| 4414 | 4459 | right: ' . $ays_survey_popup_conteiner_pos_right . '; |
| @@ -4431,10 +4476,11 @@ | ||
| 4431 | 4476 | } |
| 4432 | 4477 | |
| 4433 | 4478 | @media screen and (max-width: 640px){ |
| 4434 | 4479 | div.ays-survey-popup-modal-' . $popup['id'] . ' { |
| 4435 | - width: ' . $popup_survey_width_mobile . ($popup_survey_width_mobile_by == 'percentage' ? '%' : 'px') . '; | |
| 4436 | - 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%') . '; | |
| 4437 | 4483 | background-color: ' . $popup_bg_color_mobile . '; |
| 4438 | 4484 | } |
| 4439 | 4485 | .ays-survey-popup-modal-' . $popup['id'] . ' .ays-survey-popup-title-content{ |
| 4440 | 4486 | font-size: '.$survey_popup_title_mobile_font_size.'px; |
| @@ -4450,8 +4496,50 @@ | ||
| 4450 | 4496 | |
| 4451 | 4497 | </style> |
| 4452 | 4498 | '; |
| 4453 | 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 | + | |
| 4454 | 4542 | $popup_survey_view .= '<script type="text/javascript">'; |
| 4455 | 4543 | |
| 4456 | 4544 | $popup_survey_view .= " |
| 4457 | 4545 | if(typeof aysSurveyPopupsOptions === 'undefined'){ |
| @@ -4465,8 +4553,9 @@ | ||
| 4465 | 4553 | 'popup_close_after_finish_delay' => $survey_popup_close_after_finish_delay, |
| 4466 | 4554 | 'popup_selector' => $popup_selector, |
| 4467 | 4555 | 'popupEnableCloseByEsc' => $survey_popup_enable_close_by_esc, |
| 4468 | 4556 | 'closePopupOverlayOutsideClick' => $close_popup_overlay_outside_click, |
| 4557 | + 'popup_animation' => $popup_animation, | |
| 4469 | 4558 | |
| 4470 | 4559 | ) ) ) . "';"; |
| 4471 | 4560 | $popup_survey_view .= '</script>'; |
| 4472 | 4561 | $popup_survey_view .= '</div>'; |