Changeset 2875971
- Timestamp:
- 03/07/2023 02:07:03 PM (3 years ago)
- Location:
- vedicastroapi/trunk
- Files:
-
- 2 edited
-
public/class-vedic-astro-api-public.php (modified) (1 diff)
-
vedic-astro-api.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vedicastroapi/trunk/public/class-vedic-astro-api-public.php
r2875840 r2875971 4961 4961 $paryantar_mahadasha = isset( $_POST['mahadasha'] ) ? sanitize_text_field( $_POST['mahadasha'] ) : ''; 4962 4962 4963 if ( !empty( $mdad ) && !empty( $mahadasha ) ) { 4964 $maha_antar_dasha = explode( "/", $mdad ); 4965 $paryantardasha_endpoint = "dashas/specific-sub-dasha"; 4966 if ( isset( $_COOKIE['kundali_form_data'] ) ) { 4967 parse_str( $_COOKIE['kundali_form_data'], $form_data ); 4968 $kundali_date = isset( $form_data['kundali-date'] ) ? sanitize_text_field( trim( $form_data["kundali-date"] ) ) : ''; 4969 $kundali_times = isset( $form_data['kundali-time'] ) ? sanitize_text_field( trim( $form_data["kundali-time"] ) ) : ''; 4970 $kundali_time = date( "h:i", strtotime( $kundali_times ) ); 4971 $timezone = isset( $form_data['user_location_timezone'] ) ? floatval( $form_data["user_location_timezone"] ) : VAAPI_LOCATION_TIMEZONE; 4972 $latitude = isset( $form_data['user_location_longitude'] ) ? floatval( $form_data["user_location_longitude"] ) : VAAPI_LOCATION_LONGITUDE; 4973 $longitude = isset( $form_data['user_location_latitude'] ) ? floatval( $form_data["user_location_latitude"] ) : VAAPI_LOCATION_LATITUDE; 4974 $languages = isset( $form_data['lang'] ) ? sanitize_text_field( trim( $form_data["lang"] ) ) : ''; 4975 $api_key = $this->vedicastro_google_api_key(); 4976 $api_data = [ 4977 "dob" => date( "d/m/Y", strtotime( $kundali_date ) ), 4978 "tob" => $kundali_time, 4979 "lat" => $latitude, 4980 "lon" => $longitude, 4981 "tz" => $timezone, 4982 "lang" => $languages, 4983 "api_key" => $api_key 4984 ]; 4985 if ( is_array( $maha_antar_dasha ) && !empty( $maha_antar_dasha ) ) { 4986 if ( $maha_antar_dasha[0] ) { 4987 $api_data["md"] = $maha_antar_dasha[0]; 4963 if ( !empty( $mdad ) && !empty( $paryantar_mahadasha ) ) { 4964 $maha_antar_dasha = explode( "/", $mdad ); 4965 $paryantardasha_endpoint = "dashas/specific-sub-dasha"; 4966 if ( isset( $_COOKIE['kundali_form_data'] ) ) { 4967 parse_str( $_COOKIE['kundali_form_data'], $form_data ); 4968 $kundali_date = isset( $form_data['kundali-date'] ) ? sanitize_text_field( trim( $form_data["kundali-date"] ) ) : ''; 4969 $kundali_times = isset( $form_data['kundali-time'] ) ? sanitize_text_field( trim( $form_data["kundali-time"] ) ) : ''; 4970 $kundali_time = date( "h:i", strtotime( $kundali_times ) ); 4971 $timezone = isset( $form_data['user_location_timezone'] ) ? floatval( $form_data["user_location_timezone"] ) : VAAPI_LOCATION_TIMEZONE; 4972 $latitude = isset( $form_data['user_location_longitude'] ) ? floatval( $form_data["user_location_longitude"] ) : VAAPI_LOCATION_LONGITUDE; 4973 $longitude = isset( $form_data['user_location_latitude'] ) ? floatval( $form_data["user_location_latitude"] ) : VAAPI_LOCATION_LATITUDE; 4974 $languages = isset( $form_data['lang'] ) ? sanitize_text_field( trim( $form_data["lang"] ) ) : ''; 4975 $api_key = $this->vedicastro_google_api_key(); 4976 $api_data = [ 4977 "dob" => date( "d/m/Y", strtotime( $kundali_date ) ), 4978 "tob" => $kundali_time, 4979 "lat" => $latitude, 4980 "lon" => $longitude, 4981 "tz" => $timezone, 4982 "lang" => $languages, 4983 "api_key" => $api_key 4984 ]; 4985 if ( is_array( $maha_antar_dasha ) && !empty( $maha_antar_dasha ) ) { 4986 if ( $maha_antar_dasha[0] ) { 4987 $api_data["md"] = $maha_antar_dasha[0]; 4988 } 4989 if ( $maha_antar_dasha[1] ) { 4990 $api_data["ad"] = $maha_antar_dasha[1]; 4991 } 4988 4992 } 4989 if ( $maha_antar_dasha[1] ) { 4990 $api_data["ad"] = $maha_antar_dasha[1]; 4993 4994 $get_antardasha_data = $this->vedicastro_mahadasha_api( 4995 $paryantardasha_endpoint, 4996 $api_data 4997 ); 4998 4999 if ( is_array( $get_antardasha_data ) && $get_antardasha_data['status'] == 200 && !empty( $get_antardasha_data['response'] ) ) { 5000 5001 $html .= sprintf( __('<table class="lagan_birth_table_data mahadasha_hover_data" border="1"><thead><tr><th><span class="fw-700 lh-20 fs-14 clr-black1">%s</span></th><th><span class="fw-700 lh-20 fs-14 clr-black1">%s</span></th></tr></thead><tbody>', 'vedic-astro-api' ), __('Paryantar Dasha', 'vedic-astro-api'), __('End Dates', 'vedic-astro-api') ); 5002 5003 foreach ( $get_antardasha_data['response']['paryantardasha'] as $key => $paryantar_dasha ) { 5004 5005 $html .= sprintf( __('<tr><td><span class="fw-400 lh-20 fs-14 clr-black1">%s/%s</span></td><td><span class="fw-400 lh-20 fs-14 clr-black1">%s</span></td></tr>', 'vedic-astro-api' ), esc_html( $paryantar_mahadasha ), esc_html( $paryantar_dasha['name'] ), esc_html( $paryantar_dasha['end'] ) ); 5006 5007 } 5008 5009 $html .= sprintf( __('</tbody></table>', 'vedic-astro-api' ) ); 5010 5011 echo json_encode( [ "status" => "success", "pratyantar_res" => $html, 'mdad' => $mdad ] ); 5012 5013 wp_die(); 5014 5015 } else { 5016 5017 echo json_encode( [ "status" => "false", "pratyantar_res" => __( "No result found", 'vedic-astro-api') ] ); 5018 5019 wp_die(); 5020 4991 5021 } 5022 } else{ 5023 5024 echo json_encode( [ "status" => "false", "pratyantar_res" => __( "Something went wrong", 'vedic-astro-api') ] ); 5025 5026 wp_die(); 4992 5027 } 4993 5028 4994 $get_antardasha_data = $this->vedicastro_mahadasha_api( 4995 $paryantardasha_endpoint, 4996 $api_data 4997 ); 4998 4999 if ( is_array( $get_antardasha_data ) && $get_antardasha_data['status'] == 200 && !empty( $get_antardasha_data['response'] ) ) { 5000 5001 $html .= sprintf( __('<table class="lagan_birth_table_data mahadasha_hover_data" border="1"><thead><tr><th><span class="fw-700 lh-20 fs-14 clr-black1">%s</span></th><th><span class="fw-700 lh-20 fs-14 clr-black1">%s</span></th></tr></thead><tbody>', 'vedic-astro-api' ), __('Paryantar Dasha', 'vedic-astro-api'), __('End Dates', 'vedic-astro-api') ); 5002 5003 foreach ( $get_antardasha_data['response']['paryantardasha'] as $key => $paryantar_dasha ) { 5004 5005 $html .= sprintf( __('<tr><td><span class="fw-400 lh-20 fs-14 clr-black1">%s/%s</span></td><td><span class="fw-400 lh-20 fs-14 clr-black1">%s</span></td></tr>', 'vedic-astro-api' ), esc_html( $paryantar_mahadasha ), esc_html( $paryantar_dasha['name'] ), esc_html( $paryantar_dasha['end'] ) ); 5006 5007 } 5008 5009 $html .= sprintf( __('</tbody></table>', 'vedic-astro-api' ) ); 5010 5011 echo json_encode( [ "status" => "success", "pratyantar_res" => $html, 'mdad' => $mdad ] ); 5012 5013 wp_die(); 5014 5015 } else { 5016 5017 echo json_encode( [ "status" => "false", "pratyantar_res" => __( "No result found", 'vedic-astro-api') ] ); 5018 5019 wp_die(); 5020 5021 } 5029 } else{ 5030 5031 echo json_encode( [ "status" => "false", "pratyantar_res" => __( "Something went wrong", 'vedic-astro-api') ] ); 5032 5033 wp_die(); 5022 5034 } 5023 5024 }5025 5026 echo json_encode( [ "status" => "false", "pratyantar_res" => __( "Something went wrong", 'vedic-astro-api') ] );5027 5028 wp_die();5029 5035 5030 5036 } -
vedicastroapi/trunk/vedic-astro-api.php
r2875840 r2875971 18 18 * Description: Horoscope and Astrology is the first vedic astrology plugin that lets you generate horoscope reports based on the birth details. 19 19 * Version: 1.0.0 20 * Author: Vedic Astro API , Ravi Yadav, Soham Web Solution20 * Author: Vedic Astro API 21 21 * Author URI: https://sohamsolution.com 22 22 * License: GPLv3
Note: See TracChangeset
for help on using the changeset viewer.