Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

spaces to tabs - correct indentation

  • Loading branch information...
commit 2045ca42c99ab034b83d47e694d69c9cb6491e69 1 parent 259638e
@dereuromark dereuromark authored
View
18 class.csstidy.php
@@ -260,9 +260,9 @@ function csstidy() {
$this->settings['compress_font-weight'] = true;
$this->settings['lowercase_s'] = false;
/*
- 1 common shorthands optimization
- 2 + font property optimization
- 3 + background property optimization
+ 1 common shorthands optimization
+ 2 + font property optimization
+ 3 + background property optimization
*/
$this->settings['optimise_shorthands'] = 1;
$this->settings['remove_last_;'] = true;
@@ -273,9 +273,9 @@ function csstidy() {
*/
$this->settings['sort_properties'] = false;
/*
- 1, 3, 5, etc -- enable sorting selectors inside @media: a{}b{}c{}
- 2, 5, 8, etc -- enable sorting selectors inside one CSS declaration: a,b,c{}
- preserve order by default cause it can break functionnality
+ 1, 3, 5, etc -- enable sorting selectors inside @media: a{}b{}c{}
+ 2, 5, 8, etc -- enable sorting selectors inside one CSS declaration: a,b,c{}
+ preserve order by default cause it can break functionnality
*/
$this->settings['sort_selectors'] = 0;
/* is dangeroues to be used: CSS is broken sometimes */
@@ -708,7 +708,7 @@ function parse($string) {
// else this is dumb IE a hack, keep it
// including //
elseif (($this->property=='' AND !ctype_space($string{$i}))
- OR ($this->property=='/' OR $string{$i}=="/")) {
+ OR ($this->property=='/' OR $string{$i}=="/")) {
$this->property .= $string{$i};
}
}
@@ -840,7 +840,7 @@ function parse($string) {
$_quoted_string = $this->quoted_string[count($this->quoted_string)-1];
$temp_add = $string{$i};
- // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
+ // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
// parentheticals can be nested more than once.
if ($_str_char === ")" && ($string{$i} === "(" || $string{$i} === '"' || $string{$i} === '\'') && !csstidy::escaped($string, $i)) {
$this->cur_string[] = $string{$i};
@@ -1143,7 +1143,7 @@ function merge_css_blocks($media, $selector, $css_add) {
static function is_important(&$value) {
return (
strpos($value,"!")!==false // quick test
- AND !strcasecmp(substr(str_replace($GLOBALS['csstidy']['whitespace'], '', $value), -10, 10), '!important'));
+ AND !strcasecmp(substr(str_replace($GLOBALS['csstidy']['whitespace'], '', $value), -10, 10), '!important'));
}
/**
View
6 class.csstidy_optimise.php
@@ -19,7 +19,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -647,7 +647,7 @@ function dissolve_short_bg($str_value) {
// don't try to explose background gradient !
if (stripos($str_value, "gradient(")!==FALSE)
return array('background'=>$str_value);
-
+
$background_prop_default = & $GLOBALS['csstidy']['background_prop_default'];
$repeat = array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'space');
$attachment = array('scroll', 'fixed', 'local');
@@ -733,7 +733,7 @@ function merge_bg($input_css) {
// if background properties is here and not empty, don't try anything
if (isset($input_css['background']) AND $input_css['background'])
return $input_css;
-
+
for ($i = 0; $i < $number_of_values; $i++) {
foreach ($background_prop_default as $bg_property => $default_value) {
// Skip if property does not exist
View
4 class.csstidy_print.php
@@ -19,7 +19,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -315,7 +315,7 @@ function _convert_raw_css($default_media='') {
elseif ($default_media) {
$this->parser->_add_token(AT_START, $default_media, true);
}
-
+
foreach ($val as $selector => $vali) {
if ($sort_properties)
ksort($vali);
View
466 css_optimiser.php
@@ -17,7 +17,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@@ -47,23 +47,23 @@ function rmdirr($dirname,$oc=0)
{
// Sanity check
if (!file_exists($dirname)) {
- return false;
+ return false;
}
// Simple delete for a file
if (is_file($dirname) && (time()-fileatime($dirname))>3600) {
- return unlink($dirname);
+ return unlink($dirname);
}
// Loop through the folder
if(is_dir($dirname))
{
$dir = dir($dirname);
while (false !== $entry = $dir->read()) {
- // Skip pointers
- if ($entry === '.' || $entry === '..') {
- continue;
- }
- // Recurse
- rmdirr($dirname.'/'.$entry,$oc);
+ // Skip pointers
+ if ($entry === '.' || $entry === '..') {
+ continue;
+ }
+ // Recurse
+ rmdirr($dirname.'/'.$entry,$oc);
}
$dir->close();
}
@@ -76,39 +76,39 @@ function rmdirr($dirname,$oc=0)
function options($options, $selected = null, $labelIsValue = false)
{
- $html = '';
-
- settype($selected, 'array');
- settype($options, 'array');
-
- foreach ($options as $value=>$label)
- {
- if (is_array($label)) {
- $value = $label[0];
- $label = $label[1];
- }
- $label = htmlspecialchars($label, ENT_QUOTES, 'utf-8');
- $value = $labelIsValue ? $label
- : htmlspecialchars($value, ENT_QUOTES, 'utf-8');
-
- $html .= '<option value="'.$value.'"';
- if (in_array($value, $selected)) {
- $html .= ' selected="selected"';
- }
- $html .= '>'.$label.'</option>';
- }
- if (!$html) {
- $html .= '<option value="0">---</option>';
- }
-
- return $html;
+ $html = '';
+
+ settype($selected, 'array');
+ settype($options, 'array');
+
+ foreach ($options as $value=>$label)
+ {
+ if (is_array($label)) {
+ $value = $label[0];
+ $label = $label[1];
+ }
+ $label = htmlspecialchars($label, ENT_QUOTES, 'utf-8');
+ $value = $labelIsValue ? $label
+ : htmlspecialchars($value, ENT_QUOTES, 'utf-8');
+
+ $html .= '<option value="'.$value.'"';
+ if (in_array($value, $selected)) {
+ $html .= ' selected="selected"';
+ }
+ $html .= '>'.$label.'</option>';
+ }
+ if (!$html) {
+ $html .= '<option value="0">---</option>';
+ }
+
+ return $html;
}
$css = new csstidy();
$is_custom = isset($_REQUEST['custom']) && !empty($_REQUEST['custom']) && isset($_REQUEST['template']) && ($_REQUEST['template'] === '4');
if($is_custom)
{
- setcookie ('custom_template', $_REQUEST['custom'], time()+360000);
+ setcookie ('custom_template', $_REQUEST['custom'], time()+360000);
}
rmdirr('temp');
@@ -130,8 +130,8 @@ function options($options, $selected = null, $labelIsValue = false)
// This by itself is enough since our scripts don't use DOM to create elements (in which case the namespace aware ones
-// should be used when serving as application/xhtml+xml but not when served as text/html ;
-// also, case will be different when retrieving element names, as HTML DOM returns in upper case,
+// should be used when serving as application/xhtml+xml but not when served as text/html ;
+// also, case will be different when retrieving element names, as HTML DOM returns in upper case,
// genuine XHTML DOM (when XHTML served as such) as lower
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
$http_accept = 'application/xhtml+xml';
@@ -160,7 +160,7 @@ function options($options, $selected = null, $labelIsValue = false)
if ($http_accept === 'text/html') {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
}
else {
@@ -170,38 +170,38 @@ function options($options, $selected = null, $labelIsValue = false)
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $l; ?>">
- <head>
- <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
- <title>
- <?php echo $lang[$l][0]; echo $css->version; ?>)
- </title>
- <link rel="stylesheet" href="cssparse.css" type="text/css" />
- <script type="text/javascript"><!--/*--><![CDATA[/*><!--*/
- function enable_disable_preserve()
- {
- var inputs = new Array('sort_sel', 'sort_de', 'optimise_shorthands', 'merge_selectors', 'none');
- var inputs_v = new Array( true, true, true, true, false);
- for(var i = 0; i < inputs.length; i++)
- {
- if(document.getElementById('preserve_css').checked) {
- document.getElementById(inputs[i]).disabled = inputs_v[i];
- } else {
- document.getElementById(inputs[i]).disabled = !inputs_v[i];
- }
- }
- }
- function ClipBoard()
- {
+ <head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+ <title>
+ <?php echo $lang[$l][0]; echo $css->version; ?>)
+ </title>
+ <link rel="stylesheet" href="cssparse.css" type="text/css" />
+ <script type="text/javascript"><!--/*--><![CDATA[/*><!--*/
+ function enable_disable_preserve()
+ {
+ var inputs = new Array('sort_sel', 'sort_de', 'optimise_shorthands', 'merge_selectors', 'none');
+ var inputs_v = new Array( true, true, true, true, false);
+ for(var i = 0; i < inputs.length; i++)
+ {
+ if(document.getElementById('preserve_css').checked) {
+ document.getElementById(inputs[i]).disabled = inputs_v[i];
+ } else {
+ document.getElementById(inputs[i]).disabled = !inputs_v[i];
+ }
+ }
+ }
+ function ClipBoard()
+ {
if (window.clipboardData) { // Feature testing
window.clipboardData.setData('Text',document.getElementById("copytext").innerText);
}
- else if (navigator.userAgent.indexOf('Gecko') != -1
+ else if (navigator.userAgent.indexOf('Gecko') != -1
&& navigator.userAgent.indexOf('Apple') == -1
) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
- getService(Components.interfaces.nsIClipboardHelper);
+ getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString(document.getElementById("copytext").innerHTML);
}
catch (e) {
@@ -211,150 +211,150 @@ function ClipBoard()
else {
alert("<?php echo $lang[$l][60]; ?>");
}
- }
+ }
/*]]>*/-->
- </script>
- </head>
- <body onload="enable_disable_preserve()">
- <div><h1 style="display:inline">
- <?php echo $lang[$l][1]; ?>
- </h1>
- <?php echo $lang[$l][2]; ?> <a
- href="http://csstidy.sourceforge.net/">csstidy</a> <?php echo $css->version; ?>)
- </div><p>
- <?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>
- <p><?php echo $lang[$l][4]; ?>
- <?php echo $lang[$l][6]; ?>
- </p>
-
- <form method="post" action="">
- <div>
- <fieldset id="field_input">
- <legend><?php echo $lang[$l][8]; ?></legend> <label for="css_text"
- 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>
- <label for="url"><?php echo $lang[$l][10]; ?></label> <input type="text"
- name="url" id="url" <?php if(isset($_REQUEST['url']) &&
- !empty($_REQUEST['url'])) echo 'value="',htmlspecialchars($_REQUEST['url'], ENT_QUOTES, 'utf-8'),'"'; ?>
- size="35" /><br />
- <input type="submit" value="<?php echo $lang[$l][35]; ?>" id="submit" />
- </fieldset>
- <div id="rightcol">
- <fieldset id="code_layout">
- <legend><?php echo $lang[$l][11]; ?></legend> <label for="template"
- class="block"><?php echo $lang[$l][12]; ?></label> <select
- id="template" name="template" style="margin-bottom:1em;">
- <?php
- $num = (isset($_REQUEST['template'])) ? intval($_REQUEST['template']) : 1;
- echo options(array(3 => $lang[$l][13], 2 => $lang[$l][14], 1 => $lang[$l][15], 0 => $lang[$l][16], 4 => $lang[$l][17]), $num);
- ?>
- </select><br />
- <label for="custom" class="block">
- <?php echo $lang[$l][18]; ?> </label> <textarea id="custom"
- name="custom" cols="33" rows="4"><?php
- if($is_custom) echo
- htmlspecialchars($_REQUEST['custom'], ENT_QUOTES, 'utf-8');
- elseif(isset($_COOKIE['custom_template']) &&
- !empty($_COOKIE['custom_template'])) echo
+ </script>
+ </head>
+ <body onload="enable_disable_preserve()">
+ <div><h1 style="display:inline">
+ <?php echo $lang[$l][1]; ?>
+ </h1>
+ <?php echo $lang[$l][2]; ?> <a
+ href="http://csstidy.sourceforge.net/">csstidy</a> <?php echo $css->version; ?>)
+ </div><p>
+ <?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>
+ <p><?php echo $lang[$l][4]; ?>
+ <?php echo $lang[$l][6]; ?>
+ </p>
+
+ <form method="post" action="">
+ <div>
+ <fieldset id="field_input">
+ <legend><?php echo $lang[$l][8]; ?></legend> <label for="css_text"
+ 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>
+ <label for="url"><?php echo $lang[$l][10]; ?></label> <input type="text"
+ name="url" id="url" <?php if(isset($_REQUEST['url']) &&
+ !empty($_REQUEST['url'])) echo 'value="',htmlspecialchars($_REQUEST['url'], ENT_QUOTES, 'utf-8'),'"'; ?>
+ size="35" /><br />
+ <input type="submit" value="<?php echo $lang[$l][35]; ?>" id="submit" />
+ </fieldset>
+ <div id="rightcol">
+ <fieldset id="code_layout">
+ <legend><?php echo $lang[$l][11]; ?></legend> <label for="template"
+ class="block"><?php echo $lang[$l][12]; ?></label> <select
+ id="template" name="template" style="margin-bottom:1em;">
+ <?php
+ $num = (isset($_REQUEST['template'])) ? intval($_REQUEST['template']) : 1;
+ echo options(array(3 => $lang[$l][13], 2 => $lang[$l][14], 1 => $lang[$l][15], 0 => $lang[$l][16], 4 => $lang[$l][17]), $num);
+ ?>
+ </select><br />
+ <label for="custom" class="block">
+ <?php echo $lang[$l][18]; ?> </label> <textarea id="custom"
+ name="custom" cols="33" rows="4"><?php
+ if($is_custom) echo
+ htmlspecialchars($_REQUEST['custom'], ENT_QUOTES, 'utf-8');
+ elseif(isset($_COOKIE['custom_template']) &&
+ !empty($_COOKIE['custom_template'])) echo
htmlspecialchars($_COOKIE['custom_template'], ENT_QUOTES, 'utf-8');
- ?></textarea>
- </fieldset>
- <fieldset id="options">
- <legend><?php echo $lang[$l][19]; ?></legend>
+ ?></textarea>
+ </fieldset>
+ <fieldset id="options">
+ <legend><?php echo $lang[$l][19]; ?></legend>
+
+ <input onchange="enable_disable_preserve()" type="checkbox" name="preserve_css" id="preserve_css"
+ <?php if($css->get_cfg('preserve_css')) echo 'checked="checked"'; ?> />
+ <label for="preserve_css" title="<?php echo $lang[$l][52]; ?>" class="help"><?php echo $lang[$l][51]; ?></label><br />
- <input onchange="enable_disable_preserve()" type="checkbox" name="preserve_css" id="preserve_css"
- <?php if($css->get_cfg('preserve_css')) echo 'checked="checked"'; ?> />
- <label for="preserve_css" title="<?php echo $lang[$l][52]; ?>" class="help"><?php echo $lang[$l][51]; ?></label><br />
+ <input type="checkbox" name="sort_sel" id="sort_sel"
+ <?php if($css->get_cfg('sort_selectors')) echo 'checked="checked"'; ?> />
+ <label for="sort_sel" title="<?php echo $lang[$l][41]; ?>" class="help"><?php echo $lang[$l][20]; ?></label><br />
- <input type="checkbox" name="sort_sel" id="sort_sel"
- <?php if($css->get_cfg('sort_selectors')) echo 'checked="checked"'; ?> />
- <label for="sort_sel" title="<?php echo $lang[$l][41]; ?>" class="help"><?php echo $lang[$l][20]; ?></label><br />
+ <input type="checkbox" name="sort_de" id="sort_de"
+ <?php if($css->get_cfg('sort_properties')) echo 'checked="checked"'; ?> />
+ <label for="sort_de"><?php echo $lang[$l][21]; ?></label><br />
- <input type="checkbox" name="sort_de" id="sort_de"
- <?php if($css->get_cfg('sort_properties')) echo 'checked="checked"'; ?> />
- <label for="sort_de"><?php echo $lang[$l][21]; ?></label><br />
+ <label for="merge_selectors"><?php echo $lang[$l][22]; ?></label>
+ <select style="width:15em;" name="merge_selectors" id="merge_selectors">
+ <?php echo options(array('0' => $lang[$l][47], '1' => $lang[$l][48], '2' => $lang[$l][49]), $css->get_cfg('merge_selectors')); ?>
+ </select><br />
- <label for="merge_selectors"><?php echo $lang[$l][22]; ?></label>
- <select style="width:15em;" name="merge_selectors" id="merge_selectors">
- <?php echo options(array('0' => $lang[$l][47], '1' => $lang[$l][48], '2' => $lang[$l][49]), $css->get_cfg('merge_selectors')); ?>
- </select><br />
+ <label for="optimise_shorthands"><?php echo $lang[$l][23]; ?></label>
+ <select name="optimise_shorthands" id="optimise_shorthands">
+ <?php echo options(array($lang[$l][54], $lang[$l][55], $lang[$l][56]), $css->get_cfg('optimise_shorthands')); ?>
+ </select><br />
- <label for="optimise_shorthands"><?php echo $lang[$l][23]; ?></label>
- <select name="optimise_shorthands" id="optimise_shorthands">
- <?php echo options(array($lang[$l][54], $lang[$l][55], $lang[$l][56]), $css->get_cfg('optimise_shorthands')); ?>
- </select><br />
+ <input type="checkbox" name="compress_c" id="compress_c"
+ <?php if($css->get_cfg('compress_colors')) echo 'checked="checked"';?> />
+ <label for="compress_c"><?php echo $lang[$l][24]; ?></label><br />
- <input type="checkbox" name="compress_c" id="compress_c"
- <?php if($css->get_cfg('compress_colors')) echo 'checked="checked"';?> />
- <label for="compress_c"><?php echo $lang[$l][24]; ?></label><br />
+ <input type="checkbox" name="compress_fw" id="compress_fw"
+ <?php if($css->get_cfg('compress_font-weight')) echo 'checked="checked"';?> />
+ <label for="compress_fw"><?php echo $lang[$l][45]; ?></label><br />
- <input type="checkbox" name="compress_fw" id="compress_fw"
- <?php if($css->get_cfg('compress_font-weight')) echo 'checked="checked"';?> />
- <label for="compress_fw"><?php echo $lang[$l][45]; ?></label><br />
+ <input type="checkbox" name="lowercase" id="lowercase" value="lowercase"
+ <?php if($css->get_cfg('lowercase_s')) echo 'checked="checked"'; ?> />
+ <label title="<?php echo $lang[$l][30]; ?>" class="help" for="lowercase"><?php echo $lang[$l][25]; ?></label><br />
- <input type="checkbox" name="lowercase" id="lowercase" value="lowercase"
- <?php if($css->get_cfg('lowercase_s')) echo 'checked="checked"'; ?> />
- <label title="<?php echo $lang[$l][30]; ?>" class="help" for="lowercase"><?php echo $lang[$l][25]; ?></label><br />
+ <?php echo $lang[$l][26]; ?><br />
+ <input type="radio" name="case_properties" id="none" value="0"
+ <?php if($css->get_cfg('case_properties') === 0) echo 'checked="checked"'; ?> />
+ <label for="none"><?php echo $lang[$l][53]; ?></label>
+ <input type="radio" name="case_properties" id="lower_yes" value="1"
+ <?php if($css->get_cfg('case_properties') === 1) echo 'checked="checked"'; ?> />
+ <label for="lower_yes"><?php echo $lang[$l][27]; ?></label>
+ <input type="radio" name="case_properties" id="upper_yes" value="2"
+ <?php if($css->get_cfg('case_properties') === 2) echo 'checked="checked"'; ?> />
+ <label for="upper_yes"><?php echo $lang[$l][29]; ?></label><br />
- <?php echo $lang[$l][26]; ?><br />
- <input type="radio" name="case_properties" id="none" value="0"
- <?php if($css->get_cfg('case_properties') === 0) echo 'checked="checked"'; ?> />
- <label for="none"><?php echo $lang[$l][53]; ?></label>
- <input type="radio" name="case_properties" id="lower_yes" value="1"
- <?php if($css->get_cfg('case_properties') === 1) echo 'checked="checked"'; ?> />
- <label for="lower_yes"><?php echo $lang[$l][27]; ?></label>
- <input type="radio" name="case_properties" id="upper_yes" value="2"
- <?php if($css->get_cfg('case_properties') === 2) echo 'checked="checked"'; ?> />
- <label for="upper_yes"><?php echo $lang[$l][29]; ?></label><br />
+ <input type="checkbox" name="rbs" id="rbs"
+ <?php if($css->get_cfg('remove_bslash')) echo 'checked="checked"'; ?> />
+ <label for="rbs"><?php echo $lang[$l][31]; ?></label><br />
- <input type="checkbox" name="rbs" id="rbs"
- <?php if($css->get_cfg('remove_bslash')) echo 'checked="checked"'; ?> />
- <label for="rbs"><?php echo $lang[$l][31]; ?></label><br />
+ <input type="checkbox" id="remove_last_sem" name="remove_last_sem"
+ <?php if($css->get_cfg('remove_last_;')) echo 'checked="checked"'; ?> />
+ <label for="remove_last_sem"><?php echo $lang[$l][42]; ?></label><br />
- <input type="checkbox" id="remove_last_sem" name="remove_last_sem"
- <?php if($css->get_cfg('remove_last_;')) echo 'checked="checked"'; ?> />
- <label for="remove_last_sem"><?php echo $lang[$l][42]; ?></label><br />
+ <input type="checkbox" id="discard" name="discard"
+ <?php if($css->get_cfg('discard_invalid_properties')) echo 'checked="checked"'; ?> />
+ <label for="discard"><?php echo $lang[$l][43]; ?></label>
+ <select name="css_level"><?php echo options(array('CSS2.1','CSS2.0','CSS1.0'),$css->get_cfg('css_level'), true); ?></select><br />
- <input type="checkbox" id="discard" name="discard"
- <?php if($css->get_cfg('discard_invalid_properties')) echo 'checked="checked"'; ?> />
- <label for="discard"><?php echo $lang[$l][43]; ?></label>
- <select name="css_level"><?php echo options(array('CSS2.1','CSS2.0','CSS1.0'),$css->get_cfg('css_level'), true); ?></select><br />
+ <input type="checkbox" id="timestamp" name="timestamp"
+ <?php if($css->get_cfg('timestamp')) echo 'checked="checked"'; ?> />
+ <label for="timestamp"><?php echo $lang[$l][57]; ?></label><br />
- <input type="checkbox" id="timestamp" name="timestamp"
- <?php if($css->get_cfg('timestamp')) echo 'checked="checked"'; ?> />
- <label for="timestamp"><?php echo $lang[$l][57]; ?></label><br />
-
<input type="checkbox" id="whole_file" name="whole_file"
- <?php if(isset($_REQUEST['whole_file'])) echo 'checked="checked"'; ?> />
- <label for="whole_file"><?php echo $lang[$l][63]; ?></label><br />
+ <?php if(isset($_REQUEST['whole_file'])) echo 'checked="checked"'; ?> />
+ <label for="whole_file"><?php echo $lang[$l][63]; ?></label><br />
- <input type="checkbox" name="file_output" id="file_output" value="file_output"
- <?php if(isset($_REQUEST['file_output'])) echo 'checked="checked"'; ?> />
- <label class="help" title="<?php echo $lang[$l][34]; ?>" for="file_output">
+ <input type="checkbox" name="file_output" id="file_output" value="file_output"
+ <?php if(isset($_REQUEST['file_output'])) echo 'checked="checked"'; ?> />
+ <label class="help" title="<?php echo $lang[$l][34]; ?>" for="file_output">
<strong><?php echo $lang[$l][33]; ?></strong>
</label><br />
- </fieldset>
- <input type="hidden" name="post" />
- </div>
- </div>
- </form>
- <?php
+ </fieldset>
+ <input type="hidden" name="post" />
+ </div>
+ </div>
+ </form>
+ <?php
- $file_ok = false;
- $result = false;
+ $file_ok = false;
+ $result = false;
- $url = (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) ? $_REQUEST['url'] : false;
+ $url = (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) ? $_REQUEST['url'] : false;
if(isset($_REQUEST['template']))
{
@@ -381,26 +381,26 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
}
}
- if($url)
- {
- if(substr($_REQUEST['url'],0,7) !== 'http://')
+ if($url)
+ {
+ if(substr($_REQUEST['url'],0,7) !== 'http://')
{
$_REQUEST['url'] = 'http://'.$_REQUEST['url'];
}
- $result = $css->parse_from_url($_REQUEST['url'],0);
- }
- elseif(isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5)
- {
- $result = $css->parse($_REQUEST['css_text']);
- }
-
- if($result)
- {
- $ratio = $css->print->get_ratio();
- $diff = $css->print->get_diff();
- if(isset($_REQUEST['file_output']))
- {
- $filename = md5(mt_rand().time().mt_rand());
+ $result = $css->parse_from_url($_REQUEST['url'],0);
+ }
+ elseif(isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5)
+ {
+ $result = $css->parse($_REQUEST['css_text']);
+ }
+
+ if($result)
+ {
+ $ratio = $css->print->get_ratio();
+ $diff = $css->print->get_diff();
+ if(isset($_REQUEST['file_output']))
+ {
+ $filename = md5(mt_rand().time().mt_rand());
if (!is_dir('temp')) {
$madedir = mkdir('temp');
if (!$madedir) {
@@ -408,20 +408,20 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
exit;
}
}
- $handle = fopen('temp/'.$filename.'.css','w');
- if($handle) {
- if(fwrite($handle,$css->print->plain()))
- {
- $file_ok = true;
- }
- }
- fclose($handle);
- }
- if($ratio>0) $ratio = '<span style="color:green;">'.$ratio.'%</span>
- ('.$diff.' Bytes)'; else $ratio = '<span
- style="color:red;">'.$ratio.'%</span> ('.$diff.' Bytes)';
- if(count($css->log) > 0): ?>
- <fieldset id="messages"><legend>Messages</legend>
+ $handle = fopen('temp/'.$filename.'.css','w');
+ if($handle) {
+ if(fwrite($handle,$css->print->plain()))
+ {
+ $file_ok = true;
+ }
+ }
+ fclose($handle);
+ }
+ if($ratio>0) $ratio = '<span style="color:green;">'.$ratio.'%</span>
+ ('.$diff.' Bytes)'; else $ratio = '<span
+ style="color:red;">'.$ratio.'%</span> ('.$diff.' Bytes)';
+ if(count($css->log) > 0): ?>
+ <fieldset id="messages"><legend>Messages</legend>
<div><dl><?php
foreach($css->log as $line => $array)
{
@@ -433,22 +433,22 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
}
}
?></dl></div>
- </fieldset>
- <?php endif;
- echo '<fieldset><legend>',$lang[$l][37],': ',$css->print->size('input'),'KB, ',$lang[$l][38],':',$css->print->size('output'),'KB, ',$lang[$l][36],': ',$ratio;
- if($file_ok)
- {
- echo ' - <a href="temp/',$filename,'.css">Download</a>';
- }
- echo ' - <a href="javascript:ClipBoard()">',$lang[$l][58],'</a>';
- echo '</legend>';
- echo '<code id="copytext">';
- echo $css->print->formatted();
- echo '</code></fieldset><div><br /></div>';
-
+ </fieldset>
+ <?php endif;
+ echo '<fieldset><legend>',$lang[$l][37],': ',$css->print->size('input'),'KB, ',$lang[$l][38],':',$css->print->size('output'),'KB, ',$lang[$l][36],': ',$ratio;
+ if($file_ok)
+ {
+ echo ' - <a href="temp/',$filename,'.css">Download</a>';
+ }
+ echo ' - <a href="javascript:ClipBoard()">',$lang[$l][58],'</a>';
+ echo '</legend>';
+ echo '<code id="copytext">';
+ echo $css->print->formatted();
+ echo '</code></fieldset><div><br /></div>';
+
echo '<fieldset class="code_output"><legend>',$lang[$l][64],'</legend>';
- echo '<textarea rows="10" cols="80">';
-
+ echo '<textarea rows="10" cols="80">';
+
if(isset($_REQUEST['whole_file'])) {
echo htmlspecialchars($css->print->formatted_page('xhtml1.1', false, '', 'en'), ENT_QUOTES, 'utf-8');
}
@@ -459,20 +459,20 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
echo '</textarea></fieldset>';
echo '<fieldset class="code_output"><legend>',$lang[$l][65],'</legend>';
echo '<textarea rows="10" cols="30">';
-
+
echo file_get_contents('cssparsed.css');
echo '</textarea>';
-
+
echo '</fieldset><p><a href="javascript:scrollTo(0,0)">&#8593; ',$lang[$l][59],'</a></p>';
-
- }
- elseif(isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
- echo '<p class="important">',$lang[$l][28],'</p>';
- }
- ?>
- <p style="text-align:center;font-size:.8em;clear:both;">
- <?php echo $lang[$l][61] ?> <a
- href="http://csstidy.sourceforge.net/contact.php"><?php echo $lang[$l][62] ?></a>.
- </p>
- </body>
+
+ }
+ elseif(isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
+ echo '<p class="important">',$lang[$l][28],'</p>';
+ }
+ ?>
+ <p style="text-align:center;font-size:.8em;clear:both;">
+ <?php echo $lang[$l][61] ?> <a
+ href="http://csstidy.sourceforge.net/contact.php"><?php echo $lang[$l][62] ?></a>.
+ </p>
+ </body>
</html>
View
4 data.inc.php
@@ -76,9 +76,9 @@
* @version 1.2
*/
$GLOBALS['csstidy']['unit_values'] = array ('background', 'background-position', 'background-size', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-width',
- 'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'column-gap', 'column-width',
+ 'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'column-gap', 'column-width',
'font-size', 'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height',
- 'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
+ 'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
'padding-bottom', 'padding-left', 'perspective', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width');
/**
View
18 lang.inc.php
@@ -16,26 +16,26 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
- * @author Brett Zamir (brettz9 at yahoo dot com) 2007
+ * @author Brett Zamir (brettz9 at yahoo dot com) 2007
*/
if(isset($_GET['lang'])) {
- $l = $_GET['lang'];
+ $l = $_GET['lang'];
}
else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
- $l = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
- $l = strtolower(substr($l, 0, 2));
+ $l = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+ $l = strtolower(substr($l, 0, 2));
}
else {
- $l = '';
+ $l = '';
}
$l = (in_array($l, array('de', 'fr', 'zh'))) ? $l : 'en';
@@ -128,7 +128,7 @@
$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)';
$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)';
$lang['de'][18] = 'Benutzerdefinierte <a href="http://csstidy.sourceforge.net/templates.php">Vorlage</a>';
-$lang['de'][19] = 'Optionen';
+$lang['de'][19] = 'Optionen';
$lang['de'][20] = 'Selektoren sortieren (Vorsicht)';
$lang['de'][21] = 'Eigenschaften sortieren';
$lang['de'][22] = 'Selektoren umgruppieren';
@@ -140,7 +140,7 @@
$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!';
$lang['de'][29] = 'Großbuchstaben';
$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML';
-$lang['de'][31] = 'Unnötige Backslashes entfernen';
+$lang['de'][31] = 'Unnötige Backslashes entfernen';
$lang['de'][32] = '!important-Hack konvertieren';
$lang['de'][33] = 'Als Datei ausgeben';
$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen';
@@ -271,7 +271,7 @@
$lang['zh'][25] = '改用小寫選擇符';
$lang['zh'][26] = '屬性的字形:';
$lang['zh'][27] = '小寫';
-$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
+$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
$lang['zh'][29] = '大寫';
$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱';
$lang['zh'][31] = '移除不必要的反斜線';
View
48 testing/unit-tests.inc
@@ -5,31 +5,31 @@
*/
function globr($sDir, $sPattern, $nFlags = NULL) {
- $aFiles = glob("$sDir/$sPattern", $nFlags);
- $files = getDir($sDir);
- if (is_array($files)) {
- foreach( $files as $file ) {
- $aSubFiles = globr($file, $sPattern, $nFlags);
- $aFiles = array_merge($aFiles,$aSubFiles);
- }
- }
- return $aFiles;
+ $aFiles = glob("$sDir/$sPattern", $nFlags);
+ $files = getDir($sDir);
+ if (is_array($files)) {
+ foreach( $files as $file ) {
+ $aSubFiles = globr($file, $sPattern, $nFlags);
+ $aFiles = array_merge($aFiles,$aSubFiles);
+ }
+ }
+ return $aFiles;
}
function getDir($sDir) {
- $i=0;
- $aDirs = array();
- if(is_dir($sDir)) {
- if($rContents = opendir($sDir)) {
- while($sNode = readdir($rContents)) {
- if(is_dir($sDir.'/'.$sNode )) {
- if($sNode !="." && $sNode !="..") {
- $aDirs[$i] = $sDir.'/'.$sNode ;
- $i++;
- }
- }
- }
- }
- }
- return $aDirs;
+ $i=0;
+ $aDirs = array();
+ if(is_dir($sDir)) {
+ if($rContents = opendir($sDir)) {
+ while($sNode = readdir($rContents)) {
+ if(is_dir($sDir.'/'.$sNode )) {
+ if($sNode !="." && $sNode !="..") {
+ $aDirs[$i] = $sDir.'/'.$sNode ;
+ $i++;
+ }
+ }
+ }
+ }
+ }
+ return $aDirs;
}
View
6 testing/unit-tests.php
@@ -34,9 +34,9 @@
// Setup test files
$test = new GroupTest('CSSTidy unit tests');
foreach ($test_files as $test_file) {
- require_once "unit-tests/$test_file";
- list($x, $class_suffix) = explode('.', $test_file);
- $test->addTestClass("csstidy_test_$class_suffix");
+ require_once "unit-tests/$test_file";
+ list($x, $class_suffix) = explode('.', $test_file);
+ $test->addTestClass("csstidy_test_$class_suffix");
}
if (SimpleReporter::inCli()) $reporter = new TextReporter();
View
54 testing/unit-tests/class.Text_Diff_Renderer_parallel.php
@@ -6,31 +6,31 @@
*/
class Text_Diff_Renderer_parallel extends Text_Diff_Renderer
{
- /** String header for left column */
- var $original = 'Original';
- /** String header for right column */
- var $final = 'Final';
- var $_leading_context_lines = 10000; // these are big to ensure entire string is output
- var $_trailing_context_lines = 10000;
- function _blockHeader() {}
- function _startDiff() {
- return '<table class="diff"><thead><tr><th>'. $this->original .'</th><th>'. $this->final .'</th></tr></thead><tbody>';
- }
- function _endDiff() {
- return '</tbody></table>';
- }
- function _context($lines) {
- return '<tr><td><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td>
- <td><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td></tr>';
- }
- function _added($lines) {
- return '<tr><td>&nbsp;</td><td class="added"><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td></tr>';
- }
- function _deleted($lines) {
- return '<tr><td class="deleted"><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td><td>&nbsp;</td></tr>';
- }
- function _changed($orig, $final) {
- return '<tr class="changed"><td><pre>'. htmlspecialchars(implode("\n", $orig)) .'</pre></td>
- <td><pre>'. htmlspecialchars(implode("\n", $final)) .'</pre></td></tr>';
- }
+ /** String header for left column */
+ var $original = 'Original';
+ /** String header for right column */
+ var $final = 'Final';
+ var $_leading_context_lines = 10000; // these are big to ensure entire string is output
+ var $_trailing_context_lines = 10000;
+ function _blockHeader() {}
+ function _startDiff() {
+ return '<table class="diff"><thead><tr><th>'. $this->original .'</th><th>'. $this->final .'</th></tr></thead><tbody>';
+ }
+ function _endDiff() {
+ return '</tbody></table>';
+ }
+ function _context($lines) {
+ return '<tr><td><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td>
+ <td><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td></tr>';
+ }
+ function _added($lines) {
+ return '<tr><td>&nbsp;</td><td class="added"><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td></tr>';
+ }
+ function _deleted($lines) {
+ return '<tr><td class="deleted"><pre>'. htmlspecialchars(implode("\n", $lines)) .'</pre></td><td>&nbsp;</td></tr>';
+ }
+ function _changed($orig, $final) {
+ return '<tr class="changed"><td><pre>'. htmlspecialchars(implode("\n", $orig)) .'</pre></td>
+ <td><pre>'. htmlspecialchars(implode("\n", $final)) .'</pre></td></tr>';
+ }
}
View
200 testing/unit-tests/class.csstidy_csst.php
@@ -7,75 +7,75 @@
*/
class csstidy_csst extends SimpleExpectation
{
- /** Filename of test */
- var $filename;
-
- /** Test name */
- var $test;
-
- /** CSS for test to parse */
- var $css = '';
-
- /** Settings for csstidy */
- var $settings = array();
-
- /** Expected var_export() output of $css->css[41] (no at block) */
- var $expect = '';
-
- /** Boolean whether or not to use $css->css instead for $expect */
- var $fullexpect = false;
+ /** Filename of test */
+ var $filename;
+
+ /** Test name */
+ var $test;
+
+ /** CSS for test to parse */
+ var $css = '';
+
+ /** Settings for csstidy */
+ var $settings = array();
+
+ /** Expected var_export() output of $css->css[41] (no at block) */
+ var $expect = '';
+
+ /** Boolean whether or not to use $css->css instead for $expect */
+ var $fullexpect = false;
/** Print form of CSS that can be tested **/
- var $print = false;
+ var $print = false;
var $default_media = "";
- /** Actual result */
- var $actual;
-
- /**
- * Loads this class from a file.
- * @param $filename String filename to load
- */
- function load($filename) {
- $this->filename = $filename;
- $fh = fopen($filename, 'r');
- $state = '';
- while (($line = fgets($fh)) !== false) {
- $line = rtrim($line, "\n\r"); // normalize newlines
- if (substr($line, 0, 2) == '--') {
- // detected section
- $state = $line;
- continue;
- }
- if ($state === null) continue;
- switch ($state) {
- case '--TEST--':
- $this->test = trim($line);
- break;
- case '--CSS--':
- $this->css .= $line . "\n";
- break;
- case '--FULLEXPECT--':
- $this->fullexpect = true;
- $this->expect .= $line . "\n";
- break;
- case '--EXPECT--':
- $this->expect .= $line . "\n";
- break;
- case '--SETTINGS--':
- list($n, $v) = array_map('trim',explode('=', $line, 2));
- $v = eval("return $v;");
- if ($n=="default_media" AND $this->print)
- $this->default_media = $v;
- else
- $this->settings[$n] = $v;
- break;
- case '--PRINT--':
- $this->print = true;
- $this->expect .= $line . "\n";
- break;
- }
- }
+ /** Actual result */
+ var $actual;
+
+ /**
+ * Loads this class from a file.
+ * @param $filename String filename to load
+ */
+ function load($filename) {
+ $this->filename = $filename;
+ $fh = fopen($filename, 'r');
+ $state = '';
+ while (($line = fgets($fh)) !== false) {
+ $line = rtrim($line, "\n\r"); // normalize newlines
+ if (substr($line, 0, 2) == '--') {
+ // detected section
+ $state = $line;
+ continue;
+ }
+ if ($state === null) continue;
+ switch ($state) {
+ case '--TEST--':
+ $this->test = trim($line);
+ break;
+ case '--CSS--':
+ $this->css .= $line . "\n";
+ break;
+ case '--FULLEXPECT--':
+ $this->fullexpect = true;
+ $this->expect .= $line . "\n";
+ break;
+ case '--EXPECT--':
+ $this->expect .= $line . "\n";
+ break;
+ case '--SETTINGS--':
+ list($n, $v) = array_map('trim',explode('=', $line, 2));
+ $v = eval("return $v;");
+ if ($n=="default_media" AND $this->print)
+ $this->default_media = $v;
+ else
+ $this->settings[$n] = $v;
+ break;
+ case '--PRINT--':
+ $this->print = true;
+ $this->expect .= $line . "\n";
+ break;
+ }
+ }
if ($this->print) {
$this->expect = trim($this->expect);
}
@@ -85,51 +85,51 @@ function load($filename) {
if (!$this->fullexpect)
$this->expect = array(41=>$this->expect);
}
- fclose($fh);
- }
-
- /**
- * Implements SimpleExpectation::test().
- * @param $filename Filename of test file to test.
- */
- function test($filename = false) {
- if ($filename) $this->load($filename);
- $css = new csstidy();
- $css->set_cfg($this->settings);
- $css->parse($this->css);
+ fclose($fh);
+ }
+
+ /**
+ * Implements SimpleExpectation::test().
+ * @param $filename Filename of test file to test.
+ */
+ function test($filename = false) {
+ if ($filename) $this->load($filename);
+ $css = new csstidy();
+ $css->set_cfg($this->settings);
+ $css->parse($this->css);
if ($this->print){
$this->actual = $css->print->plain($this->default_media);
}
else{
$this->actual = $css->css;
}
- return $this->expect === $this->actual;
- }
-
- /**
- * Implements SimpleExpectation::testMessage().
- */
- function testMessage() {
- $message = $this->test . ' test at '. htmlspecialchars($this->filename);
- return $message;
- }
-
- /**
- * Renders the test with an HTML diff table.
- */
- function render() {
- $message = '<pre>'. htmlspecialchars($this->css) .'</pre>';
- $diff = new Text_Diff(
+ return $this->expect === $this->actual;
+ }
+
+ /**
+ * Implements SimpleExpectation::testMessage().
+ */
+ function testMessage() {
+ $message = $this->test . ' test at '. htmlspecialchars($this->filename);
+ return $message;
+ }
+
+ /**
+ * Renders the test with an HTML diff table.
+ */
+ function render() {
+ $message = '<pre>'. htmlspecialchars($this->css) .'</pre>';
+ $diff = new Text_Diff(
'auto',
array(
explode("\n", $this->print?$this->expect:var_export($this->expect,true)),
explode("\n", $this->print?$this->actual:var_export($this->actual,true))
)
);
- $renderer = new Text_Diff_Renderer_parallel();
- $renderer->original = 'Expected';
- $renderer->final = 'Actual';
- $message .= $renderer->render($diff);
- return $message;
- }
+ $renderer = new Text_Diff_Renderer_parallel();
+ $renderer->original = 'Expected';
+ $renderer->final = 'Actual';
+ $message .= $renderer->render($diff);
+ return $message;
+ }
}
View
26 testing/unit-tests/class.csstidy_harness.php
@@ -5,17 +5,17 @@
*/
class csstidy_harness extends UnitTestCase
{
- /**
- * Modified testing algorithm that allows a single test method to be
- * prefixed with __only in order to make it the only one run.
- */
- function getTests() {
- // __onlytest makes only one test get triggered
- foreach (get_class_methods(get_class($this)) as $method) {
- if (strtolower(substr($method, 0, 10)) == '__onlytest') {
- return array($method);
- }
- }
- return parent::getTests();
- }
+ /**
+ * Modified testing algorithm that allows a single test method to be
+ * prefixed with __only in order to make it the only one run.
+ */
+ function getTests() {
+ // __onlytest makes only one test get triggered
+ foreach (get_class_methods(get_class($this)) as $method) {
+ if (strtolower(substr($method, 0, 10)) == '__onlytest') {
+ return array($method);
+ }
+ }
+ return parent::getTests();
+ }
}
View
16 testing/unit-tests/class.csstidy_reporter.php
@@ -6,16 +6,16 @@
*/
class csstidy_reporter extends HTMLReporter
{
-
- function _getCss() {
- $css = parent::_getCss();
- $css .= '
+
+ function _getCss() {
+ $css = parent::_getCss();
+ $css .= '
.diff {margin-bottom: 1em;}
.diff th {width:50%;}
.diff pre {margin:0; padding:0; background:none;}
.diff .changed, .diff .deleted, .diff .added {background: #FF5;}
- ';
- return $css;
- }
-
+ ';
+ return $css;
+ }
+
}
View
22 testing/unit-tests/test.csst.php
@@ -7,15 +7,15 @@
*/
class csstidy_test_csst extends csstidy_harness
{
- function testAll() {
- $files = globr(dirname(__FILE__) . '/csst', '*.csst');
- foreach ($files as $filename) {
- $expectation = new csstidy_csst();
- $result = $this->assert($expectation, $filename, '%s');
- // this is necessary because SimpleTest doesn't support
- // HTML messages; this probably should be in the reporter.
- // This is *not* compatible with XmlReporter
- if (!$result) echo $expectation->render();
- }
- }
+ function testAll() {
+ $files = globr(dirname(__FILE__) . '/csst', '*.csst');
+ foreach ($files as $filename) {
+ $expectation = new csstidy_csst();
+ $result = $this->assert($expectation, $filename, '%s');
+ // this is necessary because SimpleTest doesn't support
+ // HTML messages; this probably should be in the reporter.
+ // This is *not* compatible with XmlReporter
+ if (!$result) echo $expectation->render();
+ }
+ }
}

0 comments on commit 2045ca4

Please sign in to comment.
Something went wrong with that request. Please try again.