blob: 2973eb9a92979cac2c1bee51aeb0fc7bd6f4772a (
plain)
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
|
<?php
class PostmanNotifyOptions {
const DEFAULT_NOTIFICATION_SERVICE = 'default';
const NOTIFICATION_SERVICE = 'notification_service';
const NOTIFICATION_USE_CHROME = 'notification_use_chrome';
const NOTIFICATION_CHROME_UID = 'notification_chrome_uid';
const PUSHOVER_USER = 'pushover_user';
const PUSHOVER_TOKEN = 'pushover_token';
const SLACK_TOKEN = 'slack_token';
private $options;
private static $instance;
public static function getInstance()
{
if ( ! self::$instance ) {
self::$instance = new static;
}
return self::$instance;
}
private function __construct()
{
$this->options = get_option( 'postman_options' );
}
public function getNotificationService() {
if ( isset( $this->options [ self::NOTIFICATION_SERVICE ] ) ) {
return $this->options [ self::NOTIFICATION_SERVICE ];
} else {
return self::DEFAULT_NOTIFICATION_SERVICE;
}
}
public function getPushoverUser() {
if ( isset( $this->options [ self::PUSHOVER_USER ] ) ) {
return base64_decode( $this->options [ self::PUSHOVER_USER ] );
}
}
public function getPushoverToken() {
if ( isset( $this->options [ self::PUSHOVER_TOKEN ] ) ) {
return base64_decode( $this->options [ self::PUSHOVER_TOKEN ] );
}
}
public function getSlackToken() {
if ( isset( $this->options [ self::SLACK_TOKEN ] ) ) {
return base64_decode( $this->options [ self::SLACK_TOKEN ] );
}
}
public function useChromeExtension() {
if ( isset( $this->options [ self::NOTIFICATION_USE_CHROME ] ) ) {
return $this->options [ self::NOTIFICATION_USE_CHROME ];
}
}
public function getNotificationChromeUid() {
if ( isset( $this->options [ self::NOTIFICATION_CHROME_UID ] ) ) {
return base64_decode( $this->options [ self::NOTIFICATION_CHROME_UID ] );
}
}
}
|