ChangePasswordExamplePlugin::MainFabrica()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
class ChangePasswordExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
4
{
5
	public function Init()
6
	{
7
		$this->addHook('main.fabrica', 'MainFabrica');
8
	}
9
10
	/**
11
	 * @param string $sName
12
	 * @param mixed $oProvider
13
	 */
14
	public function MainFabrica($sName, &$oProvider)
15
	{
16
		switch ($sName)
17
		{
18
			case 'change-password':
19
20
				include_once __DIR__.'/ChangePasswordExampleDriver.php';
21
22
				$oProvider = new ChangePasswordExampleDriver();
23
				$oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))));
24
25
				break;
26
		}
27
	}
28
29
	/**
30
	 * @return array
31
	 */
32
	public function configMapping()
33
	{
34
		return array(
35
			\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
36
				->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
37
				->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: [email protected] [email protected] *@domain2.net')
38
				->SetDefaultValue('*')
39
		);
40
	}
41
}