|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* @package sitemaker |
|
5
|
|
|
* @copyright (c) 2013 Daniel A. (blitze) |
|
6
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
|
7
|
|
|
* |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace blitze\content; |
|
11
|
|
|
|
|
12
|
|
|
class ext extends \phpbb\extension\base |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* Check whether or not the extension can be enabled. |
|
16
|
|
|
* |
|
17
|
|
|
* @return bool |
|
18
|
|
|
*/ |
|
19
|
|
|
public function is_enableable() |
|
20
|
|
|
{ |
|
21
|
|
|
$this->container->get('language')->add_lang('info_acp_content', 'blitze/content'); |
|
22
|
|
|
|
|
23
|
|
|
return $this->phpbb_version_is_ok() && $this->required_exts_are_ok(); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Check whether or not this extension can be enabled on the current phpBB version. |
|
28
|
|
|
* |
|
29
|
|
|
* @return bool |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function phpbb_version_is_ok() |
|
32
|
|
|
{ |
|
33
|
|
|
$config = $this->container->get('config'); |
|
34
|
|
|
return phpbb_version_compare($config['version'], '3.2.2', '>=') && phpbb_version_compare($config['version'], '3.3.0', '<'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Check whether or not the extension's dependencies are available and installed. |
|
39
|
|
|
* |
|
40
|
|
|
* @return bool |
|
41
|
|
|
*/ |
|
42
|
|
|
protected function required_exts_are_ok() |
|
43
|
|
|
{ |
|
44
|
|
|
if (!class_exists('blitze\sitemaker\ext')) |
|
45
|
|
|
{ |
|
46
|
|
|
trigger_error($this->container->get('language')->lang('MISSING_REQUIRED_EXTENSION'), E_USER_WARNING); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
if (!$this->container->get('ext.manager')->is_enabled('blitze/sitemaker')) |
|
50
|
|
|
{ |
|
51
|
|
|
$this->container->get('ext.manager')->enable('blitze/sitemaker'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return true; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|