Skip to content

Commit

Permalink
PMA_mimeDefaultFunction() function moved back to PMA_DisplayResults c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
Chanaka committed Jun 30, 2012
1 parent a2b0135 commit a76cd76
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
42 changes: 34 additions & 8 deletions libraries/DisplayResults.class.php
Expand Up @@ -2191,7 +2191,7 @@ private function _getTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
: false;

// Wrap MIME-transformations. [MIME]
$default_function = 'PMA_mimeDefaultFunction'; // default_function
$default_function = '_mimeDefaultFunction'; // default_function
$transformation_plugin = $default_function;
$transform_options = array();

Expand Down Expand Up @@ -2928,7 +2928,7 @@ private function _getDataCellForBlobColumns(
$transform_options,
$meta
)
: $default_function($column, array(), $meta);
: $this->$default_function($column, array(), $meta);

if ($is_field_truncated) {
$class .= ' truncated';
Expand Down Expand Up @@ -4068,7 +4068,7 @@ private function _getSortedColumnMessage(
$row = PMA_DBI_fetch_row($dt_result);

// initializing default arguments
$default_function = 'PMA_mimeDefaultFunction';
$default_function = '_mimeDefaultFunction';
$transformation_plugin = $default_function;
$transform_options = array();

Expand Down Expand Up @@ -4596,7 +4596,7 @@ private function _handleNonPrintableContents(
);
} else {

$result = $default_function($result, array(), $meta);
$result = $this->$default_function($result, array(), $meta);
if (stristr($meta->type, self::BLOB_FIELD)
&& $_SESSION['tmp_user_values']['display_blob']
) {
Expand Down Expand Up @@ -4726,7 +4726,7 @@ private function _getRowData(
$transform_options,
$meta
)
: $default_function($data)
: $this->$default_function($data)
)
. ' <code>[-&gt;' . $dispval . ']</code>';

Expand Down Expand Up @@ -4776,10 +4776,10 @@ private function _getRowData(
if ($_SESSION['tmp_user_values']['relational_display'] == self::RELATIONAL_DISPLAY_COLUMN) {
// user chose "relational display field" in the
// display options, so show display field in the cell
$result .= $default_function($dispval);
$result .= $this->$default_function($dispval);
} else {
// otherwise display data in the cell
$result .= $default_function($data);
$result .= $this->$default_function($data);
}

}
Expand All @@ -4793,7 +4793,7 @@ private function _getRowData(
$transform_options,
$meta
)
: $default_function($data)
: $this->$default_function($data)
);
}

Expand Down Expand Up @@ -5087,6 +5087,32 @@ private function _getCheckboxAndLinks(
return $ret;

} // end of the '_getCheckboxAndLinks()' function


/**
* Replace some html-unfriendly stuff
*
* @param string $buffer String to process
*
* @return Escaped and cleaned up text suitable for html.
*
* @access private
*
* @see _getDataCellForBlobField(), _getRowData(),
* _handleNonPrintableContents()
*/
private function _mimeDefaultFunction($buffer)
{
$buffer = htmlspecialchars($buffer);
$buffer = str_replace(
"\011",
' &nbsp;&nbsp;&nbsp;',
str_replace(' ', ' &nbsp;', $buffer)
);
$buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);

return $buffer;
}

}
?>
27 changes: 0 additions & 27 deletions libraries/core.lib.php
Expand Up @@ -777,31 +777,4 @@ function PMA_addJSVar($key, $value, $escape = true)
PMA_addJSCode(PMA_getJsValue($key, $value, $escape));
}


/**
* Replace some html-unfriendly stuff
*
* @param string $buffer String to process
*
* @return Escaped and cleaned up text suitable for html.
*
* @access private
*
* @see PMA_DisplayResults::_getDataCellForBlobField(),
* PMA_DisplayResults::_getRowData(),
* PMA_DisplayResults::_handleNonPrintableContents()
*/
function PMA_mimeDefaultFunction($buffer)
{
$buffer = htmlspecialchars($buffer);
$buffer = str_replace(
"\011",
' &nbsp;&nbsp;&nbsp;',
str_replace(' ', ' &nbsp;', $buffer)
);
$buffer = preg_replace("@((\015\012)|(\015)|(\012))@", '<br />', $buffer);

return $buffer;
}

?>

0 comments on commit a76cd76

Please sign in to comment.