html5-starter 0.1.3b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/LICENSE +3 -0
  2. data/README.md +135 -0
  3. data/VERSION +1 -0
  4. data/lib/app/helpers/html5_boilerplate_helper.rb +47 -0
  5. data/lib/html5-boilerplate.rb +6 -0
  6. data/stylesheets/_html5-boilerplate.scss +15 -0
  7. data/stylesheets/html5-boilerplate/_fonts.scss +36 -0
  8. data/stylesheets/html5-boilerplate/_handheld.scss +8 -0
  9. data/stylesheets/html5-boilerplate/_helpers.scss +25 -0
  10. data/stylesheets/html5-boilerplate/_print.scss +20 -0
  11. data/stylesheets/html5-boilerplate/_reset.scss +50 -0
  12. data/stylesheets/html5-boilerplate/_styles.scss +100 -0
  13. data/templates/project/_flashes.html.haml +4 -0
  14. data/templates/project/_footer.html.haml +2 -0
  15. data/templates/project/_head.html.haml +32 -0
  16. data/templates/project/_header.html.haml +1 -0
  17. data/templates/project/_javascripts.html.haml +38 -0
  18. data/templates/project/_stylesheets.html.haml +8 -0
  19. data/templates/project/application.html.haml +15 -0
  20. data/templates/project/files/404.html +22 -0
  21. data/templates/project/files/apple-touch-icon.png +0 -0
  22. data/templates/project/files/build/build.xml +636 -0
  23. data/templates/project/files/build/buildinfo.properties +5 -0
  24. data/templates/project/files/build/config/build.properties +3 -0
  25. data/templates/project/files/build/config/default.properties +79 -0
  26. data/templates/project/files/build/config/project.properties +49 -0
  27. data/templates/project/files/build/createproject.sh +73 -0
  28. data/templates/project/files/build/tools/ant-contrib-1.0b3.jar +0 -0
  29. data/templates/project/files/build/tools/css-compressor/CSSCompression.php +465 -0
  30. data/templates/project/files/build/tools/css-compressor/changelog.txt +22 -0
  31. data/templates/project/files/build/tools/css-compressor/cli.php +101 -0
  32. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-colors.json +39 -0
  33. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-safe.json +16 -0
  34. data/templates/project/files/build/tools/css-compressor/helpers/long2hex-colors.json +127 -0
  35. data/templates/project/files/build/tools/css-compressor/lib/Cleanup.php +218 -0
  36. data/templates/project/files/build/tools/css-compressor/lib/Color.php +199 -0
  37. data/templates/project/files/build/tools/css-compressor/lib/Combine.php +191 -0
  38. data/templates/project/files/build/tools/css-compressor/lib/Combine/Aural.php +109 -0
  39. data/templates/project/files/build/tools/css-compressor/lib/Combine/Background.php +107 -0
  40. data/templates/project/files/build/tools/css-compressor/lib/Combine/Border.php +98 -0
  41. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderOutline.php +109 -0
  42. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderRadius.php +262 -0
  43. data/templates/project/files/build/tools/css-compressor/lib/Combine/Font.php +125 -0
  44. data/templates/project/files/build/tools/css-compressor/lib/Combine/List.php +104 -0
  45. data/templates/project/files/build/tools/css-compressor/lib/Combine/MarginPadding.php +190 -0
  46. data/templates/project/files/build/tools/css-compressor/lib/Compress.php +212 -0
  47. data/templates/project/files/build/tools/css-compressor/lib/Control.php +236 -0
  48. data/templates/project/files/build/tools/css-compressor/lib/Exception.php +32 -0
  49. data/templates/project/files/build/tools/css-compressor/lib/Format.php +187 -0
  50. data/templates/project/files/build/tools/css-compressor/lib/Individuals.php +307 -0
  51. data/templates/project/files/build/tools/css-compressor/lib/Numeric.php +103 -0
  52. data/templates/project/files/build/tools/css-compressor/lib/Option.php +133 -0
  53. data/templates/project/files/build/tools/css-compressor/lib/Organize.php +149 -0
  54. data/templates/project/files/build/tools/css-compressor/lib/Selectors.php +245 -0
  55. data/templates/project/files/build/tools/css-compressor/lib/Setup.php +292 -0
  56. data/templates/project/files/build/tools/css-compressor/lib/Trim.php +213 -0
  57. data/templates/project/files/build/tools/css-compressor/license.txt +21 -0
  58. data/templates/project/files/build/tools/htmlcompressor-0.9.8.jar +0 -0
  59. data/templates/project/files/build/tools/jpegtran.exe +0 -0
  60. data/templates/project/files/build/tools/optipng-0.6.4-exe/LICENSE.txt +21 -0
  61. data/templates/project/files/build/tools/optipng-0.6.4-exe/optipng.exe +0 -0
  62. data/templates/project/files/build/tools/yuicompressor-2.4.2.jar +0 -0
  63. data/templates/project/files/crossdomain.xml +25 -0
  64. data/templates/project/files/favicon.ico +0 -0
  65. data/templates/project/files/gitignore.txt +32 -0
  66. data/templates/project/files/gitignore_placeholder.txt +2 -0
  67. data/templates/project/files/google.yml +22 -0
  68. data/templates/project/files/htaccess +415 -0
  69. data/templates/project/files/humans.txt +43 -0
  70. data/templates/project/files/lighttpd.conf +149 -0
  71. data/templates/project/files/mime.types +80 -0
  72. data/templates/project/files/nginx.conf +108 -0
  73. data/templates/project/files/robots.txt +5 -0
  74. data/templates/project/files/web.config +207 -0
  75. data/templates/project/handheld.scss +8 -0
  76. data/templates/project/index.html +81 -0
  77. data/templates/project/javascripts/libs/dd_belatedpng.js +13 -0
  78. data/templates/project/javascripts/libs/jquery-1.4.4.js +7179 -0
  79. data/templates/project/javascripts/libs/jquery-1.4.4.min.js +167 -0
  80. data/templates/project/javascripts/libs/modernizr-1.6.min.js +30 -0
  81. data/templates/project/javascripts/plugins.js +13 -0
  82. data/templates/project/javascripts/rails.js +156 -0
  83. data/templates/project/javascripts/script.js +26 -0
  84. data/templates/project/manifest.rb +101 -0
  85. data/templates/project/partials/_base.scss +23 -0
  86. data/templates/project/style.scss +70 -0
  87. metadata +171 -0
