static function __default_handler($parser, $data) { if ($data === "<![CDATA[") { return; } if ($data === "]]>") { return; } if ("<!--" === _hx_substr($data, 0, 4)) { Xml::$build->addChild(Xml::createComment(_hx_substr($data, 4, strlen($data) - 7))); } else { Xml::$build->addChild(Xml::createPCData($data)); } }
/** * Builds the complete xml document. * @return string * @access private */ protected function buildXML() { $hp = new Xml('1.0', 'utf-8'); $hp->formatOutput = true; // begin hp items $hpitems = $hp->createElement('hotPadsItems'); $hpitems->setAttribute("version", '2.1'); $comm = $hp->createComment('Generated at ' . gmdate(DATE_RFC822)); $hpitems->appendChild($comm); if (is_array($this->properties)) { foreach ($this->properties as $prop) { $noerrors = $this->validate($prop); if ($noerrors === true) { // Build listing $listing = $hp->createElement('Listing'); // Listing attributes $listing->setAttribute("id", $prop->id); $listing->setAttribute("type", $prop->type); $listing->setAttribute("propertyType", $prop->property_type); // Property details $listing->appendChild($this->hpTextNode('name', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('unit', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('street', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('city', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('state', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('zip', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('country', false, $hp, $prop)); // Contact details $listing->appendChild($this->hpTextNode('contactName', 'contact_name', $hp, $prop)); $listing->appendChild($this->hpTextNode('contactEmail', 'contact_email', $hp, $prop)); $listing->appendChild($this->hpTextNode('contactPhone', 'contact_phone', $hp, $prop)); $listing->appendChild($this->hpTextNode('contactFax', 'contact_fax', $hp, $prop)); // Descriptions and urls $listing->appendChild($this->hpTextNode('previewMessage', 'preview_message', $hp, $prop)); $listing->appendChild($this->hpTextNode('description', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('terms', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('website', 'website_url', $hp, $prop)); $listing->appendChild($this->hpTextNode('virtualTourUrl', 'vr_url', $hp, $prop)); // Photos if ($prop->photos) { foreach ($prop->photos as $img) { $photo = $hp->createElement('ListingPhoto'); $photo->setAttribute("source", $img['source']); $listing->appendChild($photo); } } // Additional data $listing->appendChild($this->hpTextNode('price', false, $hp, $prop)); $listing->appendChild($this->hpTextNode('pricingFrequency', 'price_freq', $hp, $prop)); $listing->appendChild($this->hpTextNode('HOA-Fee', 'hoa_maint', $hp, $prop)); $listing->appendChild($this->hpTextNode('numBedrooms', 'bedrooms', $hp, $prop)); $listing->appendChild($this->hpTextNode('numFullBaths', 'full_bath', $hp, $prop)); $listing->appendChild($this->hpTextNode('numHalfBaths', 'half_bath', $hp, $prop)); $listing->appendChild($this->hpTextNode('squareFeet', 'sqft', $hp, $prop)); $hpitems->appendChild($listing); } } $hp->appendChild($hpitems); return $hp->saveXML(); } }