This repository was archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSemanticFlags.php
More file actions
52 lines (44 loc) · 1.96 KB
/
SemanticFlags.php
File metadata and controls
52 lines (44 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
SemanticFlags is a MediaWiki extension to streamline flag markup on
ModEnc and to expose the information in a Schema.org-compatible way
for search engines.
Copyright (C) 2012 Renegade (RenegadeProjects.com)
This program 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 3 of the License, or
(at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
die( -1 );
}
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => "SemanticFlags",
'descriptionmsg' => "semanticflags-desc",
'version' => 0.1,
'author' => "Renegade <Renegade@RenegadeProjects.com>",
'url' => "https://github.com/EvilRenegade/SemanticFlags"
);
$wgExtensionMessagesFiles['SemanticFlags'] = dirname( __FILE__ ) . '/SemanticFlags.i18n.php';
$wgAutoloadClasses['SemanticFlag'] = dirname( __FILE__ ) . '/SemanticFlags.body.php';
$wgAutoloadClasses['CnCInstallment'] = dirname( __FILE__ ) . '/SemanticFlags.body.php';
$wgHooks['ParserFirstCallInit'][] = 'wfSemanticFlagsInit';
function wfSemanticFlagsInit(Parser $parser) {
$parser->setHook( 'flag', 'wfParseFlag' );
return true; //mandatory
}
/*
All information is conveyed via attributes, so $args is where the info is at.
*/
function wfParseFlag( $input, array $args, Parser $parser, PPFrame $frame ) {
$flag = new SemanticFlag($input, $args, $parser, $frame);
return $flag->getOutput();
}