Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php |
— | — | @@ -1,88 +1,88 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_point(s) parser functions with OpenLayers
|
6 | | - *
|
7 | | - * @file Maps_OpenLayersDispPoint.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -class MapsOpenLayersDispPoint extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsOpenLayersUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setMapSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsOpenLayersUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsOpenLayersPrefix;
|
31 | | - $this->defaultZoom = $egMapsOpenLayersZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egOpenLayersOnThisPage;
|
40 | | -
|
41 | | - MapsOpenLayersUtils::addOLDependencies($this->output);
|
42 | | - $egOpenLayersOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egOpenLayersOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $controlItems = MapsOpenLayersUtils::createControlsString($this->controls);
|
55 | | -
|
56 | | - MapsMapper::enforceArrayValues($this->layers);
|
57 | | - $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers);
|
58 | | -
|
59 | | - MapsUtils::makePxValue($this->width);
|
60 | | - MapsUtils::makePxValue($this->height);
|
61 | | -
|
62 | | - $markerItems = array();
|
63 | | -
|
64 | | - // TODO: Refactor up
|
65 | | - foreach ($this->markerData as $markerData) {
|
66 | | - $lat = $markerData['lat'];
|
67 | | - $lon = $markerData['lon'];
|
68 | | -
|
69 | | - $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title;
|
70 | | - $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label;
|
71 | | -
|
72 | | - $title = str_replace("'", "\'", $title);
|
73 | | - $label = str_replace("'", "\'", $label);
|
74 | | -
|
75 | | - $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : '';
|
76 | | - $markerItems[] = "getOLMarkerData($lon, $lat, '$title', '$label', '$icon')";
|
77 | | - }
|
78 | | -
|
79 | | - $markersString = implode(',', $markerItems);
|
80 | | -
|
81 | | - $this->output .= "<div id='$this->mapName' style='width: $this->width; height: $this->height; background-color: #cccccc;'></div>
|
82 | | - <script type='$wgJsMimeType'> /*<![CDATA[*/
|
83 | | - addLoadEvent(
|
84 | | - initOpenLayer('$this->mapName', $this->centre_lon, $this->centre_lat, $this->zoom, [$layerItems], [$controlItems],[$markersString])
|
85 | | - );
|
86 | | - /*]]>*/ </script>";
|
87 | | - }
|
88 | | -
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_point(s) parser functions with OpenLayers |
| 6 | + * |
| 7 | + * @file Maps_OpenLayersDispPoint.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +class MapsOpenLayersDispPoint extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsOpenLayersUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setMapSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsOpenLayersUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsOpenLayersPrefix; |
| 31 | + $this->defaultZoom = $egMapsOpenLayersZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egOpenLayersOnThisPage; |
| 40 | + |
| 41 | + MapsOpenLayersUtils::addOLDependencies($this->output); |
| 42 | + $egOpenLayersOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egOpenLayersOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $controlItems = MapsOpenLayersUtils::createControlsString($this->controls); |
| 55 | + |
| 56 | + MapsMapper::enforceArrayValues($this->layers); |
| 57 | + $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers); |
| 58 | + |
| 59 | + MapsUtils::makePxValue($this->width); |
| 60 | + MapsUtils::makePxValue($this->height); |
| 61 | + |
| 62 | + $markerItems = array(); |
| 63 | + |
| 64 | + // TODO: Refactor up |
| 65 | + foreach ($this->markerData as $markerData) { |
| 66 | + $lat = $markerData['lat']; |
| 67 | + $lon = $markerData['lon']; |
| 68 | + |
| 69 | + $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title; |
| 70 | + $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label; |
| 71 | + |
| 72 | + $title = str_replace("'", "\'", $title); |
| 73 | + $label = str_replace("'", "\'", $label); |
| 74 | + |
| 75 | + $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : ''; |
| 76 | + $markerItems[] = "getOLMarkerData($lon, $lat, '$title', '$label', '$icon')"; |
| 77 | + } |
| 78 | + |
| 79 | + $markersString = implode(',', $markerItems); |
| 80 | + |
| 81 | + $this->output .= "<div id='$this->mapName' style='width: $this->width; height: $this->height; background-color: #cccccc;'></div> |
| 82 | + <script type='$wgJsMimeType'> /*<![CDATA[*/ |
| 83 | + addLoadEvent( |
| 84 | + initOpenLayer('$this->mapName', $this->centre_lon, $this->centre_lat, $this->zoom, [$layerItems], [$controlItems],[$markersString]) |
| 85 | + ); |
| 86 | + /*]]>*/ </script>"; |
| 87 | + } |
| 88 | + |
89 | 89 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php |
___________________________________________________________________ |
Added: svn:eol-style |
90 | 90 | + native |
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php |
— | — | @@ -1,69 +1,69 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_map parser function with OpenLayers
|
6 | | - *
|
7 | | - * @file Maps_OpenLayersDispMap.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -class MapsOpenLayersDispMap extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsOpenLayersUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setMapSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsOpenLayersUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsOpenLayersPrefix;
|
31 | | - $this->defaultZoom = $egMapsOpenLayersZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egOpenLayersOnThisPage;
|
40 | | -
|
41 | | - MapsOpenLayersUtils::addOLDependencies($this->output);
|
42 | | - $egOpenLayersOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egOpenLayersOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $controlItems = MapsOpenLayersUtils::createControlsString($this->controls);
|
55 | | -
|
56 | | - MapsMapper::enforceArrayValues($this->layers);
|
57 | | - $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers);
|
58 | | -
|
59 | | - MapsUtils::makePxValue($this->width);
|
60 | | - MapsUtils::makePxValue($this->height);
|
61 | | -
|
62 | | - $this->output .= "<div id='$this->mapName' style='width: $this->width; height: $this->height; background-color: #cccccc;'></div>
|
63 | | - <script type='$wgJsMimeType'> /*<![CDATA[*/
|
64 | | - addLoadEvent(
|
65 | | - initOpenLayer('$this->mapName', $this->centre_lon, $this->centre_lat, $this->zoom, [$layerItems], [$controlItems],[])
|
66 | | - );
|
67 | | - /*]]>*/ </script>";
|
68 | | - }
|
69 | | -
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_map parser function with OpenLayers |
| 6 | + * |
| 7 | + * @file Maps_OpenLayersDispMap.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +class MapsOpenLayersDispMap extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsOpenLayersUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setMapSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsOpenLayersUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsOpenLayersPrefix; |
| 31 | + $this->defaultZoom = $egMapsOpenLayersZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egOpenLayersOnThisPage; |
| 40 | + |
| 41 | + MapsOpenLayersUtils::addOLDependencies($this->output); |
| 42 | + $egOpenLayersOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egOpenLayersOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $controlItems = MapsOpenLayersUtils::createControlsString($this->controls); |
| 55 | + |
| 56 | + MapsMapper::enforceArrayValues($this->layers); |
| 57 | + $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers); |
| 58 | + |
| 59 | + MapsUtils::makePxValue($this->width); |
| 60 | + MapsUtils::makePxValue($this->height); |
| 61 | + |
| 62 | + $this->output .= "<div id='$this->mapName' style='width: $this->width; height: $this->height; background-color: #cccccc;'></div> |
| 63 | + <script type='$wgJsMimeType'> /*<![CDATA[*/ |
| 64 | + addLoadEvent( |
| 65 | + initOpenLayer('$this->mapName', $this->centre_lon, $this->centre_lat, $this->zoom, [$layerItems], [$controlItems],[]) |
| 66 | + ); |
| 67 | + /*]]>*/ </script>"; |
| 68 | + } |
| 69 | + |
70 | 70 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php |
___________________________________________________________________ |
Added: svn:eol-style |
71 | 71 | + native |
Index: trunk/extensions/Maps/ParserFunctions/Maps_BasePointMap.php |
— | — | @@ -1,164 +1,164 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Abstract class MapsBasePointMap provides the scafolding for classes handling display_point(s)
|
6 | | - * and display_address(es) calls for a spesific mapping service. It inherits from MapsMapFeature and therefore
|
7 | | - * forces inheriting classes to implement sereveral methods.
|
8 | | - *
|
9 | | - * @file Maps_BasePointMap.php
|
10 | | - * @ingroup Maps
|
11 | | - *
|
12 | | - * @author Jeroen De Dauw
|
13 | | - */
|
14 | | -
|
15 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
16 | | - die( 'Not an entry point.' );
|
17 | | -}
|
18 | | -
|
19 | | -abstract class MapsBasePointMap extends MapsMapFeature {
|
20 | | -
|
21 | | - protected $markerData = array();
|
22 | | -
|
23 | | - /**
|
24 | | - * Handles the request from the parser hook by doing the work that's common for all
|
25 | | - * mapping services, calling the specific methods and finally returning the resulting output.
|
26 | | - *
|
27 | | - * @param unknown_type $parser
|
28 | | - * @param array $params
|
29 | | - *
|
30 | | - * @return html
|
31 | | - */
|
32 | | - public final function displayMap(&$parser, array $params) {
|
33 | | - $this->setMapSettings();
|
34 | | -
|
35 | | - $coords = $this->manageMapProperties($params);
|
36 | | -
|
37 | | - $this->doMapServiceLoad();
|
38 | | -
|
39 | | - $this->setMapName();
|
40 | | -
|
41 | | - $this->setCoordinates($parser);
|
42 | | -
|
43 | | - $this->setZoom();
|
44 | | -
|
45 | | - $this->setCentre();
|
46 | | -
|
47 | | - $this->doParsing($parser);
|
48 | | -
|
49 | | - $this->doEscaping();
|
50 | | -
|
51 | | - $this->addSpecificMapHTML();
|
52 | | -
|
53 | | - return $this->output;
|
54 | | - }
|
55 | | -
|
56 | | - /**
|
57 | | - * (non-PHPdoc)
|
58 | | - * @see smw/extensions/Maps/MapsMapFeature#manageMapProperties($mapProperties, $className)
|
59 | | - */
|
60 | | - protected function manageMapProperties($params) {
|
61 | | - parent::manageMapProperties($params, __CLASS__);
|
62 | | - }
|
63 | | -
|
64 | | - /**
|
65 | | - * Sets the zoom level to the provided value. When no zoom is provided, set
|
66 | | - * it to the default when there is only one location, or the best fitting soom when
|
67 | | - * there are multiple locations.
|
68 | | - *
|
69 | | - */
|
70 | | - private function setZoom() {
|
71 | | - if (strlen($this->zoom) < 1) {
|
72 | | - if (count($this->markerData) > 1) {
|
73 | | - $this->zoom = 'null';
|
74 | | - }
|
75 | | - else {
|
76 | | - $this->zoom = $this->defaultZoom;
|
77 | | - }
|
78 | | - }
|
79 | | - }
|
80 | | -
|
81 | | - /**
|
82 | | - * Fills the $markerData array with the locations and their meta data.
|
83 | | - *
|
84 | | - * @param unknown_type $parser
|
85 | | - */
|
86 | | - private function setCoordinates($parser) {
|
87 | | - $this->coordinates = explode(';', $this->coordinates);
|
88 | | -
|
89 | | - foreach($this->coordinates as $coordinates) {
|
90 | | - $args = explode('~', $coordinates);
|
91 | | -
|
92 | | - $args[0] = str_replace('″', '"', $args[0]);
|
93 | | - $args[0] = str_replace('′', "'", $args[0]);
|
94 | | -
|
95 | | - $markerData = MapsUtils::getLatLon($args[0]);
|
96 | | -
|
97 | | - if (count($args) > 1) {
|
98 | | - $markerData['title'] = $parser->recursiveTagParse( $args[1] );
|
99 | | -
|
100 | | - if (count($args) > 2) {
|
101 | | - $markerData['label'] = $parser->recursiveTagParse( $args[2] );
|
102 | | -
|
103 | | - if (count($args) > 3) {
|
104 | | - $markerData['icon'] = $args[3];
|
105 | | - }
|
106 | | - }
|
107 | | - }
|
108 | | -
|
109 | | - $this->markerData[] = $markerData;
|
110 | | - }
|
111 | | - }
|
112 | | -
|
113 | | - /**
|
114 | | - * Sets the $centre_lat and $centre_lon fields.
|
115 | | - * Note: this needs to be done AFTRE the maker coordinates are set.
|
116 | | - *
|
117 | | - */
|
118 | | - private function setCentre() {
|
119 | | - if (empty($this->centre)) {
|
120 | | - if (count($this->markerData) == 1) {
|
121 | | - // If centre is not set and there is exactelly one marker, use it's coordinates.
|
122 | | - $this->centre_lat = $this->markerData[0]['lat'];
|
123 | | - $this->centre_lon = $this->markerData[0]['lon'];
|
124 | | - }
|
125 | | - elseif (count($this->markerData) > 1) {
|
126 | | - // If centre is not set and there are multiple markers, set the values to null,
|
127 | | - // to be auto determined by the JS of the mapping API.
|
128 | | - $this->centre_lat = 'null';
|
129 | | - $this->centre_lon = 'null';
|
130 | | - }
|
131 | | - else {
|
132 | | - // If centre is not set and there are no markers, use the default latitude and longitutde.
|
133 | | - global $egMapsMapLat, $egMapsMapLon;
|
134 | | - $this->centre_lat = $egMapsMapLat;
|
135 | | - $this->centre_lon = $egMapsMapLon;
|
136 | | - }
|
137 | | - }
|
138 | | - else {
|
139 | | - // If a centre value is set, use it.
|
140 | | - $centre = MapsUtils::getLatLon($this->centre);
|
141 | | - $this->centre_lat = $centre['lat'];
|
142 | | - $this->centre_lon = $centre['lon'];
|
143 | | - }
|
144 | | - }
|
145 | | -
|
146 | | - /**
|
147 | | - * Parse the wiki text in the title and label values.
|
148 | | - *
|
149 | | - * @param unknown_type $parser
|
150 | | - */
|
151 | | - private function doParsing(&$parser) {
|
152 | | - $this->title = $parser->recursiveTagParse( $this->title );
|
153 | | - $this->label = $parser->recursiveTagParse( $this->label );
|
154 | | - }
|
155 | | -
|
156 | | - /**
|
157 | | - * Escape the title and label text
|
158 | | - *
|
159 | | - */
|
160 | | - private function doEscaping() {
|
161 | | - $this->title = str_replace("'", "\'", $this->title);
|
162 | | - $this->label = str_replace("'", "\'", $this->label);
|
163 | | - }
|
164 | | -
|
165 | | -}
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Abstract class MapsBasePointMap provides the scafolding for classes handling display_point(s) |
| 6 | + * and display_address(es) calls for a spesific mapping service. It inherits from MapsMapFeature and therefore |
| 7 | + * forces inheriting classes to implement sereveral methods. |
| 8 | + * |
| 9 | + * @file Maps_BasePointMap.php |
| 10 | + * @ingroup Maps |
| 11 | + * |
| 12 | + * @author Jeroen De Dauw |
| 13 | + */ |
| 14 | + |
| 15 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 16 | + die( 'Not an entry point.' ); |
| 17 | +} |
| 18 | + |
| 19 | +abstract class MapsBasePointMap extends MapsMapFeature { |
| 20 | + |
| 21 | + protected $markerData = array(); |
| 22 | + |
| 23 | + /** |
| 24 | + * Handles the request from the parser hook by doing the work that's common for all |
| 25 | + * mapping services, calling the specific methods and finally returning the resulting output. |
| 26 | + * |
| 27 | + * @param unknown_type $parser |
| 28 | + * @param array $params |
| 29 | + * |
| 30 | + * @return html |
| 31 | + */ |
| 32 | + public final function displayMap(&$parser, array $params) { |
| 33 | + $this->setMapSettings(); |
| 34 | + |
| 35 | + $coords = $this->manageMapProperties($params); |
| 36 | + |
| 37 | + $this->doMapServiceLoad(); |
| 38 | + |
| 39 | + $this->setMapName(); |
| 40 | + |
| 41 | + $this->setCoordinates($parser); |
| 42 | + |
| 43 | + $this->setZoom(); |
| 44 | + |
| 45 | + $this->setCentre(); |
| 46 | + |
| 47 | + $this->doParsing($parser); |
| 48 | + |
| 49 | + $this->doEscaping(); |
| 50 | + |
| 51 | + $this->addSpecificMapHTML(); |
| 52 | + |
| 53 | + return $this->output; |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * (non-PHPdoc) |
| 58 | + * @see smw/extensions/Maps/MapsMapFeature#manageMapProperties($mapProperties, $className) |
| 59 | + */ |
| 60 | + protected function manageMapProperties($params) { |
| 61 | + parent::manageMapProperties($params, __CLASS__); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Sets the zoom level to the provided value. When no zoom is provided, set |
| 66 | + * it to the default when there is only one location, or the best fitting soom when |
| 67 | + * there are multiple locations. |
| 68 | + * |
| 69 | + */ |
| 70 | + private function setZoom() { |
| 71 | + if (strlen($this->zoom) < 1) { |
| 72 | + if (count($this->markerData) > 1) { |
| 73 | + $this->zoom = 'null'; |
| 74 | + } |
| 75 | + else { |
| 76 | + $this->zoom = $this->defaultZoom; |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * Fills the $markerData array with the locations and their meta data. |
| 83 | + * |
| 84 | + * @param unknown_type $parser |
| 85 | + */ |
| 86 | + private function setCoordinates($parser) { |
| 87 | + $this->coordinates = explode(';', $this->coordinates); |
| 88 | + |
| 89 | + foreach($this->coordinates as $coordinates) { |
| 90 | + $args = explode('~', $coordinates); |
| 91 | + |
| 92 | + $args[0] = str_replace('″', '"', $args[0]); |
| 93 | + $args[0] = str_replace('′', "'", $args[0]); |
| 94 | + |
| 95 | + $markerData = MapsUtils::getLatLon($args[0]); |
| 96 | + |
| 97 | + if (count($args) > 1) { |
| 98 | + $markerData['title'] = $parser->recursiveTagParse( $args[1] ); |
| 99 | + |
| 100 | + if (count($args) > 2) { |
| 101 | + $markerData['label'] = $parser->recursiveTagParse( $args[2] ); |
| 102 | + |
| 103 | + if (count($args) > 3) { |
| 104 | + $markerData['icon'] = $args[3]; |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + $this->markerData[] = $markerData; |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Sets the $centre_lat and $centre_lon fields. |
| 115 | + * Note: this needs to be done AFTRE the maker coordinates are set. |
| 116 | + * |
| 117 | + */ |
| 118 | + private function setCentre() { |
| 119 | + if (empty($this->centre)) { |
| 120 | + if (count($this->markerData) == 1) { |
| 121 | + // If centre is not set and there is exactelly one marker, use it's coordinates. |
| 122 | + $this->centre_lat = $this->markerData[0]['lat']; |
| 123 | + $this->centre_lon = $this->markerData[0]['lon']; |
| 124 | + } |
| 125 | + elseif (count($this->markerData) > 1) { |
| 126 | + // If centre is not set and there are multiple markers, set the values to null, |
| 127 | + // to be auto determined by the JS of the mapping API. |
| 128 | + $this->centre_lat = 'null'; |
| 129 | + $this->centre_lon = 'null'; |
| 130 | + } |
| 131 | + else { |
| 132 | + // If centre is not set and there are no markers, use the default latitude and longitutde. |
| 133 | + global $egMapsMapLat, $egMapsMapLon; |
| 134 | + $this->centre_lat = $egMapsMapLat; |
| 135 | + $this->centre_lon = $egMapsMapLon; |
| 136 | + } |
| 137 | + } |
| 138 | + else { |
| 139 | + // If a centre value is set, use it. |
| 140 | + $centre = MapsUtils::getLatLon($this->centre); |
| 141 | + $this->centre_lat = $centre['lat']; |
| 142 | + $this->centre_lon = $centre['lon']; |
| 143 | + } |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Parse the wiki text in the title and label values. |
| 148 | + * |
| 149 | + * @param unknown_type $parser |
| 150 | + */ |
| 151 | + private function doParsing(&$parser) { |
| 152 | + $this->title = $parser->recursiveTagParse( $this->title ); |
| 153 | + $this->label = $parser->recursiveTagParse( $this->label ); |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Escape the title and label text |
| 158 | + * |
| 159 | + */ |
| 160 | + private function doEscaping() { |
| 161 | + $this->title = str_replace("'", "\'", $this->title); |
| 162 | + $this->label = str_replace("'", "\'", $this->label); |
| 163 | + } |
| 164 | + |
| 165 | +} |
Property changes on: trunk/extensions/Maps/ParserFunctions/Maps_BasePointMap.php |
___________________________________________________________________ |
Added: svn:eol-style |
166 | 166 | + native |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php |
— | — | @@ -1,77 +1,77 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_map parser function with Google Maps
|
6 | | - *
|
7 | | - * @file Maps_GoogleMapsDispMap.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -final class MapsGoogleMapsDispMap extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsGoogleMapsUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setMapSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsGoogleMapsUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
|
31 | | - $this->defaultZoom = $egMapsGoogleMapsZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egGoogleMapsOnThisPage;
|
40 | | -
|
41 | | - MapsGoogleMapsUtils::addGMapDependencies($this->output);
|
42 | | - $egGoogleMapsOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egGoogleMapsOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true);
|
55 | | -
|
56 | | - $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls);
|
57 | | -
|
58 | | - $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom);
|
59 | | -
|
60 | | - $this->types = explode(",", $this->types);
|
61 | | -
|
62 | | - $typesString = MapsGoogleMapsUtils::createTypesString($this->types);
|
63 | | -
|
64 | | - $this->output .=<<<END
|
65 | | -
|
66 | | -<div id="$this->mapName" class="$this->class" style="$this->style" ></div>
|
67 | | -<script type="$wgJsMimeType"> /*<![CDATA[*/
|
68 | | -addLoadEvent(
|
69 | | - initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [])
|
70 | | -);
|
71 | | -/*]]>*/ </script>
|
72 | | -
|
73 | | -END;
|
74 | | -
|
75 | | - }
|
76 | | -
|
77 | | -}
|
78 | | -
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_map parser function with Google Maps |
| 6 | + * |
| 7 | + * @file Maps_GoogleMapsDispMap.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +final class MapsGoogleMapsDispMap extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsGoogleMapsUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setMapSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsGoogleMapsUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsGoogleMapsPrefix; |
| 31 | + $this->defaultZoom = $egMapsGoogleMapsZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egGoogleMapsOnThisPage; |
| 40 | + |
| 41 | + MapsGoogleMapsUtils::addGMapDependencies($this->output); |
| 42 | + $egGoogleMapsOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egGoogleMapsOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true); |
| 55 | + |
| 56 | + $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls); |
| 57 | + |
| 58 | + $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom); |
| 59 | + |
| 60 | + $this->types = explode(",", $this->types); |
| 61 | + |
| 62 | + $typesString = MapsGoogleMapsUtils::createTypesString($this->types); |
| 63 | + |
| 64 | + $this->output .=<<<END |
| 65 | + |
| 66 | +<div id="$this->mapName" class="$this->class" style="$this->style" ></div> |
| 67 | +<script type="$wgJsMimeType"> /*<![CDATA[*/ |
| 68 | +addLoadEvent( |
| 69 | + initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, []) |
| 70 | +); |
| 71 | +/*]]>*/ </script> |
| 72 | + |
| 73 | +END; |
| 74 | + |
| 75 | + } |
| 76 | + |
| 77 | +} |
| 78 | + |
Property changes on: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php |
___________________________________________________________________ |
Added: svn:eol-style |
79 | 79 | + native |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php |
— | — | @@ -1,98 +1,98 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_point(s) parser functions with Google Maps
|
6 | | - *
|
7 | | - * @file Maps_GoogleMapsDispPoint.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -final class MapsGoogleMapsDispPoint extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsGoogleMapsUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setMapSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsGoogleMapsUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
|
31 | | - $this->defaultZoom = $egMapsGoogleMapsZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egGoogleMapsOnThisPage;
|
40 | | -
|
41 | | - MapsGoogleMapsUtils::addGMapDependencies($this->output);
|
42 | | - $egGoogleMapsOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egGoogleMapsOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth);
|
55 | | -
|
56 | | - $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true);
|
57 | | -
|
58 | | - $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls);
|
59 | | -
|
60 | | - $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom);
|
61 | | -
|
62 | | - $markerItems = array();
|
63 | | -
|
64 | | - // TODO: Refactor up
|
65 | | - foreach ($this->markerData as $markerData) {
|
66 | | - $lat = $markerData['lat'];
|
67 | | - $lon = $markerData['lon'];
|
68 | | -
|
69 | | - $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title;
|
70 | | - $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label;
|
71 | | -
|
72 | | - $title = str_replace("'", "\'", $title);
|
73 | | - $label = str_replace("'", "\'", $label);
|
74 | | -
|
75 | | - $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : '';
|
76 | | - $markerItems[] = "getGMarkerData($lat, $lon, '$title', '$label', '$icon')";
|
77 | | - }
|
78 | | -
|
79 | | - $markersString = implode(',', $markerItems);
|
80 | | -
|
81 | | - $this->types = explode(",", $this->types);
|
82 | | -
|
83 | | - $typesString = MapsGoogleMapsUtils::createTypesString($this->types, $enableEarth);
|
84 | | -
|
85 | | - $this->output .=<<<END
|
86 | | -
|
87 | | -<div id="$this->mapName" class="$this->class" style="$this->style" ></div>
|
88 | | -<script type="$wgJsMimeType"> /*<![CDATA[*/
|
89 | | -addLoadEvent(
|
90 | | - initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString])
|
91 | | -);
|
92 | | -/*]]>*/ </script>
|
93 | | -
|
94 | | -END;
|
95 | | -
|
96 | | - }
|
97 | | -
|
98 | | -}
|
99 | | -
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_point(s) parser functions with Google Maps |
| 6 | + * |
| 7 | + * @file Maps_GoogleMapsDispPoint.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +final class MapsGoogleMapsDispPoint extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsGoogleMapsUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setMapSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsGoogleMapsUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsGoogleMapsPrefix; |
| 31 | + $this->defaultZoom = $egMapsGoogleMapsZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egGoogleMapsOnThisPage; |
| 40 | + |
| 41 | + MapsGoogleMapsUtils::addGMapDependencies($this->output); |
| 42 | + $egGoogleMapsOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egGoogleMapsOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth); |
| 55 | + |
| 56 | + $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true); |
| 57 | + |
| 58 | + $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls); |
| 59 | + |
| 60 | + $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom); |
| 61 | + |
| 62 | + $markerItems = array(); |
| 63 | + |
| 64 | + // TODO: Refactor up |
| 65 | + foreach ($this->markerData as $markerData) { |
| 66 | + $lat = $markerData['lat']; |
| 67 | + $lon = $markerData['lon']; |
| 68 | + |
| 69 | + $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title; |
| 70 | + $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label; |
| 71 | + |
| 72 | + $title = str_replace("'", "\'", $title); |
| 73 | + $label = str_replace("'", "\'", $label); |
| 74 | + |
| 75 | + $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : ''; |
| 76 | + $markerItems[] = "getGMarkerData($lat, $lon, '$title', '$label', '$icon')"; |
| 77 | + } |
| 78 | + |
| 79 | + $markersString = implode(',', $markerItems); |
| 80 | + |
| 81 | + $this->types = explode(",", $this->types); |
| 82 | + |
| 83 | + $typesString = MapsGoogleMapsUtils::createTypesString($this->types, $enableEarth); |
| 84 | + |
| 85 | + $this->output .=<<<END |
| 86 | + |
| 87 | +<div id="$this->mapName" class="$this->class" style="$this->style" ></div> |
| 88 | +<script type="$wgJsMimeType"> /*<![CDATA[*/ |
| 89 | +addLoadEvent( |
| 90 | + initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString]) |
| 91 | +); |
| 92 | +/*]]>*/ </script> |
| 93 | + |
| 94 | +END; |
| 95 | + |
| 96 | + } |
| 97 | + |
| 98 | +} |
| 99 | + |
Property changes on: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php |
___________________________________________________________________ |
Added: svn:eol-style |
100 | 100 | + native |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php |
— | — | @@ -1,96 +1,96 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_point(s) parser functions with Yahoo! Maps
|
6 | | - *
|
7 | | - * @file Maps_YahooMapsDispPoint.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -class MapsYahooMapsDispPoint extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsYahooMapsUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setFormInputSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsYahooMapsUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsYahooMapsPrefix;
|
31 | | - $this->defaultZoom = $egMapsYahooMapsZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egYahooMapsOnThisPage;
|
40 | | -
|
41 | | - MapsYahooMapsUtils::addYMapDependencies($this->output);
|
42 | | - $egYahooMapsOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egYahooMapsOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $this->type = MapsYahooMapsUtils::getYMapType($this->type, true);
|
55 | | -
|
56 | | - $this->controls = MapsYahooMapsUtils::createControlsString($this->controls);
|
57 | | -
|
58 | | - MapsUtils::makePxValue($this->width);
|
59 | | - MapsUtils::makePxValue($this->height);
|
60 | | -
|
61 | | - $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom);
|
62 | | -
|
63 | | - $markerItems = array();
|
64 | | -
|
65 | | - // TODO: Refactor up
|
66 | | - foreach ($this->markerData as $markerData) {
|
67 | | - $lat = $markerData['lat'];
|
68 | | - $lon = $markerData['lon'];
|
69 | | -
|
70 | | - $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title;
|
71 | | - $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label;
|
72 | | -
|
73 | | - $title = str_replace("'", "\'", $title);
|
74 | | - $label = str_replace("'", "\'", $label);
|
75 | | -
|
76 | | - $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : '';
|
77 | | - $markerItems[] = "getYMarkerData($lat, $lon, '$title', '$label', '$icon')";
|
78 | | - }
|
79 | | -
|
80 | | - $markersString = implode(',', $markerItems);
|
81 | | -
|
82 | | - $this->types = explode(",", $this->types);
|
83 | | -
|
84 | | - $typesString = MapsYahooMapsUtils::createTypesString($this->types);
|
85 | | -
|
86 | | - $this->output .= <<<END
|
87 | | - <div id="$this->mapName" style="width: $this->width; height: $this->height;"></div>
|
88 | | -
|
89 | | - <script type="$wgJsMimeType">/*<![CDATA[*/
|
90 | | - addLoadEvent(
|
91 | | - initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString])
|
92 | | - );
|
93 | | - /*]]>*/</script>
|
94 | | -END;
|
95 | | - }
|
96 | | -
|
97 | | -}
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_point(s) parser functions with Yahoo! Maps |
| 6 | + * |
| 7 | + * @file Maps_YahooMapsDispPoint.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +class MapsYahooMapsDispPoint extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsYahooMapsUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setFormInputSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsYahooMapsUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsYahooMapsPrefix; |
| 31 | + $this->defaultZoom = $egMapsYahooMapsZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egYahooMapsOnThisPage; |
| 40 | + |
| 41 | + MapsYahooMapsUtils::addYMapDependencies($this->output); |
| 42 | + $egYahooMapsOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egYahooMapsOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $this->type = MapsYahooMapsUtils::getYMapType($this->type, true); |
| 55 | + |
| 56 | + $this->controls = MapsYahooMapsUtils::createControlsString($this->controls); |
| 57 | + |
| 58 | + MapsUtils::makePxValue($this->width); |
| 59 | + MapsUtils::makePxValue($this->height); |
| 60 | + |
| 61 | + $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom); |
| 62 | + |
| 63 | + $markerItems = array(); |
| 64 | + |
| 65 | + // TODO: Refactor up |
| 66 | + foreach ($this->markerData as $markerData) { |
| 67 | + $lat = $markerData['lat']; |
| 68 | + $lon = $markerData['lon']; |
| 69 | + |
| 70 | + $title = array_key_exists('title', $markerData) ? $markerData['title'] : $this->title; |
| 71 | + $label = array_key_exists('label', $markerData) ? $markerData['label'] : $this->label; |
| 72 | + |
| 73 | + $title = str_replace("'", "\'", $title); |
| 74 | + $label = str_replace("'", "\'", $label); |
| 75 | + |
| 76 | + $icon = array_key_exists('icon', $markerData) ? $markerData['icon'] : ''; |
| 77 | + $markerItems[] = "getYMarkerData($lat, $lon, '$title', '$label', '$icon')"; |
| 78 | + } |
| 79 | + |
| 80 | + $markersString = implode(',', $markerItems); |
| 81 | + |
| 82 | + $this->types = explode(",", $this->types); |
| 83 | + |
| 84 | + $typesString = MapsYahooMapsUtils::createTypesString($this->types); |
| 85 | + |
| 86 | + $this->output .= <<<END |
| 87 | + <div id="$this->mapName" style="width: $this->width; height: $this->height;"></div> |
| 88 | + |
| 89 | + <script type="$wgJsMimeType">/*<![CDATA[*/ |
| 90 | + addLoadEvent( |
| 91 | + initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString]) |
| 92 | + ); |
| 93 | + /*]]>*/</script> |
| 94 | +END; |
| 95 | + } |
| 96 | + |
| 97 | +} |
Property changes on: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php |
___________________________________________________________________ |
Added: svn:eol-style |
98 | 98 | + native |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php |
— | — | @@ -1,77 +1,77 @@ |
2 | | -<?php
|
3 | | -
|
4 | | -/**
|
5 | | - * Class for handling the display_map parser function with Yahoo! Maps
|
6 | | - *
|
7 | | - * @file Maps_YahooMapsDispMap.php
|
8 | | - * @ingroup Maps
|
9 | | - *
|
10 | | - * @author Jeroen De Dauw
|
11 | | - */
|
12 | | -
|
13 | | -if( !defined( 'MEDIAWIKI' ) ) {
|
14 | | - die( 'Not an entry point.' );
|
15 | | -}
|
16 | | -
|
17 | | -class MapsYahooMapsDispMap extends MapsBasePointMap {
|
18 | | -
|
19 | | - public $serviceName = MapsYahooMapsUtils::SERVICE_NAME;
|
20 | | -
|
21 | | - /**
|
22 | | - * @see MapsBaseMap::setFormInputSettings()
|
23 | | - *
|
24 | | - */
|
25 | | - protected function setMapSettings() {
|
26 | | - global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
|
27 | | -
|
28 | | - $this->defaultParams = MapsYahooMapsUtils::getDefaultParams();
|
29 | | -
|
30 | | - $this->elementNamePrefix = $egMapsYahooMapsPrefix;
|
31 | | - $this->defaultZoom = $egMapsYahooMapsZoom;
|
32 | | - }
|
33 | | -
|
34 | | - /**
|
35 | | - * @see MapsBaseMap::doMapServiceLoad()
|
36 | | - *
|
37 | | - */
|
38 | | - protected function doMapServiceLoad() {
|
39 | | - global $egYahooMapsOnThisPage;
|
40 | | -
|
41 | | - MapsYahooMapsUtils::addYMapDependencies($this->output);
|
42 | | - $egYahooMapsOnThisPage++;
|
43 | | -
|
44 | | - $this->elementNr = $egYahooMapsOnThisPage;
|
45 | | - }
|
46 | | -
|
47 | | - /**
|
48 | | - * @see MapsBaseMap::addSpecificMapHTML()
|
49 | | - *
|
50 | | - */
|
51 | | - public function addSpecificMapHTML() {
|
52 | | - global $wgJsMimeType;
|
53 | | -
|
54 | | - $this->type = MapsYahooMapsUtils::getYMapType($this->type, true);
|
55 | | -
|
56 | | - $this->controls = MapsYahooMapsUtils::createControlsString($this->controls);
|
57 | | -
|
58 | | - MapsUtils::makePxValue($this->width);
|
59 | | - MapsUtils::makePxValue($this->height);
|
60 | | -
|
61 | | - $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom);
|
62 | | -
|
63 | | - $this->types = explode(",", $this->types);
|
64 | | -
|
65 | | - $typesString = MapsYahooMapsUtils::createTypesString($this->types);
|
66 | | -
|
67 | | - $this->output .= <<<END
|
68 | | - <div id="$this->mapName" style="width: $this->width; height: $this->height;"></div>
|
69 | | -
|
70 | | - <script type="$wgJsMimeType">/*<![CDATA[*/
|
71 | | - addLoadEvent(
|
72 | | - initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [])
|
73 | | - );
|
74 | | - /*]]>*/</script>
|
75 | | -END;
|
76 | | - }
|
77 | | -
|
78 | | -}
|
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for handling the display_map parser function with Yahoo! Maps |
| 6 | + * |
| 7 | + * @file Maps_YahooMapsDispMap.php |
| 8 | + * @ingroup Maps |
| 9 | + * |
| 10 | + * @author Jeroen De Dauw |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( 'Not an entry point.' ); |
| 15 | +} |
| 16 | + |
| 17 | +class MapsYahooMapsDispMap extends MapsBasePointMap { |
| 18 | + |
| 19 | + public $serviceName = MapsYahooMapsUtils::SERVICE_NAME; |
| 20 | + |
| 21 | + /** |
| 22 | + * @see MapsBaseMap::setFormInputSettings() |
| 23 | + * |
| 24 | + */ |
| 25 | + protected function setMapSettings() { |
| 26 | + global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix; |
| 27 | + |
| 28 | + $this->defaultParams = MapsYahooMapsUtils::getDefaultParams(); |
| 29 | + |
| 30 | + $this->elementNamePrefix = $egMapsYahooMapsPrefix; |
| 31 | + $this->defaultZoom = $egMapsYahooMapsZoom; |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @see MapsBaseMap::doMapServiceLoad() |
| 36 | + * |
| 37 | + */ |
| 38 | + protected function doMapServiceLoad() { |
| 39 | + global $egYahooMapsOnThisPage; |
| 40 | + |
| 41 | + MapsYahooMapsUtils::addYMapDependencies($this->output); |
| 42 | + $egYahooMapsOnThisPage++; |
| 43 | + |
| 44 | + $this->elementNr = $egYahooMapsOnThisPage; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @see MapsBaseMap::addSpecificMapHTML() |
| 49 | + * |
| 50 | + */ |
| 51 | + public function addSpecificMapHTML() { |
| 52 | + global $wgJsMimeType; |
| 53 | + |
| 54 | + $this->type = MapsYahooMapsUtils::getYMapType($this->type, true); |
| 55 | + |
| 56 | + $this->controls = MapsYahooMapsUtils::createControlsString($this->controls); |
| 57 | + |
| 58 | + MapsUtils::makePxValue($this->width); |
| 59 | + MapsUtils::makePxValue($this->height); |
| 60 | + |
| 61 | + $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom); |
| 62 | + |
| 63 | + $this->types = explode(",", $this->types); |
| 64 | + |
| 65 | + $typesString = MapsYahooMapsUtils::createTypesString($this->types); |
| 66 | + |
| 67 | + $this->output .= <<<END |
| 68 | + <div id="$this->mapName" style="width: $this->width; height: $this->height;"></div> |
| 69 | + |
| 70 | + <script type="$wgJsMimeType">/*<![CDATA[*/ |
| 71 | + addLoadEvent( |
| 72 | + initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, []) |
| 73 | + ); |
| 74 | + /*]]>*/</script> |
| 75 | +END; |
| 76 | + } |
| 77 | + |
| 78 | +} |
Property changes on: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php |
___________________________________________________________________ |
Added: svn:eol-style |
79 | 79 | + native |
Property changes on: trunk/extensions/DonationInterface/GeoIP/.bzrignore |
___________________________________________________________________ |
Added: svn:eol-style |
80 | 80 | + native |
Property changes on: trunk/extensions/DonationInterface/GeoIP/GeoIPCountryWhois.csv |
___________________________________________________________________ |
Added: svn:eol-style |
81 | 81 | + native |
Property changes on: trunk/extensions/DonationInterface/activemq_stomp/Stomp/Frame.php |
___________________________________________________________________ |
Added: svn:eol-style |
82 | 82 | + native |
Property changes on: trunk/extensions/ContributionTracking/ContributionTracking.sql |
___________________________________________________________________ |
Added: svn:eol-style |
83 | 83 | + native |