1 | <?php namespace Arcanedev\LaravelHtml; |
||
14 | class HtmlBuilder extends Builder implements HtmlBuilderContract |
||
15 | { |
||
16 | /* ------------------------------------------------------------------------------------------------ |
||
17 | | Properties |
||
18 | | ------------------------------------------------------------------------------------------------ |
||
19 | */ |
||
20 | /** |
||
21 | * The URL generator instance. |
||
22 | * |
||
23 | * @var \Illuminate\Contracts\Routing\UrlGenerator |
||
24 | */ |
||
25 | protected $url; |
||
26 | |||
27 | /* ------------------------------------------------------------------------------------------------ |
||
28 | | Constructor |
||
29 | | ------------------------------------------------------------------------------------------------ |
||
30 | */ |
||
31 | /** |
||
32 | * Create a new HTML builder instance. |
||
33 | * |
||
34 | * @param \Illuminate\Contracts\Routing\UrlGenerator $url |
||
35 | */ |
||
36 | 426 | public function __construct(UrlGenerator $url = null) |
|
40 | |||
41 | /* ------------------------------------------------------------------------------------------------ |
||
42 | | Main Functions |
||
43 | | ------------------------------------------------------------------------------------------------ |
||
44 | */ |
||
45 | /** |
||
46 | * Convert an HTML string to entities. |
||
47 | * |
||
48 | * @param string $value |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 39 | public function entities($value) |
|
56 | |||
57 | /** |
||
58 | * Convert all applicable characters to HTML entities. |
||
59 | * |
||
60 | * @param string $value |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 57 | public function escape($value) |
|
68 | |||
69 | /** |
||
70 | * Convert entities to HTML characters. |
||
71 | * |
||
72 | * @param string $value |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | 6 | public function decode($value) |
|
80 | |||
81 | /** |
||
82 | * Generate a link to a JavaScript file. |
||
83 | * |
||
84 | * @param string $url |
||
85 | * @param array $attributes |
||
86 | * @param bool $secure |
||
87 | * |
||
88 | * @return \Illuminate\Support\HtmlString |
||
89 | */ |
||
90 | 6 | public function script($url, $attributes = [], $secure = null) |
|
98 | |||
99 | /** |
||
100 | * Generate a link to a CSS file. |
||
101 | * |
||
102 | * @param string $url |
||
103 | * @param array $attributes |
||
104 | * @param bool $secure |
||
105 | * |
||
106 | * @return \Illuminate\Support\HtmlString |
||
107 | */ |
||
108 | 6 | public function style($url, $attributes = [], $secure = null) |
|
121 | |||
122 | /** |
||
123 | * Generate an HTML image element. |
||
124 | * |
||
125 | * @param string $url |
||
126 | * @param string $alt |
||
127 | * @param array $attributes |
||
128 | * @param bool $secure |
||
129 | * |
||
130 | * @return \Illuminate\Support\HtmlString |
||
131 | */ |
||
132 | 6 | public function image($url, $alt = null, $attributes = [], $secure = null) |
|
140 | |||
141 | /** |
||
142 | * Generate a link to a Favicon file. |
||
143 | * |
||
144 | * @param string $url |
||
145 | * @param array $attributes |
||
146 | * @param bool $secure |
||
147 | * |
||
148 | * @return \Illuminate\Support\HtmlString |
||
149 | */ |
||
150 | 6 | public function favicon($url, $attributes = [], $secure = null) |
|
162 | |||
163 | /** |
||
164 | * Generate a HTML link. |
||
165 | * |
||
166 | * @param string $url |
||
167 | * @param string $title |
||
168 | * @param array $attributes |
||
169 | * @param bool $secure |
||
170 | * @param bool $escaped |
||
171 | * |
||
172 | * @return \Illuminate\Support\HtmlString |
||
173 | */ |
||
174 | 27 | public function link($url, $title = null, $attributes = [], $secure = null, $escaped = true) |
|
187 | |||
188 | /** |
||
189 | * Generate a HTTPS HTML link. |
||
190 | * |
||
191 | * @param string $url |
||
192 | * @param string $title |
||
193 | * @param array $attributes |
||
194 | * @param bool $escaped |
||
195 | * |
||
196 | * @return \Illuminate\Support\HtmlString |
||
197 | */ |
||
198 | 6 | public function secureLink($url, $title = null, $attributes = [], $escaped = true) |
|
202 | |||
203 | /** |
||
204 | * Generate a HTML link to an asset. |
||
205 | * |
||
206 | * @param string $url |
||
207 | * @param string $title |
||
208 | * @param array $attributes |
||
209 | * @param bool $secure |
||
210 | * |
||
211 | * @return \Illuminate\Support\HtmlString |
||
212 | */ |
||
213 | 9 | public function linkAsset($url, $title = null, $attributes = [], $secure = null) |
|
219 | |||
220 | /** |
||
221 | * Generate a HTTPS HTML link to an asset. |
||
222 | * |
||
223 | * @param string $url |
||
224 | * @param string $title |
||
225 | * @param array $attributes |
||
226 | * |
||
227 | * @return \Illuminate\Support\HtmlString |
||
228 | */ |
||
229 | 3 | public function linkSecureAsset($url, $title = null, $attributes = []) |
|
233 | |||
234 | /** |
||
235 | * Generate a HTML link to a named route. |
||
236 | * |
||
237 | * @param string $name |
||
238 | * @param string $title |
||
239 | * @param array $parameters |
||
240 | * @param array $attributes |
||
241 | * @param bool $escaped |
||
242 | * |
||
243 | * @return \Illuminate\Support\HtmlString |
||
244 | */ |
||
245 | 3 | public function linkRoute($name, $title = null, $parameters = [], $attributes = [], $escaped = true) |
|
251 | |||
252 | /** |
||
253 | * Generate a HTML link to a controller action. |
||
254 | * |
||
255 | * @param string $action |
||
256 | * @param string $title |
||
257 | * @param array $parameters |
||
258 | * @param array $attributes |
||
259 | * @param bool $escaped |
||
260 | * |
||
261 | * @return \Illuminate\Support\HtmlString |
||
262 | */ |
||
263 | 3 | public function linkAction($action, $title = null, $parameters = [], $attributes = [], $escaped = true) |
|
269 | |||
270 | /** |
||
271 | * Generate a HTML link to an email address. |
||
272 | * |
||
273 | * @param string $email |
||
274 | * @param string $title |
||
275 | * @param array $attributes |
||
276 | * @param bool $escaped |
||
277 | * |
||
278 | * @return \Illuminate\Support\HtmlString |
||
279 | */ |
||
280 | 3 | public function mailto($email, $title = null, $attributes = [], $escaped = true) |
|
292 | |||
293 | /** |
||
294 | * Obfuscate an e-mail address to prevent spam-bots from sniffing it. |
||
295 | * |
||
296 | * @param string $email |
||
297 | * |
||
298 | * @return string |
||
299 | */ |
||
300 | 3 | public function email($email) |
|
304 | |||
305 | /** |
||
306 | * Generate an ordered list of items. |
||
307 | * |
||
308 | * @param array $list |
||
309 | * @param array $attributes |
||
310 | * |
||
311 | * @return \Illuminate\Support\HtmlString |
||
312 | */ |
||
313 | 6 | public function ol(array $list, array $attributes = []) |
|
319 | |||
320 | /** |
||
321 | * Generate an un-ordered list of items. |
||
322 | * |
||
323 | * @param array $list |
||
324 | * @param array $attributes |
||
325 | * |
||
326 | * @return \Illuminate\Support\HtmlString |
||
327 | */ |
||
328 | 6 | public function ul(array $list, array $attributes = []) |
|
334 | |||
335 | /** |
||
336 | * Generate a description list of items. |
||
337 | * |
||
338 | * @param array $list |
||
339 | * @param array $attributes |
||
340 | * |
||
341 | * @return \Illuminate\Support\HtmlString |
||
342 | */ |
||
343 | 9 | public function dl(array $list, array $attributes = []) |
|
349 | |||
350 | /** |
||
351 | * Generates non-breaking space entities based on a supplied multiplier. |
||
352 | * |
||
353 | * @param int $multiplier |
||
354 | * |
||
355 | * @return string |
||
356 | */ |
||
357 | 3 | public function nbsp($multiplier = 1) |
|
361 | |||
362 | /** |
||
363 | * Build an HTML attribute string from an array. |
||
364 | * |
||
365 | * @param array $attributes |
||
366 | * |
||
367 | * @return string |
||
368 | */ |
||
369 | 330 | public function attributes(array $attributes) |
|
373 | |||
374 | /** |
||
375 | * Obfuscate a string to prevent spam-bots from sniffing it. |
||
376 | * |
||
377 | * @param string $value |
||
378 | * |
||
379 | * @return string |
||
380 | */ |
||
381 | 6 | public function obfuscate($value) |
|
385 | |||
386 | /** |
||
387 | * Generate a meta tag. |
||
388 | * |
||
389 | * @param string $name |
||
390 | * @param string $content |
||
391 | * @param array $attributes |
||
392 | * |
||
393 | * @return \Illuminate\Support\HtmlString |
||
394 | */ |
||
395 | 12 | public function meta($name, $content, array $attributes = []) |
|
401 | |||
402 | /** |
||
403 | * Generate a HTML link to an phone number (call). |
||
404 | * |
||
405 | * @param string $phone |
||
406 | * @param string $title |
||
407 | * @param array $attributes |
||
408 | * @param bool $escaped |
||
409 | * |
||
410 | * @return \Illuminate\Support\HtmlString |
||
411 | */ |
||
412 | 3 | public function tel($phone, $title = null, $attributes = [], $escaped = true) |
|
422 | } |
||
423 |