Optimised get_company_pref()
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 2 Oct 2017 05:57:45 +0000 (07:57 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 2 Oct 2017 05:57:45 +0000 (07:57 +0200)
admin/db/company_db.inc

index f73cd04cc636036d1b68bd41738d6a64b0fb1288..39108db831f22d408f41f2344c3a1c3b9371f96a 100644 (file)
@@ -39,16 +39,13 @@ function get_company_pref($prefs = null)
 
        $all = $SysPrefs->prefs;
 
-       if (!$prefs)
-               return $all;
-       elseif (is_string($prefs))
+       if ($prefs && is_string($prefs))
                return @$all[$prefs];
 
-       $ret = array();
-       foreach($prefs as $name)
-               $ret[$name] = $all[$name];
+       if (!is_array($all))
+               $all = array();
 
-       return $ret;
+       return $all;
 }
 
 function get_company_prefs()