forked from enterprisemediawiki/MasonryMainPage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMasonryMainPage.php
92 lines (81 loc) · 3.31 KB
/
MasonryMainPage.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* The MasonryMainPage extension enables use of Masonry blocks within MediaWiki
*
* Documentation: https://github.com/darenwelsh/MediaWiki-MasonryMainPage
* Support: https://github.com/darenwelsh/MediaWiki-MasonryMainPage
* Source code: https://github.com/darenwelsh/MediaWiki-MasonryMainPage
*
* @file MasonryMainPage.php
* @addtogroup Extensions
* @author Daren Welsh
* @copyright © 2014 by Daren Welsh
* @licence GNU GPL v3+
*/
# Not a valid entry point, skip unless MEDIAWIKI is defined
if (!defined('MEDIAWIKI')) {
die( "MasonryMainPage extension" );
}
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'MasonryMainPage',
'url' => 'http://github.com/darenwelsh/MediaWiki-MasonryMainPage',
'author' => 'Daren Welsh',
'descriptionmsg' => 'masonrymainpage-desc',
'version' => '0.1.0'
);
# $dir: the directory of this file, e.g. something like:
# 1) /var/www/wiki/extensions/BlankParserFunction
# 2) C:/xampp/htdocs/wiki/extensions/BlankParserFunction
// this isn't used, yet
// $dir = dirname( __FILE__ ) . '/';
# Location of "message file". Message files are used to store your extension's text
# that will be displayed to users. This text is generally stored in a separate
# file so it is easy to make text in English, German, Russian, etc, and users can
# easily switch to the desired language.
// No internationalization yet
// $wgExtensionMessagesFiles['BlankParserFunction'] = $dir . 'BlankParserFunction.i18n.php';
# The "body" file will contain the bulk of a simple parser function extension.
# NEED MORE INFO HERE.
#
// No classes yet
// $wgAutoloadClasses['BlankParserFunction'] = $dir . 'BlankParserFunction.body.php';
# This specifies the function that will initialize the parser function.
# NEED MORE INFO HERE.
#
// No parser function yet
// $wgHooks['ParserFirstCallInit'][] = 'BlankParserFunction::setup';
/**
* Use a hook to add a meta tag to force IE to not use compatibility mode
**/
$wgHooks['BeforePageDisplay'][] = 'addIECompatibilityMetaTag';
/**
* Adds the following meta tag to the HTML header of all pages
* <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
*
* This forces IE to load the page NOT in compatibility mode. Loading
* in compatibility mode breaks the Masonry extension.
*
* This function should be called on the 'BeforePageDisplay' hook as follows:
* $wgHooks['BeforePageDisplay'][] = onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { ... }
**/
function addIECompatibilityMetaTag (&$out, &$skin) {
$out->addMeta( 'http:X-UA-Compatible', 'IE=9; IE=8; IE=7; IE=EDGE' );
}
/**
* JSC-MOD specific javascript modifications
**/
$wgHooks['AjaxAddScript'][] = 'addMasonryFiles';
function addMasonryFiles ( $out ){
global $wgScriptPath;
$out->addScriptFile( $wgScriptPath .'/extensions/MasonryMainPage/masonry.pkgd.min.js' );
$out->addScriptFile( $wgScriptPath .'/extensions/MasonryMainPage/imagesloaded.pkgd.min.js' );
$out->addScriptFile( $wgScriptPath .'/extensions/MasonryMainPage/masonry-common.js' );
$out->addLink( array(
'rel' => 'stylesheet',
'type' => 'text/css',
'media' => "screen",
'href' => "$wgScriptPath/extensions/MasonryMainPage/Masonry.css"
) );
return true;
}