forked from ForumHulp/htmlemail
/
ext.php
50 lines (45 loc) · 1.62 KB
/
ext.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
<?php
/**
*
* HTML email extension for the phpBB Forum Software package.
*
* @copyright (c) 2015 ForumHulp.com <http://forumhulp.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace forumhulp\htmlemail;
/**
* This ext class is optional and can be omitted if left empty.
* However you can add special (un)installation commands in the
* methods enable_step(), disable_step() and purge_step(). As it is,
* these methods are defined in \phpbb\extension\base, which this
* class extends, but you can overwrite them to give special
* instructions for those cases.
*/
class ext extends \phpbb\extension\base
{
public function is_enableable()
{
if (!class_exists('forumhulp\helper\helper'))
{
$this->container->get('user')->add_lang_ext('forumhulp/cronstatus', 'info_acp_cronstatus');
trigger_error($this->container->get('user')->lang['FH_HELPER_NOTICE'], E_USER_WARNING);
}
if (!$this->container->get('ext.manager')->is_enabled('forumhulp/helper'))
{
$this->container->get('ext.manager')->enable('forumhulp/helper');
}
return class_exists('forumhulp\helper\helper');
}
public function enable_step($old_state)
{
if (empty($old_state))
{
$this->container->get('user')->add_lang_ext('forumhulp/htmlemail', 'info_acp_htmlemail');
$this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS'] .
(isset($this->container->get('user')->lang['HTML_EMAIL_NOTICE']) ? $this->container->get('user')->lang['HTML_EMAIL_NOTICE'] : ''));
}
// Run parent enable step method
return parent::enable_step($old_state);
}
}