updated handling of long filenames in icons views of "simple" and "slik" templates, and modified output functions in exec/output.exec.php.

git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@28 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
jim
2006-10-13 20:59:04 +00:00
parent 86f5c6a93d
commit dc5ebee5f2
5 changed files with 26 additions and 16 deletions

View File

@@ -86,21 +86,25 @@ class Path {
return $r_files;
}
}
//>Section> path_wordwrap
function wordbreak ($input, $length, $break=" ") {
if (preg_match("/(.*)\.(.*)/", $input, $preg) ) {
$words = explode(' ', $preg[1]);
$ext = '.'.$preg[2];
} else {
$words = explode(' ', $input);
$ext = '';
//>Section> path_breakFilename
function breakFilename ($input, $maxlength, $wordbreak = 16) {
if ( $wordbreak != false ) {
if (preg_match("/(.*)\.(.*)/", $input, $preg) ) {
$words = explode(' ', $preg[1]);
$ext = '.'.$preg[2];
} else {
$words = explode(' ', $input);
$ext = '';
}
foreach( $words as $key => $value ) {
$words[$key] = wordwrap($value, $wordbreak, ' ', 1);
}
$input = implode(' ', $words).$ext;
}
foreach( $words as $key => $value ) {
$words[$key] = wordwrap($value, $length, $break, 1);
}
return implode(' ', $words).$ext;
if ( strlen($input) > $maxlength ) return rtrim(substr($input, 0, $maxlength)).'...';
return $input;
}
//>Section> path_class.end