@@ -42,9 +42,9 @@ |
||
42 | 42 | </head> |
43 | 43 | <body> |
44 | 44 | <div class="box"><?php |
45 | - foreach(glob('*.png') as $img) { |
|
46 | - echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> '; |
|
47 | - } |
|
48 | - ?></div> |
|
45 | + foreach(glob('*.png') as $img) { |
|
46 | + echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> '; |
|
47 | + } |
|
48 | + ?></div> |
|
49 | 49 | </body> |
50 | 50 | </html> |
@@ -42,8 +42,8 @@ |
||
42 | 42 | </head> |
43 | 43 | <body> |
44 | 44 | <div class="box"><?php |
45 | - foreach(glob('*.png') as $img) { |
|
46 | - echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> '; |
|
45 | + foreach (glob('*.png') as $img) { |
|
46 | + echo '<img src="'.$img.'" alt="'.$img.'" title="'.$img.'" /> '; |
|
47 | 47 | } |
48 | 48 | ?></div> |
49 | 49 | </body> |
@@ -25,127 +25,127 @@ |
||
25 | 25 | */ |
26 | 26 | class helper_plugin_openlayersmap_staticmap extends DokuWiki_Plugin |
27 | 27 | { |
28 | - /** maximum width of the resulting image. */ |
|
29 | - private $maxWidth = 1024; |
|
30 | - /** maximum heigth of the resulting image. */ |
|
31 | - private $maxHeight = 1024; |
|
28 | + /** maximum width of the resulting image. */ |
|
29 | + private $maxWidth = 1024; |
|
30 | + /** maximum heigth of the resulting image. */ |
|
31 | + private $maxHeight = 1024; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Provide metadata of the public methods of this class. |
|
35 | - * |
|
36 | - * @return array Information to all provided methods. |
|
37 | - */ |
|
38 | - public function getMethods(): array |
|
39 | - { |
|
40 | - $result = array(); |
|
41 | - $result[] = array( |
|
42 | - 'name' => 'getMap', |
|
43 | - 'desc' => 'returns url to the image', |
|
44 | - 'params' => array( |
|
45 | - 'lat' => 'float', |
|
46 | - 'lon' => 'float', |
|
47 | - 'zoom' => 'integer', |
|
48 | - 'size' => 'string', |
|
49 | - 'maptype' => 'string', |
|
50 | - 'markers' => 'string', |
|
51 | - 'gpx' => 'string', |
|
52 | - 'kml' => 'string', |
|
53 | - 'geojson' => 'string', |
|
54 | - 'apikey' => 'string' |
|
55 | - ), |
|
56 | - 'return' => array('image' => 'string'), |
|
57 | - ); |
|
58 | - return $result; |
|
59 | - } |
|
33 | + /** |
|
34 | + * Provide metadata of the public methods of this class. |
|
35 | + * |
|
36 | + * @return array Information to all provided methods. |
|
37 | + */ |
|
38 | + public function getMethods(): array |
|
39 | + { |
|
40 | + $result = array(); |
|
41 | + $result[] = array( |
|
42 | + 'name' => 'getMap', |
|
43 | + 'desc' => 'returns url to the image', |
|
44 | + 'params' => array( |
|
45 | + 'lat' => 'float', |
|
46 | + 'lon' => 'float', |
|
47 | + 'zoom' => 'integer', |
|
48 | + 'size' => 'string', |
|
49 | + 'maptype' => 'string', |
|
50 | + 'markers' => 'string', |
|
51 | + 'gpx' => 'string', |
|
52 | + 'kml' => 'string', |
|
53 | + 'geojson' => 'string', |
|
54 | + 'apikey' => 'string' |
|
55 | + ), |
|
56 | + 'return' => array('image' => 'string'), |
|
57 | + ); |
|
58 | + return $result; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Create the map. |
|
63 | - * |
|
64 | - * @param float $lat the latitude of the map's center, eg. 40.714728 |
|
65 | - * @param float $lon the longitude of the map's center, eg -73.998672 |
|
66 | - * @param int $zoom the zoom level in the tile cache, eg. 14 |
|
67 | - * @param string $size the size in WxH px, eg. 512x512 |
|
68 | - * @param string $maptype the maptype, eg. cycle |
|
69 | - * @param array $markers associative array of markers, array('lat'=>$lat,'lon'=>$lon,'type'=>$iconStyle), |
|
70 | - * eg. array('lat'=>40.702147,'lon'=>-74.015794,'type'=>lightblue1); |
|
71 | - * @param string $gpx media link |
|
72 | - * @param string $kml media link |
|
73 | - * @param string $geojson media link |
|
74 | - * @param string $apikey optional API key eg. for Thunderforest maps |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getMap( |
|
79 | - float $lat, |
|
80 | - float $lon, |
|
81 | - int $zoom, |
|
82 | - string $size, |
|
83 | - string $maptype, |
|
84 | - array $markers, |
|
85 | - string $gpx, |
|
86 | - string $kml, |
|
87 | - string $geojson, |
|
88 | - string $apikey = '' |
|
89 | - ): string { |
|
90 | - global $conf; |
|
91 | - // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: markers :',$markers); |
|
61 | + /** |
|
62 | + * Create the map. |
|
63 | + * |
|
64 | + * @param float $lat the latitude of the map's center, eg. 40.714728 |
|
65 | + * @param float $lon the longitude of the map's center, eg -73.998672 |
|
66 | + * @param int $zoom the zoom level in the tile cache, eg. 14 |
|
67 | + * @param string $size the size in WxH px, eg. 512x512 |
|
68 | + * @param string $maptype the maptype, eg. cycle |
|
69 | + * @param array $markers associative array of markers, array('lat'=>$lat,'lon'=>$lon,'type'=>$iconStyle), |
|
70 | + * eg. array('lat'=>40.702147,'lon'=>-74.015794,'type'=>lightblue1); |
|
71 | + * @param string $gpx media link |
|
72 | + * @param string $kml media link |
|
73 | + * @param string $geojson media link |
|
74 | + * @param string $apikey optional API key eg. for Thunderforest maps |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getMap( |
|
79 | + float $lat, |
|
80 | + float $lon, |
|
81 | + int $zoom, |
|
82 | + string $size, |
|
83 | + string $maptype, |
|
84 | + array $markers, |
|
85 | + string $gpx, |
|
86 | + string $kml, |
|
87 | + string $geojson, |
|
88 | + string $apikey = '' |
|
89 | + ): string { |
|
90 | + global $conf; |
|
91 | + // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: markers :',$markers); |
|
92 | 92 | |
93 | - // normalize zoom |
|
94 | - $zoom = $zoom ?: 0; |
|
95 | - if ($zoom > 18) { |
|
96 | - $zoom = 18; |
|
97 | - } |
|
98 | - // normalize WxH |
|
99 | - list($width, $height) = explode('x', $size); |
|
100 | - $width = (int)$width; |
|
101 | - if ($width > $this->maxWidth) { |
|
102 | - $width = $this->maxWidth; |
|
103 | - } |
|
104 | - $height = (int)$height; |
|
105 | - if ($height > $this->maxHeight) { |
|
106 | - $height = $this->maxHeight; |
|
107 | - } |
|
93 | + // normalize zoom |
|
94 | + $zoom = $zoom ?: 0; |
|
95 | + if ($zoom > 18) { |
|
96 | + $zoom = 18; |
|
97 | + } |
|
98 | + // normalize WxH |
|
99 | + list($width, $height) = explode('x', $size); |
|
100 | + $width = (int)$width; |
|
101 | + if ($width > $this->maxWidth) { |
|
102 | + $width = $this->maxWidth; |
|
103 | + } |
|
104 | + $height = (int)$height; |
|
105 | + if ($height > $this->maxHeight) { |
|
106 | + $height = $this->maxHeight; |
|
107 | + } |
|
108 | 108 | |
109 | - // cleanup/validate gpx/kml |
|
110 | - $kml = $this->mediaIdToPath($kml); |
|
111 | - // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: kml file:',$kml); |
|
112 | - $gpx = $this->mediaIdToPath($gpx); |
|
113 | - // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: gpx file:',$gpx); |
|
114 | - $geojson = $this->mediaIdToPath($geojson); |
|
109 | + // cleanup/validate gpx/kml |
|
110 | + $kml = $this->mediaIdToPath($kml); |
|
111 | + // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: kml file:',$kml); |
|
112 | + $gpx = $this->mediaIdToPath($gpx); |
|
113 | + // Logger::debug('helper_plugin_openlayersmap_staticmap::getMap: gpx file:',$gpx); |
|
114 | + $geojson = $this->mediaIdToPath($geojson); |
|
115 | 115 | |
116 | - // create map |
|
117 | - require_once DOKU_PLUGIN . 'openlayersmap/StaticMap.php'; |
|
118 | - $map = new StaticMap( |
|
119 | - $lat, $lon, $zoom, $width, $height, $maptype, |
|
120 | - $markers, $gpx, $kml, $geojson, $conf['mediadir'], $conf['cachedir'], |
|
121 | - $this->getConf('autoZoomMap'), $apikey |
|
122 | - ); |
|
116 | + // create map |
|
117 | + require_once DOKU_PLUGIN . 'openlayersmap/StaticMap.php'; |
|
118 | + $map = new StaticMap( |
|
119 | + $lat, $lon, $zoom, $width, $height, $maptype, |
|
120 | + $markers, $gpx, $kml, $geojson, $conf['mediadir'], $conf['cachedir'], |
|
121 | + $this->getConf('autoZoomMap'), $apikey |
|
122 | + ); |
|
123 | 123 | |
124 | - // return the media id url |
|
125 | - // $mediaId = str_replace('/', ':', $map->getMap()); |
|
126 | - // if($this->startsWith($mediaId,':')) { |
|
127 | - // $mediaId = substr($mediaId, 1); |
|
128 | - // } |
|
129 | - // return $mediaId; |
|
130 | - return str_replace('/', ':', $map->getMap()); |
|
131 | - } |
|
124 | + // return the media id url |
|
125 | + // $mediaId = str_replace('/', ':', $map->getMap()); |
|
126 | + // if($this->startsWith($mediaId,':')) { |
|
127 | + // $mediaId = substr($mediaId, 1); |
|
128 | + // } |
|
129 | + // return $mediaId; |
|
130 | + return str_replace('/', ':', $map->getMap()); |
|
131 | + } |
|
132 | 132 | |
133 | - /** |
|
134 | - * Constructs the path to a file. |
|
135 | - * @param string $id the DW media id |
|
136 | - * @return string the path to the file |
|
137 | - */ |
|
138 | - private function mediaIdToPath(string $id): string |
|
139 | - { |
|
140 | - global $conf; |
|
141 | - if (empty($id)) { |
|
142 | - return ""; |
|
143 | - } |
|
144 | - $id = str_replace(array("[[", "]]"), "", $id); |
|
145 | - if ((strpos($id, ':') === 0)) { |
|
146 | - $id = substr($id, 1); |
|
147 | - } |
|
148 | - $id = str_replace(":", "/", $id); |
|
149 | - return $conf['mediadir'] . '/' . $id; |
|
150 | - } |
|
133 | + /** |
|
134 | + * Constructs the path to a file. |
|
135 | + * @param string $id the DW media id |
|
136 | + * @return string the path to the file |
|
137 | + */ |
|
138 | + private function mediaIdToPath(string $id): string |
|
139 | + { |
|
140 | + global $conf; |
|
141 | + if (empty($id)) { |
|
142 | + return ""; |
|
143 | + } |
|
144 | + $id = str_replace(array("[[", "]]"), "", $id); |
|
145 | + if ((strpos($id, ':') === 0)) { |
|
146 | + $id = substr($id, 1); |
|
147 | + } |
|
148 | + $id = str_replace(":", "/", $id); |
|
149 | + return $conf['mediadir'] . '/' . $id; |
|
150 | + } |
|
151 | 151 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | } |
98 | 98 | // normalize WxH |
99 | 99 | list($width, $height) = explode('x', $size); |
100 | - $width = (int)$width; |
|
100 | + $width = (int) $width; |
|
101 | 101 | if ($width > $this->maxWidth) { |
102 | 102 | $width = $this->maxWidth; |
103 | 103 | } |
104 | - $height = (int)$height; |
|
104 | + $height = (int) $height; |
|
105 | 105 | if ($height > $this->maxHeight) { |
106 | 106 | $height = $this->maxHeight; |
107 | 107 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $geojson = $this->mediaIdToPath($geojson); |
115 | 115 | |
116 | 116 | // create map |
117 | - require_once DOKU_PLUGIN . 'openlayersmap/StaticMap.php'; |
|
117 | + require_once DOKU_PLUGIN.'openlayersmap/StaticMap.php'; |
|
118 | 118 | $map = new StaticMap( |
119 | 119 | $lat, $lon, $zoom, $width, $height, $maptype, |
120 | 120 | $markers, $gpx, $kml, $geojson, $conf['mediadir'], $conf['cachedir'], |
@@ -146,6 +146,6 @@ discard block |
||
146 | 146 | $id = substr($id, 1); |
147 | 147 | } |
148 | 148 | $id = str_replace(":", "/", $id); |
149 | - return $conf['mediadir'] . '/' . $id; |
|
149 | + return $conf['mediadir'].'/'.$id; |
|
150 | 150 | } |
151 | 151 | } |
@@ -22,74 +22,74 @@ |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | $meta['enableOSM'] = array( |
25 | - 'onoff' |
|
25 | + 'onoff' |
|
26 | 26 | ); |
27 | 27 | $meta['enableStamen'] = array( |
28 | - 'onoff' |
|
28 | + 'onoff' |
|
29 | 29 | ); |
30 | 30 | $meta['enableGoogle'] = array( |
31 | - 'onoff' |
|
31 | + 'onoff' |
|
32 | 32 | ); |
33 | 33 | $meta['googleAPIkey'] = array( |
34 | - 'string' |
|
34 | + 'string' |
|
35 | 35 | ); |
36 | 36 | $meta['enableBing'] = array( |
37 | - 'onoff' |
|
37 | + 'onoff' |
|
38 | 38 | ); |
39 | 39 | $meta['bingAPIKey'] = array( |
40 | - 'string' |
|
40 | + 'string' |
|
41 | 41 | ); |
42 | 42 | $meta['tfApiKey'] = array( |
43 | - 'string' |
|
43 | + 'string' |
|
44 | 44 | ); |
45 | 45 | $meta['iconUrlOverload'] = array( |
46 | - 'string' |
|
46 | + 'string' |
|
47 | 47 | ); |
48 | 48 | $meta['enableA11y'] = array( |
49 | - 'onoff' |
|
49 | + 'onoff' |
|
50 | 50 | ); |
51 | 51 | $meta['optionStaticMapGenerator'] = array( |
52 | - 'multichoice', |
|
53 | - '_choices' => array('local', 'remote') |
|
52 | + 'multichoice', |
|
53 | + '_choices' => array('local', 'remote') |
|
54 | 54 | ); |
55 | 55 | $meta['autoZoomMap'] = array( |
56 | - 'onoff' |
|
56 | + 'onoff' |
|
57 | 57 | ); |
58 | 58 | $meta ['displayformat'] = array( |
59 | - 'multichoice', |
|
60 | - '_choices' => array('DD', 'DMS') |
|
59 | + 'multichoice', |
|
60 | + '_choices' => array('DD', 'DMS') |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $meta ['default_width'] = array( |
64 | - 'string' |
|
64 | + 'string' |
|
65 | 65 | ); |
66 | 66 | $meta ['default_height'] = array( |
67 | - 'string' |
|
67 | + 'string' |
|
68 | 68 | ); |
69 | 69 | $meta ['default_zoom'] = array( |
70 | - 'string' |
|
70 | + 'string' |
|
71 | 71 | ); |
72 | 72 | $meta ['default_autozoom'] = array( |
73 | - 'onoff' |
|
73 | + 'onoff' |
|
74 | 74 | ); |
75 | 75 | $meta ['default_statusbar'] = array( |
76 | - 'onoff' |
|
76 | + 'onoff' |
|
77 | 77 | ); |
78 | 78 | $meta ['default_toolbar'] = array( |
79 | - 'onoff' |
|
79 | + 'onoff' |
|
80 | 80 | ); |
81 | 81 | $meta ['default_controls'] = array( |
82 | - 'onoff' |
|
82 | + 'onoff' |
|
83 | 83 | ); |
84 | 84 | $meta ['default_poihoverstyle'] = array( |
85 | - 'onoff' |
|
85 | + 'onoff' |
|
86 | 86 | ); |
87 | 87 | $meta ['default_kmlfile'] = array( |
88 | - 'string' |
|
88 | + 'string' |
|
89 | 89 | ); |
90 | 90 | $meta ['default_gpxfile'] = array( |
91 | - 'string' |
|
91 | + 'string' |
|
92 | 92 | ); |
93 | 93 | $meta ['default_geojsonfile'] = array( |
94 | - 'string' |
|
94 | + 'string' |
|
95 | 95 | ); |
@@ -27,108 +27,108 @@ |
||
27 | 27 | */ |
28 | 28 | class admin_plugin_openlayersmap_purge extends DokuWiki_Admin_Plugin |
29 | 29 | { |
30 | - /** |
|
31 | - * (non-PHPdoc) |
|
32 | - * @see DokuWiki_Admin_Plugin::getMenuSort() |
|
33 | - */ |
|
34 | - public function getMenuSort(): int |
|
35 | - { |
|
36 | - return 800; |
|
37 | - } |
|
30 | + /** |
|
31 | + * (non-PHPdoc) |
|
32 | + * @see DokuWiki_Admin_Plugin::getMenuSort() |
|
33 | + */ |
|
34 | + public function getMenuSort(): int |
|
35 | + { |
|
36 | + return 800; |
|
37 | + } |
|
38 | 38 | |
39 | - public function getMenuIcon(): string |
|
40 | - { |
|
41 | - $plugin = $this->getPluginName(); |
|
42 | - return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
43 | - } |
|
39 | + public function getMenuIcon(): string |
|
40 | + { |
|
41 | + $plugin = $this->getPluginName(); |
|
42 | + return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * (non-PHPdoc) |
|
47 | - * @see DokuWiki_Admin_Plugin::handle() |
|
48 | - */ |
|
49 | - public function handle(): void |
|
50 | - { |
|
51 | - global $conf; |
|
52 | - if (!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
53 | - return; |
|
54 | - } |
|
55 | - if (isset($_REQUEST['purgetiles'])) { |
|
56 | - $path = $conf['cachedir'] . '/olmaptiles'; |
|
57 | - if ($this->rrmdir($path)) { |
|
58 | - msg($this->getLang('admin_purged_tiles')); |
|
59 | - } |
|
60 | - } |
|
61 | - if (isset($_REQUEST['purgemaps'])) { |
|
62 | - $path = $conf['mediadir'] . '/olmapmaps'; |
|
63 | - if ($this->rrmdir($path)) { |
|
64 | - msg($this->getLang('admin_purged_maps')); |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
45 | + /** |
|
46 | + * (non-PHPdoc) |
|
47 | + * @see DokuWiki_Admin_Plugin::handle() |
|
48 | + */ |
|
49 | + public function handle(): void |
|
50 | + { |
|
51 | + global $conf; |
|
52 | + if (!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
53 | + return; |
|
54 | + } |
|
55 | + if (isset($_REQUEST['purgetiles'])) { |
|
56 | + $path = $conf['cachedir'] . '/olmaptiles'; |
|
57 | + if ($this->rrmdir($path)) { |
|
58 | + msg($this->getLang('admin_purged_tiles')); |
|
59 | + } |
|
60 | + } |
|
61 | + if (isset($_REQUEST['purgemaps'])) { |
|
62 | + $path = $conf['mediadir'] . '/olmapmaps'; |
|
63 | + if ($this->rrmdir($path)) { |
|
64 | + msg($this->getLang('admin_purged_maps')); |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Recursively delete the directory. |
|
71 | - * @param string $sDir directory path |
|
72 | - * @return boolean true when succesful |
|
73 | - */ |
|
74 | - private function rrmdir(string $sDir): bool |
|
75 | - { |
|
76 | - if (is_dir($sDir)) { |
|
77 | - Logger::debug('admin_plugin_openlayersmap_purge::rrmdir: recursively removing path: ', $sDir); |
|
78 | - $sDir = rtrim($sDir, '/'); |
|
79 | - $oDir = dir($sDir); |
|
80 | - while (($sFile = $oDir->read()) !== false) { |
|
81 | - if ($sFile !== '.' && $sFile !== '..') { |
|
82 | - (!is_link("$sDir/$sFile") && is_dir("$sDir/$sFile")) ? |
|
83 | - $this->rrmdir("$sDir/$sFile") : unlink("$sDir/$sFile"); |
|
84 | - } |
|
85 | - } |
|
86 | - $oDir->close(); |
|
87 | - rmdir($sDir); |
|
88 | - return true; |
|
89 | - } |
|
90 | - return false; |
|
91 | - } |
|
69 | + /** |
|
70 | + * Recursively delete the directory. |
|
71 | + * @param string $sDir directory path |
|
72 | + * @return boolean true when succesful |
|
73 | + */ |
|
74 | + private function rrmdir(string $sDir): bool |
|
75 | + { |
|
76 | + if (is_dir($sDir)) { |
|
77 | + Logger::debug('admin_plugin_openlayersmap_purge::rrmdir: recursively removing path: ', $sDir); |
|
78 | + $sDir = rtrim($sDir, '/'); |
|
79 | + $oDir = dir($sDir); |
|
80 | + while (($sFile = $oDir->read()) !== false) { |
|
81 | + if ($sFile !== '.' && $sFile !== '..') { |
|
82 | + (!is_link("$sDir/$sFile") && is_dir("$sDir/$sFile")) ? |
|
83 | + $this->rrmdir("$sDir/$sFile") : unlink("$sDir/$sFile"); |
|
84 | + } |
|
85 | + } |
|
86 | + $oDir->close(); |
|
87 | + rmdir($sDir); |
|
88 | + return true; |
|
89 | + } |
|
90 | + return false; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * (non-PHPdoc) |
|
95 | - * @see DokuWiki_Admin_Plugin::html() |
|
96 | - */ |
|
97 | - public function html(): void |
|
98 | - { |
|
99 | - echo $this->locale_xhtml('admin_intro'); |
|
100 | - $form = new Doku_Form(array('id' => 'olmap_purgeform', 'method' => 'post')); |
|
101 | - $form->addHidden('continue', 'go'); |
|
93 | + /** |
|
94 | + * (non-PHPdoc) |
|
95 | + * @see DokuWiki_Admin_Plugin::html() |
|
96 | + */ |
|
97 | + public function html(): void |
|
98 | + { |
|
99 | + echo $this->locale_xhtml('admin_intro'); |
|
100 | + $form = new Doku_Form(array('id' => 'olmap_purgeform', 'method' => 'post')); |
|
101 | + $form->addHidden('continue', 'go'); |
|
102 | 102 | |
103 | - $form->startFieldset($this->getLang('admin_tiles')); |
|
104 | - $form->addElement('<p>'); |
|
105 | - $form->addElement( |
|
106 | - '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />' |
|
107 | - ); |
|
108 | - $form->addElement( |
|
109 | - '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles') |
|
110 | - . '</label>' |
|
111 | - ); |
|
112 | - $form->addElement('</p>'); |
|
113 | - $form->endFieldset(); |
|
103 | + $form->startFieldset($this->getLang('admin_tiles')); |
|
104 | + $form->addElement('<p>'); |
|
105 | + $form->addElement( |
|
106 | + '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />' |
|
107 | + ); |
|
108 | + $form->addElement( |
|
109 | + '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles') |
|
110 | + . '</label>' |
|
111 | + ); |
|
112 | + $form->addElement('</p>'); |
|
113 | + $form->endFieldset(); |
|
114 | 114 | |
115 | - $form->startFieldset($this->getLang('admin_maps')); |
|
116 | - $form->addElement('<p>'); |
|
117 | - $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />'); |
|
118 | - $form->addElement( |
|
119 | - '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>' |
|
120 | - ); |
|
121 | - $form->addElement('</p>'); |
|
122 | - $form->endFieldset(); |
|
115 | + $form->startFieldset($this->getLang('admin_maps')); |
|
116 | + $form->addElement('<p>'); |
|
117 | + $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />'); |
|
118 | + $form->addElement( |
|
119 | + '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>' |
|
120 | + ); |
|
121 | + $form->addElement('</p>'); |
|
122 | + $form->endFieldset(); |
|
123 | 123 | |
124 | - $form->addElement( |
|
125 | - form_makeButton( |
|
126 | - 'submit', |
|
127 | - 'admin', |
|
128 | - $this->getLang('admin_submit'), |
|
129 | - array('accesskey' => 'p', 'title' => $this->getLang('admin_submit')) |
|
130 | - ) |
|
131 | - ); |
|
132 | - $form->printForm(); |
|
133 | - } |
|
124 | + $form->addElement( |
|
125 | + form_makeButton( |
|
126 | + 'submit', |
|
127 | + 'admin', |
|
128 | + $this->getLang('admin_submit'), |
|
129 | + array('accesskey' => 'p', 'title' => $this->getLang('admin_submit')) |
|
130 | + ) |
|
131 | + ); |
|
132 | + $form->printForm(); |
|
133 | + } |
|
134 | 134 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function getMenuIcon(): string |
40 | 40 | { |
41 | 41 | $plugin = $this->getPluginName(); |
42 | - return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
42 | + return DOKU_PLUGIN.$plugin.'/admin/purge.svg'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | return; |
54 | 54 | } |
55 | 55 | if (isset($_REQUEST['purgetiles'])) { |
56 | - $path = $conf['cachedir'] . '/olmaptiles'; |
|
56 | + $path = $conf['cachedir'].'/olmaptiles'; |
|
57 | 57 | if ($this->rrmdir($path)) { |
58 | 58 | msg($this->getLang('admin_purged_tiles')); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | if (isset($_REQUEST['purgemaps'])) { |
62 | - $path = $conf['mediadir'] . '/olmapmaps'; |
|
62 | + $path = $conf['mediadir'].'/olmapmaps'; |
|
63 | 63 | if ($this->rrmdir($path)) { |
64 | 64 | msg($this->getLang('admin_purged_maps')); |
65 | 65 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />' |
107 | 107 | ); |
108 | 108 | $form->addElement( |
109 | - '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles') |
|
109 | + '<label for="purgetiles" class="label">'.$this->getLang('admin_purge_tiles') |
|
110 | 110 | . '</label>' |
111 | 111 | ); |
112 | 112 | $form->addElement('</p>'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $form->addElement('<p>'); |
117 | 117 | $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />'); |
118 | 118 | $form->addElement( |
119 | - '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>' |
|
119 | + '<label for="purgemaps" class="label">'.$this->getLang('admin_purge_maps').'</label>' |
|
120 | 120 | ); |
121 | 121 | $form->addElement('</p>'); |
122 | 122 | $form->endFieldset(); |
@@ -25,49 +25,49 @@ |
||
25 | 25 | class action_plugin_openlayersmap extends DokuWiki_Action_Plugin |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * plugin should use this method to register its handlers with the DokuWiki's event controller |
|
30 | - * |
|
31 | - * @param $controller DokuWiki's event controller object. Also available as global $EVENT_HANDLER |
|
32 | - */ |
|
33 | - public function register(Doku_Event_Handler $controller) |
|
34 | - { |
|
35 | - $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insertButton', array()); |
|
36 | - $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'insertCSSSniffer'); |
|
37 | - } |
|
28 | + /** |
|
29 | + * plugin should use this method to register its handlers with the DokuWiki's event controller |
|
30 | + * |
|
31 | + * @param $controller DokuWiki's event controller object. Also available as global $EVENT_HANDLER |
|
32 | + */ |
|
33 | + public function register(Doku_Event_Handler $controller) |
|
34 | + { |
|
35 | + $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insertButton', array()); |
|
36 | + $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'insertCSSSniffer'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Inserts the toolbar button. |
|
41 | - * @param Doku_Event $event the DokuWiki event |
|
42 | - */ |
|
43 | - public function insertButton(Doku_Event $event, $param) |
|
44 | - { |
|
45 | - $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
46 | - $strOpen .= 'lon="5.1" zoom="12" statusbar="1" controls="1" poihoverstyle="0" '; |
|
47 | - $strOpen .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n'; |
|
48 | - $strOpen .= '~~ Plugin olmap help.\n'; |
|
49 | - $strOpen .= '~~ Required in the above tag are values for: id (unique on this page), width, heigth.\n'; |
|
50 | - $strOpen .= '~~ Also you will want to enter zoomlevel and lat, lon values that make sense for where you'; |
|
51 | - $strOpen .= '~~ want the map to start.\n\n'; |
|
52 | - $strOpen .= '~~ Below is an example of a POI, you can add as many as you want. '; |
|
53 | - $strOpen .= '~~ More examples: https://dokuwiki.org/plugin:openlayersmap \n'; |
|
54 | - $event->data[] = array( |
|
55 | - 'type' => 'format', |
|
56 | - 'title' => $this->getLang('openlayersmap'), |
|
57 | - 'icon' => '../../plugins/openlayersmap/toolbar/map.png', |
|
58 | - 'open' => $strOpen, |
|
59 | - 'sample' => '50.0117,5.1287,-90,.8,marker-green.png,Pont de Barbouillons; Daverdisse \\\\ external link: |
|
39 | + /** |
|
40 | + * Inserts the toolbar button. |
|
41 | + * @param Doku_Event $event the DokuWiki event |
|
42 | + */ |
|
43 | + public function insertButton(Doku_Event $event, $param) |
|
44 | + { |
|
45 | + $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
46 | + $strOpen .= 'lon="5.1" zoom="12" statusbar="1" controls="1" poihoverstyle="0" '; |
|
47 | + $strOpen .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n'; |
|
48 | + $strOpen .= '~~ Plugin olmap help.\n'; |
|
49 | + $strOpen .= '~~ Required in the above tag are values for: id (unique on this page), width, heigth.\n'; |
|
50 | + $strOpen .= '~~ Also you will want to enter zoomlevel and lat, lon values that make sense for where you'; |
|
51 | + $strOpen .= '~~ want the map to start.\n\n'; |
|
52 | + $strOpen .= '~~ Below is an example of a POI, you can add as many as you want. '; |
|
53 | + $strOpen .= '~~ More examples: https://dokuwiki.org/plugin:openlayersmap \n'; |
|
54 | + $event->data[] = array( |
|
55 | + 'type' => 'format', |
|
56 | + 'title' => $this->getLang('openlayersmap'), |
|
57 | + 'icon' => '../../plugins/openlayersmap/toolbar/map.png', |
|
58 | + 'open' => $strOpen, |
|
59 | + 'sample' => '50.0117,5.1287,-90,.8,marker-green.png,Pont de Barbouillons; Daverdisse \\\\ external link: |
|
60 | 60 | [[https://test.com|test.com]] \\\\ internal link: [[::start]]\\\\ **DW Formatting** \n', |
61 | - 'close' => '</olmap>\n', |
|
62 | - ); |
|
63 | - } |
|
61 | + 'close' => '</olmap>\n', |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | |
65 | - /** add a snippet of javascript into the head to do a css operation we can check for later on.*/ |
|
66 | - public function insertCSSSniffer(Doku_Event $event, $param) |
|
67 | - { |
|
68 | - $event->data["script"][] = array( |
|
69 | - "type" => "text/javascript", |
|
70 | - "_data" => "document.documentElement.className += ' olCSSsupported';", |
|
71 | - ); |
|
72 | - } |
|
65 | + /** add a snippet of javascript into the head to do a css operation we can check for later on.*/ |
|
66 | + public function insertCSSSniffer(Doku_Event $event, $param) |
|
67 | + { |
|
68 | + $event->data["script"][] = array( |
|
69 | + "type" => "text/javascript", |
|
70 | + "_data" => "document.documentElement.className += ' olCSSsupported';", |
|
71 | + ); |
|
72 | + } |
|
73 | 73 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function insertButton(Doku_Event $event, $param) |
44 | 44 | { |
45 | - $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
45 | + $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
46 | 46 | $strOpen .= 'lon="5.1" zoom="12" statusbar="1" controls="1" poihoverstyle="0" '; |
47 | 47 | $strOpen .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n'; |
48 | 48 | $strOpen .= '~~ Plugin olmap help.\n'; |
@@ -25,48 +25,48 @@ |
||
25 | 25 | class general_plugin_openlayersmap_test extends DokuWikiTest |
26 | 26 | { |
27 | 27 | |
28 | - protected $pluginsEnabled = array('openlayersmap', 'geophp'); |
|
28 | + protected $pluginsEnabled = array('openlayersmap', 'geophp'); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Simple test to make sure the plugin.info.txt is in correct format. |
|
32 | - */ |
|
33 | - final public function test_plugininfo(): void |
|
34 | - { |
|
35 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
36 | - self::assertFileExists($file); |
|
30 | + /** |
|
31 | + * Simple test to make sure the plugin.info.txt is in correct format. |
|
32 | + */ |
|
33 | + final public function test_plugininfo(): void |
|
34 | + { |
|
35 | + $file = __DIR__ . '/../plugin.info.txt'; |
|
36 | + self::assertFileExists($file); |
|
37 | 37 | |
38 | - $info = confToHash($file); |
|
38 | + $info = confToHash($file); |
|
39 | 39 | |
40 | - self::assertArrayHasKey('base', $info); |
|
41 | - self::assertArrayHasKey('author', $info); |
|
42 | - self::assertArrayHasKey('email', $info); |
|
43 | - self::assertArrayHasKey('date', $info); |
|
44 | - self::assertArrayHasKey('name', $info); |
|
45 | - self::assertArrayHasKey('desc', $info); |
|
46 | - self::assertArrayHasKey('url', $info); |
|
40 | + self::assertArrayHasKey('base', $info); |
|
41 | + self::assertArrayHasKey('author', $info); |
|
42 | + self::assertArrayHasKey('email', $info); |
|
43 | + self::assertArrayHasKey('date', $info); |
|
44 | + self::assertArrayHasKey('name', $info); |
|
45 | + self::assertArrayHasKey('desc', $info); |
|
46 | + self::assertArrayHasKey('url', $info); |
|
47 | 47 | |
48 | - self::assertEquals('openlayersmap', $info['base']); |
|
49 | - self::assertRegExp('/^https?:\/\//', $info['url']); |
|
50 | - self::assertTrue(mail_isvalid($info['email'])); |
|
51 | - self::assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
52 | - self::assertTrue(false !== strtotime($info['date'])); |
|
53 | - } |
|
48 | + self::assertEquals('openlayersmap', $info['base']); |
|
49 | + self::assertRegExp('/^https?:\/\//', $info['url']); |
|
50 | + self::assertTrue(mail_isvalid($info['email'])); |
|
51 | + self::assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
52 | + self::assertTrue(false !== strtotime($info['date'])); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * test if plugin is loaded. |
|
57 | - */ |
|
58 | - final public function test_plugin_openlayersmap_isloaded(): void |
|
59 | - { |
|
60 | - global $plugin_controller; |
|
61 | - self::assertContains( |
|
62 | - 'geophp', |
|
63 | - $plugin_controller->getList(), |
|
64 | - "geophp plugin is loaded" |
|
65 | - ); |
|
66 | - self::assertContains( |
|
67 | - 'openlayersmap', |
|
68 | - $plugin_controller->getList(), |
|
69 | - "openlayersmap plugin is loaded" |
|
70 | - ); |
|
71 | - } |
|
55 | + /** |
|
56 | + * test if plugin is loaded. |
|
57 | + */ |
|
58 | + final public function test_plugin_openlayersmap_isloaded(): void |
|
59 | + { |
|
60 | + global $plugin_controller; |
|
61 | + self::assertContains( |
|
62 | + 'geophp', |
|
63 | + $plugin_controller->getList(), |
|
64 | + "geophp plugin is loaded" |
|
65 | + ); |
|
66 | + self::assertContains( |
|
67 | + 'openlayersmap', |
|
68 | + $plugin_controller->getList(), |
|
69 | + "openlayersmap plugin is loaded" |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | final public function test_plugininfo(): void |
34 | 34 | { |
35 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
35 | + $file = __DIR__.'/../plugin.info.txt'; |
|
36 | 36 | self::assertFileExists($file); |
37 | 37 | |
38 | 38 | $info = confToHash($file); |
@@ -22,110 +22,110 @@ |
||
22 | 22 | */ |
23 | 23 | class syntax_plugin_openlayersmap_osmlayer extends DokuWiki_Syntax_Plugin |
24 | 24 | { |
25 | - private $dflt = array( |
|
26 | - 'id' => 'olmap', |
|
27 | - 'name' => '', |
|
28 | - 'url' => '', |
|
29 | - 'opacity' => 0.8, |
|
30 | - 'attribution' => '', |
|
31 | - 'visible' => false, |
|
32 | - 'cors' => null |
|
33 | - ); |
|
25 | + private $dflt = array( |
|
26 | + 'id' => 'olmap', |
|
27 | + 'name' => '', |
|
28 | + 'url' => '', |
|
29 | + 'opacity' => 0.8, |
|
30 | + 'attribution' => '', |
|
31 | + 'visible' => false, |
|
32 | + 'cors' => null |
|
33 | + ); |
|
34 | 34 | |
35 | - /** |
|
36 | - * (non-PHPdoc) |
|
37 | - * |
|
38 | - * @see DokuWiki_Syntax_Plugin::getPType() |
|
39 | - */ |
|
40 | - public function getPType(): string |
|
41 | - { |
|
42 | - return 'block'; |
|
43 | - } |
|
35 | + /** |
|
36 | + * (non-PHPdoc) |
|
37 | + * |
|
38 | + * @see DokuWiki_Syntax_Plugin::getPType() |
|
39 | + */ |
|
40 | + public function getPType(): string |
|
41 | + { |
|
42 | + return 'block'; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * (non-PHPdoc) |
|
47 | - * |
|
48 | - * @see DokuWiki_Syntax_Plugin::getType() |
|
49 | - */ |
|
50 | - public function getType(): string |
|
51 | - { |
|
52 | - // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
53 | - return 'baseonly'; |
|
54 | - } |
|
45 | + /** |
|
46 | + * (non-PHPdoc) |
|
47 | + * |
|
48 | + * @see DokuWiki_Syntax_Plugin::getType() |
|
49 | + */ |
|
50 | + public function getType(): string |
|
51 | + { |
|
52 | + // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
53 | + return 'baseonly'; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * (non-PHPdoc) |
|
58 | - * |
|
59 | - * @see Doku_Parser_Mode::getSort() |
|
60 | - */ |
|
61 | - public function getSort(): int |
|
62 | - { |
|
63 | - return 902; |
|
64 | - } |
|
56 | + /** |
|
57 | + * (non-PHPdoc) |
|
58 | + * |
|
59 | + * @see Doku_Parser_Mode::getSort() |
|
60 | + */ |
|
61 | + public function getSort(): int |
|
62 | + { |
|
63 | + return 902; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Connect to our special pattern. |
|
68 | - * |
|
69 | - * @see Doku_Parser_Mode::connectTo() |
|
70 | - */ |
|
71 | - public function connectTo($mode): void |
|
72 | - { |
|
73 | - // look for: <olmap_osmlayer id="olmap" name="sport" url="http://tiles.openseamap.org/sport/${z}/${x}/${y}.png" |
|
74 | - // visible="false" opacity=0.6 attribution="Some attribution"></olmap_osmlayer> |
|
75 | - $this->Lexer->addSpecialPattern( |
|
76 | - '<olmap_osmlayer ?[^>\n]*>.*?</olmap_osmlayer>', |
|
77 | - $mode, |
|
78 | - 'plugin_openlayersmap_osmlayer' |
|
79 | - ); |
|
80 | - } |
|
66 | + /** |
|
67 | + * Connect to our special pattern. |
|
68 | + * |
|
69 | + * @see Doku_Parser_Mode::connectTo() |
|
70 | + */ |
|
71 | + public function connectTo($mode): void |
|
72 | + { |
|
73 | + // look for: <olmap_osmlayer id="olmap" name="sport" url="http://tiles.openseamap.org/sport/${z}/${x}/${y}.png" |
|
74 | + // visible="false" opacity=0.6 attribution="Some attribution"></olmap_osmlayer> |
|
75 | + $this->Lexer->addSpecialPattern( |
|
76 | + '<olmap_osmlayer ?[^>\n]*>.*?</olmap_osmlayer>', |
|
77 | + $mode, |
|
78 | + 'plugin_openlayersmap_osmlayer' |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * (non-PHPdoc) |
|
84 | - * |
|
85 | - * @see DokuWiki_Syntax_Plugin::handle() |
|
86 | - */ |
|
87 | - public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
88 | - { |
|
89 | - $param = array(); |
|
90 | - $data = $this->dflt; |
|
82 | + /** |
|
83 | + * (non-PHPdoc) |
|
84 | + * |
|
85 | + * @see DokuWiki_Syntax_Plugin::handle() |
|
86 | + */ |
|
87 | + public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
88 | + { |
|
89 | + $param = array(); |
|
90 | + $data = $this->dflt; |
|
91 | 91 | |
92 | - preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
92 | + preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
93 | 93 | |
94 | - foreach ($param as $kvpair) { |
|
95 | - list ($matched, $key, $val) = $kvpair; |
|
96 | - if (isset ($data [$key])) { |
|
97 | - $key = strtolower($key); |
|
98 | - $data [$key] = $val; |
|
99 | - } |
|
100 | - } |
|
101 | - // dbglog($data,'syntax_plugin_overlayer::handle: parsed data is:'); |
|
102 | - return $data; |
|
103 | - } |
|
94 | + foreach ($param as $kvpair) { |
|
95 | + list ($matched, $key, $val) = $kvpair; |
|
96 | + if (isset ($data [$key])) { |
|
97 | + $key = strtolower($key); |
|
98 | + $data [$key] = $val; |
|
99 | + } |
|
100 | + } |
|
101 | + // dbglog($data,'syntax_plugin_overlayer::handle: parsed data is:'); |
|
102 | + return $data; |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * (non-PHPdoc) |
|
107 | - * |
|
108 | - * @see DokuWiki_Syntax_Plugin::render() |
|
109 | - */ |
|
110 | - public function render($format, Doku_Renderer $renderer, $data): bool |
|
111 | - { |
|
112 | - if ($format !== 'xhtml') { |
|
113 | - return false; |
|
114 | - } |
|
105 | + /** |
|
106 | + * (non-PHPdoc) |
|
107 | + * |
|
108 | + * @see DokuWiki_Syntax_Plugin::render() |
|
109 | + */ |
|
110 | + public function render($format, Doku_Renderer $renderer, $data): bool |
|
111 | + { |
|
112 | + if ($format !== 'xhtml') { |
|
113 | + return false; |
|
114 | + } |
|
115 | 115 | |
116 | - // incremented for each olmap_osmlayer tag in the page source |
|
117 | - static $overlaynumber = 0; |
|
116 | + // incremented for each olmap_osmlayer tag in the page source |
|
117 | + static $overlaynumber = 0; |
|
118 | 118 | |
119 | - list ($id, $url, $name, $visible) = $data; |
|
120 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | - $str = '{'; |
|
122 | - foreach ($data as $key => $val) { |
|
123 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
124 | - } |
|
125 | - $str .= '"type":"osm"}'; |
|
126 | - $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
127 | - . '"></script>'; |
|
128 | - $overlaynumber++; |
|
129 | - return true; |
|
130 | - } |
|
119 | + list ($id, $url, $name, $visible) = $data; |
|
120 | + $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | + $str = '{'; |
|
122 | + foreach ($data as $key => $val) { |
|
123 | + $str .= "'" . $key . "' : '" . $val . "',"; |
|
124 | + } |
|
125 | + $str .= '"type":"osm"}'; |
|
126 | + $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
127 | + . '"></script>'; |
|
128 | + $overlaynumber++; |
|
129 | + return true; |
|
130 | + } |
|
131 | 131 | } |
@@ -117,13 +117,13 @@ |
||
117 | 117 | static $overlaynumber = 0; |
118 | 118 | |
119 | 119 | list ($id, $url, $name, $visible) = $data; |
120 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | - $str = '{'; |
|
120 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | + $str = '{'; |
|
122 | 122 | foreach ($data as $key => $val) { |
123 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
123 | + $str .= "'".$key."' : '".$val."',"; |
|
124 | 124 | } |
125 | 125 | $str .= '"type":"osm"}'; |
126 | - $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
126 | + $renderer->doc .= base64_encode("olMapOverlays['osm".$overlaynumber."'] = ".$str.";") |
|
127 | 127 | . '"></script>'; |
128 | 128 | $overlaynumber++; |
129 | 129 | return true; |
@@ -22,114 +22,114 @@ |
||
22 | 22 | */ |
23 | 23 | class syntax_plugin_openlayersmap_agslayer extends DokuWiki_Syntax_Plugin |
24 | 24 | { |
25 | - private $dflt = array( |
|
26 | - 'id' => 'olmap', |
|
27 | - 'name' => '', |
|
28 | - 'url' => '', |
|
29 | - 'opacity' => 0.8, |
|
30 | - 'attribution' => '', |
|
31 | - 'visible' => false, |
|
32 | - 'layers' => '', |
|
33 | - 'format' => 'png', |
|
34 | - 'transparent' => 'true' |
|
35 | - ); |
|
25 | + private $dflt = array( |
|
26 | + 'id' => 'olmap', |
|
27 | + 'name' => '', |
|
28 | + 'url' => '', |
|
29 | + 'opacity' => 0.8, |
|
30 | + 'attribution' => '', |
|
31 | + 'visible' => false, |
|
32 | + 'layers' => '', |
|
33 | + 'format' => 'png', |
|
34 | + 'transparent' => 'true' |
|
35 | + ); |
|
36 | 36 | |
37 | - /** |
|
38 | - * (non-PHPdoc) |
|
39 | - * |
|
40 | - * @see DokuWiki_Syntax_Plugin::getPType() |
|
41 | - */ |
|
42 | - public function getPType(): string |
|
43 | - { |
|
44 | - return 'block'; |
|
45 | - } |
|
37 | + /** |
|
38 | + * (non-PHPdoc) |
|
39 | + * |
|
40 | + * @see DokuWiki_Syntax_Plugin::getPType() |
|
41 | + */ |
|
42 | + public function getPType(): string |
|
43 | + { |
|
44 | + return 'block'; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * (non-PHPdoc) |
|
49 | - * |
|
50 | - * @see DokuWiki_Syntax_Plugin::getType() |
|
51 | - */ |
|
52 | - public function getType(): string |
|
53 | - { |
|
54 | - // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
55 | - return 'baseonly'; |
|
56 | - } |
|
47 | + /** |
|
48 | + * (non-PHPdoc) |
|
49 | + * |
|
50 | + * @see DokuWiki_Syntax_Plugin::getType() |
|
51 | + */ |
|
52 | + public function getType(): string |
|
53 | + { |
|
54 | + // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
55 | + return 'baseonly'; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * (non-PHPdoc) |
|
60 | - * |
|
61 | - * @see Doku_Parser_Mode::getSort() |
|
62 | - */ |
|
63 | - public function getSort(): int |
|
64 | - { |
|
65 | - return 904; |
|
66 | - } |
|
58 | + /** |
|
59 | + * (non-PHPdoc) |
|
60 | + * |
|
61 | + * @see Doku_Parser_Mode::getSort() |
|
62 | + */ |
|
63 | + public function getSort(): int |
|
64 | + { |
|
65 | + return 904; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Connect to our special pattern. |
|
70 | - * |
|
71 | - * @see Doku_Parser_Mode::connectTo() |
|
72 | - */ |
|
73 | - public function connectTo($mode): void |
|
74 | - { |
|
75 | - // look for: <olmap_agslayer id="olmap" name="cloud" |
|
76 | - // url="http://geoservices2.wallonie.be/arcgis/rest/services/APP_KAYAK/KAYAK/MapServer/export" |
|
77 | - // attribution="wallonie.be" visible="true" layers="show:0,1,2,3,4,7"></olmap_agslayer> |
|
78 | - // sample: |
|
79 | - // http://geoservices2.wallonie.be/arcgis/rest/services/APP_KAYAK/KAYAK/MapServer/export?LAYERS=show%3A0%2C1%2C2%2C3%2C4%2C7&TRANSPARENT=true&FORMAT=png&BBOX=643294.029959%2C6467184.088252%2C645740.014863%2C6469630.073157&SIZE=256%2C256&F=html&BBOXSR=3857&IMAGESR=3857 |
|
80 | - $this->Lexer->addSpecialPattern( |
|
81 | - '<olmap_agslayer ?[^>\n]*>.*?</olmap_agslayer>', |
|
82 | - $mode, |
|
83 | - 'plugin_openlayersmap_agslayer' |
|
84 | - ); |
|
85 | - } |
|
68 | + /** |
|
69 | + * Connect to our special pattern. |
|
70 | + * |
|
71 | + * @see Doku_Parser_Mode::connectTo() |
|
72 | + */ |
|
73 | + public function connectTo($mode): void |
|
74 | + { |
|
75 | + // look for: <olmap_agslayer id="olmap" name="cloud" |
|
76 | + // url="http://geoservices2.wallonie.be/arcgis/rest/services/APP_KAYAK/KAYAK/MapServer/export" |
|
77 | + // attribution="wallonie.be" visible="true" layers="show:0,1,2,3,4,7"></olmap_agslayer> |
|
78 | + // sample: |
|
79 | + // http://geoservices2.wallonie.be/arcgis/rest/services/APP_KAYAK/KAYAK/MapServer/export?LAYERS=show%3A0%2C1%2C2%2C3%2C4%2C7&TRANSPARENT=true&FORMAT=png&BBOX=643294.029959%2C6467184.088252%2C645740.014863%2C6469630.073157&SIZE=256%2C256&F=html&BBOXSR=3857&IMAGESR=3857 |
|
80 | + $this->Lexer->addSpecialPattern( |
|
81 | + '<olmap_agslayer ?[^>\n]*>.*?</olmap_agslayer>', |
|
82 | + $mode, |
|
83 | + 'plugin_openlayersmap_agslayer' |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * (non-PHPdoc) |
|
89 | - * |
|
90 | - * @see DokuWiki_Syntax_Plugin::handle() |
|
91 | - */ |
|
92 | - public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
93 | - { |
|
94 | - $param = array(); |
|
95 | - $data = $this->dflt; |
|
87 | + /** |
|
88 | + * (non-PHPdoc) |
|
89 | + * |
|
90 | + * @see DokuWiki_Syntax_Plugin::handle() |
|
91 | + */ |
|
92 | + public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
93 | + { |
|
94 | + $param = array(); |
|
95 | + $data = $this->dflt; |
|
96 | 96 | |
97 | - preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
97 | + preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
98 | 98 | |
99 | - foreach ($param as $kvpair) { |
|
100 | - list ($matched, $key, $val) = $kvpair; |
|
101 | - if (isset ($data [$key])) { |
|
102 | - $key = strtolower($key); |
|
103 | - $data [$key] = $val; |
|
104 | - } |
|
105 | - } |
|
106 | - return $data; |
|
107 | - } |
|
99 | + foreach ($param as $kvpair) { |
|
100 | + list ($matched, $key, $val) = $kvpair; |
|
101 | + if (isset ($data [$key])) { |
|
102 | + $key = strtolower($key); |
|
103 | + $data [$key] = $val; |
|
104 | + } |
|
105 | + } |
|
106 | + return $data; |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * (non-PHPdoc) |
|
111 | - * |
|
112 | - * @see DokuWiki_Syntax_Plugin::render() |
|
113 | - */ |
|
114 | - public function render($format, Doku_Renderer $renderer, $data): bool |
|
115 | - { |
|
116 | - if ($format !== 'xhtml') { |
|
117 | - return false; |
|
118 | - } |
|
109 | + /** |
|
110 | + * (non-PHPdoc) |
|
111 | + * |
|
112 | + * @see DokuWiki_Syntax_Plugin::render() |
|
113 | + */ |
|
114 | + public function render($format, Doku_Renderer $renderer, $data): bool |
|
115 | + { |
|
116 | + if ($format !== 'xhtml') { |
|
117 | + return false; |
|
118 | + } |
|
119 | 119 | |
120 | - // incremented for each olmap_agslayer tag in the page source |
|
121 | - static $overlaynumber = 0; |
|
120 | + // incremented for each olmap_agslayer tag in the page source |
|
121 | + static $overlaynumber = 0; |
|
122 | 122 | |
123 | - list ($id, $url, $name, $visible) = $data; |
|
124 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | - $str = '{'; |
|
126 | - foreach ($data as $key => $val) { |
|
127 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
128 | - } |
|
129 | - $str .= "'type':'ags'}"; |
|
130 | - $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
131 | - . '"></script>'; |
|
132 | - $overlaynumber++; |
|
133 | - return true; |
|
134 | - } |
|
123 | + list ($id, $url, $name, $visible) = $data; |
|
124 | + $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | + $str = '{'; |
|
126 | + foreach ($data as $key => $val) { |
|
127 | + $str .= "'" . $key . "' : '" . $val . "',"; |
|
128 | + } |
|
129 | + $str .= "'type':'ags'}"; |
|
130 | + $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
131 | + . '"></script>'; |
|
132 | + $overlaynumber++; |
|
133 | + return true; |
|
134 | + } |
|
135 | 135 | } |
@@ -121,13 +121,13 @@ |
||
121 | 121 | static $overlaynumber = 0; |
122 | 122 | |
123 | 123 | list ($id, $url, $name, $visible) = $data; |
124 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | - $str = '{'; |
|
124 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | + $str = '{'; |
|
126 | 126 | foreach ($data as $key => $val) { |
127 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
127 | + $str .= "'".$key."' : '".$val."',"; |
|
128 | 128 | } |
129 | 129 | $str .= "'type':'ags'}"; |
130 | - $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
130 | + $renderer->doc .= base64_encode("olMapOverlays['ags".$overlaynumber."'] = ".$str.";") |
|
131 | 131 | . '"></script>'; |
132 | 132 | $overlaynumber++; |
133 | 133 | return true; |
@@ -22,113 +22,113 @@ |
||
22 | 22 | */ |
23 | 23 | class syntax_plugin_openlayersmap_wmslayer extends DokuWiki_Syntax_Plugin |
24 | 24 | { |
25 | - private $dflt = array( |
|
26 | - 'id' => 'olmap', |
|
27 | - 'name' => '', |
|
28 | - 'url' => '', |
|
29 | - 'opacity' => 0.8, |
|
30 | - 'attribution' => '', |
|
31 | - 'visible' => false, |
|
32 | - 'layers' => '', |
|
33 | - 'version' => '1.3.0', |
|
34 | - 'format' => 'image/png', |
|
35 | - 'transparent' => 'true' |
|
36 | - ); |
|
25 | + private $dflt = array( |
|
26 | + 'id' => 'olmap', |
|
27 | + 'name' => '', |
|
28 | + 'url' => '', |
|
29 | + 'opacity' => 0.8, |
|
30 | + 'attribution' => '', |
|
31 | + 'visible' => false, |
|
32 | + 'layers' => '', |
|
33 | + 'version' => '1.3.0', |
|
34 | + 'format' => 'image/png', |
|
35 | + 'transparent' => 'true' |
|
36 | + ); |
|
37 | 37 | |
38 | - /** |
|
39 | - * (non-PHPdoc) |
|
40 | - * |
|
41 | - * @see DokuWiki_Syntax_Plugin::getPType() |
|
42 | - */ |
|
43 | - public function getPType(): string |
|
44 | - { |
|
45 | - return 'block'; |
|
46 | - } |
|
38 | + /** |
|
39 | + * (non-PHPdoc) |
|
40 | + * |
|
41 | + * @see DokuWiki_Syntax_Plugin::getPType() |
|
42 | + */ |
|
43 | + public function getPType(): string |
|
44 | + { |
|
45 | + return 'block'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * (non-PHPdoc) |
|
50 | - * |
|
51 | - * @see DokuWiki_Syntax_Plugin::getType() |
|
52 | - */ |
|
53 | - public function getType(): string |
|
54 | - { |
|
55 | - // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
56 | - return 'baseonly'; |
|
57 | - } |
|
48 | + /** |
|
49 | + * (non-PHPdoc) |
|
50 | + * |
|
51 | + * @see DokuWiki_Syntax_Plugin::getType() |
|
52 | + */ |
|
53 | + public function getType(): string |
|
54 | + { |
|
55 | + // return 'FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs'; |
|
56 | + return 'baseonly'; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * (non-PHPdoc) |
|
61 | - * |
|
62 | - * @see Doku_Parser_Mode::getSort() |
|
63 | - */ |
|
64 | - public function getSort(): int |
|
65 | - { |
|
66 | - return 902; |
|
67 | - } |
|
59 | + /** |
|
60 | + * (non-PHPdoc) |
|
61 | + * |
|
62 | + * @see Doku_Parser_Mode::getSort() |
|
63 | + */ |
|
64 | + public function getSort(): int |
|
65 | + { |
|
66 | + return 902; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Connect to our special pattern. |
|
71 | - * |
|
72 | - * @see Doku_Parser_Mode::connectTo() |
|
73 | - */ |
|
74 | - public function connectTo($mode): void |
|
75 | - { |
|
76 | - // look for: <olmap_wmslayer id="olmap" name="cloud" url="http://openweathermap.org/t/tile.cgi?SERVICE=WMS" |
|
77 | - // attribution="OpenWeatherMap" visible="true" layers="GLBETA_PR"></olmap_wmslayer> |
|
78 | - $this->Lexer->addSpecialPattern( |
|
79 | - '<olmap_wmslayer ?[^>\n]*>.*?</olmap_wmslayer>', |
|
80 | - $mode, |
|
81 | - 'plugin_openlayersmap_wmslayer' |
|
82 | - ); |
|
83 | - } |
|
69 | + /** |
|
70 | + * Connect to our special pattern. |
|
71 | + * |
|
72 | + * @see Doku_Parser_Mode::connectTo() |
|
73 | + */ |
|
74 | + public function connectTo($mode): void |
|
75 | + { |
|
76 | + // look for: <olmap_wmslayer id="olmap" name="cloud" url="http://openweathermap.org/t/tile.cgi?SERVICE=WMS" |
|
77 | + // attribution="OpenWeatherMap" visible="true" layers="GLBETA_PR"></olmap_wmslayer> |
|
78 | + $this->Lexer->addSpecialPattern( |
|
79 | + '<olmap_wmslayer ?[^>\n]*>.*?</olmap_wmslayer>', |
|
80 | + $mode, |
|
81 | + 'plugin_openlayersmap_wmslayer' |
|
82 | + ); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * (non-PHPdoc) |
|
87 | - * |
|
88 | - * @see DokuWiki_Syntax_Plugin::handle() |
|
89 | - */ |
|
90 | - public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
91 | - { |
|
92 | - $param = array(); |
|
93 | - $data = $this->dflt; |
|
85 | + /** |
|
86 | + * (non-PHPdoc) |
|
87 | + * |
|
88 | + * @see DokuWiki_Syntax_Plugin::handle() |
|
89 | + */ |
|
90 | + public function handle($match, $state, $pos, Doku_Handler $handler): array |
|
91 | + { |
|
92 | + $param = array(); |
|
93 | + $data = $this->dflt; |
|
94 | 94 | |
95 | - preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
95 | + preg_match_all('/(\w*)="(.*?)"/us', $match, $param, PREG_SET_ORDER); |
|
96 | 96 | |
97 | - foreach ($param as $kvpair) { |
|
98 | - list ($matched, $key, $val) = $kvpair; |
|
99 | - if (isset ($data [$key])) { |
|
100 | - $key = strtolower($key); |
|
101 | - $data [$key] = $val; |
|
102 | - } |
|
103 | - } |
|
104 | - // dbglog($data,'syntax_plugin_overlayer::handle: parsed data is:'); |
|
105 | - return $data; |
|
106 | - } |
|
97 | + foreach ($param as $kvpair) { |
|
98 | + list ($matched, $key, $val) = $kvpair; |
|
99 | + if (isset ($data [$key])) { |
|
100 | + $key = strtolower($key); |
|
101 | + $data [$key] = $val; |
|
102 | + } |
|
103 | + } |
|
104 | + // dbglog($data,'syntax_plugin_overlayer::handle: parsed data is:'); |
|
105 | + return $data; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * (non-PHPdoc) |
|
110 | - * |
|
111 | - * @see DokuWiki_Syntax_Plugin::render() |
|
112 | - */ |
|
113 | - public function render($format, Doku_Renderer $renderer, $data): bool |
|
114 | - { |
|
115 | - if ($format !== 'xhtml') { |
|
116 | - return false; |
|
117 | - } |
|
108 | + /** |
|
109 | + * (non-PHPdoc) |
|
110 | + * |
|
111 | + * @see DokuWiki_Syntax_Plugin::render() |
|
112 | + */ |
|
113 | + public function render($format, Doku_Renderer $renderer, $data): bool |
|
114 | + { |
|
115 | + if ($format !== 'xhtml') { |
|
116 | + return false; |
|
117 | + } |
|
118 | 118 | |
119 | - // incremented for each olmap_wmslayer tag in the page source |
|
120 | - static $overlaynumber = 0; |
|
119 | + // incremented for each olmap_wmslayer tag in the page source |
|
120 | + static $overlaynumber = 0; |
|
121 | 121 | |
122 | - list ($id, $url, $name, $visible) = $data; |
|
123 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | - $str = '{'; |
|
125 | - foreach ($data as $key => $val) { |
|
126 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
127 | - } |
|
128 | - $str .= "'type':'wms'}"; |
|
129 | - $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
130 | - . '"></script>'; |
|
131 | - $overlaynumber++; |
|
132 | - return true; |
|
133 | - } |
|
122 | + list ($id, $url, $name, $visible) = $data; |
|
123 | + $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | + $str = '{'; |
|
125 | + foreach ($data as $key => $val) { |
|
126 | + $str .= "'" . $key . "' : '" . $val . "',"; |
|
127 | + } |
|
128 | + $str .= "'type':'wms'}"; |
|
129 | + $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
130 | + . '"></script>'; |
|
131 | + $overlaynumber++; |
|
132 | + return true; |
|
133 | + } |
|
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -120,13 +120,13 @@ |
||
120 | 120 | static $overlaynumber = 0; |
121 | 121 | |
122 | 122 | list ($id, $url, $name, $visible) = $data; |
123 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | - $str = '{'; |
|
123 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | + $str = '{'; |
|
125 | 125 | foreach ($data as $key => $val) { |
126 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
126 | + $str .= "'".$key."' : '".$val."',"; |
|
127 | 127 | } |
128 | 128 | $str .= "'type':'wms'}"; |
129 | - $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
129 | + $renderer->doc .= base64_encode("olMapOverlays['wms".$overlaynumber."'] = ".$str.";") |
|
130 | 130 | . '"></script>'; |
131 | 131 | $overlaynumber++; |
132 | 132 | return true; |