PATH:
home
/
letacommog
/
laindinois
/
OLD
/
wp-content
/
plugins
/
downtown-rest-api
/
classes
<?php add_action( 'rest_api_init', 'dwt_listing_author_detail', 0 ); function dwt_listing_author_detail() { register_rest_route( 'downtown/app', '/author-detial/', array( 'methods' => WP_REST_Server::EDITABLE, 'callback' => 'dwt_listing_get_auth_public', 'permission_callback' => function () { return dwt_listing_basic_auth(); }, ) ); } // Listing Detial Service if (!function_exists('dwt_listing_get_auth_public')) { function dwt_listing_get_auth_public($request) { global $dwt_listing_api; //listings $eventz = $listingz = $params = array(); $has_next_pagez = $lastpagez = $nextz = $has_next_page = $lastpage = $next = ''; $params = $request->get_json_params(); $event_limit = $limit = 10; if(isset($dwt_listing_api['app_listing_public_auth_page']) && $dwt_listing_api['app_listing_public_auth_page'] !="") { $limit = $dwt_listing_api['app_listing_public_auth_page']; } if(isset($dwt_listing_api['app_listing_public_auth_events']) && $dwt_listing_api['app_listing_public_auth_events'] !="") { $event_limit = $dwt_listing_api['app_listing_public_auth_events']; } $event_page = $listing_page = 1; if(!empty($params['listing_next_page'])) { $listing_page = $params['listing_next_page']; } if(!empty($params['event_next_page'])) { $event_page = $params['event_next_page']; } if( isset( $params['user_id'] ) && $params['user_id'] != "" ) { $user_id = $params['user_id']; $data['tab_listing'] = esc_html__('Listings','dwt-listing-api'); $data['tab_events'] = esc_html__('Events','dwt-listing-api'); $data['about'] = esc_html__('About','dwt-listing-api'); $get_email = $get_contact = $get_loc = $get_user_name = $get_user_dp = ''; $get_user_dp = dwt_listing_fetch_comment_poster($user_id,'dp'); $get_user_name = dwt_listing_fetch_comment_poster($user_id,'name'); $get_loc = dwt_listing_fetch_comment_poster($user_id,'location'); $get_contact = dwt_listing_fetch_comment_poster($user_id,'contact'); $get_email = dwt_listing_fetch_comment_poster($user_id,'email'); $data['user_img'] = $get_user_dp; $data['user_name'] = $get_user_name; $data['user_loc'] = $get_loc; $data['user_contact'] = $get_contact; $data['user_email'] = $get_email; $linkedin = $google = $twitter = $fb = ''; if(get_user_meta($user_id, 'd_fb_link' , true ) != '') { $fb = get_user_meta($user_id, 'd_fb_link' , true ); } if(get_user_meta($user_id, 'd_twitter_link' , true ) != '') { $twitter = get_user_meta($user_id, 'd_twitter_link' , true ); } if(get_user_meta($user_id, 'd_google_link' , true ) != '') { $google = get_user_meta($user_id, 'd_google_link' , true ); } if(get_user_meta($user_id, 'd_linked_link' , true ) != '') { $linkedin = get_user_meta($user_id, 'd_linked_link' , true ); } $about = ''; if(get_user_meta($user_id, 'd_about_user' , true ) != '') { $about = get_user_meta($user_id, 'd_about_user' , true ); } $data['about_desc'] = $about; $data['social_links']['fb'] = $fb; $data['social_links']['twitter'] = $twitter; $data['social_links']['google'] = $google; $data['social_links']['linkedin'] = $linkedin; $data['no_more'] = esc_html__('No more events','dwt-listing-api'); $data['from'] = esc_html__('From ','dwt-listing-api'); $data['to'] = esc_html__('To ','dwt-listing-api'); $data['venue'] = esc_html__('Venue ','dwt-listing-api'); //Author Listings $args = array ( 'post_type' => 'listing', 'author' => $user_id, 'post_status' => 'publish', 'posts_per_page' => $limit, 'order'=> 'DESC', 'orderby' => 'date', 'meta_query' => array('key'=>'dwt_listing_listing_status','value' => 1,'compare' => '='), 'paged' => $listing_page, ); $my_listings = new WP_Query($args); if ( $my_listings->have_posts() ) { $color_code = $pieces = $category_name = $categor_id = $listing_cats = $total_views = $status_type = $b_status = $is_featured = ''; $toal_results = ''; $toal_results = esc_attr($my_listings->found_posts); $data['total_listings'] = $toal_results . esc_html__(" Results found ", "dwt-listing-api"); $data['no_more'] = esc_html__('No more listings','dwt-listing-api'); while($my_listings->have_posts()) { $my_listings->the_post(); $listing_id = get_the_ID(); $media = dwt_listing_fetch_listing_gallery($listing_id); $is_featured = dwt_listing_is_listing_featured_app($listing_id); $get_percentage = dwt_listing_fetch_reviews_average($listing_id); if(isset($get_percentage) && count((array)$get_percentage['ratings']) > 0 && count((array)$get_percentage['rated_no_of_times']) > 0) { $rating_stars = $get_percentage['rated_no_of_times']; $average = $get_percentage['average']; } if(dwt_listing_business_hours_status($listing_id) !="") { $status_type = dwt_listing_business_hours_status($listing_id); if($status_type == 0) { $b_status = esc_html__('Closed','dwt-listing-api'); $color_code = '#c00'; } else if($status_type == 2) { $b_status = esc_html__('Always Open','dwt-listing-api'); $color_code = '#fc0'; } else { $b_status = esc_html__('Open Now','dwt-listing-api'); $color_code = '#25a25a'; } } $listing_cats = dwt_listing_listing_assigned_cats_app($listing_id); if(count((array) $listing_cats) > 0 && !empty($listing_cats)) { $pieces = explode(',', $listing_cats); $categor_id = $pieces[0]; $category_name = $pieces[1]; } $rated = get_comment_meta($listing_id, 'review_stars', true); if( function_exists('pvc_get_post_views') ) $total_views = pvc_get_post_views( $listing_id); $listingz[] = array( "listing_id" => $listing_id, "category_id" => $categor_id, "category_name" => dwt_listing_convert_uniText($category_name), "listing_title" => dwt_listing_convert_uniText(get_the_title($listing_id)), "image" => dwt_listing_return_listing_idz($media,'dwt_listing_list-view1'), "is_featured" => $is_featured, "business_hours_status" => $b_status, "color_code" => $color_code, "rating_stars" => $rating_stars, "rating_avg" => $average, "total_views" => $views . $total_views, "posted_date" => $posted_on . get_the_date(get_option('date_format'),$listing_id), ); } wp_reset_postdata(); } $data['has_listings'] = (count((array) $listingz) > 0) ? true : false; if(count((array) $listingz) > 0) { $data['listing'] = $listingz; //listing pagination $next = $listing_page + 1; $lastpage = ceil($my_listings->found_posts/$limit); $has_next_page = ($next <= (int)$lastpage) ? true : false; $data['listing_pagination'] = array("total_listings" => $my_listings->found_posts, "current_page" => (int)$listing_page, "next_page" => (int)$next, "has_next_page" => $has_next_page ); } else { $data['listing_message'] = __("No Listing Yet!", "dwt-listing-api"); } //Author Events $event_args = array(array('key'=>'dwt_listing_event_status','value' => 1,'compare' => '=')); $args_events = array ( 'post_type' => 'events', 'author' => $user_id, 'posts_per_page' => $event_limit, 'post_status' => 'publish', 'paged' => $event_page, 'order'=> 'DESC', 'orderby' => 'date', 'meta_query' => $event_args ); $my_events = new WP_Query($args_events); if ($my_events->have_posts()) { while($my_events->have_posts() ) { $my_events->the_post(); $event_id = get_the_ID(); $media = dwt_listing_fetch_event_gallery($event_id); $event_start_date = get_post_meta($event_id, 'dwt_listing_event_start_date', true ); $event_end_date = get_post_meta($event_id, 'dwt_listing_event_end_date', true ); $event_venue = get_post_meta($event_id, 'dwt_listing_event_venue', true); $eventz_cats = dwt_listing_events_assigned_cats_app($event_id); if(count((array) $eventz_cats) > 0 && !empty($eventz_cats)) { $pieces = explode(',', $eventz_cats); $categor_id = $pieces[0]; $category_name = $pieces[1]; } if($event_start_date !="" && $event_end_date !="") { $event_start = date_i18n( get_option( 'date_format'), strtotime( $event_start_date ) ); $event_end = date_i18n( get_option( 'date_format'), strtotime( $event_end_date ) ); } $eventz[] = array( "event_id" => $event_id, "event_category_id" => $categor_id, "event_category_name" => dwt_listing_convert_uniText($category_name), "event_title" => dwt_listing_convert_uniText(get_the_title($event_id)), "image" => dwt_listing_return_event_idz($media,'dwt_listing_locations-thumb'), "event_loc" => $event_venue, "event_start_date" => $event_start, "event_end_date" => $event_end, ); } } $data['has_events'] = false; if(count((array) $eventz) > 0) { $data['has_events'] = true; $data['events'] = $eventz; $nextz = $event_page + 1; $lastpagez = ceil($my_events->found_posts/$event_limit); $has_next_pagez = ($nextz <= (int)$lastpagez) ? true : false; $data['event_pagination'] = array("total_events" => $my_events->found_posts, "current_page" => (int)$event_page, "next_page" => (int)$nextz, "has_next_event_page" => $has_next_pagez ); } else { $data['events_message'] = __("No Event Yet!", "dwt-listing-api"); } return $response = array('success' => true, 'data' => $data, 'message'=>''); } else { $msg = esc_html__("No result found.", "dwt-listing-api"); return $response = array('success' => false, 'data' => '', 'message' => $msg); } } }
[+]
..
[-] profile.php
[edit]
[-] listing-search.php
[edit]
[-] register.php
[edit]
[-] blog.php
[edit]
[-] reviews.php
[edit]
[-] login.php
[edit]
[+]
payments
[-] event-detail.php
[edit]
[-] author-listings.php
[edit]
[-] packages.php
[edit]
[-] categories.php
[edit]
[+]
packages
[-] events-search.php
[edit]
[-] fetch_data.php
[edit]
[-] home.php
[edit]
[-] listing-detail.php
[edit]
[+]
submit-listing
[+]
profile
[-] forget.php
[edit]
[-] settings.php
[edit]
[-] events.php
[edit]