mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Shorten printed SQL query
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1138 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -307,10 +307,10 @@ function is_utf8($val) {
|
||||
* @return string escaped string with appended ...
|
||||
*/
|
||||
function shorten_utf8($string, $length = 80, $suffix = "") {
|
||||
if (!preg_match("~^((?:.|\n){0,$length})(.|\n)?~u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions
|
||||
preg_match("(^([\t\r\n -~]{0,$length})(.?))s", $string, $match);
|
||||
if (!preg_match("(^([\t\r\n -\x{FFFF}]{0,$length})($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
|
||||
preg_match("(^([\t\r\n -~]{0,$length})($)?)", $string, $match);
|
||||
}
|
||||
return h($match[1]) . $suffix . ($match[2] ? "<em>...</em>" : "");
|
||||
return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<em>...</em>");
|
||||
}
|
||||
|
||||
/** Generate friendly URL
|
||||
|
Reference in New Issue
Block a user