1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Head view helper, adding the necessary cdns. |
5
|
|
|
* |
6
|
|
|
* @author Leandro Silva <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @category LosUi |
9
|
|
|
* |
10
|
|
|
* @license https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License |
11
|
|
|
* |
12
|
|
|
* @link http://github.com/LansoWeb/LosUi |
13
|
|
|
*/ |
14
|
|
|
namespace LosUi\View\Helper; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Head view helper, adding the necessary links for cdns. |
18
|
|
|
* |
19
|
|
|
* @author Leandro Silva <[email protected]> |
20
|
|
|
* |
21
|
|
|
* @category LosUi |
22
|
|
|
* |
23
|
|
|
* @license https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License |
24
|
|
|
* |
25
|
|
|
* @link http://github.com/LansoWeb/LosUi |
26
|
|
|
*/ |
27
|
|
|
class Head |
28
|
|
|
{ |
29
|
|
|
const VERSION_JQUERY = '2.2.0'; |
30
|
|
|
const VERSION_BOOTSTRAP = '3.3.7'; |
31
|
|
|
const VERSION_FONTAWESOME = '4.7.0'; |
32
|
|
|
|
33
|
|
|
//---- Jquery |
34
|
|
|
public function getJquery($useMinified = true, $version = self::VERSION_JQUERY) : string |
35
|
|
|
{ |
36
|
|
|
return sprintf('<script src="%s">', $this->getJqueryLink($useMinified, $version)); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getJqueryLink($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
40
|
|
|
{ |
41
|
|
|
return sprintf( |
42
|
|
|
'https://code.jquery.com/jquery-%s.%sjs', |
43
|
|
|
$version, |
44
|
|
|
$useMinified ? 'min.' : '' |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
//---- Bootstrap |
49
|
|
|
public function getBootstrap($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
50
|
|
|
{ |
51
|
|
|
return $this->getBootstrapJs($useMinified, $version) . '<br>' . $this->getBootstrapCss($useMinified, $version); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getBootstrapCss($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
55
|
|
|
{ |
56
|
|
|
return sprintf('<link rel="stylesheet" href="%s">', $this->getBootstrapCssLink($useMinified, $version)); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getBootstrapJs($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
60
|
|
|
{ |
61
|
|
|
return sprintf('<script src="%s">', $this->getBootstrapJsLink($useMinified, $version)); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getBootstrapCssLink($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
65
|
|
|
{ |
66
|
|
|
return sprintf( |
67
|
|
|
'https://maxcdn.bootstrapcdn.com/bootstrap/%s/css/bootstrap.%scss', |
68
|
|
|
$version, |
69
|
|
|
$useMinified ? 'min.' : '' |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getBootstrapJsLink($useMinified = true, $version = self::VERSION_BOOTSTRAP) : string |
74
|
|
|
{ |
75
|
|
|
return sprintf( |
76
|
|
|
'https://maxcdn.bootstrapcdn.com/bootstrap/%s/js/bootstrap.%sjs', |
77
|
|
|
$version, |
78
|
|
|
$useMinified ? 'min.' : '' |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
//---- Fontawesome |
83
|
|
|
public function getFontAwesome($useMinified = true, $version = self::VERSION_FONTAWESOME) : string |
84
|
|
|
{ |
85
|
|
|
return sprintf('<link rel="stylesheet" href="%s">', $this->getFontAwesomeCssLink($useMinified, $version)); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getFontAwesomeCssLink($useMinified = true, $version = self::VERSION_FONTAWESOME) : string |
89
|
|
|
{ |
90
|
|
|
return sprintf( |
91
|
|
|
'https://maxcdn.bootstrapcdn.com/font-awesome/%s/css/font-awesome.%scss', |
92
|
|
|
$version, |
93
|
|
|
$useMinified ? 'min.' : '' |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|