From d63ed916fc1fb91adbf158e61297376b0f98477c Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 30 Dec 2009 13:46:17 +0000 Subject: [PATCH] code cleanup --- libraries/export/htmlword.php | 30 +++++++++++++++--------------- libraries/export/mediawiki.php | 2 +- libraries/export/php_array.php | 32 ++++++++++++++++---------------- libraries/export/texytext.php | 18 +++++++++--------- libraries/export/yaml.php | 2 +- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index e1efdd4ec6..0d895fa2a6 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -68,7 +68,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> - + '); } @@ -129,10 +129,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { global $what; - if (!PMA_exportOutputHandler('

' . $GLOBALS['strDumpingData'] . ' ' . $table . '

')) { + if (! PMA_exportOutputHandler('

' . $GLOBALS['strDumpingData'] . ' ' . $table . '

')) { return FALSE; } - if (!PMA_exportOutputHandler('')) { + if (! PMA_exportOutputHandler('
')) { return FALSE; } @@ -147,7 +147,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $schema_insert .= ''; } // end for $schema_insert .= ''; - if (!PMA_exportOutputHandler($schema_insert)) { + if (! PMA_exportOutputHandler($schema_insert)) { return FALSE; } } // end if @@ -156,7 +156,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) while ($row = PMA_DBI_fetch_row($result)) { $schema_insert = ''; for ($j = 0; $j < $fields_cnt; $j++) { - if (!isset($row[$j]) || is_null($row[$j])) { + if (! isset($row[$j]) || is_null($row[$j])) { $value = $GLOBALS[$what . '_null']; } elseif ($row[$j] == '0' || $row[$j] != '') { $value = $row[$j]; @@ -166,12 +166,12 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $schema_insert .= ''; } // end for $schema_insert .= ''; - if (!PMA_exportOutputHandler($schema_insert)) { + if (! PMA_exportOutputHandler($schema_insert)) { return FALSE; } } // end while PMA_DBI_free_result($result); - if (!PMA_exportOutputHandler('
' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))) . '
')) { + if (! PMA_exportOutputHandler('')) { return FALSE; } @@ -182,7 +182,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals { global $cfgRelation; - if (!PMA_exportOutputHandler('

' . $GLOBALS['strTableStructure'] . ' ' .$table . '

')) { + if (! PMA_exportOutputHandler('

' . $GLOBALS['strTableStructure'] . ' ' .$table . '

