-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to 6.x alpha and add stub for GeoJson NS
- Loading branch information
1 parent
f23b59d
commit 124318f
Showing
11 changed files
with
153 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,58 +11,4 @@ | |
* @author Jeroen De Dauw < [email protected] > | ||
*/ | ||
|
||
use Maps\MapsSetup; | ||
|
||
if ( defined( 'Maps_COORDS_FLOAT' ) ) { | ||
// Do not initialize more than once. | ||
return 1; | ||
} | ||
|
||
// The different coordinate notations. | ||
define( 'Maps_COORDS_FLOAT', 'float' ); | ||
define( 'Maps_COORDS_DMS', 'dms' ); | ||
define( 'Maps_COORDS_DM', 'dm' ); | ||
define( 'Maps_COORDS_DD', 'dd' ); | ||
|
||
require_once __DIR__ . '/Maps_Settings.php'; | ||
|
||
// Include the composer autoloader if it is present. | ||
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { | ||
include_once( __DIR__ . '/vendor/autoload.php' ); | ||
} | ||
|
||
// Internationalization | ||
$GLOBALS['wgMessagesDirs']['Maps'] = __DIR__ . '/i18n'; | ||
$GLOBALS['wgExtensionMessagesFiles']['MapsMagic'] = __DIR__ . '/Maps.i18n.magic.php'; | ||
$GLOBALS['wgExtensionMessagesFiles']['MapsAlias'] = __DIR__ . '/Maps.i18n.alias.php'; | ||
|
||
$GLOBALS['wgExtensionFunctions'][] = function() { | ||
if ( $GLOBALS['egMapsDisableExtension'] ) { | ||
return true; | ||
} | ||
|
||
if ( defined( 'Maps_VERSION' ) ) { | ||
// Do not initialize more than once. | ||
return true; | ||
} | ||
|
||
// Only initialize the extension when all dependencies are present. | ||
if ( !defined( 'Validator_VERSION' ) ) { | ||
throw new Exception( 'You need to have Validator installed in order to use Maps' ); | ||
} | ||
|
||
if ( version_compare( $GLOBALS['wgVersion'], '1.27c', '<' ) ) { | ||
throw new Exception( | ||
'This version of Maps requires MediaWiki 1.27 or above; use Maps 4.2.x for older versions.' | ||
. ' More information at https://github.com/JeroenDeDauw/Maps/blob/master/INSTALL.md' | ||
); | ||
} | ||
|
||
define( 'Maps_VERSION', '5.7 alpha' ); | ||
define( 'SM_VERSION', Maps_VERSION ); | ||
|
||
( new MapsSetup( $GLOBALS ) )->setup(); | ||
|
||
return true; | ||
}; | ||
|
||
wfLoadExtension( 'Maps' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
use Maps\MapsSetup; | ||
|
||
class MapsRegistration { | ||
|
||
public static function onRegistration() { | ||
if ( defined( 'Maps_COORDS_FLOAT' ) ) { | ||
// Do not initialize more than once. | ||
return true; | ||
} | ||
|
||
// The different coordinate notations. | ||
define( 'Maps_COORDS_FLOAT', 'float' ); | ||
define( 'Maps_COORDS_DMS', 'dms' ); | ||
define( 'Maps_COORDS_DM', 'dm' ); | ||
define( 'Maps_COORDS_DD', 'dd' ); | ||
|
||
require_once __DIR__ . '/Maps_Settings.php'; | ||
|
||
// Internationalization | ||
$GLOBALS['wgMessagesDirs']['Maps.class'] = __DIR__ . '/i18n'; | ||
$GLOBALS['wgExtensionMessagesFiles']['MapsMagic'] = __DIR__ . '/Maps.i18n.magic.php'; | ||
$GLOBALS['wgExtensionMessagesFiles']['MapsAlias'] = __DIR__ . '/Maps.i18n.alias.php'; | ||
|
||
$GLOBALS['wgExtensionFunctions'][] = function() { | ||
if ( $GLOBALS['egMapsDisableExtension'] ) { | ||
return true; | ||
} | ||
|
||
if ( defined( 'Maps_VERSION' ) ) { | ||
// Do not initialize more than once. | ||
return true; | ||
} | ||
|
||
// Only initialize the extension when all dependencies are present. | ||
if ( !defined( 'Validator_VERSION' ) ) { | ||
throw new Exception( 'You need to have Validator installed in order to use Maps' ); | ||
} | ||
|
||
if ( version_compare( $GLOBALS['wgVersion'], '1.27c', '<' ) ) { | ||
throw new Exception( | ||
'This version of Maps requires MediaWiki 1.27 or above; use Maps 4.2.x for older versions.' | ||
. ' More information at https://github.com/JeroenDeDauw/Maps/blob/master/INSTALL.md' | ||
); | ||
} | ||
|
||
( new MapsSetup( $GLOBALS ) )->setup(); | ||
|
||
return true; | ||
}; | ||
|
||
return true; | ||
} | ||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "Maps", | ||
"version": "6.0 alpha", | ||
|
||
"author": [ | ||
"[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]", | ||
"..." | ||
], | ||
"url": "https://github.com/JeroenDeDauw/Maps/blob/master/README.md#maps", | ||
"descriptionmsg": "maps-desc", | ||
"license-name": "GPL-2.0-or-later", | ||
"type": "parserhook", | ||
|
||
"requires": { | ||
"MediaWiki": ">= 1.31.0" | ||
}, | ||
|
||
"callback": "MapsRegistration::onRegistration", | ||
"ContentHandlers": { | ||
"GeoJson": "Maps\\GeoJson\\GeoJsonContentHandler" | ||
}, | ||
"namespaces": [ | ||
{ | ||
"id": 420, | ||
"constant": "NS_GEO_JSON", | ||
"name": "GeoJson", | ||
"subpages": false, | ||
"content": true, | ||
"defaultcontentmodel": "GeoJson" | ||
}, | ||
{ | ||
"id": 556, | ||
"constant": "NS_GEO_JSON_TALK", | ||
"name": "GeoJson_talk", | ||
"subpages": true, | ||
"content": false, | ||
"defaultcontentmodel": "wikitext" | ||
} | ||
], | ||
|
||
"manifest_version": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,6 @@ protected function getAttribs() { | |
} | ||
|
||
protected function getGroupName() { | ||
return 'maps'; | ||
return 'Maps.class'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Maps\GeoJson; | ||
|
||
class GeoJsonContent extends \JsonContent { | ||
|
||
/* public */ const CONTENT_MODEL_ID = 'GeoJSON'; | ||
|
||
public function __construct( $text, $modelId = self::CONTENT_MODEL_ID ) { | ||
parent::__construct( $text, $modelId ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Maps\GeoJson; | ||
|
||
class GeoJsonContentHandler extends \JsonContentHandler { | ||
|
||
public function __construct( $modelId = GeoJsonContent::CONTENT_MODEL_ID ) { | ||
parent::__construct( $modelId ); | ||
} | ||
|
||
protected function getContentClass() { | ||
return GeoJsonContent::class; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters