Skip to content

Commit

Permalink
Coding style improvements - Multiline assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
madhuracj committed Dec 7, 2011
1 parent a7c00f7 commit 35b18e5
Show file tree
Hide file tree
Showing 22 changed files with 166 additions and 156 deletions.
17 changes: 9 additions & 8 deletions browse_foreigners.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,22 +223,23 @@ function formupdate(fieldmd5, key) {
$val_ordered_current_val = htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title = '';
} else {
$val_ordered_current_val_title =
htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val_title
= htmlspecialchars($val_ordered_current_val);
$val_ordered_current_val = htmlspecialchars(
PMA_substr($val_ordered_current_val, 0, $cfg['LimitChars'])
. '...'
);
);
}
if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val_title = '';
} else {
$key_ordered_current_val_title =
htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val =
htmlspecialchars(PMA_substr($key_ordered_current_val, 0,
$cfg['LimitChars']) . '...');
$key_ordered_current_val_title
= htmlspecialchars($key_ordered_current_val);
$key_ordered_current_val
= htmlspecialchars(
PMA_substr($key_ordered_current_val, 0, $cfg['LimitChars']) . '...'
);
}

if (! empty($data)) {
Expand Down
4 changes: 2 additions & 2 deletions db_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ function PMA_getSearchSqls($table, $field, $search_str, $search_option)
} // end while

