diff options
author | Adrian Lang <lang@cosmocode.de> | 2010-03-26 14:10:46 +0100 |
---|---|---|
committer | Adrian Lang <lang@cosmocode.de> | 2010-03-26 14:10:46 +0100 |
commit | 569a001959f65aea2c0e7cd3dd5b541cac0e9e58 (patch) | |
tree | 1c50a1ba86ad3bfca4c319a6bcad75a3196f2b6e | |
parent | 0139312b0d39e61bdff7318a0c092eb20b208a78 (diff) | |
download | rpg-569a001959f65aea2c0e7cd3dd5b541cac0e9e58.tar.gz rpg-569a001959f65aea2c0e7cd3dd5b541cac0e9e58.tar.bz2 |
Fix and simplify p_get_metadata key looping
explode converts $string (false) to string ("") and returns it if $delimiter is
not found, therefor looking for the key "" in metadata array.
-rw-r--r-- | inc/parserutils.php | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index cb8bc079d..4bec3ab1d 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -244,8 +244,7 @@ function p_get_metadata($id, $key='', $render=false){ $val = $meta['current']; // filter by $key - foreach(explode(' ', trim($key), 2) as $cur_key) { - $cur_key = trim($cur_key); + foreach(preg_split('/\s+/', $key, 2, PREG_SPLIT_NO_EMPTY) as $cur_key) { if (!isset($val[$cur_key])) { return null; } |