-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWfExplore.php
134 lines (111 loc) · 4.62 KB
/
WfExplore.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
wfLoadExtension('Explore');
/** OLD STUF
# Alert the user that this is not a valid access point to MediaWiki if they try to access the special pages file directly.
if ( !defined( 'MEDIAWIKI' ) ) {
exit( 1 );
}
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'WfExplore',
'author' => 'Pierre Boutet',
//'url' => 'https://www.mediawiki.org/wiki/Extension:WfExplore',
'descriptionmsg' => 'wfexplore-desc',
'version' => '0.1.0',
);
$wgAutoloadClasses['Explore\\InputBox'] = __DIR__ . '/includes/InputBox.php';
$wgAutoloadClasses['SpecialWfExplore'] = __DIR__ . '/includes/SpecialWfExplore.php'; # Location of the SpecialWfSearch class (Tell MediaWiki to load this file)
$wgAutoloadClasses['WfExploreQueryParser'] = __DIR__ . "/includes/WfExploreQueryParser.php";
$wgAutoloadClasses['WfExploreTag'] = __DIR__ . "/includes/WfExploreTag.php";
$wgAutoloadClasses['WfExploreCore'] = __DIR__ . "/includes/WfExploreCore.php";
$wgAutoloadClasses['ApiGetPropertyValues'] = __DIR__ . '/includes/ApiGetPropertyValues.php';
$wgAutoloadClasses['WikifabExploreResultFormatter'] = __DIR__ . '/includes/WikifabExploreResultFormatter.php'; # Location of the WikifabSearchResultFormatter class
$wgAutoloadClasses['Skins\\Chameleon\\Components\\ExploreSearchBar'] = __DIR__ . '/includes/ChameleonComponents/ExploreSearchBar.php'; # Location of the WikifabSearchResultFormatter class
$wgAutoloadClasses['WfTutorialUtils'] = __DIR__ . '/includes/WfTutorialUtils.php'; # tools for using tutorial forms pages
$wgMessagesDirs['WfExplore'] = __DIR__ . "/i18n"; # Location of localisation files (Tell MediaWiki to load them)
//$wgExtensionMessagesFiles['WfExploreAlias'] = __DIR__ . '/WfExplore.alias.php'; # Location of an aliases file
// Allow translation of the parser function name
$wgExtensionMessagesFiles['WfExploreMagic'] = __DIR__ . '/WfExplore.magic.php';
$wgSpecialPages['WfExplore'] = 'SpecialWfExplore'; # Tell MediaWiki about the new special page and its class name
$egWfExploreLayoutForm= __DIR__ . '/views/LayoutExploreForm.php';
//$GLOBALS['egChameleonLayoutFileSearchResult'];
$wgExploreDefaultsFieldsDisplayValues = [
'Main_Picture' => 'No-image-yet.jpg',
'group-logo' => 'no-logo-group.gif'
];
$wgAPIModules['exploregetpropertyvalues'] = 'ApiGetPropertyValues';
$wgResourceModules['ext.wikifab.wfExplore.js'] = array(
'scripts' => array(
'js/jquery.dynatree.js',
'js/selectize.js',
'wf-explore.js',
'js/form-fulltext-autocompletion.js'
),
'styles' => array(
'css/ui.dynatree.css',
'css/normalize.css',
'wf-explore.css'
),
'localBasePath' => __DIR__,
'remoteExtPath' => 'Explore',
'messages' => array(
'wfexplore-load-more-tutorials-previous'
),
'dependencies' => array(
'jquery.ui.datepicker',
'jquery.ui.autocomplete'
)
);
$wgResourceModules['ext.wikifab.wfexplore.css'] = array(
'styles' => array(
'wf-explore.css',
'css/normalize.css'
),
'localBasePath' => __DIR__,
'remoteExtPath' => 'Explore'
);
$wgResourceModules['ext.wikifab.wfexplore'] = array(
'dependencies' => array(
'ext.wikifab.wfexplore.css',
'ext.wikifab.wfExplore.js'
),
);
$wfexploreExtractTags = true;
$wgExploreIsLocalized = false;
$wgExploreResultsLayouts = [
'event' => __DIR__ . '/views/layout-event.html'
];
$wgHooks['ParserFirstCallInit'][] = 'WfExploreParserFunctions';
$wgHooks['PageRenderingHash'][] = 'wfExploreOnPageRenderingHash';
// this global var is used to record is parser has been called
// it should be move inside a class, with the 2 functions below
$wfExploreGlobalParsedFunction = false;
# Parser function to insert a link changing a tab.
function WfExploreParserFunctions( $parser ) {
global $wgOut, $wfExploreGlobalParsedFunction;
// we record that parsing function has been used to chang cache hash
$wfExploreGlobalParsedFunction = true;
$wgOut->addModuleStyles(
array(
'ext.wikifab.wfexplore.css'
)
);
$wgOut->addModules( array( 'ext.wikifab.wfexplore' ) );
$parser->setFunctionHook( 'displayExplore', array('WfExploreTag', 'addSampleParser' ));
$parser->setFunctionHook( 'exploreQuery', array('WfExploreQueryParser', 'addSampleParser' ));
$parser->setFunctionHook( 'exploreinputbox', array( 'Explore\\InputBox', 'render' ) );
return true;
}
function wfExploreOnPageRenderingHash( &$confstr, User $user, &$forOptions ) {
global $wfExploreGlobalParsedFunction, $wgRequest;
if($wgRequest->getMethod() == 'GET') {
// if parse function has been used, we add query to cache hash key
if (isset($wfExploreGlobalParsedFunction) && $wfExploreGlobalParsedFunction) {
foreach ($wgRequest->getValues() as $key => $val) {
$confstr .= '-' . $key . "-" . $val;
}
}
}
return true;
}
**/