| @@ -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 ){ |
| @@ -3729,8 +3749,28 @@ | ||
| 3729 | 3749 | } |
| 3730 | 3750 | } |
| 3731 | 3751 | return $output; |
| 3732 | 3752 | } |
| 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 | + } | |
| 3733 | 3773 | |
| 3734 | 3774 | public function ays_survey_popup_set_cookie(){ |
| 3735 | 3775 | if( isset( $_REQUEST['id'] ) && $_REQUEST['id'] != '' ){ |
| 3736 | 3776 | $id = sanitize_text_field( $_REQUEST['id'] ); |