forked from extern/egroupware
replace create_function with performanter, because opcachable closure
This commit is contained in:
parent
4da844a70f
commit
485416d5f1
@ -811,7 +811,10 @@ class Categories
|
||||
($cat['appname'] != self::GLOBAL_APPNAME);
|
||||
}
|
||||
// sort heighest weight to the top
|
||||
usort($cats,create_function('$a,$b',"return \$b['weight'] - \$a['weight'];"));
|
||||
usort($cats, function($a, $b)
|
||||
{
|
||||
return $b['weight'] - $a['weight'];
|
||||
});
|
||||
}
|
||||
return $cache[$cat['cat_name']] = (int) $cats[0]['id'];
|
||||
}
|
||||
|
@ -2057,7 +2057,11 @@ class Db
|
||||
{
|
||||
$keys = array_keys($arr);
|
||||
|
||||
return array_walk($keys,create_function('&$v,$k,$strip','$v = str_replace($strip,\'\',$v);'),$strip) ?
|
||||
return array_walk($keys, function(&$v, $k, $strip)
|
||||
{
|
||||
unset($k); // not used, but required by function signature
|
||||
$v = str_replace($strip, '', $v);
|
||||
}, $strip) ?
|
||||
array_combine($keys,$arr) : $arr;
|
||||
}
|
||||
}
|
||||
|
@ -1369,7 +1369,10 @@ class Schema
|
||||
{
|
||||
if($this->capabilities['name_case'] == 'upper')
|
||||
{
|
||||
array_walk($primary,create_function('&$s','$s = strtolower($s);'));
|
||||
array_walk($primary, function(&$s)
|
||||
{
|
||||
$s = strtolower($s);
|
||||
});
|
||||
}
|
||||
$definition['pk'] = $primary;
|
||||
}
|
||||
@ -1402,7 +1405,10 @@ class Schema
|
||||
}
|
||||
if($this->capabilities['name_case'] == 'upper')
|
||||
{
|
||||
array_walk($index['columns'],create_function('&$s','$s = strtolower($s);'));
|
||||
array_walk($index['columns'], function(&$s)
|
||||
{
|
||||
$s = strtolower($s);
|
||||
});
|
||||
}
|
||||
if (count($definition['pk']) && (implode(':',$definition['pk']) == implode(':',$index['columns']) ||
|
||||
$index['unique'] && count(array_intersect($definition['pk'],$index['columns'])) == count($definition['pk'])))
|
||||
|
@ -90,7 +90,8 @@ class Link extends Etemplate\Widget
|
||||
// ToDo: implement on client-side
|
||||
if (!$attrs['help']) self::setElementAttribute($form_name, 'help', 'view this linked entry in its application');
|
||||
|
||||
if($attrs['type'] == 'link-list') {
|
||||
if($attrs['type'] == 'link-list')
|
||||
{
|
||||
$app = $value['to_app'];
|
||||
$id = $value['to_id'];
|
||||
$links = Api\Link::get_links($app,$id,'','link_lastmod DESC',true, $value['show_deleted']);
|
||||
@ -103,11 +104,18 @@ class Link extends Etemplate\Widget
|
||||
/**
|
||||
* Find links that match the given parameters
|
||||
*/
|
||||
public static function ajax_link_search($app, $type, $pattern, $options=array()) {
|
||||
public static function ajax_link_search($app, $type, $pattern, $options=array())
|
||||
{
|
||||
$options['type'] = $type ? $type : $options['type'];
|
||||
if(!$options['num_rows']) $options['num_rows'] = 1000;
|
||||
|
||||
$links = Api\Link::query($app, $pattern, $options);
|
||||
$linksc = array_combine(array_map(create_function('$k', 'return (string)" ".$k;'), array_keys($links)), $links);
|
||||
|
||||
$linksc = array_combine(array_map(function($k)
|
||||
{
|
||||
return (string)$k;
|
||||
}, array_keys($links)), $links);
|
||||
|
||||
$response = Api\Json\Response::get();
|
||||
$response->data($linksc);
|
||||
}
|
||||
|
@ -360,7 +360,10 @@ class Vfs extends Vfs\StreamWrapper
|
||||
}
|
||||
self::$fstab[$path] = $url;
|
||||
|
||||
uksort(self::$fstab,create_function('$a,$b','return strlen($a)-strlen($b);'));
|
||||
uksort(self::$fstab, function($a, $b)
|
||||
{
|
||||
return strlen($a) - strlen($b);
|
||||
});
|
||||
|
||||
if ($persitent_mount)
|
||||
{
|
||||
|
@ -1103,7 +1103,10 @@ class StreamWrapper implements StreamWrapperIface
|
||||
self::$symlink_cache[$path] = $target;
|
||||
|
||||
// sort longest path first
|
||||
uksort(self::$symlink_cache,create_function('$b,$a','return strlen($a)-strlen($b);'));
|
||||
uksort(self::$symlink_cache, function($b, $a)
|
||||
{
|
||||
return strlen($a) - strlen($b);
|
||||
});
|
||||
if (self::LOG_LEVEL > 1) error_log(__METHOD__."($path,$target) cache now ".array2string(self::$symlink_cache));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user