-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iDisplay.php
executable file
·56 lines (50 loc) · 1.97 KB
/
iDisplay.php
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
53
54
55
56
<?php
# Extension to Use iframes to insert a webseite.
# From Minseong
# edited and enhanced by Dominik Sigmund
#
# Enjoy !
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
$wgExtensionCredits['parserhook'][] = array(
'name' => 'iDisplay',
'version' => '1.9',
'description' => 'Display sites in an iFrame, you may block them with a intersite',
'author' => 'Dominik Sigmund and Others',
'url' => 'http://fh-hfv-web02.hf.brnet.int/at-wiki/index.php/iDisplay'
);
# Define a setup function
$wgHooks['ParserFirstCallInit'][] = 'idisplay_Setup';
# Add a hook to initialise the magic word
$wgHooks['LanguageGetMagic'][] = 'idisplay_Magic';
function idisplay_Setup( &$parser ) {
# Set a function hook associating the magic word with our function
$parser->setFunctionHook( 'idisplay', 'idisplay_Render' );
return true;
}
function idisplay_Magic( &$magicWords, $langCode ) {
# Add the magic word
# The first array element is whether to be case sensitive, in this case (0) it is not case sensitive, 1 would be sensitive
# All remaining elements are synonyms for our parser function
$magicWords['idisplay'] = array( 0, 'idisplay', 'anysite' );
# unless we return true, other parser functions extensions won't get loaded.
return true;
}
function idisplay_Render( $parser, $input, $w='', $h='', $s='') {
$width = (int)$w > 0 ? (int)$w : 800;
$height = (int)$h > 0 ? (int)$h : 600;
if($s!='') {
//intersite here! give it the input!
$input = 'http://fh-hfv-web02.hf.brnet.int/at-wiki/extensions/iDisplay/inter.php?page='
. str_replace("&","[",$input);
}
$output = Html::element( 'iframe', array(
'width' => $width,
'height' => $height,
'src' => $input,
'frameborder' => "0",
));
return array($output, 'noparse' => true, 'isHTML' => true);
}
?>