1 | <?php |
||
2 | /** |
||
3 | * File containing the Lingo class |
||
4 | * |
||
5 | * This file is part of the MediaWiki extension Lingo. |
||
6 | * |
||
7 | * @copyright 2011 - 2018, Stephan Gambke |
||
8 | * @license GPL-2.0-or-later |
||
9 | * |
||
10 | * The Lingo extension is free software: you can redistribute it and/or modify |
||
11 | * it under the terms of the GNU General Public License as published by the Free |
||
12 | * Software Foundation; either version 2 of the License, or (at your option) any |
||
13 | * later version. |
||
14 | * |
||
15 | * The Lingo extension is distributed in the hope that it will be useful, but |
||
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
||
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
||
18 | * details. |
||
19 | * |
||
20 | * You should have received a copy of the GNU General Public License along |
||
21 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
||
22 | * |
||
23 | * @file |
||
24 | * @ingroup Lingo |
||
25 | */ |
||
26 | |||
27 | namespace Lingo; |
||
28 | |||
29 | /** |
||
30 | * Class Lingo |
||
31 | * |
||
32 | * @package Lingo |
||
33 | * @ingroup Lingo |
||
34 | */ |
||
35 | class Lingo { |
||
36 | |||
37 | /** |
||
38 | * Deferred settings |
||
39 | * - registration of _NOGLOSSARY_ magic word |
||
40 | * - extension description shown on Special:Version |
||
41 | * |
||
42 | * @since 2.0.2 |
||
43 | */ |
||
44 | public static function initExtension() { |
||
45 | $GLOBALS[ 'wgExtensionFunctions' ][] = function () { |
||
46 | $parser = LingoParser::getInstance(); |
||
47 | |||
48 | $backend = new $GLOBALS[ 'wgexLingoBackend' ](); |
||
49 | |||
50 | $parser->setBackend( $backend ); |
||
51 | |||
52 | \Hooks::register( 'ContentAlterParserOutput', function () use ( $parser ){ |
||
0 ignored issues
–
show
|
|||
53 | $parser->parse( $GLOBALS[ 'wgParser' ] ); |
||
54 | } ); |
||
55 | |||
56 | \Hooks::register( 'ApiMakeParserOptions', function ( \ParserOptions $popts, \Title $title, array $params ) use ( $parser ){ |
||
0 ignored issues
–
show
The type
ParserOptions was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
The type
Title was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
57 | $parser->setApiParams( $params ); |
||
58 | } ); |
||
59 | |||
60 | \Hooks::register( 'GetDoubleUnderscoreIDs', function ( array &$doubleUnderscoreIDs ) { |
||
61 | $doubleUnderscoreIDs[] = 'noglossary'; |
||
62 | return true; |
||
63 | } ); |
||
64 | |||
65 | \Hooks::register( 'ParserFirstCallInit', function ( \Parser $parser ) { |
||
66 | $parser->setHook( 'noglossary', function ( $input, array $args, \Parser $parser, \PPFrame $frame ) { |
||
0 ignored issues
–
show
The type
PPFrame was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
67 | $output = $parser->recursiveTagParse( $input, $frame ); |
||
68 | return '<span class="noglossary">' . $output . '</span>'; |
||
69 | } ); |
||
70 | |||
71 | return true; |
||
72 | } ); |
||
73 | |||
74 | \Hooks::register( 'SpecialPageBeforeExecute', function ( \SpecialPage $specialPage, $subPage ) { |
||
75 | if ( $specialPage instanceof \SpecialVersion ) { |
||
76 | foreach ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ] as $index => $description ) { |
||
77 | if ( $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ][ $index ][ 'name' ] === 'Lingo' ) { |
||
78 | $GLOBALS[ 'wgExtensionCredits' ][ 'parserhook' ][ $index ][ 'description' ] = wfMessage( 'lingo-desc', $GLOBALS[ 'wgexLingoPage' ] ?: wfMessage( 'lingo-terminologypagename' )->inContentLanguage()->text() )->text(); |
||
79 | } |
||
80 | } |
||
81 | } |
||
82 | |||
83 | return true; |
||
84 | } ); |
||
85 | }; |
||
86 | } |
||
87 | |||
88 | } |
||
89 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths