private function generate_page_buttons() { ob_start(); $token = carbon_get_theme_option('crb_instagram_access_token'); if ($token) { $this->delete_token_button(); return ob_get_clean(); } $client_id = carbon_get_theme_option($this->client->carbon_config_fields['client_id']); $client_secret = carbon_get_theme_option($this->client->carbon_config_fields['client_secret']); if ($client_id && $client_secret) { $this->auth_button(); return ob_get_clean(); } }
function carbon_get_theme_option($name, $type = null) { if ($type == 'complex') { return carbon_get_complex_fields('ThemeOptions', $name); } else { if ($type == 'map') { $raw_meta = get_option($name); $coordinates = explode(',', $raw_meta); return array('lat' => (double) $coordinates[0], 'lng' => (double) $coordinates[1]); } else { if ($type == 'map_with_address') { $partial_meta = carbon_get_theme_option($name, 'map'); $partial_meta['address'] = get_option($name . '-address'); return $partial_meta; } } } return get_option($name); }