/**
 * Customise the search price range in the search widget/shortcode
 *
 */
function rec_epl_listing_search_price_sale_range()
{
    // Check to make sure Easy Property Listings is active
    // so that the epl_currency_formatted_amount function works
    if (!class_exists('Easy_Property_Listings')) {
        return;
    }
    $prices_arr = array(100000 => epl_currency_formatted_amount(100000), 150000 => epl_currency_formatted_amount(150000), 250000 => epl_currency_formatted_amount(250000), 300000 => epl_currency_formatted_amount(300000), 350000 => epl_currency_formatted_amount(350000), 400000 => epl_currency_formatted_amount(400000), 450000 => epl_currency_formatted_amount(450000), 500000 => epl_currency_formatted_amount(500000), 550000 => epl_currency_formatted_amount(550000), 600000 => epl_currency_formatted_amount(600000), 650000 => epl_currency_formatted_amount(650000), 700000 => epl_currency_formatted_amount(700000), 750000 => epl_currency_formatted_amount(750000), 800000 => epl_currency_formatted_amount(800000), 850000 => epl_currency_formatted_amount(850000), 900000 => epl_currency_formatted_amount(900000), 950000 => epl_currency_formatted_amount(950000), 1000000 => epl_currency_formatted_amount(1000000), 1500000 => epl_currency_formatted_amount(1500000), 10000000 => epl_currency_formatted_amount(10000000) . '+');
    return $prices_arr;
}
 public function get_property_bond()
 {
     if ($this->post_type != 'rental') {
         return;
     }
     $bond_position = apply_filters('epl_property_bond_position', 'after');
     if ($this->get_property_meta('property_bond') != '' && $bond_position == 'before') {
         return $this->label_bond . ' ' . epl_currency_formatted_amount($this->get_property_meta('property_bond'));
     } elseif ($this->get_property_meta('property_bond') != '') {
         return epl_currency_formatted_amount($this->get_property_meta('property_bond')) . ' ' . $this->label_bond;
     }
 }
 }
 $property_com_authority = '';
 if (isset($meta['property_com_authority'])) {
     if (isset($meta['property_com_authority'][0])) {
         $property_com_authority = $meta['property_com_authority'][0];
     }
 }
 $property_com_exclusivity = '';
 if (isset($meta['property_com_exclusivity'])) {
     if (isset($meta['property_com_exclusivity'][0])) {
         $property_com_exclusivity = $meta['property_com_exclusivity'][0];
     }
 }
 // Rental Price XE Format
 if ($property_com_rent != '') {
     $property_com_rent = epl_currency_formatted_amount($property_com_rent);
 }
 // Commercial / Business Features
 $property_com_is_multiple = '';
 if (isset($meta['property_com_is_multiple'])) {
     if (isset($meta['property_com_is_multiple'][0])) {
         $property_com_is_multiple = $meta['property_com_is_multiple'][0];
     }
 }
 $property_com_rent_range_min = '';
 if (isset($meta['property_com_rent_range_min'])) {
     if (isset($meta['property_com_rent_range_min'][0])) {
         $property_com_rent_range_min = $meta['property_com_rent_range_min'][0];
     }
 }
 $property_com_rent_range_max = '';
    /**
     * Manage Admin Business Post Type Columns: Row Contents
     *
     * @since 1.0
     */
    function epl_manage_business_columns_value($column, $post_id)
    {
        global $post, $property, $epl_settings;
        switch ($column) {
            /* If displaying the 'Featured' image column. */
            case 'property_thumb':
                do_action('epl_manage_listing_column_property_thumb_before');
                do_action('epl_manage_listing_column_property_thumb');
                do_action('epl_manage_listing_column_property_thumb_after');
                break;
            case 'listing':
                /* Get the post meta. */
                $property_address_suburb = get_the_term_list($post->ID, 'location', '', ', ', '');
                $heading = get_post_meta($post_id, 'property_heading', true);
                $category = get_post_meta($post_id, 'property_commercial_category', true);
                $homeopen = get_post_meta($post_id, 'property_inspection_times', true);
                $outgoings = get_post_meta($post_id, 'property_com_outgoings', true);
                $return = get_post_meta($post_id, 'property_com_return', true);
                $land = get_post_meta($post_id, 'property_land_area', true);
                $land_unit = get_post_meta($post_id, 'property_land_area_unit', true);
                if (empty($heading)) {
                    echo '<strong>' . __('Important! Set a Heading', 'epl') . '</strong>';
                } else {
                    echo '<div class="type_heading"><strong>', $heading, '</strong></div>';
                }
                if (!empty($category)) {
                    echo '<div class="epl_meta_category">Category: ', $category, '</div>';
                }
                echo '<div class="type_suburb">', $property_address_suburb, '</div>';
                if (!empty($outgoings)) {
                    echo '<div class="epl_meta_outgoings">Outgoings: ', epl_currency_formatted_amount($outgoings), '</div>';
                }
                if (!empty($return)) {
                    echo '<div class="epl_meta_baths">Return: ', $return, '%</div>';
                }
                if (!empty($land)) {
                    echo '<div class="epl_meta_land_details">';
                    echo '<span class="epl_meta_land">Land: ', $land, '</span>';
                    echo '<span class="epl_meta_land_unit"> ', $land_unit, '</span>';
                    echo '</div>';
                }
                if (!empty($homeopen)) {
                    $homeopen = array_filter(explode("\n", $homeopen));
                    $homeopen_list = '<ul class="epl_meta_home_open">';
                    foreach ($homeopen as $num => $item) {
                        $homeopen_list .= '<li>' . htmlspecialchars($item) . '</li>';
                    }
                    $homeopen_list .= '</ul>';
                    echo '<div class="epl_meta_home_open_label"><span class="home-open"><strong>' . $epl_settings['label_home_open'] . '</strong></span>', $homeopen_list, '</div>';
                }
                break;
                /* If displaying the 'Listing ID' column. */
            /* If displaying the 'Listing ID' column. */
            case 'listing_id':
                do_action('epl_manage_listing_column_listing_id_before');
                do_action('epl_manage_listing_column_listing_id');
                do_action('epl_manage_listing_column_listing_id_after');
                break;
                /* If displaying the 'Geocoding' column. */
            /* If displaying the 'Geocoding' column. */
            case 'geo':
                do_action('epl_manage_listing_column_geo_before');
                do_action('epl_manage_listing_column_geo');
                do_action('epl_manage_listing_column_geo_after');
                break;
                /* If displaying the 'Price' column. */
            /* If displaying the 'Price' column. */
            case 'property_price':
                $price = get_post_meta($post_id, 'property_price', true);
                $view = get_post_meta($post_id, 'property_price_view', true);
                $property_under_offer = get_post_meta($post_id, 'property_under_offer', true);
                $lease = get_post_meta($post_id, 'property_com_rent', true);
                $lease_period = get_post_meta($post_id, 'property_com_rent_period', true);
                $lease_date = get_post_meta($post_id, 'property_com_lease_end_date', true);
                $max_price = '2000000';
                if (isset($epl_settings['epl_max_graph_sales_price'])) {
                    $max_price = (int) $epl_settings['epl_max_graph_sales_price'];
                }
                $property_status = ucfirst(get_post_meta($post_id, 'property_status', true));
                $property_authority = get_post_meta($post_id, 'property_authority', true);
                $sold_price = get_post_meta($post_id, 'property_sold_price', true);
                if (!empty($property_under_offer) && 'yes' == $property_under_offer) {
                    $class = 'bar-under-offer';
                } elseif ($property_status == 'Current') {
                    $class = 'bar-home-open';
                } elseif ($property_status == 'Sold' || $property_status == 'Leased') {
                    $class = 'bar-home-sold';
                } else {
                    $class = '';
                }
                if ($sold_price != '') {
                    $barwidth = $max_price == 0 ? 0 : $sold_price / $max_price * 100;
                } else {
                    $barwidth = $max_price == 0 ? 0 : $price / $max_price * 100;
                }
                echo '
					<div class="epl-price-bar ' . $class . '">
						<span style="width:' . $barwidth . '%"></span>
					</div>';
                if (!empty($property_under_offer) && 'yes' == $property_under_offer) {
                    echo '<div class="type_under_offer">' . $property->label_under_offer . '</div>';
                }
                if (empty($view)) {
                    echo '<div class="epl_meta_search_price">' . __('Sale', 'epl') . ': ', epl_currency_formatted_amount($price), '</div>';
                } else {
                    echo '<div class="epl_meta_price">', $view, '</div>';
                }
                if (!empty($lease)) {
                    if (empty($lease_period)) {
                        $lease_period = 'annual';
                    }
                    echo '<div class="epl_meta_lease_price">Lease: ', epl_currency_formatted_amount($lease), ' ', epl_listing_load_meta_commercial_rent_period_value($lease_period), '</div>';
                }
                if (!empty($lease_date)) {
                    echo '<div class="epl_meta_lease_date">' . __('Lease End', 'epl') . ': ', $lease_date, '</div>';
                }
                if ($property_authority == 'auction') {
                    _e('Auction ', 'epl');
                    echo '<br>' . $property->get_property_auction(true);
                }
                break;
                /* If displaying the 'Commercial Listing Type' column. */
            /* If displaying the 'Commercial Listing Type' column. */
            case 'listing_type':
                /* Get the post meta. */
                $listing_type = get_post_meta($post_id, 'property_com_listing_type', true);
                /* If no duration is found, output a default message. */
                if (!empty($listing_type)) {
                    echo $listing_type;
                }
                break;
                /* If displaying the 'property_status' column. */
            /* If displaying the 'property_status' column. */
            case 'property_status':
                do_action('epl_manage_listing_column_property_status_before');
                do_action('epl_manage_listing_column_property_status');
                do_action('epl_manage_listing_column_property_status_after');
                break;
            case 'agent':
                do_action('epl_manage_listing_column_agent_before');
                do_action('epl_manage_listing_column_agent');
                do_action('epl_manage_listing_column_agent_after');
                break;
                /* Just break out of the switch statement for everything else. */
            /* Just break out of the switch statement for everything else. */
            default:
                break;
        }
    }
