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,107 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Combine_Background
9
- {
10
- /**
11
- * Combine Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Combine: Combine Controller
15
- * @param (regex) rbackground: Background matching
16
- * @param (array) groupings: List of background combinations
17
- */
18
- private $Control;
19
- private $Combine;
20
- private $rbackground = "/(^|(?<!\\\);)background-(color|image|repeat|attachment|position):(.*?)((?<!\\\);|$)/";
21
- private $groupings = array(
22
- // With color
23
- array( 'color', 'image', 'repeat', 'attachment', 'position' ),
24
- array( 'color', 'image', 'attachment', 'position' ),
25
- array( 'color', 'image', 'repeat', 'position' ),
26
- array( 'color', 'image', 'repeat', 'attachment' ),
27
- array( 'color', 'image', 'repeat' ),
28
- array( 'color', 'image', 'attachment' ),
29
- array( 'color', 'image', 'position' ),
30
- array( 'color', 'image' ),
31
- // Without Color
32
- array( 'image', 'attachment', 'position' ),
33
- array( 'image', 'repeat', 'position' ),
34
- array( 'image', 'repeat', 'attachment' ),
35
- array( 'image', 'repeat' ),
36
- array( 'image', 'attachment' ),
37
- array( 'image', 'position' ),
38
- // Just Color/Image
39
- array( 'image' ),
40
- array( 'color' ),
41
- );
42
-
43
- /**
44
- * Stash a reference to the controller & combiner
45
- *
46
- * @param (class) control: CSSCompression Controller
47
- * @param (class) combine: CSSCompression Combiner
48
- */
49
- public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
50
- $this->Control = $control;
51
- $this->Combine = $combine;
52
- }
53
-
54
- /**
55
- * Combines multiple background props into single definition
56
- *
57
- * @param (string) val: Rule Set
58
- */
59
- public function combine( $val ) {
60
- $storage = array();
61
-
62
- // Find all possible occurences and build the replacement
63
- $pos = 0;
64
- while ( preg_match( $this->rbackground, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
65
- $storage[ $match[ 2 ][ 0 ] ] = $match[ 3 ][ 0 ];
66
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
67
- }
68
-
69
- // Run background checks and get replacement str
70
- foreach ( $this->groupings as $props ) {
71
- if ( $replace = $this->Combine->searchDefinitions( 'background', $storage, $props ) ) {
72
- break;
73
- }
74
- }
75
-
76
- // If replacement string found, run it on all declarations
77
- if ( $replace ) {
78
- $pos = 0;
79
- while ( preg_match( $this->rbackground, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
80
- $colon = strlen( $match[ 1 ][ 0 ] );
81
- $val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
82
- $pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
83
- $replace = '';
84
- }
85
- }
86
-
87
- // Return converted val
88
- return $val;
89
- }
90
-
91
- /**
92
- * Access to private methods for testing
93
- *
94
- * @param (string) method: Method to be called
95
- * @param (array) args: Array of paramters to be passed in
96
- */
97
- public function access( $method, $args ) {
98
- if ( method_exists( $this, $method ) ) {
99
- return call_user_func_array( array( $this, $method ), $args );
100
- }
101
- else {
102
- throw new CSSCompression_Exception( "Unknown method in Background Class - " . $method );
103
- }
104
- }
105
- };
106
-
107
- ?>
@@ -1,98 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Combine_Border
9
- {
10
- /**
11
- * Combine Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Combine: Combine Controller
15
- * @param (regex) rborder: Border matching
16
- */
17
- private $Control;
18
- private $Combine;
19
- private $rborder = "/(^|(?<!\\\);)border-(top|right|bottom|left):(.*?)((?<!\\\);|$)/";
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 multiple border properties into single definition
34
- *
35
- * @param (string) val: Rule Set
36
- */
37
- public function combine( $val ) {
38
- if ( ( $replace = $this->replace( $val ) ) === false ) {
39
- return $val;
40
- }
41
-
42
- // Rebuild the rule set with the combinations found
43
- $pos = 0;
44
- while ( preg_match( $this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
45
- $colon = strlen( $match[ 1 ][ 0 ] );
46
- $val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
47
- $pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
48
- $replace = '';
49
- }
50
-
51
- // Return converted val
52
- return $val;
53
- }
54
-
55
- /**
56
- * Builds a replacement string
57
- *
58
- * @param (string) val: Rule Set
59
- */
60
- private function replace( $val ) {
61
- $storage = array();
62
-
63
- // Find all possible occurences and build the replacement
64
- $pos = 0;
65
- while ( preg_match( $this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
66
- // Override double written properties
67
- $storage[ $match[ 2 ][ 0 ] ] = $match[ 3 ][ 0 ];
68
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
69
- }
70
-
71
- // All 4 have to be defined
72
- if ( count( $storage ) == 4 &&
73
- $storage['top'] == $storage['bottom'] &&
74
- $storage['left'] == $storage['right'] &&
75
- $storage['top'] == $storage['right'] ) {
76
- return "border:" . $storage['top'] . ';';
77
- }
78
-
79
- return false;
80
- }
81
-
82
- /**
83
- * Access to private methods for testing
84
- *
85
- * @param (string) method: Method to be called
86
- * @param (array) args: Array of paramters to be passed in
87
- */
88
- public function access( $method, $args ) {
89
- if ( method_exists( $this, $method ) ) {
90
- return call_user_func_array( array( $this, $method ), $args );
91
- }
92
- else {
93
- throw new CSSCompression_Exception( "Unknown method in Border Class - " . $method );
94
- }
95
- }
96
- };
97
-
98
- ?>
@@ -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_BorderOutline
9
- {
10
- /**
11
- * Combine Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Combine: Combine Controller
15
- * @param (regex) rcsw: Border/Outline matching
16
- */
17
- private $Control;
18
- private $Combine;
19
- private $rcsw = "/(^|(?<!\\\);)(border|border-top|border-bottom|border-left|border-right|outline)-(color|style|width):(.*?)((?<!\\\);|$)/";
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 color/style/width of border/outline properties
34
- *
35
- * @param (string) val: Rule Set
36
- */
37
- public function combine( $val ) {
38
- $storage = $this->storage( $val );
39
- $pos = 0;
40
-
41
- // Now rebuild the string replacing all instances
42
- while ( preg_match( $this->rcsw, $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
- $pos = 0;
67
-
68
- // Find all possible occurences and build the replacement
69
- while ( preg_match( $this->rcsw, $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 ) == 3 && ! $this->Combine->checkUncombinables( $arr ) ) {
83
- $storage[ $tag ] = "$tag:" . $arr['width'] . ' ' . $arr['style'] . ' ' . $arr['color'] . ';';
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 BorderOutline Class - " . $method );
105
- }
106
- }
107
- };
108
-
109
- ?>
@@ -1,262 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Combine_BorderRadius
9
- {
10
- /**
11
- * Combine Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Combine: Combine Controller
15
- * @param (regex) rspace: Checks for space without an escape '\' character before it
16
- * @param (regex) rslash: Checks for unescaped slash character
17
- * @param (array) borderRadius: Various border radii components
18
- */
19
- private $Control;
20
- private $Combine;
21
- private $rspace = "/(?<!\\\)\s/";
22
- private $rslash = "/(?<!\\\)\//";
23
- private $borderRadius = array(
24
- 'css3' => array(
25
- 'mod' => '',
26
- 'base' => "/(^|(?<!\\\);)border-radius:(.*?)((?<!\\\);|$)/",
27
- 'full' => "/(^|(?<!\\\);)border-(top|bottom)-(left|right)-radius:(.*?)((?<!\\\);|$)/",
28
- ),
29
- 'moz' => array(
30
- 'mod' => '-moz-',
31
- 'base' => "/(^|(?<!\\\);)-moz-border-radius:(.*?)((?<!\\\);|$)/",
32
- 'full' => "/(^|(?<!\\\);)-moz-border-radius-(top|bottom)(left|right):(.*?)((?<!\\\);|$)/"
33
- ),
34
- 'webkit' => array(
35
- 'mod' => '-webkit-',
36
- 'base' => "/(^|(?<!\\\);)-webkit-border-radius:(.*?)((?<!\\\);|$)/",
37
- 'full' => "/(^|(?<!\\\);)-webkit-border-(top|bottom)-(left|right)-radius:(.*?)((?<!\\\);|$)/"
38
- ),
39
- );
40
-
41
- /**
42
- * Stash a reference to the controller & combiner
43
- *
44
- * @param (class) control: CSSCompression Controller
45
- * @param (class) combine: CSSCompression Combiner
46
- */
47
- public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
48
- $this->Control = $control;
49
- $this->Combine = $combine;
50
- }
51
-
52
-
53
- /**
54
- * Main handler to combine border-radii into a single rule
55
- *
56
- * @param (string) val: Rule Set
57
- */
58
- public function combine( $val ) {
59
- foreach ( $this->borderRadius as $regex ) {
60
- $val = $this->fix( $val, $regex );
61
- }
62
-
63
- return $val;
64
- }
65
-
66
- /**
67
- * Does the actual combining
68
- *
69
- * @param (string) val: Rule Set
70
- */
71
- private function fix( $val, $regex ) {
72
- $val = $this->base( $val, $regex );
73
- $replace = $regex['mod'];
74
-
75
- // Storage builder
76
- if ( ( $storage = $this->storage( $val, $regex ) ) === false ) {
77
- return $val;
78
- }
79
-
80
- // Setup horizontal/vertical radii
81
- foreach ( $storage as $dir => &$config ) {
82
- // Verticals are optional
83
- if ( $dir == 'vertical' && ! $config['keep'] ) {
84
- break;
85
- }
86
- // All 4 are the same
87
- else if ( $config['top-left'] == $config['top-right'] &&
88
- $config['top-right'] == $config['bottom-right'] &&
89
- $config['bottom-right'] == $config['bottom-left'] ) {
90
- $config['replace'] .= $config['top-left'];
91
- }
92
- // Opposites are the same
93
- else if ( $config['top-left'] == $config['bottom-right'] && $config['top-right'] == $config['bottom-left'] ) {
94
- $config['replace'] .= $config['top-left'] . ' ' . $config['top-right'];
95
- }
96
- // 3-point directional
97
- else if ( $config['top-right'] == $config['bottom-left'] ) {
98
- $config['replace'] .= $config['top-left'] . ' ' . $config['top-right'] . ' ' . $config['bottom-right'];
99
- }
100
- // none are the same, but can still use shorthand notation
101
- else {
102
- $config['replace'] .= $config['top-left'] . ' ' . $config['top-right'] . ' '
103
- . $config['bottom-right'] . ' ' . $config['bottom-left'];
104
- }
105
- }
106
-
107
- // Now rebuild the string replacing all instances of margin/padding if shorthand exists
108
- $pos = 0;
109
- $replace = $regex['mod'] . "border-radius:" . $storage['horizontal']['replace'] . $storage['vertical']['replace'] . ';';
110
- while ( preg_match( $regex['full'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
111
- $colon = strlen( $match[ 1 ][ 0 ] );
112
- $val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
113
- $pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
114
- $replace = '';
115
- }
116
-
117
- // Return converted val
118
- return $val;
119
- }
120
-
121
- /**
122
- * Expands short handed border radius props for combination
123
- *
124
- * @param (string) val: Rule Set
125
- */
126
- private function base( $val, $regex ) {
127
- $pos = 0;
128
- while ( preg_match( $regex['base'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
129
- $replace = '';
130
- $parts = preg_split( $this->rslash, trim( $match[ 2 ][ 0 ] ), 2 );
131
- $positions = array(
132
- 'top-left' => 0,
133
- 'top-right' => 0,
134
- 'bottom-right' => 0,
135
- 'bottom-left' => 0,
136
- );
137
- $base = array(
138
- 'horizontal' => array(
139
- 'parts' => preg_split( $this->rspace, trim( $parts[ 0 ] ) ),
140
- 'pos' => $positions,
141
- ),
142
- 'vertical' => array(
143
- 'parts' => isset( $parts[ 1 ] ) ? preg_split( $this->rspace, trim( $parts[ 1 ] ) ) : '',
144
- 'pos' => $positions,
145
- ),
146
- );
147
-
148
- foreach ( $base as &$config ) {
149
- // Skip uncombinables
150
- if ( $this->Combine->checkUncombinables( $config['parts'] ) ) {
151
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
152
- continue 2;
153
- }
154
- // Might not have verticals
155
- else if ( $config['parts'] === '' ) {
156
- continue;
157
- }
158
-
159
- // Each position needs a value
160
- switch ( count( $config['parts'] ) ) {
161
- case 1:
162
- $config['pos']['top-left'] = $config['pos']['top-right'] = $config['parts'][ 0 ];
163
- $config['pos']['bottom-left'] = $config['pos']['bottom-right'] = $config['parts'][ 0 ];
164
- break;
165
- case 2:
166
- $config['pos']['top-left'] = $config['pos']['bottom-right'] = $config['parts'][ 0 ];
167
- $config['pos']['bottom-left'] = $config['pos']['top-right'] = $config['parts'][ 1 ];
168
- break;
169
- case 3:
170
- $config['pos']['top-left'] = $config['parts'][ 0 ];
171
- $config['pos']['bottom-left'] = $config['pos']['top-right'] = $config['parts'][ 1 ];
172
- $config['pos']['bottom-right'] = $config['parts'][ 2 ];
173
- break;
174
- case 4:
175
- $config['pos']['top-left'] = $config['parts'][ 0 ];
176
- $config['pos']['top-right'] = $config['parts'][ 1 ];
177
- $config['pos']['bottom-right'] = $config['parts'][ 2 ];
178
- $config['pos']['bottom-left'] = $config['parts'][ 3 ];
179
- break;
180
- default:
181
- continue 2;
182
- }
183
-
184
- }
185
-
186
- // Build the replacement
187
- foreach ( $positions as $p => $v ) {
188
- if ( $regex['mod'] == '-moz-' ) {
189
- $replace .= "-moz-border-radius-" . preg_replace( "/-/", '', $p ) . ":"
190
- . $base['horizontal']['pos'][ $p ]
191
- . ( $base['vertical']['parts'] === '' ? '' : ' ' . $base['vertical']['pos'][ $p ] )
192
- . ';';
193
- }
194
- else {
195
- $replace .= $regex['mod'] . "border-$p-radius:"
196
- . $base['horizontal']['pos'][ $p ]
197
- . ( $base['vertical']['parts'] === '' ? '' : ' ' . $base['vertical']['pos'][ $p ] )
198
- . ';';
199
- }
200
- }
201
- $pos += strlen( $replace );
202
- $val = substr_replace( $val, $replace, $match[ 0 ][ 1 ], strlen( $match[ 0 ][ 0 ] ) );
203
- }
204
-
205
- return $val;
206
- }
207
-
208
- /**
209
- * Builds the storage object for border radius props
210
- *
211
- * @param (string) val: Rule Set
212
- * @param (array) regex: Current border radius type checking props
213
- */
214
- private function storage( $val, $regex ) {
215
- $storage = array(
216
- 'horizontal' => array( 'replace' => '' ),
217
- 'vertical' => array( 'replace' => '', 'keep' => false ),
218
- );
219
-
220
- // Find all possible occurences of this border-radius type and mark their directional value
221
- $pos = 0;
222
- while ( preg_match( $regex['full'], $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
223
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
224
- $parts = preg_split( $this->rspace, $match[ 4 ][ 0 ], 2 );
225
- $storage['horizontal'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = trim( $parts[ 0 ] );
226
- if ( isset( $parts[ 1 ] ) ) {
227
- $storage['vertical'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = trim( $parts[ 1 ] );
228
- $storage['vertical']['keep'] = true;
229
- $storage['vertical']['replace'] = '/';
230
- }
231
- else {
232
- $storage['vertical'][ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = '0';
233
- }
234
- }
235
-
236
- // Only combine if all 4 definitions are found (5 including replace)
237
- if ( count( $storage['horizontal'] ) != 5 ||
238
- $this->Combine->checkUncombinables( $storage['horizontal'] ) ||
239
- $this->Combine->checkUncombinables( $storage['vertical'] ) ) {
240
- return false;
241
- }
242
-
243
- return $storage;
244
- }
245
-
246
- /**
247
- * Access to private methods for testing
248
- *
249
- * @param (string) method: Method to be called
250
- * @param (array) args: Array of paramters to be passed in
251
- */
252
- public function access( $method, $args ) {
253
- if ( method_exists( $this, $method ) ) {
254
- return call_user_func_array( array( $this, $method ), $args );
255
- }
256
- else {
257
- throw new CSSCompression_Exception( "Unknown method in BorderRadius Class - " . $method );
258
- }
259
- }
260
- };
261
-
262
- ?>
@@ -1,125 +0,0 @@
1
- <?php
2
- /**
3
- * CSS Compressor [VERSION]
4
- * [DATE]
5
- * Corey Hart @ http://www.codenothing.com
6
- */
7
-
8
- Class CSSCompression_Combine_Font
9
- {
10
- /**
11
- * Combine Patterns
12
- *
13
- * @class Control: Compression Controller
14
- * @class Combine: Combine Controller
15
- * @param (regex) rfont: Font matching
16
- * @param (array) groupings: Set of font combinationals
17
- */
18
- private $Control;
19
- private $Combine;
20
- private $rfont = "/(^|(?<!\\\);)(font|line)-(style|variant|weight|size|height|family):(.*?)((?<!\\\);|$)/";
21
- private $groupings = array(
22
- array( 'font-style', 'font-variant', 'font-weight', 'size/height', 'font-family' ),
23
- array( 'font-style', 'font-variant', 'font-weight', 'font-size', 'font-family' ),
24
- array( 'font-style', 'font-variant', 'size/height', 'font-family' ),
25
- array( 'font-style', 'font-variant', 'font-size', 'font-family' ),
26
- array( 'font-style', 'font-weight', 'size/height', 'font-family' ),
27
- array( 'font-style', 'font-weight', 'font-size', 'font-family' ),
28
- array( 'font-variant', 'font-weight', 'size/height', 'font-family' ),
29
- array( 'font-variant', 'font-weight', 'font-size', 'font-family' ),
30
- array( 'font-weight', 'size/height', 'font-family' ),
31
- array( 'font-weight', 'font-size', 'font-family' ),
32
- array( 'font-variant', 'size/height', 'font-family' ),
33
- array( 'font-variant', 'font-size', 'font-family' ),
34
- array( 'font-style', 'size/height', 'font-family' ),
35
- array( 'font-style', 'font-size', 'font-family' ),
36
- array( 'size/height', 'font-family' ),
37
- array( 'font-size', 'font-family' ),
38
- );
39
-
40
- /**
41
- * Stash a reference to the controller & combiner
42
- *
43
- * @param (class) control: CSSCompression Controller
44
- * @param (class) combine: CSSCompression Combiner
45
- */
46
- public function __construct( CSSCompression_Control $control, CSSCompression_Combine $combine ) {
47
- $this->Control = $control;
48
- $this->Combine = $combine;
49
- }
50
-
51
- /**
52
- * Combines multiple font-definitions into single definition
53
- *
54
- * @param (string) val: Rule Set
55
- */
56
- public function combine( $val ) {
57
- $storage = $this->storage( $val );
58
-
59
- // Loop through each property check and see if they can be replaced
60
- foreach ( $this->groupings as $props ) {
61
- if ( $replace = $this->Combine->searchDefinitions( 'font', $storage, $props ) ) {
62
- break;
63
- }
64
- }
65
-
66
- // If replacement string found, run it on all declarations
67
- if ( $replace ) {
68
- $pos = 0;
69
- while ( preg_match( $this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
70
- if ( ! isset( $storage['line-height'] ) && stripos( $match[ 0 ][ 0 ], 'line-height') === 0 ) {
71
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
72
- continue;
73
- }
74
- $colon = strlen( $match[ 1 ][ 0 ] );
75
- $val = substr_replace( $val, $replace, $match[ 0 ][ 1 ] + $colon, strlen( $match[ 0 ][ 0 ] ) - $colon );
76
- $pos = $match[ 0 ][ 1 ] + strlen( $replace ) - $colon - 1;
77
- $replace = '';
78
- }
79
- }
80
-
81
- // Return converted val
82
- return $val;
83
- }
84
-
85
- /**
86
- * Builds a storage object for iteration
87
- *
88
- * @param (string) val: Rule Set
89
- */
90
- private function storage( $val ) {
91
- $storage = array();
92
-
93
- // Find all possible occurences and build the replacement
94
- $pos = 0;
95
- while ( preg_match( $this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos ) ) {
96
- $storage[ $match[ 2 ][ 0 ] . '-' . $match[ 3 ][ 0 ] ] = $match[ 4 ][ 0 ];
97
- $pos = $match[ 0 ][ 1 ] + strlen( $match[ 0 ][ 0 ] ) - 1;
98
- }
99
-
100
- // Combine font-size & line-height if possible
101
- if ( isset( $storage['font-size'] ) && isset( $storage['line-height'] ) ) {
102
- $storage['size/height'] = $storage['font-size'] . '/' . $storage['line-height'];
103
- unset( $storage['font-size'], $storage['line-height'] );
104
- }
105
-
106
- return $storage;
107
- }
108
-
109
- /**
110
- * Access to private methods for testing
111
- *
112
- * @param (string) method: Method to be called
113
- * @param (array) args: Array of paramters to be passed in
114
- */
115
- public function access( $method, $args ) {
116
- if ( method_exists( $this, $method ) ) {
117
- return call_user_func_array( array( $this, $method ), $args );
118
- }
119
- else {
120
- throw new CSSCompression_Exception( "Unknown method in Font Class - " . $method );
121
- }
122
- }
123
- };
124
-
125
- ?>