From 10b5b251f8dddd5c980d0af638a539355f58e5db Mon Sep 17 00:00:00 2001 From: Paul 'flowerysong' Arthur Date: Fri, 2 Jul 2010 04:43:23 +0000 Subject: Process config arrays in a loop, instead of by hand. --- lib/class/preference.class.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php index 051e58d8..bc2e9b2e 100644 --- a/lib/class/preference.class.php +++ b/lib/class/preference.class.php @@ -323,15 +323,14 @@ class Preference { * become an array and boolean everythings */ public static function fix_preferences($results) { + $arrays = array('auth_methods', 'tag_order', 'art_order', + 'amazon_base_urls'); - $results['auth_methods'] = trim($results['auth_methods']) ? explode(",",$results['auth_methods']) : array(); - $results['tag_order'] = trim($results['tag_order']) ? explode(",",$results['tag_order']) : array(); - $results['art_order'] = trim($results['art_order']) ? explode(",",$results['art_order']) : array(); - - if (isset($results['amazin_base_urls'])) - $results['amazon_base_urls'] = trim($results['amazin_base_urls']) ? explode(",",$results['amazon_base_urls']) : array(); - else - $results['amazon_base_urls']= array(); + foreach ($arrays as $item) { + $results[$item] = trim($results[$item]) + ? explode(',', $results[$item]) + : array(); + } foreach ($results as $key=>$data) { if (!is_array($data)) { -- cgit