function products($fresh = false) { $d = get_option('chargify'); $opt = array("api_key" => $d["chargifyApiKey"], "test_api_key" => $d["chargifyTestApiKey"], "domain" => $d["chargifyDomain"], "test_domain" => $d["chargifyTestDomain"], "test_mode" => $d["chargifyMode"] == 'test' ? TRUE : FALSE); if ($fresh) { $connector = new ChargifyConnector($opt); $products = $connector->getAllProducts(); } else { if (is_array($d['chargifyProducts'])) { $products = array(); foreach ($d['chargifyProducts'] as $p) { if ($p['enable'] == 'on') { $products[] = unserialize(base64_decode($p['raw'])); } } } } return $products; }