File: Config.php

package info (click to toggle)
kalkun 0.8.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,340 kB
  • sloc: php: 30,659; javascript: 30,443; sql: 961; sh: 766; xml: 105; makefile: 41
file content (101 lines) | stat: -rw-r--r-- 1,998 bytes parent folder | download | duplicates (2)
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
94
95
96
97
98
99
100
101
<?php

/**
 * Kalkun
 * An open source web based SMS Management
 *
 * @package		Kalkun
 * @author		Kalkun Dev Team
 * @license		https://spdx.org/licenses/GPL-2.0-or-later.html
 * @link		https://kalkun.sourceforge.io/
 */
// ------------------------------------------------------------------------

namespace Kalkun\Plugins\StopManager;
defined('BASEPATH') OR exit('No direct script access allowed');

require_once (APPPATH . '/plugins/Plugin_helper.php');

/**
 * Description of Config
 *
 */
class Config {

	private static $instance = NULL;
	private $config = NULL;
	private $keywordsOptOut = NULL;
	private $keywordsOptIn = NULL;
	private $keywordsType = NULL;

	public function __construct()
	{
		$this->config = \Plugin_helper::get_plugin_config('stop_manager');
		$this->keywordsOptOut = array_map('strtoupper', $this->config['optout_keywords']);
		$this->keywordsOptIn = array_map('strtoupper', $this->config['optin_keywords']);
		$this->keywordsType = array_map('strtolower', $this->config['type_keywords']);
	}

	public static function getInstance()
	{
		if (self::$instance === NULL)
		{
			self::$instance = new Config();
		}

		return self::$instance;
	}

	public function isTypeEnabled()
	{
		return $this->config['enable_type'];
	}

	public function getValidCmds()
	{
		return array_merge($this->keywordsOptOut, $this->keywordsOptIn);
		;
	}

	public function getValidTypes()
	{
		return $this->keywordsType;
	}

	public function getKeywordsOptOut()
	{
		return $this->keywordsOptOut;
	}

	public function getKeywordsOptIn()
	{
		return $this->keywordsOptIn;
	}

	public function getKeywordsType()
	{
		return $this->keywordsType;
	}

	public function getConfig($item = NULL)
	{
		if ($item !== NULL)
		{
			return $this->config[$item];
		}
		else
		{
			return $this->config;
		}
	}

	public function isAutoreplyInfoEnabled()
	{
		return $this->config['enable_autoreply_info'];
	}

	public function isAutoreplyErrorEnabled()
	{
		return $this->config['enable_autoreply_error'];
	}
}