echo ' </select>' . "\n";
$alter_select =
'<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
$alter_select
= '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('selectall' => 1))) . '#db_search"'
. ' onclick="setSelectOptions(\'db_search\', \'table_select[]\', true); return false;">' . __('Select All') . '</a>'
. '&nbsp;/&nbsp;'
. '<a href="db_search.php' . PMA_generate_common_url(array_merge($url_params, array('unselectall' => 1))) . '#db_search"'
Expand Down
4 changes: 2 additions & 2 deletions db_structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@
// Show Summary
if ($is_show_stats) {
list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
list($overhead_formatted, $overhead_unit) =
PMA_formatByteDown($overhead_size, 3, 1);
list($overhead_formatted, $overhead_unit)
= PMA_formatByteDown($overhead_size, 3, 1);
}
?>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions libraries/Config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,8 @@ function checkPmaAbsoluteUri()
if (substr($pma_absolute_uri, 0, 7) != 'http://'
&& substr($pma_absolute_uri, 0, 8) != 'https://'
) {
$pma_absolute_uri =
($is_https ? 'https' : 'http')
$pma_absolute_uri
= ($is_https ? 'https' : 'http')
. ':' . (substr($pma_absolute_uri, 0, 2) == '//' ? '' : '//')
. $pma_absolute_uri;
}
Expand Down
16 changes: 8 additions & 8 deletions libraries/RecentTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public static function getInstance()
public function getFromDb()
{
// Read from phpMyAdmin database, if recent tables is not in session
$sql_query =
" SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";
$sql_query
= " SELECT `tables` FROM " . $this->pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'";

$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
if (isset($row[0])) {
Expand All @@ -91,15 +91,15 @@ public function getFromDb()
/**
* Save recent tables into phpMyAdmin database.
*
*
*
* @return true|PMA_Message
*/
public function saveToDb()
{
$username = $GLOBALS['cfg']['Server']['user'];
$sql_query =
" REPLACE INTO " . $this->pma_table . " (`username`, `tables`)" .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes(json_encode($this->tables)) . "')";
$sql_query
= " REPLACE INTO " . $this->pma_table . " (`username`, `tables`)" .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes(json_encode($this->tables)) . "')";

$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);

Expand Down Expand Up @@ -163,7 +163,7 @@ public function getHtmlSelect()
$html .= '<select name="selected_recent_table" id="recentTable">';
$html .= $this->getHtmlSelectOption();
$html .= '</select>';

return $html;
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/StorageEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ function __construct($engine)
if (!empty($storage_engines[$engine])) {
$this->engine = $engine;
$this->title = $storage_engines[$engine]['Engine'];
$this->comment =
(isset($storage_engines[$engine]['Comment'])
$this->comment
= (isset($storage_engines[$engine]['Comment'])
? $storage_engines[$engine]['Comment']
: '');
switch ($storage_engines[$engine]['Support']) {
Expand Down
4 changes: 2 additions & 2 deletions libraries/Table.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,8 @@ protected function saveUiPrefsToDb()
$max_rows = $GLOBALS['cfg']['Server']['MaxTableUiprefs'];
if ($rows_count > $max_rows) {
$num_rows_to_delete = $rows_count - $max_rows;
$sql_query =
' DELETE FROM ' . $pma_table .
$sql_query
= ' DELETE FROM ' . $pma_table .
' ORDER BY last_update ASC' .
' LIMIT ' . $num_rows_to_delete;
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
Expand Down
18 changes: 12 additions & 6 deletions libraries/database_interface.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,12 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$columns[$column_name]['TABLE_SCHEMA'] = $database;
$columns[$column_name]['TABLE_NAME'] = $table;
$columns[$column_name]['ORDINAL_POSITION'] = $ordinal_position;
$columns[$column_name]['DATA_TYPE'] =
substr($columns[$column_name]['COLUMN_TYPE'], 0,
strpos($columns[$column_name]['COLUMN_TYPE'], '('));
$columns[$column_name]['DATA_TYPE']
= substr(
$columns[$column_name]['COLUMN_TYPE'],
0,
strpos($columns[$column_name]['COLUMN_TYPE'], '(')
);
/**
* @todo guess CHARACTER_MAXIMUM_LENGTH from COLUMN_TYPE
*/
Expand All @@ -955,9 +958,12 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
$columns[$column_name]['CHARACTER_OCTET_LENGTH'] = null;
$columns[$column_name]['NUMERIC_PRECISION'] = null;
$columns[$column_name]['NUMERIC_SCALE'] = null;
$columns[$column_name]['CHARACTER_SET_NAME'] =
substr($columns[$column_name]['COLLATION_NAME'], 0,
strpos($columns[$column_name]['COLLATION_NAME'], '_'));
$columns[$column_name]['CHARACTER_SET_NAME']
= substr(
$columns[$column_name]['COLLATION_NAME'],
0,
strpos($columns[$column_name]['COLLATION_NAME'], '_')
);

$ordinal_position++;
}
Expand Down
68 changes: 34 additions & 34 deletions libraries/export/latex.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,50 +36,50 @@
);

/* what to dump (structure/data/both) */
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'dump_what', 'text' => __('Dump table'));
$plugin_list['latex']['options'][] =
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'dump_what', 'text' => __('Dump table'));
$plugin_list['latex']['options'][]
= array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['latex']['options'][] = array('type' => 'end_group');

/* Structure options */
if (!$hide_structure) {
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'structure_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'structure_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
}
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
}
$plugin_list['latex']['options'][] =
array('type' => 'end_group');
$plugin_list['latex']['options'][]
= array('type' => 'end_group');
}
/* Data */
$plugin_list['latex']['options'][] =
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['latex']['options'][] =
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'data_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][] =
array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['latex']['options'][] =
array('type' => 'end_group');
$plugin_list['latex']['options'][]
= array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['latex']['options'][]
= array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_caption', 'text' => __('Table caption'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_continued_caption', 'text' => __('Table caption (continued)'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'data_label', 'text' => __('Label key'), 'doc' => 'faq6_27');
$plugin_list['latex']['options'][]
= array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['latex']['options'][]
= array('type' => 'end_group');
} else {

/**
Expand Down
44 changes: 22 additions & 22 deletions libraries/export/odt.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,38 @@
);

/* what to dump (structure/data/both) */
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'text' => __('Dump table') , 'name' => 'general_opts');
$plugin_list['odt']['options'][] =
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'text' => __('Dump table') , 'name' => 'general_opts');
$plugin_list['odt']['options'][]
= array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
$plugin_list['odt']['options'][] = array('type' => 'end_group');

