Fix systematic errors in pagination, sucursal warnings, and fatal count() errors across multiple modules
This commit is contained in:
@@ -224,7 +224,7 @@ switch ( $sapi ) {
|
||||
}
|
||||
|
||||
if ( isset($opts['t']) ) {
|
||||
$arr = split(',',$opts['t']);
|
||||
$arr = explode(',',$opts['t']);
|
||||
$types = array();
|
||||
foreach ($arr as $type)
|
||||
$types[ trim($type) ] = 1;
|
||||
|
||||
@@ -230,8 +230,9 @@ abstract class Frame_Reflower {
|
||||
|
||||
// Convert escaped hex characters into ascii characters (e.g. \A => newline)
|
||||
$string = preg_replace_callback("/\\\\([0-9a-fA-F]{0,6})(\s)?(?(2)|(?=[^0-9a-fA-F]))/",
|
||||
create_function('$matches',
|
||||
'return chr(hexdec($matches[1]));'),
|
||||
function($matches) {
|
||||
return chr(hexdec($matches[1]));
|
||||
},
|
||||
$string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
@@ -377,16 +377,18 @@ class Text_Frame_Reflower extends Frame_Reflower {
|
||||
// faster than doing a single-pass character by character scan. Heh,
|
||||
// yes I took the time to bench it ;)
|
||||
$words = array_flip(preg_split("/[\s-]+/u",$str, -1, PREG_SPLIT_DELIM_CAPTURE));
|
||||
array_walk($words, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.addslashes($font).'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($words, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
arsort($words);
|
||||
$min = reset($words);
|
||||
break;
|
||||
|
||||
case "pre":
|
||||
$lines = array_flip(preg_split("/\n/u", $str));
|
||||
array_walk($lines, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.addslashes($font).'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($lines, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
|
||||
arsort($lines);
|
||||
$min = reset($lines);
|
||||
@@ -413,8 +415,9 @@ class Text_Frame_Reflower extends Frame_Reflower {
|
||||
case "pre-wrap":
|
||||
// Find the longest word (i.e. minimum length)
|
||||
$lines = array_flip(preg_split("/\n/", $text));
|
||||
array_walk($lines, create_function('&$val,$str',
|
||||
'$val = Font_Metrics::get_text_width($str, "'.$font.'", '.$size.', '.$word_spacing.', '.$char_spacing.');'));
|
||||
array_walk($lines, function(&$val, $str) use ($font, $size, $word_spacing, $char_spacing) {
|
||||
$val = Font_Metrics::get_text_width($str, $font, $size, $word_spacing, $char_spacing);
|
||||
});
|
||||
arsort($lines);
|
||||
reset($lines);
|
||||
$str = key($lines);
|
||||
|
||||
Reference in New Issue
Block a user