summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/includes/specials/SpecialPage.php
blob: 5bc84de0e02045cb9a55903995d393693ffa93fd (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
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
<?php

namespace SMW;

/**
 * Semantic MediaWiki SpecialPage base class
 *
 *
 * @license GNU GPL v2+
 * @since   1.9
 *
 * @author mwjames
 */

/**
 * Semantic MediaWiki SpecialPage base class
 *
 * @ingroup SpecialPage
 * @codeCoverageIgnore
 */
class SpecialPage extends \SpecialPage {

	/** @var Store */
	protected $store = null;

	/** @var Settings */
	protected $settings = null;

	/**
	 * @see SpecialPage::__construct
	 *
	 * @since 1.9
	 *
	 * @param $name
	 * @param $restriction
	 */
	public function __construct( $name = '', $restriction = '' ) {
		parent::__construct( $name, $restriction );
		$this->store = StoreFactory::getStore();
	}

	/**
	 * Sets store instance
	 *
	 * @since 1.9
	 *
	 * @param Store $store
	 */
	public function setStore( Store $store ) {
		$this->store = $store;
		return $this;
	}

	/**
	 * Returns store object
	 *
	 * @since 1.9
	 *
	 * @return Store
	 */
	public function getStore() {
		return $this->store;
	}

	/**
	 * Sets Settings object
	 *
	 * @since 1.9
	 *
	 * @param Settings $settings
	 */
	public function setSettings( Settings $settings ) {
		$this->settings = $settings;
		return $this;
	}

	/**
	 * Returns Settings object
	 *
	 * @since 1.9
	 *
	 * @return Store
	 */
	public function getSettings() {

		if ( $this->settings === null ) {
			$this->settings = Settings::newFromGlobals();
		}

		return $this->settings;
	}

}