Exemplo n.º 5
0
function epl_manage_listing_column_price_callback()
{
    global $post, $property, $epl_settings;
    $price = get_post_meta($post->ID, 'property_price', true);
    $view = get_post_meta($post->ID, 'property_price_view', true);
    $property_status = ucfirst(get_post_meta($post->ID, 'property_status', true));
    $property_authority = get_post_meta($post->ID, 'property_authority', true);
    $sold_price = get_post_meta($post->ID, 'property_sold_price', true);
    $property_under_offer = get_post_meta($post->ID, 'property_under_offer', true);
    $lease = get_post_meta($post->ID, 'property_com_rent', true);
    $lease_period = get_post_meta($post->ID, 'property_com_rent_period', true);
    $lease_date = get_post_meta($post->ID, 'property_com_lease_end_date', true);
    $d_bond = '';
    $bond = '';
    $max_price = '2000000';
    if (isset($epl_settings['epl_max_graph_sales_price'])) {
        $max_price = (int) $epl_settings['epl_max_graph_sales_price'];
    }
    /* Rental Listing Type Custom Values */
    if ('rental' == $post->post_type) {
        $price = get_post_meta($post->ID, 'property_rent', true);
        $view = get_post_meta($post->ID, 'property_rent_view', true);
        $d_bond = $epl_settings['display_bond'];
        $bond = get_post_meta($post->ID, 'property_bond', true);
        $max_price = '2000';
        if (isset($epl_settings['epl_max_graph_rent_price'])) {
            $max_price = (int) $epl_settings['epl_max_graph_rent_price'];
        }
    }
    if (!empty($property_under_offer) && 'yes' == $property_under_offer) {
        $class = 'bar-under-offer';
    } elseif ($property_status == 'Current') {
        $class = 'bar-home-open';
    } elseif ($property_status == 'Sold') {
        $class = 'bar-home-sold';
    } elseif ($property_status == 'Leased') {
        $class = 'bar-home-sold';
    } else {
        $class = '';
    }
    if ($sold_price != '') {
        $barwidth = $max_price == 0 ? 0 : $sold_price / $max_price * 100;
    } else {
        $barwidth = $max_price == 0 ? 0 : $price / $max_price * 100;
    }
    echo '<div class="epl-price-bar ' . $class . '">
			<span style="width:' . $barwidth . '%"></span>
		</div>';
    if (!empty($property_under_offer) && 'yes' == $property_under_offer) {
        echo '<div class="type_under_offer">' . $property->label_under_offer . '</div>';
    }
    if (empty($view)) {
        echo '<div class="epl_meta_search_price">' . $property->get_price_plain_value() . ' ';
        echo $property_status == 'Sold' ? epl_currency_formatted_amount($sold_price) : '';
        echo '</div>';
    } else {
        echo '<div class="epl_meta_price">' . $property->get_price_plain_value() . '</div>';
    }
    /* Rental Listing Type */
    if ($d_bond == 1) {
        echo '<div class="epl_meta_bond">', epl_labels('label_bond'), ' ', epl_currency_formatted_amount($bond), '</div>';
    }
    /* Commercial Listing Type */
    if (!empty($lease_date)) {
        echo '<div class="epl_meta_lease_date">Lease End: ', $lease_date, '</div>';
    }
    if ($property_authority == 'auction') {
        _e('Auction ', 'epl');
        echo '<br>' . $property->get_property_auction(true);
    }
}