forked from patricktalmadge/bootstrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
labels.php
111 lines (100 loc) · 2.47 KB
/
labels.php
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
<?php namespace Bootstrapper;
use \HTML;
/**
* Labels for creating Twitter Bootstrap style Labels.
*
* @package Bundles
* @subpackage Twitter
* @author Patrick Talmadge - Follow @patricktalmadge
*
* @see http://twitter.github.com/bootstrap/
*/
class Labels
{
// Labels colors
const NORMAL = '';
const SUCCESS = 'label-success';
const WARNING = 'label-warning';
const IMPORTANT = 'label-important';
const INFO = 'label-info';
const INVERSE = 'label-inverse';
/**
* Create a new Labels instance.
*
* @param string $type
* @param string $message
* @param array $attributes
* @return Label
*/
protected static function show($type = Labels::NORMAL, $message, $attributes = array())
{
$attributes = Helpers::add_class($attributes, 'label '.$type);
return '<span'.HTML::attributes($attributes).'>'.$message.'</span>';
}
/**
* Create a new Normal Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function normal($message, $attributes = array())
{
return static::show(Labels::NORMAL, $message, $attributes);
}
/**
* Create a new Success Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function success($message, $attributes = array())
{
return static::show(Labels::SUCCESS, $message, $attributes);
}
/**
* Create a new Warning Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function warning($message, $attributes = array())
{
return static::show(Labels::WARNING, $message, $attributes);
}
/**
* Create a new Important Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function important($message, $attributes = array())
{
return static::show(Labels::IMPORTANT, $message, $attributes);
}
/**
* Create a new Info Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function info($message, $attributes = array())
{
return static::show(Labels::INFO, $message, $attributes);
}
/**
* Create a new Inverse Labels instance.
*
* @param string $message
* @param array $attributes
* @return Label
*/
public static function inverse($message, $attributes = array())
{
return static::show(Labels::INVERSE, $message, $attributes);
}
}