/* Structure options */
if (!$hide_structure) {
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
if (!empty($GLOBALS['cfgRelation']['relation'])) {
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
}
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'comments', 'text' => __('Display comments'));
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
}
$plugin_list['odt']['options'][] =
array('type' => 'end_group');
$plugin_list['odt']['options'][]
= array('type' => 'end_group');
}
/* Data */
$plugin_list['odt']['options'][] =
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['odt']['options'][] =
array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['odt']['options'][] =
array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['odt']['options'][] =
array('type' => 'end_group');
$plugin_list['odt']['options'][]
= array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
$plugin_list['odt']['options'][]
= array('type' => 'bool', 'name' => 'columns', 'text' => __('Put columns names in the first row'));
$plugin_list['odt']['options'][]
= array('type' => 'text', 'name' => 'null', 'text' => __('Replace NULL with:'));
$plugin_list['odt']['options'][]
= array('type' => 'end_group');
} else {

$GLOBALS['odt_buffer'] = '';
Expand Down
4 changes: 2 additions & 2 deletions libraries/gis/pma_gis_visualization.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public function asOl()
{
$this->init();
$scale_data = $this->_scaleDataSet($this->_data);
$output =
'var options = {'
$output
= 'var options = {'
. 'projection: new OpenLayers.Projection("EPSG:900913"),'
. 'displayProjection: new OpenLayers.Projection("EPSG:4326"),'
. 'units: "m",'
Expand Down
8 changes: 4 additions & 4 deletions libraries/import/csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
);

if ($plugin_param !== 'table') {
$plugin_list['csv']['options'][] =
array('type' => 'bool', 'name' => 'col_names', 'text' => __('The first line of the file contains the table column names <i>(if this is unchecked, the first line will become part of the data)</i>'));
$plugin_list['csv']['options'][]
= array('type' => 'bool', 'name' => 'col_names', 'text' => __('The first line of the file contains the table column names <i>(if this is unchecked, the first line will become part of the data)</i>'));
} else {
$hint = new PMA_Message(__('If the data in each row of the file is not in the same order as in the database, list the corresponding column names here. Column names must be separated by commas and not enclosed in quotations.'));
$plugin_list['csv']['options'][] =
array('type' => 'text', 'name' => 'columns', 'text' => __('Column names: ') . PMA_showHint($hint));
$plugin_list['csv']['options'][]
= array('type' => 'text', 'name' => 'columns', 'text' => __('Column names: ') . PMA_showHint($hint));
}
$plugin_list['csv']['options'][] = array('type' => 'end_group');

Expand Down
8 changes: 4 additions & 4 deletions libraries/mysql_charsets.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
}
//$mysql_collations_available[$row['Collation']] = ! isset($row['Compiled']) || $row['Compiled'] == 'Yes';
$mysql_collations_available[$row['COLLATION_NAME']] = true;
$mysql_charsets_available[$row['CHARACTER_SET_NAME']] =
!empty($mysql_charsets_available[$row['CHARACTER_SET_NAME']])
$mysql_charsets_available[$row['CHARACTER_SET_NAME']]
= !empty($mysql_charsets_available[$row['CHARACTER_SET_NAME']])
|| !empty($mysql_collations_available[$row['COLLATION_NAME']]);
}
PMA_DBI_free_result($res);
Expand Down Expand Up @@ -118,8 +118,8 @@ function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION,
if (!$mysql_charsets_available[$current_charset]) {
continue;
}
$current_cs_descr =
empty($mysql_charsets_descriptions[$current_charset])
$current_cs_descr
= empty($mysql_charsets_descriptions[$current_charset])
? $current_charset
: $mysql_charsets_descriptions[$current_charset];

Expand Down
12 changes: 6 additions & 6 deletions libraries/pmd_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

$cfgRelation = PMA_getRelationsParam();

$GLOBALS['script_display_field'] =
'<script type="text/javascript">' . "\n" .
$GLOBALS['script_display_field']
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var display_field = new Array();' . "\n";

Expand Down Expand Up @@ -129,8 +129,8 @@ function get_script_contr()
}

$ti = 0;
$script_contr =
'<script type="text/javascript">' . "\n" .
$script_contr
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var contr = new Array();' . "\n";
for ($i = 0, $cnt = count($con["C_NAME"]); $i < $cnt; $i++) {
Expand Down Expand Up @@ -199,8 +199,8 @@ function get_all_keys($unique_only = false)
*/
function get_script_tabs()
{
$script_tabs =
'<script type="text/javascript">' . "\n" .
$script_tabs
= '<script type="text/javascript">' . "\n" .
'// <![CDATA[' . "\n" .
'var j_tabs = new Array();' . "\n" .
'var h_tabs = new Array();' . "\n" ;
Expand Down
Loading

0 comments on commit 35b18e5

Please sign in to comment.