1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the syntaxhighligter-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SyntaxHighlighterBundle\API; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\SyntaxHighlighterBundle\Encoder\SyntaxHighlighterEncoder; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* SyntaxHightlighter strings. |
18
|
|
|
* |
19
|
|
|
* @author webeweb <https://github.com/webeweb/> |
20
|
|
|
* @package WBW\Bundle\SyntaxHighlighterBundle\API |
21
|
|
|
* @final |
22
|
|
|
*/ |
23
|
|
|
final class SyntaxHighlighterStrings { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Alert. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $alert = "SyntaxHighlighter\n\n"; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Brush not HTML script. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
private $brushNotHtmlScript = "Brush wasn't made for html-script option:"; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Copy to clipboard. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
private $copyToClipboard = "copy to clipboard"; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Copy to clipboard confirmation. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
private $copyToClipboardConfirmation = "The code is in your clipboard now"; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Expand source. |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
private $expandSource = "+ expand source"; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Help. |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
private $help = "?"; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* No brush. |
69
|
|
|
* |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
private $noBrush = "Can't find brush for:"; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Print. |
76
|
|
|
* |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
private $print = "print"; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* View source. |
83
|
|
|
* |
84
|
|
|
* @var string |
85
|
|
|
*/ |
86
|
|
|
private $viewSource = "view source"; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Constructor. |
90
|
|
|
*/ |
91
|
|
|
public function __construct() { |
92
|
|
|
// NOTHING TO DO. |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Convert into a string representing this instance. |
97
|
|
|
* |
98
|
|
|
* @return string Returns a string representing this instance. |
99
|
|
|
*/ |
100
|
|
|
public function __toString() { |
101
|
|
|
|
102
|
|
|
// Initialize. |
103
|
|
|
$script = "SyntaxHighlighter.config.strings."; |
104
|
|
|
|
105
|
|
|
// Initialize the output. |
106
|
|
|
$output = []; |
107
|
|
|
|
108
|
|
|
SyntaxHighlighterEncoder::stringToString($this->alert, $output, $script . "alert = \"", "\";"); |
109
|
|
|
SyntaxHighlighterEncoder::stringToString($this->brushNotHtmlScript, $output, $script . "brushNotHtmlScript = \"", "\";"); |
110
|
|
|
SyntaxHighlighterEncoder::stringToString($this->copyToClipboard, $output, $script . "copyToClipboard = \"", "\";"); |
111
|
|
|
SyntaxHighlighterEncoder::stringToString($this->copyToClipboardConfirmation, $output, $script . "copyToClipboardConfirmation = \"", "\";"); |
112
|
|
|
SyntaxHighlighterEncoder::stringToString($this->expandSource, $output, $script . "expandSource = \"", "\";"); |
113
|
|
|
SyntaxHighlighterEncoder::stringToString($this->help, $output, $script . "help = \"", "\";"); |
114
|
|
|
SyntaxHighlighterEncoder::stringToString($this->noBrush, $output, $script . "noBrush = \"", "\";"); |
115
|
|
|
SyntaxHighlighterEncoder::stringToString($this->print, $output, $script . "print = \"", "\";"); |
116
|
|
|
SyntaxHighlighterEncoder::stringToString($this->viewSource, $output, $script . "viewSource = \"", "\";"); |
117
|
|
|
|
118
|
|
|
// Return the output. |
119
|
|
|
return implode("\n", $output); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get the alert. |
124
|
|
|
* |
125
|
|
|
* @return string Returns the alert. |
126
|
|
|
*/ |
127
|
|
|
public function getAlert() { |
128
|
|
|
return $this->alert; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Get the brush not HTML script. |
133
|
|
|
* |
134
|
|
|
* @return string Returns the brush not HTML script. |
135
|
|
|
*/ |
136
|
|
|
public function getBrushNotHtmlScript() { |
137
|
|
|
return $this->brushNotHtmlScript; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Get the copy to clipboard. |
142
|
|
|
* |
143
|
|
|
* @return string Returns the copy to clipboard. |
144
|
|
|
*/ |
145
|
|
|
public function getCopyToClipboard() { |
146
|
|
|
return $this->copyToClipboard; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Get the copy to clipboard confirmation. |
151
|
|
|
* |
152
|
|
|
* @return string Returns the copy to clipboard confirmation. |
153
|
|
|
*/ |
154
|
|
|
public function getCopyToClipboardConfirmation() { |
155
|
|
|
return $this->copyToClipboardConfirmation; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get the expand source. |
160
|
|
|
* |
161
|
|
|
* @return string Returns the expand source. |
162
|
|
|
*/ |
163
|
|
|
public function getExpandSource() { |
164
|
|
|
return $this->expandSource; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Get the help. |
169
|
|
|
* |
170
|
|
|
* @return string Returns the help. |
171
|
|
|
*/ |
172
|
|
|
public function getHelp() { |
173
|
|
|
return $this->help; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get the no brush. |
178
|
|
|
* |
179
|
|
|
* @return string Returns the no brush. |
180
|
|
|
*/ |
181
|
|
|
public function getNoBrush() { |
182
|
|
|
return $this->noBrush; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Get the print. |
187
|
|
|
* |
188
|
|
|
* @return string Returns the print. |
189
|
|
|
*/ |
190
|
|
|
public function getPrint() { |
191
|
|
|
return $this->print; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Get the view source. |
196
|
|
|
* |
197
|
|
|
* @return string Returns the view source. |
198
|
|
|
*/ |
199
|
|
|
public function getViewSource() { |
200
|
|
|
return $this->viewSource; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Set the alert. |
205
|
|
|
* |
206
|
|
|
* @param string $alert The alert. |
207
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
208
|
|
|
*/ |
209
|
|
|
public function setAlert($alert = "SyntaxHighlighter\n\n") { |
210
|
|
|
$this->alert = $alert; |
211
|
|
|
return $this; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Set the brush not HTML script. |
216
|
|
|
* |
217
|
|
|
* @param string $brushNotHtmlScript The brush not HTML script. |
218
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
219
|
|
|
*/ |
220
|
|
|
public function setBrushNotHtmlScript($brushNotHtmlScript = "Brush wasn't made for html-script option:") { |
221
|
|
|
$this->brushNotHtmlScript = $brushNotHtmlScript; |
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Set the copy to clipboard. |
227
|
|
|
* |
228
|
|
|
* @param string $copyToClipboard The copy to clipboard. |
229
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
230
|
|
|
*/ |
231
|
|
|
public function setCopyToClipboard($copyToClipboard = "copy to clipboard") { |
232
|
|
|
$this->copyToClipboard = $copyToClipboard; |
233
|
|
|
return $this; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set the copy to clipboard confirmation. |
238
|
|
|
* |
239
|
|
|
* @param string $copyToClipboardConfirmation The copy to clipboard confirmation. |
240
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
241
|
|
|
*/ |
242
|
|
|
public function setCopyToClipboardConfirmation($copyToClipboardConfirmation = "The code is in your clipboard now") { |
243
|
|
|
$this->copyToClipboardConfirmation = $copyToClipboardConfirmation; |
244
|
|
|
return $this; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Set the expand source. |
249
|
|
|
* |
250
|
|
|
* @param string $expandSource The expand source. |
251
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
252
|
|
|
*/ |
253
|
|
|
public function setExpandSource($expandSource = "+ expand source") { |
254
|
|
|
$this->expandSource = $expandSource; |
255
|
|
|
return $this; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* Set the help. |
260
|
|
|
* |
261
|
|
|
* @param string $help The help. |
262
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
263
|
|
|
*/ |
264
|
|
|
public function setHelp($help = "?") { |
265
|
|
|
$this->help = $help; |
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Set the no brush. |
271
|
|
|
* |
272
|
|
|
* @param string $noBrush The no brush. |
273
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
274
|
|
|
*/ |
275
|
|
|
public function setNoBrush($noBrush = "Can't find brush for:") { |
276
|
|
|
$this->noBrush = $noBrush; |
277
|
|
|
return $this; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Set the print. |
282
|
|
|
* |
283
|
|
|
* @param string $print The print. |
284
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
285
|
|
|
*/ |
286
|
|
|
public function setPrint($print = "print") { |
287
|
|
|
$this->print = $print; |
288
|
|
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* Set the view source. |
293
|
|
|
* |
294
|
|
|
* @param string $viewSource The view source. |
295
|
|
|
* @return SyntaxHighlighterStrings Returns the SyntaxHighlighter strings. |
296
|
|
|
*/ |
297
|
|
|
public function setViewSource($viewSource = "view source") { |
298
|
|
|
$this->viewSource = $viewSource; |
299
|
|
|
return $this; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
} |
303
|
|
|
|