-
Notifications
You must be signed in to change notification settings - Fork 4
/
SemanticImageAnnotator.hooks.php
executable file
·61 lines (45 loc) · 1.78 KB
/
SemanticImageAnnotator.hooks.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
<?php
/**
* Hooks for Annotator extension
*
* @file
* @ingroup Extensions
*/
class SemanticImageAnnotatorHooks {
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
if($out->getTitle()->getNamespace() == 6) { //0 is the Aricle's Namespace
$out->addModules( 'ext.imageannotator' );
}
return true;
}
public static function onCanonicalNamespaces( array &$namespaces ) {
global $wgNamespacesWithSubpages;
if ( !defined( 'NS_ANNOTATION' ) ) {
define( 'NS_ANNOTATION', 248 );
define( 'NS_ANNOTATION_TALK', 249 );
}
$namespaces[NS_ANNOTATION] = 'Annotation';
$namespaces[NS_ANNOTATION_TALK] = 'Annotation_talk';
$wgNamespacesWithSubpages[NS_ANNOTATION] = true;
return true;
}
public static function afterInit( ) {
global $smwgNamespacesWithSemanticLinks;
if ( !defined( 'NS_ANNOTATION' ) ) {
define( 'NS_ANNOTATION', 248 );
define( 'NS_ANNOTATION_TALK', 249 );
}
$smwgNamespacesWithSemanticLinks[NS_ANNOTATION] = true;
// Enable PageForms Namespace for SemanticLinks
$smwgNamespacesWithSemanticLinks[PF_NS_FORM] = true;
return true;
}
public static function smwInitProperties( ) {
if ( class_exists( 'SMW\PropertyRegistry' ) ) {
SMW\PropertyRegistry::getInstance()->registerProperty ( "___SA_FORM_TYPE_PROPERTY", '_txt', "Form Type", true, true );
SMW\PropertyRegistry::getInstance()->registerProperty ( "___SA_CATEGORY_NAME_PROPERTY", '_txt', "SA Category Name", true, true );
SMW\PropertyRegistry::getInstance()->registerProperty ( "___SA_CATEGORY_COLOR_PROPERTY", '_txt', "SA Category Color", true, true );
}
return true;
}
}