@@ -343,8 +343,9 @@ discard block |
||
343 | 343 | public function checkMapCache() { |
344 | 344 | $this->mapCacheID = md5 ( $this->serializeParams () ); |
345 | 345 | $filename = $this->mapCacheIDToFilename (); |
346 | - if (file_exists ( $filename )) |
|
347 | - return true; |
|
346 | + if (file_exists ( $filename )) { |
|
347 | + return true; |
|
348 | + } |
|
348 | 349 | } |
349 | 350 | public function serializeParams() { |
350 | 351 | return join ( "&", array ( |
@@ -398,8 +399,9 @@ discard block |
||
398 | 399 | * @param string $url |
399 | 400 | */ |
400 | 401 | public function fetchTile($url) { |
401 | - if ($this->useTileCache && ($cached = $this->checkTileCache ( $url ))) |
|
402 | - return $cached; |
|
402 | + if ($this->useTileCache && ($cached = $this->checkTileCache ( $url ))) { |
|
403 | + return $cached; |
|
404 | + } |
|
403 | 405 | |
404 | 406 | $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')'; |
405 | 407 | if (function_exists ( "curl_init" )) { |
@@ -467,7 +469,9 @@ discard block |
||
467 | 469 | * drawing colour |
468 | 470 | */ |
469 | 471 | private function drawGeometry($geom, $colour) { |
470 | - if (empty($geom)) return; |
|
472 | + if (empty($geom)) { |
|
473 | + return; |
|
474 | + } |
|
471 | 475 | |
472 | 476 | switch ($geom->geometryType ()) { |
473 | 477 | case 'GeometryCollection' : |
@@ -605,14 +609,18 @@ discard block |
||
605 | 609 | public function makeMap() { |
606 | 610 | $this->initCoords (); |
607 | 611 | $this->createBaseMap (); |
608 | - if (! empty ( $this->markers )) |
|
609 | - $this->placeMarkers (); |
|
610 | - if (file_exists ( $this->kmlFileName )) |
|
611 | - $this->drawKML (); |
|
612 | - if (file_exists ( $this->gpxFileName )) |
|
613 | - $this->drawGPX (); |
|
614 | - if (file_exists ( $this->geojsonFileName )) |
|
615 | - $this->drawGeojson (); |
|
612 | + if (! empty ( $this->markers )) { |
|
613 | + $this->placeMarkers (); |
|
614 | + } |
|
615 | + if (file_exists ( $this->kmlFileName )) { |
|
616 | + $this->drawKML (); |
|
617 | + } |
|
618 | + if (file_exists ( $this->gpxFileName )) { |
|
619 | + $this->drawGPX (); |
|
620 | + } |
|
621 | + if (file_exists ( $this->geojsonFileName )) { |
|
622 | + $this->drawGeojson (); |
|
623 | + } |
|
616 | 624 | |
617 | 625 | $this->drawCopyright (); |
618 | 626 | } |
@@ -14,10 +14,12 @@ discard block |
||
14 | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | */ |
17 | -if (! defined ( 'DOKU_INC' )) |
|
17 | +if (! defined ( 'DOKU_INC' )) { |
|
18 | 18 | define ( 'DOKU_INC', realpath ( dirname ( __FILE__ ) . '/../../' ) . '/' ); |
19 | -if (! defined ( 'DOKU_PLUGIN' )) |
|
19 | +} |
|
20 | +if (! defined ( 'DOKU_PLUGIN' )) { |
|
20 | 21 | define ( 'DOKU_PLUGIN', DOKU_INC . 'lib/plugins/' ); |
22 | +} |
|
21 | 23 | require_once (DOKU_PLUGIN . 'syntax.php'); |
22 | 24 | |
23 | 25 | /** |
@@ -582,8 +584,9 @@ discard block |
||
582 | 584 | $imgUrl .= "?ma=" . $bbox ['minlat'] . "%2C" . $bbox ['minlon'] . "%2C" . $bbox ['maxlat'] . "%2C" . $bbox ['maxlon']; |
583 | 585 | $imgUrl .= "&dcl=1"; |
584 | 586 | } |
585 | - if (strpos ( $imgUrl, "?" ) === false) |
|
586 | - $imgUrl .= "?"; |
|
587 | + if (strpos ( $imgUrl, "?" ) === false) { |
|
588 | + $imgUrl .= "?"; |
|
589 | + } |
|
587 | 590 | |
588 | 591 | //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . "," . str_replace ( "px", "", $gmap ['height'] ); |
589 | 592 | $imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . "%2C" . str_replace ( "px", "", $gmap ['height'] ); |
@@ -14,8 +14,12 @@ discard block |
||
14 | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | */ |
17 | -if (!defined('DOKU_INC')) die(); |
|
18 | -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
17 | +if (!defined('DOKU_INC')) { |
|
18 | + die(); |
|
19 | +} |
|
20 | +if (!defined('DOKU_PLUGIN')) { |
|
21 | + define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
22 | +} |
|
19 | 23 | require_once DOKU_PLUGIN.'openlayersmap/StaticMap.php'; |
20 | 24 | /** |
21 | 25 | * DokuWiki Plugin openlayersmap (staticmap Helper Component). |
@@ -77,13 +81,19 @@ discard block |
||
77 | 81 | |
78 | 82 | // normalize zoom |
79 | 83 | $zoom = $zoom?intval($zoom):0; |
80 | - if($zoom > 18) $zoom = 18; |
|
84 | + if($zoom > 18) { |
|
85 | + $zoom = 18; |
|
86 | + } |
|
81 | 87 | // normalize WxH |
82 | 88 | list($width, $height) = explode('x',$size); |
83 | 89 | $width = intval($width); |
84 | - if($width > $this->maxWidth) $width = $this->maxWidth; |
|
90 | + if($width > $this->maxWidth) { |
|
91 | + $width = $this->maxWidth; |
|
92 | + } |
|
85 | 93 | $height = intval($height); |
86 | - if($height > $this->maxHeight) $height = $this->maxHeight; |
|
94 | + if($height > $this->maxHeight) { |
|
95 | + $height = $this->maxHeight; |
|
96 | + } |
|
87 | 97 | |
88 | 98 | // cleanup/validate gpx/kml |
89 | 99 | $kml = $this->mediaIdToPath($kml); |
@@ -24,44 +24,44 @@ |
||
24 | 24 | */ |
25 | 25 | class general_plugin_openlayersmap_test extends DokuWikiTest { |
26 | 26 | |
27 | - protected $pluginsEnabled = array('openlayersmap','geophp'); |
|
27 | + protected $pluginsEnabled = array('openlayersmap','geophp'); |
|
28 | 28 | |
29 | - /** |
|
30 | - * Simple test to make sure the plugin.info.txt is in correct format |
|
31 | - */ |
|
32 | - public function test_plugininfo() { |
|
33 | - $file = __DIR__.'/../plugin.info.txt'; |
|
34 | - $this->assertFileExists($file); |
|
29 | + /** |
|
30 | + * Simple test to make sure the plugin.info.txt is in correct format |
|
31 | + */ |
|
32 | + public function test_plugininfo() { |
|
33 | + $file = __DIR__.'/../plugin.info.txt'; |
|
34 | + $this->assertFileExists($file); |
|
35 | 35 | |
36 | - $info = confToHash($file); |
|
36 | + $info = confToHash($file); |
|
37 | 37 | |
38 | - $this->assertArrayHasKey('base', $info); |
|
39 | - $this->assertArrayHasKey('author', $info); |
|
40 | - $this->assertArrayHasKey('email', $info); |
|
41 | - $this->assertArrayHasKey('date', $info); |
|
42 | - $this->assertArrayHasKey('name', $info); |
|
43 | - $this->assertArrayHasKey('desc', $info); |
|
44 | - $this->assertArrayHasKey('url', $info); |
|
38 | + $this->assertArrayHasKey('base', $info); |
|
39 | + $this->assertArrayHasKey('author', $info); |
|
40 | + $this->assertArrayHasKey('email', $info); |
|
41 | + $this->assertArrayHasKey('date', $info); |
|
42 | + $this->assertArrayHasKey('name', $info); |
|
43 | + $this->assertArrayHasKey('desc', $info); |
|
44 | + $this->assertArrayHasKey('url', $info); |
|
45 | 45 | |
46 | - $this->assertEquals('openlayersmap', $info['base']); |
|
47 | - $this->assertRegExp('/^https?:\/\//', $info['url']); |
|
48 | - $this->assertTrue(mail_isvalid($info['email'])); |
|
49 | - $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
50 | - $this->assertTrue(false !== strtotime($info['date'])); |
|
51 | - } |
|
46 | + $this->assertEquals('openlayersmap', $info['base']); |
|
47 | + $this->assertRegExp('/^https?:\/\//', $info['url']); |
|
48 | + $this->assertTrue(mail_isvalid($info['email'])); |
|
49 | + $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
50 | + $this->assertTrue(false !== strtotime($info['date'])); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * test if plugin is loaded. |
|
55 | - */ |
|
56 | - public function test_plugin_openlayersmap_isloaded() { |
|
57 | - global $plugin_controller; |
|
58 | - $this->assertTrue( |
|
59 | - in_array('geophp', $plugin_controller->getList()), |
|
60 | - "geophp plugin is loaded" |
|
61 | - ); |
|
62 | - $this->assertTrue( |
|
63 | - in_array('openlayersmap', $plugin_controller->getList()), |
|
64 | - "openlayersmap plugin is loaded" |
|
65 | - ); |
|
66 | - } |
|
53 | + /** |
|
54 | + * test if plugin is loaded. |
|
55 | + */ |
|
56 | + public function test_plugin_openlayersmap_isloaded() { |
|
57 | + global $plugin_controller; |
|
58 | + $this->assertTrue( |
|
59 | + in_array('geophp', $plugin_controller->getList()), |
|
60 | + "geophp plugin is loaded" |
|
61 | + ); |
|
62 | + $this->assertTrue( |
|
63 | + in_array('openlayersmap', $plugin_controller->getList()), |
|
64 | + "openlayersmap plugin is loaded" |
|
65 | + ); |
|
66 | + } |
|
67 | 67 | } |
@@ -14,8 +14,12 @@ discard block |
||
14 | 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | */ |
17 | -if (!defined('DOKU_INC')) die(); |
|
18 | -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
17 | +if (!defined('DOKU_INC')) { |
|
18 | + die(); |
|
19 | +} |
|
20 | +if (!defined('DOKU_PLUGIN')) { |
|
21 | + define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
22 | +} |
|
19 | 23 | require_once DOKU_PLUGIN.'admin.php'; |
20 | 24 | /** |
21 | 25 | * DokuWiki Plugin openlayersmap (Admin Component). |
@@ -45,14 +49,20 @@ discard block |
||
45 | 49 | */ |
46 | 50 | public function handle() { |
47 | 51 | global $conf; |
48 | - if(!isset($_REQUEST['continue']) || !checkSecurityToken()) return; |
|
52 | + if(!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
53 | + return; |
|
54 | + } |
|
49 | 55 | if(isset($_REQUEST['purgetiles'])){ |
50 | 56 | $path = $conf['cachedir'].'/olmaptiles'; |
51 | - if ($this->rrmdir($path)) msg($this->getLang('admin_purged_tiles'),0); |
|
57 | + if ($this->rrmdir($path)) { |
|
58 | + msg($this->getLang('admin_purged_tiles'),0); |
|
59 | + } |
|
52 | 60 | } |
53 | 61 | if(isset($_REQUEST['purgemaps'])){ |
54 | 62 | $path = $conf['mediadir'].'/olmapmaps'; |
55 | - if ($this->rrmdir($path)) msg($this->getLang('admin_purged_maps'),0); |
|
63 | + if ($this->rrmdir($path)) { |
|
64 | + msg($this->getLang('admin_purged_maps'),0); |
|
65 | + } |
|
56 | 66 | } |
57 | 67 | } |
58 | 68 |
@@ -15,8 +15,12 @@ |
||
15 | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('DOKU_INC')) die(); |
|
19 | -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); |
|
18 | +if (!defined('DOKU_INC')) { |
|
19 | + die(); |
|
20 | +} |
|
21 | +if (!defined('DOKU_PLUGIN')) { |
|
22 | + define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); |
|
23 | +} |
|
20 | 24 | require_once (DOKU_PLUGIN . 'action.php'); |
21 | 25 | /** |
22 | 26 | * Plugin OL Maps: Allow Display of a OpenLayers Map in a wiki page. |