summaryrefslogtreecommitdiff
path: root/inc/parserutils.php
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-03-26 14:10:46 +0100
committerAdrian Lang <lang@cosmocode.de>2010-03-26 14:10:46 +0100
commit569a001959f65aea2c0e7cd3dd5b541cac0e9e58 (patch)
tree1c50a1ba86ad3bfca4c319a6bcad75a3196f2b6e /inc/parserutils.php
parent0139312b0d39e61bdff7318a0c092eb20b208a78 (diff)
downloadrpg-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.
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r--inc/parserutils.php3
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;
}