Last active
August 29, 2015 14:01
-
-
Save jdlrobson/f9af964eec72f29797d0 to your computer and use it in GitHub Desktop.
A boiler plate for a map extension
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
<?php | |
/** | |
* A boilerplate for resource loader modules | |
*/ | |
$wgMFResourceBoilerplate = array( | |
'localBasePath' => __DIR__, | |
'remoteExtPath' => 'WikiMaps', | |
); | |
$modules = array( | |
); | |
$wgResourceModules = array_merge( $wgResourceModules, $modules ); |
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
<?php | |
/** | |
* Hooks for Geo extension. | |
* | |
* @file | |
* | |
* @ingroup Extensions | |
* @ingroup EventLogging | |
* | |
*/ | |
class GeoHooks { | |
/** | |
* CustomEditor hook handler | |
* @see https://www.mediawiki.org/wiki/Manual:Hooks/CustomEditor | |
* | |
* @param Article $article | |
* @param User $user | |
* @return bool | |
*/ | |
public static function onCustomEditor( $article, $user ) { | |
if( $article->getTitle()->getNamespace() === NS_MAP ) { | |
$output = $article->getContext()->getOutput(); | |
$output->addHtml( 'DO THE MAP EDIT INTERFACE' ); | |
return false; | |
} | |
return true; | |
} | |
public static function onBeforePageDisplay( $out, $skin ) { | |
$out->clearHtml(); | |
$out->addHtml( 'PRINT MAP HERE' ); | |
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
<?php | |
/* | |
* This file is part of the MediaWiki extension Geo | |
* | |
* VectorBeta is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* VectorBeta is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with Geo. If not, see <http://www.gnu.org/licenses/>. | |
* | |
* @file | |
* @ingroup extensions | |
*/ | |
define( 'NS_MAP', 42 ); | |
define( 'NS_MAP_TALK', 43 ); | |
$wgExtraNamespaces[NS_MAP] = "Map"; | |
$wgExtraNamespaces[NS_MAP_TALK] = "Map_talk"; | |
// autoload extension classes | |
$autoloadClasses = array ( | |
'GeoHooks' => 'includes/WikiMaps.hooks.php', | |
); | |
foreach ( $autoloadClasses as $className => $classFilename ) { | |
$wgAutoloadClasses[$className] = __DIR__ . "/$classFilename"; | |
} | |
$wgHooks['CustomEditor'][] = 'GeoHooks::onCustomEditor'; | |
$wgHooks['BeforePageDisplay'][] = 'GeoHooks::onBeforePageDisplay'; | |
// ResourceLoader modules | |
require_once __DIR__ . "/includes/Resources.php"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment