Skip to content

Commit

Permalink
Merge branch 'release/1.4.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharvold committed Apr 2, 2024
2 parents 7d56000 + 2b17aaf commit dcbcf88
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: MB-Jan, bjornharvold
Tags: wink2travel, travel, hotel, booking, affiliate network
Requires at least: 4.7
Tested up to: 6.4
Stable tag: 1.4.15
Version: 1.4.15
Stable tag: 1.4.16
Version: 1.4.16
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
2 changes: 1 addition & 1 deletion includes/elementHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function coreComponent() {
$html = '';
$clientId = get_option($this->clientIdKey, false);

echo'<wink-app-loader config=\'{"clientId":"'.esc_html($clientId).'"}\'></wink-app-loader>';
echo'<wink-app-loader client-id="'.esc_html($clientId).'"></wink-app-loader>';
$GLOBALS['winkLoaderAlreadyEnqueued'] = true;
}
return $GLOBALS['winkLoaderAlreadyEnqueued'];
Expand Down
38 changes: 22 additions & 16 deletions includes/elements/winkcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ function winkElement($atts) {
$config['layout'] = "HOTEL";
}
}
$attrs = join(' ', array_map(function($key) use ($config){
if(is_bool($config[$key])){
return $config[$key]?$key:'';
}
return $key.'="'.$config[$key].'"';
}, array_keys($config)));
ob_start();
?>
<wink-content-loader config='<?php echo filter_var(wp_json_encode($config),FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?>'></wink-content-loader>
<wink-content-loader <?php echo $attrs; ?>></wink-content-loader>
<?php
$content = ob_get_contents();
ob_end_clean();
Expand All @@ -113,7 +119,7 @@ function winkElement($atts) {
return htmlspecialchars($content);
}
//error_log(str_replace("&quot;",'"',$content));
return str_replace("&quot;",'"',$content);
return str_replace('&quot;','"',$content);
}

function getwinkBearerToken()
Expand Down Expand Up @@ -220,21 +226,21 @@ function getwinkLayouts($bearerToken) {
} else {
if (!empty($response['body'])) {
$data = json_decode($response['body'], true);
if (!empty($data)) {
if (!empty($data['status']) && $data['error'] == 404) {
delete_option( 'winkData' );
delete_option( 'winkdataTime' );
error_log('Wink - Unable to retrieve layout data.');
if (!empty($data)) {
if (!empty($data['status']) && $data['error'] == 404) {
delete_option( 'winkData' );
delete_option( 'winkdataTime' );
error_log('Wink - Unable to retrieve layout data.');
} else {
// error_log('Wink - layout $data' . $data);
update_option('winkData', $data);
update_option('winkdataTime', 60 * 2 + current_time('timestamp')); // 2 minutes
return $data;
}
} else {
// error_log('Wink - layout $data' . $data);
update_option('winkData', $data);
update_option('winkdataTime', 60 * 2 + current_time('timestamp')); // 2 minutes
return $data;
error_log('Wink - Unable to get response body content while retrieving layouts. Response array below:');
error_log(print_r($response,true));
}
} else {
error_log('Wink - Unable to get response body content while retrieving layouts. Response array below:');
error_log(print_r($response,true));
}
}
}
} else {
Expand Down Expand Up @@ -286,4 +292,4 @@ function gutenbergBlockRegistration()
}
}

$winkContent = new winkContent();
$winkContent = new winkContent();
2 changes: 1 addition & 1 deletion wink.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Wink Affiliate WordPress Plugin
* Description: This plugin integrates your Wink affiliate account with WordPress. It integrates with Gutenberg, Elementor, Avada, WPBakery and as shortcodes.
* Version: 1.4.15
* Version: 1.4.16
* Author: Wink
* Author URI: https://wink.travel/
* License: GPL-3.0
Expand Down

0 comments on commit dcbcf88

Please sign in to comment.