@@ -0,0 +1,22 @@
1
+ #
2
+ # CSS Compression [VERSION] Change Log
3
+ # [DATE]
4
+ # Corey Hart @ http://www.codenothing.com
5
+ #
6
+
7
+ # Compressor Additions
8
+ - Configuration Modes
9
+ - pseduo-space, add space between pseduo selectors and comma/brace for ie6
10
+ - removing leading 0 of a decimal, 0.633px -> .633px
11
+ - handling all At Rules (charsets,media,imports,font-family,etc..)
12
+ - handling ms filter paths
13
+ - More css hacks support, including box-modal hack
14
+ - attr2selector, Convert id=blah and class=blah attributes to their selector counterparts
15
+ - strict-id, removes all selectors up to the last id
16
+ - add-unknown, adds unknown blocks to top of output in a comment
17
+
18
+ # Codebase Changes
19
+ - Converted to subclass architecture, more modular.
20
+ - Using JSON based sandbox specs for focused unit tests.
21
+ - Helper conversion definitions(long2hex, hex2short) are now in JSON based files.
22
+ - Added benchmark/regression testing
@@ -0,0 +1,101 @@
1
+ <?php
2
+ /**
3
+ * CSS Compressor [VERSION]
4
+ * [DATE]
5
+ * Corey Hart @ http://www.codenothing.com
6
+ */
7
+ require( dirname(__FILE__) . '/CSSCompression.php' );
8
+
9
+
10
+ Class Cli
11
+ {
12
+ /**
13
+ * Cli Patterns
14
+ *
15
+ * @param (CSSCompression instance) instance: CSSCompression instance
16
+ * @param (array) args: Array of command line arguments
17
+ * @param (array) options: Array of options read from cli arguments
18
+ * @param (string) mode: Compression mode
19
+ * @param (string) cwd: Current working directory
20
+ * @param (string) content: CSS Sheets read
21
+ * @param (regex) rcss: Matches css file name extension
22
+ * @param (regex) roption: Matches the longhand options
23
+ * @param (regex) rsingle: Matches shorthand options
24
+ * @param (regex) rprefix: Matches absolute paths
25
+ */
26
+ private $instance;
27
+ private $args = array();
28
+ private $options = array();
29
+ private $mode = 'safe';
30
+ private $cwd = '';
31
+ private $content = '';
32
+ private $rcss = "/\.css$/";
33
+ private $roption = "/^--/i";
34
+ private $rsingle = "/^-/";
35
+ private $rprefix = "/^(\/|\~\/)/";
36
+
37
+ /**
38
+ * Run the compression across files passed to cli
39
+ *
40
+ * @param (array) args: Array of argument passed over the command line
41
+ */
42
+ public function __construct( $args = array() ) {
43
+ $this->args = $args;
44
+ $this->cwd = getcwd() . '/';
45
+
46
+ $this->read();
47
+ $this->render();
48
+ }
49
+
50
+ /**
51
+ * Reads the cli arguments and puts them in their place
52
+ *
53
+ * @params none
54
+ */
55
+ public function read(){
56
+ while ( count( $this->args ) ) {
57
+ $arg = array_shift( $this->args );
58
+
59
+ if ( preg_match( $this->rcss, $arg ) ) {
60
+ $path = preg_match( $this->rprefix, $arg ) ? $arg : $this->cwd . $arg;
61
+ $this->content .= file_get_contents( $path );
62
+ }
63
+ else if ( substr( $arg, 0, 2 ) == '--' ) {
64
+ $parts = explode( '=', $arg, 2 );
65
+ $name = substr( $parts[ 0 ], 2 );
66
+ $value = isset( $parts[ 1 ] ) ? $parts[ 1 ] : true;
67
+
68
+ if ( $name == 'mode' ) {
69
+ $this->mode = $value;
70
+ }
71
+ else {
72
+ $this->options[ $name ] = $value === 'false' ? false : $value;
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Outputs the compression of the content read
80
+ *
81
+ * @params none
82
+ */
83
+ public function render(){
84
+ $this->instance = new CSSCompression();
85
+
86
+ if ( $this->mode ) {
87
+ $this->instance->mode( $this->mode );
88
+ }
89
+
90
+ if ( $this->options ) {
91
+ $this->instance->option( $this->options );
92
+ }
93
+
94
+ echo $this->instance->compress( $this->content );
95
+ }
96
+ };
97
+
98
+ // Auto-initialize the cli script
99
+ new Cli( $_SERVER['argv'] );
100
+
101
+ ?>
@@ -0,0 +1,39 @@
1
+ /**
2
+ * CSS Compressor [VERSION]
3
+ * [DATE]
4
+ * Corey Hart @ http://www.codenothing.com
5
+ */
6
+ {
7
+ "#f0ffff":"azure",
8
+ "#f5f5dc":"beige",
9
+ "#ffe4c4":"bisque",
10
+ "#a52a2a":"brown",
11
+ "#ff7f50":"coral",
12
+ "#ffd700":"gold",
13
+ "#808080":"gray",
14
+ "#008000":"green",
15
+ "#4b0082":"indigo",
16
+ "#fffff0":"ivory",
17
+ "#f0e68c":"khaki",
18
+ "#faf0e6":"linen",
19
+ "#800000":"maroon",
20
+ "#000080":"navy",
21
+ "#808000":"olive",
22
+ "#ffa500":"orange",
23
+ "#da70d6":"orchid",
24
+ "#cd853f":"peru",
25
+ "#ffc0cb":"pink",
26
+ "#dda0dd":"plum",
27
+ "#800080":"purple",
28
+ "#ff0000":"red",
29
+ "#fa8072":"salmon",
30
+ "#a0522d":"sienna",
31
+ "#c0c0c0":"silver",
32
+ "#fffafa":"snow",
33
+ "#d2b48c":"tan",
34
+ "#008080":"teal",
35
+ "#ff6347":"tomato",
36
+ "#ee82ee":"violet",
37
+ "#f5deb3":"wheat",
38
+ "#f00":"red"
39
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * CSS Compressor [VERSION]
3
+ * [DATE]
4
+ * Corey Hart @ http://www.codenothing.com
5
+ */
6
+ {
7
+ "#808080":"gray",
8
+ "#008000":"green",
9
+ "#800000":"maroon",
10
+ "#000080":"navy",
11
+ "#808000":"olive",
12
+ "#ff0000":"red",
13
+ "#c0c0c0":"silver",
14
+ "#008080":"teal",
15
+ "#f00":"red"
16
+ }
@@ -0,0 +1,127 @@
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
+ }
@@ -0,0 +1,218 @@
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
+ ?>