Version Description
- Fix: jQuery Migrate compatibility.
- Fix: PHP 8 compatibility.
Download this release
Release Info
Developer | pdclark |
Plugin | Styles |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- classes/csstidy/.gitignore +6 -0
- classes/csstidy/.travis.yml +19 -0
- classes/csstidy/README.md +86 -0
- classes/csstidy/class.csstidy.php +396 -274
- classes/csstidy/class.csstidy_ctype.php +0 -46
- classes/csstidy/class.csstidy_optimise.php +498 -127
- classes/csstidy/class.csstidy_print.php +122 -50
- classes/csstidy/composer.json +45 -0
- classes/csstidy/css_optimiser.php +454 -0
- classes/csstidy/cssparse.css +33 -32
- classes/csstidy/cssparsed.css +28 -28
- classes/csstidy/data-wp.inc.php +0 -75
- classes/csstidy/data.inc.php +524 -536
- classes/csstidy/lang.inc.php +311 -311
- classes/csstidy/template.tpl +10 -0
- classes/csstidy/template1.tpl +12 -0
- classes/csstidy/template2.tpl +5 -0
- classes/csstidy/template3.tpl +1 -0
- classes/styles-admin.php +1 -0
- classes/styles-child.php +1 -10
- js/admin-notices.js +1 -1
- readme.txt +12 -7
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- styles.php +1 -1
classes/csstidy/.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
testing/simpletest*
|
2 |
+
testing/Text*
|
3 |
+
nbproject*
|
4 |
+
.idea
|
5 |
+
vendor/
|
6 |
+
composer.lock
|
classes/csstidy/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
php:
|
4 |
+
- 5.6
|
5 |
+
- 7.0
|
6 |
+
- 7.1
|
7 |
+
- 7.2
|
8 |
+
- nightly
|
9 |
+
|
10 |
+
install: composer install
|
11 |
+
|
12 |
+
script:
|
13 |
+
- cd testing
|
14 |
+
- php unit-tests.php
|
15 |
+
- cd ..
|
16 |
+
|
17 |
+
matrix:
|
18 |
+
allow_failures:
|
19 |
+
- php: nightly
|
classes/csstidy/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CSSTidy [![Build Status](https://travis-ci.org/Cerdic/CSSTidy.svg?branch=master)](https://travis-ci.org/Cerdic/CSSTidy)
|
2 |
+
|
3 |
+
CSSTidy is a CSS minifier
|
4 |
+
|
5 |
+
* css_optimiser.php is the web-interface
|
6 |
+
* class.csstidy.php is the parser
|
7 |
+
* bin/pcsstidy is the standalone command line executable
|
8 |
+
|
9 |
+
This class represents a CSS parser which reads CSS code and saves it in an array.
|
10 |
+
In opposite to most other CSS parsers, it does not use regular expressions and
|
11 |
+
thus has full CSS3 support and a higher reliability. The downside of not using regular expressions
|
12 |
+
is a lower speed though.
|
13 |
+
Additional to that it applies some optimisations and fixes to the CSS code.
|
14 |
+
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
```
|
19 |
+
include('class.csstidy.php');
|
20 |
+
$csstidy = new csstidy();
|
21 |
+
|
22 |
+
// Set some options :
|
23 |
+
$csstidy->set_cfg('optimise_shorthands', 2);
|
24 |
+
$csstidy->set_cfg('template', 'high');
|
25 |
+
|
26 |
+
// Parse the CSS
|
27 |
+
$csstidy->parse($css_code);
|
28 |
+
|
29 |
+
// Get back the optimized CSS Code
|
30 |
+
$css_code_opt = $csstidy->print->plain();
|
31 |
+
```
|
32 |
+
|
33 |
+
|
34 |
+
## Changelog
|
35 |
+
* v1.7.3 :
|
36 |
+
- fix bug and notice on reverse_left_and_right option
|
37 |
+
* v1.7.1 :
|
38 |
+
- fix deprecated with PHP 7.4
|
39 |
+
* v1.7.0 :
|
40 |
+
- provide bin/pcsstidy for command line usage
|
41 |
+
- support nested @media and @supports rules
|
42 |
+
* v1.6.5 :
|
43 |
+
- fix warnings with PHP 7.3
|
44 |
+
* v1.6.4 :
|
45 |
+
- preserve important comments (starting with !) in the minification /*! Credits/Licence */
|
46 |
+
* v1.6.3 :
|
47 |
+
- border-radius shorthands optimisation, reverse_left_and_right option
|
48 |
+
* v1.5.7 :
|
49 |
+
- PHP 7 compatibility, composer update, Travis CI integration
|
50 |
+
* v1.5.6 :
|
51 |
+
- fixes minor bugs, mainly on CSS3 properties/units
|
52 |
+
* v1.5.2 :
|
53 |
+
- is PHP 5.4+ compliant, removes use of GLOBALS, fixes some bugs, integrates CSS3 units
|
54 |
+
- and now available on https://packagist.org/packages/cerdic/css-tidy
|
55 |
+
* v1.4 :<br/>
|
56 |
+
Is the new version coming from master branch (corresponds to the initial trunk of svn repository) after beeing stabilized
|
57 |
+
* v1.3 branch corresponds to the last stable relase published by the author.<br/>
|
58 |
+
It integrates some bugfixes and a 1.3.1 version has been taged
|
59 |
+
Since the original project (http://csstidy.sourceforge.net/index.php) has been suspended
|
60 |
+
here is the import of https://csstidy.svn.sourceforge.net/svnroot/csstidy on 2010-11-14
|
61 |
+
|
62 |
+
Only PHP version is here maintained
|
63 |
+
|
64 |
+
## Licence
|
65 |
+
|
66 |
+
Copyright 2005-2007 Florian Schmitz
|
67 |
+
Copyright 2010-2019 Cedric Morin
|
68 |
+
|
69 |
+
CSSTidy is free software; you can redistribute it and/or modify
|
70 |
+
it under the terms of the GNU Lesser General Public License as published by
|
71 |
+
the Free Software Foundation; either version 2.1 of the License, or
|
72 |
+
(at your option) any later version.
|
73 |
+
|
74 |
+
CSSTidy is distributed in the hope that it will be useful,
|
75 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
76 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
77 |
+
GNU Lesser General Public License for more details.
|
78 |
+
|
79 |
+
You should have received a copy of the GNU Lesser General Public License
|
80 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
81 |
+
|
82 |
+
|
83 |
+
## History
|
84 |
+
|
85 |
+
Original Tracker :
|
86 |
+
http://sourceforge.net/tracker/?group_id=148404&atid=771415
|
classes/csstidy/class.csstidy.php
CHANGED
@@ -27,26 +27,29 @@
|
|
27 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
28 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
29 |
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
|
30 |
-
* @author Cedric Morin (cedric at yterium dot com) 2010
|
|
|
|
|
31 |
*/
|
32 |
-
/**
|
33 |
-
* Defines ctype functions if required
|
34 |
-
*
|
35 |
-
* @version 1.0
|
36 |
-
*/
|
37 |
-
require_once('class.csstidy_ctype.php');
|
38 |
|
39 |
/**
|
40 |
-
*
|
41 |
-
*
|
42 |
-
* @version 1.3
|
43 |
*/
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
/**
|
47 |
* Contains a class for printing CSS code
|
48 |
*
|
49 |
-
* @version 1.0
|
50 |
*/
|
51 |
require('class.csstidy_print.php');
|
52 |
|
@@ -60,7 +63,6 @@ require('class.csstidy_optimise.php');
|
|
60 |
/**
|
61 |
* CSS Parser class
|
62 |
*
|
63 |
-
|
64 |
* This class represents a CSS parser which reads CSS code and saves it in an array.
|
65 |
* In opposite to most other CSS parsers, it does not use regular expressions and
|
66 |
* thus has full CSS2 support and a higher reliability.
|
@@ -68,7 +70,7 @@ require('class.csstidy_optimise.php');
|
|
68 |
* An online version should be available here: http://cdburnerxp.se/cssparse/css_optimiser.php
|
69 |
* @package csstidy
|
70 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
71 |
-
* @version 1.3
|
72 |
*/
|
73 |
class csstidy {
|
74 |
|
@@ -77,57 +79,57 @@ class csstidy {
|
|
77 |
* @var array
|
78 |
* @access public
|
79 |
*/
|
80 |
-
|
81 |
/**
|
82 |
* Saves the parsed CSS (raw)
|
83 |
* @var array
|
84 |
* @access private
|
85 |
*/
|
86 |
-
|
87 |
/**
|
88 |
* Printer class
|
89 |
* @see csstidy_print
|
90 |
* @var object
|
91 |
* @access public
|
92 |
*/
|
93 |
-
|
94 |
/**
|
95 |
* Optimiser class
|
96 |
* @see csstidy_optimise
|
97 |
* @var object
|
98 |
* @access private
|
99 |
*/
|
100 |
-
|
101 |
/**
|
102 |
* Saves the CSS charset (@charset)
|
103 |
* @var string
|
104 |
* @access private
|
105 |
*/
|
106 |
-
|
107 |
/**
|
108 |
* Saves all @import URLs
|
109 |
* @var array
|
110 |
* @access private
|
111 |
*/
|
112 |
-
|
113 |
/**
|
114 |
* Saves the namespace
|
115 |
* @var string
|
116 |
* @access private
|
117 |
*/
|
118 |
-
|
119 |
/**
|
120 |
* Contains the version of csstidy
|
121 |
* @var string
|
122 |
* @access private
|
123 |
*/
|
124 |
-
|
125 |
/**
|
126 |
* Stores the settings
|
127 |
* @var array
|
128 |
* @access private
|
129 |
*/
|
130 |
-
|
131 |
/**
|
132 |
* Saves the parser-status.
|
133 |
*
|
@@ -142,37 +144,44 @@ class csstidy {
|
|
142 |
* @var string
|
143 |
* @access private
|
144 |
*/
|
145 |
-
|
146 |
/**
|
147 |
* Saves the current at rule (@media)
|
148 |
* @var string
|
149 |
* @access private
|
150 |
*/
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
/**
|
153 |
* Saves the current selector
|
154 |
* @var string
|
155 |
* @access private
|
156 |
*/
|
157 |
-
|
158 |
/**
|
159 |
* Saves the current property
|
160 |
* @var string
|
161 |
* @access private
|
162 |
*/
|
163 |
-
|
164 |
/**
|
165 |
* Saves the position of , in selectors
|
166 |
* @var array
|
167 |
* @access private
|
168 |
*/
|
169 |
-
|
170 |
/**
|
171 |
* Saves the current value
|
172 |
* @var string
|
173 |
* @access private
|
174 |
*/
|
175 |
-
|
176 |
/**
|
177 |
* Saves the current sub-value
|
178 |
*
|
@@ -183,81 +192,93 @@ class csstidy {
|
|
183 |
* @var string
|
184 |
* @access private
|
185 |
*/
|
186 |
-
|
187 |
/**
|
188 |
* Array which saves all subvalues for a property.
|
189 |
* @var array
|
190 |
* @see sub_value
|
191 |
* @access private
|
192 |
*/
|
193 |
-
|
194 |
/**
|
195 |
* Saves the stack of characters that opened the current strings
|
196 |
* @var array
|
197 |
* @access private
|
198 |
*/
|
199 |
-
|
200 |
-
|
201 |
/**
|
202 |
* Status from which the parser switched to ic or instr
|
203 |
* @var array
|
204 |
* @access private
|
205 |
*/
|
206 |
-
|
207 |
/**
|
208 |
/**
|
209 |
* =true if in invalid at-rule
|
210 |
* @var bool
|
211 |
* @access private
|
212 |
*/
|
213 |
-
|
214 |
/**
|
215 |
* =true if something has been added to the current selector
|
216 |
* @var bool
|
217 |
* @access private
|
218 |
*/
|
219 |
-
|
220 |
/**
|
221 |
* Array which saves the message log
|
222 |
* @var array
|
223 |
* @access private
|
224 |
*/
|
225 |
-
|
226 |
/**
|
227 |
* Saves the line number
|
228 |
* @var integer
|
229 |
* @access private
|
230 |
*/
|
231 |
-
|
232 |
/**
|
233 |
* Marks if we need to leave quotes for a string
|
234 |
* @var array
|
235 |
* @access private
|
236 |
*/
|
237 |
-
|
238 |
|
239 |
/**
|
240 |
* List of tokens
|
241 |
* @var string
|
242 |
*/
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
/**
|
245 |
* Loads standard template and sets default settings
|
246 |
* @access private
|
247 |
* @version 1.3
|
248 |
*/
|
249 |
-
function __construct() {
|
|
|
|
|
|
|
|
|
250 |
$this->settings['remove_bslash'] = true;
|
251 |
$this->settings['compress_colors'] = true;
|
252 |
$this->settings['compress_font-weight'] = true;
|
253 |
$this->settings['lowercase_s'] = false;
|
254 |
/*
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
*/
|
259 |
$this->settings['optimise_shorthands'] = 1;
|
260 |
$this->settings['remove_last_;'] = true;
|
|
|
261 |
/* rewrite all properties with low case, better for later gzip OK, safe*/
|
262 |
$this->settings['case_properties'] = 1;
|
263 |
/* sort properties in alpabetic order, better for later gzip
|
@@ -265,24 +286,28 @@ class csstidy {
|
|
265 |
*/
|
266 |
$this->settings['sort_properties'] = false;
|
267 |
/*
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
*/
|
272 |
$this->settings['sort_selectors'] = 0;
|
273 |
/* is dangeroues to be used: CSS is broken sometimes */
|
274 |
$this->settings['merge_selectors'] = 0;
|
275 |
/* preserve or not browser hacks */
|
|
|
|
|
|
|
|
|
276 |
$this->settings['discard_invalid_selectors'] = false;
|
277 |
$this->settings['discard_invalid_properties'] = false;
|
278 |
-
$this->settings['css_level'] = '
|
279 |
$this->settings['preserve_css'] = false;
|
280 |
$this->settings['timestamp'] = false;
|
281 |
$this->settings['template'] = ''; // say that propertie exist
|
282 |
$this->set_cfg('template','default'); // call load_template
|
283 |
$this->optimise = new csstidy_optimise($this);
|
284 |
|
285 |
-
$this->tokens_list = & $
|
286 |
}
|
287 |
|
288 |
/**
|
@@ -292,7 +317,7 @@ class csstidy {
|
|
292 |
* @return mixed
|
293 |
* @version 1.0
|
294 |
*/
|
295 |
-
function get_cfg($setting) {
|
296 |
if (isset($this->settings[$setting])) {
|
297 |
return $this->settings[$setting];
|
298 |
}
|
@@ -305,7 +330,7 @@ class csstidy {
|
|
305 |
* @access private
|
306 |
* @version 1.4
|
307 |
*/
|
308 |
-
function _load_template($template) {
|
309 |
switch ($template) {
|
310 |
case 'default':
|
311 |
$this->load_template('default');
|
@@ -337,7 +362,7 @@ class csstidy {
|
|
337 |
* @return bool
|
338 |
* @version 1.0
|
339 |
*/
|
340 |
-
function set_cfg($setting, $value=null) {
|
341 |
if (is_array($setting) && $value === null) {
|
342 |
foreach ($setting as $setprop => $setval) {
|
343 |
$this->settings[$setprop] = $setval;
|
@@ -346,7 +371,7 @@ class csstidy {
|
|
346 |
$this->_load_template($this->settings['template']);
|
347 |
}
|
348 |
return true;
|
349 |
-
}
|
350 |
$this->settings[$setting] = $value;
|
351 |
if ($setting === 'template') {
|
352 |
$this->_load_template($this->settings['template']);
|
@@ -364,9 +389,19 @@ class csstidy {
|
|
364 |
* @access private
|
365 |
* @version 1.0
|
366 |
*/
|
367 |
-
function _add_token($type, $data, $do = false) {
|
368 |
if ($this->get_cfg('preserve_css') || $do) {
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
}
|
372 |
|
@@ -378,7 +413,7 @@ class csstidy {
|
|
378 |
* @access private
|
379 |
* @version 1.0
|
380 |
*/
|
381 |
-
function log($message, $type, $line = -1) {
|
382 |
if ($line === -1) {
|
383 |
$line = $this->line;
|
384 |
}
|
@@ -397,15 +432,15 @@ class csstidy {
|
|
397 |
* @return string
|
398 |
* @version 1.2
|
399 |
*/
|
400 |
-
function _unicode(&$string, &$i) {
|
401 |
++$i;
|
402 |
$add = '';
|
403 |
$replaced = false;
|
404 |
|
405 |
-
while ($i < strlen($string) && (ctype_xdigit($string
|
406 |
-
$add .= $string
|
407 |
|
408 |
-
if (ctype_space($string
|
409 |
break;
|
410 |
}
|
411 |
$i++;
|
@@ -419,12 +454,12 @@ class csstidy {
|
|
419 |
$add = trim('\\' . $add);
|
420 |
}
|
421 |
|
422 |
-
if (@ctype_xdigit($string
|
423 |
-
&& !$replaced || !ctype_space($string
|
424 |
$i--;
|
425 |
}
|
426 |
|
427 |
-
if ($add !== '\\' || !$this->get_cfg('remove_bslash') || strpos($this->tokens_list, $string
|
428 |
return $add;
|
429 |
}
|
430 |
|
@@ -444,7 +479,7 @@ class csstidy {
|
|
444 |
* @access public
|
445 |
* @version 1.4
|
446 |
*/
|
447 |
-
function write_page($filename, $doctype='xhtml1.1', $externalcss=true, $title='', $lang='en') {
|
448 |
$this->write($filename, true);
|
449 |
}
|
450 |
|
@@ -460,7 +495,7 @@ class csstidy {
|
|
460 |
* @access public
|
461 |
* @version 1.4
|
462 |
*/
|
463 |
-
function write($filename, $formatted=false, $doctype='xhtml1.1', $externalcss=true, $title='', $lang='en', $pre_code=true) {
|
464 |
$filename .= ( $formatted) ? '.xhtml' : '.css';
|
465 |
|
466 |
if (!is_dir('temp')) {
|
@@ -489,8 +524,8 @@ class csstidy {
|
|
489 |
* @version 1.1
|
490 |
* @see http://csstidy.sourceforge.net/templates.php
|
491 |
*/
|
492 |
-
function load_template($content, $from_file=true) {
|
493 |
-
$predefined_templates = & $
|
494 |
if ($content === 'high_compression' || $content === 'default' || $content === 'highest_compression' || $content === 'low_compression') {
|
495 |
$this->template = $predefined_templates[$content];
|
496 |
return;
|
@@ -514,7 +549,7 @@ class csstidy {
|
|
514 |
* @access public
|
515 |
* @version 1.0
|
516 |
*/
|
517 |
-
function parse_from_url($url) {
|
518 |
return $this->parse(@file_get_contents($url));
|
519 |
}
|
520 |
|
@@ -525,8 +560,8 @@ class csstidy {
|
|
525 |
* @access public
|
526 |
* @version 1.11
|
527 |
*/
|
528 |
-
function is_token(&$string, $i) {
|
529 |
-
return (strpos($this->tokens_list, $string
|
530 |
}
|
531 |
|
532 |
/**
|
@@ -536,75 +571,81 @@ class csstidy {
|
|
536 |
* @return bool
|
537 |
* @version 1.1
|
538 |
*/
|
539 |
-
function parse($string) {
|
540 |
// Temporarily set locale to en_US in order to handle floats properly
|
541 |
$old = @setlocale(LC_ALL, 0);
|
542 |
@setlocale(LC_ALL, 'C');
|
543 |
|
544 |
// PHP bug? Settings need to be refreshed in PHP4
|
545 |
$this->print = new csstidy_print($this);
|
546 |
-
|
547 |
|
548 |
-
$all_properties = & $
|
549 |
-
$at_rules = & $
|
550 |
-
$quoted_string_properties = & $
|
551 |
|
552 |
$this->css = array();
|
553 |
$this->print->input_css = $string;
|
554 |
$string = str_replace("\r\n", "\n", $string) . ' ';
|
555 |
$cur_comment = '';
|
|
|
556 |
|
557 |
for ($i = 0, $size = strlen($string); $i < $size; $i++) {
|
558 |
-
if ($string
|
559 |
++$this->line;
|
560 |
}
|
561 |
|
562 |
switch ($this->status) {
|
563 |
/* Case in at-block */
|
564 |
case 'at':
|
565 |
-
if (
|
566 |
-
if ($string
|
567 |
$this->status = 'ic';
|
568 |
++$i;
|
569 |
$this->from[] = 'at';
|
570 |
-
} elseif ($string
|
571 |
$this->status = 'is';
|
572 |
-
$this->at = $this->css_new_media_section($this->at);
|
573 |
$this->_add_token(AT_START, $this->at);
|
574 |
-
} elseif ($string
|
575 |
-
$
|
576 |
-
} elseif ($string
|
577 |
-
$
|
578 |
}
|
579 |
// fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
|
580 |
-
|
581 |
-
|
582 |
-
$this->at .= $string{$i};
|
583 |
}
|
584 |
} else {
|
585 |
-
$lastpos = strlen($
|
586 |
-
if (!( (ctype_space($
|
587 |
-
$
|
588 |
}
|
589 |
}
|
590 |
break;
|
591 |
|
592 |
/* Case in-selector */
|
593 |
case 'is':
|
594 |
-
if (
|
595 |
-
if ($string
|
596 |
$this->status = 'ic';
|
597 |
++$i;
|
598 |
$this->from[] = 'is';
|
599 |
-
} elseif ($string
|
600 |
// Check for at-rule
|
601 |
$this->invalid_at = true;
|
602 |
foreach ($at_rules as $name => $type) {
|
603 |
if (!strcasecmp(substr($string, $i + 1, strlen($name)), $name)) {
|
604 |
-
($type === 'at') ? $
|
|
|
|
|
|
|
|
|
|
|
605 |
$this->status = $type;
|
606 |
$i += strlen($name);
|
607 |
$this->invalid_at = false;
|
|
|
608 |
}
|
609 |
}
|
610 |
|
@@ -612,139 +653,131 @@ class csstidy {
|
|
612 |
$this->selector = '@';
|
613 |
$invalid_at_name = '';
|
614 |
for ($j = $i + 1; $j < $size; ++$j) {
|
615 |
-
if (!ctype_alpha($string
|
616 |
break;
|
617 |
}
|
618 |
-
$invalid_at_name .= $string
|
619 |
}
|
620 |
$this->log('Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning');
|
621 |
}
|
622 |
-
} elseif (($string
|
623 |
-
$this->cur_string[] = $string
|
624 |
$this->status = 'instr';
|
625 |
-
$this->str_char[] = $string
|
626 |
$this->from[] = 'is';
|
627 |
/* fixing CSS3 attribute selectors, i.e. a[href$=".mp3" */
|
628 |
-
$this->quoted_string[] = ($string
|
629 |
-
} elseif ($this->invalid_at && $string
|
630 |
$this->invalid_at = false;
|
631 |
$this->status = 'is';
|
632 |
-
|
|
|
|
|
|
|
|
|
|
|
633 |
$this->status = 'ip';
|
634 |
-
if($this->at == '') {
|
635 |
-
$this->at = $this->css_new_media_section(DEFAULT_AT);
|
636 |
}
|
637 |
$this->selector = $this->css_new_selector($this->at,$this->selector);
|
638 |
$this->_add_token(SEL_START, $this->selector);
|
639 |
$this->added = false;
|
640 |
-
} elseif ($string
|
641 |
$this->_add_token(AT_END, $this->at);
|
642 |
-
$this->at =
|
643 |
$this->selector = '';
|
644 |
$this->sel_separate = array();
|
645 |
-
} elseif ($string
|
646 |
$this->selector = trim($this->selector) . ',';
|
647 |
$this->sel_separate[] = strlen($this->selector);
|
648 |
-
} elseif ($string
|
649 |
$this->selector .= $this->_unicode($string, $i);
|
650 |
-
} elseif ($string
|
651 |
-
// remove unnecessary universal selector, FS#147
|
652 |
} else {
|
653 |
-
$this->selector .= $string
|
654 |
}
|
655 |
} else {
|
656 |
$lastpos = strlen($this->selector) - 1;
|
657 |
-
if ($lastpos == -1 || !( (ctype_space($this->selector
|
658 |
-
$this->selector .= $string
|
659 |
-
}
|
660 |
-
else if (ctype_space($string{$i}) && $this->get_cfg('preserve_css') && !$this->get_cfg('merge_selectors')) {
|
661 |
-
$this->selector .= $string{$i};
|
662 |
}
|
663 |
}
|
664 |
break;
|
665 |
|
666 |
/* Case in-property */
|
667 |
case 'ip':
|
668 |
-
if (
|
669 |
-
if (($string
|
670 |
$this->status = 'iv';
|
671 |
-
if (!$this->get_cfg('discard_invalid_properties') ||
|
672 |
$this->property = $this->css_new_property($this->at,$this->selector,$this->property);
|
673 |
$this->_add_token(PROPERTY, $this->property);
|
674 |
}
|
675 |
-
} elseif ($string
|
676 |
$this->status = 'ic';
|
677 |
++$i;
|
678 |
$this->from[] = 'ip';
|
679 |
-
} elseif ($string
|
680 |
$this->explode_selectors();
|
681 |
$this->status = 'is';
|
682 |
$this->invalid_at = false;
|
683 |
$this->_add_token(SEL_END, $this->selector);
|
684 |
$this->selector = '';
|
685 |
$this->property = '';
|
686 |
-
|
|
|
|
|
|
|
|
|
|
|
687 |
$this->property = '';
|
688 |
-
} elseif ($string
|
689 |
$this->property .= $this->_unicode($string, $i);
|
690 |
}
|
691 |
// else this is dumb IE a hack, keep it
|
692 |
-
|
693 |
-
|
|
|
|
|
694 |
}
|
695 |
-
}
|
696 |
-
|
697 |
-
$this->property .= $string{$i};
|
698 |
}
|
699 |
break;
|
700 |
|
701 |
/* Case in-value */
|
702 |
case 'iv':
|
703 |
-
$pn = (($string
|
704 |
-
if (
|
705 |
-
if ($string
|
706 |
$this->status = 'ic';
|
707 |
++$i;
|
708 |
$this->from[] = 'iv';
|
709 |
-
} elseif (($string
|
710 |
-
$this->cur_string[] = $string
|
711 |
-
$this->str_char[] = ($string
|
712 |
$this->status = 'instr';
|
713 |
$this->from[] = 'iv';
|
714 |
$this->quoted_string[] = in_array(strtolower($this->property), $quoted_string_properties);
|
715 |
-
} elseif ($string
|
716 |
$this->sub_value = trim($this->sub_value) . ',';
|
717 |
-
} elseif ($string
|
718 |
$this->sub_value .= $this->_unicode($string, $i);
|
719 |
-
} elseif ($string
|
720 |
-
if ($this->selector
|
|
|
|
|
|
|
721 |
$this->status = 'is';
|
722 |
|
723 |
switch ($this->selector) {
|
724 |
-
case '@charset':
|
725 |
-
/* Add quotes to charset */
|
726 |
-
$this->sub_value_arr[] = '"' . trim($this->sub_value) . '"';
|
727 |
-
$this->charset = $this->sub_value_arr[0];
|
728 |
break;
|
729 |
-
case '@namespace':
|
730 |
-
/* Add quotes to namespace */
|
731 |
-
$this->sub_value_arr[] = '"' . trim($this->sub_value) . '"';
|
732 |
-
$this->namespace = implode(' ', $this->sub_value_arr);
|
733 |
break;
|
734 |
-
case '@import':
|
735 |
-
$this->sub_value = trim($this->sub_value);
|
736 |
-
|
737 |
-
if (empty($this->sub_value_arr)) {
|
738 |
-
// Quote URLs in imports only if they're not already inside url() and not already quoted.
|
739 |
-
if (substr($this->sub_value, 0, 4) != 'url(') {
|
740 |
-
if (!($this->sub_value{0} == substr($this->sub_value, -1) && in_array($this->sub_value{0}, array("'", '"')))) {
|
741 |
-
$this->sub_value = '"' . $this->sub_value . '"';
|
742 |
-
}
|
743 |
-
}
|
744 |
-
}
|
745 |
-
|
746 |
-
$this->sub_value_arr[] = $this->sub_value;
|
747 |
-
$this->import[] = implode(' ', $this->sub_value_arr);
|
748 |
break;
|
749 |
}
|
750 |
|
@@ -755,12 +788,12 @@ class csstidy {
|
|
755 |
} else {
|
756 |
$this->status = 'ip';
|
757 |
}
|
758 |
-
} elseif ($string
|
759 |
-
$this->sub_value .= $string
|
760 |
}
|
761 |
-
if (($string
|
762 |
if ($this->at == '') {
|
763 |
-
$this->at = $this->css_new_media_section(DEFAULT_AT);
|
764 |
}
|
765 |
|
766 |
// case settings
|
@@ -771,36 +804,24 @@ class csstidy {
|
|
771 |
|
772 |
$this->optimise->subvalue();
|
773 |
if ($this->sub_value != '') {
|
774 |
-
|
775 |
-
$format_strings = csstidy::parse_string_list(substr($this->sub_value, 7, -1));
|
776 |
-
if (!$format_strings) {
|
777 |
-
$this->sub_value = "";
|
778 |
-
}
|
779 |
-
else {
|
780 |
-
$this->sub_value = "format(";
|
781 |
-
|
782 |
-
foreach ($format_strings as $format_string) {
|
783 |
-
$this->sub_value .= '"' . str_replace('"', '\\"', $format_string) . '",';
|
784 |
-
}
|
785 |
-
|
786 |
-
$this->sub_value = substr($this->sub_value, 0, -1) . ")";
|
787 |
-
}
|
788 |
-
}
|
789 |
-
if ($this->sub_value != '') {
|
790 |
-
$this->sub_value_arr[] = $this->sub_value;
|
791 |
-
}
|
792 |
$this->sub_value = '';
|
793 |
}
|
794 |
|
795 |
-
$this->value =
|
796 |
-
while(count($this->sub_value_arr)){
|
797 |
-
|
798 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
799 |
}
|
800 |
|
801 |
$this->optimise->value();
|
802 |
|
803 |
-
$valid =
|
804 |
if ((!$this->invalid_at || $this->get_cfg('preserve_css')) && (!$this->get_cfg('discard_invalid_properties') || $valid)) {
|
805 |
$this->css_add_property($this->at, $this->selector, $this->property, $this->value);
|
806 |
$this->_add_token(VALUE, $this->value);
|
@@ -818,17 +839,22 @@ class csstidy {
|
|
818 |
$this->sub_value_arr = array();
|
819 |
$this->value = '';
|
820 |
}
|
821 |
-
if ($string
|
822 |
$this->explode_selectors();
|
823 |
$this->_add_token(SEL_END, $this->selector);
|
824 |
$this->status = 'is';
|
825 |
$this->invalid_at = false;
|
826 |
$this->selector = '';
|
|
|
|
|
|
|
|
|
|
|
827 |
}
|
828 |
} elseif (!$pn) {
|
829 |
-
$this->sub_value .= $string
|
830 |
|
831 |
-
if (ctype_space($string
|
832 |
$this->optimise->subvalue();
|
833 |
if ($this->sub_value != '') {
|
834 |
$this->sub_value_arr[] = $this->sub_value;
|
@@ -842,31 +868,30 @@ class csstidy {
|
|
842 |
case 'instr':
|
843 |
$_str_char = $this->str_char[count($this->str_char)-1];
|
844 |
$_cur_string = $this->cur_string[count($this->cur_string)-1];
|
845 |
-
$
|
|
|
846 |
|
847 |
-
// Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
|
848 |
// parentheticals can be nested more than once.
|
849 |
-
if ($_str_char === ")" && ($string
|
850 |
-
$this->cur_string[] = $string
|
851 |
-
$this->str_char[] = $string
|
852 |
$this->from[] = 'instr';
|
853 |
-
$this->quoted_string[] =
|
854 |
-
continue;
|
855 |
}
|
856 |
|
857 |
-
if ($_str_char !== ")" && ($string
|
858 |
$temp_add = "\\A";
|
859 |
$this->log('Fixed incorrect newline in string', 'Warning');
|
860 |
}
|
861 |
|
862 |
$_cur_string .= $temp_add;
|
863 |
|
864 |
-
if ($string
|
865 |
-
$_quoted_string = array_pop($this->quoted_string);
|
866 |
-
|
867 |
$this->status = array_pop($this->from);
|
868 |
|
869 |
-
if (!preg_match('|[' . implode('', $
|
870 |
if (!$_quoted_string) {
|
871 |
if ($_str_char !== ')') {
|
872 |
// Convert properties like
|
@@ -885,20 +910,21 @@ class csstidy {
|
|
885 |
}
|
886 |
|
887 |
array_pop($this->cur_string);
|
|
|
888 |
array_pop($this->str_char);
|
889 |
|
890 |
-
if ($_str_char ===
|
891 |
-
$_cur_string =
|
892 |
}
|
893 |
|
894 |
if ($this->status === 'iv') {
|
895 |
-
if (!$_quoted_string){
|
896 |
-
if (strpos($_cur_string,',')!==false)
|
897 |
// we can on only remove space next to ','
|
898 |
-
$_cur_string = implode(',',array_map('trim',explode(',',$_cur_string)));
|
899 |
// and multiple spaces (too expensive)
|
900 |
-
if (strpos($_cur_string,' ')!==false)
|
901 |
-
$_cur_string = preg_replace(",\s+,",
|
902 |
}
|
903 |
$this->sub_value .= $_cur_string;
|
904 |
} elseif ($this->status === 'is') {
|
@@ -906,21 +932,26 @@ class csstidy {
|
|
906 |
} elseif ($this->status === 'instr') {
|
907 |
$this->cur_string[count($this->cur_string)-1] .= $_cur_string;
|
908 |
}
|
909 |
-
}
|
910 |
-
else {
|
911 |
$this->cur_string[count($this->cur_string)-1] = $_cur_string;
|
912 |
}
|
913 |
break;
|
914 |
|
915 |
/* Case in-comment */
|
916 |
case 'ic':
|
917 |
-
if ($string
|
918 |
$this->status = array_pop($this->from);
|
919 |
$i++;
|
920 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
$cur_comment = '';
|
922 |
} else {
|
923 |
-
$cur_comment .= $string
|
924 |
}
|
925 |
break;
|
926 |
}
|
@@ -935,12 +966,39 @@ class csstidy {
|
|
935 |
return!(empty($this->css) && empty($this->import) && empty($this->charset) && empty($this->tokens) && empty($this->namespace));
|
936 |
}
|
937 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
/**
|
939 |
* Explodes selectors
|
940 |
* @access private
|
941 |
* @version 1.0
|
942 |
*/
|
943 |
-
function explode_selectors() {
|
944 |
// Explode multiple selectors
|
945 |
if ($this->get_cfg('merge_selectors') === 1) {
|
946 |
$new_sels = array();
|
@@ -976,7 +1034,26 @@ class csstidy {
|
|
976 |
* @version 1.02
|
977 |
*/
|
978 |
static function escaped(&$string, $pos) {
|
979 |
-
return!(@($string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
980 |
}
|
981 |
|
982 |
/**
|
@@ -988,14 +1065,14 @@ class csstidy {
|
|
988 |
* @access private
|
989 |
* @version 1.2
|
990 |
*/
|
991 |
-
function css_add_property($media, $selector, $property, $new_val) {
|
992 |
if ($this->get_cfg('preserve_css') || trim($new_val) == '') {
|
993 |
return;
|
994 |
}
|
995 |
|
996 |
$this->added = true;
|
997 |
if (isset($this->css[$media][$selector][$property])) {
|
998 |
-
if ((
|
999 |
$this->css[$media][$selector][$property] = trim($new_val);
|
1000 |
}
|
1001 |
} else {
|
@@ -1004,37 +1081,85 @@ class csstidy {
|
|
1004 |
}
|
1005 |
|
1006 |
/**
|
1007 |
-
*
|
1008 |
-
*
|
1009 |
-
* else rename it with extra spaces
|
1010 |
-
* to avoid merging
|
1011 |
*
|
1012 |
-
* @param string $media
|
1013 |
-
* @return string
|
1014 |
*/
|
1015 |
-
function
|
1016 |
-
|
|
|
1017 |
return $media;
|
1018 |
}
|
1019 |
|
1020 |
// if the last @media is the same as this
|
1021 |
// keep it
|
1022 |
-
if (!$this->css OR !is_array($this->css) OR empty($this->css)){
|
1023 |
-
return $media;
|
1024 |
-
}
|
1025 |
end($this->css);
|
1026 |
-
|
1027 |
-
if ($at == $media){
|
1028 |
return $media;
|
1029 |
}
|
|
|
|
|
1030 |
while (isset($this->css[$media]))
|
1031 |
if (is_numeric($media))
|
1032 |
$media++;
|
1033 |
else
|
1034 |
-
$media .=
|
1035 |
return $media;
|
1036 |
}
|
1037 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1038 |
/**
|
1039 |
* Start a new selector.
|
1040 |
* If already referenced in this media section,
|
@@ -1048,28 +1173,28 @@ class csstidy {
|
|
1048 |
* @param string $selector
|
1049 |
* @return string
|
1050 |
*/
|
1051 |
-
function css_new_selector($media,$selector){
|
1052 |
-
if($this->get_cfg('preserve_css')) {
|
1053 |
return $selector;
|
1054 |
}
|
1055 |
$selector = trim($selector);
|
1056 |
-
if (strncmp($selector,
|
1057 |
if ($this->settings['merge_selectors'] != false)
|
1058 |
return $selector;
|
1059 |
|
1060 |
-
if (!$this->css
|
1061 |
return $selector;
|
1062 |
|
1063 |
// if last is the same, keep it
|
1064 |
end($this->css[$media]);
|
1065 |
-
|
1066 |
-
if ($sel == $selector){
|
1067 |
return $selector;
|
1068 |
}
|
1069 |
}
|
1070 |
|
1071 |
while (isset($this->css[$media][$selector]))
|
1072 |
-
$selector .=
|
1073 |
return $selector;
|
1074 |
}
|
1075 |
|
@@ -1083,15 +1208,15 @@ class csstidy {
|
|
1083 |
* @param string $property
|
1084 |
* @return string
|
1085 |
*/
|
1086 |
-
function css_new_property($media, $selector, $property){
|
1087 |
-
if($this->get_cfg('preserve_css')) {
|
1088 |
return $property;
|
1089 |
}
|
1090 |
-
if (!$this->css
|
1091 |
return $property;
|
1092 |
|
1093 |
while (isset($this->css[$media][$selector][$property]))
|
1094 |
-
$property .=
|
1095 |
|
1096 |
return $property;
|
1097 |
}
|
@@ -1104,7 +1229,7 @@ class csstidy {
|
|
1104 |
* @access private
|
1105 |
* @version 1.1
|
1106 |
*/
|
1107 |
-
function merge_css_blocks($media, $selector, $css_add) {
|
1108 |
foreach ($css_add as $property => $value) {
|
1109 |
$this->css_add_property($media, $selector, $property, $value, false);
|
1110 |
}
|
@@ -1117,8 +1242,10 @@ class csstidy {
|
|
1117 |
* @access public
|
1118 |
* @version 1.0
|
1119 |
*/
|
1120 |
-
|
1121 |
-
return (
|
|
|
|
|
1122 |
}
|
1123 |
|
1124 |
/**
|
@@ -1128,8 +1255,8 @@ class csstidy {
|
|
1128 |
* @access public
|
1129 |
* @version 1.0
|
1130 |
*/
|
1131 |
-
|
1132 |
-
if (
|
1133 |
$value = trim($value);
|
1134 |
$value = substr($value, 0, -9);
|
1135 |
$value = trim($value);
|
@@ -1148,8 +1275,8 @@ class csstidy {
|
|
1148 |
* @access private
|
1149 |
* @version 1.2
|
1150 |
*/
|
1151 |
-
function property_is_next($istring, $pos) {
|
1152 |
-
$all_properties = & $
|
1153 |
$istring = substr($istring, $pos, strlen($istring) - $pos);
|
1154 |
$pos = strpos($istring, ':');
|
1155 |
if ($pos === false) {
|
@@ -1166,13 +1293,13 @@ class csstidy {
|
|
1166 |
/**
|
1167 |
* Checks if a property is valid
|
1168 |
* @param string $property
|
1169 |
-
* @return bool
|
1170 |
* @access public
|
1171 |
* @version 1.0
|
1172 |
*/
|
1173 |
-
function property_is_valid($property) {
|
1174 |
-
if (in_array(trim($property), $
|
1175 |
-
$all_properties = & $
|
1176 |
return (isset($all_properties[$property]) && strpos($all_properties[$property], strtoupper($this->get_cfg('css_level'))) !== false );
|
1177 |
}
|
1178 |
|
@@ -1190,8 +1317,7 @@ class csstidy {
|
|
1190 |
* @param string
|
1191 |
* @return array
|
1192 |
*/
|
1193 |
-
|
1194 |
-
function parse_string_list($value) {
|
1195 |
$value = trim($value);
|
1196 |
|
1197 |
// Case: empty
|
@@ -1200,33 +1326,29 @@ class csstidy {
|
|
1200 |
$strings = array();
|
1201 |
|
1202 |
$in_str = false;
|
1203 |
-
$current_string =
|
1204 |
|
1205 |
for ($i = 0, $_len = strlen($value); $i < $_len; $i++) {
|
1206 |
-
if (($value
|
1207 |
$in_str = false;
|
1208 |
$strings[] = $current_string;
|
1209 |
-
$current_string =
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
if ($in_str === $value{$i}) {
|
1213 |
$strings[] = $current_string;
|
1214 |
$in_str = false;
|
1215 |
-
$current_string =
|
1216 |
continue;
|
|
|
|
|
1217 |
}
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
if ($in_str){
|
1224 |
-
$current_string .= $value{$i};
|
1225 |
-
}
|
1226 |
-
else {
|
1227 |
-
if (!preg_match("/[\s,]/", $value{$i})) {
|
1228 |
$in_str = true;
|
1229 |
-
$current_string = $value
|
1230 |
}
|
1231 |
}
|
1232 |
}
|
27 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
28 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
29 |
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
|
30 |
+
* @author Cedric Morin (cedric at yterium dot com) 2010-2012
|
31 |
+
* @author Christopher Finke (cfinke at gmail.com) 2012
|
32 |
+
* @author Mark Scherer (remove $GLOBALS once and for all + PHP5.4 comp) 2012
|
33 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
/**
|
36 |
+
* Defines constants
|
37 |
+
* @todo //TODO: make them class constants of csstidy
|
|
|
38 |
*/
|
39 |
+
define('AT_START', 1);
|
40 |
+
define('AT_END', 2);
|
41 |
+
define('SEL_START', 3);
|
42 |
+
define('SEL_END', 4);
|
43 |
+
define('PROPERTY', 5);
|
44 |
+
define('VALUE', 6);
|
45 |
+
define('COMMENT', 7);
|
46 |
+
define('IMPORTANT_COMMENT',8);
|
47 |
+
define('DEFAULT_AT', 41);
|
48 |
|
49 |
/**
|
50 |
* Contains a class for printing CSS code
|
51 |
*
|
52 |
+
* @version 1.1.0
|
53 |
*/
|
54 |
require('class.csstidy_print.php');
|
55 |
|
63 |
/**
|
64 |
* CSS Parser class
|
65 |
*
|
|
|
66 |
* This class represents a CSS parser which reads CSS code and saves it in an array.
|
67 |
* In opposite to most other CSS parsers, it does not use regular expressions and
|
68 |
* thus has full CSS2 support and a higher reliability.
|
70 |
* An online version should be available here: http://cdburnerxp.se/cssparse/css_optimiser.php
|
71 |
* @package csstidy
|
72 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
73 |
+
* @version 1.7.3
|
74 |
*/
|
75 |
class csstidy {
|
76 |
|
79 |
* @var array
|
80 |
* @access public
|
81 |
*/
|
82 |
+
public $css = array();
|
83 |
/**
|
84 |
* Saves the parsed CSS (raw)
|
85 |
* @var array
|
86 |
* @access private
|
87 |
*/
|
88 |
+
public $tokens = array();
|
89 |
/**
|
90 |
* Printer class
|
91 |
* @see csstidy_print
|
92 |
* @var object
|
93 |
* @access public
|
94 |
*/
|
95 |
+
public $print;
|
96 |
/**
|
97 |
* Optimiser class
|
98 |
* @see csstidy_optimise
|
99 |
* @var object
|
100 |
* @access private
|
101 |
*/
|
102 |
+
public $optimise;
|
103 |
/**
|
104 |
* Saves the CSS charset (@charset)
|
105 |
* @var string
|
106 |
* @access private
|
107 |
*/
|
108 |
+
public $charset = '';
|
109 |
/**
|
110 |
* Saves all @import URLs
|
111 |
* @var array
|
112 |
* @access private
|
113 |
*/
|
114 |
+
public $import = array();
|
115 |
/**
|
116 |
* Saves the namespace
|
117 |
* @var string
|
118 |
* @access private
|
119 |
*/
|
120 |
+
public $namespace = '';
|
121 |
/**
|
122 |
* Contains the version of csstidy
|
123 |
* @var string
|
124 |
* @access private
|
125 |
*/
|
126 |
+
public $version = '1.7.3';
|
127 |
/**
|
128 |
* Stores the settings
|
129 |
* @var array
|
130 |
* @access private
|
131 |
*/
|
132 |
+
public $settings = array();
|
133 |
/**
|
134 |
* Saves the parser-status.
|
135 |
*
|
144 |
* @var string
|
145 |
* @access private
|
146 |
*/
|
147 |
+
public $status = 'is';
|
148 |
/**
|
149 |
* Saves the current at rule (@media)
|
150 |
* @var string
|
151 |
* @access private
|
152 |
*/
|
153 |
+
public $at = '';
|
154 |
+
/**
|
155 |
+
* Saves the at rule for next selector (during @font-face or other @)
|
156 |
+
* @var string
|
157 |
+
* @access private
|
158 |
+
*/
|
159 |
+
public $next_selector_at = '';
|
160 |
+
|
161 |
/**
|
162 |
* Saves the current selector
|
163 |
* @var string
|
164 |
* @access private
|
165 |
*/
|
166 |
+
public $selector = '';
|
167 |
/**
|
168 |
* Saves the current property
|
169 |
* @var string
|
170 |
* @access private
|
171 |
*/
|
172 |
+
public $property = '';
|
173 |
/**
|
174 |
* Saves the position of , in selectors
|
175 |
* @var array
|
176 |
* @access private
|
177 |
*/
|
178 |
+
public $sel_separate = array();
|
179 |
/**
|
180 |
* Saves the current value
|
181 |
* @var string
|
182 |
* @access private
|
183 |
*/
|
184 |
+
public $value = '';
|
185 |
/**
|
186 |
* Saves the current sub-value
|
187 |
*
|
192 |
* @var string
|
193 |
* @access private
|
194 |
*/
|
195 |
+
public $sub_value = '';
|
196 |
/**
|
197 |
* Array which saves all subvalues for a property.
|
198 |
* @var array
|
199 |
* @see sub_value
|
200 |
* @access private
|
201 |
*/
|
202 |
+
public $sub_value_arr = array();
|
203 |
/**
|
204 |
* Saves the stack of characters that opened the current strings
|
205 |
* @var array
|
206 |
* @access private
|
207 |
*/
|
208 |
+
public $str_char = array();
|
209 |
+
public $cur_string = array();
|
210 |
/**
|
211 |
* Status from which the parser switched to ic or instr
|
212 |
* @var array
|
213 |
* @access private
|
214 |
*/
|
215 |
+
public $from = array();
|
216 |
/**
|
217 |
/**
|
218 |
* =true if in invalid at-rule
|
219 |
* @var bool
|
220 |
* @access private
|
221 |
*/
|
222 |
+
public $invalid_at = false;
|
223 |
/**
|
224 |
* =true if something has been added to the current selector
|
225 |
* @var bool
|
226 |
* @access private
|
227 |
*/
|
228 |
+
public $added = false;
|
229 |
/**
|
230 |
* Array which saves the message log
|
231 |
* @var array
|
232 |
* @access private
|
233 |
*/
|
234 |
+
public $log = array();
|
235 |
/**
|
236 |
* Saves the line number
|
237 |
* @var integer
|
238 |
* @access private
|
239 |
*/
|
240 |
+
public $line = 1;
|
241 |
/**
|
242 |
* Marks if we need to leave quotes for a string
|
243 |
* @var array
|
244 |
* @access private
|
245 |
*/
|
246 |
+
public $quoted_string = array();
|
247 |
|
248 |
/**
|
249 |
* List of tokens
|
250 |
* @var string
|
251 |
*/
|
252 |
+
public $tokens_list = "";
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Various CSS Data for CSSTidy
|
256 |
+
* @var array
|
257 |
+
*/
|
258 |
+
public $data = array();
|
259 |
+
|
260 |
/**
|
261 |
* Loads standard template and sets default settings
|
262 |
* @access private
|
263 |
* @version 1.3
|
264 |
*/
|
265 |
+
public function __construct() {
|
266 |
+
$data = array();
|
267 |
+
include('data.inc.php');
|
268 |
+
$this->data = $data;
|
269 |
+
|
270 |
$this->settings['remove_bslash'] = true;
|
271 |
$this->settings['compress_colors'] = true;
|
272 |
$this->settings['compress_font-weight'] = true;
|
273 |
$this->settings['lowercase_s'] = false;
|
274 |
/*
|
275 |
+
1 common shorthands optimization
|
276 |
+
2 + font property optimization
|
277 |
+
3 + background property optimization
|
278 |
*/
|
279 |
$this->settings['optimise_shorthands'] = 1;
|
280 |
$this->settings['remove_last_;'] = true;
|
281 |
+
$this->settings['space_before_important'] = false;
|
282 |
/* rewrite all properties with low case, better for later gzip OK, safe*/
|
283 |
$this->settings['case_properties'] = 1;
|
284 |
/* sort properties in alpabetic order, better for later gzip
|
286 |
*/
|
287 |
$this->settings['sort_properties'] = false;
|
288 |
/*
|
289 |
+
1, 3, 5, etc -- enable sorting selectors inside @media: a{}b{}c{}
|
290 |
+
2, 5, 8, etc -- enable sorting selectors inside one CSS declaration: a,b,c{}
|
291 |
+
preserve order by default cause it can break functionnality
|
292 |
*/
|
293 |
$this->settings['sort_selectors'] = 0;
|
294 |
/* is dangeroues to be used: CSS is broken sometimes */
|
295 |
$this->settings['merge_selectors'] = 0;
|
296 |
/* preserve or not browser hacks */
|
297 |
+
|
298 |
+
/* Useful to produce a rtl css from a ltr one (or the opposite) */
|
299 |
+
$this->settings['reverse_left_and_right'] = 0;
|
300 |
+
|
301 |
$this->settings['discard_invalid_selectors'] = false;
|
302 |
$this->settings['discard_invalid_properties'] = false;
|
303 |
+
$this->settings['css_level'] = 'CSS3.0';
|
304 |
$this->settings['preserve_css'] = false;
|
305 |
$this->settings['timestamp'] = false;
|
306 |
$this->settings['template'] = ''; // say that propertie exist
|
307 |
$this->set_cfg('template','default'); // call load_template
|
308 |
$this->optimise = new csstidy_optimise($this);
|
309 |
|
310 |
+
$this->tokens_list = & $this->data['csstidy']['tokens'];
|
311 |
}
|
312 |
|
313 |
/**
|
317 |
* @return mixed
|
318 |
* @version 1.0
|
319 |
*/
|
320 |
+
public function get_cfg($setting) {
|
321 |
if (isset($this->settings[$setting])) {
|
322 |
return $this->settings[$setting];
|
323 |
}
|
330 |
* @access private
|
331 |
* @version 1.4
|
332 |
*/
|
333 |
+
public function _load_template($template) {
|
334 |
switch ($template) {
|
335 |
case 'default':
|
336 |
$this->load_template('default');
|
362 |
* @return bool
|
363 |
* @version 1.0
|
364 |
*/
|
365 |
+
public function set_cfg($setting, $value=null) {
|
366 |
if (is_array($setting) && $value === null) {
|
367 |
foreach ($setting as $setprop => $setval) {
|
368 |
$this->settings[$setprop] = $setval;
|
371 |
$this->_load_template($this->settings['template']);
|
372 |
}
|
373 |
return true;
|
374 |
+
} elseif (isset($this->settings[$setting]) && $value !== '') {
|
375 |
$this->settings[$setting] = $value;
|
376 |
if ($setting === 'template') {
|
377 |
$this->_load_template($this->settings['template']);
|
389 |
* @access private
|
390 |
* @version 1.0
|
391 |
*/
|
392 |
+
public function _add_token($type, $data, $do = false) {
|
393 |
if ($this->get_cfg('preserve_css') || $do) {
|
394 |
+
// nested @... : if opening a new part we just closed, remove the previous closing instead of adding opening
|
395 |
+
if ($type === AT_START
|
396 |
+
and count($this->tokens)
|
397 |
+
and $last = end($this->tokens)
|
398 |
+
and $last[0] === AT_END
|
399 |
+
and $last[1] === trim($data)) {
|
400 |
+
array_pop($this->tokens);
|
401 |
+
}
|
402 |
+
else {
|
403 |
+
$this->tokens[] = array($type, ($type == COMMENT or $type == IMPORTANT_COMMENT) ? $data : trim($data));
|
404 |
+
}
|
405 |
}
|
406 |
}
|
407 |
|
413 |
* @access private
|
414 |
* @version 1.0
|
415 |
*/
|
416 |
+
public function log($message, $type, $line = -1) {
|
417 |
if ($line === -1) {
|
418 |
$line = $this->line;
|
419 |
}
|
432 |
* @return string
|
433 |
* @version 1.2
|
434 |
*/
|
435 |
+
public function _unicode(&$string, &$i) {
|
436 |
++$i;
|
437 |
$add = '';
|
438 |
$replaced = false;
|
439 |
|
440 |
+
while ($i < strlen($string) && (ctype_xdigit($string[$i]) || ctype_space($string[$i])) && strlen($add) < 6) {
|
441 |
+
$add .= $string[$i];
|
442 |
|
443 |
+
if (ctype_space($string[$i])) {
|
444 |
break;
|
445 |
}
|
446 |
$i++;
|
454 |
$add = trim('\\' . $add);
|
455 |
}
|
456 |
|
457 |
+
if (@ctype_xdigit($string[$i + 1]) && ctype_space($string[$i])
|
458 |
+
&& !$replaced || !ctype_space($string[$i])) {
|
459 |
$i--;
|
460 |
}
|
461 |
|
462 |
+
if ($add !== '\\' || !$this->get_cfg('remove_bslash') || strpos($this->tokens_list, $string[$i + 1]) !== false) {
|
463 |
return $add;
|
464 |
}
|
465 |
|
479 |
* @access public
|
480 |
* @version 1.4
|
481 |
*/
|
482 |
+
public function write_page($filename, $doctype='xhtml1.1', $externalcss=true, $title='', $lang='en') {
|
483 |
$this->write($filename, true);
|
484 |
}
|
485 |
|
495 |
* @access public
|
496 |
* @version 1.4
|
497 |
*/
|
498 |
+
public function write($filename, $formatted=false, $doctype='xhtml1.1', $externalcss=true, $title='', $lang='en', $pre_code=true) {
|
499 |
$filename .= ( $formatted) ? '.xhtml' : '.css';
|
500 |
|
501 |
if (!is_dir('temp')) {
|
524 |
* @version 1.1
|
525 |
* @see http://csstidy.sourceforge.net/templates.php
|
526 |
*/
|
527 |
+
public function load_template($content, $from_file=true) {
|
528 |
+
$predefined_templates = & $this->data['csstidy']['predefined_templates'];
|
529 |
if ($content === 'high_compression' || $content === 'default' || $content === 'highest_compression' || $content === 'low_compression') {
|
530 |
$this->template = $predefined_templates[$content];
|
531 |
return;
|
549 |
* @access public
|
550 |
* @version 1.0
|
551 |
*/
|
552 |
+
public function parse_from_url($url) {
|
553 |
return $this->parse(@file_get_contents($url));
|
554 |
}
|
555 |
|
560 |
* @access public
|
561 |
* @version 1.11
|
562 |
*/
|
563 |
+
public function is_token(&$string, $i) {
|
564 |
+
return (strpos($this->tokens_list, $string[$i]) !== false && !$this->escaped($string, $i));
|
565 |
}
|
566 |
|
567 |
/**
|
571 |
* @return bool
|
572 |
* @version 1.1
|
573 |
*/
|
574 |
+
public function parse($string) {
|
575 |
// Temporarily set locale to en_US in order to handle floats properly
|
576 |
$old = @setlocale(LC_ALL, 0);
|
577 |
@setlocale(LC_ALL, 'C');
|
578 |
|
579 |
// PHP bug? Settings need to be refreshed in PHP4
|
580 |
$this->print = new csstidy_print($this);
|
581 |
+
$this->optimise = new csstidy_optimise($this);
|
582 |
|
583 |
+
$all_properties = & $this->data['csstidy']['all_properties'];
|
584 |
+
$at_rules = & $this->data['csstidy']['at_rules'];
|
585 |
+
$quoted_string_properties = & $this->data['csstidy']['quoted_string_properties'];
|
586 |
|
587 |
$this->css = array();
|
588 |
$this->print->input_css = $string;
|
589 |
$string = str_replace("\r\n", "\n", $string) . ' ';
|
590 |
$cur_comment = '';
|
591 |
+
$cur_at = '';
|
592 |
|
593 |
for ($i = 0, $size = strlen($string); $i < $size; $i++) {
|
594 |
+
if ($string[$i] === "\n" || $string[$i] === "\r") {
|
595 |
++$this->line;
|
596 |
}
|
597 |
|
598 |
switch ($this->status) {
|
599 |
/* Case in at-block */
|
600 |
case 'at':
|
601 |
+
if ($this->is_token($string, $i)) {
|
602 |
+
if ($string[$i] === '/' && @$string[$i + 1] === '*') {
|
603 |
$this->status = 'ic';
|
604 |
++$i;
|
605 |
$this->from[] = 'at';
|
606 |
+
} elseif ($string[$i] === '{') {
|
607 |
$this->status = 'is';
|
608 |
+
$this->at = $this->css_new_media_section($this->at, $cur_at);
|
609 |
$this->_add_token(AT_START, $this->at);
|
610 |
+
} elseif ($string[$i] === ',') {
|
611 |
+
$cur_at = trim($cur_at) . ',';
|
612 |
+
} elseif ($string[$i] === '\\') {
|
613 |
+
$cur_at .= $this->_unicode($string, $i);
|
614 |
}
|
615 |
// fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
|
616 |
+
elseif (in_array($string[$i], array('(', ')', ':', '.', '/'))) {
|
617 |
+
$cur_at .= $string[$i];
|
|
|
618 |
}
|
619 |
} else {
|
620 |
+
$lastpos = strlen($cur_at) - 1;
|
621 |
+
if (!( (ctype_space($cur_at[$lastpos]) || $this->is_token($cur_at, $lastpos) && $cur_at[$lastpos] === ',') && ctype_space($string[$i]))) {
|
622 |
+
$cur_at .= $string[$i];
|
623 |
}
|
624 |
}
|
625 |
break;
|
626 |
|
627 |
/* Case in-selector */
|
628 |
case 'is':
|
629 |
+
if ($this->is_token($string, $i)) {
|
630 |
+
if ($string[$i] === '/' && @$string[$i + 1] === '*' && trim($this->selector) == '') {
|
631 |
$this->status = 'ic';
|
632 |
++$i;
|
633 |
$this->from[] = 'is';
|
634 |
+
} elseif ($string[$i] === '@' && trim($this->selector) == '') {
|
635 |
// Check for at-rule
|
636 |
$this->invalid_at = true;
|
637 |
foreach ($at_rules as $name => $type) {
|
638 |
if (!strcasecmp(substr($string, $i + 1, strlen($name)), $name)) {
|
639 |
+
($type === 'at') ? $cur_at = '@' . $name : $this->selector = '@' . $name;
|
640 |
+
if ($type === 'atis') {
|
641 |
+
$this->next_selector_at = ($this->next_selector_at?$this->next_selector_at:($this->at?$this->at:DEFAULT_AT));
|
642 |
+
$this->at = $this->css_new_media_section($this->at, ' ', true);
|
643 |
+
$type = 'is';
|
644 |
+
}
|
645 |
$this->status = $type;
|
646 |
$i += strlen($name);
|
647 |
$this->invalid_at = false;
|
648 |
+
break;
|
649 |
}
|
650 |
}
|
651 |
|
653 |
$this->selector = '@';
|
654 |
$invalid_at_name = '';
|
655 |
for ($j = $i + 1; $j < $size; ++$j) {
|
656 |
+
if (!ctype_alpha($string[$j])) {
|
657 |
break;
|
658 |
}
|
659 |
+
$invalid_at_name .= $string[$j];
|
660 |
}
|
661 |
$this->log('Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning');
|
662 |
}
|
663 |
+
} elseif (($string[$i] === '"' || $string[$i] === "'")) {
|
664 |
+
$this->cur_string[] = $string[$i];
|
665 |
$this->status = 'instr';
|
666 |
+
$this->str_char[] = $string[$i];
|
667 |
$this->from[] = 'is';
|
668 |
/* fixing CSS3 attribute selectors, i.e. a[href$=".mp3" */
|
669 |
+
$this->quoted_string[] = ($string[$i - 1] === '=' );
|
670 |
+
} elseif ($this->invalid_at && $string[$i] === ';') {
|
671 |
$this->invalid_at = false;
|
672 |
$this->status = 'is';
|
673 |
+
if ($this->next_selector_at) {
|
674 |
+
$this->at = $this->css_close_media_section($this->at);
|
675 |
+
$this->at = $this->css_new_media_section($this->at, $this->next_selector_at);
|
676 |
+
$this->next_selector_at = '';
|
677 |
+
}
|
678 |
+
} elseif ($string[$i] === '{') {
|
679 |
$this->status = 'ip';
|
680 |
+
if ($this->at == '') {
|
681 |
+
$this->at = $this->css_new_media_section($this->at, DEFAULT_AT);
|
682 |
}
|
683 |
$this->selector = $this->css_new_selector($this->at,$this->selector);
|
684 |
$this->_add_token(SEL_START, $this->selector);
|
685 |
$this->added = false;
|
686 |
+
} elseif ($string[$i] === '}') {
|
687 |
$this->_add_token(AT_END, $this->at);
|
688 |
+
$this->at = $this->css_close_media_section($this->at);
|
689 |
$this->selector = '';
|
690 |
$this->sel_separate = array();
|
691 |
+
} elseif ($string[$i] === ',') {
|
692 |
$this->selector = trim($this->selector) . ',';
|
693 |
$this->sel_separate[] = strlen($this->selector);
|
694 |
+
} elseif ($string[$i] === '\\') {
|
695 |
$this->selector .= $this->_unicode($string, $i);
|
696 |
+
} elseif ($string[$i] === '*' && @in_array($string[$i + 1], array('.', '#', '[', ':')) && ($i==0 OR $string[$i - 1]!=='/')) {
|
697 |
+
// remove unnecessary universal selector, FS#147, but not comment in selector
|
698 |
} else {
|
699 |
+
$this->selector .= $string[$i];
|
700 |
}
|
701 |
} else {
|
702 |
$lastpos = strlen($this->selector) - 1;
|
703 |
+
if ($lastpos == -1 || !( (ctype_space($this->selector[$lastpos]) || $this->is_token($this->selector, $lastpos) && $this->selector[$lastpos] === ',') && ctype_space($string[$i]))) {
|
704 |
+
$this->selector .= $string[$i];
|
|
|
|
|
|
|
705 |
}
|
706 |
}
|
707 |
break;
|
708 |
|
709 |
/* Case in-property */
|
710 |
case 'ip':
|
711 |
+
if ($this->is_token($string, $i)) {
|
712 |
+
if (($string[$i] === ':' || $string[$i] === '=') && $this->property != '') {
|
713 |
$this->status = 'iv';
|
714 |
+
if (!$this->get_cfg('discard_invalid_properties') || $this->property_is_valid($this->property)) {
|
715 |
$this->property = $this->css_new_property($this->at,$this->selector,$this->property);
|
716 |
$this->_add_token(PROPERTY, $this->property);
|
717 |
}
|
718 |
+
} elseif ($string[$i] === '/' && @$string[$i + 1] === '*' && $this->property == '') {
|
719 |
$this->status = 'ic';
|
720 |
++$i;
|
721 |
$this->from[] = 'ip';
|
722 |
+
} elseif ($string[$i] === '}') {
|
723 |
$this->explode_selectors();
|
724 |
$this->status = 'is';
|
725 |
$this->invalid_at = false;
|
726 |
$this->_add_token(SEL_END, $this->selector);
|
727 |
$this->selector = '';
|
728 |
$this->property = '';
|
729 |
+
if ($this->next_selector_at) {
|
730 |
+
$this->at = $this->css_close_media_section($this->at);
|
731 |
+
$this->at = $this->css_new_media_section($this->at, $this->next_selector_at);
|
732 |
+
$this->next_selector_at = '';
|
733 |
+
}
|
734 |
+
} elseif ($string[$i] === ';') {
|
735 |
$this->property = '';
|
736 |
+
} elseif ($string[$i] === '\\') {
|
737 |
$this->property .= $this->_unicode($string, $i);
|
738 |
}
|
739 |
// else this is dumb IE a hack, keep it
|
740 |
+
// including //
|
741 |
+
elseif (($this->property === '' && !ctype_space($string[$i]))
|
742 |
+
|| ($this->property === '/' || $string[$i] === '/')) {
|
743 |
+
$this->property .= $string[$i];
|
744 |
}
|
745 |
+
} elseif (!ctype_space($string[$i])) {
|
746 |
+
$this->property .= $string[$i];
|
|
|
747 |
}
|
748 |
break;
|
749 |
|
750 |
/* Case in-value */
|
751 |
case 'iv':
|
752 |
+
$pn = (($string[$i] === "\n" || $string[$i] === "\r") && $this->property_is_next($string, $i + 1) || $i == strlen($string) - 1);
|
753 |
+
if ($this->is_token($string, $i) || $pn) {
|
754 |
+
if ($string[$i] === '/' && @$string[$i + 1] === '*') {
|
755 |
$this->status = 'ic';
|
756 |
++$i;
|
757 |
$this->from[] = 'iv';
|
758 |
+
} elseif (($string[$i] === '"' || $string[$i] === "'" || $string[$i] === '(')) {
|
759 |
+
$this->cur_string[] = $string[$i];
|
760 |
+
$this->str_char[] = ($string[$i] === '(') ? ')' : $string[$i];
|
761 |
$this->status = 'instr';
|
762 |
$this->from[] = 'iv';
|
763 |
$this->quoted_string[] = in_array(strtolower($this->property), $quoted_string_properties);
|
764 |
+
} elseif ($string[$i] === ',') {
|
765 |
$this->sub_value = trim($this->sub_value) . ',';
|
766 |
+
} elseif ($string[$i] === '\\') {
|
767 |
$this->sub_value .= $this->_unicode($string, $i);
|
768 |
+
} elseif ($string[$i] === ';' || $pn) {
|
769 |
+
if ($this->selector[0] === '@' && isset($at_rules[substr($this->selector, 1)]) && $at_rules[substr($this->selector, 1)] === 'iv') {
|
770 |
+
/* Add quotes to charset, import, namespace */
|
771 |
+
$this->sub_value_arr[] = trim($this->sub_value);
|
772 |
+
|
773 |
$this->status = 'is';
|
774 |
|
775 |
switch ($this->selector) {
|
776 |
+
case '@charset': $this->charset = '"'.$this->sub_value_arr[0].'"';
|
|
|
|
|
|
|
777 |
break;
|
778 |
+
case '@namespace': $this->namespace = implode(' ', $this->sub_value_arr);
|
|
|
|
|
|
|
779 |
break;
|
780 |
+
case '@import': $this->import[] = implode(' ', $this->sub_value_arr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
break;
|
782 |
}
|
783 |
|
788 |
} else {
|
789 |
$this->status = 'ip';
|
790 |
}
|
791 |
+
} elseif ($string[$i] !== '}') {
|
792 |
+
$this->sub_value .= $string[$i];
|
793 |
}
|
794 |
+
if (($string[$i] === '}' || $string[$i] === ';' || $pn) && !empty($this->selector)) {
|
795 |
if ($this->at == '') {
|
796 |
+
$this->at = $this->css_new_media_section($this->at,DEFAULT_AT);
|
797 |
}
|
798 |
|
799 |
// case settings
|
804 |
|
805 |
$this->optimise->subvalue();
|
806 |
if ($this->sub_value != '') {
|
807 |
+
$this->sub_value_arr[] = $this->sub_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
$this->sub_value = '';
|
809 |
}
|
810 |
|
811 |
+
$this->value = '';
|
812 |
+
while (count($this->sub_value_arr)) {
|
813 |
+
$sub = array_shift($this->sub_value_arr);
|
814 |
+
if (strstr($this->selector, 'font-face')) {
|
815 |
+
$sub = $this->quote_font_format($sub);
|
816 |
+
}
|
817 |
+
|
818 |
+
if ($sub != '')
|
819 |
+
$this->value .= ((!strlen($this->value) || substr($this->value,-1,1) === ',')?'':' ').$sub;
|
820 |
}
|
821 |
|
822 |
$this->optimise->value();
|
823 |
|
824 |
+
$valid = $this->property_is_valid($this->property);
|
825 |
if ((!$this->invalid_at || $this->get_cfg('preserve_css')) && (!$this->get_cfg('discard_invalid_properties') || $valid)) {
|
826 |
$this->css_add_property($this->at, $this->selector, $this->property, $this->value);
|
827 |
$this->_add_token(VALUE, $this->value);
|
839 |
$this->sub_value_arr = array();
|
840 |
$this->value = '';
|
841 |
}
|
842 |
+
if ($string[$i] === '}') {
|
843 |
$this->explode_selectors();
|
844 |
$this->_add_token(SEL_END, $this->selector);
|
845 |
$this->status = 'is';
|
846 |
$this->invalid_at = false;
|
847 |
$this->selector = '';
|
848 |
+
if ($this->next_selector_at) {
|
849 |
+
$this->at = $this->css_close_media_section($this->at);
|
850 |
+
$this->at = $this->css_new_media_section($this->at, $this->next_selector_at);
|
851 |
+
$this->next_selector_at = '';
|
852 |
+
}
|
853 |
}
|
854 |
} elseif (!$pn) {
|
855 |
+
$this->sub_value .= $string[$i];
|
856 |
|
857 |
+
if (ctype_space($string[$i])) {
|
858 |
$this->optimise->subvalue();
|
859 |
if ($this->sub_value != '') {
|
860 |
$this->sub_value_arr[] = $this->sub_value;
|
868 |
case 'instr':
|
869 |
$_str_char = $this->str_char[count($this->str_char)-1];
|
870 |
$_cur_string = $this->cur_string[count($this->cur_string)-1];
|
871 |
+
$_quoted_string = $this->quoted_string[count($this->quoted_string)-1];
|
872 |
+
$temp_add = $string[$i];
|
873 |
|
874 |
+
// Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
|
875 |
// parentheticals can be nested more than once.
|
876 |
+
if ($_str_char === ")" && ($string[$i] === "(" || $string[$i] === '"' || $string[$i] === '\'') && !$this->escaped($string, $i)) {
|
877 |
+
$this->cur_string[] = $string[$i];
|
878 |
+
$this->str_char[] = $string[$i] === '(' ? ')' : $string[$i];
|
879 |
$this->from[] = 'instr';
|
880 |
+
$this->quoted_string[] = ($_str_char === ')' && $string[$i] !== '(' && trim($_cur_string)==='(')?$_quoted_string:!($string[$i] === '(');
|
881 |
+
continue 2;
|
882 |
}
|
883 |
|
884 |
+
if ($_str_char !== ")" && ($string[$i] === "\n" || $string[$i] === "\r") && !($string[$i - 1] === '\\' && !$this->escaped($string, $i - 1))) {
|
885 |
$temp_add = "\\A";
|
886 |
$this->log('Fixed incorrect newline in string', 'Warning');
|
887 |
}
|
888 |
|
889 |
$_cur_string .= $temp_add;
|
890 |
|
891 |
+
if ($string[$i] === $_str_char && !$this->escaped($string, $i)) {
|
|
|
|
|
892 |
$this->status = array_pop($this->from);
|
893 |
|
894 |
+
if (!preg_match('|[' . implode('', $this->data['csstidy']['whitespace']) . ']|uis', $_cur_string) && $this->property !== 'content') {
|
895 |
if (!$_quoted_string) {
|
896 |
if ($_str_char !== ')') {
|
897 |
// Convert properties like
|
910 |
}
|
911 |
|
912 |
array_pop($this->cur_string);
|
913 |
+
array_pop($this->quoted_string);
|
914 |
array_pop($this->str_char);
|
915 |
|
916 |
+
if ($_str_char === ')') {
|
917 |
+
$_cur_string = '(' . trim(substr($_cur_string, 1, -1)) . ')';
|
918 |
}
|
919 |
|
920 |
if ($this->status === 'iv') {
|
921 |
+
if (!$_quoted_string) {
|
922 |
+
if (strpos($_cur_string,',') !== false)
|
923 |
// we can on only remove space next to ','
|
924 |
+
$_cur_string = implode(',', array_map('trim', explode(',',$_cur_string)));
|
925 |
// and multiple spaces (too expensive)
|
926 |
+
if (strpos($_cur_string, ' ') !== false)
|
927 |
+
$_cur_string = preg_replace(",\s+,", ' ', $_cur_string);
|
928 |
}
|
929 |
$this->sub_value .= $_cur_string;
|
930 |
} elseif ($this->status === 'is') {
|
932 |
} elseif ($this->status === 'instr') {
|
933 |
$this->cur_string[count($this->cur_string)-1] .= $_cur_string;
|
934 |
}
|
935 |
+
} else {
|
|
|
936 |
$this->cur_string[count($this->cur_string)-1] = $_cur_string;
|
937 |
}
|
938 |
break;
|
939 |
|
940 |
/* Case in-comment */
|
941 |
case 'ic':
|
942 |
+
if ($string[$i] === '*' && $string[$i + 1] === '/') {
|
943 |
$this->status = array_pop($this->from);
|
944 |
$i++;
|
945 |
+
if (strlen($cur_comment) > 1 and strncmp($cur_comment, '!', 1) === 0) {
|
946 |
+
$this->_add_token(IMPORTANT_COMMENT, $cur_comment);
|
947 |
+
$this->css_add_important_comment($cur_comment);
|
948 |
+
}
|
949 |
+
else {
|
950 |
+
$this->_add_token(COMMENT, $cur_comment);
|
951 |
+
}
|
952 |
$cur_comment = '';
|
953 |
} else {
|
954 |
+
$cur_comment .= $string[$i];
|
955 |
}
|
956 |
break;
|
957 |
}
|
966 |
return!(empty($this->css) && empty($this->import) && empty($this->charset) && empty($this->tokens) && empty($this->namespace));
|
967 |
}
|
968 |
|
969 |
+
|
970 |
+
/**
|
971 |
+
* format() in font-face needs quoted values for somes browser (FF at least)
|
972 |
+
*
|
973 |
+
* @param $value
|
974 |
+
* @return string
|
975 |
+
*/
|
976 |
+
public function quote_font_format($value) {
|
977 |
+
if (strncmp($value,'format',6) == 0) {
|
978 |
+
$p = strpos($value,')',7);
|
979 |
+
$end = substr($value,$p);
|
980 |
+
$format_strings = $this->parse_string_list(substr($value, 7, $p-7));
|
981 |
+
if (!$format_strings) {
|
982 |
+
$value = '';
|
983 |
+
} else {
|
984 |
+
$value = 'format(';
|
985 |
+
|
986 |
+
foreach ($format_strings as $format_string) {
|
987 |
+
$value .= '"' . str_replace('"', '\\"', $format_string) . '",';
|
988 |
+
}
|
989 |
+
|
990 |
+
$value = substr($value, 0, -1) . $end;
|
991 |
+
}
|
992 |
+
}
|
993 |
+
return $value;
|
994 |
+
}
|
995 |
+
|
996 |
/**
|
997 |
* Explodes selectors
|
998 |
* @access private
|
999 |
* @version 1.0
|
1000 |
*/
|
1001 |
+
public function explode_selectors() {
|
1002 |
// Explode multiple selectors
|
1003 |
if ($this->get_cfg('merge_selectors') === 1) {
|
1004 |
$new_sels = array();
|
1034 |
* @version 1.02
|
1035 |
*/
|
1036 |
static function escaped(&$string, $pos) {
|
1037 |
+
return!(@($string[$pos - 1] !== '\\') || csstidy::escaped($string, $pos - 1));
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
|
1041 |
+
/**
|
1042 |
+
* Add an important comment to the css code
|
1043 |
+
* (one we want to keep)
|
1044 |
+
* @param $comment
|
1045 |
+
*/
|
1046 |
+
public function css_add_important_comment($comment) {
|
1047 |
+
if ($this->get_cfg('preserve_css') || trim($comment) == '') {
|
1048 |
+
return;
|
1049 |
+
}
|
1050 |
+
if (!isset($this->css['!'])) {
|
1051 |
+
$this->css['!'] = '';
|
1052 |
+
}
|
1053 |
+
else {
|
1054 |
+
$this->css['!'] .= "\n";
|
1055 |
+
}
|
1056 |
+
$this->css['!'] .= $comment;
|
1057 |
}
|
1058 |
|
1059 |
/**
|
1065 |
* @access private
|
1066 |
* @version 1.2
|
1067 |
*/
|
1068 |
+
public function css_add_property($media, $selector, $property, $new_val) {
|
1069 |
if ($this->get_cfg('preserve_css') || trim($new_val) == '') {
|
1070 |
return;
|
1071 |
}
|
1072 |
|
1073 |
$this->added = true;
|
1074 |
if (isset($this->css[$media][$selector][$property])) {
|
1075 |
+
if (($this->is_important($this->css[$media][$selector][$property]) && $this->is_important($new_val)) || !$this->is_important($this->css[$media][$selector][$property])) {
|
1076 |
$this->css[$media][$selector][$property] = trim($new_val);
|
1077 |
}
|
1078 |
} else {
|
1081 |
}
|
1082 |
|
1083 |
/**
|
1084 |
+
* Check if a current media section is the continuation of the last one
|
1085 |
+
* if not inc the name of the media section to avoid a merging
|
|
|
|
|
1086 |
*
|
1087 |
+
* @param int|string $media
|
1088 |
+
* @return int|string
|
1089 |
*/
|
1090 |
+
public function css_check_last_media_section_or_inc($media) {
|
1091 |
+
// are we starting?
|
1092 |
+
if (!$this->css || !is_array($this->css) || empty($this->css)) {
|
1093 |
return $media;
|
1094 |
}
|
1095 |
|
1096 |
// if the last @media is the same as this
|
1097 |
// keep it
|
|
|
|
|
|
|
1098 |
end($this->css);
|
1099 |
+
$at = key($this->css);
|
1100 |
+
if ($at == $media) {
|
1101 |
return $media;
|
1102 |
}
|
1103 |
+
|
1104 |
+
// else inc the section in the array
|
1105 |
while (isset($this->css[$media]))
|
1106 |
if (is_numeric($media))
|
1107 |
$media++;
|
1108 |
else
|
1109 |
+
$media .= ' ';
|
1110 |
return $media;
|
1111 |
}
|
1112 |
|
1113 |
+
/**
|
1114 |
+
* Start a new media section.
|
1115 |
+
* Check if the media is not already known,
|
1116 |
+
* else rename it with extra spaces
|
1117 |
+
* to avoid merging
|
1118 |
+
*
|
1119 |
+
* @param string $current_media
|
1120 |
+
* @param string $media
|
1121 |
+
* @param bool $at_root
|
1122 |
+
* @return string
|
1123 |
+
*/
|
1124 |
+
public function css_new_media_section($current_media, $new_media, $at_root = false) {
|
1125 |
+
if ($this->get_cfg('preserve_css')) {
|
1126 |
+
return $new_media;
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
// if we already are in a media and CSS level is 3, manage nested medias
|
1130 |
+
if ($current_media
|
1131 |
+
&& !$at_root
|
1132 |
+
// numeric $current_media means DEFAULT_AT or inc
|
1133 |
+
&& !is_numeric($current_media)
|
1134 |
+
&& strncmp($this->get_cfg('css_level'), 'CSS3', 4) == 0) {
|
1135 |
+
|
1136 |
+
$new_media = rtrim($current_media) . "{" . rtrim($new_media);
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
return $this->css_check_last_media_section_or_inc($new_media);
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* Close a media section
|
1144 |
+
* Find the parent media we were in before or the root
|
1145 |
+
* @param $current_media
|
1146 |
+
* @return string
|
1147 |
+
*/
|
1148 |
+
public function css_close_media_section($current_media) {
|
1149 |
+
if ($this->get_cfg('preserve_css')) {
|
1150 |
+
return '';
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
if (strpos($current_media, '{') !== false) {
|
1154 |
+
$current_media = explode('{', $current_media);
|
1155 |
+
array_pop($current_media);
|
1156 |
+
$current_media = implode('{', $current_media);
|
1157 |
+
return $current_media;
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
return '';
|
1161 |
+
}
|
1162 |
+
|
1163 |
/**
|
1164 |
* Start a new selector.
|
1165 |
* If already referenced in this media section,
|
1173 |
* @param string $selector
|
1174 |
* @return string
|
1175 |
*/
|
1176 |
+
public function css_new_selector($media,$selector) {
|
1177 |
+
if ($this->get_cfg('preserve_css')) {
|
1178 |
return $selector;
|
1179 |
}
|
1180 |
$selector = trim($selector);
|
1181 |
+
if (strncmp($selector,'@font-face',10)!=0) {
|
1182 |
if ($this->settings['merge_selectors'] != false)
|
1183 |
return $selector;
|
1184 |
|
1185 |
+
if (!$this->css || !isset($this->css[$media]) || !$this->css[$media])
|
1186 |
return $selector;
|
1187 |
|
1188 |
// if last is the same, keep it
|
1189 |
end($this->css[$media]);
|
1190 |
+
$sel = key($this->css[$media]);
|
1191 |
+
if ($sel == $selector) {
|
1192 |
return $selector;
|
1193 |
}
|
1194 |
}
|
1195 |
|
1196 |
while (isset($this->css[$media][$selector]))
|
1197 |
+
$selector .= ' ';
|
1198 |
return $selector;
|
1199 |
}
|
1200 |
|
1208 |
* @param string $property
|
1209 |
* @return string
|
1210 |
*/
|
1211 |
+
public function css_new_property($media, $selector, $property) {
|
1212 |
+
if ($this->get_cfg('preserve_css')) {
|
1213 |
return $property;
|
1214 |
}
|
1215 |
+
if (!$this->css || !isset($this->css[$media][$selector]) || !$this->css[$media][$selector])
|
1216 |
return $property;
|
1217 |
|
1218 |
while (isset($this->css[$media][$selector][$property]))
|
1219 |
+
$property .= ' ';
|
1220 |
|
1221 |
return $property;
|
1222 |
}
|
1229 |
* @access private
|
1230 |
* @version 1.1
|
1231 |
*/
|
1232 |
+
public function merge_css_blocks($media, $selector, $css_add) {
|
1233 |
foreach ($css_add as $property => $value) {
|
1234 |
$this->css_add_property($media, $selector, $property, $value, false);
|
1235 |
}
|
1242 |
* @access public
|
1243 |
* @version 1.0
|
1244 |
*/
|
1245 |
+
public function is_important(&$value) {
|
1246 |
+
return (
|
1247 |
+
strpos($value, '!') !== false // quick test
|
1248 |
+
AND !strcasecmp(substr(str_replace($this->data['csstidy']['whitespace'], '', $value), -10, 10), '!important'));
|
1249 |
}
|
1250 |
|
1251 |
/**
|
1255 |
* @access public
|
1256 |
* @version 1.0
|
1257 |
*/
|
1258 |
+
public function gvw_important($value) {
|
1259 |
+
if ($this->is_important($value)) {
|
1260 |
$value = trim($value);
|
1261 |
$value = substr($value, 0, -9);
|
1262 |
$value = trim($value);
|
1275 |
* @access private
|
1276 |
* @version 1.2
|
1277 |
*/
|
1278 |
+
public function property_is_next($istring, $pos) {
|
1279 |
+
$all_properties = & $this->data['csstidy']['all_properties'];
|
1280 |
$istring = substr($istring, $pos, strlen($istring) - $pos);
|
1281 |
$pos = strpos($istring, ':');
|
1282 |
if ($pos === false) {
|
1293 |
/**
|
1294 |
* Checks if a property is valid
|
1295 |
* @param string $property
|
1296 |
+
* @return bool
|
1297 |
* @access public
|
1298 |
* @version 1.0
|
1299 |
*/
|
1300 |
+
public function property_is_valid($property) {
|
1301 |
+
if (in_array(trim($property), $this->data['csstidy']['multiple_properties'])) $property = trim($property);
|
1302 |
+
$all_properties = & $this->data['csstidy']['all_properties'];
|
1303 |
return (isset($all_properties[$property]) && strpos($all_properties[$property], strtoupper($this->get_cfg('css_level'))) !== false );
|
1304 |
}
|
1305 |
|
1317 |
* @param string
|
1318 |
* @return array
|
1319 |
*/
|
1320 |
+
public function parse_string_list($value) {
|
|
|
1321 |
$value = trim($value);
|
1322 |
|
1323 |
// Case: empty
|
1326 |
$strings = array();
|
1327 |
|
1328 |
$in_str = false;
|
1329 |
+
$current_string = '';
|
1330 |
|
1331 |
for ($i = 0, $_len = strlen($value); $i < $_len; $i++) {
|
1332 |
+
if (($value[$i] === ',' || $value[$i] === ' ') && $in_str === true) {
|
1333 |
$in_str = false;
|
1334 |
$strings[] = $current_string;
|
1335 |
+
$current_string = '';
|
1336 |
+
} elseif ($value[$i] === '"' || $value[$i] === "'") {
|
1337 |
+
if ($in_str === $value[$i]) {
|
|
|
1338 |
$strings[] = $current_string;
|
1339 |
$in_str = false;
|
1340 |
+
$current_string = '';
|
1341 |
continue;
|
1342 |
+
} elseif (!$in_str) {
|
1343 |
+
$in_str = $value[$i];
|
1344 |
}
|
1345 |
+
} else {
|
1346 |
+
if ($in_str) {
|
1347 |
+
$current_string .= $value[$i];
|
1348 |
+
} else {
|
1349 |
+
if (!preg_match("/[\s,]/", $value[$i])) {
|
|
|
|
|
|
|
|
|
|
|
1350 |
$in_str = true;
|
1351 |
+
$current_string = $value[$i];
|
1352 |
}
|
1353 |
}
|
1354 |
}
|
classes/csstidy/class.csstidy_ctype.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* CSSTidy - CSS Parser and Optimiser
|
5 |
-
*
|
6 |
-
* CSS ctype functions
|
7 |
-
* Defines some functions that can be not defined.
|
8 |
-
*
|
9 |
-
* This file is part of CSSTidy.
|
10 |
-
*
|
11 |
-
* CSSTidy is free software; you can redistribute it and/or modify
|
12 |
-
* it under the terms of the GNU General Public License as published by
|
13 |
-
* the Free Software Foundation; either version 2 of the License, or
|
14 |
-
* (at your option) any later version.
|
15 |
-
*
|
16 |
-
* CSSTidy is distributed in the hope that it will be useful,
|
17 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
-
* GNU General Public License for more details.
|
20 |
-
*
|
21 |
-
* You should have received a copy of the GNU General Public License
|
22 |
-
* along with CSSTidy; if not, write to the Free Software
|
23 |
-
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
-
*
|
25 |
-
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
26 |
-
* @package csstidy
|
27 |
-
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
|
28 |
-
* @version 1.0
|
29 |
-
*/
|
30 |
-
/* ctype_space Check for whitespace character(s) */
|
31 |
-
if (!function_exists('ctype_space')) {
|
32 |
-
|
33 |
-
function ctype_space($text) {
|
34 |
-
return!preg_match("/[^\s\r\n\t\f]/", $text);
|
35 |
-
}
|
36 |
-
|
37 |
-
}
|
38 |
-
/* ctype_alpha Check for alphabetic character(s) */
|
39 |
-
if (!function_exists('ctype_alpha')) {
|
40 |
-
|
41 |
-
function ctype_alpha($text) {
|
42 |
-
return preg_match("/[a-zA-Z]/", $text);
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
46 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/csstidy/class.csstidy_optimise.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU Lesser General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU Lesser General Public License
|
24 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25 |
*
|
@@ -28,6 +28,7 @@
|
|
28 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
29 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
30 |
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
|
|
|
31 |
*/
|
32 |
|
33 |
/**
|
@@ -41,14 +42,20 @@
|
|
41 |
*/
|
42 |
class csstidy_optimise {
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
/**
|
45 |
* Constructor
|
46 |
* @param array $css contains the class csstidy
|
47 |
* @access private
|
48 |
* @version 1.0
|
49 |
*/
|
50 |
-
function __construct(
|
51 |
-
$this->parser =
|
52 |
$this->css = & $css->css;
|
53 |
$this->sub_value = & $css->sub_value;
|
54 |
$this->at = & $css->at;
|
@@ -62,41 +69,61 @@ class csstidy_optimise {
|
|
62 |
* @access public
|
63 |
* @version 1.0
|
64 |
*/
|
65 |
-
function postparse() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
if ($this->parser->get_cfg('preserve_css')) {
|
67 |
return;
|
68 |
}
|
69 |
|
70 |
-
if ($this->parser->get_cfg('merge_selectors') === 2) {
|
71 |
foreach ($this->css as $medium => $value) {
|
72 |
-
|
|
|
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
if ($this->parser->get_cfg('discard_invalid_selectors')) {
|
77 |
foreach ($this->css as $medium => $value) {
|
78 |
-
|
|
|
|
|
79 |
}
|
80 |
}
|
81 |
|
82 |
if ($this->parser->get_cfg('optimise_shorthands') > 0) {
|
83 |
foreach ($this->css as $medium => $value) {
|
84 |
-
|
85 |
-
$
|
|
|
|
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
100 |
}
|
101 |
}
|
102 |
}
|
@@ -108,12 +135,12 @@ class csstidy_optimise {
|
|
108 |
* @access public
|
109 |
* @version 1.0
|
110 |
*/
|
111 |
-
function value() {
|
112 |
-
$shorthands = & $
|
113 |
|
114 |
// optimise shorthand properties
|
115 |
if (isset($shorthands[$this->property])) {
|
116 |
-
$temp =
|
117 |
if ($temp != $this->value) {
|
118 |
$this->parser->log('Optimised shorthand notation (' . $this->property . '): Changed "' . $this->value . '" to "' . $temp . '"', 'Information');
|
119 |
}
|
@@ -131,8 +158,8 @@ class csstidy_optimise {
|
|
131 |
* @access public
|
132 |
* @version 1.0
|
133 |
*/
|
134 |
-
function shorthands() {
|
135 |
-
$shorthands = & $
|
136 |
|
137 |
if (!$this->parser->get_cfg('optimise_shorthands') || $this->parser->get_cfg('preserve_css')) {
|
138 |
return;
|
@@ -140,14 +167,14 @@ class csstidy_optimise {
|
|
140 |
|
141 |
if ($this->property === 'font' && $this->parser->get_cfg('optimise_shorthands') > 1) {
|
142 |
$this->css[$this->at][$this->selector]['font']='';
|
143 |
-
$this->parser->merge_css_blocks($this->at, $this->selector,
|
144 |
}
|
145 |
if ($this->property === 'background' && $this->parser->get_cfg('optimise_shorthands') > 2) {
|
146 |
$this->css[$this->at][$this->selector]['background']='';
|
147 |
-
$this->parser->merge_css_blocks($this->at, $this->selector,
|
148 |
}
|
149 |
if (isset($shorthands[$this->property])) {
|
150 |
-
$this->parser->merge_css_blocks($this->at, $this->selector,
|
151 |
if (is_array($shorthands[$this->property])) {
|
152 |
$this->css[$this->at][$this->selector][$this->property] = '';
|
153 |
}
|
@@ -159,8 +186,8 @@ class csstidy_optimise {
|
|
159 |
* @access public
|
160 |
* @version 1.0
|
161 |
*/
|
162 |
-
function subvalue() {
|
163 |
-
$replace_colors = & $
|
164 |
|
165 |
$this->sub_value = trim($this->sub_value);
|
166 |
if ($this->sub_value == '') { // caution : '0'
|
@@ -168,17 +195,17 @@ class csstidy_optimise {
|
|
168 |
}
|
169 |
|
170 |
$important = '';
|
171 |
-
if (
|
172 |
$important = '!important';
|
173 |
}
|
174 |
-
$this->sub_value =
|
175 |
|
176 |
// Compress font-weight
|
177 |
if ($this->property === 'font-weight' && $this->parser->get_cfg('compress_font-weight')) {
|
178 |
if ($this->sub_value === 'bold') {
|
179 |
$this->sub_value = '700';
|
180 |
$this->parser->log('Optimised font-weight: Changed "bold" to "700"', 'Information');
|
181 |
-
}
|
182 |
$this->sub_value = '400';
|
183 |
$this->parser->log('Optimised font-weight: Changed "normal" to "400"', 'Information');
|
184 |
}
|
@@ -214,10 +241,10 @@ class csstidy_optimise {
|
|
214 |
* @return string
|
215 |
* @version 1.0
|
216 |
*/
|
217 |
-
function shorthand($value) {
|
218 |
$important = '';
|
219 |
-
if (
|
220 |
-
$values =
|
221 |
$important = '!important';
|
222 |
}
|
223 |
else
|
@@ -260,9 +287,10 @@ class csstidy_optimise {
|
|
260 |
* @access public
|
261 |
* @version 1.1
|
262 |
*/
|
263 |
-
function compress_important(&$string) {
|
264 |
-
if (
|
265 |
-
$
|
|
|
266 |
}
|
267 |
return $string;
|
268 |
}
|
@@ -273,11 +301,35 @@ class csstidy_optimise {
|
|
273 |
* @return string
|
274 |
* @version 1.1
|
275 |
*/
|
276 |
-
function cut_color($color) {
|
277 |
-
$replace_colors = & $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
// rgb(0,0,0) -> #000000 (or #000 in this case later)
|
280 |
-
if (
|
281 |
$color_tmp = substr($color, 4, strlen($color) - 5);
|
282 |
$color_tmp = explode(',', $color_tmp);
|
283 |
for ($i = 0; $i < count($color_tmp); $i++) {
|
@@ -306,8 +358,8 @@ class csstidy_optimise {
|
|
306 |
// #aabbcc -> #abc
|
307 |
if (strlen($color) == 7) {
|
308 |
$color_temp = strtolower($color);
|
309 |
-
if ($color_temp
|
310 |
-
$color = '#' . $color
|
311 |
}
|
312 |
}
|
313 |
|
@@ -340,9 +392,9 @@ class csstidy_optimise {
|
|
340 |
* @return string
|
341 |
* @version 1.2
|
342 |
*/
|
343 |
-
function compress_numbers($subvalue) {
|
344 |
-
$unit_values = & $
|
345 |
-
$color_values = & $
|
346 |
|
347 |
// for font:1em/1em sans-serif...;
|
348 |
if ($this->property === 'font') {
|
@@ -350,6 +402,7 @@ class csstidy_optimise {
|
|
350 |
} else {
|
351 |
$temp = array($subvalue);
|
352 |
}
|
|
|
353 |
for ($l = 0; $l < count($temp); $l++) {
|
354 |
// if we are not dealing with a number at this point, do not optimise anything
|
355 |
$number = $this->AnalyseCssNumber($temp[$l]);
|
@@ -359,12 +412,7 @@ class csstidy_optimise {
|
|
359 |
|
360 |
// Fix bad colors
|
361 |
if (in_array($this->property, $color_values)) {
|
362 |
-
|
363 |
-
$temp[$l] = '#' . $temp[$l];
|
364 |
-
}
|
365 |
-
else {
|
366 |
-
$temp[$l] = "0";
|
367 |
-
}
|
368 |
continue;
|
369 |
}
|
370 |
|
@@ -372,9 +420,9 @@ class csstidy_optimise {
|
|
372 |
if ($number[1] == '' && in_array($this->property, $unit_values, true)) {
|
373 |
$number[1] = 'px';
|
374 |
}
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
|
379 |
$temp[$l] = $number[0] . $number[1];
|
380 |
}
|
@@ -388,13 +436,13 @@ class csstidy_optimise {
|
|
388 |
* @param string $string
|
389 |
* @return array ('unit' if unit is found or '' if no unit exists, number value) or false if no number
|
390 |
*/
|
391 |
-
function AnalyseCssNumber($string) {
|
392 |
// most simple checks first
|
393 |
-
if (strlen($string) == 0 || ctype_alpha($string
|
394 |
return false;
|
395 |
}
|
396 |
|
397 |
-
$units = & $
|
398 |
$return = array(0, '');
|
399 |
|
400 |
$return[0] = floatval($string);
|
@@ -433,7 +481,7 @@ class csstidy_optimise {
|
|
433 |
* @access public
|
434 |
* @version 1.2
|
435 |
*/
|
436 |
-
function merge_selectors(&$array) {
|
437 |
$css = $array;
|
438 |
foreach ($css as $key => $value) {
|
439 |
if (!isset($css[$key])) {
|
@@ -474,7 +522,7 @@ class csstidy_optimise {
|
|
474 |
* regular expression
|
475 |
* @version 1.4
|
476 |
*/
|
477 |
-
function discard_invalid_selectors(&$array) {
|
478 |
$invalid = array('+' => true, '~' => true, ',' => true, '>' => true);
|
479 |
foreach ($array as $selector => $decls) {
|
480 |
$ok = true;
|
@@ -497,20 +545,23 @@ class csstidy_optimise {
|
|
497 |
* Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...
|
498 |
* @param string $property
|
499 |
* @param string $value
|
|
|
500 |
* @return array
|
501 |
* @version 1.0
|
502 |
* @see merge_4value_shorthands()
|
503 |
*/
|
504 |
-
function dissolve_4value_shorthands($property, $value) {
|
505 |
-
$shorthands
|
|
|
|
|
506 |
if (!is_array($shorthands[$property])) {
|
507 |
$return[$property] = $value;
|
508 |
return $return;
|
509 |
}
|
510 |
|
511 |
$important = '';
|
512 |
-
if (
|
513 |
-
$value =
|
514 |
$important = '!important';
|
515 |
}
|
516 |
$values = explode(' ', $value);
|
@@ -539,82 +590,161 @@ class csstidy_optimise {
|
|
539 |
return $return;
|
540 |
}
|
541 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
/**
|
543 |
* Explodes a string as explode() does, however, not if $sep is escaped or within a string.
|
544 |
* @param string $sep seperator
|
545 |
* @param string $string
|
|
|
546 |
* @return array
|
547 |
* @version 1.0
|
548 |
*/
|
549 |
-
function explode_ws($sep, $string) {
|
550 |
$status = 'st';
|
551 |
$to = '';
|
552 |
|
553 |
-
$output = array(
|
|
|
|
|
554 |
$num = 0;
|
555 |
for ($i = 0, $len = strlen($string); $i < $len; $i++) {
|
556 |
switch ($status) {
|
557 |
case 'st':
|
558 |
-
if ($string
|
559 |
++$num;
|
560 |
-
} elseif ($string
|
561 |
$status = 'str';
|
562 |
-
$to = ($string
|
563 |
-
(isset($output[$num])) ? $output[$num] .= $string
|
564 |
} else {
|
565 |
-
(isset($output[$num])) ? $output[$num] .= $string
|
566 |
}
|
567 |
break;
|
568 |
|
569 |
case 'str':
|
570 |
-
if ($string
|
571 |
$status = 'st';
|
572 |
}
|
573 |
-
(isset($output[$num])) ? $output[$num] .= $string
|
574 |
break;
|
575 |
}
|
576 |
}
|
577 |
|
578 |
-
|
579 |
-
return $output;
|
580 |
-
} else {
|
581 |
-
return array($output);
|
582 |
-
}
|
583 |
}
|
584 |
|
585 |
/**
|
586 |
* Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
|
587 |
* @param array $array
|
|
|
588 |
* @return array
|
589 |
* @version 1.2
|
590 |
* @see dissolve_4value_shorthands()
|
591 |
*/
|
592 |
-
function merge_4value_shorthands($array) {
|
593 |
$return = $array;
|
594 |
-
$shorthands
|
|
|
|
|
595 |
|
596 |
foreach ($shorthands as $key => $value) {
|
597 |
-
if (isset($array[$value[0]]) && isset($array[$value[1]])
|
598 |
-
&& isset($array[$value[2]]) && isset($array[$value[3]])
|
599 |
$return[$key] = '';
|
600 |
|
601 |
$important = '';
|
602 |
for ($i = 0; $i < 4; $i++) {
|
603 |
$val = $array[$value[$i]];
|
604 |
-
if (
|
605 |
$important = '!important';
|
606 |
-
$return[$key] .=
|
607 |
} else {
|
608 |
$return[$key] .= $val . ' ';
|
609 |
}
|
610 |
unset($return[$value[$i]]);
|
611 |
}
|
612 |
-
$return[$key] =
|
613 |
}
|
614 |
}
|
615 |
return $return;
|
616 |
}
|
617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
/**
|
619 |
* Dissolve background property
|
620 |
* @param string $str_value
|
@@ -623,12 +753,12 @@ class csstidy_optimise {
|
|
623 |
* @see merge_bg()
|
624 |
* @todo full CSS 3 compliance
|
625 |
*/
|
626 |
-
function dissolve_short_bg($str_value) {
|
627 |
// don't try to explose background gradient !
|
628 |
-
if (stripos($str_value,
|
629 |
return array('background'=>$str_value);
|
630 |
-
|
631 |
-
$background_prop_default = & $
|
632 |
$repeat = array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'space');
|
633 |
$attachment = array('scroll', 'fixed', 'local');
|
634 |
$clip = array('border', 'padding');
|
@@ -637,12 +767,12 @@ class csstidy_optimise {
|
|
637 |
$important = '';
|
638 |
$return = array('background-image' => null, 'background-size' => null, 'background-repeat' => null, 'background-position' => null, 'background-attachment' => null, 'background-clip' => null, 'background-origin' => null, 'background-color' => null);
|
639 |
|
640 |
-
if (
|
641 |
$important = ' !important';
|
642 |
-
$str_value =
|
643 |
}
|
644 |
|
645 |
-
$str_value =
|
646 |
for ($i = 0; $i < count($str_value); $i++) {
|
647 |
$have['clip'] = false;
|
648 |
$have['pos'] = false;
|
@@ -652,7 +782,7 @@ class csstidy_optimise {
|
|
652 |
if (is_array($str_value[$i])) {
|
653 |
$str_value[$i] = $str_value[$i][0];
|
654 |
}
|
655 |
-
$str_value[$i] =
|
656 |
|
657 |
for ($j = 0; $j < count($str_value[$i]); $j++) {
|
658 |
if ($have['bg'] === false && (substr($str_value[$i][$j], 0, 4) === 'url(' || $str_value[$i][$j] === 'none')) {
|
@@ -667,16 +797,15 @@ class csstidy_optimise {
|
|
667 |
$have['clip'] = true;
|
668 |
} elseif (in_array($str_value[$i][$j], $origin, true)) {
|
669 |
$return['background-origin'] .= $str_value[$i][$j] . ',';
|
670 |
-
} elseif ($str_value[$i][$j]
|
671 |
$return['background-size'] .= substr($str_value[$i][$j], 1, -1) . ',';
|
672 |
-
} elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j]
|
673 |
$return['background-position'] .= $str_value[$i][$j];
|
674 |
if (!$have['pos'])
|
675 |
$return['background-position'] .= ' '; else
|
676 |
$return['background-position'].= ',';
|
677 |
$have['pos'] = true;
|
678 |
-
}
|
679 |
-
elseif (!$have['color']) {
|
680 |
$return['background-color'] .= $str_value[$i][$j] . ',';
|
681 |
$have['color'] = true;
|
682 |
}
|
@@ -701,19 +830,19 @@ class csstidy_optimise {
|
|
701 |
* @see dissolve_short_bg()
|
702 |
* @todo full CSS 3 compliance
|
703 |
*/
|
704 |
-
function merge_bg($input_css) {
|
705 |
-
$background_prop_default = & $
|
706 |
// Max number of background images. CSS3 not yet fully implemented
|
707 |
-
$number_of_values = @max(count(
|
708 |
// Array with background images to check if BG image exists
|
709 |
-
$bg_img_array =
|
710 |
$new_bg_value = '';
|
711 |
$important = '';
|
712 |
|
713 |
// if background properties is here and not empty, don't try anything
|
714 |
-
if (isset($input_css['background'])
|
715 |
return $input_css;
|
716 |
-
|
717 |
for ($i = 0; $i < $number_of_values; $i++) {
|
718 |
foreach ($background_prop_default as $bg_property => $default_value) {
|
719 |
// Skip if property does not exist
|
@@ -723,7 +852,7 @@ class csstidy_optimise {
|
|
723 |
|
724 |
$cur_value = $input_css[$bg_property];
|
725 |
// skip all optimisation if gradient() somewhere
|
726 |
-
if (stripos($cur_value,
|
727 |
return $input_css;
|
728 |
|
729 |
// Skip some properties if there is no background image
|
@@ -734,9 +863,9 @@ class csstidy_optimise {
|
|
734 |
}
|
735 |
|
736 |
// Remove !important
|
737 |
-
if (
|
738 |
$important = ' !important';
|
739 |
-
$cur_value =
|
740 |
}
|
741 |
|
742 |
// Do not add default values
|
@@ -744,7 +873,7 @@ class csstidy_optimise {
|
|
744 |
continue;
|
745 |
}
|
746 |
|
747 |
-
$temp =
|
748 |
|
749 |
if (isset($temp[$i])) {
|
750 |
if ($bg_property === 'background-size') {
|
@@ -781,17 +910,17 @@ class csstidy_optimise {
|
|
781 |
* @version 1.3
|
782 |
* @see merge_font()
|
783 |
*/
|
784 |
-
function dissolve_short_font($str_value) {
|
785 |
-
$font_prop_default = & $
|
786 |
$font_weight = array('normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900);
|
787 |
$font_variant = array('normal', 'small-caps');
|
788 |
$font_style = array('normal', 'italic', 'oblique');
|
789 |
$important = '';
|
790 |
$return = array('font-style' => null, 'font-variant' => null, 'font-weight' => null, 'font-size' => null, 'line-height' => null, 'font-family' => null);
|
791 |
|
792 |
-
if (
|
793 |
$important = '!important';
|
794 |
-
$str_value =
|
795 |
}
|
796 |
|
797 |
$have['style'] = false;
|
@@ -802,9 +931,9 @@ class csstidy_optimise {
|
|
802 |
$multiwords = false;
|
803 |
|
804 |
// Workaround with multiple font-family
|
805 |
-
$str_value =
|
806 |
|
807 |
-
$str_value[0] =
|
808 |
|
809 |
for ($j = 0; $j < count($str_value[0]); $j++) {
|
810 |
if ($have['weight'] === false && in_array($str_value[0][$j], $font_weight)) {
|
@@ -816,8 +945,8 @@ class csstidy_optimise {
|
|
816 |
} elseif ($have['style'] === false && in_array($str_value[0][$j], $font_style)) {
|
817 |
$return['font-style'] = $str_value[0][$j];
|
818 |
$have['style'] = true;
|
819 |
-
} elseif ($have['size'] === false && (is_numeric($str_value[0][$j]
|
820 |
-
$size =
|
821 |
$return['font-size'] = $size[0];
|
822 |
if (isset($size[1])) {
|
823 |
$return['line-height'] = $size[1];
|
@@ -846,7 +975,7 @@ class csstidy_optimise {
|
|
846 |
|
847 |
// Fix for 100 and more font-size
|
848 |
if ($have['size'] === false && isset($return['font-weight']) &&
|
849 |
-
is_numeric($return['font-weight']
|
850 |
$return['font-size'] = $return['font-weight'];
|
851 |
unset($return['font-weight']);
|
852 |
}
|
@@ -868,27 +997,27 @@ class csstidy_optimise {
|
|
868 |
* @version 1.3
|
869 |
* @see dissolve_short_font()
|
870 |
*/
|
871 |
-
function merge_font($input_css) {
|
872 |
-
$font_prop_default = & $
|
873 |
$new_font_value = '';
|
874 |
$important = '';
|
875 |
// Skip if not font-family and font-size set
|
876 |
-
if (isset($input_css['font-family']) && isset($input_css['font-size'])) {
|
877 |
// fix several words in font-family - add quotes
|
878 |
if (isset($input_css['font-family'])) {
|
879 |
-
$families = explode(
|
880 |
$result_families = array();
|
881 |
foreach ($families as $family) {
|
882 |
$family = trim($family);
|
883 |
$len = strlen($family);
|
884 |
-
if (strpos($family,
|
885 |
-
!(($family
|
886 |
-
($family
|
887 |
$family = '"' . $family . '"';
|
888 |
}
|
889 |
$result_families[] = $family;
|
890 |
}
|
891 |
-
$input_css['font-family'] = implode(
|
892 |
}
|
893 |
foreach ($font_prop_default as $font_property => $default_value) {
|
894 |
|
@@ -905,9 +1034,9 @@ class csstidy_optimise {
|
|
905 |
}
|
906 |
|
907 |
// Remove !important
|
908 |
-
if (
|
909 |
$important = '!important';
|
910 |
-
$cur_value =
|
911 |
}
|
912 |
|
913 |
$new_font_value .= $cur_value;
|
@@ -920,7 +1049,7 @@ class csstidy_optimise {
|
|
920 |
|
921 |
// Delete all font-properties
|
922 |
foreach ($font_prop_default as $font_property => $default_value) {
|
923 |
-
if ($font_property!=='font'
|
924 |
unset($input_css[$font_property]);
|
925 |
}
|
926 |
|
@@ -933,4 +1062,246 @@ class csstidy_optimise {
|
|
933 |
return $input_css;
|
934 |
}
|
935 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
}
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU Lesser General Public License for more details.
|
22 |
+
*
|
23 |
* You should have received a copy of the GNU Lesser General Public License
|
24 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25 |
*
|
28 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
29 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
30 |
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
|
31 |
+
* @author Cedric Morin (cedric at yterium dot com) 2010-2012
|
32 |
*/
|
33 |
|
34 |
/**
|
42 |
*/
|
43 |
class csstidy_optimise {
|
44 |
|
45 |
+
/**
|
46 |
+
* csstidy object
|
47 |
+
* @var object
|
48 |
+
*/
|
49 |
+
public $parser;
|
50 |
+
|
51 |
/**
|
52 |
* Constructor
|
53 |
* @param array $css contains the class csstidy
|
54 |
* @access private
|
55 |
* @version 1.0
|
56 |
*/
|
57 |
+
public function __construct($css) {
|
58 |
+
$this->parser = $css;
|
59 |
$this->css = & $css->css;
|
60 |
$this->sub_value = & $css->sub_value;
|
61 |
$this->at = & $css->at;
|
69 |
* @access public
|
70 |
* @version 1.0
|
71 |
*/
|
72 |
+
public function postparse() {
|
73 |
+
|
74 |
+
if ($this->parser->get_cfg('reverse_left_and_right') > 0) {
|
75 |
+
|
76 |
+
foreach ($this->css as $medium => $selectors) {
|
77 |
+
if (is_array($selectors)) {
|
78 |
+
foreach ($selectors as $selector => $properties) {
|
79 |
+
$this->css[$medium][$selector] = $this->reverse_left_and_right($this->css[$medium][$selector]);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
if ($this->parser->get_cfg('preserve_css')) {
|
87 |
return;
|
88 |
}
|
89 |
|
90 |
+
if ((int)$this->parser->get_cfg('merge_selectors') === 2) {
|
91 |
foreach ($this->css as $medium => $value) {
|
92 |
+
if (is_array($value)) {
|
93 |
+
$this->merge_selectors($this->css[$medium]);
|
94 |
+
}
|
95 |
}
|
96 |
}
|
97 |
|
98 |
if ($this->parser->get_cfg('discard_invalid_selectors')) {
|
99 |
foreach ($this->css as $medium => $value) {
|
100 |
+
if (is_array($value)) {
|
101 |
+
$this->discard_invalid_selectors($this->css[$medium]);
|
102 |
+
}
|
103 |
}
|
104 |
}
|
105 |
|
106 |
if ($this->parser->get_cfg('optimise_shorthands') > 0) {
|
107 |
foreach ($this->css as $medium => $value) {
|
108 |
+
if (is_array($value)) {
|
109 |
+
foreach ($value as $selector => $value1) {
|
110 |
+
$this->css[$medium][$selector] = $this->merge_4value_shorthands($this->css[$medium][$selector]);
|
111 |
+
$this->css[$medium][$selector] = $this->merge_4value_radius_shorthands($this->css[$medium][$selector]);
|
112 |
|
113 |
+
if ($this->parser->get_cfg('optimise_shorthands') < 2) {
|
114 |
+
continue;
|
115 |
+
}
|
116 |
|
117 |
+
$this->css[$medium][$selector] = $this->merge_font($this->css[$medium][$selector]);
|
118 |
|
119 |
+
if ($this->parser->get_cfg('optimise_shorthands') < 3) {
|
120 |
+
continue;
|
121 |
+
}
|
122 |
|
123 |
+
$this->css[$medium][$selector] = $this->merge_bg($this->css[$medium][$selector]);
|
124 |
+
if (empty($this->css[$medium][$selector])) {
|
125 |
+
unset($this->css[$medium][$selector]);
|
126 |
+
}
|
127 |
}
|
128 |
}
|
129 |
}
|
135 |
* @access public
|
136 |
* @version 1.0
|
137 |
*/
|
138 |
+
public function value() {
|
139 |
+
$shorthands = & $this->parser->data['csstidy']['shorthands'];
|
140 |
|
141 |
// optimise shorthand properties
|
142 |
if (isset($shorthands[$this->property])) {
|
143 |
+
$temp = $this->shorthand($this->value); // FIXME - move
|
144 |
if ($temp != $this->value) {
|
145 |
$this->parser->log('Optimised shorthand notation (' . $this->property . '): Changed "' . $this->value . '" to "' . $temp . '"', 'Information');
|
146 |
}
|
158 |
* @access public
|
159 |
* @version 1.0
|
160 |
*/
|
161 |
+
public function shorthands() {
|
162 |
+
$shorthands = & $this->parser->data['csstidy']['shorthands'];
|
163 |
|
164 |
if (!$this->parser->get_cfg('optimise_shorthands') || $this->parser->get_cfg('preserve_css')) {
|
165 |
return;
|
167 |
|
168 |
if ($this->property === 'font' && $this->parser->get_cfg('optimise_shorthands') > 1) {
|
169 |
$this->css[$this->at][$this->selector]['font']='';
|
170 |
+
$this->parser->merge_css_blocks($this->at, $this->selector, $this->dissolve_short_font($this->value));
|
171 |
}
|
172 |
if ($this->property === 'background' && $this->parser->get_cfg('optimise_shorthands') > 2) {
|
173 |
$this->css[$this->at][$this->selector]['background']='';
|
174 |
+
$this->parser->merge_css_blocks($this->at, $this->selector, $this->dissolve_short_bg($this->value));
|
175 |
}
|
176 |
if (isset($shorthands[$this->property])) {
|
177 |
+
$this->parser->merge_css_blocks($this->at, $this->selector, $this->dissolve_4value_shorthands($this->property, $this->value));
|
178 |
if (is_array($shorthands[$this->property])) {
|
179 |
$this->css[$this->at][$this->selector][$this->property] = '';
|
180 |
}
|
186 |
* @access public
|
187 |
* @version 1.0
|
188 |
*/
|
189 |
+
public function subvalue() {
|
190 |
+
$replace_colors = & $this->parser->data['csstidy']['replace_colors'];
|
191 |
|
192 |
$this->sub_value = trim($this->sub_value);
|
193 |
if ($this->sub_value == '') { // caution : '0'
|
195 |
}
|
196 |
|
197 |
$important = '';
|
198 |
+
if ($this->parser->is_important($this->sub_value)) {
|
199 |
$important = '!important';
|
200 |
}
|
201 |
+
$this->sub_value = $this->parser->gvw_important($this->sub_value);
|
202 |
|
203 |
// Compress font-weight
|
204 |
if ($this->property === 'font-weight' && $this->parser->get_cfg('compress_font-weight')) {
|
205 |
if ($this->sub_value === 'bold') {
|
206 |
$this->sub_value = '700';
|
207 |
$this->parser->log('Optimised font-weight: Changed "bold" to "700"', 'Information');
|
208 |
+
} elseif ($this->sub_value === 'normal') {
|
209 |
$this->sub_value = '400';
|
210 |
$this->parser->log('Optimised font-weight: Changed "normal" to "400"', 'Information');
|
211 |
}
|
241 |
* @return string
|
242 |
* @version 1.0
|
243 |
*/
|
244 |
+
public function shorthand($value) {
|
245 |
$important = '';
|
246 |
+
if ($this->parser->is_important($value)) {
|
247 |
+
$values = $this->parser->gvw_important($value);
|
248 |
$important = '!important';
|
249 |
}
|
250 |
else
|
287 |
* @access public
|
288 |
* @version 1.1
|
289 |
*/
|
290 |
+
public function compress_important(&$string) {
|
291 |
+
if ($this->parser->is_important($string)) {
|
292 |
+
$important = $this->parser->get_cfg('space_before_important') ? ' !important' : '!important';
|
293 |
+
$string = $this->parser->gvw_important($string) . $important;
|
294 |
}
|
295 |
return $string;
|
296 |
}
|
301 |
* @return string
|
302 |
* @version 1.1
|
303 |
*/
|
304 |
+
public function cut_color($color) {
|
305 |
+
$replace_colors = & $this->parser->data['csstidy']['replace_colors'];
|
306 |
+
|
307 |
+
// if it's a string, don't touch !
|
308 |
+
if (strncmp($color, "'", 1) == 0 || strncmp($color, '"', 1) == 0)
|
309 |
+
return $color;
|
310 |
+
|
311 |
+
/* expressions complexes de type gradient */
|
312 |
+
if (strpos($color, '(') !== false && strncmp($color, 'rgb(' ,4) != 0) {
|
313 |
+
// on ne touche pas aux couleurs dans les expression ms, c'est trop sensible
|
314 |
+
if (stripos($color, 'progid:') !== false)
|
315 |
+
return $color;
|
316 |
+
preg_match_all(",rgb\([^)]+\),i", $color, $matches, PREG_SET_ORDER);
|
317 |
+
if (count($matches)) {
|
318 |
+
foreach ($matches as $m) {
|
319 |
+
$color = str_replace($m[0], $this->cut_color($m[0]), $color);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
preg_match_all(",#[0-9a-f]{6}(?=[^0-9a-f]),i", $color, $matches, PREG_SET_ORDER);
|
323 |
+
if (count($matches)) {
|
324 |
+
foreach ($matches as $m) {
|
325 |
+
$color = str_replace($m[0],$this->cut_color($m[0]), $color);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
return $color;
|
329 |
+
}
|
330 |
|
331 |
// rgb(0,0,0) -> #000000 (or #000 in this case later)
|
332 |
+
if (strncasecmp($color, 'rgb(', 4)==0) {
|
333 |
$color_tmp = substr($color, 4, strlen($color) - 5);
|
334 |
$color_tmp = explode(',', $color_tmp);
|
335 |
for ($i = 0; $i < count($color_tmp); $i++) {
|
358 |
// #aabbcc -> #abc
|
359 |
if (strlen($color) == 7) {
|
360 |
$color_temp = strtolower($color);
|
361 |
+
if ($color_temp[0] === '#' && $color_temp[1] == $color_temp[2] && $color_temp[3] == $color_temp[4] && $color_temp[5] == $color_temp[6]) {
|
362 |
+
$color = '#' . $color[1] . $color[3] . $color[5];
|
363 |
}
|
364 |
}
|
365 |
|
392 |
* @return string
|
393 |
* @version 1.2
|
394 |
*/
|
395 |
+
public function compress_numbers($subvalue) {
|
396 |
+
$unit_values = & $this->parser->data['csstidy']['unit_values'];
|
397 |
+
$color_values = & $this->parser->data['csstidy']['color_values'];
|
398 |
|
399 |
// for font:1em/1em sans-serif...;
|
400 |
if ($this->property === 'font') {
|
402 |
} else {
|
403 |
$temp = array($subvalue);
|
404 |
}
|
405 |
+
|
406 |
for ($l = 0; $l < count($temp); $l++) {
|
407 |
// if we are not dealing with a number at this point, do not optimise anything
|
408 |
$number = $this->AnalyseCssNumber($temp[$l]);
|
412 |
|
413 |
// Fix bad colors
|
414 |
if (in_array($this->property, $color_values)) {
|
415 |
+
$temp[$l] = '#' . $temp[$l];
|
|
|
|
|
|
|
|
|
|
|
416 |
continue;
|
417 |
}
|
418 |
|
420 |
if ($number[1] == '' && in_array($this->property, $unit_values, true)) {
|
421 |
$number[1] = 'px';
|
422 |
}
|
423 |
+
} elseif ($number[1] != 's' && $number[1] != 'ms') {
|
424 |
+
$number[1] = '';
|
425 |
+
}
|
426 |
|
427 |
$temp[$l] = $number[0] . $number[1];
|
428 |
}
|
436 |
* @param string $string
|
437 |
* @return array ('unit' if unit is found or '' if no unit exists, number value) or false if no number
|
438 |
*/
|
439 |
+
public function AnalyseCssNumber($string) {
|
440 |
// most simple checks first
|
441 |
+
if (strlen($string) == 0 || ctype_alpha($string[0])) {
|
442 |
return false;
|
443 |
}
|
444 |
|
445 |
+
$units = & $this->parser->data['csstidy']['units'];
|
446 |
$return = array(0, '');
|
447 |
|
448 |
$return[0] = floatval($string);
|
481 |
* @access public
|
482 |
* @version 1.2
|
483 |
*/
|
484 |
+
public function merge_selectors(&$array) {
|
485 |
$css = $array;
|
486 |
foreach ($css as $key => $value) {
|
487 |
if (!isset($css[$key])) {
|
522 |
* regular expression
|
523 |
* @version 1.4
|
524 |
*/
|
525 |
+
public function discard_invalid_selectors(&$array) {
|
526 |
$invalid = array('+' => true, '~' => true, ',' => true, '>' => true);
|
527 |
foreach ($array as $selector => $decls) {
|
528 |
$ok = true;
|
545 |
* Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...
|
546 |
* @param string $property
|
547 |
* @param string $value
|
548 |
+
* @param array|null $shorthands
|
549 |
* @return array
|
550 |
* @version 1.0
|
551 |
* @see merge_4value_shorthands()
|
552 |
*/
|
553 |
+
public function dissolve_4value_shorthands($property, $value, $shorthands = null) {
|
554 |
+
if (is_null($shorthands)) {
|
555 |
+
$shorthands = & $this->parser->data['csstidy']['shorthands'];
|
556 |
+
}
|
557 |
if (!is_array($shorthands[$property])) {
|
558 |
$return[$property] = $value;
|
559 |
return $return;
|
560 |
}
|
561 |
|
562 |
$important = '';
|
563 |
+
if ($this->parser->is_important($value)) {
|
564 |
+
$value = $this->parser->gvw_important($value);
|
565 |
$important = '!important';
|
566 |
}
|
567 |
$values = explode(' ', $value);
|
590 |
return $return;
|
591 |
}
|
592 |
|
593 |
+
/**
|
594 |
+
* Dissolves radius properties like
|
595 |
+
* border-radius:10px 10px 10px / 1px 2px
|
596 |
+
* to border-top-left:10px 1px;border-top-right:10px 2x;...
|
597 |
+
* @param string $property
|
598 |
+
* @param string $value
|
599 |
+
* @return array
|
600 |
+
* @version 1.0
|
601 |
+
* @use dissolve_4value_shorthands()
|
602 |
+
* @see merge_4value_radius_shorthands()
|
603 |
+
*/
|
604 |
+
public function dissolve_4value_radius_shorthands($property, $value) {
|
605 |
+
$shorthands = & $this->parser->data['csstidy']['radius_shorthands'];
|
606 |
+
if (!is_array($shorthands[$property])) {
|
607 |
+
$return[$property] = $value;
|
608 |
+
return $return;
|
609 |
+
}
|
610 |
+
|
611 |
+
if (strpos($value, '/') !== false) {
|
612 |
+
$values = $this->explode_ws('/', $value);
|
613 |
+
if (count($values) == 2) {
|
614 |
+
$r[0] = $this->dissolve_4value_shorthands($property, trim($values[0]), $shorthands);
|
615 |
+
$r[1] = $this->dissolve_4value_shorthands($property, trim($values[1]), $shorthands);
|
616 |
+
$return = array();
|
617 |
+
foreach ($r[0] as $p=>$v) {
|
618 |
+
$return[$p] = $v;
|
619 |
+
if ($r[1][$p] !== $v) {
|
620 |
+
$return[$p] .= ' ' . $r[1][$p];
|
621 |
+
}
|
622 |
+
}
|
623 |
+
return $return;
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
$return = $this->dissolve_4value_shorthands($property, $value, $shorthands);
|
628 |
+
return $return;
|
629 |
+
}
|
630 |
+
|
631 |
/**
|
632 |
* Explodes a string as explode() does, however, not if $sep is escaped or within a string.
|
633 |
* @param string $sep seperator
|
634 |
* @param string $string
|
635 |
+
* @param bool $explode_in_parenthesis
|
636 |
* @return array
|
637 |
* @version 1.0
|
638 |
*/
|
639 |
+
public function explode_ws($sep, $string, $explode_in_parenthesis = false) {
|
640 |
$status = 'st';
|
641 |
$to = '';
|
642 |
|
643 |
+
$output = array(
|
644 |
+
0 => '',
|
645 |
+
);
|
646 |
$num = 0;
|
647 |
for ($i = 0, $len = strlen($string); $i < $len; $i++) {
|
648 |
switch ($status) {
|
649 |
case 'st':
|
650 |
+
if ($string[$i] == $sep && !$this->parser->escaped($string, $i)) {
|
651 |
++$num;
|
652 |
+
} elseif ($string[$i] === '"' || $string[$i] === '\'' || (!$explode_in_parenthesis && $string[$i] === '(') && !$this->parser->escaped($string, $i)) {
|
653 |
$status = 'str';
|
654 |
+
$to = ($string[$i] === '(') ? ')' : $string[$i];
|
655 |
+
(isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
|
656 |
} else {
|
657 |
+
(isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
|
658 |
}
|
659 |
break;
|
660 |
|
661 |
case 'str':
|
662 |
+
if ($string[$i] == $to && !$this->parser->escaped($string, $i)) {
|
663 |
$status = 'st';
|
664 |
}
|
665 |
+
(isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
|
666 |
break;
|
667 |
}
|
668 |
}
|
669 |
|
670 |
+
return $output;
|
|
|
|
|
|
|
|
|
671 |
}
|
672 |
|
673 |
/**
|
674 |
* Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
|
675 |
* @param array $array
|
676 |
+
* @param array|null $shorthands
|
677 |
* @return array
|
678 |
* @version 1.2
|
679 |
* @see dissolve_4value_shorthands()
|
680 |
*/
|
681 |
+
public function merge_4value_shorthands($array, $shorthands = null) {
|
682 |
$return = $array;
|
683 |
+
if (is_null($shorthands)) {
|
684 |
+
$shorthands = & $this->parser->data['csstidy']['shorthands'];
|
685 |
+
}
|
686 |
|
687 |
foreach ($shorthands as $key => $value) {
|
688 |
+
if ($value !== 0 && isset($array[$value[0]]) && isset($array[$value[1]])
|
689 |
+
&& isset($array[$value[2]]) && isset($array[$value[3]])) {
|
690 |
$return[$key] = '';
|
691 |
|
692 |
$important = '';
|
693 |
for ($i = 0; $i < 4; $i++) {
|
694 |
$val = $array[$value[$i]];
|
695 |
+
if ($this->parser->is_important($val)) {
|
696 |
$important = '!important';
|
697 |
+
$return[$key] .= $this->parser->gvw_important($val) . ' ';
|
698 |
} else {
|
699 |
$return[$key] .= $val . ' ';
|
700 |
}
|
701 |
unset($return[$value[$i]]);
|
702 |
}
|
703 |
+
$return[$key] = $this->shorthand(trim($return[$key] . $important));
|
704 |
}
|
705 |
}
|
706 |
return $return;
|
707 |
}
|
708 |
|
709 |
+
/**
|
710 |
+
* Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
|
711 |
+
* @param array $array
|
712 |
+
* @return array
|
713 |
+
* @version 1.2
|
714 |
+
* @use merge_4value_shorthands()
|
715 |
+
* @see dissolve_4value_radius_shorthands()
|
716 |
+
*/
|
717 |
+
public function merge_4value_radius_shorthands($array) {
|
718 |
+
$return = $array;
|
719 |
+
$shorthands = & $this->parser->data['csstidy']['radius_shorthands'];
|
720 |
+
|
721 |
+
foreach ($shorthands as $key => $value) {
|
722 |
+
if (isset($array[$value[0]]) && isset($array[$value[1]])
|
723 |
+
&& isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0) {
|
724 |
+
$return[$key] = '';
|
725 |
+
$a = array();
|
726 |
+
for ($i = 0; $i < 4; $i++) {
|
727 |
+
$v = $this->explode_ws(' ', trim($array[$value[$i]]));
|
728 |
+
$a[0][$value[$i]] = reset($v);
|
729 |
+
$a[1][$value[$i]] = end($v);
|
730 |
+
}
|
731 |
+
$r = array();
|
732 |
+
$r[0] = $this->merge_4value_shorthands($a[0], $shorthands);
|
733 |
+
$r[1] = $this->merge_4value_shorthands($a[1], $shorthands);
|
734 |
+
|
735 |
+
if (isset($r[0][$key]) and isset($r[1][$key])) {
|
736 |
+
$return[$key] = $r[0][$key];
|
737 |
+
if ($r[1][$key] !== $r[0][$key]) {
|
738 |
+
$return[$key] .= ' / ' . $r[1][$key];
|
739 |
+
}
|
740 |
+
for ($i = 0; $i < 4; $i++) {
|
741 |
+
unset($return[$value[$i]]);
|
742 |
+
}
|
743 |
+
}
|
744 |
+
}
|
745 |
+
}
|
746 |
+
return $return;
|
747 |
+
}
|
748 |
/**
|
749 |
* Dissolve background property
|
750 |
* @param string $str_value
|
753 |
* @see merge_bg()
|
754 |
* @todo full CSS 3 compliance
|
755 |
*/
|
756 |
+
public function dissolve_short_bg($str_value) {
|
757 |
// don't try to explose background gradient !
|
758 |
+
if (stripos($str_value, 'gradient(')!== false)
|
759 |
return array('background'=>$str_value);
|
760 |
+
|
761 |
+
$background_prop_default = & $this->parser->data['csstidy']['background_prop_default'];
|
762 |
$repeat = array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'space');
|
763 |
$attachment = array('scroll', 'fixed', 'local');
|
764 |
$clip = array('border', 'padding');
|
767 |
$important = '';
|
768 |
$return = array('background-image' => null, 'background-size' => null, 'background-repeat' => null, 'background-position' => null, 'background-attachment' => null, 'background-clip' => null, 'background-origin' => null, 'background-color' => null);
|
769 |
|
770 |
+
if ($this->parser->is_important($str_value)) {
|
771 |
$important = ' !important';
|
772 |
+
$str_value = $this->parser->gvw_important($str_value);
|
773 |
}
|
774 |
|
775 |
+
$str_value = $this->explode_ws(',', $str_value);
|
776 |
for ($i = 0; $i < count($str_value); $i++) {
|
777 |
$have['clip'] = false;
|
778 |
$have['pos'] = false;
|
782 |
if (is_array($str_value[$i])) {
|
783 |
$str_value[$i] = $str_value[$i][0];
|
784 |
}
|
785 |
+
$str_value[$i] = $this->explode_ws(' ', trim($str_value[$i]));
|
786 |
|
787 |
for ($j = 0; $j < count($str_value[$i]); $j++) {
|
788 |
if ($have['bg'] === false && (substr($str_value[$i][$j], 0, 4) === 'url(' || $str_value[$i][$j] === 'none')) {
|
797 |
$have['clip'] = true;
|
798 |
} elseif (in_array($str_value[$i][$j], $origin, true)) {
|
799 |
$return['background-origin'] .= $str_value[$i][$j] . ',';
|
800 |
+
} elseif ($str_value[$i][$j][0] === '(') {
|
801 |
$return['background-size'] .= substr($str_value[$i][$j], 1, -1) . ',';
|
802 |
+
} elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j][0]) || $str_value[$i][$j][0] === null || $str_value[$i][$j][0] === '-' || $str_value[$i][$j][0] === '.') {
|
803 |
$return['background-position'] .= $str_value[$i][$j];
|
804 |
if (!$have['pos'])
|
805 |
$return['background-position'] .= ' '; else
|
806 |
$return['background-position'].= ',';
|
807 |
$have['pos'] = true;
|
808 |
+
} elseif (!$have['color']) {
|
|
|
809 |
$return['background-color'] .= $str_value[$i][$j] . ',';
|
810 |
$have['color'] = true;
|
811 |
}
|
830 |
* @see dissolve_short_bg()
|
831 |
* @todo full CSS 3 compliance
|
832 |
*/
|
833 |
+
public function merge_bg($input_css) {
|
834 |
+
$background_prop_default = & $this->parser->data['csstidy']['background_prop_default'];
|
835 |
// Max number of background images. CSS3 not yet fully implemented
|
836 |
+
$number_of_values = @max(count($this->explode_ws(',', $input_css['background-image'])), count($this->explode_ws(',', $input_css['background-color'])), 1);
|
837 |
// Array with background images to check if BG image exists
|
838 |
+
$bg_img_array = @$this->explode_ws(',', $this->parser->gvw_important($input_css['background-image']));
|
839 |
$new_bg_value = '';
|
840 |
$important = '';
|
841 |
|
842 |
// if background properties is here and not empty, don't try anything
|
843 |
+
if (isset($input_css['background']) && $input_css['background'])
|
844 |
return $input_css;
|
845 |
+
|
846 |
for ($i = 0; $i < $number_of_values; $i++) {
|
847 |
foreach ($background_prop_default as $bg_property => $default_value) {
|
848 |
// Skip if property does not exist
|
852 |
|
853 |
$cur_value = $input_css[$bg_property];
|
854 |
// skip all optimisation if gradient() somewhere
|
855 |
+
if (stripos($cur_value, 'gradient(') !== false)
|
856 |
return $input_css;
|
857 |
|
858 |
// Skip some properties if there is no background image
|
863 |
}
|
864 |
|
865 |
// Remove !important
|
866 |
+
if ($this->parser->is_important($cur_value)) {
|
867 |
$important = ' !important';
|
868 |
+
$cur_value = $this->parser->gvw_important($cur_value);
|
869 |
}
|
870 |
|
871 |
// Do not add default values
|
873 |
continue;
|
874 |
}
|
875 |
|
876 |
+
$temp = $this->explode_ws(',', $cur_value);
|
877 |
|
878 |
if (isset($temp[$i])) {
|
879 |
if ($bg_property === 'background-size') {
|
910 |
* @version 1.3
|
911 |
* @see merge_font()
|
912 |
*/
|
913 |
+
public function dissolve_short_font($str_value) {
|
914 |
+
$font_prop_default = & $this->parser->data['csstidy']['font_prop_default'];
|
915 |
$font_weight = array('normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900);
|
916 |
$font_variant = array('normal', 'small-caps');
|
917 |
$font_style = array('normal', 'italic', 'oblique');
|
918 |
$important = '';
|
919 |
$return = array('font-style' => null, 'font-variant' => null, 'font-weight' => null, 'font-size' => null, 'line-height' => null, 'font-family' => null);
|
920 |
|
921 |
+
if ($this->parser->is_important($str_value)) {
|
922 |
$important = '!important';
|
923 |
+
$str_value = $this->parser->gvw_important($str_value);
|
924 |
}
|
925 |
|
926 |
$have['style'] = false;
|
931 |
$multiwords = false;
|
932 |
|
933 |
// Workaround with multiple font-family
|
934 |
+
$str_value = $this->explode_ws(',', trim($str_value));
|
935 |
|
936 |
+
$str_value[0] = $this->explode_ws(' ', trim($str_value[0]));
|
937 |
|
938 |
for ($j = 0; $j < count($str_value[0]); $j++) {
|
939 |
if ($have['weight'] === false && in_array($str_value[0][$j], $font_weight)) {
|
945 |
} elseif ($have['style'] === false && in_array($str_value[0][$j], $font_style)) {
|
946 |
$return['font-style'] = $str_value[0][$j];
|
947 |
$have['style'] = true;
|
948 |
+
} elseif ($have['size'] === false && (is_numeric($str_value[0][$j][0]) || $str_value[0][$j][0] === null || $str_value[0][$j][0] === '.')) {
|
949 |
+
$size = $this->explode_ws('/', trim($str_value[0][$j]));
|
950 |
$return['font-size'] = $size[0];
|
951 |
if (isset($size[1])) {
|
952 |
$return['line-height'] = $size[1];
|
975 |
|
976 |
// Fix for 100 and more font-size
|
977 |
if ($have['size'] === false && isset($return['font-weight']) &&
|
978 |
+
is_numeric($return['font-weight'][0])) {
|
979 |
$return['font-size'] = $return['font-weight'];
|
980 |
unset($return['font-weight']);
|
981 |
}
|
997 |
* @version 1.3
|
998 |
* @see dissolve_short_font()
|
999 |
*/
|
1000 |
+
public function merge_font($input_css) {
|
1001 |
+
$font_prop_default = & $this->parser->data['csstidy']['font_prop_default'];
|
1002 |
$new_font_value = '';
|
1003 |
$important = '';
|
1004 |
// Skip if not font-family and font-size set
|
1005 |
+
if (isset($input_css['font-family']) && isset($input_css['font-size']) && $input_css['font-family'] != 'inherit') {
|
1006 |
// fix several words in font-family - add quotes
|
1007 |
if (isset($input_css['font-family'])) {
|
1008 |
+
$families = explode(',', $input_css['font-family']);
|
1009 |
$result_families = array();
|
1010 |
foreach ($families as $family) {
|
1011 |
$family = trim($family);
|
1012 |
$len = strlen($family);
|
1013 |
+
if (strpos($family, ' ') &&
|
1014 |
+
!(($family[0] === '"' && $family[$len - 1] === '"') ||
|
1015 |
+
($family[0] === "'" && $family[$len - 1] === "'"))) {
|
1016 |
$family = '"' . $family . '"';
|
1017 |
}
|
1018 |
$result_families[] = $family;
|
1019 |
}
|
1020 |
+
$input_css['font-family'] = implode(',', $result_families);
|
1021 |
}
|
1022 |
foreach ($font_prop_default as $font_property => $default_value) {
|
1023 |
|
1034 |
}
|
1035 |
|
1036 |
// Remove !important
|
1037 |
+
if ($this->parser->is_important($cur_value)) {
|
1038 |
$important = '!important';
|
1039 |
+
$cur_value = $this->parser->gvw_important($cur_value);
|
1040 |
}
|
1041 |
|
1042 |
$new_font_value .= $cur_value;
|
1049 |
|
1050 |
// Delete all font-properties
|
1051 |
foreach ($font_prop_default as $font_property => $default_value) {
|
1052 |
+
if ($font_property !== 'font' || !$new_font_value)
|
1053 |
unset($input_css[$font_property]);
|
1054 |
}
|
1055 |
|
1062 |
return $input_css;
|
1063 |
}
|
1064 |
|
1065 |
+
/**
|
1066 |
+
* Reverse left vs right in a list of properties/values
|
1067 |
+
* @param array $array
|
1068 |
+
* @return array
|
1069 |
+
*/
|
1070 |
+
public function reverse_left_and_right($array) {
|
1071 |
+
$return = array();
|
1072 |
+
|
1073 |
+
// change left <-> right in properties name and values
|
1074 |
+
foreach ($array as $propertie => $value) {
|
1075 |
+
|
1076 |
+
if (method_exists($this, $m = 'reverse_left_and_right_' . str_replace('-','_',trim($propertie)))) {
|
1077 |
+
$value = $this->$m($value);
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
// simple replacement for properties
|
1081 |
+
$propertie = str_ireplace(array('left', 'right' ,"\x1"), array("\x1", 'left', 'right') , $propertie);
|
1082 |
+
// be careful for values, not modifying protected or quoted valued
|
1083 |
+
foreach (array('left' => "\x1", 'right' => 'left', "\x1" => 'right') as $v => $r) {
|
1084 |
+
if (strpos($value, $v) !== false) {
|
1085 |
+
// attraper les left et right separes du reste (pas au milieu d'un mot)
|
1086 |
+
if (in_array($v, array('left', 'right') )) {
|
1087 |
+
$value = preg_replace(",\\b$v\\b,", "\x0" , $value);
|
1088 |
+
}
|
1089 |
+
else {
|
1090 |
+
$value = str_replace($v, "\x0" , $value);
|
1091 |
+
}
|
1092 |
+
$value = $this->explode_ws("\x0", $value . ' ', true);
|
1093 |
+
$value = rtrim(implode($r, $value));
|
1094 |
+
$value = str_replace("\x0" , $v, $value);
|
1095 |
+
}
|
1096 |
+
}
|
1097 |
+
$return[$propertie] = $value;
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
return $return;
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
/**
|
1104 |
+
* Reversing 4 values shorthands properties
|
1105 |
+
* @param string $value
|
1106 |
+
* @return string
|
1107 |
+
*/
|
1108 |
+
public function reverse_left_and_right_4value_shorthands($property, $value) {
|
1109 |
+
$shorthands = & $this->parser->data['csstidy']['shorthands'];
|
1110 |
+
if (isset($shorthands[$property])) {
|
1111 |
+
$property_right = $shorthands[$property][1];
|
1112 |
+
$property_left = $shorthands[$property][3];
|
1113 |
+
$v = $this->dissolve_4value_shorthands($property, $value);
|
1114 |
+
if ($v[$property_left] !== $v[$property_right]) {
|
1115 |
+
$r = $v[$property_right];
|
1116 |
+
$v[$property_right] = $v[$property_left];
|
1117 |
+
$v[$property_left] = $r;
|
1118 |
+
$v = $this->merge_4value_shorthands($v);
|
1119 |
+
if (isset($v[$property])) {
|
1120 |
+
return $v[$property];
|
1121 |
+
}
|
1122 |
+
}
|
1123 |
+
}
|
1124 |
+
return $value;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
/**
|
1128 |
+
* Reversing 4 values radius shorthands properties
|
1129 |
+
* @param string $value
|
1130 |
+
* @return string
|
1131 |
+
*/
|
1132 |
+
public function reverse_left_and_right_4value_radius_shorthands($property, $value) {
|
1133 |
+
$shorthands = & $this->parser->data['csstidy']['radius_shorthands'];
|
1134 |
+
if (isset($shorthands[$property])) {
|
1135 |
+
$v = $this->dissolve_4value_radius_shorthands($property, $value);
|
1136 |
+
if ($v[$shorthands[$property][0]] !== $v[$shorthands[$property][1]]
|
1137 |
+
or $v[$shorthands[$property][2]] !== $v[$shorthands[$property][3]]) {
|
1138 |
+
$r = array(
|
1139 |
+
$shorthands[$property][0] => $v[$shorthands[$property][1]],
|
1140 |
+
$shorthands[$property][1] => $v[$shorthands[$property][0]],
|
1141 |
+
$shorthands[$property][2] => $v[$shorthands[$property][3]],
|
1142 |
+
$shorthands[$property][3] => $v[$shorthands[$property][2]],
|
1143 |
+
);
|
1144 |
+
$v = $this->merge_4value_radius_shorthands($r);
|
1145 |
+
if (isset($v[$property])) {
|
1146 |
+
return $v[$property];
|
1147 |
+
}
|
1148 |
+
}
|
1149 |
+
}
|
1150 |
+
return $value;
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
/**
|
1154 |
+
* Reversing margin shorthands
|
1155 |
+
* @param string $value
|
1156 |
+
* @return string
|
1157 |
+
*/
|
1158 |
+
public function reverse_left_and_right_margin($value) {
|
1159 |
+
return $this->reverse_left_and_right_4value_shorthands('margin', $value);
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
/**
|
1163 |
+
* Reversing padding shorthands
|
1164 |
+
* @param string $value
|
1165 |
+
* @return string
|
1166 |
+
*/
|
1167 |
+
public function reverse_left_and_right_padding($value) {
|
1168 |
+
return $this->reverse_left_and_right_4value_shorthands('padding', $value);
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
/**
|
1172 |
+
* Reversing border-color shorthands
|
1173 |
+
* @param string $value
|
1174 |
+
* @return string
|
1175 |
+
*/
|
1176 |
+
public function reverse_left_and_right_border_color($value) {
|
1177 |
+
return $this->reverse_left_and_right_4value_shorthands('border-color', $value);
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* Reversing border-style shorthands
|
1182 |
+
* @param string $value
|
1183 |
+
* @return string
|
1184 |
+
*/
|
1185 |
+
public function reverse_left_and_right_border_style($value) {
|
1186 |
+
return $this->reverse_left_and_right_4value_shorthands('border-style', $value);
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
/**
|
1190 |
+
* Reversing border-width shorthands
|
1191 |
+
* @param string $value
|
1192 |
+
* @return string
|
1193 |
+
*/
|
1194 |
+
public function reverse_left_and_right_border_width($value) {
|
1195 |
+
return $this->reverse_left_and_right_4value_shorthands('border-width', $value);
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
/**
|
1199 |
+
* Reversing border-radius shorthands
|
1200 |
+
* @param string $value
|
1201 |
+
* @return string
|
1202 |
+
*/
|
1203 |
+
public function reverse_left_and_right_border_radius($value) {
|
1204 |
+
return $this->reverse_left_and_right_4value_radius_shorthands('border-radius', $value);
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
/**
|
1208 |
+
* Reversing border-radius shorthands
|
1209 |
+
* @param string $value
|
1210 |
+
* @return string
|
1211 |
+
*/
|
1212 |
+
public function reverse_left_and_right__moz_border_radius($value) {
|
1213 |
+
return $this->reverse_left_and_right_4value_radius_shorthands('border-radius', $value);
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
/**
|
1217 |
+
* Reversing border-radius shorthands
|
1218 |
+
* @param string $value
|
1219 |
+
* @return string
|
1220 |
+
*/
|
1221 |
+
public function reverse_left_and_right__webkit_border_radius($value) {
|
1222 |
+
return $this->reverse_left_and_right_4value_radius_shorthands('border-radius', $value);
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
|
1226 |
+
/**
|
1227 |
+
* Reversing background shorthands
|
1228 |
+
* @param string $value
|
1229 |
+
* @return string
|
1230 |
+
*/
|
1231 |
+
public function reverse_left_and_right_background($value) {
|
1232 |
+
$values = $this->dissolve_short_bg($value);
|
1233 |
+
if (isset($values['background-position']) and $values['background-position']) {
|
1234 |
+
$v = $this->reverse_left_and_right_background_position($values['background-position']);
|
1235 |
+
if ($v !== $values['background-position']) {
|
1236 |
+
if ($value == $values['background-position']) {
|
1237 |
+
return $v;
|
1238 |
+
}
|
1239 |
+
else {
|
1240 |
+
$values['background-position'] = $v;
|
1241 |
+
$x = $this->merge_bg($values);
|
1242 |
+
if (isset($x['background'])) {
|
1243 |
+
return $x['background'];
|
1244 |
+
}
|
1245 |
+
}
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
return $value;
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
/**
|
1252 |
+
* Reversing background position shorthands
|
1253 |
+
* @param string $value
|
1254 |
+
* @return string
|
1255 |
+
*/
|
1256 |
+
public function reverse_left_and_right_background_position_x($value) {
|
1257 |
+
return $this->reverse_left_and_right_background_position($value);
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
/**
|
1261 |
+
* Reversing background position shorthands
|
1262 |
+
* @param string $value
|
1263 |
+
* @return string
|
1264 |
+
*/
|
1265 |
+
public function reverse_left_and_right_background_position($value) {
|
1266 |
+
// multiple background case
|
1267 |
+
if (strpos($value, ',') !== false) {
|
1268 |
+
$values = $this->explode_ws(',', $value);
|
1269 |
+
if (count($values) > 1) {
|
1270 |
+
foreach ($values as $k=>$v) {
|
1271 |
+
$values[$k] = $this->reverse_left_and_right_background_position($v);
|
1272 |
+
}
|
1273 |
+
return implode(',', $values);
|
1274 |
+
}
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
// if no explicit left or right value
|
1278 |
+
if (stripos($value, 'left') === false and stripos($value, 'right') === false) {
|
1279 |
+
$values = $this->explode_ws(' ', trim($value));
|
1280 |
+
$values = array_map('trim', $values);
|
1281 |
+
$values = array_filter($values, function ($v) { return strlen($v);});
|
1282 |
+
$values = array_values($values);
|
1283 |
+
if (count($values) == 1) {
|
1284 |
+
if (in_array($value, array('center', 'top', 'bottom', 'inherit', 'initial', 'unset'))) {
|
1285 |
+
return $value;
|
1286 |
+
}
|
1287 |
+
return "left $value";
|
1288 |
+
}
|
1289 |
+
if ($values[1] == 'top' or $values[1] == 'bottom') {
|
1290 |
+
if ($values[0] === 'center') {
|
1291 |
+
return $value;
|
1292 |
+
}
|
1293 |
+
return 'left ' . implode(' ', $values);
|
1294 |
+
}
|
1295 |
+
else {
|
1296 |
+
$last = array_pop($values);
|
1297 |
+
if ($last === 'center') {
|
1298 |
+
return $value;
|
1299 |
+
}
|
1300 |
+
return implode(' ', $values) . ' left ' . $last;
|
1301 |
+
}
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
return $value;
|
1305 |
+
}
|
1306 |
+
|
1307 |
}
|
classes/csstidy/class.csstidy_print.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU Lesser General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU Lesser General Public License
|
24 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25 |
*
|
@@ -27,7 +27,7 @@
|
|
27 |
* @package csstidy
|
28 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
29 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
30 |
-
* @author Cedric Morin (cedric at yterium dot com) 2010
|
31 |
*/
|
32 |
|
33 |
/**
|
@@ -37,28 +37,34 @@
|
|
37 |
*
|
38 |
* @package csstidy
|
39 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
40 |
-
* @version 1.0
|
41 |
*/
|
42 |
class csstidy_print {
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
/**
|
45 |
* Saves the input CSS string
|
46 |
* @var string
|
47 |
* @access private
|
48 |
*/
|
49 |
-
|
50 |
/**
|
51 |
* Saves the formatted CSS string
|
52 |
* @var string
|
53 |
* @access public
|
54 |
*/
|
55 |
-
|
56 |
/**
|
57 |
* Saves the formatted CSS string (plain text)
|
58 |
* @var string
|
59 |
* @access public
|
60 |
*/
|
61 |
-
|
62 |
|
63 |
/**
|
64 |
* Constructor
|
@@ -66,8 +72,8 @@ class csstidy_print {
|
|
66 |
* @access private
|
67 |
* @version 1.0
|
68 |
*/
|
69 |
-
function __construct(
|
70 |
-
$this->parser =
|
71 |
$this->css = & $css->css;
|
72 |
$this->template = & $css->template;
|
73 |
$this->tokens = & $css->tokens;
|
@@ -81,7 +87,7 @@ class csstidy_print {
|
|
81 |
* @access private
|
82 |
* @version 1.0
|
83 |
*/
|
84 |
-
function _reset() {
|
85 |
$this->output_css = '';
|
86 |
$this->output_css_plain = '';
|
87 |
}
|
@@ -93,7 +99,7 @@ class csstidy_print {
|
|
93 |
* @access public
|
94 |
* @version 1.0
|
95 |
*/
|
96 |
-
function plain($default_media='') {
|
97 |
$this->_print(true, $default_media);
|
98 |
return $this->output_css_plain;
|
99 |
}
|
@@ -105,7 +111,7 @@ class csstidy_print {
|
|
105 |
* @access public
|
106 |
* @version 1.0
|
107 |
*/
|
108 |
-
function formatted($default_media='') {
|
109 |
$this->_print(false, $default_media);
|
110 |
return $this->output_css;
|
111 |
}
|
@@ -120,9 +126,12 @@ class csstidy_print {
|
|
120 |
* @access public
|
121 |
* @version 1.4
|
122 |
*/
|
123 |
-
function formatted_page($doctype='
|
124 |
switch ($doctype) {
|
125 |
-
case '
|
|
|
|
|
|
|
126 |
$doctype_output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
127 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
128 |
break;
|
@@ -147,7 +156,6 @@ class csstidy_print {
|
|
147 |
$output .= "\n</style>";
|
148 |
} else {
|
149 |
$output .= "\n" . ' <link rel="stylesheet" type="text/css" href="cssparsed.css" />';
|
150 |
-
// }
|
151 |
}
|
152 |
$output .= "\n</head>\n<body><code id=\"copytext\">";
|
153 |
$output .= $this->formatted();
|
@@ -162,7 +170,7 @@ class csstidy_print {
|
|
162 |
* @access private
|
163 |
* @version 2.0
|
164 |
*/
|
165 |
-
function _print($plain = false, $default_media='') {
|
166 |
if ($this->output_css && $this->output_css_plain) {
|
167 |
return;
|
168 |
}
|
@@ -183,44 +191,53 @@ class csstidy_print {
|
|
183 |
}
|
184 |
|
185 |
if (!empty($this->charset)) {
|
186 |
-
$output .= $template[0] . '@charset ' . $template[5] . $this->charset . $template[6];
|
187 |
}
|
188 |
|
189 |
if (!empty($this->import)) {
|
190 |
for ($i = 0, $size = count($this->import); $i < $size; $i++) {
|
191 |
-
$
|
192 |
-
|
193 |
-
$import_components[0] = '\'' . trim(substr($import_components[0], 4, -1), "'\"") . '\'';
|
194 |
-
$this->import[$i] = implode(' ', $import_components);
|
195 |
$this->parser->log('Optimised @import : Removed "url("', 'Information');
|
196 |
}
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
}
|
200 |
|
201 |
if (!empty($this->namespace)) {
|
202 |
-
if (
|
203 |
-
$this->namespace =
|
|
|
204 |
$this->parser->log('Optimised @namespace : Removed "url("', 'Information');
|
205 |
}
|
206 |
-
$output .= $template[0] . '@namespace ' . $template[5] . $this->namespace . $template[6];
|
207 |
}
|
208 |
|
209 |
-
$
|
210 |
-
$in_at_out = '';
|
211 |
$out = & $output;
|
|
|
212 |
|
213 |
foreach ($this->tokens as $key => $token) {
|
214 |
switch ($token[0]) {
|
215 |
case AT_START:
|
216 |
$out .= $template[0] . $this->_htmlsp($token[1], $plain) . $template[1];
|
217 |
-
$
|
|
|
|
|
|
|
|
|
218 |
break;
|
219 |
|
220 |
case SEL_START:
|
221 |
if ($this->parser->get_cfg('lowercase_s'))
|
222 |
$token[1] = strtolower($token[1]);
|
223 |
-
$out .= ( $token[1]
|
224 |
$out .= $template[3];
|
225 |
break;
|
226 |
|
@@ -249,12 +266,31 @@ class csstidy_print {
|
|
249 |
break;
|
250 |
|
251 |
case AT_END:
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
break;
|
257 |
|
|
|
258 |
case COMMENT:
|
259 |
$out .= $template[11] . '/*' . $this->_htmlsp($token[1], $plain) . '*/' . $template[12];
|
260 |
break;
|
@@ -280,7 +316,7 @@ class csstidy_print {
|
|
280 |
* @access private
|
281 |
* @version 1.0
|
282 |
*/
|
283 |
-
function _seeknocomment($key, $move) {
|
284 |
$go = ($move > 0) ? 1 : -1;
|
285 |
for ($i = $key + 1; abs($key - $i) - 1 < abs($move); $i += $go) {
|
286 |
if (!isset($this->tokens[$i])) {
|
@@ -300,36 +336,72 @@ class csstidy_print {
|
|
300 |
* @access private
|
301 |
* @version 1.0
|
302 |
*/
|
303 |
-
function _convert_raw_css($default_media='') {
|
304 |
$this->tokens = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
|
306 |
foreach ($this->css as $medium => $val) {
|
307 |
-
if ($
|
308 |
ksort($val);
|
309 |
if (intval($medium) < DEFAULT_AT) {
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
313 |
$this->parser->_add_token(AT_START, $default_media, true);
|
314 |
}
|
315 |
-
|
316 |
foreach ($val as $selector => $vali) {
|
317 |
-
if ($
|
318 |
ksort($vali);
|
319 |
$this->parser->_add_token(SEL_START, $selector, true);
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
foreach ($vali as $property => $valj) {
|
322 |
-
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
}
|
325 |
-
|
326 |
$this->parser->_add_token(SEL_END, $selector, true);
|
327 |
}
|
328 |
|
329 |
if (intval($medium) < DEFAULT_AT) {
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
333 |
$this->parser->_add_token(AT_END, $default_media, true);
|
334 |
}
|
335 |
}
|
@@ -344,7 +416,7 @@ class csstidy_print {
|
|
344 |
* @access private
|
345 |
* @version 1.0
|
346 |
*/
|
347 |
-
function _htmlsp($string, $plain) {
|
348 |
if (!$plain) {
|
349 |
return htmlspecialchars($string, ENT_QUOTES, 'utf-8');
|
350 |
}
|
@@ -357,7 +429,7 @@ class csstidy_print {
|
|
357 |
* @return float
|
358 |
* @version 1.2
|
359 |
*/
|
360 |
-
function get_ratio() {
|
361 |
if (!$this->output_css_plain) {
|
362 |
$this->formatted();
|
363 |
}
|
@@ -370,7 +442,7 @@ class csstidy_print {
|
|
370 |
* @return string
|
371 |
* @version 1.1
|
372 |
*/
|
373 |
-
function get_diff() {
|
374 |
if (!$this->output_css_plain) {
|
375 |
$this->formatted();
|
376 |
}
|
@@ -393,7 +465,7 @@ class csstidy_print {
|
|
393 |
* @return integer
|
394 |
* @version 1.0
|
395 |
*/
|
396 |
-
function size($loc = 'output') {
|
397 |
if ($loc === 'output' && !$this->output_css) {
|
398 |
$this->formatted();
|
399 |
}
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU Lesser General Public License for more details.
|
22 |
+
*
|
23 |
* You should have received a copy of the GNU Lesser General Public License
|
24 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
25 |
*
|
27 |
* @package csstidy
|
28 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
29 |
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
30 |
+
* @author Cedric Morin (cedric at yterium dot com) 2010-2012
|
31 |
*/
|
32 |
|
33 |
/**
|
37 |
*
|
38 |
* @package csstidy
|
39 |
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
40 |
+
* @version 1.1.0
|
41 |
*/
|
42 |
class csstidy_print {
|
43 |
|
44 |
+
/**
|
45 |
+
* csstidy object
|
46 |
+
* @var object
|
47 |
+
*/
|
48 |
+
public $parser;
|
49 |
+
|
50 |
/**
|
51 |
* Saves the input CSS string
|
52 |
* @var string
|
53 |
* @access private
|
54 |
*/
|
55 |
+
public $input_css = '';
|
56 |
/**
|
57 |
* Saves the formatted CSS string
|
58 |
* @var string
|
59 |
* @access public
|
60 |
*/
|
61 |
+
public $output_css = '';
|
62 |
/**
|
63 |
* Saves the formatted CSS string (plain text)
|
64 |
* @var string
|
65 |
* @access public
|
66 |
*/
|
67 |
+
public $output_css_plain = '';
|
68 |
|
69 |
/**
|
70 |
* Constructor
|
72 |
* @access private
|
73 |
* @version 1.0
|
74 |
*/
|
75 |
+
public function __construct($css) {
|
76 |
+
$this->parser = $css;
|
77 |
$this->css = & $css->css;
|
78 |
$this->template = & $css->template;
|
79 |
$this->tokens = & $css->tokens;
|
87 |
* @access private
|
88 |
* @version 1.0
|
89 |
*/
|
90 |
+
public function _reset() {
|
91 |
$this->output_css = '';
|
92 |
$this->output_css_plain = '';
|
93 |
}
|
99 |
* @access public
|
100 |
* @version 1.0
|
101 |
*/
|
102 |
+
public function plain($default_media='') {
|
103 |
$this->_print(true, $default_media);
|
104 |
return $this->output_css_plain;
|
105 |
}
|
111 |
* @access public
|
112 |
* @version 1.0
|
113 |
*/
|
114 |
+
public function formatted($default_media='') {
|
115 |
$this->_print(false, $default_media);
|
116 |
return $this->output_css;
|
117 |
}
|
126 |
* @access public
|
127 |
* @version 1.4
|
128 |
*/
|
129 |
+
public function formatted_page($doctype='html5', $externalcss=true, $title='', $lang='en') {
|
130 |
switch ($doctype) {
|
131 |
+
case 'html5':
|
132 |
+
$doctype_output = '<!DOCTYPE html>';
|
133 |
+
break;
|
134 |
+
case 'xhtml1.0strict':
|
135 |
$doctype_output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
136 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
137 |
break;
|
156 |
$output .= "\n</style>";
|
157 |
} else {
|
158 |
$output .= "\n" . ' <link rel="stylesheet" type="text/css" href="cssparsed.css" />';
|
|
|
159 |
}
|
160 |
$output .= "\n</head>\n<body><code id=\"copytext\">";
|
161 |
$output .= $this->formatted();
|
170 |
* @access private
|
171 |
* @version 2.0
|
172 |
*/
|
173 |
+
public function _print($plain = false, $default_media='') {
|
174 |
if ($this->output_css && $this->output_css_plain) {
|
175 |
return;
|
176 |
}
|
191 |
}
|
192 |
|
193 |
if (!empty($this->charset)) {
|
194 |
+
$output .= $template[0] . '@charset ' . $template[5] . $this->charset . $template[6] . $template[13];
|
195 |
}
|
196 |
|
197 |
if (!empty($this->import)) {
|
198 |
for ($i = 0, $size = count($this->import); $i < $size; $i++) {
|
199 |
+
if (substr($this->import[$i], 0, 4) === 'url(' && substr($this->import[$i], -1, 1) === ')') {
|
200 |
+
$this->import[$i] = '"' . substr($this->import[$i], 4, -1) . '"';
|
|
|
|
|
201 |
$this->parser->log('Optimised @import : Removed "url("', 'Information');
|
202 |
}
|
203 |
+
else if (!preg_match('/^".+"$/',$this->import[$i])) {
|
204 |
+
// fixes a bug for @import ".." instead of the expected @import url("..")
|
205 |
+
// If it comes in due to @import ".." the "" will be missing and the output will become @import .. (which is an error)
|
206 |
+
$this->import[$i] = '"' . $this->import[$i] . '"';
|
207 |
+
}
|
208 |
+
|
209 |
+
$output .= $template[0] . '@import ' . $template[5] . $this->import[$i] . $template[6] . $template[13];
|
210 |
}
|
211 |
}
|
212 |
|
213 |
if (!empty($this->namespace)) {
|
214 |
+
if (($p=strpos($this->namespace,"url("))!==false && substr($this->namespace, -1, 1) === ')') {
|
215 |
+
$this->namespace = substr_replace($this->namespace,'"',$p,4);
|
216 |
+
$this->namespace = substr($this->namespace, 0, -1) . '"';
|
217 |
$this->parser->log('Optimised @namespace : Removed "url("', 'Information');
|
218 |
}
|
219 |
+
$output .= $template[0] . '@namespace ' . $template[5] . $this->namespace . $template[6] . $template[13];
|
220 |
}
|
221 |
|
222 |
+
$in_at_out = [];
|
|
|
223 |
$out = & $output;
|
224 |
+
$indent_level = 0;
|
225 |
|
226 |
foreach ($this->tokens as $key => $token) {
|
227 |
switch ($token[0]) {
|
228 |
case AT_START:
|
229 |
$out .= $template[0] . $this->_htmlsp($token[1], $plain) . $template[1];
|
230 |
+
$indent_level++;
|
231 |
+
if (!isset($in_at_out[$indent_level])) {
|
232 |
+
$in_at_out[$indent_level] = '';
|
233 |
+
}
|
234 |
+
$out = & $in_at_out[$indent_level];
|
235 |
break;
|
236 |
|
237 |
case SEL_START:
|
238 |
if ($this->parser->get_cfg('lowercase_s'))
|
239 |
$token[1] = strtolower($token[1]);
|
240 |
+
$out .= ( $token[1][0] !== '@') ? $template[2] . $this->_htmlsp($token[1], $plain) : $template[0] . $this->_htmlsp($token[1], $plain);
|
241 |
$out .= $template[3];
|
242 |
break;
|
243 |
|
266 |
break;
|
267 |
|
268 |
case AT_END:
|
269 |
+
if (strlen($template[10])) {
|
270 |
+
// indent the bloc we are closing
|
271 |
+
$out = str_replace("\n\n", "\r\n", $out); // don't fill empty lines
|
272 |
+
$out = str_replace("\n", "\n" . $template[10], $out);
|
273 |
+
$out = str_replace("\r\n", "\n\n", $out);
|
274 |
+
}
|
275 |
+
if ($indent_level > 1) {
|
276 |
+
$out = & $in_at_out[$indent_level-1];
|
277 |
+
}
|
278 |
+
else {
|
279 |
+
$out = & $output;
|
280 |
+
}
|
281 |
+
$out .= $template[10] . $in_at_out[$indent_level];
|
282 |
+
if ($this->_seeknocomment($key, 1) != AT_END) {
|
283 |
+
$out .= $template[9];
|
284 |
+
}
|
285 |
+
else {
|
286 |
+
$out .= rtrim($template[9]);
|
287 |
+
}
|
288 |
+
|
289 |
+
unset($in_at_out[$indent_level]);
|
290 |
+
$indent_level--;
|
291 |
break;
|
292 |
|
293 |
+
case IMPORTANT_COMMENT:
|
294 |
case COMMENT:
|
295 |
$out .= $template[11] . '/*' . $this->_htmlsp($token[1], $plain) . '*/' . $template[12];
|
296 |
break;
|
316 |
* @access private
|
317 |
* @version 1.0
|
318 |
*/
|
319 |
+
public function _seeknocomment($key, $move) {
|
320 |
$go = ($move > 0) ? 1 : -1;
|
321 |
for ($i = $key + 1; abs($key - $i) - 1 < abs($move); $i += $go) {
|
322 |
if (!isset($this->tokens[$i])) {
|
336 |
* @access private
|
337 |
* @version 1.0
|
338 |
*/
|
339 |
+
public function _convert_raw_css($default_media='') {
|
340 |
$this->tokens = array();
|
341 |
+
$sort_selectors = $this->parser->get_cfg('sort_selectors');
|
342 |
+
$sort_properties = $this->parser->get_cfg('sort_properties');
|
343 |
+
|
344 |
+
// important comment section ?
|
345 |
+
if (isset($this->css['!'])) {
|
346 |
+
$this->parser->_add_token(IMPORTANT_COMMENT, rtrim($this->css['!']), true);
|
347 |
+
unset($this->css['!']);
|
348 |
+
}
|
349 |
|
350 |
foreach ($this->css as $medium => $val) {
|
351 |
+
if ($sort_selectors)
|
352 |
ksort($val);
|
353 |
if (intval($medium) < DEFAULT_AT) {
|
354 |
+
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
355 |
+
if (strlen(trim($medium))) {
|
356 |
+
$parts_to_open = explode('{', $medium);
|
357 |
+
foreach ($parts_to_open as $part) {
|
358 |
+
$this->parser->_add_token(AT_START, $part, true);
|
359 |
+
}
|
360 |
+
}
|
361 |
+
} elseif ($default_media) {
|
362 |
$this->parser->_add_token(AT_START, $default_media, true);
|
363 |
}
|
364 |
+
|
365 |
foreach ($val as $selector => $vali) {
|
366 |
+
if ($sort_properties)
|
367 |
ksort($vali);
|
368 |
$this->parser->_add_token(SEL_START, $selector, true);
|
369 |
|
370 |
+
$invalid = array(
|
371 |
+
'*' => array(), // IE7 hacks first
|
372 |
+
'_' => array(), // IE6 hacks
|
373 |
+
'/' => array(), // IE6 hacks
|
374 |
+
'-' => array() // IE6 hacks
|
375 |
+
);
|
376 |
foreach ($vali as $property => $valj) {
|
377 |
+
if (strncmp($property,"//",2)!==0) {
|
378 |
+
$matches = array();
|
379 |
+
if ($sort_properties && preg_match('/^(\*|_|\/|-)(?!(ms|moz|o\b|xv|atsc|wap|khtml|webkit|ah|hp|ro|rim|tc)-)/', $property, $matches)) {
|
380 |
+
$invalid[$matches[1]][$property] = $valj;
|
381 |
+
} else {
|
382 |
+
$this->parser->_add_token(PROPERTY, $property, true);
|
383 |
+
$this->parser->_add_token(VALUE, $valj, true);
|
384 |
+
}
|
385 |
+
}
|
386 |
+
}
|
387 |
+
foreach ($invalid as $prefix => $props) {
|
388 |
+
foreach ($props as $property => $valj) {
|
389 |
+
$this->parser->_add_token(PROPERTY, $property, true);
|
390 |
+
$this->parser->_add_token(VALUE, $valj, true);
|
391 |
+
}
|
392 |
}
|
|
|
393 |
$this->parser->_add_token(SEL_END, $selector, true);
|
394 |
}
|
395 |
|
396 |
if (intval($medium) < DEFAULT_AT) {
|
397 |
+
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
398 |
+
if (strlen(trim($medium))) {
|
399 |
+
$parts_to_close = explode('{', $medium);
|
400 |
+
foreach (array_reverse($parts_to_close) as $part) {
|
401 |
+
$this->parser->_add_token(AT_END, $part, true);
|
402 |
+
}
|
403 |
+
}
|
404 |
+
} elseif ($default_media) {
|
405 |
$this->parser->_add_token(AT_END, $default_media, true);
|
406 |
}
|
407 |
}
|
416 |
* @access private
|
417 |
* @version 1.0
|
418 |
*/
|
419 |
+
public function _htmlsp($string, $plain) {
|
420 |
if (!$plain) {
|
421 |
return htmlspecialchars($string, ENT_QUOTES, 'utf-8');
|
422 |
}
|
429 |
* @return float
|
430 |
* @version 1.2
|
431 |
*/
|
432 |
+
public function get_ratio() {
|
433 |
if (!$this->output_css_plain) {
|
434 |
$this->formatted();
|
435 |
}
|
442 |
* @return string
|
443 |
* @version 1.1
|
444 |
*/
|
445 |
+
public function get_diff() {
|
446 |
if (!$this->output_css_plain) {
|
447 |
$this->formatted();
|
448 |
}
|
465 |
* @return integer
|
466 |
* @version 1.0
|
467 |
*/
|
468 |
+
public function size($loc = 'output') {
|
469 |
if ($loc === 'output' && !$this->output_css) {
|
470 |
$this->formatted();
|
471 |
}
|
classes/csstidy/composer.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "cerdic/css-tidy",
|
3 |
+
"description": "CSSTidy is a CSS minifier",
|
4 |
+
"license": "LGPL-2.1-or-later",
|
5 |
+
"authors": [
|
6 |
+
{
|
7 |
+
"name": "Cédric MORIN",
|
8 |
+
"email": "changeme@mailinator.com"
|
9 |
+
}
|
10 |
+
],
|
11 |
+
"repositories": [
|
12 |
+
{
|
13 |
+
"type": "vcs",
|
14 |
+
"url": "https://github.com/pear/Text_Diff",
|
15 |
+
"no-api": true
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"autoload": {
|
19 |
+
"classmap": [
|
20 |
+
"class.csstidy_optimise.php",
|
21 |
+
"class.csstidy_print.php",
|
22 |
+
"class.csstidy.php"
|
23 |
+
]
|
24 |
+
},
|
25 |
+
"autoload-dev": {
|
26 |
+
"classmap": [
|
27 |
+
"testing"
|
28 |
+
]
|
29 |
+
},
|
30 |
+
"require": {
|
31 |
+
"php": "^5.4.0 || ^7"
|
32 |
+
},
|
33 |
+
"require-dev": {
|
34 |
+
"pear/text_diff": "^1.2",
|
35 |
+
"simpletest/simpletest": "^1.1"
|
36 |
+
},
|
37 |
+
"bin": ["bin/pcsstidy"],
|
38 |
+
"archive": {
|
39 |
+
"exclude": [
|
40 |
+
"/.gitignore",
|
41 |
+
"/.travis.yml",
|
42 |
+
"/testing"
|
43 |
+
]
|
44 |
+
}
|
45 |
+
}
|
classes/csstidy/css_optimiser.php
ADDED
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CSSTidy - CSS Optimiser Interface
|
5 |
+
* This file produces an XHTML interface for optimising CSS code
|
6 |
+
*
|
7 |
+
* Copyright 2005, 2006, 2007 Florian Schmitz
|
8 |
+
*
|
9 |
+
* This file is part of CSSTidy.
|
10 |
+
*
|
11 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
12 |
+
* it under the terms of the GNU Lesser General Public License as published by
|
13 |
+
* the Free Software Foundation; either version 2.1 of the License, or
|
14 |
+
* (at your option) any later version.
|
15 |
+
*
|
16 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
17 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
* GNU Lesser General Public License for more details.
|
20 |
+
*
|
21 |
+
* You should have received a copy of the GNU Lesser General Public License
|
22 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
23 |
+
*
|
24 |
+
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
|
25 |
+
* @package csstidy
|
26 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
27 |
+
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
28 |
+
*/
|
29 |
+
|
30 |
+
require('class.csstidy.php');
|
31 |
+
require('lang.inc.php');
|
32 |
+
|
33 |
+
|
34 |
+
if (get_magic_quotes_gpc()) {
|
35 |
+
if (isset($_REQUEST['css_text'])) {
|
36 |
+
$_REQUEST['css_text'] = stripslashes($_REQUEST['css_text']);
|
37 |
+
}
|
38 |
+
if (isset($_REQUEST['custom'])) {
|
39 |
+
$_REQUEST['custom'] = stripslashes($_REQUEST['custom']);
|
40 |
+
}
|
41 |
+
if (isset($_COOKIE['custom_template'])) {
|
42 |
+
$_COOKIE['custom_template'] = stripslashes($_COOKIE['custom_template']);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
function rmdirr($dirname,$oc=0)
|
47 |
+
{
|
48 |
+
// Sanity check
|
49 |
+
if (!file_exists($dirname)) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
// Simple delete for a file
|
53 |
+
if (is_file($dirname) && (time()-fileatime($dirname))>3600) {
|
54 |
+
return unlink($dirname);
|
55 |
+
}
|
56 |
+
// Loop through the folder
|
57 |
+
if (is_dir($dirname)) {
|
58 |
+
$dir = dir($dirname);
|
59 |
+
while (false !== $entry = $dir->read()) {
|
60 |
+
// Skip pointers
|
61 |
+
if ($entry === '.' || $entry === '..') {
|
62 |
+
continue;
|
63 |
+
}
|
64 |
+
// Recurse
|
65 |
+
rmdirr($dirname.'/'.$entry,$oc);
|
66 |
+
}
|
67 |
+
$dir->close();
|
68 |
+
}
|
69 |
+
// Clean up
|
70 |
+
if ($oc==1) {
|
71 |
+
return rmdir($dirname);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
function options($options, $selected = null, $labelIsValue = false)
|
76 |
+
{
|
77 |
+
$html = '';
|
78 |
+
|
79 |
+
settype($selected, 'array');
|
80 |
+
settype($options, 'array');
|
81 |
+
|
82 |
+
foreach ($options as $value=>$label) {
|
83 |
+
if (is_array($label)) {
|
84 |
+
$value = $label[0];
|
85 |
+
$label = $label[1];
|
86 |
+
}
|
87 |
+
$label = htmlspecialchars($label, ENT_QUOTES, 'utf-8');
|
88 |
+
$value = $labelIsValue ? $label
|
89 |
+
: htmlspecialchars($value, ENT_QUOTES, 'utf-8');
|
90 |
+
|
91 |
+
$html .= '<option value="'.$value.'"';
|
92 |
+
if (in_array($value, $selected)) {
|
93 |
+
$html .= ' selected="selected"';
|
94 |
+
}
|
95 |
+
$html .= '>'.$label.'</option>';
|
96 |
+
}
|
97 |
+
if (!$html) {
|
98 |
+
$html .= '<option value="0">---</option>';
|
99 |
+
}
|
100 |
+
|
101 |
+
return $html;
|
102 |
+
}
|
103 |
+
|
104 |
+
$css = new csstidy();
|
105 |
+
$is_custom = isset($_REQUEST['custom']) && !empty($_REQUEST['custom']) && isset($_REQUEST['template']) && ($_REQUEST['template'] === '4');
|
106 |
+
if ($is_custom)
|
107 |
+
{
|
108 |
+
setcookie ('custom_template', $_REQUEST['custom'], time()+360000);
|
109 |
+
}
|
110 |
+
|
111 |
+
rmdirr('temp');
|
112 |
+
|
113 |
+
if (isset($_REQUEST['case_properties'])) $css->set_cfg('case_properties',$_REQUEST['case_properties']);
|
114 |
+
if (isset($_REQUEST['lowercase'])) $css->set_cfg('lowercase_s',true);
|
115 |
+
if (!isset($_REQUEST['compress_c']) && isset($_REQUEST['post'])) $css->set_cfg('compress_colors',false);
|
116 |
+
if (!isset($_REQUEST['compress_fw']) && isset($_REQUEST['post'])) $css->set_cfg('compress_font-weight',false);
|
117 |
+
if (isset($_REQUEST['merge_selectors'])) $css->set_cfg('merge_selectors', $_REQUEST['merge_selectors']);
|
118 |
+
if (isset($_REQUEST['optimise_shorthands'])) $css->set_cfg('optimise_shorthands',$_REQUEST['optimise_shorthands']);
|
119 |
+
if (!isset($_REQUEST['rbs']) && isset($_REQUEST['post'])) $css->set_cfg('remove_bslash',false);
|
120 |
+
if (isset($_REQUEST['preserve_css'])) $css->set_cfg('preserve_css',true);
|
121 |
+
if (isset($_REQUEST['sort_sel'])) $css->set_cfg('sort_selectors',true);
|
122 |
+
if (isset($_REQUEST['sort_de'])) $css->set_cfg('sort_properties',true);
|
123 |
+
if (isset($_REQUEST['remove_last_sem'])) $css->set_cfg('remove_last_;',true);
|
124 |
+
if (isset($_REQUEST['discard'])) $css->set_cfg('discard_invalid_properties',true);
|
125 |
+
if (isset($_REQUEST['css_level'])) $css->set_cfg('css_level',$_REQUEST['css_level']);
|
126 |
+
if (isset($_REQUEST['timestamp'])) $css->set_cfg('timestamp',true);
|
127 |
+
if (isset($_REQUEST['rtl'])) $css->set_cfg('reverse_left_and_right',true);
|
128 |
+
|
129 |
+
|
130 |
+
// This by itself is enough since our scripts don't use DOM to create elements (in which case the namespace aware ones
|
131 |
+
// should be used when serving as application/xhtml+xml but not when served as text/html ;
|
132 |
+
// also, case will be different when retrieving element names, as HTML DOM returns in upper case,
|
133 |
+
// genuine XHTML DOM (when XHTML served as such) as lower
|
134 |
+
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
|
135 |
+
$http_accept = 'application/xhtml+xml';
|
136 |
+
} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'application/xml')) {
|
137 |
+
$http_accept = 'application/xml';
|
138 |
+
} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'text/xml')) {
|
139 |
+
$http_accept = 'text/xml';
|
140 |
+
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Opera ') || stristr($_SERVER['HTTP_USER_AGENT'], 'Opera/')) {
|
141 |
+
preg_match('@Opera/(\d)@', $_SERVER['HTTP_USER_AGENT'], $matches);
|
142 |
+
if (isset($matches[1]) && $matches[1] >= 7) {
|
143 |
+
$http_accept = 'application/xhtml+xml';
|
144 |
+
} else {
|
145 |
+
$http_accept = 'text/html';
|
146 |
+
}
|
147 |
+
} else {
|
148 |
+
$http_accept = 'text/html';
|
149 |
+
}
|
150 |
+
|
151 |
+
header('Content-Type: '.$http_accept.'; charset=utf-8');
|
152 |
+
|
153 |
+
if ($http_accept === 'text/html') {
|
154 |
+
|
155 |
+
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
156 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
157 |
+
<?php
|
158 |
+
} else {
|
159 |
+
|
160 |
+
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
161 |
+
<?php
|
162 |
+
}
|
163 |
+
|
164 |
+
?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $l; ?>">
|
165 |
+
<head>
|
166 |
+
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
167 |
+
<title>
|
168 |
+
<?php echo $lang[$l][0]; echo $css->version; ?>)
|
169 |
+
</title>
|
170 |
+
<link rel="stylesheet" href="cssparse.css" type="text/css" />
|
171 |
+
<script type="text/javascript"><!--/*--><![CDATA[/*><!--*/
|
172 |
+
function enable_disable_preserve() {
|
173 |
+
var inputs = new Array('sort_sel', 'sort_de', 'optimise_shorthands', 'merge_selectors', 'none');
|
174 |
+
var inputs_v = new Array( true, true, true, true, false);
|
175 |
+
for (var i = 0; i < inputs.length; i++) {
|
176 |
+
if (document.getElementById('preserve_css').checked) {
|
177 |
+
document.getElementById(inputs[i]).disabled = inputs_v[i];
|
178 |
+
} else {
|
179 |
+
document.getElementById(inputs[i]).disabled = !inputs_v[i];
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
function ClipBoard() {
|
184 |
+
if (window.clipboardData) { // Feature testing
|
185 |
+
window.clipboardData.setData('Text',document.getElementById("copytext").innerText);
|
186 |
+
} else if (navigator.userAgent.indexOf('Gecko') != -1
|
187 |
+
&& navigator.userAgent.indexOf('Apple') == -1
|
188 |
+
) {
|
189 |
+
try {
|
190 |
+
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
191 |
+
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
|
192 |
+
getService(Components.interfaces.nsIClipboardHelper);
|
193 |
+
gClipboardHelper.copyString(document.getElementById("copytext").innerHTML);
|
194 |
+
}
|
195 |
+
catch (e) {
|
196 |
+
alert(e+"\n\n"+"<?php echo $lang[$l][66] ?>");
|
197 |
+
}
|
198 |
+
} else {
|
199 |
+
alert("<?php echo $lang[$l][60]; ?>");
|
200 |
+
}
|
201 |
+
}
|
202 |
+
/*]]>*/-->
|
203 |
+
</script>
|
204 |
+
</head>
|
205 |
+
<body onload="enable_disable_preserve()">
|
206 |
+
<div><h1 style="display:inline">
|
207 |
+
<?php echo $lang[$l][1]; ?>
|
208 |
+
</h1>
|
209 |
+
<?php echo $lang[$l][2]; ?> <a
|
210 |
+
href="http://csstidy.sourceforge.net/">csstidy</a> <?php echo $css->version; ?>)
|
211 |
+
</div><p>
|
212 |
+
<?php echo $lang[$l][39]; ?>: <a hreflang="en" href="?lang=en">English</a> <a hreflang="de" href="?lang=de">Deutsch</a> <a hreflang="fr" href="?lang=fr">French</a> <a hreflang="zh" href="?lang=zh">Chinese</a></p>
|
213 |
+
<p><?php echo $lang[$l][4]; ?>
|
214 |
+
<?php echo $lang[$l][6]; ?>
|
215 |
+
</p>
|
216 |
+
|
217 |
+
<form method="post" action="">
|
218 |
+
<div>
|
219 |
+
<fieldset id="field_input">
|
220 |
+
<legend><?php echo $lang[$l][8]; ?></legend> <label for="css_text"
|
221 |
+
class="block"><?php echo $lang[$l][9]; ?></label><textarea id="css_text" name="css_text" rows="20" cols="35"><?php if (isset($_REQUEST['css_text'])) echo htmlspecialchars($_REQUEST['css_text'], ENT_QUOTES, "utf-8"); ?></textarea>
|
222 |
+
<label for="url"><?php echo $lang[$l][10]; ?></label> <input type="text"
|
223 |
+
name="url" id="url" <?php if (isset($_REQUEST['url']) &&
|
224 |
+
!empty($_REQUEST['url'])) echo 'value="',htmlspecialchars($_REQUEST['url'], ENT_QUOTES, 'utf-8'),'"'; ?>
|
225 |
+
size="35" /><br />
|
226 |
+
<input type="submit" value="<?php echo $lang[$l][35]; ?>" id="submit" />
|
227 |
+
</fieldset>
|
228 |
+
<div id="rightcol">
|
229 |
+
<fieldset id="code_layout">
|
230 |
+
<legend><?php echo $lang[$l][11]; ?></legend> <label for="template"
|
231 |
+
class="block"><?php echo $lang[$l][12]; ?></label> <select
|
232 |
+
id="template" name="template" style="margin-bottom:1em">
|
233 |
+
<?php
|
234 |
+
$num = (isset($_REQUEST['template'])) ? intval($_REQUEST['template']) : 1;
|
235 |
+
echo options(array(3 => $lang[$l][13], 2 => $lang[$l][14], 1 => $lang[$l][15], 0 => $lang[$l][16], 4 => $lang[$l][17]), $num);
|
236 |
+
?>
|
237 |
+
</select><br />
|
238 |
+
<label for="custom" class="block">
|
239 |
+
<?php echo $lang[$l][18]; ?> </label> <textarea id="custom"
|
240 |
+
name="custom" cols="33" rows="4"><?php
|
241 |
+
if ($is_custom) echo
|
242 |
+
htmlspecialchars($_REQUEST['custom'], ENT_QUOTES, 'utf-8');
|
243 |
+
elseif(isset($_COOKIE['custom_template']) &&
|
244 |
+
!empty($_COOKIE['custom_template'])) echo
|
245 |
+
htmlspecialchars($_COOKIE['custom_template'], ENT_QUOTES, 'utf-8');
|
246 |
+
?></textarea>
|
247 |
+
</fieldset>
|
248 |
+
<fieldset id="options">
|
249 |
+
<legend><?php echo $lang[$l][19]; ?></legend>
|
250 |
+
|
251 |
+
<input onchange="enable_disable_preserve()" type="checkbox" name="preserve_css" id="preserve_css"
|
252 |
+
<?php if ($css->get_cfg('preserve_css')) echo 'checked="checked"'; ?> />
|
253 |
+
<label for="preserve_css" title="<?php echo $lang[$l][52]; ?>" class="help"><?php echo $lang[$l][51]; ?></label><br />
|
254 |
+
|
255 |
+
|
256 |
+
<input type="checkbox" name="sort_sel" id="sort_sel"
|
257 |
+
<?php if ($css->get_cfg('sort_selectors')) echo 'checked="checked"'; ?> />
|
258 |
+
<label for="sort_sel" title="<?php echo $lang[$l][41]; ?>" class="help"><?php echo $lang[$l][20]; ?></label><br />
|
259 |
+
|
260 |
+
|
261 |
+
<input type="checkbox" name="sort_de" id="sort_de"
|
262 |
+
<?php if ($css->get_cfg('sort_properties')) echo 'checked="checked"'; ?> />
|
263 |
+
<label for="sort_de"><?php echo $lang[$l][21]; ?></label><br />
|
264 |
+
|
265 |
+
|
266 |
+
<label for="merge_selectors"><?php echo $lang[$l][22]; ?></label>
|
267 |
+
<select style="width:15em;" name="merge_selectors" id="merge_selectors">
|
268 |
+
<?php echo options(array('0' => $lang[$l][47], '1' => $lang[$l][48], '2' => $lang[$l][49]), $css->get_cfg('merge_selectors')); ?>
|
269 |
+
</select><br />
|
270 |
+
|
271 |
+
<label for="optimise_shorthands"><?php echo $lang[$l][23]; ?></label>
|
272 |
+
<select name="optimise_shorthands" id="optimise_shorthands">
|
273 |
+
<?php echo options(array($lang[$l][54], $lang[$l][55], $lang[$l][56]), $css->get_cfg('optimise_shorthands')); ?>
|
274 |
+
</select><br />
|
275 |
+
|
276 |
+
|
277 |
+
<input type="checkbox" name="compress_c" id="compress_c"
|
278 |
+
<?php if ($css->get_cfg('compress_colors')) echo 'checked="checked"';?> />
|
279 |
+
<label for="compress_c"><?php echo $lang[$l][24]; ?></label><br />
|
280 |
+
|
281 |
+
|
282 |
+
<input type="checkbox" name="compress_fw" id="compress_fw"
|
283 |
+
<?php if ($css->get_cfg('compress_font-weight')) echo 'checked="checked"';?> />
|
284 |
+
<label for="compress_fw"><?php echo $lang[$l][45]; ?></label><br />
|
285 |
+
|
286 |
+
|
287 |
+
<input type="checkbox" name="lowercase" id="lowercase" value="lowercase"
|
288 |
+
<?php if ($css->get_cfg('lowercase_s')) echo 'checked="checked"'; ?> />
|
289 |
+
<label title="<?php echo $lang[$l][30]; ?>" class="help" for="lowercase"><?php echo $lang[$l][25]; ?></label><br />
|
290 |
+
|
291 |
+
|
292 |
+
<?php echo $lang[$l][26]; ?><br />
|
293 |
+
<input type="radio" name="case_properties" id="none" value="0"
|
294 |
+
<?php if ($css->get_cfg('case_properties') === 0) echo 'checked="checked"'; ?> />
|
295 |
+
<label for="none"><?php echo $lang[$l][53]; ?></label>
|
296 |
+
<input type="radio" name="case_properties" id="lower_yes" value="1"
|
297 |
+
<?php if ($css->get_cfg('case_properties') === 1) echo 'checked="checked"'; ?> />
|
298 |
+
<label for="lower_yes"><?php echo $lang[$l][27]; ?></label>
|
299 |
+
<input type="radio" name="case_properties" id="upper_yes" value="2"
|
300 |
+
<?php if ($css->get_cfg('case_properties') === 2) echo 'checked="checked"'; ?> />
|
301 |
+
<label for="upper_yes"><?php echo $lang[$l][29]; ?></label><br />
|
302 |
+
|
303 |
+
<input type="checkbox" name="rbs" id="rbs"
|
304 |
+
<?php if ($css->get_cfg('remove_bslash')) echo 'checked="checked"'; ?> />
|
305 |
+
<label for="rbs"><?php echo $lang[$l][31]; ?></label><br />
|
306 |
+
|
307 |
+
|
308 |
+
<input type="checkbox" id="remove_last_sem" name="remove_last_sem"
|
309 |
+
<?php if ($css->get_cfg('remove_last_;')) echo 'checked="checked"'; ?> />
|
310 |
+
<label for="remove_last_sem"><?php echo $lang[$l][42]; ?></label><br />
|
311 |
+
|
312 |
+
|
313 |
+
<input type="checkbox" id="discard" name="discard"
|
314 |
+
<?php if ($css->get_cfg('discard_invalid_properties')) echo 'checked="checked"'; ?> />
|
315 |
+
<label for="discard"><?php echo $lang[$l][43]; ?></label>
|
316 |
+
<select name="css_level"><?php echo options(array('CSS3.0','CSS2.1','CSS2.0','CSS1.0'),$css->get_cfg('css_level'), true); ?></select><br />
|
317 |
+
|
318 |
+
|
319 |
+
<input type="checkbox" id="timestamp" name="timestamp"
|
320 |
+
<?php if ($css->get_cfg('timestamp')) echo 'checked="checked"'; ?> />
|
321 |
+
<label for="timestamp"><?php echo $lang[$l][57]; ?></label><br />
|
322 |
+
|
323 |
+
<input type="checkbox" id="rtl" name="rtl"
|
324 |
+
<?php if ($css->get_cfg('reverse_left_and_right')) echo 'checked="checked"'; ?> />
|
325 |
+
<label for="rtl"><?php echo $lang[$l][67]; ?></label><br />
|
326 |
+
|
327 |
+
<input type="checkbox" id="whole_file" name="whole_file"
|
328 |
+
<?php if (isset($_REQUEST['whole_file'])) echo 'checked="checked"'; ?> />
|
329 |
+
<label for="whole_file"><?php echo $lang[$l][63]; ?></label><br />
|
330 |
+
|
331 |
+
|
332 |
+
<input type="checkbox" name="file_output" id="file_output" value="file_output"
|
333 |
+
<?php if (isset($_REQUEST['file_output'])) echo 'checked="checked"'; ?> />
|
334 |
+
<label class="help" title="<?php echo $lang[$l][34]; ?>" for="file_output">
|
335 |
+
<strong><?php echo $lang[$l][33]; ?></strong>
|
336 |
+
</label><br />
|
337 |
+
|
338 |
+
</fieldset>
|
339 |
+
<input type="hidden" name="post" />
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
</form>
|
343 |
+
<?php
|
344 |
+
|
345 |
+
$file_ok = false;
|
346 |
+
$result = false;
|
347 |
+
|
348 |
+
$url = (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) ? $_REQUEST['url'] : false;
|
349 |
+
|
350 |
+
if (isset($_REQUEST['template'])) {
|
351 |
+
switch ($_REQUEST['template']) {
|
352 |
+
case 4:
|
353 |
+
if ($is_custom) {
|
354 |
+
$css->load_template($_REQUEST['custom'],false);
|
355 |
+
}
|
356 |
+
break;
|
357 |
+
|
358 |
+
case 3:
|
359 |
+
$css->load_template('highest_compression');
|
360 |
+
break;
|
361 |
+
|
362 |
+
case 2:
|
363 |
+
$css->load_template('high_compression');
|
364 |
+
break;
|
365 |
+
|
366 |
+
case 0:
|
367 |
+
$css->load_template('low_compression');
|
368 |
+
break;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
if ($url) {
|
373 |
+
if (substr($_REQUEST['url'],0,7) !== 'http://') {
|
374 |
+
$_REQUEST['url'] = 'http://'.$_REQUEST['url'];
|
375 |
+
}
|
376 |
+
$result = $css->parse_from_url($_REQUEST['url'],0);
|
377 |
+
} elseif (isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5) {
|
378 |
+
$result = $css->parse($_REQUEST['css_text']);
|
379 |
+
}
|
380 |
+
|
381 |
+
if ($result) {
|
382 |
+
$ratio = $css->print->get_ratio();
|
383 |
+
$diff = $css->print->get_diff();
|
384 |
+
if (isset($_REQUEST['file_output'])) {
|
385 |
+
$filename = md5(mt_rand().time().mt_rand());
|
386 |
+
if (!is_dir('temp')) {
|
387 |
+
$madedir = mkdir('temp');
|
388 |
+
if (!$madedir) {
|
389 |
+
print 'Could not make directory "temp" in '.dirname(__FILE__);
|
390 |
+
exit;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
$handle = fopen('temp/'.$filename.'.css','w');
|
394 |
+
if ($handle) {
|
395 |
+
if (fwrite($handle,$css->print->plain())) {
|
396 |
+
$file_ok = true;
|
397 |
+
}
|
398 |
+
}
|
399 |
+
fclose($handle);
|
400 |
+
}
|
401 |
+
if ($ratio>0) $ratio = '<span style="color:green">'.$ratio.'%</span>
|
402 |
+
('.$diff.' Bytes)'; else $ratio = '<span
|
403 |
+
style="color:red;">'.$ratio.'%</span> ('.$diff.' Bytes)';
|
404 |
+
if (count($css->log) > 0): ?>
|
405 |
+
<fieldset id="messages"><legend>Messages</legend>
|
406 |
+
<div><dl><?php
|
407 |
+
foreach ($css->log as $line => $array) {
|
408 |
+
echo '<dt>',$line,'</dt>';
|
409 |
+
$array_size = count($array);
|
410 |
+
for ($i = 0; $i < $array_size; ++$i) {
|
411 |
+
echo '<dd class="',$array[$i]['t'],'">',$array[$i]['m'],'</dd>';
|
412 |
+
}
|
413 |
+
}
|
414 |
+
?></dl></div>
|
415 |
+
</fieldset>
|
416 |
+
<?php endif;
|
417 |
+
echo '<fieldset><legend>',$lang[$l][37],': ',$css->print->size('input'),'KB, ',$lang[$l][38],':',$css->print->size('output'),'KB, ',$lang[$l][36],': ',$ratio;
|
418 |
+
if ($file_ok) {
|
419 |
+
echo ' - <a href="temp/',$filename,'.css">Download</a>';
|
420 |
+
}
|
421 |
+
echo ' - <a href="javascript:ClipBoard()">',$lang[$l][58],'</a>'
|
422 |
+
, '</legend>'
|
423 |
+
, '<code id="copytext">'
|
424 |
+
, $css->print->formatted()
|
425 |
+
, '</code></fieldset><div><br /></div>'
|
426 |
+
|
427 |
+
, '<fieldset class="code_output"><legend>',$lang[$l][64],'</legend>'
|
428 |
+
, '<textarea rows="10" cols="80">';
|
429 |
+
|
430 |
+
if (isset($_REQUEST['whole_file'])) {
|
431 |
+
echo htmlspecialchars($css->print->formatted_page('xhtml1.1', false, '', 'en'), ENT_QUOTES, 'utf-8');
|
432 |
+
} else {
|
433 |
+
echo htmlspecialchars('<code id="copytext">', ENT_QUOTES, 'utf-8'),"\n";
|
434 |
+
echo htmlspecialchars($css->print->formatted()."\n".'</code>', ENT_QUOTES, 'utf-8');
|
435 |
+
}
|
436 |
+
echo '</textarea></fieldset>'
|
437 |
+
, '<fieldset class="code_output"><legend>',$lang[$l][65],'</legend>'
|
438 |
+
, '<textarea rows="10" cols="30">';
|
439 |
+
|
440 |
+
echo file_get_contents('cssparsed.css');
|
441 |
+
echo '</textarea>'
|
442 |
+
|
443 |
+
, '</fieldset><p><a href="javascript:scrollTo(0,0)">↑ ',$lang[$l][59],'</a></p>';
|
444 |
+
|
445 |
+
} elseif (isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
|
446 |
+
echo '<p class="important">',$lang[$l][28],'</p>';
|
447 |
+
}
|
448 |
+
?>
|
449 |
+
<p style="text-align:center;font-size:.8em;clear:both">
|
450 |
+
<?php echo $lang[$l][61] ?> <a
|
451 |
+
href="http://csstidy.sourceforge.net/contact.php"><?php echo $lang[$l][62] ?></a>.
|
452 |
+
</p>
|
453 |
+
</body>
|
454 |
+
</html>
|
classes/csstidy/cssparse.css
CHANGED
@@ -1,118 +1,119 @@
|
|
1 |
-
@import
|
2 |
|
3 |
-
html,
|
4 |
-
font
|
5 |
-
background:#
|
6 |
}
|
7 |
|
8 |
code {
|
9 |
-
font-size:1.2em
|
10 |
}
|
11 |
|
12 |
div#rightcol {
|
13 |
-
padding-left:32em
|
14 |
}
|
15 |
|
16 |
fieldset {
|
17 |
display:block;
|
18 |
-
margin
|
19 |
padding:1em;
|
20 |
-
border:solid #
|
21 |
}
|
|
|
22 |
fieldset.code_output {
|
23 |
-
display:inline
|
24 |
}
|
25 |
|
26 |
h1 {
|
27 |
-
font-size:2em
|
28 |
}
|
29 |
|
30 |
small {
|
31 |
-
font-size
|
32 |
}
|
33 |
|
34 |
fieldset#field_input {
|
35 |
float:left;
|
36 |
-
margin:0
|
37 |
}
|
38 |
|
39 |
fieldset#options,fieldset#code_layout {
|
40 |
-
width:31em
|
41 |
}
|
42 |
|
43 |
input#submit {
|
44 |
clear:both;
|
45 |
display:block;
|
46 |
-
margin:1em
|
47 |
}
|
48 |
|
49 |
select {
|
50 |
-
margin:2px 0 0
|
51 |
}
|
52 |
|
53 |
label.block {
|
54 |
-
display:block
|
55 |
}
|
56 |
|
57 |
legend {
|
58 |
-
background:#
|
59 |
padding:2px 4px;
|
60 |
-
border:dashed 1px
|
61 |
}
|
62 |
|
63 |
textarea#css_text {
|
64 |
width:27em;
|
65 |
height:370px;
|
66 |
display:block;
|
67 |
-
margin-right:1em
|
68 |
}
|
69 |
|
70 |
.help {
|
71 |
-
cursor:help
|
72 |
}
|
73 |
|
74 |
p.important {
|
75 |
border:solid 1px red;
|
76 |
-
font-weight:
|
77 |
padding:1em;
|
78 |
-
background
|
79 |
}
|
80 |
|
81 |
p {
|
82 |
-
margin:1em 0
|
83 |
}
|
84 |
|
85 |
dl {
|
86 |
-
padding-left
|
87 |
}
|
88 |
|
89 |
dt {
|
90 |
-
font-weight:
|
91 |
margin:0;
|
92 |
float:left;
|
93 |
clear:both;
|
94 |
-
height:1.5em
|
95 |
}
|
96 |
|
97 |
dd {
|
98 |
margin:0 0 0 4em;
|
99 |
-
height:1.5em
|
100 |
}
|
101 |
|
102 |
fieldset#messages {
|
103 |
-
background
|
104 |
-
padding:0 0 0 1em
|
105 |
}
|
106 |
|
107 |
fieldset#messages div {
|
108 |
height:10em;
|
109 |
-
overflow:auto
|
110 |
}
|
111 |
|
112 |
dd.Warning {
|
113 |
-
color:orange
|
114 |
}
|
115 |
|
116 |
dd.Information {
|
117 |
-
color:green
|
118 |
}
|
1 |
+
@import "cssparsed.css";
|
2 |
|
3 |
+
html,body {
|
4 |
+
font:.8em Verdana,Helvetica,sans-serif;
|
5 |
+
background:#f8f8f6
|
6 |
}
|
7 |
|
8 |
code {
|
9 |
+
font-size:1.2em
|
10 |
}
|
11 |
|
12 |
div#rightcol {
|
13 |
+
padding-left:32em
|
14 |
}
|
15 |
|
16 |
fieldset {
|
17 |
display:block;
|
18 |
+
margin:.5em 0;
|
19 |
padding:1em;
|
20 |
+
border:solid #7284ab 2px
|
21 |
}
|
22 |
+
|
23 |
fieldset.code_output {
|
24 |
+
display:inline
|
25 |
}
|
26 |
|
27 |
h1 {
|
28 |
+
font-size:2em
|
29 |
}
|
30 |
|
31 |
small {
|
32 |
+
font-size:.7em
|
33 |
}
|
34 |
|
35 |
fieldset#field_input {
|
36 |
float:left;
|
37 |
+
margin:0 .5em 1em 0
|
38 |
}
|
39 |
|
40 |
fieldset#options,fieldset#code_layout {
|
41 |
+
width:31em
|
42 |
}
|
43 |
|
44 |
input#submit {
|
45 |
clear:both;
|
46 |
display:block;
|
47 |
+
margin:1em
|
48 |
}
|
49 |
|
50 |
select {
|
51 |
+
margin:2px 0 0
|
52 |
}
|
53 |
|
54 |
label.block {
|
55 |
+
display:block
|
56 |
}
|
57 |
|
58 |
legend {
|
59 |
+
background:#c4e1c3;
|
60 |
padding:2px 4px;
|
61 |
+
border:dashed 1px
|
62 |
}
|
63 |
|
64 |
textarea#css_text {
|
65 |
width:27em;
|
66 |
height:370px;
|
67 |
display:block;
|
68 |
+
margin-right:1em
|
69 |
}
|
70 |
|
71 |
.help {
|
72 |
+
cursor:help
|
73 |
}
|
74 |
|
75 |
p.important {
|
76 |
border:solid 1px red;
|
77 |
+
font-weight:700;
|
78 |
padding:1em;
|
79 |
+
background:#fff
|
80 |
}
|
81 |
|
82 |
p {
|
83 |
+
margin:1em 0
|
84 |
}
|
85 |
|
86 |
dl {
|
87 |
+
padding-left:.5em
|
88 |
}
|
89 |
|
90 |
dt {
|
91 |
+
font-weight:700;
|
92 |
margin:0;
|
93 |
float:left;
|
94 |
clear:both;
|
95 |
+
height:1.5em
|
96 |
}
|
97 |
|
98 |
dd {
|
99 |
margin:0 0 0 4em;
|
100 |
+
height:1.5em
|
101 |
}
|
102 |
|
103 |
fieldset#messages {
|
104 |
+
background:#fff;
|
105 |
+
padding:0 0 0 1em
|
106 |
}
|
107 |
|
108 |
fieldset#messages div {
|
109 |
height:10em;
|
110 |
+
overflow:auto
|
111 |
}
|
112 |
|
113 |
dd.Warning {
|
114 |
+
color:orange
|
115 |
}
|
116 |
|
117 |
dd.Information {
|
118 |
+
color:green
|
119 |
}
|
classes/csstidy/cssparsed.css
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
code#copytext {
|
2 |
-
|
3 |
-
|
4 |
-
}
|
5 |
-
|
6 |
-
.at {
|
7 |
-
color
|
8 |
-
}
|
9 |
-
|
10 |
-
.format {
|
11 |
-
color:gray
|
12 |
-
}
|
13 |
-
|
14 |
-
.property {
|
15 |
-
color:green
|
16 |
-
}
|
17 |
-
|
18 |
-
.selector {
|
19 |
-
color:blue
|
20 |
-
}
|
21 |
-
|
22 |
-
.value {
|
23 |
-
color:red;
|
24 |
-
left:
|
25 |
-
}
|
26 |
-
|
27 |
-
.comment {
|
28 |
-
color:orange
|
29 |
}
|
1 |
+
code#copytext {
|
2 |
+
white-space:pre;
|
3 |
+
font-family:Verdana
|
4 |
+
}
|
5 |
+
|
6 |
+
.at {
|
7 |
+
color:#00008b
|
8 |
+
}
|
9 |
+
|
10 |
+
.format {
|
11 |
+
color:gray
|
12 |
+
}
|
13 |
+
|
14 |
+
.property {
|
15 |
+
color:green
|
16 |
+
}
|
17 |
+
|
18 |
+
.selector {
|
19 |
+
color:blue
|
20 |
+
}
|
21 |
+
|
22 |
+
.value {
|
23 |
+
color:red;
|
24 |
+
left:500px
|
25 |
+
}
|
26 |
+
|
27 |
+
.comment {
|
28 |
+
color:orange
|
29 |
}
|
classes/csstidy/data-wp.inc.php
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
unset( $GLOBALS['csstidy']['all_properties']['binding'] );
|
4 |
-
|
5 |
-
$GLOBALS['csstidy']['all_properties']['text-size-adjust'] = 'CSS3.0';
|
6 |
-
|
7 |
-
// Support browser prefixes for properties only in the latest CSS draft
|
8 |
-
foreach ( $GLOBALS['csstidy']['all_properties'] as $property => $levels ) {
|
9 |
-
if ( strpos( $levels, "," ) === false ) {
|
10 |
-
$GLOBALS['csstidy']['all_properties']['-moz-' . $property] = $levels;
|
11 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-' . $property] = $levels;
|
12 |
-
$GLOBALS['csstidy']['all_properties']['-ms-' . $property] = $levels;
|
13 |
-
$GLOBALS['csstidy']['all_properties']['-o-' . $property] = $levels;
|
14 |
-
$GLOBALS['csstidy']['all_properties']['-khtml-' . $property] = $levels;
|
15 |
-
|
16 |
-
if ( in_array( $property, $GLOBALS['csstidy']['unit_values'] ) ) {
|
17 |
-
$GLOBALS['csstidy']['unit_values'][] = '-moz-' . $property;
|
18 |
-
$GLOBALS['csstidy']['unit_values'][] = '-webkit-' . $property;
|
19 |
-
$GLOBALS['csstidy']['unit_values'][] = '-ms-' . $property;
|
20 |
-
$GLOBALS['csstidy']['unit_values'][] = '-o-' . $property;
|
21 |
-
$GLOBALS['csstidy']['unit_values'][] = '-khtml-' . $property;
|
22 |
-
}
|
23 |
-
|
24 |
-
if ( in_array( $property, $GLOBALS['csstidy']['color_values'] ) ) {
|
25 |
-
$GLOBALS['csstidy']['color_values'][] = '-moz-' . $property;
|
26 |
-
$GLOBALS['csstidy']['color_values'][] = '-webkit-' . $property;
|
27 |
-
$GLOBALS['csstidy']['color_values'][] = '-ms-' . $property;
|
28 |
-
$GLOBALS['csstidy']['color_values'][] = '-o-' . $property;
|
29 |
-
$GLOBALS['csstidy']['color_values'][] = '-khtml-' . $property;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
foreach ( $GLOBALS['csstidy']['multiple_properties'] as $property ) {
|
35 |
-
if ( '-' != $property[0] ) {
|
36 |
-
$GLOBALS['csstidy']['multiple_properties'][] = '-o-' . $property;
|
37 |
-
$GLOBALS['csstidy']['multiple_properties'][] = '-ms-' . $property;
|
38 |
-
$GLOBALS['csstidy']['multiple_properties'][] = '-webkit-' . $property;
|
39 |
-
$GLOBALS['csstidy']['multiple_properties'][] = '-moz-' . $property;
|
40 |
-
$GLOBALS['csstidy']['multiple_properties'][] = '-khtml-' . $property;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* CSS Animation
|
46 |
-
*
|
47 |
-
* @see https://developer.mozilla.org/en/CSS/CSS_animations
|
48 |
-
*/
|
49 |
-
$GLOBALS['csstidy']['at_rules']['-webkit-keyframes'] = 'at';
|
50 |
-
$GLOBALS['csstidy']['at_rules']['-moz-keyframes'] = 'at';
|
51 |
-
$GLOBALS['csstidy']['at_rules']['-ms-keyframes'] = 'at';
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Non-standard CSS properties. They're not part of any spec, but we say
|
55 |
-
* they're in all of them so that we can support them.
|
56 |
-
*/
|
57 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-filter'] = 'CSS2.0,CSS2.1,CSS3.0';
|
58 |
-
$GLOBALS['csstidy']['all_properties']['-moz-filter'] = 'CSS2.0,CSS2.1,CSS3.0';
|
59 |
-
$GLOBALS['csstidy']['all_properties']['-ms-filter'] = 'CSS2.0,CSS2.1,CSS3.0';
|
60 |
-
$GLOBALS['csstidy']['all_properties']['filter'] = 'CSS2.0,CSS2.1,CSS3.0';
|
61 |
-
$GLOBALS['csstidy']['all_properties']['scrollbar-face-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
62 |
-
$GLOBALS['csstidy']['all_properties']['-ms-interpolation-mode'] = 'CSS2.0,CSS2.1,CSS3.0';
|
63 |
-
$GLOBALS['csstidy']['all_properties']['text-rendering'] = 'CSS2.0,CSS2.1,CSS3.0';
|
64 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-x'] = 'CSS3.0';
|
65 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-y'] = 'CSS3.0';
|
66 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-transform-origin-z'] = 'CSS3.0';
|
67 |
-
$GLOBALS['csstidy']['all_properties']['-webkit-font-smoothing'] = 'CSS3.0';
|
68 |
-
$GLOBALS['csstidy']['all_properties']['-font-smooth'] = 'CSS3.0';
|
69 |
-
$GLOBALS['csstidy']['all_properties']['-o-object-fit'] = 'CSS3.0';
|
70 |
-
$GLOBALS['csstidy']['all_properties']['object-fit'] = 'CSS3.0';
|
71 |
-
$GLOBALS['csstidy']['all_properties']['-o-object-position'] = 'CSS3.0';
|
72 |
-
$GLOBALS['csstidy']['all_properties']['object-position'] = 'CSS3.0';
|
73 |
-
$GLOBALS['csstidy']['all_properties']['text-overflow'] = 'CSS3.0';
|
74 |
-
$GLOBALS['csstidy']['all_properties']['zoom'] = 'CSS3.0';
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/csstidy/data.inc.php
CHANGED
@@ -24,60 +24,51 @@
|
|
24 |
* @author Nikolay Matsievsky (speed at webo dot name) 2010
|
25 |
*/
|
26 |
|
27 |
-
define('AT_START', 1);
|
28 |
-
define('AT_END', 2);
|
29 |
-
define('SEL_START', 3);
|
30 |
-
define('SEL_END', 4);
|
31 |
-
define('PROPERTY', 5);
|
32 |
-
define('VALUE', 6);
|
33 |
-
define('COMMENT', 7);
|
34 |
-
define('DEFAULT_AT', 41);
|
35 |
-
|
36 |
/**
|
37 |
* All whitespace allowed in CSS
|
38 |
*
|
39 |
-
* @global array $
|
40 |
* @version 1.0
|
41 |
*/
|
42 |
-
$
|
43 |
|
44 |
/**
|
45 |
* All CSS tokens used by csstidy
|
46 |
*
|
47 |
-
* @global string $
|
48 |
* @version 1.0
|
49 |
*/
|
50 |
-
$
|
51 |
|
52 |
/**
|
53 |
* All CSS units (CSS 3 units included)
|
54 |
*
|
55 |
* @see compress_numbers()
|
56 |
-
* @global array $
|
57 |
* @version 1.0
|
58 |
*/
|
59 |
-
$
|
60 |
|
61 |
/**
|
62 |
* Available at-rules
|
63 |
*
|
64 |
-
* @global array $
|
65 |
-
* @version 1.
|
66 |
*/
|
67 |
-
$
|
68 |
|
69 |
/**
|
70 |
* Properties that need a value with unit
|
71 |
*
|
72 |
* @todo CSS3 properties
|
73 |
* @see compress_numbers();
|
74 |
-
* @global array $
|
75 |
* @version 1.2
|
76 |
*/
|
77 |
-
$
|
78 |
-
|
79 |
'font-size', 'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height',
|
80 |
-
'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
|
81 |
'padding-bottom', 'padding-left', 'perspective', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width');
|
82 |
|
83 |
/**
|
@@ -85,577 +76,574 @@ $GLOBALS['csstidy']['unit_values'] = array ('background', 'background-position',
|
|
85 |
*
|
86 |
* @todo CSS3 properties
|
87 |
* @see compress_numbers();
|
88 |
-
* @global array $
|
89 |
* @version 1.0
|
90 |
*/
|
91 |
-
$
|
92 |
-
$
|
93 |
-
$
|
94 |
-
$
|
95 |
-
$
|
96 |
-
$
|
97 |
-
$
|
98 |
-
$
|
99 |
-
$
|
100 |
-
$
|
101 |
|
102 |
/**
|
103 |
* Default values for the background properties
|
104 |
*
|
105 |
* @todo Possibly property names will change during CSS3 development
|
106 |
-
* @global array $
|
107 |
* @see dissolve_short_bg()
|
108 |
* @see merge_bg()
|
109 |
* @version 1.0
|
110 |
*/
|
111 |
-
$
|
112 |
-
$
|
113 |
-
$
|
114 |
-
$
|
115 |
-
$
|
116 |
-
$
|
117 |
-
$
|
118 |
-
$
|
119 |
-
$
|
120 |
|
121 |
/**
|
122 |
* Default values for the font properties
|
123 |
*
|
124 |
-
* @global array $
|
125 |
* @see merge_fonts()
|
126 |
* @version 1.3
|
127 |
*/
|
128 |
-
$
|
129 |
-
$
|
130 |
-
$
|
131 |
-
$
|
132 |
-
$
|
133 |
-
$
|
134 |
-
$
|
135 |
|
136 |
/**
|
137 |
* A list of non-W3C color names which get replaced by their hex-codes
|
138 |
*
|
139 |
-
* @global array $
|
140 |
* @see cut_color()
|
141 |
* @version 1.0
|
142 |
*/
|
143 |
-
$
|
144 |
-
$
|
145 |
-
$
|
146 |
-
$
|
147 |
-
$
|
148 |
-
$
|
149 |
-
$
|
150 |
-
$
|
151 |
-
$
|
152 |
-
$
|
153 |
-
$
|
154 |
-
$
|
155 |
-
$
|
156 |
-
$
|
157 |
-
$
|
158 |
-
$
|
159 |
-
$
|
160 |
-
$
|
161 |
-
$
|
162 |
-
$
|
163 |
-
$
|
164 |
-
$
|
165 |
-
$
|
166 |
-
$
|
167 |
-
$
|
168 |
-
$
|
169 |
-
$
|
170 |
-
$
|
171 |
-
$
|
172 |
-
$
|
173 |
-
$
|
174 |
-
$
|
175 |
-
$
|
176 |
-
$
|
177 |
-
$
|
178 |
-
$
|
179 |
-
$
|
180 |
-
$
|
181 |
-
$
|
182 |
-
$
|
183 |
-
$
|
184 |
-
$
|
185 |
-
$
|
186 |
-
$
|
187 |
-
$
|
188 |
-
$
|
189 |
-
$
|
190 |
-
$
|
191 |
-
$
|
192 |
-
$
|
193 |
-
$
|
194 |
-
$
|
195 |
-
$
|
196 |
-
$
|
197 |
-
$
|
198 |
-
$
|
199 |
-
$
|
200 |
-
$
|
201 |
-
$
|
202 |
-
$
|
203 |
-
$
|
204 |
-
$
|
205 |
-
$
|
206 |
-
$
|
207 |
-
$
|
208 |
-
$
|
209 |
-
$
|
210 |
-
$
|
211 |
-
$
|
212 |
-
$
|
213 |
-
$
|
214 |
-
$
|
215 |
-
$
|
216 |
-
$
|
217 |
-
$
|
218 |
-
$
|
219 |
-
$
|
220 |
-
$
|
221 |
-
$
|
222 |
-
$
|
223 |
-
$
|
224 |
-
$
|
225 |
-
$
|
226 |
-
$
|
227 |
-
$
|
228 |
-
$
|
229 |
-
$
|
230 |
-
$
|
231 |
-
$
|
232 |
-
$
|
233 |
-
$
|
234 |
-
$
|
235 |
-
$
|
236 |
-
$
|
237 |
-
$
|
238 |
-
$
|
239 |
-
$
|
240 |
-
$
|
241 |
-
$
|
242 |
-
$
|
243 |
-
$
|
244 |
-
$
|
245 |
-
$
|
246 |
-
$
|
247 |
-
$
|
248 |
-
$
|
249 |
-
$
|
250 |
-
$
|
251 |
-
$
|
252 |
-
$
|
253 |
-
$
|
254 |
-
$
|
255 |
-
$
|
256 |
-
$
|
257 |
-
$
|
258 |
-
$
|
259 |
-
$
|
260 |
-
$
|
261 |
-
$
|
262 |
-
$
|
263 |
-
$
|
264 |
-
$
|
265 |
-
$
|
266 |
-
$
|
267 |
-
$
|
268 |
-
$
|
269 |
-
$
|
270 |
|
271 |
/**
|
272 |
* A list of all shorthand properties that are devided into four properties and/or have four subvalues
|
273 |
*
|
274 |
-
* @global array $
|
275 |
* @todo Are there new ones in CSS3?
|
276 |
* @see dissolve_4value_shorthands()
|
277 |
* @see merge_4value_shorthands()
|
278 |
* @version 1.0
|
279 |
*/
|
280 |
-
$
|
281 |
-
$
|
282 |
-
$
|
283 |
-
$
|
284 |
-
$
|
285 |
-
$
|
286 |
-
|
|
|
|
|
|
|
287 |
|
288 |
/**
|
289 |
* All CSS Properties. Needed for csstidy::property_is_next()
|
290 |
*
|
291 |
-
* @global array $
|
292 |
-
* @
|
293 |
-
* @version 1.0
|
294 |
* @see csstidy::property_is_next()
|
295 |
*/
|
296 |
-
$
|
297 |
-
$
|
298 |
-
$
|
299 |
-
$
|
300 |
-
$
|
301 |
-
$
|
302 |
-
$
|
303 |
-
$
|
304 |
-
$
|
305 |
-
$
|
306 |
-
$
|
307 |
-
$
|
308 |
-
$
|
309 |
-
$
|
310 |
-
$
|
311 |
-
$
|
312 |
-
$
|
313 |
-
$
|
314 |
-
$
|
315 |
-
$
|
316 |
-
$
|
317 |
-
$
|
318 |
-
$
|
319 |
-
$
|
320 |
-
$
|
321 |
-
$
|
322 |
-
$
|
323 |
-
$
|
324 |
-
$
|
325 |
-
$
|
326 |
-
$
|
327 |
-
$
|
328 |
-
$
|
329 |
-
$
|
330 |
-
$
|
331 |
-
$
|
332 |
-
$
|
333 |
-
$
|
334 |
-
$
|
335 |
-
$
|
336 |
-
$
|
337 |
-
$
|
338 |
-
$
|
339 |
-
$
|
340 |
-
$
|
341 |
-
$
|
342 |
-
$
|
343 |
-
$
|
344 |
-
$
|
345 |
-
$
|
346 |
-
$
|
347 |
-
$
|
348 |
-
$
|
349 |
-
$
|
350 |
-
$
|
351 |
-
$
|
352 |
-
$
|
353 |
-
$
|
354 |
-
$
|
355 |
-
$
|
356 |
-
$
|
357 |
-
$
|
358 |
-
$
|
359 |
-
$
|
360 |
-
$
|
361 |
-
$
|
362 |
-
$
|
363 |
-
$
|
364 |
-
$
|
365 |
-
$
|
366 |
-
$
|
367 |
-
$
|
368 |
-
$
|
369 |
-
$
|
370 |
-
$
|
371 |
-
$
|
372 |
-
$
|
373 |
-
$
|
374 |
-
$
|
375 |
-
$
|
376 |
-
$
|
377 |
-
$
|
378 |
-
$
|
379 |
-
$
|
380 |
-
$
|
381 |
-
$
|
382 |
-
$
|
383 |
-
$
|
384 |
-
$
|
385 |
-
$
|
386 |
-
$
|
387 |
-
$
|
388 |
-
$
|
389 |
-
$
|
390 |
-
$
|
391 |
-
$
|
392 |
-
$
|
393 |
-
$
|
394 |
-
$
|
395 |
-
$
|
396 |
-
$
|
397 |
-
$
|
398 |
-
$
|
399 |
-
$
|
400 |
-
$
|
401 |
-
$
|
402 |
-
$
|
403 |
-
$
|
404 |
-
$
|
405 |
-
$
|
406 |
-
$
|
407 |
-
$
|
408 |
-
$
|
409 |
-
$
|
410 |
-
$
|
411 |
-
$
|
412 |
-
$
|
413 |
-
$
|
414 |
-
$
|
415 |
-
$
|
416 |
-
$
|
417 |
-
$
|
418 |
-
$
|
419 |
-
$
|
420 |
-
$
|
421 |
-
$
|
422 |
-
$
|
423 |
-
$
|
424 |
-
$
|
425 |
-
$
|
426 |
-
$
|
427 |
-
$
|
428 |
-
$
|
429 |
-
$
|
430 |
-
$
|
431 |
-
$
|
432 |
-
$
|
433 |
-
$
|
434 |
-
$
|
435 |
-
$
|
436 |
-
$
|
437 |
-
$
|
438 |
-
$
|
439 |
-
$
|
440 |
-
$
|
441 |
-
$
|
442 |
-
$
|
443 |
-
$
|
444 |
-
$
|
445 |
-
$
|
446 |
-
$
|
447 |
-
$
|
448 |
-
$
|
449 |
-
$
|
450 |
-
$
|
451 |
-
$
|
452 |
-
$
|
453 |
-
$
|
454 |
-
$
|
455 |
-
$
|
456 |
-
$
|
457 |
-
$
|
458 |
-
$
|
459 |
-
$
|
460 |
-
$
|
461 |
-
$
|
462 |
-
$
|
463 |
-
$
|
464 |
-
$
|
465 |
-
$
|
466 |
-
$
|
467 |
-
$
|
468 |
-
$
|
469 |
-
$
|
470 |
-
$
|
471 |
-
$
|
472 |
-
$
|
473 |
-
$
|
474 |
-
$
|
475 |
-
$
|
476 |
-
$
|
477 |
-
$
|
478 |
-
$
|
479 |
-
$
|
480 |
-
$
|
481 |
-
$
|
482 |
-
$
|
483 |
-
$
|
484 |
-
$
|
485 |
-
$
|
486 |
-
$
|
487 |
-
$
|
488 |
-
$
|
489 |
-
$
|
490 |
-
$
|
491 |
-
$
|
492 |
-
$
|
493 |
-
$
|
494 |
-
$
|
495 |
-
$
|
496 |
-
$
|
497 |
-
$
|
498 |
-
$
|
499 |
-
$
|
500 |
-
$
|
501 |
-
$
|
502 |
-
$
|
503 |
-
$
|
504 |
-
$
|
505 |
-
$
|
506 |
-
$
|
507 |
-
$
|
508 |
-
$
|
509 |
-
$
|
510 |
-
$
|
511 |
-
$
|
512 |
-
$
|
513 |
-
$
|
514 |
-
$
|
515 |
-
$
|
516 |
-
$
|
517 |
-
$
|
518 |
-
$
|
519 |
-
$
|
520 |
-
$
|
521 |
-
$
|
522 |
-
$
|
523 |
-
$
|
524 |
-
$
|
525 |
-
$
|
526 |
-
$
|
527 |
-
$
|
528 |
-
$
|
529 |
-
$
|
530 |
-
$
|
531 |
-
$
|
532 |
-
$
|
533 |
-
$
|
534 |
-
$
|
535 |
-
$
|
536 |
-
$
|
537 |
-
$
|
538 |
-
$
|
539 |
-
$
|
540 |
-
$
|
541 |
-
$
|
542 |
-
$
|
543 |
-
$
|
544 |
-
$
|
545 |
-
$
|
546 |
-
$
|
547 |
-
$
|
548 |
-
$
|
549 |
-
$
|
550 |
-
$
|
551 |
-
$
|
552 |
-
$
|
553 |
-
$
|
554 |
-
$
|
555 |
-
$
|
556 |
-
$
|
557 |
-
$
|
558 |
-
$
|
559 |
-
$
|
560 |
-
$
|
561 |
-
$
|
562 |
-
$
|
563 |
-
$
|
564 |
-
$
|
565 |
-
$
|
566 |
-
$
|
567 |
-
$
|
568 |
-
$
|
569 |
-
$
|
570 |
-
$
|
571 |
-
$
|
572 |
-
$
|
573 |
-
$
|
574 |
-
$
|
575 |
-
$
|
576 |
|
577 |
/**
|
578 |
* An array containing all properties that can accept a quoted string as a value.
|
579 |
*
|
580 |
-
* @global array $
|
581 |
*/
|
582 |
-
$
|
583 |
|
584 |
/**
|
585 |
* An array containing all properties that can be defined multiple times without being overwritten.
|
586 |
-
* All unit values are included so that units like rem can be supported with fallbacks to px or em.
|
587 |
*
|
588 |
-
* @global array $
|
589 |
*/
|
590 |
-
$
|
591 |
|
592 |
/**
|
593 |
* An array containing all predefined templates.
|
594 |
*
|
595 |
-
* @global array $
|
596 |
* @version 1.0
|
597 |
* @see csstidy::load_template()
|
598 |
*/
|
599 |
-
$
|
600 |
-
$
|
601 |
-
$
|
602 |
-
$
|
603 |
-
$
|
604 |
-
$
|
605 |
-
$
|
606 |
-
$
|
607 |
-
$
|
608 |
-
$
|
609 |
-
$
|
610 |
-
$
|
611 |
-
$
|
612 |
-
$
|
613 |
-
|
614 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="at">';
|
615 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span> <span class="format">{</span>'."\n";
|
616 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="selector">';
|
617 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">{</span>';
|
618 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="property">';
|
619 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="value">';
|
620 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">;</span>';
|
621 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="format">}</span>';
|
622 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
623 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n". '<span class="format">}'."\n".'</span>';
|
624 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '';
|
625 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
|
626 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span>'; // after comment
|
627 |
-
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
628 |
-
|
629 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="at">';
|
630 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
631 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="selector">';
|
632 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
633 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="property">';
|
634 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="value">';
|
635 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">;</span>';
|
636 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
637 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
638 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
639 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
640 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="comment">'; // before comment
|
641 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span>'; // after comment
|
642 |
-
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
643 |
|
644 |
-
$
|
645 |
-
$
|
646 |
-
$
|
647 |
-
$
|
648 |
-
$
|
649 |
-
$
|
650 |
-
$
|
651 |
-
$
|
652 |
-
$
|
653 |
-
$
|
654 |
-
$
|
655 |
-
$
|
656 |
-
$
|
657 |
-
$
|
658 |
|
659 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
|
661 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
* @author Nikolay Matsievsky (speed at webo dot name) 2010
|
25 |
*/
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* All whitespace allowed in CSS
|
29 |
*
|
30 |
+
* @global array $data['csstidy']['whitespace']
|
31 |
* @version 1.0
|
32 |
*/
|
33 |
+
$data['csstidy']['whitespace'] = array(' ',"\n","\t","\r","\x0B");
|
34 |
|
35 |
/**
|
36 |
* All CSS tokens used by csstidy
|
37 |
*
|
38 |
+
* @global string $data['csstidy']['tokens']
|
39 |
* @version 1.0
|
40 |
*/
|
41 |
+
$data['csstidy']['tokens'] = '/@}{;:=\'"(,\\!$%&)*+.<>?[]^`|~';
|
42 |
|
43 |
/**
|
44 |
* All CSS units (CSS 3 units included)
|
45 |
*
|
46 |
* @see compress_numbers()
|
47 |
+
* @global array $data['csstidy']['units']
|
48 |
* @version 1.0
|
49 |
*/
|
50 |
+
$data['csstidy']['units'] = array('in','cm','mm','pt','pc','px','rem','em','%','ex','gd','vw','vh','vm','deg','grad','rad','turn','ms','s','khz','hz','ch','vmin','vmax','dpi','dpcm','dppx');
|
51 |
|
52 |
/**
|
53 |
* Available at-rules
|
54 |
*
|
55 |
+
* @global array $data['csstidy']['at_rules']
|
56 |
+
* @version 1.1
|
57 |
*/
|
58 |
+
$data['csstidy']['at_rules'] = array('page' => 'is','font-face' => 'atis','charset' => 'iv', 'import' => 'iv','namespace' => 'iv','media' => 'at', 'supports' => 'at', 'keyframes' => 'at','-moz-keyframes' => 'at','-o-keyframes' => 'at','-webkit-keyframes' => 'at','-ms-keyframes' => 'at');
|
59 |
|
60 |
/**
|
61 |
* Properties that need a value with unit
|
62 |
*
|
63 |
* @todo CSS3 properties
|
64 |
* @see compress_numbers();
|
65 |
+
* @global array $data['csstidy']['unit_values']
|
66 |
* @version 1.2
|
67 |
*/
|
68 |
+
$data['csstidy']['unit_values'] = array ('background', 'background-position', 'background-size', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-width',
|
69 |
+
'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'column-gap', 'column-width',
|
70 |
'font-size', 'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height',
|
71 |
+
'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
|
72 |
'padding-bottom', 'padding-left', 'perspective', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width');
|
73 |
|
74 |
/**
|
76 |
*
|
77 |
* @todo CSS3 properties
|
78 |
* @see compress_numbers();
|
79 |
+
* @global array $data['csstidy']['color_values']
|
80 |
* @version 1.0
|
81 |
*/
|
82 |
+
$data['csstidy']['color_values'] = array();
|
83 |
+
$data['csstidy']['color_values'][] = 'background-color';
|
84 |
+
$data['csstidy']['color_values'][] = 'border-color';
|
85 |
+
$data['csstidy']['color_values'][] = 'border-top-color';
|
86 |
+
$data['csstidy']['color_values'][] = 'border-right-color';
|
87 |
+
$data['csstidy']['color_values'][] = 'border-bottom-color';
|
88 |
+
$data['csstidy']['color_values'][] = 'border-left-color';
|
89 |
+
$data['csstidy']['color_values'][] = 'color';
|
90 |
+
$data['csstidy']['color_values'][] = 'outline-color';
|
91 |
+
$data['csstidy']['color_values'][] = 'column-rule-color';
|
92 |
|
93 |
/**
|
94 |
* Default values for the background properties
|
95 |
*
|
96 |
* @todo Possibly property names will change during CSS3 development
|
97 |
+
* @global array $data['csstidy']['background_prop_default']
|
98 |
* @see dissolve_short_bg()
|
99 |
* @see merge_bg()
|
100 |
* @version 1.0
|
101 |
*/
|
102 |
+
$data['csstidy']['background_prop_default'] = array();
|
103 |
+
$data['csstidy']['background_prop_default']['background-image'] = 'none';
|
104 |
+
$data['csstidy']['background_prop_default']['background-size'] = 'auto';
|
105 |
+
$data['csstidy']['background_prop_default']['background-repeat'] = 'repeat';
|
106 |
+
$data['csstidy']['background_prop_default']['background-position'] = '0 0';
|
107 |
+
$data['csstidy']['background_prop_default']['background-attachment'] = 'scroll';
|
108 |
+
$data['csstidy']['background_prop_default']['background-clip'] = 'border';
|
109 |
+
$data['csstidy']['background_prop_default']['background-origin'] = 'padding';
|
110 |
+
$data['csstidy']['background_prop_default']['background-color'] = 'transparent';
|
111 |
|
112 |
/**
|
113 |
* Default values for the font properties
|
114 |
*
|
115 |
+
* @global array $data['csstidy']['font_prop_default']
|
116 |
* @see merge_fonts()
|
117 |
* @version 1.3
|
118 |
*/
|
119 |
+
$data['csstidy']['font_prop_default'] = array();
|
120 |
+
$data['csstidy']['font_prop_default']['font-style'] = 'normal';
|
121 |
+
$data['csstidy']['font_prop_default']['font-variant'] = 'normal';
|
122 |
+
$data['csstidy']['font_prop_default']['font-weight'] = 'normal';
|
123 |
+
$data['csstidy']['font_prop_default']['font-size'] = '';
|
124 |
+
$data['csstidy']['font_prop_default']['line-height'] = '';
|
125 |
+
$data['csstidy']['font_prop_default']['font-family'] = '';
|
126 |
|
127 |
/**
|
128 |
* A list of non-W3C color names which get replaced by their hex-codes
|
129 |
*
|
130 |
+
* @global array $data['csstidy']['replace_colors']
|
131 |
* @see cut_color()
|
132 |
* @version 1.0
|
133 |
*/
|
134 |
+
$data['csstidy']['replace_colors'] = array();
|
135 |
+
$data['csstidy']['replace_colors']['aliceblue'] = '#f0f8ff';
|
136 |
+
$data['csstidy']['replace_colors']['antiquewhite'] = '#faebd7';
|
137 |
+
$data['csstidy']['replace_colors']['aquamarine'] = '#7fffd4';
|
138 |
+
$data['csstidy']['replace_colors']['azure'] = '#f0ffff';
|
139 |
+
$data['csstidy']['replace_colors']['beige'] = '#f5f5dc';
|
140 |
+
$data['csstidy']['replace_colors']['bisque'] = '#ffe4c4';
|
141 |
+
$data['csstidy']['replace_colors']['blanchedalmond'] = '#ffebcd';
|
142 |
+
$data['csstidy']['replace_colors']['blueviolet'] = '#8a2be2';
|
143 |
+
$data['csstidy']['replace_colors']['brown'] = '#a52a2a';
|
144 |
+
$data['csstidy']['replace_colors']['burlywood'] = '#deb887';
|
145 |
+
$data['csstidy']['replace_colors']['cadetblue'] = '#5f9ea0';
|
146 |
+
$data['csstidy']['replace_colors']['chartreuse'] = '#7fff00';
|
147 |
+
$data['csstidy']['replace_colors']['chocolate'] = '#d2691e';
|
148 |
+
$data['csstidy']['replace_colors']['coral'] = '#ff7f50';
|
149 |
+
$data['csstidy']['replace_colors']['cornflowerblue'] = '#6495ed';
|
150 |
+
$data['csstidy']['replace_colors']['cornsilk'] = '#fff8dc';
|
151 |
+
$data['csstidy']['replace_colors']['crimson'] = '#dc143c';
|
152 |
+
$data['csstidy']['replace_colors']['cyan'] = '#00ffff';
|
153 |
+
$data['csstidy']['replace_colors']['darkblue'] = '#00008b';
|
154 |
+
$data['csstidy']['replace_colors']['darkcyan'] = '#008b8b';
|
155 |
+
$data['csstidy']['replace_colors']['darkgoldenrod'] = '#b8860b';
|
156 |
+
$data['csstidy']['replace_colors']['darkgray'] = '#a9a9a9';
|
157 |
+
$data['csstidy']['replace_colors']['darkgreen'] = '#006400';
|
158 |
+
$data['csstidy']['replace_colors']['darkkhaki'] = '#bdb76b';
|
159 |
+
$data['csstidy']['replace_colors']['darkmagenta'] = '#8b008b';
|
160 |
+
$data['csstidy']['replace_colors']['darkolivegreen'] = '#556b2f';
|
161 |
+
$data['csstidy']['replace_colors']['darkorange'] = '#ff8c00';
|
162 |
+
$data['csstidy']['replace_colors']['darkorchid'] = '#9932cc';
|
163 |
+
$data['csstidy']['replace_colors']['darkred'] = '#8b0000';
|
164 |
+
$data['csstidy']['replace_colors']['darksalmon'] = '#e9967a';
|
165 |
+
$data['csstidy']['replace_colors']['darkseagreen'] = '#8fbc8f';
|
166 |
+
$data['csstidy']['replace_colors']['darkslateblue'] = '#483d8b';
|
167 |
+
$data['csstidy']['replace_colors']['darkslategray'] = '#2f4f4f';
|
168 |
+
$data['csstidy']['replace_colors']['darkturquoise'] = '#00ced1';
|
169 |
+
$data['csstidy']['replace_colors']['darkviolet'] = '#9400d3';
|
170 |
+
$data['csstidy']['replace_colors']['deeppink'] = '#ff1493';
|
171 |
+
$data['csstidy']['replace_colors']['deepskyblue'] = '#00bfff';
|
172 |
+
$data['csstidy']['replace_colors']['dimgray'] = '#696969';
|
173 |
+
$data['csstidy']['replace_colors']['dodgerblue'] = '#1e90ff';
|
174 |
+
$data['csstidy']['replace_colors']['feldspar'] = '#d19275';
|
175 |
+
$data['csstidy']['replace_colors']['firebrick'] = '#b22222';
|
176 |
+
$data['csstidy']['replace_colors']['floralwhite'] = '#fffaf0';
|
177 |
+
$data['csstidy']['replace_colors']['forestgreen'] = '#228b22';
|
178 |
+
$data['csstidy']['replace_colors']['gainsboro'] = '#dcdcdc';
|
179 |
+
$data['csstidy']['replace_colors']['ghostwhite'] = '#f8f8ff';
|
180 |
+
$data['csstidy']['replace_colors']['gold'] = '#ffd700';
|
181 |
+
$data['csstidy']['replace_colors']['goldenrod'] = '#daa520';
|
182 |
+
$data['csstidy']['replace_colors']['greenyellow'] = '#adff2f';
|
183 |
+
$data['csstidy']['replace_colors']['honeydew'] = '#f0fff0';
|
184 |
+
$data['csstidy']['replace_colors']['hotpink'] = '#ff69b4';
|
185 |
+
$data['csstidy']['replace_colors']['indianred'] = '#cd5c5c';
|
186 |
+
$data['csstidy']['replace_colors']['indigo'] = '#4b0082';
|
187 |
+
$data['csstidy']['replace_colors']['ivory'] = '#fffff0';
|
188 |
+
$data['csstidy']['replace_colors']['khaki'] = '#f0e68c';
|
189 |
+
$data['csstidy']['replace_colors']['lavender'] = '#e6e6fa';
|
190 |
+
$data['csstidy']['replace_colors']['lavenderblush'] = '#fff0f5';
|
191 |
+
$data['csstidy']['replace_colors']['lawngreen'] = '#7cfc00';
|
192 |
+
$data['csstidy']['replace_colors']['lemonchiffon'] = '#fffacd';
|
193 |
+
$data['csstidy']['replace_colors']['lightblue'] = '#add8e6';
|
194 |
+
$data['csstidy']['replace_colors']['lightcoral'] = '#f08080';
|
195 |
+
$data['csstidy']['replace_colors']['lightcyan'] = '#e0ffff';
|
196 |
+
$data['csstidy']['replace_colors']['lightgoldenrodyellow'] = '#fafad2';
|
197 |
+
$data['csstidy']['replace_colors']['lightgrey'] = '#d3d3d3';
|
198 |
+
$data['csstidy']['replace_colors']['lightgreen'] = '#90ee90';
|
199 |
+
$data['csstidy']['replace_colors']['lightpink'] = '#ffb6c1';
|
200 |
+
$data['csstidy']['replace_colors']['lightsalmon'] = '#ffa07a';
|
201 |
+
$data['csstidy']['replace_colors']['lightseagreen'] = '#20b2aa';
|
202 |
+
$data['csstidy']['replace_colors']['lightskyblue'] = '#87cefa';
|
203 |
+
$data['csstidy']['replace_colors']['lightslateblue'] = '#8470ff';
|
204 |
+
$data['csstidy']['replace_colors']['lightslategray'] = '#778899';
|
205 |
+
$data['csstidy']['replace_colors']['lightsteelblue'] = '#b0c4de';
|
206 |
+
$data['csstidy']['replace_colors']['lightyellow'] = '#ffffe0';
|
207 |
+
$data['csstidy']['replace_colors']['limegreen'] = '#32cd32';
|
208 |
+
$data['csstidy']['replace_colors']['linen'] = '#faf0e6';
|
209 |
+
$data['csstidy']['replace_colors']['magenta'] = '#ff00ff';
|
210 |
+
$data['csstidy']['replace_colors']['mediumaquamarine'] = '#66cdaa';
|
211 |
+
$data['csstidy']['replace_colors']['mediumblue'] = '#0000cd';
|
212 |
+
$data['csstidy']['replace_colors']['mediumorchid'] = '#ba55d3';
|
213 |
+
$data['csstidy']['replace_colors']['mediumpurple'] = '#9370d8';
|
214 |
+
$data['csstidy']['replace_colors']['mediumseagreen'] = '#3cb371';
|
215 |
+
$data['csstidy']['replace_colors']['mediumslateblue'] = '#7b68ee';
|
216 |
+
$data['csstidy']['replace_colors']['mediumspringgreen'] = '#00fa9a';
|
217 |
+
$data['csstidy']['replace_colors']['mediumturquoise'] = '#48d1cc';
|
218 |
+
$data['csstidy']['replace_colors']['mediumvioletred'] = '#c71585';
|
219 |
+
$data['csstidy']['replace_colors']['midnightblue'] = '#191970';
|
220 |
+
$data['csstidy']['replace_colors']['mintcream'] = '#f5fffa';
|
221 |
+
$data['csstidy']['replace_colors']['mistyrose'] = '#ffe4e1';
|
222 |
+
$data['csstidy']['replace_colors']['moccasin'] = '#ffe4b5';
|
223 |
+
$data['csstidy']['replace_colors']['navajowhite'] = '#ffdead';
|
224 |
+
$data['csstidy']['replace_colors']['oldlace'] = '#fdf5e6';
|
225 |
+
$data['csstidy']['replace_colors']['olivedrab'] = '#6b8e23';
|
226 |
+
$data['csstidy']['replace_colors']['orangered'] = '#ff4500';
|
227 |
+
$data['csstidy']['replace_colors']['orchid'] = '#da70d6';
|
228 |
+
$data['csstidy']['replace_colors']['palegoldenrod'] = '#eee8aa';
|
229 |
+
$data['csstidy']['replace_colors']['palegreen'] = '#98fb98';
|
230 |
+
$data['csstidy']['replace_colors']['paleturquoise'] = '#afeeee';
|
231 |
+
$data['csstidy']['replace_colors']['palevioletred'] = '#d87093';
|
232 |
+
$data['csstidy']['replace_colors']['papayawhip'] = '#ffefd5';
|
233 |
+
$data['csstidy']['replace_colors']['peachpuff'] = '#ffdab9';
|
234 |
+
$data['csstidy']['replace_colors']['peru'] = '#cd853f';
|
235 |
+
$data['csstidy']['replace_colors']['pink'] = '#ffc0cb';
|
236 |
+
$data['csstidy']['replace_colors']['plum'] = '#dda0dd';
|
237 |
+
$data['csstidy']['replace_colors']['powderblue'] = '#b0e0e6';
|
238 |
+
$data['csstidy']['replace_colors']['rosybrown'] = '#bc8f8f';
|
239 |
+
$data['csstidy']['replace_colors']['royalblue'] = '#4169e1';
|
240 |
+
$data['csstidy']['replace_colors']['saddlebrown'] = '#8b4513';
|
241 |
+
$data['csstidy']['replace_colors']['salmon'] = '#fa8072';
|
242 |
+
$data['csstidy']['replace_colors']['sandybrown'] = '#f4a460';
|
243 |
+
$data['csstidy']['replace_colors']['seagreen'] = '#2e8b57';
|
244 |
+
$data['csstidy']['replace_colors']['seashell'] = '#fff5ee';
|
245 |
+
$data['csstidy']['replace_colors']['sienna'] = '#a0522d';
|
246 |
+
$data['csstidy']['replace_colors']['skyblue'] = '#87ceeb';
|
247 |
+
$data['csstidy']['replace_colors']['slateblue'] = '#6a5acd';
|
248 |
+
$data['csstidy']['replace_colors']['slategray'] = '#708090';
|
249 |
+
$data['csstidy']['replace_colors']['snow'] = '#fffafa';
|
250 |
+
$data['csstidy']['replace_colors']['springgreen'] = '#00ff7f';
|
251 |
+
$data['csstidy']['replace_colors']['steelblue'] = '#4682b4';
|
252 |
+
$data['csstidy']['replace_colors']['tan'] = '#d2b48c';
|
253 |
+
$data['csstidy']['replace_colors']['thistle'] = '#d8bfd8';
|
254 |
+
$data['csstidy']['replace_colors']['tomato'] = '#ff6347';
|
255 |
+
$data['csstidy']['replace_colors']['turquoise'] = '#40e0d0';
|
256 |
+
$data['csstidy']['replace_colors']['violet'] = '#ee82ee';
|
257 |
+
$data['csstidy']['replace_colors']['violetred'] = '#d02090';
|
258 |
+
$data['csstidy']['replace_colors']['wheat'] = '#f5deb3';
|
259 |
+
$data['csstidy']['replace_colors']['whitesmoke'] = '#f5f5f5';
|
260 |
+
$data['csstidy']['replace_colors']['yellowgreen'] = '#9acd32';
|
261 |
|
262 |
/**
|
263 |
* A list of all shorthand properties that are devided into four properties and/or have four subvalues
|
264 |
*
|
265 |
+
* @global array $data['csstidy']['shorthands']
|
266 |
* @todo Are there new ones in CSS3?
|
267 |
* @see dissolve_4value_shorthands()
|
268 |
* @see merge_4value_shorthands()
|
269 |
* @version 1.0
|
270 |
*/
|
271 |
+
$data['csstidy']['shorthands'] = array();
|
272 |
+
$data['csstidy']['shorthands']['border-color'] = array('border-top-color','border-right-color','border-bottom-color','border-left-color');
|
273 |
+
$data['csstidy']['shorthands']['border-style'] = array('border-top-style','border-right-style','border-bottom-style','border-left-style');
|
274 |
+
$data['csstidy']['shorthands']['border-width'] = array('border-top-width','border-right-width','border-bottom-width','border-left-width');
|
275 |
+
$data['csstidy']['shorthands']['margin'] = array('margin-top','margin-right','margin-bottom','margin-left');
|
276 |
+
$data['csstidy']['shorthands']['padding'] = array('padding-top','padding-right','padding-bottom','padding-left');
|
277 |
+
|
278 |
+
$data['csstidy']['radius_shorthands']['border-radius'] = array('border-top-left-radius','border-top-right-radius','border-bottom-right-radius','border-bottom-left-radius');
|
279 |
+
$data['csstidy']['radius_shorthands']['-webkit-border-radius'] = array('-webkit-border-top-left-radius','-webkit-border-top-right-radius','-webkit-border-bottom-right-radius','-webkit-border-bottom-left-radius');
|
280 |
+
$data['csstidy']['radius_shorthands']['-moz-border-radius'] = array('-moz-border-radius-topleft','-moz-border-radius-topright','-moz-border-radius-bottomright','-moz-border-radius-bottomleft');
|
281 |
|
282 |
/**
|
283 |
* All CSS Properties. Needed for csstidy::property_is_next()
|
284 |
*
|
285 |
+
* @global array $data['csstidy']['all_properties']
|
286 |
+
* @version 1.1
|
|
|
287 |
* @see csstidy::property_is_next()
|
288 |
*/
|
289 |
+
$data['csstidy']['all_properties']['alignment-adjust'] = 'CSS3.0';
|
290 |
+
$data['csstidy']['all_properties']['alignment-baseline'] = 'CSS3.0';
|
291 |
+
$data['csstidy']['all_properties']['animation'] = 'CSS3.0';
|
292 |
+
$data['csstidy']['all_properties']['animation-delay'] = 'CSS3.0';
|
293 |
+
$data['csstidy']['all_properties']['animation-direction'] = 'CSS3.0';
|
294 |
+
$data['csstidy']['all_properties']['animation-duration'] = 'CSS3.0';
|
295 |
+
$data['csstidy']['all_properties']['animation-iteration-count'] = 'CSS3.0';
|
296 |
+
$data['csstidy']['all_properties']['animation-name'] = 'CSS3.0';
|
297 |
+
$data['csstidy']['all_properties']['animation-play-state'] = 'CSS3.0';
|
298 |
+
$data['csstidy']['all_properties']['animation-timing-function'] = 'CSS3.0';
|
299 |
+
$data['csstidy']['all_properties']['appearance'] = 'CSS3.0';
|
300 |
+
$data['csstidy']['all_properties']['azimuth'] = 'CSS2.0,CSS2.1,CSS3.0';
|
301 |
+
$data['csstidy']['all_properties']['backface-visibility'] = 'CSS3.0';
|
302 |
+
$data['csstidy']['all_properties']['background'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
303 |
+
$data['csstidy']['all_properties']['background-attachment'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
304 |
+
$data['csstidy']['all_properties']['background-clip'] = 'CSS3.0';
|
305 |
+
$data['csstidy']['all_properties']['background-color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
306 |
+
$data['csstidy']['all_properties']['background-image'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
307 |
+
$data['csstidy']['all_properties']['background-origin'] = 'CSS3.0';
|
308 |
+
$data['csstidy']['all_properties']['background-position'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
309 |
+
$data['csstidy']['all_properties']['background-repeat'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
310 |
+
$data['csstidy']['all_properties']['background-size'] = 'CSS3.0';
|
311 |
+
$data['csstidy']['all_properties']['baseline-shift'] = 'CSS3.0';
|
312 |
+
$data['csstidy']['all_properties']['binding'] = 'CSS3.0';
|
313 |
+
$data['csstidy']['all_properties']['bleed'] = 'CSS3.0';
|
314 |
+
$data['csstidy']['all_properties']['bookmark-label'] = 'CSS3.0';
|
315 |
+
$data['csstidy']['all_properties']['bookmark-level'] = 'CSS3.0';
|
316 |
+
$data['csstidy']['all_properties']['bookmark-state'] = 'CSS3.0';
|
317 |
+
$data['csstidy']['all_properties']['bookmark-target'] = 'CSS3.0';
|
318 |
+
$data['csstidy']['all_properties']['border'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
319 |
+
$data['csstidy']['all_properties']['border-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
320 |
+
$data['csstidy']['all_properties']['border-bottom-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
321 |
+
$data['csstidy']['all_properties']['border-bottom-left-radius'] = 'CSS3.0';
|
322 |
+
$data['csstidy']['all_properties']['border-bottom-right-radius'] = 'CSS3.0';
|
323 |
+
$data['csstidy']['all_properties']['border-bottom-style'] = 'CSS2.0,CSS2.1,CSS3.0';
|
324 |
+
$data['csstidy']['all_properties']['border-bottom-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
325 |
+
$data['csstidy']['all_properties']['border-collapse'] = 'CSS2.0,CSS2.1,CSS3.0';
|
326 |
+
$data['csstidy']['all_properties']['border-color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
327 |
+
$data['csstidy']['all_properties']['border-image'] = 'CSS3.0';
|
328 |
+
$data['csstidy']['all_properties']['border-image-outset'] = 'CSS3.0';
|
329 |
+
$data['csstidy']['all_properties']['border-image-repeat'] = 'CSS3.0';
|
330 |
+
$data['csstidy']['all_properties']['border-image-slice'] = 'CSS3.0';
|
331 |
+
$data['csstidy']['all_properties']['border-image-source'] = 'CSS3.0';
|
332 |
+
$data['csstidy']['all_properties']['border-image-width'] = 'CSS3.0';
|
333 |
+
$data['csstidy']['all_properties']['border-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
334 |
+
$data['csstidy']['all_properties']['border-left-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
335 |
+
$data['csstidy']['all_properties']['border-left-style'] = 'CSS2.0,CSS2.1,CSS3.0';
|
336 |
+
$data['csstidy']['all_properties']['border-left-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
337 |
+
$data['csstidy']['all_properties']['border-radius'] = 'CSS3.0';
|
338 |
+
$data['csstidy']['all_properties']['border-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
339 |
+
$data['csstidy']['all_properties']['border-right-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
340 |
+
$data['csstidy']['all_properties']['border-right-style'] = 'CSS2.0,CSS2.1,CSS3.0';
|
341 |
+
$data['csstidy']['all_properties']['border-right-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
342 |
+
$data['csstidy']['all_properties']['border-spacing'] = 'CSS2.0,CSS2.1,CSS3.0';
|
343 |
+
$data['csstidy']['all_properties']['border-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
344 |
+
$data['csstidy']['all_properties']['border-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
345 |
+
$data['csstidy']['all_properties']['border-top-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
346 |
+
$data['csstidy']['all_properties']['border-top-left-radius'] = 'CSS3.0';
|
347 |
+
$data['csstidy']['all_properties']['border-top-right-radius'] = 'CSS3.0';
|
348 |
+
$data['csstidy']['all_properties']['border-top-style'] = 'CSS2.0,CSS2.1,CSS3.0';
|
349 |
+
$data['csstidy']['all_properties']['border-top-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
350 |
+
$data['csstidy']['all_properties']['border-width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
351 |
+
$data['csstidy']['all_properties']['bottom'] = 'CSS2.0,CSS2.1,CSS3.0';
|
352 |
+
$data['csstidy']['all_properties']['box-decoration-break'] = 'CSS3.0';
|
353 |
+
$data['csstidy']['all_properties']['box-shadow'] = 'CSS3.0';
|
354 |
+
$data['csstidy']['all_properties']['box-sizing'] = 'CSS3.0';
|
355 |
+
$data['csstidy']['all_properties']['break-after'] = 'CSS3.0';
|
356 |
+
$data['csstidy']['all_properties']['break-before'] = 'CSS3.0';
|
357 |
+
$data['csstidy']['all_properties']['break-inside'] = 'CSS3.0';
|
358 |
+
$data['csstidy']['all_properties']['caption-side'] = 'CSS2.0,CSS2.1,CSS3.0';
|
359 |
+
$data['csstidy']['all_properties']['clear'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
360 |
+
$data['csstidy']['all_properties']['clip'] = 'CSS2.0,CSS2.1,CSS3.0';
|
361 |
+
$data['csstidy']['all_properties']['color'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
362 |
+
$data['csstidy']['all_properties']['color-profile'] = 'CSS3.0';
|
363 |
+
$data['csstidy']['all_properties']['column-count'] = 'CSS3.0';
|
364 |
+
$data['csstidy']['all_properties']['column-fill'] = 'CSS3.0';
|
365 |
+
$data['csstidy']['all_properties']['column-gap'] = 'CSS3.0';
|
366 |
+
$data['csstidy']['all_properties']['column-rule'] = 'CSS3.0';
|
367 |
+
$data['csstidy']['all_properties']['column-rule-color'] = 'CSS3.0';
|
368 |
+
$data['csstidy']['all_properties']['column-rule-style'] = 'CSS3.0';
|
369 |
+
$data['csstidy']['all_properties']['column-rule-width'] = 'CSS3.0';
|
370 |
+
$data['csstidy']['all_properties']['column-span'] = 'CSS3.0';
|
371 |
+
$data['csstidy']['all_properties']['column-width'] = 'CSS3.0';
|
372 |
+
$data['csstidy']['all_properties']['columns'] = 'CSS3.0';
|
373 |
+
$data['csstidy']['all_properties']['content'] = 'CSS2.0,CSS2.1,CSS3.0';
|
374 |
+
$data['csstidy']['all_properties']['counter-increment'] = 'CSS2.0,CSS2.1,CSS3.0';
|
375 |
+
$data['csstidy']['all_properties']['counter-reset'] = 'CSS2.0,CSS2.1,CSS3.0';
|
376 |
+
$data['csstidy']['all_properties']['crop'] = 'CSS3.0';
|
377 |
+
$data['csstidy']['all_properties']['cue'] = 'CSS2.0,CSS2.1,CSS3.0';
|
378 |
+
$data['csstidy']['all_properties']['cue-after'] = 'CSS2.0,CSS2.1,CSS3.0';
|
379 |
+
$data['csstidy']['all_properties']['cue-before'] = 'CSS2.0,CSS2.1,CSS3.0';
|
380 |
+
$data['csstidy']['all_properties']['cursor'] = 'CSS2.0,CSS2.1,CSS3.0';
|
381 |
+
$data['csstidy']['all_properties']['direction'] = 'CSS2.0,CSS2.1,CSS3.0';
|
382 |
+
$data['csstidy']['all_properties']['display'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
383 |
+
$data['csstidy']['all_properties']['dominant-baseline'] = 'CSS3.0';
|
384 |
+
$data['csstidy']['all_properties']['drop-initial-after-adjust'] = 'CSS3.0';
|
385 |
+
$data['csstidy']['all_properties']['drop-initial-after-align'] = 'CSS3.0';
|
386 |
+
$data['csstidy']['all_properties']['drop-initial-before-adjust'] = 'CSS3.0';
|
387 |
+
$data['csstidy']['all_properties']['drop-initial-before-align'] = 'CSS3.0';
|
388 |
+
$data['csstidy']['all_properties']['drop-initial-size'] = 'CSS3.0';
|
389 |
+
$data['csstidy']['all_properties']['drop-initial-value'] = 'CSS3.0';
|
390 |
+
$data['csstidy']['all_properties']['elevation'] = 'CSS2.0,CSS2.1,CSS3.0';
|
391 |
+
$data['csstidy']['all_properties']['empty-cells'] = 'CSS2.0,CSS2.1,CSS3.0';
|
392 |
+
$data['csstidy']['all_properties']['fit'] = 'CSS3.0';
|
393 |
+
$data['csstidy']['all_properties']['fit-position'] = 'CSS3.0';
|
394 |
+
$data['csstidy']['all_properties']['flex-align'] = 'CSS3.0';
|
395 |
+
$data['csstidy']['all_properties']['flex-flow'] = 'CSS3.0';
|
396 |
+
$data['csstidy']['all_properties']['flex-line-pack'] = 'CSS3.0';
|
397 |
+
$data['csstidy']['all_properties']['flex-order'] = 'CSS3.0';
|
398 |
+
$data['csstidy']['all_properties']['flex-pack'] = 'CSS3.0';
|
399 |
+
$data['csstidy']['all_properties']['float'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
400 |
+
$data['csstidy']['all_properties']['float-offset'] = 'CSS3.0';
|
401 |
+
$data['csstidy']['all_properties']['font'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
402 |
+
$data['csstidy']['all_properties']['font-family'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
403 |
+
$data['csstidy']['all_properties']['font-size'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
404 |
+
$data['csstidy']['all_properties']['font-size-adjust'] = 'CSS2.0,CSS3.0';
|
405 |
+
$data['csstidy']['all_properties']['font-stretch'] = 'CSS2.0,CSS3.0';
|
406 |
+
$data['csstidy']['all_properties']['font-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
407 |
+
$data['csstidy']['all_properties']['font-variant'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
408 |
+
$data['csstidy']['all_properties']['font-weight'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
409 |
+
$data['csstidy']['all_properties']['grid-columns'] = 'CSS3.0';
|
410 |
+
$data['csstidy']['all_properties']['grid-rows'] = 'CSS3.0';
|
411 |
+
$data['csstidy']['all_properties']['hanging-punctuation'] = 'CSS3.0';
|
412 |
+
$data['csstidy']['all_properties']['height'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
413 |
+
$data['csstidy']['all_properties']['hyphenate-after'] = 'CSS3.0';
|
414 |
+
$data['csstidy']['all_properties']['hyphenate-before'] = 'CSS3.0';
|
415 |
+
$data['csstidy']['all_properties']['hyphenate-character'] = 'CSS3.0';
|
416 |
+
$data['csstidy']['all_properties']['hyphenate-lines'] = 'CSS3.0';
|
417 |
+
$data['csstidy']['all_properties']['hyphenate-resource'] = 'CSS3.0';
|
418 |
+
$data['csstidy']['all_properties']['hyphens'] = 'CSS3.0';
|
419 |
+
$data['csstidy']['all_properties']['icon'] = 'CSS3.0';
|
420 |
+
$data['csstidy']['all_properties']['image-orientation'] = 'CSS3.0';
|
421 |
+
$data['csstidy']['all_properties']['image-rendering'] = 'CSS3.0';
|
422 |
+
$data['csstidy']['all_properties']['image-resolution'] = 'CSS3.0';
|
423 |
+
$data['csstidy']['all_properties']['inline-box-align'] = 'CSS3.0';
|
424 |
+
$data['csstidy']['all_properties']['left'] = 'CSS2.0,CSS2.1,CSS3.0';
|
425 |
+
$data['csstidy']['all_properties']['letter-spacing'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
426 |
+
$data['csstidy']['all_properties']['line-break'] = 'CSS3.0';
|
427 |
+
$data['csstidy']['all_properties']['line-height'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
428 |
+
$data['csstidy']['all_properties']['line-stacking'] = 'CSS3.0';
|
429 |
+
$data['csstidy']['all_properties']['line-stacking-ruby'] = 'CSS3.0';
|
430 |
+
$data['csstidy']['all_properties']['line-stacking-shift'] = 'CSS3.0';
|
431 |
+
$data['csstidy']['all_properties']['line-stacking-strategy'] = 'CSS3.0';
|
432 |
+
$data['csstidy']['all_properties']['list-style'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
433 |
+
$data['csstidy']['all_properties']['list-style-image'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
434 |
+
$data['csstidy']['all_properties']['list-style-position'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
435 |
+
$data['csstidy']['all_properties']['list-style-type'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
436 |
+
$data['csstidy']['all_properties']['margin'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
437 |
+
$data['csstidy']['all_properties']['margin-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
438 |
+
$data['csstidy']['all_properties']['margin-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
439 |
+
$data['csstidy']['all_properties']['margin-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
440 |
+
$data['csstidy']['all_properties']['margin-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
441 |
+
$data['csstidy']['all_properties']['marker-offset'] = 'CSS2.0,CSS3.0';
|
442 |
+
$data['csstidy']['all_properties']['marks'] = 'CSS2.0,CSS3.0';
|
443 |
+
$data['csstidy']['all_properties']['marquee-direction'] = 'CSS3.0';
|
444 |
+
$data['csstidy']['all_properties']['marquee-loop'] = 'CSS3.0';
|
445 |
+
$data['csstidy']['all_properties']['marquee-play-count'] = 'CSS3.0';
|
446 |
+
$data['csstidy']['all_properties']['marquee-speed'] = 'CSS3.0';
|
447 |
+
$data['csstidy']['all_properties']['marquee-style'] = 'CSS3.0';
|
448 |
+
$data['csstidy']['all_properties']['max-height'] = 'CSS2.0,CSS2.1,CSS3.0';
|
449 |
+
$data['csstidy']['all_properties']['max-width'] = 'CSS2.0,CSS2.1,CSS3.0';
|
450 |
+
$data['csstidy']['all_properties']['min-height'] = 'CSS2.0,CSS2.1,CSS3.0';
|
451 |
+
$data['csstidy']['all_properties']['min-width'] = 'CSS2.0,CSS2.1,CSS3.0';
|
452 |
+
$data['csstidy']['all_properties']['move-to'] = 'CSS3.0';
|
453 |
+
$data['csstidy']['all_properties']['nav-down'] = 'CSS3.0';
|
454 |
+
$data['csstidy']['all_properties']['nav-index'] = 'CSS3.0';
|
455 |
+
$data['csstidy']['all_properties']['nav-left'] = 'CSS3.0';
|
456 |
+
$data['csstidy']['all_properties']['nav-right'] = 'CSS3.0';
|
457 |
+
$data['csstidy']['all_properties']['nav-up'] = 'CSS3.0';
|
458 |
+
$data['csstidy']['all_properties']['opacity'] = 'CSS3.0';
|
459 |
+
$data['csstidy']['all_properties']['orphans'] = 'CSS2.0,CSS2.1,CSS3.0';
|
460 |
+
$data['csstidy']['all_properties']['outline'] = 'CSS2.0,CSS2.1,CSS3.0';
|
461 |
+
$data['csstidy']['all_properties']['outline-color'] = 'CSS2.0,CSS2.1,CSS3.0';
|
462 |
+
$data['csstidy']['all_properties']['outline-offset'] = 'CSS3.0';
|
463 |
+
$data['csstidy']['all_properties']['outline-style'] = 'CSS2.0,CSS2.1,CSS3.0';
|
464 |
+
$data['csstidy']['all_properties']['outline-width'] = 'CSS2.0,CSS2.1,CSS3.0';
|
465 |
+
$data['csstidy']['all_properties']['overflow'] = 'CSS2.0,CSS2.1,CSS3.0';
|
466 |
+
$data['csstidy']['all_properties']['overflow-style'] = 'CSS3.0';
|
467 |
+
$data['csstidy']['all_properties']['overflow-wrap'] = 'CSS3.0';
|
468 |
+
$data['csstidy']['all_properties']['overflow-x'] = 'CSS3.0';
|
469 |
+
$data['csstidy']['all_properties']['overflow-y'] = 'CSS3.0';
|
470 |
+
$data['csstidy']['all_properties']['padding'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
471 |
+
$data['csstidy']['all_properties']['padding-bottom'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
472 |
+
$data['csstidy']['all_properties']['padding-left'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
473 |
+
$data['csstidy']['all_properties']['padding-right'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
474 |
+
$data['csstidy']['all_properties']['padding-top'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
475 |
+
$data['csstidy']['all_properties']['page'] = 'CSS2.0,CSS3.0';
|
476 |
+
$data['csstidy']['all_properties']['page-break-after'] = 'CSS2.0,CSS2.1,CSS3.0';
|
477 |
+
$data['csstidy']['all_properties']['page-break-before'] = 'CSS2.0,CSS2.1,CSS3.0';
|
478 |
+
$data['csstidy']['all_properties']['page-break-inside'] = 'CSS2.0,CSS2.1,CSS3.0';
|
479 |
+
$data['csstidy']['all_properties']['page-policy'] = 'CSS3.0';
|
480 |
+
$data['csstidy']['all_properties']['pause'] = 'CSS2.0,CSS2.1,CSS3.0';
|
481 |
+
$data['csstidy']['all_properties']['pause-after'] = 'CSS2.0,CSS2.1,CSS3.0';
|
482 |
+
$data['csstidy']['all_properties']['pause-before'] = 'CSS2.0,CSS2.1,CSS3.0';
|
483 |
+
$data['csstidy']['all_properties']['perspective'] = 'CSS3.0';
|
484 |
+
$data['csstidy']['all_properties']['perspective-origin'] = 'CSS3.0';
|
485 |
+
$data['csstidy']['all_properties']['phonemes'] = 'CSS3.0';
|
486 |
+
$data['csstidy']['all_properties']['pitch'] = 'CSS2.0,CSS2.1,CSS3.0';
|
487 |
+
$data['csstidy']['all_properties']['pitch-range'] = 'CSS2.0,CSS2.1,CSS3.0';
|
488 |
+
$data['csstidy']['all_properties']['play-during'] = 'CSS2.0,CSS2.1,CSS3.0';
|
489 |
+
$data['csstidy']['all_properties']['position'] = 'CSS2.0,CSS2.1,CSS3.0';
|
490 |
+
$data['csstidy']['all_properties']['presentation-level'] = 'CSS3.0';
|
491 |
+
$data['csstidy']['all_properties']['punctuation-trim'] = 'CSS3.0';
|
492 |
+
$data['csstidy']['all_properties']['quotes'] = 'CSS2.0,CSS2.1,CSS3.0';
|
493 |
+
$data['csstidy']['all_properties']['rendering-intent'] = 'CSS3.0';
|
494 |
+
$data['csstidy']['all_properties']['resize'] = 'CSS3.0';
|
495 |
+
$data['csstidy']['all_properties']['rest'] = 'CSS3.0';
|
496 |
+
$data['csstidy']['all_properties']['rest-after'] = 'CSS3.0';
|
497 |
+
$data['csstidy']['all_properties']['rest-before'] = 'CSS3.0';
|
498 |
+
$data['csstidy']['all_properties']['richness'] = 'CSS2.0,CSS2.1,CSS3.0';
|
499 |
+
$data['csstidy']['all_properties']['right'] = 'CSS2.0,CSS2.1,CSS3.0';
|
500 |
+
$data['csstidy']['all_properties']['rotation'] = 'CSS3.0';
|
501 |
+
$data['csstidy']['all_properties']['rotation-point'] = 'CSS3.0';
|
502 |
+
$data['csstidy']['all_properties']['ruby-align'] = 'CSS3.0';
|
503 |
+
$data['csstidy']['all_properties']['ruby-overhang'] = 'CSS3.0';
|
504 |
+
$data['csstidy']['all_properties']['ruby-position'] = 'CSS3.0';
|
505 |
+
$data['csstidy']['all_properties']['ruby-span'] = 'CSS3.0';
|
506 |
+
$data['csstidy']['all_properties']['size'] = 'CSS2.0,CSS3.0';
|
507 |
+
$data['csstidy']['all_properties']['speak'] = 'CSS2.0,CSS2.1,CSS3.0';
|
508 |
+
$data['csstidy']['all_properties']['speak-header'] = 'CSS2.0,CSS2.1,CSS3.0';
|
509 |
+
$data['csstidy']['all_properties']['speak-numeral'] = 'CSS2.0,CSS2.1,CSS3.0';
|
510 |
+
$data['csstidy']['all_properties']['speak-punctuation'] = 'CSS2.0,CSS2.1,CSS3.0';
|
511 |
+
$data['csstidy']['all_properties']['speech-rate'] = 'CSS2.0,CSS2.1,CSS3.0';
|
512 |
+
$data['csstidy']['all_properties']['src'] = 'CSS3.0';
|
513 |
+
$data['csstidy']['all_properties']['stress'] = 'CSS2.0,CSS2.1,CSS3.0';
|
514 |
+
$data['csstidy']['all_properties']['string-set'] = 'CSS3.0';
|
515 |
+
$data['csstidy']['all_properties']['tab-size'] = 'CSS3.0';
|
516 |
+
$data['csstidy']['all_properties']['table-layout'] = 'CSS2.0,CSS2.1,CSS3.0';
|
517 |
+
$data['csstidy']['all_properties']['target'] = 'CSS3.0';
|
518 |
+
$data['csstidy']['all_properties']['target-name'] = 'CSS3.0';
|
519 |
+
$data['csstidy']['all_properties']['target-new'] = 'CSS3.0';
|
520 |
+
$data['csstidy']['all_properties']['target-position'] = 'CSS3.0';
|
521 |
+
$data['csstidy']['all_properties']['text-align'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
522 |
+
$data['csstidy']['all_properties']['text-align-last'] = 'CSS3.0';
|
523 |
+
$data['csstidy']['all_properties']['text-decoration'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
524 |
+
$data['csstidy']['all_properties']['text-decoration-color'] = 'CSS3.0';
|
525 |
+
$data['csstidy']['all_properties']['text-decoration-line'] = 'CSS3.0';
|
526 |
+
$data['csstidy']['all_properties']['text-decoration-skip'] = 'CSS3.0';
|
527 |
+
$data['csstidy']['all_properties']['text-decoration-style'] = 'CSS3.0';
|
528 |
+
$data['csstidy']['all_properties']['text-emphasis'] = 'CSS3.0';
|
529 |
+
$data['csstidy']['all_properties']['text-emphasis-color'] = 'CSS3.0';
|
530 |
+
$data['csstidy']['all_properties']['text-emphasis-position'] = 'CSS3.0';
|
531 |
+
$data['csstidy']['all_properties']['text-emphasis-style'] = 'CSS3.0';
|
532 |
+
$data['csstidy']['all_properties']['text-height'] = 'CSS3.0';
|
533 |
+
$data['csstidy']['all_properties']['text-indent'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
534 |
+
$data['csstidy']['all_properties']['text-justify'] = 'CSS3.0';
|
535 |
+
$data['csstidy']['all_properties']['text-outline'] = 'CSS3.0';
|
536 |
+
$data['csstidy']['all_properties']['text-shadow'] = 'CSS2.0,CSS3.0';
|
537 |
+
$data['csstidy']['all_properties']['text-space-collapse'] = 'CSS3.0';
|
538 |
+
$data['csstidy']['all_properties']['text-transform'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
539 |
+
$data['csstidy']['all_properties']['text-underline-position'] = 'CSS3.0';
|
540 |
+
$data['csstidy']['all_properties']['text-wrap'] = 'CSS3.0';
|
541 |
+
$data['csstidy']['all_properties']['top'] = 'CSS2.0,CSS2.1,CSS3.0';
|
542 |
+
$data['csstidy']['all_properties']['transform'] = 'CSS3.0';
|
543 |
+
$data['csstidy']['all_properties']['transform-origin'] = 'CSS3.0';
|
544 |
+
$data['csstidy']['all_properties']['transform-style'] = 'CSS3.0';
|
545 |
+
$data['csstidy']['all_properties']['transition'] = 'CSS3.0';
|
546 |
+
$data['csstidy']['all_properties']['transition-delay'] = 'CSS3.0';
|
547 |
+
$data['csstidy']['all_properties']['transition-duration'] = 'CSS3.0';
|
548 |
+
$data['csstidy']['all_properties']['transition-property'] = 'CSS3.0';
|
549 |
+
$data['csstidy']['all_properties']['transition-timing-function'] = 'CSS3.0';
|
550 |
+
$data['csstidy']['all_properties']['unicode-bidi'] = 'CSS2.0,CSS2.1,CSS3.0';
|
551 |
+
$data['csstidy']['all_properties']['vertical-align'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
552 |
+
$data['csstidy']['all_properties']['visibility'] = 'CSS2.0,CSS2.1,CSS3.0';
|
553 |
+
$data['csstidy']['all_properties']['voice-balance'] = 'CSS3.0';
|
554 |
+
$data['csstidy']['all_properties']['voice-duration'] = 'CSS3.0';
|
555 |
+
$data['csstidy']['all_properties']['voice-family'] = 'CSS2.0,CSS2.1,CSS3.0';
|
556 |
+
$data['csstidy']['all_properties']['voice-pitch'] = 'CSS3.0';
|
557 |
+
$data['csstidy']['all_properties']['voice-pitch-range'] = 'CSS3.0';
|
558 |
+
$data['csstidy']['all_properties']['voice-rate'] = 'CSS3.0';
|
559 |
+
$data['csstidy']['all_properties']['voice-stress'] = 'CSS3.0';
|
560 |
+
$data['csstidy']['all_properties']['voice-volume'] = 'CSS3.0';
|
561 |
+
$data['csstidy']['all_properties']['volume'] = 'CSS2.0,CSS2.1,CSS3.0';
|
562 |
+
$data['csstidy']['all_properties']['white-space'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
563 |
+
$data['csstidy']['all_properties']['widows'] = 'CSS2.0,CSS2.1,CSS3.0';
|
564 |
+
$data['csstidy']['all_properties']['width'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
565 |
+
$data['csstidy']['all_properties']['word-break'] = 'CSS3.0';
|
566 |
+
$data['csstidy']['all_properties']['word-spacing'] = 'CSS1.0,CSS2.0,CSS2.1,CSS3.0';
|
567 |
+
$data['csstidy']['all_properties']['word-wrap'] = 'CSS3.0';
|
568 |
+
$data['csstidy']['all_properties']['z-index'] = 'CSS2.0,CSS2.1,CSS3.0';
|
569 |
|
570 |
/**
|
571 |
* An array containing all properties that can accept a quoted string as a value.
|
572 |
*
|
573 |
+
* @global array $data['csstidy']['quoted_string_properties']
|
574 |
*/
|
575 |
+
$data['csstidy']['quoted_string_properties'] = array('content', 'font-family', 'quotes');
|
576 |
|
577 |
/**
|
578 |
* An array containing all properties that can be defined multiple times without being overwritten.
|
|
|
579 |
*
|
580 |
+
* @global array $data['csstidy']['quoted_string_properties']
|
581 |
*/
|
582 |
+
$data['csstidy']['multiple_properties'] = array('background', 'background-image');
|
583 |
|
584 |
/**
|
585 |
* An array containing all predefined templates.
|
586 |
*
|
587 |
+
* @global array $data['csstidy']['predefined_templates']
|
588 |
* @version 1.0
|
589 |
* @see csstidy::load_template()
|
590 |
*/
|
591 |
+
$data['csstidy']['predefined_templates']['default'][0] = '<span class="at">'; //string before @rule
|
592 |
+
$data['csstidy']['predefined_templates']['default'][1] = '</span> <span class="format">{</span>'."\n"; //bracket after @-rule
|
593 |
+
$data['csstidy']['predefined_templates']['default'][2] = '<span class="selector">'; //string before selector
|
594 |
+
$data['csstidy']['predefined_templates']['default'][3] = '</span> <span class="format">{</span>'."\n"; //bracket after selector
|
595 |
+
$data['csstidy']['predefined_templates']['default'][4] = '<span class="property">'; //string before property
|
596 |
+
$data['csstidy']['predefined_templates']['default'][5] = '</span><span class="value">'; //string after property+before value
|
597 |
+
$data['csstidy']['predefined_templates']['default'][6] = '</span><span class="format">;</span>'."\n"; //string after value
|
598 |
+
$data['csstidy']['predefined_templates']['default'][7] = '<span class="format">}</span>'; //closing bracket - selector
|
599 |
+
$data['csstidy']['predefined_templates']['default'][8] = "\n\n"; //space between blocks {...}
|
600 |
+
$data['csstidy']['predefined_templates']['default'][9] = "\n".'<span class="format">}</span>'. "\n\n"; //closing bracket @-rule
|
601 |
+
$data['csstidy']['predefined_templates']['default'][10] = ''; //indent in @-rule
|
602 |
+
$data['csstidy']['predefined_templates']['default'][11] = '<span class="comment">'; // before comment
|
603 |
+
$data['csstidy']['predefined_templates']['default'][12] = '</span>'."\n"; // after comment
|
604 |
+
$data['csstidy']['predefined_templates']['default'][13] = "\n"; // after each line @-rule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
|
606 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="at">';
|
607 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span> <span class="format">{</span>'."\n";
|
608 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="selector">';
|
609 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">{</span>';
|
610 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="property">';
|
611 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="value">';
|
612 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">;</span>';
|
613 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="format">}</span>';
|
614 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
615 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = "\n". '<span class="format">}'."\n".'</span>';
|
616 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '';
|
617 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
|
618 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span>'."\n"; // after comment
|
619 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
620 |
|
621 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="at">';
|
622 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
623 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="selector">';
|
624 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
625 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="property">';
|
626 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="value">';
|
627 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">;</span>';
|
628 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
629 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
630 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
631 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
632 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="comment">'; // before comment
|
633 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span>'; // after comment
|
634 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
635 |
|
636 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
|
637 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '</span> <span class="format">{</span>'."\n";
|
638 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="selector">';
|
639 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n".'<span class="format">{</span>'."\n";
|
640 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = ' <span class="property">';
|
641 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="value">';
|
642 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="format">;</span>'."\n";
|
643 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="format">}</span>';
|
644 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = "\n\n";
|
645 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = "\n".'<span class="format">}</span>'."\n\n";
|
646 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = ' ';
|
647 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="comment">'; // before comment
|
648 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n"; // after comment
|
649 |
+
$data['csstidy']['predefined_templates']['low_compression'][] = "\n";
|
classes/csstidy/lang.inc.php
CHANGED
@@ -1,311 +1,311 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Localization of CSS Optimiser Interface of CSSTidy
|
5 |
-
*
|
6 |
-
* Copyright 2005, 2006, 2007 Florian Schmitz
|
7 |
-
*
|
8 |
-
* This file is part of CSSTidy.
|
9 |
-
*
|
10 |
-
* CSSTidy is free software; you can redistribute it and/or modify
|
11 |
-
* it under the terms of the GNU Lesser General Public License as published by
|
12 |
-
* the Free Software Foundation; either version 2.1 of the License, or
|
13 |
-
* (at your option) any later version.
|
14 |
-
*
|
15 |
-
* CSSTidy is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU Lesser General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU Lesser General Public License
|
21 |
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
|
24 |
-
* @package csstidy
|
25 |
-
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
26 |
-
|
27 |
-
*/
|
28 |
-
|
29 |
-
|
30 |
-
if(isset($_GET['lang'])) {
|
31 |
-
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
$lang =
|
46 |
-
$lang['en'][
|
47 |
-
$lang['en'][
|
48 |
-
$lang['en'][
|
49 |
-
$lang['en'][
|
50 |
-
$lang['en'][
|
51 |
-
$lang['en'][
|
52 |
-
$lang['en'][
|
53 |
-
$lang['en'][
|
54 |
-
$lang['en'][
|
55 |
-
$lang['en'][
|
56 |
-
$lang['en'][
|
57 |
-
$lang['en'][
|
58 |
-
$lang['en'][
|
59 |
-
$lang['en'][
|
60 |
-
$lang['en'][
|
61 |
-
$lang['en'][
|
62 |
-
$lang['en'][
|
63 |
-
$lang['en'][
|
64 |
-
$lang['en'][
|
65 |
-
$lang['en'][
|
66 |
-
$lang['en'][
|
67 |
-
$lang['en'][
|
68 |
-
$lang['en'][
|
69 |
-
$lang['en'][
|
70 |
-
$lang['en'][
|
71 |
-
$lang['en'][
|
72 |
-
$lang['en'][
|
73 |
-
$lang['en'][
|
74 |
-
$lang['en'][
|
75 |
-
$lang['en'][
|
76 |
-
$lang['en'][
|
77 |
-
$lang['en'][
|
78 |
-
$lang['en'][
|
79 |
-
$lang['en'][
|
80 |
-
$lang['en'][
|
81 |
-
$lang['en'][
|
82 |
-
$lang['en'][
|
83 |
-
$lang['en'][
|
84 |
-
$lang['en'][
|
85 |
-
$lang['en'][
|
86 |
-
$lang['en'][
|
87 |
-
$lang['en'][
|
88 |
-
$lang['en'][
|
89 |
-
$lang['en'][
|
90 |
-
$lang['en'][
|
91 |
-
$lang['en'][
|
92 |
-
$lang['en'][
|
93 |
-
$lang['en'][
|
94 |
-
$lang['en'][
|
95 |
-
$lang['en'][
|
96 |
-
$lang['en'][
|
97 |
-
$lang['en'][
|
98 |
-
$lang['en'][
|
99 |
-
$lang['en'][
|
100 |
-
$lang['en'][
|
101 |
-
$lang['en'][
|
102 |
-
$lang['en'][
|
103 |
-
$lang['en'][
|
104 |
-
$lang['en'][
|
105 |
-
$lang['en'][
|
106 |
-
$lang['en'][
|
107 |
-
$lang['en'][
|
108 |
-
$lang['en'][
|
109 |
-
$lang['en'][
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
$lang['de'][
|
114 |
-
$lang['de'][
|
115 |
-
$lang['de'][
|
116 |
-
$lang['de'][
|
117 |
-
$lang['de'][
|
118 |
-
$lang['de'][
|
119 |
-
$lang['de'][
|
120 |
-
$lang['de'][
|
121 |
-
$lang['de'][
|
122 |
-
$lang['de'][
|
123 |
-
$lang['de'][
|
124 |
-
$lang['de'][
|
125 |
-
$lang['de'][
|
126 |
-
$lang['de'][
|
127 |
-
$lang['de'][
|
128 |
-
$lang['de'][
|
129 |
-
$lang['de'][
|
130 |
-
$lang['de'][
|
131 |
-
$lang['de'][
|
132 |
-
$lang['de'][
|
133 |
-
$lang['de'][
|
134 |
-
$lang['de'][
|
135 |
-
$lang['de'][
|
136 |
-
$lang['de'][
|
137 |
-
$lang['de'][
|
138 |
-
$lang['de'][
|
139 |
-
$lang['de'][
|
140 |
-
$lang['de'][
|
141 |
-
$lang['de'][
|
142 |
-
$lang['de'][
|
143 |
-
$lang['de'][
|
144 |
-
$lang['de'][
|
145 |
-
$lang['de'][
|
146 |
-
$lang['de'][
|
147 |
-
$lang['de'][
|
148 |
-
$lang['de'][
|
149 |
-
$lang['de'][
|
150 |
-
$lang['de'][
|
151 |
-
$lang['de'][
|
152 |
-
$lang['de'][
|
153 |
-
$lang['de'][
|
154 |
-
$lang['de'][
|
155 |
-
$lang['de'][
|
156 |
-
$lang['de'][
|
157 |
-
$lang['de'][
|
158 |
-
$lang['de'][
|
159 |
-
$lang['de'][
|
160 |
-
$lang['de'][
|
161 |
-
$lang['de'][
|
162 |
-
$lang['de'][
|
163 |
-
$lang['de'][
|
164 |
-
$lang['de'][
|
165 |
-
$lang['de'][
|
166 |
-
$lang['de'][
|
167 |
-
$lang['de'][
|
168 |
-
$lang['de'][
|
169 |
-
$lang['de'][
|
170 |
-
$lang['de'][
|
171 |
-
$lang['de'][
|
172 |
-
$lang['de'][
|
173 |
-
$lang['de'][
|
174 |
-
$lang['de'][
|
175 |
-
$lang['de'][
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
$lang['fr'][
|
181 |
-
$lang['fr'][
|
182 |
-
$lang['fr'][
|
183 |
-
$lang['fr'][
|
184 |
-
$lang['fr'][
|
185 |
-
$lang['fr'][
|
186 |
-
$lang['fr'][
|
187 |
-
$lang['fr'][
|
188 |
-
$lang['fr'][
|
189 |
-
$lang['fr'][
|
190 |
-
$lang['fr'][
|
191 |
-
$lang['fr'][
|
192 |
-
$lang['fr'][
|
193 |
-
$lang['fr'][
|
194 |
-
$lang['fr'][
|
195 |
-
$lang['fr'][
|
196 |
-
$lang['fr'][
|
197 |
-
$lang['fr'][
|
198 |
-
$lang['fr'][
|
199 |
-
$lang['fr'][
|
200 |
-
$lang['fr'][
|
201 |
-
$lang['fr'][
|
202 |
-
$lang['fr'][
|
203 |
-
$lang['fr'][
|
204 |
-
$lang['fr'][
|
205 |
-
$lang['fr'][
|
206 |
-
$lang['fr'][
|
207 |
-
$lang['fr'][
|
208 |
-
$lang['fr'][
|
209 |
-
$lang['fr'][
|
210 |
-
$lang['fr'][
|
211 |
-
$lang['fr'][
|
212 |
-
$lang['fr'][
|
213 |
-
$lang['fr'][
|
214 |
-
$lang['fr'][
|
215 |
-
$lang['fr'][
|
216 |
-
$lang['fr'][
|
217 |
-
$lang['fr'][
|
218 |
-
$lang['fr'][
|
219 |
-
$lang['fr'][
|
220 |
-
$lang['fr'][
|
221 |
-
$lang['fr'][
|
222 |
-
$lang['fr'][
|
223 |
-
$lang['fr'][
|
224 |
-
$lang['fr'][
|
225 |
-
$lang['fr'][
|
226 |
-
$lang['fr'][
|
227 |
-
$lang['fr'][
|
228 |
-
$lang['fr'][
|
229 |
-
$lang['fr'][
|
230 |
-
$lang['fr'][
|
231 |
-
$lang['fr'][
|
232 |
-
$lang['fr'][
|
233 |
-
$lang['fr'][
|
234 |
-
$lang['fr'][
|
235 |
-
$lang['fr'][
|
236 |
-
$lang['fr'][
|
237 |
-
$lang['fr'][
|
238 |
-
$lang['fr'][
|
239 |
-
$lang['fr'][
|
240 |
-
$lang['fr'][
|
241 |
-
$lang['fr'][
|
242 |
-
$lang['fr'][
|
243 |
-
$lang['fr'][
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$lang['zh'][0] = 'CSS整形與最佳化工具(使用 CSSTidy ';
|
248 |
-
$lang['zh'][1] = 'CSS整形與最佳化工具';
|
249 |
-
$lang['zh'][2] = '(使用';
|
250 |
-
$lang['zh'][3] = '(純文字)';
|
251 |
-
$lang['zh'][4] = '重要事項:';
|
252 |
-
$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具<strong>沒有內建驗證器(validator)</strong>. 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 <a href="http://jigsaw.w3.org/css-validator/">W3C 驗證器</a>, 確保你的原始碼合乎規範.';
|
253 |
-
$lang['zh'][7] = '所有註解都移除了';
|
254 |
-
$lang['zh'][8] = 'CSS 輸入:';
|
255 |
-
$lang['zh'][9] = 'CSS 原始碼:';
|
256 |
-
$lang['zh'][10] = 'CSS 檔案網址(URL):';
|
257 |
-
$lang['zh'][11] = '原始碼規劃:';
|
258 |
-
$lang['zh'][12] = '壓縮程度(原始碼規劃):';
|
259 |
-
$lang['zh'][13] = '最高 (沒有辦法讀, 檔案最小)';
|
260 |
-
$lang['zh'][14] = '高 (適度的可讀性, 檔案小)';
|
261 |
-
$lang['zh'][15] = '標準 (兼顧可讀性與檔案大小)';
|
262 |
-
$lang['zh'][16] = '低 (注重可讀性)';
|
263 |
-
$lang['zh'][17] = '自訂 (在下方設定)';
|
264 |
-
$lang['zh'][18] = '自訂<a href="http://csstidy.sourceforge.net/templates.php">樣板</a>';
|
265 |
-
$lang['zh'][19] = '選項';
|
266 |
-
$lang['zh'][20] = '整理選擇符(請謹慎使用)';
|
267 |
-
$lang['zh'][21] = '整理屬性';
|
268 |
-
$lang['zh'][22] = '重組選擇符';
|
269 |
-
$lang['zh'][23] = '速記法(shorthand)最佳化';
|
270 |
-
$lang['zh'][24] = '壓縮色彩語法';
|
271 |
-
$lang['zh'][25] = '改用小寫選擇符';
|
272 |
-
$lang['zh'][26] = '屬性的字形:';
|
273 |
-
$lang['zh'][27] = '小寫';
|
274 |
-
$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
|
275 |
-
$lang['zh'][29] = '大寫';
|
276 |
-
$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱';
|
277 |
-
$lang['zh'][31] = '移除不必要的反斜線';
|
278 |
-
$lang['zh'][32] = '轉換 !important-hack';
|
279 |
-
$lang['zh'][33] = '輸出成檔案形式';
|
280 |
-
$lang['zh'][34] = '由於比較少換行字元, 會有更大的壓縮比率(複製&貼上沒有用)';
|
281 |
-
$lang['zh'][35] = '執行';
|
282 |
-
$lang['zh'][36] = '壓縮比率';
|
283 |
-
$lang['zh'][37] = '輸入';
|
284 |
-
$lang['zh'][38] = '輸出';
|
285 |
-
$lang['zh'][39] = '語言';
|
286 |
-
$lang['zh'][41] = '注意: 這或許會變更你CSS原始碼的行為!';
|
287 |
-
$lang['zh'][42] = '除去最後一個分號';
|
288 |
-
$lang['zh'][43] = '拋棄不符合規定的屬性';
|
289 |
-
$lang['zh'][44] = '只安全地最佳化';
|
290 |
-
$lang['zh'][45] = '壓縮 font-weight';
|
291 |
-
$lang['zh'][46] = '保留註解';
|
292 |
-
$lang['zh'][47] = '什麼都不要改';
|
293 |
-
$lang['zh'][48] = '只分開原本用逗號分隔的選擇符';
|
294 |
-
$lang['zh'][49] = '合併有相同屬性的選擇符(快速)';
|
295 |
-
$lang['zh'][50] = '聰明地合併選擇符(慢速)';
|
296 |
-
$lang['zh'][51] = '保護CSS';
|
297 |
-
$lang['zh'][52] = '保留註解與 hack 等等. 如果啟用這個選項, 大多數的最佳化程序都不會執行.';
|
298 |
-
$lang['zh'][53] = '不改變';
|
299 |
-
$lang['zh'][54] = '不做最佳化';
|
300 |
-
$lang['zh'][55] = '安全地最佳化';
|
301 |
-
$lang['zh'][56] = '全部最佳化';
|
302 |
-
$lang['zh'][57] = '加上時間戳記';
|
303 |
-
$lang['zh'][58] = '复制到剪贴板';
|
304 |
-
$lang['zh'][59] = '回到页面上方';
|
305 |
-
$lang['zh'][60] = '你的浏览器不支持复制到剪贴板。';
|
306 |
-
$lang['zh'][61] = '如果程序有错误或你有建议,欢迎';
|
307 |
-
$lang['zh'][62] = '和我联系';
|
308 |
-
$lang['zh'][63] = 'Output CSS code as complete HTML document';
|
309 |
-
$lang['zh'][64] = '代码';
|
310 |
-
$lang['zh'][65] = 'CSS to style CSS output';
|
311 |
-
$lang['zh'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.';
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Localization of CSS Optimiser Interface of CSSTidy
|
5 |
+
*
|
6 |
+
* Copyright 2005, 2006, 2007 Florian Schmitz
|
7 |
+
*
|
8 |
+
* This file is part of CSSTidy.
|
9 |
+
*
|
10 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU Lesser General Public License as published by
|
12 |
+
* the Free Software Foundation; either version 2.1 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU Lesser General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU Lesser General Public License
|
21 |
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22 |
+
*
|
23 |
+
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
|
24 |
+
* @package csstidy
|
25 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
|
26 |
+
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
|
27 |
+
*/
|
28 |
+
|
29 |
+
|
30 |
+
if (isset($_GET['lang'])) {
|
31 |
+
$l = $_GET['lang'];
|
32 |
+
} elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
33 |
+
$l = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
34 |
+
$l = strtolower(substr($l, 0, 2));
|
35 |
+
} else {
|
36 |
+
$l = '';
|
37 |
+
}
|
38 |
+
|
39 |
+
$l = (in_array($l, array('de', 'fr', 'zh'))) ? $l : 'en';
|
40 |
+
|
41 |
+
// note 67 in all but English&French, and 5 and 40 in all are orphaned
|
42 |
+
|
43 |
+
$lang = array();
|
44 |
+
$lang['en'][0] = 'CSS Formatter and Optimiser/Optimizer (based on CSSTidy ';
|
45 |
+
$lang['en'][1] = 'CSS Formatter and Optimiser';
|
46 |
+
$lang['en'][2] = '(based on';
|
47 |
+
$lang['en'][3] = '(plaintext)';
|
48 |
+
$lang['en'][4] = 'Important Note:';
|
49 |
+
$lang['en'][6] = 'Your code should be well-formed. This is <strong>not a validator</strong> which points out errors in your CSS code. To make sure that your code is valid, use the <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
|
50 |
+
$lang['en'][7] = 'all comments are removed';
|
51 |
+
$lang['en'][8] = 'CSS Input:';
|
52 |
+
$lang['en'][9] = 'CSS-Code:';
|
53 |
+
$lang['en'][10] = 'CSS from URL:';
|
54 |
+
$lang['en'][11] = 'Code Layout:';
|
55 |
+
$lang['en'][12] = 'Compression (code layout):';
|
56 |
+
$lang['en'][13] = 'Highest (no readability, smallest size)';
|
57 |
+
$lang['en'][14] = 'High (moderate readability, smaller size)';
|
58 |
+
$lang['en'][15] = 'Standard (balance between readability and size)';
|
59 |
+
$lang['en'][16] = 'Low (higher readability)';
|
60 |
+
$lang['en'][17] = 'Custom (enter below)';
|
61 |
+
$lang['en'][18] = 'Custom <a href="http://csstidy.sourceforge.net/templates.php">template</a>';
|
62 |
+
$lang['en'][19] = 'Options';
|
63 |
+
$lang['en'][20] = 'Sort Selectors (caution)';
|
64 |
+
$lang['en'][21] = 'Sort Properties';
|
65 |
+
$lang['en'][22] = 'Regroup selectors';
|
66 |
+
$lang['en'][23] = 'Optimise shorthands';
|
67 |
+
$lang['en'][24] = 'Compress colors';
|
68 |
+
$lang['en'][25] = 'Lowercase selectors';
|
69 |
+
$lang['en'][26] = 'Case for properties:';
|
70 |
+
$lang['en'][27] = 'Lowercase';
|
71 |
+
$lang['en'][28] = 'No or invalid CSS input or wrong URL!';
|
72 |
+
$lang['en'][29] = 'Uppercase';
|
73 |
+
$lang['en'][30] = 'lowercase elementnames needed for XHTML';
|
74 |
+
$lang['en'][31] = 'Remove unnecessary backslashes';
|
75 |
+
$lang['en'][32] = 'convert !important-hack';
|
76 |
+
$lang['en'][33] = 'Output as file';
|
77 |
+
$lang['en'][34] = 'Bigger compression because of smaller newlines (copy & paste doesn\'t work)';
|
78 |
+
$lang['en'][35] = 'Process CSS';
|
79 |
+
$lang['en'][36] = 'Compression Ratio';
|
80 |
+
$lang['en'][37] = 'Input';
|
81 |
+
$lang['en'][38] = 'Output';
|
82 |
+
$lang['en'][39] = 'Language';
|
83 |
+
$lang['en'][41] = 'Attention: This may change the behaviour of your CSS Code!';
|
84 |
+
$lang['en'][42] = 'Remove last ;';
|
85 |
+
$lang['en'][43] = 'Discard invalid properties';
|
86 |
+
$lang['en'][44] = 'Only safe optimisations';
|
87 |
+
$lang['en'][45] = 'Compress font-weight';
|
88 |
+
$lang['en'][46] = 'Save comments';
|
89 |
+
$lang['en'][47] = 'Do not change anything';
|
90 |
+
$lang['en'][48] = 'Only seperate selectors (split at ,)';
|
91 |
+
$lang['en'][49] = 'Merge selectors with the same properties (fast)';
|
92 |
+
$lang['en'][50] = 'Merge selectors intelligently (slow)';
|
93 |
+
$lang['en'][51] = 'Preserve CSS';
|
94 |
+
$lang['en'][52] = 'Save comments, hacks, etc. Most optimisations can *not* be applied if this is enabled.';
|
95 |
+
$lang['en'][53] = 'None';
|
96 |
+
$lang['en'][54] = 'Don\'t optimise';
|
97 |
+
$lang['en'][55] = 'Safe optimisations';
|
98 |
+
$lang['en'][56] = 'All optimisations';
|
99 |
+
$lang['en'][57] = 'Add timestamp';
|
100 |
+
$lang['en'][58] = 'Copy to clipboard';
|
101 |
+
$lang['en'][59] = 'Back to top';
|
102 |
+
$lang['en'][60] = 'Your browser doesn\'t support copy to clipboard.';
|
103 |
+
$lang['en'][61] = 'For bugs and suggestions feel free to';
|
104 |
+
$lang['en'][62] = 'contact me';
|
105 |
+
$lang['en'][63] = 'Output CSS code as complete HTML document';
|
106 |
+
$lang['en'][64] = 'Code';
|
107 |
+
$lang['en'][65] = 'CSS to style CSS output';
|
108 |
+
$lang['en'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.';
|
109 |
+
$lang['en'][67] = 'Reverse left and right directions';
|
110 |
+
|
111 |
+
$lang['de'][0] = 'CSS Formatierer und Optimierer (basierend auf CSSTidy ';
|
112 |
+
$lang['de'][1] = 'CSS Formatierer und Optimierer';
|
113 |
+
$lang['de'][2] = '(basierend auf';
|
114 |
+
$lang['de'][3] = '(Textversion)';
|
115 |
+
$lang['de'][4] = 'Wichtiger Hinweis:';
|
116 |
+
$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird <strong>nicht auf Gültigkeit überprüft</strong>. Um sicherzugehen dass dein Code valide ist, benutze den <a href="http://jigsaw.w3.org/css-validator/">W3C Validierungsservice</a>.';
|
117 |
+
$lang['de'][7] = 'alle Kommentare werden entfernt';
|
118 |
+
$lang['de'][8] = 'CSS Eingabe:';
|
119 |
+
$lang['de'][9] = 'CSS-Code:';
|
120 |
+
$lang['de'][10] = 'CSS von URL:';
|
121 |
+
$lang['de'][11] = 'Code Layout:';
|
122 |
+
$lang['de'][12] = 'Komprimierung (Code Layout):';
|
123 |
+
$lang['de'][13] = 'Höchste (keine Lesbarkeit, niedrigste Größe)';
|
124 |
+
$lang['de'][14] = 'Hoch (mittelmäßige Lesbarkeit, geringe Größe)';
|
125 |
+
$lang['de'][15] = 'Standard (Kompromiss zwischen Lesbarkeit und Größe)';
|
126 |
+
$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)';
|
127 |
+
$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)';
|
128 |
+
$lang['de'][18] = 'Benutzerdefinierte <a href="http://csstidy.sourceforge.net/templates.php">Vorlage</a>';
|
129 |
+
$lang['de'][19] = 'Optionen';
|
130 |
+
$lang['de'][20] = 'Selektoren sortieren (Vorsicht)';
|
131 |
+
$lang['de'][21] = 'Eigenschaften sortieren';
|
132 |
+
$lang['de'][22] = 'Selektoren umgruppieren';
|
133 |
+
$lang['de'][23] = 'Shorthands optimieren';
|
134 |
+
$lang['de'][24] = 'Farben komprimieren';
|
135 |
+
$lang['de'][25] = 'Selektoren in Kleinbuchstaben';
|
136 |
+
$lang['de'][26] = 'Groß-/Kleinschreibung für Eigenschaften';
|
137 |
+
$lang['de'][27] = 'Kleinbuchstaben';
|
138 |
+
$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!';
|
139 |
+
$lang['de'][29] = 'Großbuchstaben';
|
140 |
+
$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML';
|
141 |
+
$lang['de'][31] = 'Unnötige Backslashes entfernen';
|
142 |
+
$lang['de'][32] = '!important-Hack konvertieren';
|
143 |
+
$lang['de'][33] = 'Als Datei ausgeben';
|
144 |
+
$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen';
|
145 |
+
$lang['de'][35] = 'CSS verarbeiten';
|
146 |
+
$lang['de'][36] = 'Komprimierungsrate';
|
147 |
+
$lang['de'][37] = 'Eingabe';
|
148 |
+
$lang['de'][38] = 'Ausgabe';
|
149 |
+
$lang['de'][39] = 'Sprache';
|
150 |
+
$lang['de'][41] = 'Achtung: Dies könnte das Verhalten ihres CSS-Codes verändern!';
|
151 |
+
$lang['de'][42] = 'Letztes ; entfernen';
|
152 |
+
$lang['de'][43] = 'Ungültige Eigenschaften entfernen';
|
153 |
+
$lang['de'][44] = 'Nur sichere Optimierungen';
|
154 |
+
$lang['de'][45] = 'font-weight komprimieren';
|
155 |
+
$lang['de'][46] = 'Kommentare beibehalten';
|
156 |
+
$lang['de'][47] = 'Nichts ändern';
|
157 |
+
$lang['de'][48] = 'Selektoren nur trennen (am Komma)';
|
158 |
+
$lang['de'][49] = 'Selektoren mit gleichen Eigenschaften zusammenfassen (schnell)';
|
159 |
+
$lang['de'][50] = 'Selektoren intelligent zusammenfassen (langsam!)';
|
160 |
+
$lang['de'][51] = 'CSS erhalten';
|
161 |
+
$lang['de'][52] = 'Kommentare, Hacks, etc. speichern. Viele Optimierungen sind dann aber nicht mehr möglich.';
|
162 |
+
$lang['de'][53] = 'Keine';
|
163 |
+
$lang['de'][54] = 'Nicht optimieren';
|
164 |
+
$lang['de'][55] = 'Sichere Optimierungen';
|
165 |
+
$lang['de'][56] = 'Alle Optimierungen';
|
166 |
+
$lang['de'][57] = 'Zeitstempel hinzufügen';
|
167 |
+
$lang['de'][58] = 'Copy to clipboard';
|
168 |
+
$lang['de'][59] = 'Back to top';
|
169 |
+
$lang['de'][60] = 'Your browser doesn\'t support copy to clipboard.';
|
170 |
+
$lang['de'][61] = 'For bugs and suggestions feel free to';
|
171 |
+
$lang['de'][62] = 'contact me';
|
172 |
+
$lang['de'][63] = 'Output CSS code as complete HTML document';
|
173 |
+
$lang['de'][64] = 'Code';
|
174 |
+
$lang['de'][65] = 'CSS to style CSS output';
|
175 |
+
$lang['de'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.';
|
176 |
+
|
177 |
+
|
178 |
+
$lang['fr'][0] = 'CSS Formateur et Optimiseur (basé sur CSSTidy ';
|
179 |
+
$lang['fr'][1] = 'CSS Formateur et Optimiseur';
|
180 |
+
$lang['fr'][2] = '(basé sur ';
|
181 |
+
$lang['fr'][3] = '(Version texte)';
|
182 |
+
$lang['fr'][4] = 'Note Importante :';
|
183 |
+
$lang['fr'][6] = 'Votre code doit être valide. Ce n’est <strong>pas un validateur</strong> qui signale les erreurs dans votre code CSS. Pour être sûr que votre code est correct, utilisez le validateur : <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
|
184 |
+
$lang['fr'][7] = 'tous les commentaires sont enlevés';
|
185 |
+
$lang['fr'][8] = 'Champ CSS :';
|
186 |
+
$lang['fr'][9] = 'Code CSS :';
|
187 |
+
$lang['fr'][10] = 'CSS en provenance d’une URL :<br />';
|
188 |
+
$lang['fr'][11] = 'Mise en page du code :';
|
189 |
+
$lang['fr'][12] = 'Compression (mise en page du code) :';
|
190 |
+
$lang['fr'][13] = 'La plus élevée (aucune lisibilité, taille minimale)';
|
191 |
+
$lang['fr'][14] = 'Élevée (lisibilité modérée, petite taille)';
|
192 |
+
$lang['fr'][15] = 'Normale (équilibre entre lisibilité et taille)';
|
193 |
+
$lang['fr'][16] = 'Faible (lisibilité élevée)';
|
194 |
+
$lang['fr'][17] = 'Sur mesure (entrer ci-dessous)';
|
195 |
+
$lang['fr'][18] = '<a href="http://csstidy.sourceforge.net/templates.php">Gabarit</a> sur mesure';
|
196 |
+
$lang['fr'][19] = 'Options';
|
197 |
+
$lang['fr'][20] = 'Trier les sélecteurs (attention)';
|
198 |
+
$lang['fr'][21] = 'Trier les propriétés';
|
199 |
+
$lang['fr'][22] = 'Regrouper les sélecteurs';
|
200 |
+
$lang['fr'][23] = 'Propriétés raccourcies';
|
201 |
+
$lang['fr'][24] = 'Compresser les couleurs';
|
202 |
+
$lang['fr'][25] = 'Sélecteurs en minuscules';
|
203 |
+
$lang['fr'][26] = 'Case pour les propriétés :';
|
204 |
+
$lang['fr'][27] = 'Minuscule';
|
205 |
+
$lang['fr'][28] = 'CSS non valide ou URL incorrecte !';
|
206 |
+
$lang['fr'][29] = 'Majuscule';
|
207 |
+
$lang['fr'][30] = 'les noms des éléments en minuscules (indispensables pour XHTML)';
|
208 |
+
$lang['fr'][31] = 'enlever les antislashs inutiles';
|
209 |
+
$lang['fr'][32] = 'convertir !important-hack';
|
210 |
+
$lang['fr'][33] = 'Sauver en tant que fichier';
|
211 |
+
$lang['fr'][34] = 'Meilleure compression grâce aux caractères de saut de ligne plus petits (copier & coller ne marche pas)';
|
212 |
+
$lang['fr'][35] = 'Compresser la CSS';
|
213 |
+
$lang['fr'][36] = 'Facteur de Compression';
|
214 |
+
$lang['fr'][37] = 'Entrée';
|
215 |
+
$lang['fr'][38] = 'Sortie';
|
216 |
+
$lang['fr'][39] = 'Langue';
|
217 |
+
$lang['fr'][41] = 'Attention : ceci peut changer le comportement de votre code CSS !';
|
218 |
+
$lang['fr'][42] = 'Enlever le dernier ;';
|
219 |
+
$lang['fr'][43] = 'Supprimer les propriétés non valide';
|
220 |
+
$lang['fr'][44] = 'Seulement les optimisations sûres';
|
221 |
+
$lang['fr'][45] = 'Compresser font-weight';
|
222 |
+
$lang['fr'][46] = 'Sauvegarder les commentaires ';
|
223 |
+
$lang['fr'][47] = 'Ne rien changer';
|
224 |
+
$lang['fr'][48] = 'Sépare les sélecteurs (sépare au niveau de ,)';
|
225 |
+
$lang['fr'][49] = 'Fusionne les sélecteurs avec les mêmes propriétés (rapide)';
|
226 |
+
$lang['fr'][50] = 'Fusionne les sélecteurs intelligemment (lent)';
|
227 |
+
$lang['fr'][51] = 'Préserver la CSS';
|
228 |
+
$lang['fr'][52] = 'Sauvegarder les commentaires, hacks, etc. La plupart des optimisations ne peuvent *pas* être appliquées si cela est activé.';
|
229 |
+
$lang['fr'][53] = 'Aucun';
|
230 |
+
$lang['fr'][54] = 'Ne pas optimiser';
|
231 |
+
$lang['fr'][55] = 'Optimisations sûres';
|
232 |
+
$lang['fr'][56] = 'Toutes les optimisations';
|
233 |
+
$lang['fr'][57] = 'Ajouter un timestamp';
|
234 |
+
$lang['fr'][58] = 'Copier dans le presse-papiers';
|
235 |
+
$lang['fr'][59] = 'Retour en haut';
|
236 |
+
$lang['fr'][60] = 'Votre navigateur ne supporte pas la copie vers le presse-papiers.';
|
237 |
+
$lang['fr'][61] = 'Pour signaler des bugs ou pour des suggestions,';
|
238 |
+
$lang['fr'][62] = 'contactez-moi';
|
239 |
+
$lang['fr'][63] = 'Sauver le code CSS comme document complet HTML';
|
240 |
+
$lang['fr'][64] = 'Code';
|
241 |
+
$lang['fr'][65] = 'CSS pour colorier la sortie CSS';
|
242 |
+
$lang['fr'][66] = 'Vous devez aller dans about:config dans votre barre d’adresse, sélectionner \'signed.applets.codebase_principal_support\' dans le champ Filtre et attribuez-lui la valeur \'true\' pour utiliser cette fonctionnalité; toutefois, soyez conscient que cela augmente les risques de sécurité.';
|
243 |
+
$lang['fr'][67] = 'Inverser gauche et droite';
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
$lang['zh'][0] = 'CSS整形與最佳化工具(使用 CSSTidy ';
|
248 |
+
$lang['zh'][1] = 'CSS整形與最佳化工具';
|
249 |
+
$lang['zh'][2] = '(使用';
|
250 |
+
$lang['zh'][3] = '(純文字)';
|
251 |
+
$lang['zh'][4] = '重要事項:';
|
252 |
+
$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具<strong>沒有內建驗證器(validator)</strong>. 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 <a href="http://jigsaw.w3.org/css-validator/">W3C 驗證器</a>, 確保你的原始碼合乎規範.';
|
253 |
+
$lang['zh'][7] = '所有註解都移除了';
|
254 |
+
$lang['zh'][8] = 'CSS 輸入:';
|
255 |
+
$lang['zh'][9] = 'CSS 原始碼:';
|
256 |
+
$lang['zh'][10] = 'CSS 檔案網址(URL):';
|
257 |
+
$lang['zh'][11] = '原始碼規劃:';
|
258 |
+
$lang['zh'][12] = '壓縮程度(原始碼規劃):';
|
259 |
+
$lang['zh'][13] = '最高 (沒有辦法讀, 檔案最小)';
|
260 |
+
$lang['zh'][14] = '高 (適度的可讀性, 檔案小)';
|
261 |
+
$lang['zh'][15] = '標準 (兼顧可讀性與檔案大小)';
|
262 |
+
$lang['zh'][16] = '低 (注重可讀性)';
|
263 |
+
$lang['zh'][17] = '自訂 (在下方設定)';
|
264 |
+
$lang['zh'][18] = '自訂<a href="http://csstidy.sourceforge.net/templates.php">樣板</a>';
|
265 |
+
$lang['zh'][19] = '選項';
|
266 |
+
$lang['zh'][20] = '整理選擇符(請謹慎使用)';
|
267 |
+
$lang['zh'][21] = '整理屬性';
|
268 |
+
$lang['zh'][22] = '重組選擇符';
|
269 |
+
$lang['zh'][23] = '速記法(shorthand)最佳化';
|
270 |
+
$lang['zh'][24] = '壓縮色彩語法';
|
271 |
+
$lang['zh'][25] = '改用小寫選擇符';
|
272 |
+
$lang['zh'][26] = '屬性的字形:';
|
273 |
+
$lang['zh'][27] = '小寫';
|
274 |
+
$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
|
275 |
+
$lang['zh'][29] = '大寫';
|
276 |
+
$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱';
|
277 |
+
$lang['zh'][31] = '移除不必要的反斜線';
|
278 |
+
$lang['zh'][32] = '轉換 !important-hack';
|
279 |
+
$lang['zh'][33] = '輸出成檔案形式';
|
280 |
+
$lang['zh'][34] = '由於比較少換行字元, 會有更大的壓縮比率(複製&貼上沒有用)';
|
281 |
+
$lang['zh'][35] = '執行';
|
282 |
+
$lang['zh'][36] = '壓縮比率';
|
283 |
+
$lang['zh'][37] = '輸入';
|
284 |
+
$lang['zh'][38] = '輸出';
|
285 |
+
$lang['zh'][39] = '語言';
|
286 |
+
$lang['zh'][41] = '注意: 這或許會變更你CSS原始碼的行為!';
|
287 |
+
$lang['zh'][42] = '除去最後一個分號';
|
288 |
+
$lang['zh'][43] = '拋棄不符合規定的屬性';
|
289 |
+
$lang['zh'][44] = '只安全地最佳化';
|
290 |
+
$lang['zh'][45] = '壓縮 font-weight';
|
291 |
+
$lang['zh'][46] = '保留註解';
|
292 |
+
$lang['zh'][47] = '什麼都不要改';
|
293 |
+
$lang['zh'][48] = '只分開原本用逗號分隔的選擇符';
|
294 |
+
$lang['zh'][49] = '合併有相同屬性的選擇符(快速)';
|
295 |
+
$lang['zh'][50] = '聰明地合併選擇符(慢速)';
|
296 |
+
$lang['zh'][51] = '保護CSS';
|
297 |
+
$lang['zh'][52] = '保留註解與 hack 等等. 如果啟用這個選項, 大多數的最佳化程序都不會執行.';
|
298 |
+
$lang['zh'][53] = '不改變';
|
299 |
+
$lang['zh'][54] = '不做最佳化';
|
300 |
+
$lang['zh'][55] = '安全地最佳化';
|
301 |
+
$lang['zh'][56] = '全部最佳化';
|
302 |
+
$lang['zh'][57] = '加上時間戳記';
|
303 |
+
$lang['zh'][58] = '复制到剪贴板';
|
304 |
+
$lang['zh'][59] = '回到页面上方';
|
305 |
+
$lang['zh'][60] = '你的浏览器不支持复制到剪贴板。';
|
306 |
+
$lang['zh'][61] = '如果程序有错误或你有建议,欢迎';
|
307 |
+
$lang['zh'][62] = '和我联系';
|
308 |
+
$lang['zh'][63] = 'Output CSS code as complete HTML document';
|
309 |
+
$lang['zh'][64] = '代码';
|
310 |
+
$lang['zh'][65] = 'CSS to style CSS output';
|
311 |
+
$lang['zh'][66] = 'You need to go to about:config in your URL bar, select \'signed.applets.codebase_principal_support\' in the filter field, and set its value to true in order to use this feature; however, be aware that doing so increases security risks.';
|
classes/csstidy/template.tpl
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<span class="at">|</span> <span class="format">{</span>
|
2 |
+
|<span class="selector">|</span> <span class="format">{</span>
|
3 |
+
|<span class="property">|</span><span class="value">|</span><span class="format">;</span>
|
4 |
+
|<span class="format">}</span>|
|
5 |
+
|
6 |
+
|
|
7 |
+
<span class="format">}</span>
|
8 |
+
|
9 |
+
||<span class="comment">|</span>
|
10 |
+
|
|
classes/csstidy/template1.tpl
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<span class="at">|</span> <span class="format">{</span>
|
2 |
+
|<span class="selector">|</span>
|
3 |
+
<span class="format">{</span>
|
4 |
+
| <span class="property">|</span><span class="value">|</span><span class="format">;</span>
|
5 |
+
|<span class="format">}</span>|
|
6 |
+
|
7 |
+
|
|
8 |
+
|
9 |
+
<span class="format">}</span>
|
10 |
+
|
11 |
+
| |<span class="comment">|</span>
|
12 |
+
|
|
classes/csstidy/template2.tpl
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<span class="at">|</span> <span class="format">{</span>
|
2 |
+
|<span class="selector">|</span><span class="format">{</span>|<span class="property">|</span><span class="value">|</span><span class="format">;</span>|<span class="format">}</span>|
|
3 |
+
|
|
4 |
+
<span class="format">}
|
5 |
+
</span>||<span class="comment">|</span>|
|
classes/csstidy/template3.tpl
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<span class="at">|</span><span class="format">{</span>|<span class="selector">|</span><span class="format">{</span>|<span class="property">|</span><span class="value">|</span><span class="format">;</span>|<span class="format">}</span>||<span class="format">}</span>||<span class="comment">|</span>|
|
classes/styles-admin.php
CHANGED
@@ -311,6 +311,7 @@ class Styles_Admin {
|
|
311 |
}
|
312 |
|
313 |
$plugin_installed = false;
|
|
|
314 |
if ( is_a( $this->plugin->child, 'Styles_Child' ) ) {
|
315 |
|
316 |
$all_styles_plugins = array_merge( (array) $this->plugin->child->plugins, (array) $this->plugin->child->inactive_plugins );
|
311 |
}
|
312 |
|
313 |
$plugin_installed = false;
|
314 |
+
|
315 |
if ( is_a( $this->plugin->child, 'Styles_Child' ) ) {
|
316 |
|
317 |
$all_styles_plugins = array_merge( (array) $this->plugin->child->plugins, (array) $this->plugin->child->inactive_plugins );
|
classes/styles-child.php
CHANGED
@@ -61,13 +61,7 @@ class Styles_Child {
|
|
61 |
}
|
62 |
|
63 |
public function get_plugins_meta() {
|
64 |
-
|
65 |
-
|
66 |
-
if ( false !== $child_plugins_meta ) {
|
67 |
-
return $child_plugins_meta;
|
68 |
-
}
|
69 |
-
|
70 |
-
if ( !function_exists( 'get_plugins') ) {
|
71 |
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
72 |
}
|
73 |
|
@@ -82,9 +76,6 @@ class Styles_Child {
|
|
82 |
$child_plugins_meta[] = $meta;
|
83 |
}
|
84 |
|
85 |
-
// Refresh plugin list and metadata every 6 hours (or on activate/deactivate)
|
86 |
-
set_site_transient( 'styles_child_plugins', $child_plugins_meta, 60*60*6 );
|
87 |
-
|
88 |
return $child_plugins_meta;
|
89 |
}
|
90 |
|
61 |
}
|
62 |
|
63 |
public function get_plugins_meta() {
|
64 |
+
if ( ! function_exists( 'get_plugins') ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
require_once ABSPATH . '/wp-admin/includes/plugin.php';
|
66 |
}
|
67 |
|
76 |
$child_plugins_meta[] = $meta;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
79 |
return $child_plugins_meta;
|
80 |
}
|
81 |
|
js/admin-notices.js
CHANGED
@@ -2,7 +2,7 @@ jQuery( document ).ready( function ( $ ) {
|
|
2 |
|
3 |
// $('#styles_installation_notices').remove();
|
4 |
|
5 |
-
$( 'div.styles-notice .notice-dismiss' ).
|
6 |
$.get(
|
7 |
ajaxurl,
|
8 |
{
|
2 |
|
3 |
// $('#styles_installation_notices').remove();
|
4 |
|
5 |
+
$( 'div.styles-notice .notice-dismiss' ).on( 'click', function(){
|
6 |
$.get(
|
7 |
ajaxurl,
|
8 |
{
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Styles ===
|
2 |
Contributors: pdclark, elusivelight
|
3 |
-
Plugin URI: http://
|
4 |
Author URI: http://profiles.wordpress.org/pdclark
|
5 |
Tags: css, stylesheet, appearance, customize, customizer, colors, color picker, background, fonts, google fonts, user interface, twenty ten, twenty eleven, twenty twelve, twenty thirteen, genesis
|
6 |
Requires at least: 3.4
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 1.2.
|
9 |
|
10 |
Be creative with colors and fonts. Styles changes everything.
|
11 |
|
@@ -49,7 +49,7 @@ Styles and options for all built-in WordPress themes are free.
|
|
49 |
|
50 |
1. Upload the `styles` folder to the `/wp-content/plugins/` directory
|
51 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
52 |
-
1. Install and activate your theme's support plugin. If you are running TwentyTen through TwentyThirteen, Styles will prompt you to do this. If you would like to use Styles with other themes, check <a href="http://
|
53 |
1. Edit your site under `Appearance > Customize`
|
54 |
|
55 |
== Screenshots ==
|
@@ -75,6 +75,11 @@ In non-editing mode, Styles only outputs one cached CSS block to your site's hea
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
78 |
= 1.2.1 =
|
79 |
|
80 |
* Fix: Remove notices.
|
@@ -276,7 +281,7 @@ In non-editing mode, Styles only outputs one cached CSS block to your site's hea
|
|
276 |
|
277 |
== Upgrade Notice ==
|
278 |
|
279 |
-
= 1.
|
280 |
|
281 |
-
*
|
282 |
-
* Fix:
|
1 |
=== Styles ===
|
2 |
Contributors: pdclark, elusivelight
|
3 |
+
Plugin URI: http://github.com/stylesplugin/styles/
|
4 |
Author URI: http://profiles.wordpress.org/pdclark
|
5 |
Tags: css, stylesheet, appearance, customize, customizer, colors, color picker, background, fonts, google fonts, user interface, twenty ten, twenty eleven, twenty twelve, twenty thirteen, genesis
|
6 |
Requires at least: 3.4
|
7 |
+
Tested up to: 5.8
|
8 |
+
Stable tag: 1.2.3
|
9 |
|
10 |
Be creative with colors and fonts. Styles changes everything.
|
11 |
|
49 |
|
50 |
1. Upload the `styles` folder to the `/wp-content/plugins/` directory
|
51 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
52 |
+
1. Install and activate your theme's support plugin. If you are running TwentyTen through TwentyThirteen, Styles will prompt you to do this. If you would like to use Styles with other themes, check <a href="http://www.youtube.com/playlist?list=PLxj61Fojm1RGevBh10U2qCqjwoH4Awo-P">code your own</a>.
|
53 |
1. Edit your site under `Appearance > Customize`
|
54 |
|
55 |
== Screenshots ==
|
75 |
|
76 |
== Changelog ==
|
77 |
|
78 |
+
= 1.2.3 =
|
79 |
+
|
80 |
+
* Fix: jQuery Migrate compatibility.
|
81 |
+
* Fix: PHP 8 compatibility.
|
82 |
+
|
83 |
= 1.2.1 =
|
84 |
|
85 |
* Fix: Remove notices.
|
281 |
|
282 |
== Upgrade Notice ==
|
283 |
|
284 |
+
= 1.2.3 =
|
285 |
|
286 |
+
* Fix: jQuery Migrate compatibility.
|
287 |
+
* Fix: PHP 8 compatibility.
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|
screenshot-4.png
DELETED
Binary file
|
styles.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Styles
|
4 |
Plugin URI: http://stylesplugin.com
|
5 |
Description: Change the appearance of your theme using the <a href="customize.php">Customizer</a>. Most default themes supported via free add-ons on WordPress.org (see <a href="http://wordpress.org/plugins/styles" target="_blank">links in readme</a>).
|
6 |
-
Version: 1.2.
|
7 |
Author: Paul Clark
|
8 |
Author URI: http://profiles.wordpress.org/pdclark
|
9 |
License: GPLv2
|
3 |
Plugin Name: Styles
|
4 |
Plugin URI: http://stylesplugin.com
|
5 |
Description: Change the appearance of your theme using the <a href="customize.php">Customizer</a>. Most default themes supported via free add-ons on WordPress.org (see <a href="http://wordpress.org/plugins/styles" target="_blank">links in readme</a>).
|
6 |
+
Version: 1.2.3
|
7 |
Author: Paul Clark
|
8 |
Author URI: http://profiles.wordpress.org/pdclark
|
9 |
License: GPLv2
|