|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
function attrs($attrs) |
|
4
|
|
|
{ |
|
5
|
|
|
$str = ''; |
|
6
|
|
|
|
|
7
|
|
|
foreach ($attrs as $key => $value) { |
|
8
|
|
|
$str .= $key.'="'.$value.'" '; |
|
9
|
|
|
} |
|
10
|
|
|
|
|
11
|
|
|
return $str; |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
if (!function_exists('css')) { |
|
15
|
|
|
function css($href = '', $attrs = []) |
|
16
|
|
|
{ |
|
17
|
|
|
return '<link rel="stylesheet" type="text/css" href="'.$href.'" '.attrs($attrs).'>'; |
|
18
|
|
|
} |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
if (!function_exists('less')) { |
|
22
|
|
|
function less($href = '', $attrs = []) |
|
23
|
|
|
{ |
|
24
|
|
|
return '<link rel="stylesheet/less" type="text/css" href="'.$href.'"'.attrs($attrs).'>'; |
|
25
|
|
|
} |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
if (!function_exists('js')) { |
|
29
|
|
|
function js($src = null, $default = '', $attrs = []) |
|
30
|
|
|
{ |
|
31
|
|
|
return '<script type="text/javascript" src="'.$src.'"'.attrs($attrs).'>'.$default.'</script>'; |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
if (!function_exists('img')) { |
|
36
|
|
|
function img($src = null, $attrs = []) |
|
37
|
|
|
{ |
|
38
|
|
|
return '<img src="'.$src.'" '.attrs($attrs).'/>'; |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
if (!function_exists('fontawesome')) { |
|
43
|
|
|
function fontawesome($version = '4.7.0', $href = null) |
|
44
|
|
|
{ |
|
45
|
|
|
if (null === $href) { |
|
46
|
|
|
$href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/'.$version.'/css/font-awesome.min.css'; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
return '<link rel="stylesheet" type="text/css" href="'.$href.'">'; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
if (!function_exists('jquery')) { |
|
54
|
|
|
function jquery($version = '3.2.1', $src = null) |
|
55
|
|
|
{ |
|
56
|
|
|
if (null === $src) { |
|
57
|
|
|
$src = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/'.$version.'/jquery.min.js'; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return '<script type="text/javascript" src="'.$src.'"></script>'; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
if (!function_exists('bootstrap_js')) { |
|
65
|
|
|
function bootstrap_js($version = '4.0.0-alpha.6', $src = null) |
|
66
|
|
|
{ |
|
67
|
|
|
if (null === $src) { |
|
68
|
|
|
$src = 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/'.$version.'/js/bootstrap.min.js'; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
return '<script type="text/javascript" src="'.$src.'"></script>'; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
if (!function_exists('bootstrap_css')) { |
|
76
|
|
|
function bootstrap_css($version = '4.0.0-alpha.6', $href = null) |
|
77
|
|
|
{ |
|
78
|
|
|
if (null === $href) { |
|
79
|
|
|
$href = 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/'.$version.'/css/bootstrap.min.css'; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
return '<link rel="stylesheet" type="text/css" href="'.$href.'">'; |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if (!function_exists('icon')) { |
|
87
|
|
|
function icon($icon = '', $tag = 'i') |
|
88
|
|
|
{ |
|
89
|
|
|
return '<'.$tag.' class="fa fa-'.$icon.'"></'.$tag.'>'; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
if (!function_exists('google_analytics')) { |
|
94
|
|
|
function google_analytics($ua = '') |
|
95
|
|
|
{ |
|
96
|
|
|
// Change UA-XXXXX-X to be your site's ID |
|
97
|
|
|
$out = "<!-- Google Webmaster Tools & Analytics -->\n"; |
|
98
|
|
|
$out .= '<script type="text/javascript">'; |
|
99
|
|
|
$out .= ' var _gaq = _gaq || [];'; |
|
100
|
|
|
$out .= " _gaq.push(['_setAccount', '$ua']);"; |
|
101
|
|
|
$out .= " _gaq.push(['_trackPageview']);"; |
|
102
|
|
|
$out .= ' (function() {'; |
|
103
|
|
|
$out .= " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;"; |
|
104
|
|
|
$out .= " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';"; |
|
105
|
|
|
$out .= " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);"; |
|
106
|
|
|
$out .= ' })();'; |
|
107
|
|
|
$out .= '</script>'; |
|
108
|
|
|
|
|
109
|
|
|
return $out; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|