-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTML.php
More file actions
149 lines (134 loc) · 3.41 KB
/
HTML.php
File metadata and controls
149 lines (134 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php namespace Syntax\Core;
use URL;
/**
* Nuclear Today Custom HTML helpers
*
* Extra laravel HTML methods
*
*
* @author Stygian <stygian@nucleartoday.com>
* @package Fire Suppression
* @subpackage Rods
* @version 0.1
*/
class HTML extends \Illuminate\Support\Facades\HTML {
/**
* Create a link including an image
*
* @static
*
* @param string The URL the link will point to
* @param string The image to use (HTML::image)
* @param array Any attributes the link itself should have
* @param boolen Determine if the link is https or http
*
* @return string
*/
public static function linkImage($url, $imagesrc, $attributes = array(), $https = null)
{
$url = URL::to($url, $https);
return '<a href="'.$url.'"'.static::attributes($attributes).'>'.$imagesrc.'</a>';
}
public static function addButton($url, $iconClass = 'fa-plus')
{
return HTML::linkIcon($url, 'fa '. $iconClass);
}
public static function editButton ($url, $btnClass = 'primary')
{
return HTML::link($url, 'Edit', array('class' => 'btn btn-xs btn-'. $btnClass));
}
public static function deleteButton ($url, $btnClass = 'danger')
{
return HTML::link($url, 'Delete', array('class' => 'confirm-remove btn btn-xs btn-'. $btnClass));
}
/**
* Create a link including twitter bootstrap icons
*
* @static
*
* @param string The URL the link will point to
* @param string Any classes the icon should have (fa fa-white, fa fa-check, etc)
* @param string Text to show after the icon
* @param array Any attributes the link itself should have
* @param boolen Determine if the link is https or http
*
* @return string
*/
public static function linkIcon($url, $iconClasses, $iconText = null, $attributes = array(), $https = null)
{
$url = URL::to($url, $https);
return '<a href="'.$url.'"'.static::attributes($attributes).'><i class="'.$iconClasses.'"></i> '. $iconText .'</a>';
}
/**
* Generate a HTML span.
*
* @param string $value
* @param array $attributes
* @return string
*/
public static function span($value, $attributes = array())
{
return '<span'.static::attributes($attributes).'>'.$value.'</span>';
}
/**
* Generate a strong element.
*
* @access public
* @param string $data
* @return string
*/
public static function strong($data) {
return '<span style="font-weight: bold;">' . $data . '</span>';
}
/**
* Generate an em element.
*
* @access public
* @param string $data
* @return string
*/
public static function em($data) {
return '<span style="font-style: italic;">' . $data . '</span>';
}
/**
* Generate a code element.
*
* @access public
* @param string $data
* @return string
*/
public static function code($data) {
return '<code>' . e($data) . '</code>';
}
/**
* Generate a blockquote element.
*
* @access public
* @param string $data
* @return string
*/
public static function quote($data) {
return '<blockquote><p>' . $data . '</p></blockquote>';
}
/**
* Generate a del element.
*
* @access public
* @param string $data
* @return string
*/
public static function del($data) {
return '<del>' . $data . '</del>';
}
/**
* Generate an iframe element.
*
* @access public
* @param string $url
* @param array $attributes
* @return string
*/
public static function iframe($url, $attributes = array()) {
return '<iframe src="' . $url . '"' . static::attributes($attributes) . '></iframe>';
}
}