1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Jaeger |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2015-2016, mithra62 |
6
|
|
|
* @link http://jaeger-app.com |
7
|
|
|
* @version 1.0 |
8
|
|
|
* @filesource ./Platforms/AbstractPlatform.php |
9
|
|
|
*/ |
10
|
|
|
namespace JaegerApp\Platforms; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Jaeger - Platform Abstract |
14
|
|
|
* |
15
|
|
|
* Defines the methods each platform must implement to communicate between themselves |
16
|
|
|
* |
17
|
|
|
* @package Platforms |
18
|
|
|
* @author Eric Lamb <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
abstract class AbstractPlatform |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* The base email configuration prototype |
25
|
|
|
* |
26
|
|
|
* @var array |
27
|
|
|
*/ |
28
|
|
|
private $email_config = array( |
|
|
|
|
29
|
|
|
'from_email' => '', |
30
|
|
|
'sender_name' => '', |
31
|
|
|
'type' => 'smtp', // choose between `php` and `smtp` |
|
|
|
|
32
|
|
|
'smtp_options' => array( // if `smtp` chosen above, this must be completed and accurate |
33
|
|
|
'host' => '', |
34
|
|
|
'connection_config' => array( |
35
|
|
|
'username' => '', |
36
|
|
|
'password' => '' |
37
|
|
|
), |
38
|
|
|
'port' => '' |
39
|
|
|
) |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The settings table name |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $settings_table = ''; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Returns an array of details about interacting with the database |
50
|
|
|
*/ |
51
|
|
|
abstract public function getDbCredentials(); |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Returns an array of email connection details |
55
|
|
|
* |
56
|
|
|
* @param array $details |
|
|
|
|
57
|
|
|
*/ |
58
|
|
|
abstract public function getEmailConfig(); |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Returns the Current URL for the given request |
62
|
|
|
*/ |
63
|
|
|
abstract public function getCurrentUrl(); |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns the site name |
67
|
|
|
*/ |
68
|
|
|
abstract public function getSiteName(); |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Returns the user's timezone |
72
|
|
|
*/ |
73
|
|
|
abstract public function getTimezone(); |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Returns the site URL |
77
|
|
|
*/ |
78
|
|
|
abstract public function getSiteUrl(); |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Returns the encryption key to use for salting the encrypted data |
82
|
|
|
*/ |
83
|
|
|
abstract public function getEncryptionKey(); |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Returns an array of the configuration overrides to use (if any) |
87
|
|
|
*/ |
88
|
|
|
abstract public function getConfigOverrides(); |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Platform based abstraction to redirect a user's browser session to a given $url |
92
|
|
|
* |
93
|
|
|
* @param string $url |
94
|
|
|
*/ |
95
|
|
|
abstract public function redirect($url); |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Platform based abstraction to handle HTTP get/post request variables |
99
|
|
|
* |
100
|
|
|
* @param string $key |
101
|
|
|
* @param string $default |
102
|
|
|
* @return mixed |
103
|
|
|
*/ |
104
|
|
|
public function getPost($key, $default = false) |
|
|
|
|
105
|
|
|
{ |
106
|
|
|
if (isset($_POST[$key])) { |
107
|
|
|
return $_POST[$key]; |
108
|
|
|
} elseif (isset($_GET[$key])) { |
109
|
|
|
return $_GET[$key]; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
return $default; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Set the settings table |
117
|
|
|
* @param string $table |
118
|
|
|
* @return \JaegerApp\Platforms\AbstractPlatform |
119
|
|
|
*/ |
120
|
|
|
public function setSettingsTable($table) |
121
|
|
|
{ |
122
|
|
|
$this->settings_table = $table; |
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Returns the settings table |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
|
|
public function getSettingsTable() |
131
|
|
|
{ |
132
|
|
|
return $this->settings_table; |
133
|
|
|
} |
134
|
|
|
} |
This check marks private properties in classes that are never used. Those properties can be removed.