blob: 495a7cf68616765d3f22d2555f462acea7b36135 (
plain)
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
|
<?php
namespace SMW\MediaWiki\Hooks;
use Page;
use SMW\Page\PageFactory;
use SMW\Store;
use Title;
/**
* Register special classes for displaying semantic content on Property and
* Concept pages.
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ArticleFromTitle
*
* @license GNU GPL v2+
* @since 2.0
*
* @author mwjames
*/
class ArticleFromTitle extends HookHandler {
/**
* @var Store
*/
private $store;
/**
* @since 2.0
*
* @param Store $store
*/
public function __construct( Store $store ) {
$this->store = $store;
}
/**
* @since 2.0
*
* @param Title &$title
* @param Page|null &$page
*
* @return true
*/
public function process( Title &$title, Page &$page = null ) {
$ns = $title->getNamespace();
if ( $ns !== SMW_NS_PROPERTY && $ns !== SMW_NS_CONCEPT ) {
return true;
}
$pageFactory = new PageFactory(
$this->store
);
$page = $pageFactory->newPageFromTitle(
$title
);
return true;
}
}
|