-
Notifications
You must be signed in to change notification settings - Fork 0
/
SemanticHighcharts.php
73 lines (59 loc) · 2 KB
/
SemanticHighcharts.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
<?php
global $wgExtensionFunctions, $wgExtensionMessagesFiles, $wgMessagesDirs, $wgExtensionCredits, $wgResourceModules, $shcAgreedToHCLicense;
if (!defined('MEDIAWIKI')) {
die('Not an entry point.');
}
if (!defined('ParamProcessor_VERSION')) {
die('SemanticHighcharts requires extension ParamProcessor');
}
if ( !defined( 'SMW_VERSION' ) ) {
die('SemanticHighcharts requires extension SemanticMediaWiki');
}
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once( __DIR__ . '/vendor/autoload.php' );
}
// Credits
$wgExtensionCredits['semantic'][] = array(
'path' => __FILE__,
'name' => 'SemanticHighcharts',
'version' => '0.2.0',
'author' => 'Kim Eik',
'url' => 'https://www.mediawiki.org/wiki/Extension:SemanticHighcharts',
'descriptionmsg' => 'semantichighcharts-desc',
'license-name' => 'GPL-3.0+ AND CC-BY-NC-3.0'
);
// I18n
$wgMessagesDirs['SemanticHighcharts'] = __DIR__ . '/i18n';
$basePath = '';
if ( !file_exists( __DIR__ . '/vendor' ) ) {
$basePath = '../../';
}
// Resources
$wgResourceModules['ext.srf.highcharts'] = array(
'scripts' => array(
$basePath.'vendor/netbrain/highcharts-js/highcharts.src.js',
$basePath.'vendor/netbrain/highcharts-js/modules/exporting.src.js',
$basePath.'vendor/netbrain/highcharts-js/modules/no-data-to-display.src.js',
'src/js/srfhighcharts.js'
),
'localBasePath' => __DIR__,
'remoteExtPath' => 'SemanticHighcharts'
);
$wgExtensionFunctions[] = function() {
global $smwgResultFormats, $smwgResultAliases, $shcFormats;
$shcFormats = array(
'highcharts' => 'SRF\HighchartsHelp',
'hc:frequency-histogram' => 'SRF\Highcharts\FrequencyHistogram',
);
$formatAliases = array(
'highcharts' => array( 'hc' ),
);
foreach ( $shcFormats as $format => $formatClass ) {
$smwgResultFormats[$format] = $formatClass;
if ( isset( $smwgResultAliases ) && array_key_exists( $format, $formatAliases ) ) {
$smwgResultAliases[$format] = $formatAliases[$format];
}
}
};
// Load settings
require_once( __DIR__ . '/SemanticHighcharts.settings.php' );