mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/avatars] Use callback method in avatar manager's clean row
PHPBB3-10018
This commit is contained in:
parent
2f47c99432
commit
e6aaef6066
1 changed files with 12 additions and 7 deletions
|
@ -157,17 +157,22 @@ class phpbb_avatar_manager
|
||||||
$keys = array_keys($row);
|
$keys = array_keys($row);
|
||||||
$values = array_values($row);
|
$values = array_values($row);
|
||||||
|
|
||||||
$keys = array_map(
|
$keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys);
|
||||||
function ($key)
|
|
||||||
{
|
|
||||||
return preg_replace('#^(?:user_|group_)#', '', $key);
|
|
||||||
},
|
|
||||||
$keys
|
|
||||||
);
|
|
||||||
|
|
||||||
return array_combine($keys, $values);
|
return array_combine($keys, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip prepending user_ or group_ prefix from key
|
||||||
|
*
|
||||||
|
* @param string Array key
|
||||||
|
* @return string Key that has been stripped from its prefix
|
||||||
|
*/
|
||||||
|
protected static function strip_prefix($key)
|
||||||
|
{
|
||||||
|
return preg_replace('#^(?:user_|group_)#', '', $key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean driver names that are returned from template files
|
* Clean driver names that are returned from template files
|
||||||
* Underscores are replaced with dots
|
* Underscores are replaced with dots
|
||||||
|
|
Loading…
Add table
Reference in a new issue