Example #1
1
function oodle_realstate()
{
    echo '<?xml version="1.0" encoding="utf-8"?><listings>';
    if (osc_count_items()) {
        while (osc_has_items()) {
            $item = feed_get_house_data(osc_item());
            $time = explode(" ", osc_item_pub_date());
            if (isset($item['s_square_meters'])) {
                $lot_size = $item['s_square_meters'] * 10.7639104;
            } else {
                $lot_size = 0;
            }
            $amenities = array();
            if (isset($item['b_heating']) && $item['b_heating']) {
                $amenities[] = __('Heating', 'extra_feeds');
            }
            if (isset($item['b_air_condition']) && $item['b_air_condition']) {
                $amenities[] = __('Air condition', 'extra_feeds');
            }
            if (isset($item['b_elevator']) && $item['b_elevator']) {
                $amenities[] = __('Elevator', 'extra_feeds');
            }
            if (isset($item['b_terrace']) && $item['b_terrace']) {
                $amenities[] = __('Terrace', 'extra_feeds');
            }
            if (isset($item['b_parking']) && $item['b_parking']) {
                $amenities[] = __('Parking', 'extra_feeds');
            }
            echo '<listing>
                <category>' . osc_item_category() . '</category> 
                <description><![CDATA[' . osc_item_description() . ']]></description> 
                <id>' . osc_item_id() . '</id> 
                <title><![CDATA[' . osc_item_title() . ']]></title> 
                <url>' . osc_item_url() . '</url> 
                <address>' . osc_item_address() . '</address> 
                <city>' . osc_item_city() . '</city> 
                <country>' . osc_item_country_code() . '</country> 
                <neighborhood>' . osc_item_city_area() . '</neighborhood> 
                <state>' . osc_item_region() . '</state> 
                <zip_code>' . osc_item_zip() . '</zip_code> 
                <longitude>' . osc_item_longitude() . '</longitude>
                <latitude>' . osc_item_latitude() . '</latitude>
                <amenities>' . implode(", ", $amenities) . '</amenities>
                <bathrooms>' . @$item['i_num_bathrooms'] . '</bathrooms>
                <bedrooms>' . @$item['i_num_rooms'] . '</bedrooms>
                <condition>' . @$item['e_status'] . '</condition>
                <create_time>' . $time[0] . '</create_time>
                <currency>' . osc_item_currency() . '</currency>
                <furnished>' . (@$item['b_furnished'] ? 'Furnished' : '') . '</furnished>';
            if (osc_count_item_resources() > 0) {
                if (strpos(osc_resource_type(), 'image') !== FALSE) {
                    echo '<image_url><![CDATA[' . osc_resource_path() . ']]></image_url>';
                }
            }
            echo '<lot_size>' . $lot_size . '</lot_size>
                <lot_size_units>square feet</lot_size_units>
                <price>' . osc_item_price() . '</price>
                <seller_email>' . osc_item_contact_email() . '</seller_email> 
                <seller_name><![CDATA[' . osc_item_contact_name() . ']]></seller_name> 
                <year>' . @$item['i_year'] . '</year>
        </listing>';
        }
    }
    echo '</listings>';
}
Example #2
0
function trovit_houses()
{
    echo '<?xml version="1.0" encoding="utf-8"?>
            <trovit>';
    if (osc_count_items()) {
        while (osc_has_items()) {
            $item = feed_get_house_data(osc_item());
            $date = date('d/m/Y');
            $time = date('H:i');
            if (preg_match('|([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2})|', osc_item_pub_date(), $tmp)) {
                $date = $tmp[3] . "/" . $tmp[2] . "/" . $tmp[1];
                $time = $tmp[4] . ":" . $tmp[5];
            }
            echo '<ad>
                <id><![CDATA[' . osc_item_id() . ']]></id>
                <url><![CDATA[' . osc_item_url() . ']]></url>
                <title><![CDATA[' . osc_item_title() . ']]></title>
                <type><![CDATA[' . (isset($item['e_type']) ? $item['e_type'] : '') . ']]></type>

                <agency><![CDATA[' . (isset($item['s_agency']) ? $item['s_agency'] : '') . ']]></agency>
                <content><![CDATA[' . osc_item_description() . ']]></content>

                <price><![CDATA[' . osc_item_price() . ']]></price>
                <property_type><![CDATA[' . (isset($item['property_type']) ? $item['property_type'] : '') . ']]></property_type>
                <floor_area unit="meters"><![CDATA[' . (isset($item['s_square_meters']) ? $item['s_square_meters'] : '') . ']]></floor_area>
                <rooms><![CDATA[' . (isset($item['i_num_rooms']) ? $item['i_num_rooms'] : '') . ']]></rooms>

                <bathrooms><![CDATA[' . (isset($item['i_num_bathrooms']) ? $item['i_num_bathrooms'] : '') . ']]></bathrooms>
                <parking><![CDATA[' . (isset($item['b_parking']) ? $item['b_parking'] : '0') . ']]></parking>

                <address><![CDATA[' . (osc_item_address() != '' ? osc_item_address() : '') . ']]></address>
                <city><![CDATA[' . (osc_item_city() != '' ? osc_item_city() : '') . ']]></city>

                <city_area><![CDATA[' . (osc_item_city_area() != '' ? osc_item_city_area() : '') . ']]></city_area>
                <postcode><![CDATA[' . (osc_item_zip() != '' ? osc_item_zip() : '') . ']]></postcode>
                <region><![CDATA[' . (osc_item_region() != '' ? osc_item_region() : '') . ']]></region>

                <latitude><![CDATA[' . (osc_item_latitude() != '' ? osc_item_latitude() : '') . ']]></latitude>
                <longitude><![CDATA[' . (osc_item_longitude() != '' ? osc_item_longitude() : '') . ']]></longitude>

                <floor_number><![CDATA[' . (isset($item['i_floor_number']) ? $item['i_floor_number'] : '') . ']]></floor_number>
                <plot_area><![CDATA[' . (isset($item['i_plot_area']) ? $item['i_plot_area'] : '') . ']]></plot_area>
                <is_furnished><![CDATA[' . (isset($item['b_furnished']) ? $item['b_furnished'] : '0') . ']]></is_furnished>
                <is_new><![CDATA[' . (isset($item['b_new']) ? $item['b_new'] : '0') . ']]></is_new>
                <condition><![CDATA[' . (isset($item['s_condition']) ? $item['s_condition'] : '') . ']]></condition>
                <year><![CDATA[' . (isset($item['i_year']) ? $item['i_year'] : '') . ']]></year>
                <by_owner><![CDATA[' . (isset($item['b_by_owner']) ? $item['b_by_owner'] : '0') . ']]></by_owner>';
            $res_string = '';
            if (osc_count_item_resources() > 0) {
                while (osc_has_item_resources()) {
                    if (strpos(osc_resource_type(), 'image') !== FALSE) {
                        $res_string .= '<picture>
                                            <picture_url><![CDATA[' . osc_resource_path() . ']]></picture_url>
                                            <picture_title><![CDATA[' . osc_resource_name() . ']]></picture_title>
                                        </picture>';
                    }
                }
            }
            if ($res_string != '') {
                echo '<pictures>' . $res_string . '</pictures>';
            }
            echo '
                <date><![CDATA[' . $date . ']]></date>
                <time><![CDATA[' . $time . ']]></time>
            </ad>';
        }
    }
    echo '</trovit>';
}