PATH:
home
/
letacommog
/
laindinois
/
OLD
/
wp-content
/
plugins
/
downtown-rest-api
/
classes
<?php /*Sonu Code Here*/ // Fetch users leads & activities if ( ! function_exists( 'dwt_listing_fetch_leads_activities_app' ) ) { function dwt_listing_fetch_leads_activities_app($user_id) { global $wpdb; $response = ''; $likes = array(1 => esc_html__('Like','downtown'),2 => esc_html__('Love','downtown'),3 => esc_html__('Wow','downtown'),4 => esc_html__('Angry','downtown')); $emotion_icons = array(1 => 'like',2 => 'love',3 => 'emoji',4 => 'dislike'); $leads = array('contact' => esc_html__('Contact No','downtown'),'web' => esc_html__('Website Link','downtown')); $leads_icons = array('contact' => 'mobile','web' => 'globle'); $query_args = array( 'author' => $user_id, 'post_type' => 'listing' , 'post_status' => 'publish' ); $query = new WP_Query( $query_args ); $listing_id = ''; if ( $query->have_posts() ) { while($query->have_posts()) { $query->the_post(); $listing_id .= get_the_ID() .','; } } $listing_id = rtrim($listing_id,","); if(!empty($listing_id)) { $results = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE meta_key LIKE '_activity_%' AND post_id IN ($listing_id) ORDER BY meta_id DESC LIMIT 0,30" ); if(is_array($results) && count($results) > 0) { foreach($results as $result) { $post_id = $result->post_id; $user_name = ''; $icon = ''; $statement = ''; $profile_url =''; $get_time = ''; $get_time = explode('_',$result->meta_value); $activity_time = $get_time[0]; $activity_value = $get_time[1]; $activity_time = strtotime($activity_time); $reaction = (isset($likes[$activity_value])) ? $likes[$activity_value] : ''; $get_uid = explode('_', $result->meta_key); $get_uid[4]; $user = get_user_by('id', $get_uid[4]); if ( ! empty( $user ) ) { $user_name = $user->display_name; $profile_url = get_author_posts_url($get_uid[4]).'?type=listings'; } else { $user_name = esc_html__('Someone','downtown'); $profile_url = ''; } $on = esc_html__(' on','downtown'); $clicked = esc_html__('clicked your ','downtown'); $reacted = esc_html__('reacted as ','downtown'); $ago = esc_html__(' ago','downtown'); $type = ''; if (strpos($result->meta_key, 'leads_userid_unknown')) { $icon = 'bell'; $reaction = (isset($leads[$activity_value])) ? $leads[$activity_value] : ''; $statement = $clicked . $reaction .$on; } else if (strpos($result->meta_key, 'rating')) { $icon = 'star'; $statement = __('posted a Rating on','downtown'); } else if (strpos($result->meta_key, 'comments')) { // $type = 'comments'; $icon = 'comment'; $statement = __('post a Comment on','downtown'); } else if (strpos($result->meta_key, 'like')) { $icon = (isset($emotion_icons[$activity_value])) ? $emotion_icons[$activity_value] : ''; $statement = $reacted. $reaction .$on; } else if (strpos($result->meta_key, 'leads')) { $icon = (isset($leads_icons[$activity_value])) ? $leads_icons[$activity_value] : ''; $reaction = (isset($leads[$activity_value])) ? $leads[$activity_value] : ''; $statement = $clicked .$reaction .$on; } $lead_activities[] = array( "user_name" => $user_name, "profile_link" => $profile_url, "listing_title" => get_the_title($post_id) , "listing_link" => get_the_permalink($post_id), "statement" => $statement, "icon_type" => $icon, "activity_time" => human_time_diff($activity_time, current_time('timestamp') ) . $ago ); } $data['lead_activities'] = $lead_activities; $response = array( 'success' => true, 'data' => $data , 'message' => ''); wp_reset_postdata(); return $response; } else { $response = array( 'success' => false, 'data' => '' , 'message' => __("Recent activities about your listings will be here!", "dwt-listing-api") ); return $response; } } else { $response = array( 'success' => false, 'data' => '' , 'message' => __("Recent activities about your listings will be here!", "dwt-listing-api") ); return $response; } } } //Fetch all Listings if ( ! function_exists( 'dwt_listing_fetch_owner_listings_inapp' ) ) { function dwt_listing_fetch_owner_listings_inapp($listing_status, $paged = '', $user_id) { $response = ''; $meta_query_args = $listingz = array(); $meta_key = ''; $meta_value = ''; $meta_compare = '='; if($listing_status == 'publish') { $listing_status = 'publish'; $meta_query_args = array(array('key'=>'dwt_listing_listing_status','value' => 1,'compare' => '=')); } else if($listing_status == 'pending') { $listing_status = 'pending'; } else if($listing_status == 'featured') { $listing_status = 'publish'; $meta_key = 'dwt_listing_is_feature'; $meta_value = '1'; } else if($listing_status == 'expired') { $listing_status = 'publish'; $meta_key = 'dwt_listing_listing_status'; $meta_value = '0'; } else { $listing_status = 'publish'; $meta_query_args = array(array('key'=>'dwt_listing_listing_status','value' => 1,'compare' => '=')); } $args = array ( 'post_type' => 'listing', 'author' => $user_id, 'post_status' => $listing_status, //'posts_per_page' => get_option( 'posts_per_page' ), 'posts_per_page' => 1, //'paged' => $paged, 'order'=> 'DESC', 'orderby' => 'date', 'meta_key' => $meta_key , 'meta_value' =>$meta_value, 'meta_query' => $meta_query_args ); $my_listings = new WP_Query( $args ); if ( $my_listings->have_posts() ) { $lists = array(); $pieces = $category_name = $categor_id = $listing_cats = $total_leads = $contact_leads = $web_leads = $total_views = $status_type = $b_status = $is_featured = ''; 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); 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','downtown'); } if($status_type == 1) { $b_status = esc_html__('Open Now','downtown'); } if($status_type == 2) { $b_status = esc_html__('Always Open','downtown'); } } if(get_post_meta( $listing_id, '_dowtown_web_leads',true) !="") { $web_leads = get_post_meta( $listing_id, '_dowtown_web_leads',true); } if(get_post_meta( $listing_id, '_dowtown_contact_leads',true) !="") { $contact_leads = get_post_meta( $listing_id, '_dowtown_contact_leads',true); } if($web_leads != 0 && $contact_leads !=0) { $total_leads = $web_leads + $contact_leads; } $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]; } 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" => $category_name , "listing_title" => get_the_title($listing_id) , "listing_link" => get_the_permalink($listing_id), "image" => dwt_listing_return_listing_idz($media,'downtown-mylistings'), "is_featured" => $is_featured, "business_hours_status" => $b_status, "total_views" => $total_views, "web_clicks" => $web_leads, "contact_clicks" => $contact_leads, "total_click" => $total_leads, ); } wp_reset_postdata(); } $lists['has_list'] = (count((array) $listingz) > 0) ? true : false; if(count((array) $listingz) > 0) { $lists['listing'] = $listingz; } else { $lists['message'] = __("You don't have any listing", "dwt-listing-api"); } return $lists; } } //Return Profile Data if (!function_exists('dwt_listing_basic_profile_data')){ function dwt_listing_basic_profile_data($user_id = '') { if( $user_id == "" ) { $user = wp_get_current_user(); $user_id = $user->ID; } else { $user = get_userdata( $user_id ); } if(!$user_id) return ''; $profile_arr['id'] = $user_id; $profile_arr['name'] = $user->display_name; $profile_arr['email'] = $user->user_email; $profile_arr['street_address'] = get_user_meta($user_id, 'd_user_location', true ); $profile_arr['phone_no'] = get_user_meta($user_id, 'd_user_contact', true ); $profile_arr['user_timezone'] = get_user_meta($user_id, 'd_user_timezone', true ); $profile_arr['about_user'] = get_user_meta($user_id, 'd_about_user', true ); $profile_arr['fb_link'] = get_user_meta($user_id, 'd_fb_link', true ); $profile_arr['google_link'] = get_user_meta($user_id, 'd_google_link', true ); $profile_arr['twitter_link'] = get_user_meta($user_id, 'd_twitter_link', true ); $profile_arr['linkedin_link'] = get_user_meta($user_id, 'd_linked_link', true ); $profile_arr['profile_img'] = dwt_listing_get_user_dp($user_id,'downtown-user-dp'); /*all active ads*/ //publish listings $ads_total_text = __("All Listings", "dwt-listing-api"); $profile_arr['all_listings'] = $ads_total_text . ' ' . '('. dwt_listing_listing_total_count('publish','dwt_listing_listing_status','1',$user_id) .')'; //pending listings $pending_text = __("Pending Listings", "dwt-listing-api"); $profile_arr['pending_listings'] = $pending_text . ' ' . '('. dwt_listing_listing_total_count('pending','dwt_listing_listing_status','1',$user_id) .')'; $profile_arr['pending_listings_msg'] = __('Waiting for admin approval.','dwt-listing-api'); //featured listings $featured_text = __("Featured Listings", "dwt-listing-api"); $profile_arr['featured_listings'] = $featured_text . ' ' . '('. dwt_listing_listing_total_count('publish','dwt_listing_is_feature','1',$user_id) .')'; //featured listings $expired_text = __("Expired Listings ", "dwt-listing-api"); $profile_arr['expired_listings'] = $expired_text . ' ' . '('. dwt_listing_listing_total_count('publish','dwt_listing_listing_status','0',$user_id) .')'; return $profile_arr; } } //Fetch all bookmarks listings if (!function_exists('dwt_listing_fetch_bookmark_listings')) { function dwt_listing_fetch_bookmark_listings_inapp($user_id,$paged = '') { global $wpdb; $rows = $wpdb->get_results( "SELECT meta_value FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key LIKE 'dwt_listing_fav_listing_id%'" ); $listing_idz = array(0); foreach( $rows as $row ) { $listing_idz[] = $row->meta_value; } $args = array( 'post_type' => 'listing', 'post__in' => $listing_idz, 'post_status' => 'publish', 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => $paged, 'order'=> 'DESC', 'orderby' => 'ID' ); return $args; } }
[+]
..
[-] 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]