|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* DialogLibraryInterface.php - Adapter for the SimplyToast library. |
|
5
|
|
|
* |
|
6
|
|
|
* @package jaxon-dialogs |
|
7
|
|
|
* @author Thierry Feuzeu <[email protected]> |
|
8
|
|
|
* @copyright 2016 Thierry Feuzeu <[email protected]> |
|
9
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License |
|
10
|
|
|
* @link https://github.com/jaxon-php/jaxon-dialogs |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Jaxon\Dialogs\Library\SimplyToast; |
|
14
|
|
|
|
|
15
|
|
|
use Jaxon\Ui\Dialog\Library\AbstractDialogLibrary; |
|
|
|
|
|
|
16
|
|
|
use Jaxon\Ui\Dialog\MessageInterface; |
|
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
class SimplyToastLibrary extends AbstractDialogLibrary implements MessageInterface |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* @const The library name |
|
22
|
|
|
*/ |
|
23
|
|
|
const NAME = 'simply'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @inheritDoc |
|
27
|
|
|
*/ |
|
28
|
|
|
public function getName(): string |
|
29
|
|
|
{ |
|
30
|
|
|
return self::NAME; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @inheritDoc |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getSubdir(): string |
|
37
|
|
|
{ |
|
38
|
|
|
return 'simply-toast'; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @inheritDoc |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getVersion(): string |
|
45
|
|
|
{ |
|
46
|
|
|
return 'latest'; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @inheritDoc |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getJs(): string |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->xHelper->getJsCode('simply-toast.min.js'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @inheritDoc |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getCss(): string |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->xHelper->getCssCode('simply-toast.min.css'); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @inheritDoc |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getScript(): string |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->xHelper->render('simplytoast/alert.js'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @inheritDoc |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getReadyScript(): string |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->xHelper->render('simplytoast/ready.js.php', [ |
|
79
|
|
|
'options' => json_encode($this->xHelper->getOptionNames('options.')) |
|
80
|
|
|
]); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Print an alert message. |
|
85
|
|
|
* |
|
86
|
|
|
* @param string $sMessage The text of the message |
|
87
|
|
|
* @param string $sType The type of the message |
|
88
|
|
|
* |
|
89
|
|
|
* @return string |
|
90
|
|
|
*/ |
|
91
|
|
|
private function alert(string $sMessage, string $sType): string |
|
92
|
|
|
{ |
|
93
|
|
|
if($this->returnCode()) |
|
94
|
|
|
{ |
|
95
|
|
|
return "$.simplyToast(" . $sMessage . ", '" . $sType . "')"; |
|
96
|
|
|
} |
|
97
|
|
|
$this->addCommand(['cmd' => 'simply.alert'], ['message' => $sMessage, 'type' => $sType]); |
|
98
|
|
|
return ''; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @inheritDoc |
|
103
|
|
|
*/ |
|
104
|
|
|
public function success(string $sMessage, string $sTitle = ''): string |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->alert($sMessage, 'success'); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @inheritDoc |
|
111
|
|
|
*/ |
|
112
|
|
|
public function info(string $sMessage, string $sTitle = ''): string |
|
113
|
|
|
{ |
|
114
|
|
|
return $this->alert($sMessage, 'info'); |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @inheritDoc |
|
119
|
|
|
*/ |
|
120
|
|
|
public function warning(string $sMessage, string $sTitle = ''): string |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->alert($sMessage, 'warning'); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @inheritDoc |
|
127
|
|
|
*/ |
|
128
|
|
|
public function error(string $sMessage, string $sTitle = ''): string |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->alert($sMessage, 'danger'); |
|
131
|
|
|
} |
|
132
|
|
|
} |
|
133
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths