html5-starter 0.1.4b → 0.1.8b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +11 -113
- data/stylesheets/html5-boilerplate/_fonts.scss +4 -4
- data/stylesheets/html5-boilerplate/_handheld.scss +3 -3
- data/stylesheets/html5-boilerplate/_helpers.scss +14 -7
- data/stylesheets/html5-boilerplate/_print.scss +2 -2
- data/stylesheets/html5-boilerplate/_reset.scss +8 -8
- data/stylesheets/html5-boilerplate/_styles.scss +16 -31
- data/templates/project/files/404.html +37 -21
- data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-57x57-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon.png +0 -0
- data/templates/project/files/build/build.xml +813 -628
- data/templates/project/files/build/config/buildinfo.properties +5 -0
- data/templates/project/files/build/config/default.properties +22 -21
- data/templates/project/files/build/config/project.properties +9 -8
- data/templates/project/files/build/createproject.sh +29 -52
- data/templates/project/files/build/runbuildscript.bat +5 -0
- data/templates/project/files/build/tools/htmlcompressor-1.1.jar +0 -0
- data/templates/project/files/build/tools/{yuicompressor-2.4.2.jar → yuicompressor-2.4.5.jar} +0 -0
- data/templates/project/files/gitignore.txt +6 -0
- data/templates/project/files/htaccess +71 -8
- data/templates/project/index.html +30 -31
- data/templates/project/javascripts/libs/dd_belatedpng.js +1 -1
- data/templates/project/javascripts/libs/{jquery-1.5.0.js → jquery-1.5.1.js} +549 -409
- data/templates/project/javascripts/libs/jquery-1.5.1.min.js +16 -0
- data/templates/project/javascripts/libs/modernizr-1.7.min.js +2 -0
- data/templates/project/javascripts/plugins.js +3 -1
- data/templates/project/manifest.rb +22 -59
- data/templates/project/style.scss +17 -0
- metadata +15 -44
- data/templates/project/files/build/config/build.properties +0 -3
- data/templates/project/files/build/tools/css-compressor/CSSCompression.php +0 -465
- data/templates/project/files/build/tools/css-compressor/changelog.txt +0 -22
- data/templates/project/files/build/tools/css-compressor/cli.php +0 -101
- data/templates/project/files/build/tools/css-compressor/helpers/hex2short-colors.json +0 -39
- data/templates/project/files/build/tools/css-compressor/helpers/hex2short-safe.json +0 -16
- data/templates/project/files/build/tools/css-compressor/helpers/long2hex-colors.json +0 -127
- data/templates/project/files/build/tools/css-compressor/lib/Cleanup.php +0 -218
- data/templates/project/files/build/tools/css-compressor/lib/Color.php +0 -199
- data/templates/project/files/build/tools/css-compressor/lib/Combine/Aural.php +0 -109
- data/templates/project/files/build/tools/css-compressor/lib/Combine/Background.php +0 -107
- data/templates/project/files/build/tools/css-compressor/lib/Combine/Border.php +0 -98
- data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderOutline.php +0 -109
- data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderRadius.php +0 -262
- data/templates/project/files/build/tools/css-compressor/lib/Combine/Font.php +0 -125
- data/templates/project/files/build/tools/css-compressor/lib/Combine/List.php +0 -104
- data/templates/project/files/build/tools/css-compressor/lib/Combine/MarginPadding.php +0 -190
- data/templates/project/files/build/tools/css-compressor/lib/Combine.php +0 -191
- data/templates/project/files/build/tools/css-compressor/lib/Compress.php +0 -212
- data/templates/project/files/build/tools/css-compressor/lib/Control.php +0 -236
- data/templates/project/files/build/tools/css-compressor/lib/Exception.php +0 -32
- data/templates/project/files/build/tools/css-compressor/lib/Format.php +0 -187
- data/templates/project/files/build/tools/css-compressor/lib/Individuals.php +0 -307
- data/templates/project/files/build/tools/css-compressor/lib/Numeric.php +0 -103
- data/templates/project/files/build/tools/css-compressor/lib/Option.php +0 -133
- data/templates/project/files/build/tools/css-compressor/lib/Organize.php +0 -149
- data/templates/project/files/build/tools/css-compressor/lib/Selectors.php +0 -245
- data/templates/project/files/build/tools/css-compressor/lib/Setup.php +0 -292
- data/templates/project/files/build/tools/css-compressor/lib/Trim.php +0 -213
- data/templates/project/files/build/tools/css-compressor/license.txt +0 -21
- data/templates/project/files/build/tools/htmlcompressor-0.9.8.jar +0 -0
- data/templates/project/files/google.yml +0 -22
- data/templates/project/files/lighttpd.conf +0 -149
- data/templates/project/files/mime.types +0 -80
- data/templates/project/files/nginx.conf +0 -108
- data/templates/project/files/web.config +0 -207
- data/templates/project/javascripts/libs/jquery-1.5.0.min.js +0 -16
- data/templates/project/javascripts/libs/modernizr-1.6.min.js +0 -30
@@ -1,127 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* CSS Compressor [VERSION]
|
3
|
-
* [DATE]
|
4
|
-
* Corey Hart @ http://www.codenothing.com
|
5
|
-
*/
|
6
|
-
{
|
7
|
-
"aliceblue":"#f0f8ff",
|
8
|
-
"antiquewhite":"#faebd7",
|
9
|
-
"aquamarine":"#7fffd4",
|
10
|
-
"bisque":"#ffe4c4",
|
11
|
-
"black":"#000000",
|
12
|
-
"blanchedalmond":"#ffebcd",
|
13
|
-
"blueviolet":"#8a2be2",
|
14
|
-
"burlywood":"#deb887",
|
15
|
-
"cadetblue":"#5f9ea0",
|
16
|
-
"chartreuse":"#7fff00",
|
17
|
-
"chocolate":"#d2691e",
|
18
|
-
"coral":"#ff7f50",
|
19
|
-
"cornflowerblue":"#6495ed",
|
20
|
-
"cornsilk":"#fff8dc",
|
21
|
-
"crimson":"#dc143c",
|
22
|
-
"cyan":"#00ffff",
|
23
|
-
"darkblue":"#00008b",
|
24
|
-
"darkcyan":"#008b8b",
|
25
|
-
"darkgoldenrod":"#b8860b",
|
26
|
-
"darkgray":"#a9a9a9",
|
27
|
-
"darkgreen":"#006400",
|
28
|
-
"darkkhaki":"#bdb76b",
|
29
|
-
"darkmagenta":"#8b008b",
|
30
|
-
"darkolivegreen":"#556b2f",
|
31
|
-
"darkorange":"#ff8c00",
|
32
|
-
"darkorchid":"#9932cc",
|
33
|
-
"darkred":"#8b0000",
|
34
|
-
"darksalmon":"#e9967a",
|
35
|
-
"darkseagreen":"#8fbc8f",
|
36
|
-
"darkslateblue":"#483d8b",
|
37
|
-
"darkslategray":"#2f4f4f",
|
38
|
-
"darkturquoise":"#00ced1",
|
39
|
-
"darkviolet":"#9400d3",
|
40
|
-
"deeppink":"#ff1493",
|
41
|
-
"deepskyblue":"#00bfff",
|
42
|
-
"dimgray":"#696969",
|
43
|
-
"dodgerblue":"#1e90ff",
|
44
|
-
"firebrick":"#b22222",
|
45
|
-
"floralwhite":"#fffaf0",
|
46
|
-
"forestgreen":"#228b22",
|
47
|
-
"fuchsia":"#ff00ff",
|
48
|
-
"gainsboro":"#dcdcdc",
|
49
|
-
"ghostwhite":"#f8f8ff",
|
50
|
-
"goldenrod":"#daa520",
|
51
|
-
"green":"#008800",
|
52
|
-
"greenyellow":"#adff2f",
|
53
|
-
"honeydew":"#f0fff0",
|
54
|
-
"hotpink":"#ff69b4",
|
55
|
-
"indianred ":"#cd5c5c",
|
56
|
-
"indigo ":"#4b0082",
|
57
|
-
"lavender":"#e6e6fa",
|
58
|
-
"lavenderblush":"#fff0f5",
|
59
|
-
"lawngreen":"#7cfc00",
|
60
|
-
"lemonchiffon":"#fffacd",
|
61
|
-
"lightblue":"#add8e6",
|
62
|
-
"lightcoral":"#f08080",
|
63
|
-
"lightcyan":"#e0ffff",
|
64
|
-
"lightgoldenrodyellow":"#fafad2",
|
65
|
-
"lightgrey":"#d3d3d3",
|
66
|
-
"lightgreen":"#90ee90",
|
67
|
-
"lightpink":"#ffb6c1",
|
68
|
-
"lightsalmon":"#ffa07a",
|
69
|
-
"lightseagreen":"#20b2aa",
|
70
|
-
"lightskyblue":"#87cefa",
|
71
|
-
"lightslategray":"#778899",
|
72
|
-
"lightsteelblue":"#b0c4de",
|
73
|
-
"lightyellow":"#ffffe0",
|
74
|
-
"lime":"#00ff00",
|
75
|
-
"limegreen":"#32cd32",
|
76
|
-
"magenta":"#ff00ff",
|
77
|
-
"maroon":"#800000",
|
78
|
-
"mediumaquamarine":"#66cdaa",
|
79
|
-
"mediumblue":"#0000cd",
|
80
|
-
"mediumorchid":"#ba55d3",
|
81
|
-
"mediumpurple":"#9370d8",
|
82
|
-
"mediumseagreen":"#3cb371",
|
83
|
-
"mediumslateblue":"#7b68ee",
|
84
|
-
"mediumspringgreen":"#00fa9a",
|
85
|
-
"mediumturquoise":"#48d1cc",
|
86
|
-
"mediumvioletred":"#c71585",
|
87
|
-
"midnightblue":"#191970",
|
88
|
-
"mintcream":"#f5fffa",
|
89
|
-
"mistyrose":"#ffe4e1",
|
90
|
-
"moccasin":"#ffe4b5",
|
91
|
-
"navajowhite":"#ffdead",
|
92
|
-
"oldlace":"#fdf5e6",
|
93
|
-
"olivedrab":"#6b8e23",
|
94
|
-
"orange":"#ffa500",
|
95
|
-
"orangered":"#ff4500",
|
96
|
-
"orchid":"#da70d6",
|
97
|
-
"palegoldenrod":"#eee8aa",
|
98
|
-
"palegreen":"#98fb98",
|
99
|
-
"paleturquoise":"#afeeee",
|
100
|
-
"palevioletred":"#d87093",
|
101
|
-
"papayawhip":"#ffefd5",
|
102
|
-
"peachpuff":"#ffdab9",
|
103
|
-
"powderblue":"#b0e0e6",
|
104
|
-
"purple":"#800080",
|
105
|
-
"rosybrown":"#bc8f8f",
|
106
|
-
"royalblue":"#4169e1",
|
107
|
-
"saddlebrown":"#8b4513",
|
108
|
-
"salmon":"#fa8072",
|
109
|
-
"sandybrown":"#f4a460",
|
110
|
-
"seagreen":"#2e8b57",
|
111
|
-
"seashell":"#fff5ee",
|
112
|
-
"sienna":"#a0522d",
|
113
|
-
"silver":"#c0c0c0",
|
114
|
-
"skyblue":"#87ceeb",
|
115
|
-
"slateblue":"#6a5acd",
|
116
|
-
"slategray":"#708090",
|
117
|
-
"springgreen":"#00ff7f",
|
118
|
-
"steelblue":"#4682b4",
|
119
|
-
"thistle":"#d8bfd8",
|
120
|
-
"tomato":"#ff6347",
|
121
|
-
"turquoise":"#40e0d0",
|
122
|
-
"violet":"#ee82ee",
|
123
|
-
"white":"#ffffff",
|
124
|
-
"whitesmoke":"#f5f5f5",
|
125
|
-
"yellow":"#ffff00",
|
126
|
-
"yellowgreen":"#9acd32"
|
127
|
-
}
|
@@ -1,218 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
/**
|
3
|
-
* CSS Compressor [VERSION]
|
4
|
-
* [DATE]
|
5
|
-
* Corey Hart @ http://www.codenothing.com
|
6
|
-
*/
|
7
|
-
|
8
|
-
Class CSSCompression_Cleanup
|
9
|
-
{
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Cleanup patterns
|
13
|
-
*
|
14
|
-
* @class Control: Compression Controller
|
15
|
-
* @param (string) token: Copy of the injection token
|
16
|
-
* @param (regex) rtoken: Token regex built upon instantiation
|
17
|
-
* @param (array) options: Reference to options
|
18
|
-
* @param (regex) rsemi: Checks for last semit colon in details
|
19
|
-
* @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
|
20
|
-
* @param (regex) rspace: Checks for space without an escape '\' character before it
|
21
|
-
* @param (regex) rcolon: Checks for colon without an escape '\' character before it
|
22
|
-
* @param (regex) rquote: Checks for quote (') without an escape '\' character before it
|
23
|
-
* @param (array) rescape: Array of patterns for groupings that should be escaped
|
24
|
-
* @param (array) escaped: Contains patterns and replacements for espaced characters
|
25
|
-
*/
|
26
|
-
private $Control;
|
27
|
-
private $token = '';
|
28
|
-
private $rtoken = '';
|
29
|
-
private $options = array();
|
30
|
-
private $rsemi = "/;$/";
|
31
|
-
private $rsemicolon = "/(?<!\\\);/";
|
32
|
-
private $rspace = "/(?<!\\\)\s/";
|
33
|
-
private $rcolon = "/(?<!\\\):/";
|
34
|
-
private $rquote = "/(?<!\\\)'/";
|
35
|
-
private $rescape = array(
|
36
|
-
"/((?<!\\\)\")(.*?)((?<!\\\)\")/",
|
37
|
-
"/((?<!\\\)')(.*?)((?<!\\\)')/",
|
38
|
-
"/(url\()(.*?)(\))/",
|
39
|
-
);
|
40
|
-
private $escaped = array(
|
41
|
-
'search' => array(
|
42
|
-
"\\:",
|
43
|
-
"\\;",
|
44
|
-
"\\}",
|
45
|
-
"\\{",
|
46
|
-
"\\@",
|
47
|
-
"\\!",
|
48
|
-
"\\,",
|
49
|
-
"\\>",
|
50
|
-
"\\+",
|
51
|
-
"\\~",
|
52
|
-
"\\/",
|
53
|
-
"\\*",
|
54
|
-
"\\.",
|
55
|
-
"\\=",
|
56
|
-
"\\#",
|
57
|
-
"\\r",
|
58
|
-
"\\n",
|
59
|
-
"\\t",
|
60
|
-
"\\ ",
|
61
|
-
),
|
62
|
-
'replace' => array(
|
63
|
-
":",
|
64
|
-
";",
|
65
|
-
"}",
|
66
|
-
"{",
|
67
|
-
"@",
|
68
|
-
"!",
|
69
|
-
",",
|
70
|
-
">",
|
71
|
-
"+",
|
72
|
-
"~",
|
73
|
-
"/",
|
74
|
-
"*",
|
75
|
-
".",
|
76
|
-
"=",
|
77
|
-
"#",
|
78
|
-
"\r",
|
79
|
-
"\n",
|
80
|
-
"\t",
|
81
|
-
" ",
|
82
|
-
),
|
83
|
-
);
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Build the token regex based on defined token
|
87
|
-
*
|
88
|
-
* @param (class) control: CSSCompression Controller
|
89
|
-
*/
|
90
|
-
public function __construct( CSSCompression_Control $control ) {
|
91
|
-
$this->Control = $control;
|
92
|
-
$this->token = CSSCompression::TOKEN;
|
93
|
-
$this->options = &$control->Option->options;
|
94
|
-
|
95
|
-
// Have to build the token regexs after initialization
|
96
|
-
$this->rtoken = "/($this->token)(.*?)($this->token)/";
|
97
|
-
array_push( $this->rescape, $this->rtoken );
|
98
|
-
}
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Central cleanup process, removes all injections
|
102
|
-
*
|
103
|
-
* @param (array) selectors: Array of selectors
|
104
|
-
* @param (array) details: Array of details
|
105
|
-
*/
|
106
|
-
public function cleanup( &$selectors, &$details ) {
|
107
|
-
foreach ( $details as $i => &$value ) {
|
108
|
-
// Auto skip sections
|
109
|
-
if ( isset( $selectors[ $i ] ) && strpos( $selectors[ $i ], $this->token ) === 0 ) {
|
110
|
-
continue;
|
111
|
-
}
|
112
|
-
|
113
|
-
// Removing dupes
|
114
|
-
if ( $this->options['rm-multi-define'] ) {
|
115
|
-
$value = $this->removeMultipleDefinitions( $value );
|
116
|
-
}
|
117
|
-
|
118
|
-
$value = $this->removeUnnecessarySemicolon( $value );
|
119
|
-
}
|
120
|
-
|
121
|
-
return array( $selectors, $details );
|
122
|
-
}
|
123
|
-
|
124
|
-
/**
|
125
|
-
* Removes '\' from possible splitter characters in URLs
|
126
|
-
*
|
127
|
-
* @param (string) css: Full css sheet
|
128
|
-
*/
|
129
|
-
public function removeInjections( $css ) {
|
130
|
-
// Remove escaped characters
|
131
|
-
foreach ( $this->rescape as $regex ) {
|
132
|
-
$pos = 0;
|
133
|
-
while ( preg_match( $regex, $css, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
134
|
-
$value = $match[ 1 ][ 0 ]
|
135
|
-
. str_replace( $this->escaped['search'], $this->escaped['replace'], $match[ 2 ][ 0 ] )
|
136
|
-
. $match[ 3 ][ 0 ];
|
137
|
-
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
138
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
|
142
|
-
// Remove token injections
|
143
|
-
$pos = 0;
|
144
|
-
while ( preg_match( $this->rtoken, $css, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
145
|
-
$value = $match[ 2 ][ 0 ];
|
146
|
-
if ( preg_match( $this->rspace, $value ) ) {
|
147
|
-
$quote = preg_match( $this->rquote, $value ) ? "\"" : "'";
|
148
|
-
$value = "$quote$value$quote";
|
149
|
-
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
150
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
151
|
-
}
|
152
|
-
else {
|
153
|
-
$css = substr_replace( $css, $value, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
|
154
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $value ) + 1;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
return $css;
|
159
|
-
}
|
160
|
-
|
161
|
-
/**
|
162
|
-
* Removes multiple definitions that were created during compression
|
163
|
-
*
|
164
|
-
* @param (string) val: CSS Selector Properties
|
165
|
-
*/
|
166
|
-
private function removeMultipleDefinitions( $val = '' ) {
|
167
|
-
$storage = array();
|
168
|
-
$arr = preg_split( $this->rsemicolon, $val );
|
169
|
-
|
170
|
-
foreach ( $arr as $x ) {
|
171
|
-
if ( $x ) {
|
172
|
-
list( $a, $b ) = preg_split( $this->rcolon, $x, 2 );
|
173
|
-
$storage[ $a ] = $b;
|
174
|
-
}
|
175
|
-
}
|
176
|
-
|
177
|
-
if ( $storage ) {
|
178
|
-
$val = '';
|
179
|
-
foreach ( $storage as $x => $y ) {
|
180
|
-
$val .= "$x:$y;";
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
// Return converted val
|
185
|
-
return $val;
|
186
|
-
}
|
187
|
-
|
188
|
-
/**
|
189
|
-
* Removes last semicolons on the final property of a set
|
190
|
-
*
|
191
|
-
* @param (string) value: rule set
|
192
|
-
*/
|
193
|
-
private function removeUnnecessarySemicolon( $value ) {
|
194
|
-
return preg_replace( $this->rsemi, '', $value );
|
195
|
-
}
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Access to private methods for testing
|
199
|
-
*
|
200
|
-
* @param (string) method: Method to be called
|
201
|
-
* @param (array) args: Array of paramters to be passed in
|
202
|
-
*/
|
203
|
-
public function access( $method, $args ) {
|
204
|
-
if ( method_exists( $this, $method ) ) {
|
205
|
-
if ( $method == 'cleanup' ) {
|
206
|
-
return $this->cleanup( $args[ 0 ], $args[ 1 ] );
|
207
|
-
}
|
208
|
-
else {
|
209
|
-
return call_user_func_array( array( $this, $method ), $args );
|
210
|
-
}
|
211
|
-
}
|
212
|
-
else {
|
213
|
-
throw new CSSCompression_Exception( "Unknown method in Cleanup Class - " . $method );
|
214
|
-
}
|
215
|
-
}
|
216
|
-
};
|
217
|
-
|
218
|
-
?>
|
@@ -1,199 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
/**
|
3
|
-
* CSS Compressor [VERSION]
|
4
|
-
* [DATE]
|
5
|
-
* Corey Hart @ http://www.codenothing.com
|
6
|
-
*/
|
7
|
-
|
8
|
-
Class CSSCompression_Color
|
9
|
-
{
|
10
|
-
/**
|
11
|
-
* Color Patterns
|
12
|
-
*
|
13
|
-
* @class Control: Compression Controller
|
14
|
-
* @param (array) options: Reference to options array
|
15
|
-
* @param (regex) rrgb: Checks for rgb notation
|
16
|
-
* @param (regex) rhex: Checks for hex code
|
17
|
-
* @param (regex) rfullhex: Checks for full 6 character hex code
|
18
|
-
* @static (array) color2hex: Long color name to hex code conversions
|
19
|
-
* @static (array) hex2short: Hex code to short color name conversions
|
20
|
-
* @static (array) hex2short_safe: CSS Level 1 safe color names that are shorter than hex codes
|
21
|
-
* @static (array) files: List of static helpers with their class vars
|
22
|
-
*/
|
23
|
-
private $Control;
|
24
|
-
private $options = array();
|
25
|
-
private $rrgb = "/^rgb\((\d{1,3}\%?(,\d{1,3}\%?,\d{1,3}\%?)?)\)$/i";
|
26
|
-
private $rhex = "/^#([0-9a-f]{3}|[0-9a-f]{6})$/i";
|
27
|
-
private $rfullhex = "/^#([0-9a-f]{6})$/i";
|
28
|
-
private static $color2hex = array();
|
29
|
-
private static $hex2short = array();
|
30
|
-
private static $hex2short_safe = array();
|
31
|
-
private static $files = array(
|
32
|
-
'color2hex' => 'long2hex-colors.json',
|
33
|
-
'hex2short' => 'hex2short-colors.json',
|
34
|
-
'hex2short_safe' => 'hex2short-safe.json',
|
35
|
-
);
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Stash a reference to the controller on each instantiation
|
39
|
-
* and install conversion helpers
|
40
|
-
*
|
41
|
-
* @param (class) control: CSSCompression Controller
|
42
|
-
*/
|
43
|
-
public function __construct( CSSCompression_Control $control ) {
|
44
|
-
$this->Control = $control;
|
45
|
-
$this->options = &$control->Option->options;
|
46
|
-
|
47
|
-
if ( ! self::$color2hex ) {
|
48
|
-
foreach ( self::$files as $v => $file ) {
|
49
|
-
self::$$v = CSSCompression::getJSON( $file );
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Central handler for all color conversions.
|
56
|
-
*
|
57
|
-
* @param (string) val: Color to be parsed
|
58
|
-
*/
|
59
|
-
public function color( $val ) {
|
60
|
-
// Converts rgb values to hex codes
|
61
|
-
if ( $this->options['color-rgb2hex'] ) {
|
62
|
-
$val = $this->rgb2hex( $val );
|
63
|
-
}
|
64
|
-
|
65
|
-
// Convert long color names to hex codes
|
66
|
-
if ( $this->options['color-long2hex'] ) {
|
67
|
-
$val = $this->color2hex( $val );
|
68
|
-
}
|
69
|
-
|
70
|
-
// Ensure all hex codes are lowercase
|
71
|
-
if ( preg_match( $this->rhex, $val ) ) {
|
72
|
-
$val = strtolower( $val );
|
73
|
-
}
|
74
|
-
|
75
|
-
// Convert large hex codes to small codes
|
76
|
-
if ( $this->options['color-hex2shorthex'] ) {
|
77
|
-
$val = $this->hex2short( $val );
|
78
|
-
}
|
79
|
-
|
80
|
-
// Convert 6 digit hex codes to short color names
|
81
|
-
if ( $this->options['color-hex2shortcolor'] ) {
|
82
|
-
$val = $this->hex2color( $val );
|
83
|
-
}
|
84
|
-
|
85
|
-
// Convert safe css level1 color names
|
86
|
-
if ( $this->options['color-hex2safe'] ) {
|
87
|
-
$val = $this->hex2safe( $val );
|
88
|
-
}
|
89
|
-
|
90
|
-
return $val;
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Converts rgb values to hex codes
|
95
|
-
*
|
96
|
-
* @param (string) val: Color to be converted
|
97
|
-
*/
|
98
|
-
private function rgb2hex( $val ) {
|
99
|
-
if ( ! preg_match( $this->rrgb, $val, $match ) ) {
|
100
|
-
return $val;
|
101
|
-
}
|
102
|
-
|
103
|
-
// locals
|
104
|
-
$hex = '0123456789abcdef';
|
105
|
-
$str = explode( ',', $match[ 1 ] );
|
106
|
-
$new = '';
|
107
|
-
|
108
|
-
// Incase rgb was defined with single val
|
109
|
-
if ( ! $str ) {
|
110
|
-
$str = array( $match[ 1 ] );
|
111
|
-
}
|
112
|
-
|
113
|
-
foreach ( $str as $x ) {
|
114
|
-
$x = strpos( $x, '%' ) !== false ? intval( ( intval( $x ) / 100 ) * 255 ) : intval( $x );
|
115
|
-
|
116
|
-
if ( $x > 255 ) {
|
117
|
-
$x = 255;
|
118
|
-
}
|
119
|
-
|
120
|
-
if ( $x < 0 ) {
|
121
|
-
$x = 0;
|
122
|
-
}
|
123
|
-
|
124
|
-
$new .= $hex[ ( $x - $x % 16 ) / 16 ];
|
125
|
-
$new .= $hex[ $x % 16 ];
|
126
|
-
}
|
127
|
-
|
128
|
-
// Repeat hex code to complete 6 digit hex requirement for single definitions
|
129
|
-
if ( count( $str ) == 1 ) {
|
130
|
-
$new .= $new . $new;
|
131
|
-
}
|
132
|
-
|
133
|
-
// Replace with hex value
|
134
|
-
return "#$new";
|
135
|
-
}
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Convert long color names to hex codes
|
139
|
-
*
|
140
|
-
* @param (string) val: Color to be converted
|
141
|
-
*/
|
142
|
-
private function color2hex( $val ) {
|
143
|
-
return isset( self::$color2hex[ $val ] ) ? self::$color2hex[ $val ] : $val;
|
144
|
-
}
|
145
|
-
|
146
|
-
/**
|
147
|
-
* Convert large hex codes to small codes
|
148
|
-
*
|
149
|
-
* @param (string) val: Hex to be shortened
|
150
|
-
*/
|
151
|
-
private function hex2short( $val ) {
|
152
|
-
if ( ! preg_match( $this->rfullhex, $val, $match ) ) {
|
153
|
-
return $val;
|
154
|
-
}
|
155
|
-
|
156
|
-
// See if we can convert to 3 char hex
|
157
|
-
$hex = $match[ 1 ];
|
158
|
-
if ( $hex[ 0 ] == $hex[ 1 ] && $hex[ 2 ] == $hex[ 3 ] && $hex[ 4 ] == $hex[ 5 ] ) {
|
159
|
-
$val = '#' . $hex[ 0 ] . $hex[ 2 ] . $hex[ 4 ];
|
160
|
-
}
|
161
|
-
|
162
|
-
return $val;
|
163
|
-
}
|
164
|
-
|
165
|
-
/**
|
166
|
-
* Convert large hex codes to small codes
|
167
|
-
*
|
168
|
-
* @param (string) val: Color to be converted
|
169
|
-
*/
|
170
|
-
private function hex2color( $val ) {
|
171
|
-
return isset( self::$hex2short[ $val ] ) ? self::$hex2short[ $val ] : $val;
|
172
|
-
}
|
173
|
-
|
174
|
-
/**
|
175
|
-
* Convert large hex codes to small codes
|
176
|
-
*
|
177
|
-
* @param (string) val: Color to be converted
|
178
|
-
*/
|
179
|
-
private function hex2safe( $val ) {
|
180
|
-
return isset( self::$hex2short_safe[ $val ] ) ? self::$hex2short_safe[ $val ] : $val;
|
181
|
-
}
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Access to private methods for testing
|
185
|
-
*
|
186
|
-
* @param (string) method: Method to be called
|
187
|
-
* @param (array) args: Array of paramters to be passed in
|
188
|
-
*/
|
189
|
-
public function access( $method, $args ) {
|
190
|
-
if ( method_exists( $this, $method ) ) {
|
191
|
-
return call_user_func_array( array( $this, $method ), $args );
|
192
|
-
}
|
193
|
-
else {
|
194
|
-
throw new CSSCompression_Exception( "Unknown method in Color Class - " . $method );
|
195
|
-
}
|
196
|
-
}
|
197
|
-
};
|
198
|
-
|
199
|
-
?>
|
@@ -1,109 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
/**
|
3
|
-
* CSS Compressor [VERSION]
|
4
|
-
* [DATE]
|
5
|
-
* Corey Hart @ http://www.codenothing.com
|
6
|
-
*/
|
7
|
-
|
8
|
-
Class CSSCompression_Combine_Aural
|
9
|
-
{
|
10
|
-
/**
|
11
|
-
* Combine Patterns
|
12
|
-
*
|
13
|
-
* @class Control: Compression Controller
|
14
|
-
* @class Combine: Combine Controller
|
15
|
-
* @param (regex) raural: Aurual matching
|
16
|
-
*/
|
17
|
-
private $Control;
|
18
|
-
private $Combine;
|
19
|
-
private $raural = "/(^|(?<!\\\);)(cue|pause)-(before|after):(.*?)((?<!\\\);|$)/";
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Stash a reference to the controller & combiner
|
23
|
-
*
|
24
|
-
* @param (class) control: CSSCompression Controller
|
25
|
-
* @param (class) combine: CSSCompression Combiner
|
26
|
-
*/
|
27
|
-
public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
|
28
|
-
$this->Control = $control;
|
29
|
-
$this->Combine = $combine;
|
30
|
-
}
|
31
|
-
|
32
|
-
/**
|
33
|
-
* Combines Aural properties (currently being depreciated in W3C Standards)
|
34
|
-
*
|
35
|
-
* @param (string) val: Rule Set
|
36
|
-
*/
|
37
|
-
public function combine( $val ) {
|
38
|
-
$storage = $this->storage( $val );
|
39
|
-
$pos = 0;
|
40
|
-
|
41
|
-
// Replace first occurance with it's prop, and remove all following occurances
|
42
|
-
while ( preg_match( $this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
43
|
-
$prop = $match[ 2 ][ 0 ];
|
44
|
-
if ( isset( $storage[ $prop ] ) ) {
|
45
|
-
$colon = strlen( $match[ 1 ][ 0 ] );
|
46
|
-
$val = substr_replace( $val, $storage[ $prop ], $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
|
47
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $storage[ $prop ] ) - $colon - 1;
|
48
|
-
$storage[ $prop ] = '';
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
// Return converted val
|
56
|
-
return $val;
|
57
|
-
}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Builds a storage object for iteration
|
61
|
-
*
|
62
|
-
* @param (string) val: Rule Set
|
63
|
-
*/
|
64
|
-
private function storage( $val ) {
|
65
|
-
$storage = array();
|
66
|
-
|
67
|
-
// Find all possible occurences and build the replacement
|
68
|
-
$pos = 0;
|
69
|
-
while ( preg_match( $this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
|
70
|
-
if ( ! isset( $storage[ $match[ 2 ][ 0 ] ] ) ) {
|
71
|
-
$storage[ $match[ 2 ][ 0 ] ] = array( $match[ 3 ][ 0 ] => $match[ 4 ][ 0 ] );
|
72
|
-
}
|
73
|
-
|
74
|
-
// Override double written properties
|
75
|
-
$storage[ $match[ 2 ][ 0 ] ][ $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
|
76
|
-
$pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
|
77
|
-
}
|
78
|
-
|
79
|
-
// Go through each tag for possible combination
|
80
|
-
foreach ( $storage as $tag => $arr ) {
|
81
|
-
// All three have to be defined
|
82
|
-
if ( count( $arr ) == 2 && ! $this->Combine->checkUncombinables( $arr ) ) {
|
83
|
-
$storage[ $tag ] = "$tag:" . $arr['before'] . ' ' . $arr['after'] . ';';
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
unset( $storage[ $tag ] );
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
return $storage;
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Access to private methods for testing
|
95
|
-
*
|
96
|
-
* @param (string) method: Method to be called
|
97
|
-
* @param (array) args: Array of paramters to be passed in
|
98
|
-
*/
|
99
|
-
public function access( $method, $args ) {
|
100
|
-
if ( method_exists( $this, $method ) ) {
|
101
|
-
return call_user_func_array( array( $this, $method ), $args );
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
throw new CSSCompression_Exception( "Unknown method in Aural Class - " . $method );
|
105
|
-
}
|
106
|
-
}
|
107
|
-
};
|
108
|
-
|
109
|
-
?>
|