')) { return FALSE; } @@ -208,7 +208,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $fields_cnt = PMA_DBI_num_rows($result); // Check if we can use Relations (Mike Beck) - if ($do_relation && !empty($cfgRelation['relation'])) { + if ($do_relation && ! empty($cfgRelation['relation'])) { // Find which tables are related with the current one and write it in // an array $res_rel = PMA_getForeigners($db, $table); @@ -225,7 +225,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals /** * Displays the table structure */ - if (!PMA_exportOutputHandler('')) { + if (! PMA_exportOutputHandler('
')) { return FALSE; } @@ -258,14 +258,14 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals } $schema_insert .= ''; - if (!PMA_exportOutputHandler($schema_insert)) { + if (! PMA_exportOutputHandler($schema_insert)) { return FALSE; } while ($row = PMA_DBI_fetch_assoc($result)) { $schema_insert = ''; - $type = $row['Type']; + $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) { @@ -299,7 +299,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals if ($zerofill) { $strAttribute = 'UNSIGNED ZEROFILL'; } - if (!isset($row['Default'])) { + if (! isset($row['Default'])) { if ($row['Null'] != 'NO') { $row['Default'] = 'NULL'; } @@ -313,7 +313,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $fmt_pre = '' . $fmt_pre; $fmt_post = $fmt_post . ''; } - if ($row['Key']=='PRI') { + if ($row['Key'] == 'PRI') { $fmt_pre = '' . $fmt_pre; $fmt_post = $fmt_post . ''; } @@ -336,7 +336,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $schema_insert .= ''; - if (!PMA_exportOutputHandler($schema_insert)) { + if (! PMA_exportOutputHandler($schema_insert)) { return FALSE; } } // end while diff --git a/libraries/export/mediawiki.php b/libraries/export/mediawiki.php index 4638aca1ce..d1369cbe20 100755 --- a/libraries/export/mediawiki.php +++ b/libraries/export/mediawiki.php @@ -111,7 +111,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { global $mediawiki_export_struct; global $mediawiki_export_data; - $result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `".$db."`.`".$table."`"); + $result = PMA_DBI_fetch_result("SHOW COLUMNS FROM `" . $db . "`.`" . $table . "`"); $row_cnt = count($result); $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n"; diff --git a/libraries/export/php_array.php b/libraries/export/php_array.php index 32498d5dda..17d5f4c286 100644 --- a/libraries/export/php_array.php +++ b/libraries/export/php_array.php @@ -66,12 +66,12 @@ function PMA_exportFooter() function PMA_exportHeader() { PMA_exportOutputHandler( - '= $columns_cnt); + $isLastLine = ($i + 1 >= $columns_cnt); $column = $columns[$i]; if (is_null($record[$i])) { - $buffer .= "'".$column."'=>null".(!$isLastLine?',':''); + $buffer .= "'" . $column . "'=>null" . (! $isLastLine ? ',' : ''); } elseif (is_numeric($record[$i])) { - $buffer .= "'".$column."'=>".$record[$i] . (!$isLastLine?',':''); + $buffer .= "'" . $column . "'=>" . $record[$i] . (! $isLastLine ? ',' : ''); } else { - $buffer .= "'".$column."'=>'".addslashes($record[$i]) . "'" . (!$isLastLine?',':''); + $buffer .= "'" . $column . "'=>'" . addslashes($record[$i]) . "'" . (! $isLastLine ? ',' : ''); } } $buffer .= ')'; } - $buffer .= $crlf.');'.$crlf; - if (!PMA_exportOutputHandler($buffer)) { + $buffer .= $crlf . ');' . $crlf; + if (! PMA_exportOutputHandler($buffer)) { return FALSE; } diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php index e3d98a7317..ddb7668329 100644 --- a/libraries/export/texytext.php +++ b/libraries/export/texytext.php @@ -127,7 +127,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { global $what; - if (!PMA_exportOutputHandler('== ' . $GLOBALS['strDumpingData'] . ' ' . $table . "\n\n")) { + if (! PMA_exportOutputHandler('== ' . $GLOBALS['strDumpingData'] . ' ' . $table . "\n\n")) { return FALSE; } @@ -142,7 +142,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $text_output .= '|' . htmlspecialchars(stripslashes(PMA_DBI_field_name($result, $i))); } // end for $text_output .= "\n|------\n"; - if (!PMA_exportOutputHandler($text_output)) { + if (! PMA_exportOutputHandler($text_output)) { return FALSE; } } // end if @@ -151,7 +151,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) while ($row = PMA_DBI_fetch_row($result)) { $text_output = ''; for ($j = 0; $j < $fields_cnt; $j++) { - if (!isset($row[$j]) || is_null($row[$j])) { + if (! isset($row[$j]) || is_null($row[$j])) { $value = $GLOBALS[$what . '_null']; } elseif ($row[$j] == '0' || $row[$j] != '') { $value = $row[$j]; @@ -161,7 +161,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $text_output .= '|' . htmlspecialchars($value); } // end for $text_output .= "\n"; - if (!PMA_exportOutputHandler($text_output)) { + if (! PMA_exportOutputHandler($text_output)) { return FALSE; } } // end while @@ -174,7 +174,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals { global $cfgRelation; - if (!PMA_exportOutputHandler('== ' . $GLOBALS['strTableStructure'] . ' ' .$table . "\n\n")) { + if (! PMA_exportOutputHandler('== ' . $GLOBALS['strTableStructure'] . ' ' .$table . "\n\n")) { return FALSE; } @@ -200,7 +200,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $fields_cnt = PMA_DBI_num_rows($result); // Check if we can use Relations (Mike Beck) - if ($do_relation && !empty($cfgRelation['relation'])) { + if ($do_relation && ! empty($cfgRelation['relation'])) { // Find which tables are related with the current one and write it in // an array $res_rel = PMA_getForeigners($db, $table); @@ -247,7 +247,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals } $text_output .= "\n|------\n"; - if (!PMA_exportOutputHandler($text_output)) { + if (! PMA_exportOutputHandler($text_output)) { return FALSE; } @@ -288,7 +288,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals if ($zerofill) { $strAttribute = 'UNSIGNED ZEROFILL'; } - if (!isset($row['Default'])) { + if (! isset($row['Default'])) { if ($row['Null'] != 'NO') { $row['Default'] = 'NULL'; } @@ -325,7 +325,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $text_output .= "\n"; - if (!PMA_exportOutputHandler($text_output)) { + if (! PMA_exportOutputHandler($text_output)) { return FALSE; } } // end while diff --git a/libraries/export/yaml.php b/libraries/export/yaml.php index cea6a38377..d1ba38e810 100644 --- a/libraries/export/yaml.php +++ b/libraries/export/yaml.php @@ -174,7 +174,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $buffer .= ' ' . $column . ': ' . $record[$i] . $crlf; } - if (!PMA_exportOutputHandler($buffer)) { + if (! PMA_exportOutputHandler($buffer)) { return FALSE; } } -- 2.11.4.GIT