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.
Files changed (70) hide show
  1. data/README.md +11 -113
  2. data/stylesheets/html5-boilerplate/_fonts.scss +4 -4
  3. data/stylesheets/html5-boilerplate/_handheld.scss +3 -3
  4. data/stylesheets/html5-boilerplate/_helpers.scss +14 -7
  5. data/stylesheets/html5-boilerplate/_print.scss +2 -2
  6. data/stylesheets/html5-boilerplate/_reset.scss +8 -8
  7. data/stylesheets/html5-boilerplate/_styles.scss +16 -31
  8. data/templates/project/files/404.html +37 -21
  9. data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
  10. data/templates/project/files/apple-touch-icon-57x57-precomposed.png +0 -0
  11. data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
  12. data/templates/project/files/apple-touch-icon-precomposed.png +0 -0
  13. data/templates/project/files/apple-touch-icon.png +0 -0
  14. data/templates/project/files/build/build.xml +813 -628
  15. data/templates/project/files/build/config/buildinfo.properties +5 -0
  16. data/templates/project/files/build/config/default.properties +22 -21
  17. data/templates/project/files/build/config/project.properties +9 -8
  18. data/templates/project/files/build/createproject.sh +29 -52
  19. data/templates/project/files/build/runbuildscript.bat +5 -0
  20. data/templates/project/files/build/tools/htmlcompressor-1.1.jar +0 -0
  21. data/templates/project/files/build/tools/{yuicompressor-2.4.2.jar → yuicompressor-2.4.5.jar} +0 -0
  22. data/templates/project/files/gitignore.txt +6 -0
  23. data/templates/project/files/htaccess +71 -8
  24. data/templates/project/index.html +30 -31
  25. data/templates/project/javascripts/libs/dd_belatedpng.js +1 -1
  26. data/templates/project/javascripts/libs/{jquery-1.5.0.js → jquery-1.5.1.js} +549 -409
  27. data/templates/project/javascripts/libs/jquery-1.5.1.min.js +16 -0
  28. data/templates/project/javascripts/libs/modernizr-1.7.min.js +2 -0
  29. data/templates/project/javascripts/plugins.js +3 -1
  30. data/templates/project/manifest.rb +22 -59
  31. data/templates/project/style.scss +17 -0
  32. metadata +15 -44
  33. data/templates/project/files/build/config/build.properties +0 -3
  34. data/templates/project/files/build/tools/css-compressor/CSSCompression.php +0 -465
  35. data/templates/project/files/build/tools/css-compressor/changelog.txt +0 -22
  36. data/templates/project/files/build/tools/css-compressor/cli.php +0 -101
  37. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-colors.json +0 -39
  38. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-safe.json +0 -16
  39. data/templates/project/files/build/tools/css-compressor/helpers/long2hex-colors.json +0 -127
  40. data/templates/project/files/build/tools/css-compressor/lib/Cleanup.php +0 -218
  41. data/templates/project/files/build/tools/css-compressor/lib/Color.php +0 -199
  42. data/templates/project/files/build/tools/css-compressor/lib/Combine/Aural.php +0 -109
  43. data/templates/project/files/build/tools/css-compressor/lib/Combine/Background.php +0 -107
  44. data/templates/project/files/build/tools/css-compressor/lib/Combine/Border.php +0 -98
  45. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderOutline.php +0 -109
  46. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderRadius.php +0 -262
  47. data/templates/project/files/build/tools/css-compressor/lib/Combine/Font.php +0 -125
  48. data/templates/project/files/build/tools/css-compressor/lib/Combine/List.php +0 -104
  49. data/templates/project/files/build/tools/css-compressor/lib/Combine/MarginPadding.php +0 -190
  50. data/templates/project/files/build/tools/css-compressor/lib/Combine.php +0 -191
  51. data/templates/project/files/build/tools/css-compressor/lib/Compress.php +0 -212
  52. data/templates/project/files/build/tools/css-compressor/lib/Control.php +0 -236
  53. data/templates/project/files/build/tools/css-compressor/lib/Exception.php +0 -32
  54. data/templates/project/files/build/tools/css-compressor/lib/Format.php +0 -187
  55. data/templates/project/files/build/tools/css-compressor/lib/Individuals.php +0 -307
  56. data/templates/project/files/build/tools/css-compressor/lib/Numeric.php +0 -103
  57. data/templates/project/files/build/tools/css-compressor/lib/Option.php +0 -133
  58. data/templates/project/files/build/tools/css-compressor/lib/Organize.php +0 -149
  59. data/templates/project/files/build/tools/css-compressor/lib/Selectors.php +0 -245
  60. data/templates/project/files/build/tools/css-compressor/lib/Setup.php +0 -292
  61. data/templates/project/files/build/tools/css-compressor/lib/Trim.php +0 -213
  62. data/templates/project/files/build/tools/css-compressor/license.txt +0 -21
  63. data/templates/project/files/build/tools/htmlcompressor-0.9.8.jar +0 -0
  64. data/templates/project/files/google.yml +0 -22
  65. data/templates/project/files/lighttpd.conf +0 -149
  66. data/templates/project/files/mime.types +0 -80
  67. data/templates/project/files/nginx.conf +0 -108
  68. data/templates/project/files/web.config +0 -207
  69. data/templates/project/javascripts/libs/jquery-1.5.0.min.js +0 -16
  70. data/templates/project/javascripts/libs/modernizr-1.6.min.js +0 -30
