';
}
/**
* show form code for widget
* normaly use alojapro widget WP plugin
*/
function shortcode_giftbox_widget() {
return '';
}
/**
* show form code for widget
* normaly use alojapro widget WP plugin
*/
function shortcode_activities_widget() {
return '';
}
/**
* call to widget3 component
*/
function call($method, $type, $params, $settings) {
global $integration_settings;
$url = $integration_settings['widgetUrl'] . '/' . $method;
$xSessionId = session_id();
if ($xSessionId == "") {
$xSessionId = wp_get_session_token();
}
$locale = explode('_', get_locale());
$headers = [
// origin session id
'X-SessionId: ' . $xSessionId,
// url origin for the requests
'X-OriginUrl: ' . $integration_settings['originUrl'],
// booking, booking.php, etc...
'X-ScriptName: ' . $settings,
//'X-Language: '.$locale[0],
'X-Language: en',
'X-Currency: 1',
];
// Create curl object
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// for post method
if ($type == 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
}
// Exec the call
$response = curl_exec($ch);
return $response;
}
add_shortcode('booking_widget', 'shortcode_booking_widget');
add_shortcode('booking_process', 'shortcode_booking_process');
add_shortcode('giftbox_widget', 'shortcode_giftbox_widget');
add_shortcode('giftbox_process', 'shortcode_giftbox_process');
add_shortcode('activities_widget', 'shortcode_activities_widget');
add_shortcode('activities_process', 'shortcode_activities_process');
add_shortcode ('get_comments_num', 'shortcode_get_comments_num');
add_shortcode ('get_comments', 'shortcode_get_comments');
add_shortcode ('get_offers', 'shortcode_get_offers');