Exemplo n.º 1
0
 public static function getSelfMapData($title, $xml)
 {
     $result = '';
     $lat = (string) $xml->latitude;
     $lng = (string) $xml->longitude;
     if ($lat && $lng && Place::isValidLatitude($lat) && Place::isValidLongitude($lng)) {
         $titleString = (string) $title->getText();
         $pieces = mb_split(",", $titleString, 2);
         $url = $title->getLocalURL();
         $type = (string) $xml->type;
         $result = '<p n="' . StructuredData::escapeXml(trim($pieces[0])) . '" u="' . StructuredData::escapeXml($url) . '" a="' . $lat . '" o="' . $lng . '" t="' . $type . "\"/>";
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Return true if xml property is valid
  */
 protected function validateData(&$textbox1)
 {
     if (!StructuredData::isRedirect($textbox1)) {
         $placeTypes = Place::readPlaceTypes();
         return Place::isValidLatitude((string) $this->xml->latitude) && Place::isValidLongitude((string) $this->xml->longitude) && Place::isValidType((string) $this->xml->type, $placeTypes) && $this->isValidLocatedIn() && mb_substr($this->titleString, 0, 1) != ',' && !Place::isInvalidAlsoLocatedIn($this->xml->also_located_in);
     } else {
         return strlen($this->getContainedPlacesElements()) == 0;
     }
 }