@@ -1,307 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Individuals
9
- {
10
- /**
11
- * Individual patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Numeric: Numeric handler
15
- * @class Color: Color Handler
16
- * @param (array) options: Reference to options
17
- * @param (regex) rdirectional: Properties that may have multiple directions
18
- * @param (regex) rborderradius: Checks property for border-radius declaration
19
- * @param (regex) rnoneprop: Properties that can have none as their value(will be converted to 0)
20
- * @param (regex) rclip: Looks for rect grouping in clip declaration
21
- * @param (regex) rsplitter: Checks font properties for font-size/line-height split
22
- * @param (regex) rfilter: Special alpha filter for msie
23
- * @param (regex) rspace: Checks for unescaped space
24
- * @param (regex) rspace: Checks for unescaped slash
25
- * @param (array) weights: Array of font-weight name conversions to their numeric counterpart
26
- */
27
- private $Control;
28
- private $Numeric;
29
- private $Color;
30
- private $options = array();
31
- private $rdirectional = "/^(margin|padding|border-spacing)$/";
32
- private $rborderradius = "/border[a-z-]*radius/";
33
- private $rradiusfull = "/^(-moz-|-webkit-)?border-radius$/";
34
- private $rnoneprop = "/^(border|background|border-(top|right|bottom|left))$/";
35
- private $rclip = "/^rect\(\s*(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)(,|\s)(\-?\d*\.?\d*?\w*)\s*\)$/";
36
- private $rsplitter = "/(^|(?<!\\\)\s)([^\/ ]+)\/([^\/ ]+)((?<!\\\)\s|$)/";
37
- private $rfilter = "/[\"']?PROGID\\\?:DXImageTransform\\\?.Microsoft\\\?.Alpha\(Opacity\\\?=(\d+\\\?\.?\d*)\)[\"']?/i";
38
- private $rspace = "/(?<!\\\)\s/";
39
- private $rslash = "/(?<!\\\)\//";
40
- private $weights = array(
41
- "normal" => 400,
42
- "bold" => 700,
43
- );
44
-
45
- /**
46
- * Stash a reference to the controller on each instantiation
47
- *
48
- * @param (class) control: CSSCompression Controller
49
- */
50
- public function __construct( CSSCompression_Control $control ) {
51
- $this->Control = $control;
52
- $this->Numeric = $control->Numeric;
53
- $this->Color = $control->Color;
54
- $this->options = &$control->Option->options;
55
- }
56
-
57
- /**
58
- * Runs special unit/directional compressions
59
- *
60
- * @param (string) prop: CSS Property
61
- * @param (string) val: Value of CSS Property
62
- */
63
- public function individuals( $prop, $val ) {
64
- // Properties should always be lowercase
65
- $prop = strtolower( $prop );
66
-
67
- // Split up each definiton for color and numeric compressions
68
- $parts = preg_split( $this->rspace, $val );
69
- foreach ( $parts as &$v ) {
70
- if ( ! $v || $v == '' ) {
71
- continue;
72
- }
73
-
74
- // Remove uneeded decimals/units
75
- if ( $this->options['format-units'] ) {
76
- $v = $this->Numeric->numeric( $v );
77
- }
78
-
79
- // Color compression
80
- $v = $this->Color->color( $v );
81
- }
82
- $val = trim( implode( ' ', $parts ) );
83
-
84
- // Special border radius handling
85
- if ( preg_match( $this->rborderradius, $prop ) ) {
86
- $val = $this->borderRadius( $prop, $val );
87
- }
88
- // Remove uneeded side definitions if possible
89
- else if ( $this->options['directional-compress'] && count( $parts ) > 1 && preg_match( $this->rdirectional, $prop ) ) {
90
- $val = $this->directionals( strtolower( $val ) );
91
- }
92
-
93
- // Font-weight converter
94
- if ( $this->options['fontweight2num'] && ( $prop == 'font-weight' || $prop == 'font' ) ) {
95
- $val = $this->fontweight( $val );
96
- }
97
-
98
- // Special font value conversions
99
- if ( $prop == 'font' ) {
100
- $val = $this->font( $val );
101
- }
102
-
103
- // Special clip value compressions
104
- if ( $prop == 'clip' ) {
105
- $val = $this->clip( $val );
106
- }
107
-
108
- // None to 0 converter
109
- $val = $this->none( $prop, $val );
110
-
111
- // MSIE Filters
112
- $val = $this->filter( $prop, $val );
113
-
114
- // Return for list retrival
115
- return array( $prop, $val );
116
- }
117
-
118
- /**
119
- * Preps border radius for directional compression
120
- *
121
- * @param (string) prop: Property Declaration
122
- * @param (string) val: Declaration Value
123
- */
124
- private function borderRadius( $prop, $val ) {
125
- if ( preg_match( $this->rslash, $val ) ) {
126
- $parts = preg_split( $this->rslash, $val, 2 );
127
- // We have to redo numeric compression because the slash may hav intruded
128
- foreach ( $parts as &$row ) {
129
- $p = preg_split( $this->rspace, $row );
130
- foreach ( $p as &$v ) {
131
- if ( ! $v || $v == '' ) {
132
- continue;
133
- }
134
-
135
- // Remove uneeded decimals/units
136
- if ( $this->options['format-units'] ) {
137
- $v = $this->Numeric->numeric( $v );
138
- }
139
- }
140
- $row = implode( ' ', $p );
141
- if ( $this->options['directional-compress'] ) {
142
- $row = $this->directionals( strtolower( $row ) );
143
- }
144
- }
145
- $val = implode( '/', $parts );
146
- }
147
- else if ( $this->options['directional-compress'] && preg_match( $this->rradiusfull, $prop ) ) {
148
- $val = $this->directionals( strtolower( $val ) );
149
- }
150
-
151
- return $val;
152
- }
153
-
154
- /**
155
- * Finds directional compression on methods like margin/padding
156
- *
157
- * @param (string) val: Value of CSS Property
158
- */
159
- private function directionals( $val ) {
160
- // Split up each definiton
161
- $direction = preg_split( $this->rspace, $val );
162
-
163
- // 4 Direction reduction
164
- $count = count( $direction );
165
- if ( $count == 4 ) {
166
- // All 4 sides are the same, combine into 1 definition
167
- if ( $direction[ 0 ] == $direction[ 1 ] && $direction[ 2 ] == $direction[ 3 ] && $direction[ 0 ] == $direction[ 3 ] ) {
168
- $direction = array( $direction[ 0 ] );
169
- }
170
- // top-bottom/left-right are the same, reduce definition
171
- else if ( $direction[ 0 ] == $direction[ 2 ] && $direction[ 1 ] == $direction[ 3 ] ) {
172
- $direction = array( $direction[ 0 ], $direction[ 1 ] );
173
- }
174
- // Only left-right are the same
175
- else if ( $direction[ 1 ] == $direction[ 3 ] ) {
176
- $direction = array( $direction[ 0 ], $direction[ 1 ], $direction[ 2 ] );
177
- }
178
- }
179
- // 3 Direction reduction
180
- else if ( $count == 3 ) {
181
- // All directions are the same
182
- if ( $direction[ 0 ] == $direction[ 1 ] && $direction[ 1 ] == $direction[ 2 ] ) {
183
- $direction = array( $direction[ 0 ] );
184
- }
185
- // Only top(first) and bottom(last) are the same
186
- else if ( $direction[ 0 ] == $direction[ 2 ] ) {
187
- $direction = array( $direction[ 0 ], $direction[ 1 ] );
188
- }
189
- }
190
- // 2 Direction reduction
191
- // Both directions are the same, combine into single definition
192
- else if ( $count == 2 && $direction[ 0 ] == $direction[ 1 ] ) {
193
- $direction = array( $direction[ 0 ] );
194
- }
195
-
196
- // Return the combined version of the directions
197
- // Single entries will just return
198
- return implode( ' ', $direction );
199
- }
200
-
201
- /**
202
- * Converts font-weight names to numbers
203
- *
204
- * @param (string) val: font-weight prop value
205
- */
206
- private function fontweight( $val ) {
207
- if ( preg_match( $this->rspace, $val ) ) {
208
- $parts = preg_split( $this->rspace, $val );
209
- foreach ( $parts as &$item ) {
210
- $lower = strtolower( $item );
211
- if ( isset( $this->weights[ $lower ] ) && $lower != 'normal' ) {
212
- $item = $this->weights[ $lower ];
213
- }
214
- }
215
- $val = implode( ' ', $parts );
216
- }
217
- else if ( isset( $this->weights[ strtolower( $val ) ] ) ) {
218
- $val = $this->weights[ strtolower( $val ) ];
219
- }
220
-
221
- return $val;
222
- }
223
-
224
- /**
225
- * Special font conversions
226
- *
227
- * @param (string) val: property value
228
- */
229
- private function font( $val ) {
230
- // Split out the font-size/line-height split and run through numerical handlers
231
- if ( preg_match( $this->rsplitter, $val, $match, PREG_OFFSET_CAPTURE ) ) {
232
- $size = $this->Numeric->numeric( $match[ 2 ][ 0 ] );
233
- $height = $this->Numeric->numeric( $match[ 3 ][ 0 ] );
234
- $concat = $match[ 1 ][ 0 ] . $size . '/' . $height . $match[ 4 ][ 0 ];
235
- $val = substr_replace( $val, $concat, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
236
- }
237
-
238
- return $val;
239
- }
240
-
241
- /**
242
- * Special clip conversions
243
- *
244
- * @param (string) val: property value
245
- */
246
- private function clip( $val ) {
247
- if ( preg_match( $this->rclip, $val, $match ) ) {
248
- $positions = array( 1, 3, 5, 7 );
249
- $clean = 'rect(';
250
- foreach ( $positions as $pos ) {
251
- if ( ! isset( $match[ $pos ] ) ) {
252
- return $val;
253
- }
254
-
255
- $clean .= $this->Numeric->numeric( $match[ $pos ] ) . ( isset( $match[ $pos + 1 ] ) ? $match[ $pos + 1 ] : '' );
256
- }
257
- $val = $clean . ')';
258
- }
259
-
260
- return $val;
261
- }
262
-
263
- /**
264
- * Convert none vals to 0
265
- *
266
- * @param (string) prop: Current Property
267
- * @param (string) val: property value
268
- */
269
- private function none( $prop, $val ) {
270
- if ( preg_match( $this->rnoneprop, $prop ) && $val == 'none' ) {
271
- $val = '0';
272
- }
273
-
274
- return $val;
275
- }
276
-
277
- /**
278
- * MSIE Filter Conversion
279
- *
280
- * @param (string) prop: Current Property
281
- * @param (string) val: property value
282
- */
283
- private function filter( $prop, $val ) {
284
- if ( preg_match( "/filter/", $prop ) ) {
285
- $val = preg_replace( $this->rfilter, "alpha(opacity=$1)", $val );
286
- }
287
-
288
- return $val;
289
- }
290
-
291
- /**
292
- * Access to private methods for testing
293
- *
294
- * @param (string) method: Method to be called
295
- * @param (array) args: Array of paramters to be passed in
296
- */
297
- public function access( $method, $args ) {
298
- if ( method_exists( $this, $method ) ) {
299
- return call_user_func_array( array( $this, $method ), $args );
300
- }
301
- else {
302
- throw new CSSCompression_Exception( "Unknown method in Individuals Class - " . $method );
303
- }
304
- }
305
- };
306
-
307
- ?>
@@ -1,103 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Numeric
9
- {
10
- /**
11
- * Numeric Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @param (array) options: Reference to options
15
- * @param (regex) rdecimal: Checks for zero decimal
16
- * @param (regex) rzero: Checks for preceding 0 to decimal unit
17
- * @param (regex) runit: Checks for suffix on 0 unit
18
- */
19
- private $Control;
20
- private $options = array();
21
- private $rdecimal = "/^(\+|\-)?(\d*\.[1-9]*0*)(\%|[a-z]{2})$/i";
22
- private $rzero = "/^(\+|\-)?0(\.\d+)(\%|[a-z]{2})?$/i";
23
- private $runit = "/^0(\%|[a-z]{2})$/i";
24
-
25
- /**
26
- * Stash a reference to the controller on each instantiation
27
- *
28
- * @param (class) control: CSSCompression Controller
29
- */
30
- public function __construct( CSSCompression_Control $control ) {
31
- $this->Control = $control;
32
- $this->options = &$control->Option->options;
33
- }
34
-
35
- /**
36
- * Runs all numeric operations
37
- *
38
- * @param (string) str: Unit string
39
- */
40
- public function numeric( $str ) {
41
- $str = $this->decimal( $str );
42
- $str = $this->zeroes( $str );
43
- $str = $this->units( $str );
44
- return $str;
45
- }
46
-
47
- /**
48
- * Remove's unecessary decimal, ie 13.0px => 13px
49
- *
50
- * @param (string) str: Unit string
51
- */
52
- private function decimal( $str ) {
53
- if ( preg_match( $this->rdecimal, $str, $match ) ) {
54
- $str = ( $match[ 1 ] == '-' ? '-' : '' ) . floatval( $match[ 2 ] ) . $match[ 3 ];
55
- }
56
-
57
- return $str;
58
- }
59
-
60
- /**
61
- * Removes suffix from 0 unit, ie 0px; => 0;
62
- *
63
- * @param (string) str: Unit string
64
- */
65
- private function units( $str ) {
66
- if ( preg_match( $this->runit, $str, $match ) ) {
67
- $str = '0';
68
- }
69
-
70
- return $str;
71
- }
72
-
73
-
74
- /**
75
- * Removes leading zero in decimal, ie 0.33px => .33px
76
- *
77
- * @param (string) str: Unit string
78
- */
79
- private function zeroes( $str ) {
80
- if ( preg_match( $this->rzero, $str, $match ) ) {
81
- $str = ( isset( $match[ 1 ] ) && $match[ 1 ] == '-' ? '-' : '' ) . $match[ 2 ] . ( isset( $match[ 3 ] ) ? $match[ 3 ] : '' );
82
- }
83
-
84
- return $str;
85
- }
86
-
87
- /**
88
- * Access to private methods for testing
89
- *
90
- * @param (string) method: Method to be called
91
- * @param (array) args: Array of paramters to be passed in
92
- */
93
- public function access( $method, $args ) {
94
- if ( method_exists( $this, $method ) ) {
95
- return call_user_func_array( array( $this, $method ), $args );
96
- }
97
- else {
98
- throw new CSSCompression_Exception( "Unknown method in Numeric Class - " . $method );
99
- }
100
- }
101
- };
102
-
103
- ?>
@@ -1,133 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Option
9
- {
10
- /**
11
- * Option Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @param (string) custom: Name of the custom mode
15
- * @param (array) options: Instance settings
16
- */
17
- private $Control;
18
- private $custom = '__custom';
19
- public $options = array();
20
-
21
- /**
22
- * Stash a reference to the controller on each instantiation
23
- *
24
- * @param (class) control: CSSCompression Controller
25
- */
26
- public function __construct( CSSCompression_Control $control ) {
27
- $this->Control = $control;
28
- $this->options = CSSCompression::$defaults;
29
- $control->mode = $this->custom;
30
- }
31
-
32
- /**
33
- * Maintainable access to the options array
34
- *
35
- * - Passing no arguments returns the entire options array
36
- * - Passing a single name argument returns the value for the option
37
- * - Passing both a name and value, sets the value to the name key, and returns the value
38
- * - Passing an array will merge the options with the array passed, for object like extension
39
- *
40
- * @param (mixed) name: The key name of the option
41
- * @param (mixed) value: Value to set the option
42
- */
43
- public function option( $name = NULL, $value = NULL ) {
44
- if ( $name === NULL ) {
45
- return $this->options;
46
- }
47
- else if ( is_array( $name ) ) {
48
- return $this->merge( $name );
49
- }
50
- else if ( $value === NULL ) {
51
- return isset( $this->options[ $name ] ) ? $this->options[ $name ] : NULL;
52
- }
53
- else {
54
- // Readability doesn't signify custom settings
55
- if ( $name != 'readability' ) {
56
- $this->Control->mode = $this->custom;
57
- }
58
-
59
- return ( $this->options[ $name ] = $value );
60
- }
61
- }
62
-
63
- /**
64
- * Reset's the default options
65
- *
66
- * @params none;
67
- */
68
- public function reset(){
69
- // Reset and return the new options
70
- return $this->options = CSSCompression::$defaults;
71
- }
72
-
73
- /**
74
- * Extend like function to merge an array of preferences into
75
- * the options array.
76
- *
77
- * @param (mixed) options: Array of preferences to merge into options
78
- */
79
- public function merge( $options = array() ) {
80
- $modes = CSSCompression::modes();
81
- if ( $options && is_array( $options ) && count( $options ) ) {
82
- $this->Control->mode = $this->custom;
83
- foreach ( $this->options as $key => $value ) {
84
- if ( ! isset( $options[ $key ] ) ) {
85
- continue;
86
- }
87
- else if ( strtolower( $options[ $key ] ) == 'on' ) {
88
- $this->options[ $key ] = true;
89
- }
90
- else if ( strtolower( $options[ $key ] ) == 'off' ) {
91
- $this->options[ $key ] = false;
92
- }
93
- else {
94
- $this->options[ $key ] = intval( $options[ $key ] );
95
- }
96
- }
97
- }
98
- else if ( $options && is_string( $options ) && array_key_exists( $options, $modes ) ) {
99
- $this->Control->mode = $options;
100
-
101
- // Default all to true, the mode has to force false
102
- foreach ( $this->options as $key => $value ) {
103
- if ( $key != 'readability' ) {
104
- $this->options[ $key ] = true;
105
- }
106
- }
107
-
108
- // Merge mode into options
109
- foreach ( $modes[ $options ] as $key => $value ) {
110
- $this->options[ $key ] = $value;
111
- }
112
- }
113
-
114
- return $this->options;
115
- }
116
-
117
- /**
118
- * Access to private methods for testing
119
- *
120
- * @param (string) method: Method to be called
121
- * @param (array) args: Array of paramters to be passed in
122
- */
123
- public function access( $method, $args ) {
124
- if ( method_exists( $this, $method ) ) {
125
- return call_user_func_array( array( $this, $method ), $args );
126
- }
127
- else {
128
- throw new CSSCompression_Exception( "Unknown method in Option Class - " . $method );
129
- }
130
- }
131
- };
132
-
133
- ?>
@@ -1,149 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Organize
9
- {
10
- /**
11
- * Organize Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @param (array) options: Reference to options
15
- * @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
16
- * @param (regex) rlastsemi: Checks for semicolon at the end of the string
17
- */
18
- private $Control;
19
- private $options = array();
20
- private $rsemicolon = "/(?<!\\\);/";
21
- private $rlastsemi = "/(?<!\\\);$/";
22
-
23
- /**
24
- * Stash a reference to the controller on each instantiation
25
- *
26
- * @param (class) control: CSSCompression Controller
27
- */
28
- public function __construct( CSSCompression_Control $control ) {
29
- $this->Control = $control;
30
- $this->options = &$control->Option->options;
31
- }
32
-
33
- /**
34
- * Look to see if we can combine selectors to reduce the number
35
- * of definitions.
36
- *
37
- * @param (array) selectors: Array of selectors, map directly to details
38
- * @param (array) details: Array of rule sets, map directly to selectors
39
- */
40
- public function organize( &$selectors = array(), &$details = array() ) {
41
- // Combining defns based on similar selectors
42
- list ( $selectors, $details ) = $this->reduceSelectors( $selectors, $details );
43
-
44
- // Combining defns based on similar details
45
- list ( $selectors, $details ) = $this->reduceDetails( $selectors, $details );
46
-
47
- // Return in package form
48
- return array( $selectors, $details );
49
- }
50
-
51
- /**
52
- * Combines multiply defined selectors by merging the rule sets,
53
- * latter declarations overide declaratins at top of file
54
- *
55
- * @param (array) selectors: Array of selectors broken down by setup
56
- * @param (array) details: Array of rule sets broken down by setup
57
- */
58
- private function reduceSelectors( $selectors, $details ) {
59
- $keys = array_keys( $selectors );
60
- $max = array_pop( $keys ) + 1;
61
-
62
- for ( $i = 0; $i < $max; $i++ ) {
63
- if ( ! isset( $selectors[ $i ] ) ) {
64
- continue;
65
- }
66
-
67
- for ( $k = $i + 1; $k < $max; $k++ ) {
68
- if ( ! isset( $selectors[ $k ] ) ) {
69
- continue;
70
- }
71
-
72
- if ( $selectors[ $i ] == $selectors[ $k ] ) {
73
- // Prevent noticies
74
- if ( ! isset( $details[ $i ] ) ) {
75
- $details[ $i ] = '';
76
- }
77
- if ( ! isset( $details[ $k ] ) ) {
78
- $details[ $k ] = '';
79
- }
80
-
81
- // We kill the last semicolon before organization, so account for that.
82
- if ( $details[ $i ] != '' && $details[ $k ] != '' && ! preg_match( $this->rlastsemi, $details[ $i ] ) ) {
83
- $details[ $i ] .= ';' . $details[ $k ];
84
- }
85
- else {
86
- $details[ $i ] .= $details[ $k ];
87
- }
88
-
89
- // Remove the second part
90
- unset( $selectors[ $k ], $details[ $k ] );
91
- }
92
- }
93
- }
94
-
95
- return array( $selectors, $details );
96
- }
97
-
98
- /**
99
- * Combines multiply defined rule sets by merging the selectors
100
- * in comma seperated format
101
- *
102
- * @param (array) selectors: Array of selectors broken down by setup
103
- * @param (array) details: Array of rule sets broken down by setup
104
- */
105
- private function reduceDetails( $selectors, $details ) {
106
- $keys = array_keys( $selectors );
107
- $max = array_pop( $keys ) + 1;
108
- for ( $i = 0; $i < $max; $i++ ) {
109
- if ( ! isset( $selectors[ $i ] ) ) {
110
- continue;
111
- }
112
-
113
- $arr = preg_split( $this->rsemicolon, isset( $details[ $i ] ) ? $details[ $i ] : '' );
114
- for ( $k = $i + 1; $k < $max; $k++ ) {
115
- if ( ! isset( $selectors[ $k ] ) ) {
116
- continue;
117
- }
118
-
119
- $match = preg_split( $this->rsemicolon, isset( $details[ $k ] ) ? $details[ $k ] : '' );
120
- $x = array_diff( $arr, $match );
121
- $y = array_diff( $match, $arr );
122
-
123
- if ( count( $x ) < 1 && count( $y ) < 1 ) {
124
- $selectors[ $i ] .= ',' . $selectors[ $k ];
125
- unset( $details[ $k ], $selectors[ $k ] );
126
- }
127
- }
128
- }
129
-
130
- return array( $selectors, $details );
131
- }
132
-
133
- /**
134
- * Access to private methods for testing
135
- *
136
- * @param (string) method: Method to be called
137
- * @param (array) args: Array of paramters to be passed in
138
- */
139
- public function access( $method, $args ) {
140
- if ( method_exists( $this, $method ) ) {
141
- return call_user_func_array( array( $this, $method ), $args );
142
- }
143
- else {
144
- throw new CSSCompression_Exception( "Unknown method in Organize Class - " . $method );
145
- }
146
- }
147
- };
148
-
149
- ?>