Пример #1
0
 public function setProperty($name, $value)
 {
     //TODO available properties
     $name = strtolower($name);
     switch ($name) {
         case 'center':
             $center = \MultiMaps\GeoCoordinate::getLatLonFromString($value);
             if ($center) {
                 $this->properties['center'] = $center;
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-parameter', $name, $value)->escaped();
             }
             return true;
             break;
         case 'icon':
             $marker = new Marker();
             if ($marker->setProperty('icon', $value)) {
                 if ($marker->icon !== null) {
                     $this->properties['icon'] = $marker->icon;
                 }
                 if ($marker->size !== null) {
                     $this->properties['iconSize'] = $marker->size;
                 }
                 if ($marker->anchor !== null) {
                     $this->properties['iconAnchor'] = $marker->anchor;
                 }
                 if ($marker->shadow !== null) {
                     $this->properties['iconShadow'] = $marker->shadow;
                 }
                 if ($marker->shSize !== null) {
                     $this->properties['iconShSize'] = $marker->shSize;
                 }
                 if ($marker->shAnchor !== null) {
                     $this->properties['iconShAnchor'] = $marker->shAnchor;
                 }
             } else {
                 $this->errormessages = array_merge($this->errormessages, $marker->getErrorMessages());
             }
             return true;
             break;
         case 'height':
             $this->height = $value;
             return true;
             break;
         case 'width':
             $this->width = $value;
             return true;
             break;
         case 'bounds':
             //TODO
             break;
         default:
             if (is_string($value)) {
                 $this->properties[$name] = htmlspecialchars($value, ENT_NOQUOTES);
             } else {
                 $this->properties[$name] = $value;
             }
             return true;
             break;
     }
     return false;
 }