No render method exists for " . $field["type"] . "
";
}
// apply wordpress filter
if ( $return ){
return $output;
} else {
echo $output;
}
}
function render_text($field, $schema){
ob_start();
?>
", false, false);
$json = trim(trim($json),";");
$data = json_decode($json,true);
// Build the request to get the ACTUAL schema data
$base_url = "https://airtable.com/v0.3/view/";
$view_id = $data["sharedViewId"];
$access_policy = json_decode($data["accessPolicy"],true);
$params = [
"accessPolicy" => $data["accessPolicy"]
];
$param_string = "/readSharedFormData?" . http_build_query($params);
$url = $base_url . $view_id . $param_string;
// Make the request
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: */*",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Host: airtable.com",
"X-Requested-With: XMLHttpRequest",
"accept-encoding: gzip, deflate",
"cache-control: no-cache",
"x-airtable-application-id: " . $access_policy["applicationId"],
"x-time-zone: America/Los_Angeles",
"x-user-locale: en"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
die("cURL Error #:" . $err);
}
file_put_contents($form_id . ".json", $response);
return json_decode($response,true)["data"];
}
function easyParse($string, $start, $end, $include_start=true, $include_end=false){
$s = strpos($string, $start);
if ( ! $include_start ){
$s += strlen($start);
}
$e = strpos($string, $end, $s);
if ( $include_end ){
$e += strlen($end);
}
return substr($string, $s, $e-$s);
}
?>