<?php
get_header(); ?>
<?php
$url_lang = get_query_var('l');
$browserlang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if ($url_lang == $browserlang) {
$l = $browserlang;
}
elseif (strlen($url_lang) < 1) {
$l = $browserlang;
}
else {
$l = $url_lang;
}
$query = "query {
requestContent(environmentID: \"b3d2db17-fd81-42ee-81f1-f0541d8e81a8\", language: \"".$l."\") {
body {
key
value
}
}
}";
$payload = json_encode( array( "query"=> $query ) );
$graphqlEndpoint = 'https://api.fluentc.io/graphql';
$curl = curl_init();
$headers = array(
'Content-Type : application/json; charset=UTF-8',
'x-api-key : da2-wtkl5bpofjbu5ex5iugu4o2mbm',
);
curl_setopt_array($curl, array(
CURLOPT_URL => $graphqlEndpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$body = json_decode($response);
$data = $body->data->requestContent->body;
?>
<div id="primary" class="content-area container" role="main">
<div class="row">
<div class="<?php echo apply_filters( 'jobify_single_column_spans', 'col-sm-12 col-md-10 col-md-offset-1' ); ?>">
<?php
$content = get_the_content();
$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]>', $content );
$form_fields = array("First Name", "Last Name", "E-mail", "Password", "Contact Info");
foreach($form_fields as $field) {
$content = str_replace($field,"{*".$field."*}",$content);
}
foreach($data as $key => $value) {
$fluentckey = "{*".$value->key."*}";
$fluentcvalue = $value->value;
$content = str_replace($fluentckey,$fluentcvalue,$content);
}
echo $content;
?>
</div>
</div>
<?php do_action( 'jobify_loop_after' ); ?>
</div>
<?php get_footer(); ?>