1.Edit File SyntaxHighlight_GeSHi\geshi\geshi.php
Line 597:
function GeSHi($source = '', $language = '', $path = '') {
Update to:
function __construct($source = '', $language = '', $path = '') {
Line 4751:
$callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
Update to:
$callback_2 = function($matches) {return "[" .str_replace("|", "", $matches[1]). "]";};
2.Edit File SyntaxHighlight_GeSHi\ResourceLoaderGeSHiModule.php
Line 72 to 78:
public function getDefinitionSummary( ResourceLoaderContext $context ) { return array( 'class' => get_class( $this ), 'lang' => $this->lang, 'geshi' => GESHI_VERSION, ); }
Update to:
public function getDefinitionSummary( ResourceLoaderContext $context ) { $summary = parent::getDefinitionSummary( $context ); $summary[] = [ 'class' => get_class( $this ), 'lang' => $this->lang, 'geshi' => GESHI_VERSION, ]; return $summary; }
- It able load css, use url /wiki/load.php?modules=ext.geshi.language.php&only=styles
- but, It still doesn't work. Why?
- status: unfinished, orz
- Quest at File SyntaxHighlight_GeSHi\SyntaxHighlight_GeSHi.class.php
- Type 1, can use /wiki/load.php?modules=ext.geshi.language.php&only=styles
public static function resourceLoaderRegisterModules( &$resourceLoader ) { $modules = array(); foreach ( self::getSupportedLanguages() as $lang ) { $modules["ext.geshi.language.$lang" ] = array( 'class' => 'ResourceLoaderGeSHiModule', 'lang' => $lang, ); } $resourceLoader->register( $modules ); return true; }
- but, at head of HTML not use ext.geshi.language.php
<link rel="stylesheet" href="/wiki/load.php?lang=zh-tw&modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.interface%7Cskins.vector.styles&only=styles&skin=vector"/>
- Type 2, can not use /wiki/load.php?modules=ext.geshi.language.php&only=styles
public static function resourceLoaderRegisterModules( &$resourceLoader ) { $modules = array(); foreach ( self::getSupportedLanguages() as $lang ) { $modules["ext.geshi.language.$lang" ] = array( 'style' => "ext.geshi.language.$lang.css" ); } $resourceLoader->register( $modules ); return true; }
- but, at head of HTML use ext.geshi.language.php
<link rel="stylesheet" href="/wiki/load.php?lang=zh-tw&modules=ext.geshi.language.php%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.interface%7Cskins.vector.styles&only=styles&skin=vector"/>
- type 3, fix ver
public static function resourceLoaderRegisterModules( &$resourceLoader ) { $modules = array(); if (strpos($_SERVER['REQUEST_URI'], '/load.php?') !== false) { foreach ( self::getSupportedLanguages() as $lang ) { $modules["ext.geshi.language.$lang" ] = array( 'class' => 'ResourceLoaderGeSHiModule', 'lang' => $lang, ); } } else { $CssPath = dirname( __FILE__ ); foreach ( self::getSupportedLanguages() as $lang ) { $modules["ext.geshi.language.$lang" ] = array( 'styles' => "ext.geshi.language.$lang.css", 'localBasePath' => "$CssPath\modules", ); } } $resourceLoader->register( $modules ); return true; }
- status: finished?