Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more conventions corrections

  • Loading branch information...
commit 5bd2889ab3482ea686da1b6c41a5f47f3e8c051c 1 parent 1b92d14
@dereuromark dereuromark authored
View
15 class.csstidy.php
@@ -711,8 +711,7 @@ function parse($string) {
OR ($this->property=='/' OR $string{$i}=="/")) {
$this->property .= $string{$i};
}
- }
- elseif (!ctype_space($string{$i})) {
+ } elseif (!ctype_space($string{$i})) {
$this->property .= $string{$i};
}
break;
@@ -901,8 +900,7 @@ function parse($string) {
} elseif ($this->status === 'instr') {
$this->cur_string[count($this->cur_string)-1] .= $_cur_string;
}
- }
- else {
+ } else {
$this->cur_string[count($this->cur_string)-1] = $_cur_string;
}
break;
@@ -944,8 +942,7 @@ function quote_font_format($value) {
$format_strings = csstidy::parse_string_list(substr($value, 7, $p-7));
if (!$format_strings) {
$value = "";
- }
- else {
+ } else {
$value = "format(";
foreach ($format_strings as $format_string) {
@@ -1241,12 +1238,10 @@ function parse_string_list($value) {
} elseif (!$in_str) {
$in_str = $value{$i};
}
- }
- else {
+ } else {
if ($in_str) {
$current_string .= $value{$i};
- }
- else {
+ } else {
if (!preg_match("/[\s,]/", $value{$i})) {
$in_str = true;
$current_string = $value{$i};
View
3  class.csstidy_optimise.php
@@ -695,8 +695,7 @@ function dissolve_short_bg($str_value) {
$return['background-position'] .= ' '; else
$return['background-position'].= ',';
$have['pos'] = true;
- }
- elseif (!$have['color']) {
+ } elseif (!$have['color']) {
$return['background-color'] .= $str_value[$i][$j] . ',';
$have['color'] = true;
}
View
6 class.csstidy_print.php
@@ -311,8 +311,7 @@ function _convert_raw_css($default_media='') {
if (strlen(trim($medium))) {
$this->parser->_add_token(AT_START, $medium, true);
}
- }
- elseif ($default_media) {
+ } elseif ($default_media) {
$this->parser->_add_token(AT_START, $default_media, true);
}
@@ -352,8 +351,7 @@ function _convert_raw_css($default_media='') {
if (strlen(trim($medium))) {
$this->parser->_add_token(AT_END, $medium, true);
}
- }
- elseif ($default_media) {
+ } elseif ($default_media) {
$this->parser->_add_token(AT_END, $default_media, true);
}
}
View
73 css_optimiser.php
@@ -67,8 +67,7 @@ function rmdirr($dirname,$oc=0)
$dir->close();
}
// Clean up
- if ($oc==1)
- {
+ if ($oc==1) {
return rmdir($dirname);
}
}
@@ -80,8 +79,7 @@ function options($options, $selected = null, $labelIsValue = false)
settype($selected, 'array');
settype($options, 'array');
- foreach ($options as $value=>$label)
- {
+ foreach ($options as $value=>$label) {
if (is_array($label)) {
$value = $label[0];
$label = $label[1];
@@ -134,23 +132,18 @@ function options($options, $selected = null, $labelIsValue = false)
// genuine XHTML DOM (when XHTML served as such) as lower
if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
$http_accept = 'application/xhtml+xml';
-}
-elseif (stristr($_SERVER['HTTP_ACCEPT'], 'application/xml')) {
+} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'application/xml')) {
$http_accept = 'application/xml';
-}
-elseif (stristr($_SERVER['HTTP_ACCEPT'], 'text/xml')) {
+} elseif (stristr($_SERVER['HTTP_ACCEPT'], 'text/xml')) {
$http_accept = 'text/xml';
-}
-elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Opera ') || stristr($_SERVER['HTTP_USER_AGENT'], 'Opera/')) {
+} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Opera ') || stristr($_SERVER['HTTP_USER_AGENT'], 'Opera/')) {
preg_match('@Opera/(\d)@', $_SERVER['HTTP_USER_AGENT'], $matches);
if (isset($matches[1]) && $matches[1] >= 7) {
$http_accept = 'application/xhtml+xml';
- }
- else {
+ } else {
$http_accept = 'text/html';
}
-}
-else {
+} else {
$http_accept = 'text/html';
}
@@ -161,8 +154,7 @@ function options($options, $selected = null, $labelIsValue = false)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
-}
-else {
+} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<?php
@@ -176,8 +168,7 @@ function options($options, $selected = null, $labelIsValue = false)
</title>
<link rel="stylesheet" href="cssparse.css" type="text/css" />
<script type="text/javascript"><!--/*--><![CDATA[/*><!--*/
- function enable_disable_preserve()
- {
+ 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++) {
@@ -188,8 +179,7 @@ function enable_disable_preserve()
}
}
}
- function ClipBoard()
- {
+ function ClipBoard() {
if (window.clipboardData) { // Feature testing
window.clipboardData.setData('Text',document.getElementById("copytext").innerText);
} else if (navigator.userAgent.indexOf('Gecko') != -1
@@ -352,13 +342,10 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
$url = (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) ? $_REQUEST['url'] : false;
- if (isset($_REQUEST['template']))
- {
- switch ($_REQUEST['template'])
- {
+ if (isset($_REQUEST['template'])) {
+ switch ($_REQUEST['template']) {
case 4:
- if ($is_custom)
- {
+ if ($is_custom) {
$css->load_template($_REQUEST['custom'],false);
}
break;
@@ -377,25 +364,19 @@ 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)
- {
+ } elseif (isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5) {
$result = $css->parse($_REQUEST['css_text']);
}
- if ($result)
- {
+ if ($result) {
$ratio = $css->print->get_ratio();
$diff = $css->print->get_diff();
- if (isset($_REQUEST['file_output']))
- {
+ if (isset($_REQUEST['file_output'])) {
$filename = md5(mt_rand().time().mt_rand());
if (!is_dir('temp')) {
$madedir = mkdir('temp');
@@ -406,8 +387,7 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
}
$handle = fopen('temp/'.$filename.'.css','w');
if ($handle) {
- if (fwrite($handle,$css->print->plain()))
- {
+ if (fwrite($handle,$css->print->plain())) {
$file_ok = true;
}
}
@@ -419,12 +399,10 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
if (count($css->log) > 0): ?>
<fieldset id="messages"><legend>Messages</legend>
<div><dl><?php
- foreach ($css->log as $line => $array)
- {
+ foreach ($css->log as $line => $array) {
echo '<dt>',$line,'</dt>';
$array_size = count($array);
- for ($i = 0; $i < $array_size; ++$i)
- {
+ for ($i = 0; $i < $array_size; ++$i) {
echo '<dd class="',$array[$i]['t'],'">',$array[$i]['m'],'</dd>';
}
}
@@ -432,8 +410,7 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
</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)
- {
+ if ($file_ok) {
echo ' - <a href="temp/',$filename,'.css">Download</a>';
}
echo ' - <a href="javascript:ClipBoard()">',$lang[$l][58],'</a>';
@@ -447,8 +424,7 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
if (isset($_REQUEST['whole_file'])) {
echo htmlspecialchars($css->print->formatted_page('xhtml1.1', false, '', 'en'), ENT_QUOTES, 'utf-8');
- }
- else {
+ } else {
echo htmlspecialchars('<code id="copytext">', ENT_QUOTES, 'utf-8'),"\n";
echo htmlspecialchars($css->print->formatted()."\n".'</code>', ENT_QUOTES, 'utf-8');
}
@@ -461,8 +437,7 @@ class="block"><?php echo $lang[$l][12]; ?></label> <select
echo '</fieldset><p><a href="javascript:scrollTo(0,0)">&#8593; ',$lang[$l][59],'</a></p>';
- }
- elseif(isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
+ } elseif (isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
echo '<p class="important">',$lang[$l][28],'</p>';
}
?>
View
6 testing/unit-tests/class.csstidy_csst.php
@@ -78,8 +78,7 @@ function load($filename) {
}
if ($this->print) {
$this->expect = trim($this->expect);
- }
- else {
+ } else {
if ($this->expect)
$this->expect = eval("return ".$this->expect.";");
if (!$this->fullexpect)
@@ -99,8 +98,7 @@ function test($filename = false) {
$css->parse($this->css);
if ($this->print) {
$this->actual = $css->print->plain($this->default_media);
- }
- else{
+ } else {
$this->actual = $css->css;
}
return $this->expect === $this->actual;
Please sign in to comment.
Something went wrong with that request. Please try again.