Skip to content

Commit

Permalink
Merge branch 'release/1.4.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornharvold committed Aug 13, 2024
2 parents bd9918f + f872581 commit f09c7c1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 117 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
branches:
- master

jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.3.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ There are 2 ways to use our components:

* Support: developer@wink.travel

[https://sell.wink.travel]: https://sell.wink.travel
[https://sell.wink.travel]: https://sell.wink.travel

### Contributors

<!-- readme: collaborators,contributors -start -->
<!-- readme: collaborators,contributors -end -->
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.16
Version: 1.4.16
Stable tag: 1.4.17
Version: 1.4.17
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
39 changes: 0 additions & 39 deletions includes/silent-refresh.html

This file was deleted.

76 changes: 1 addition & 75 deletions 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.16
* Version: 1.4.17
* Author: Wink
* Author URI: https://wink.travel/
* License: GPL-3.0
Expand Down Expand Up @@ -226,77 +226,3 @@ static function environmentURL($target, $environment) {
if (!empty(get_option('winkClientId', false))) {
require_once('includes/elementHandler.php'); // Handles all Wink Elements (Only load it if the client id is present)
}


// make silent-refresh.html accessible on all sites using rewrite rules
function winkAddRewriteRules() {
$page_slug = 'products'; // slug of the page you want to be shown to
$param = 'winksilent'; // param name you want to handle on the page
add_rewrite_tag('%winksilent%', '([^&]+)', 'winksilent=');
add_rewrite_rule('silent-refresh\.html?([^/]*)', 'index.php?winksilent=true', 'top');
}

function winkAddQueryVars($vars) {
$vars[] = 'winksilent'; // param name you want to handle on the page
return $vars;
}
add_filter('query_vars', 'winkAddQueryVars');

function winkRenderSilentRefresh( $atts ){
$do = get_query_var( 'winksilent' );
if ( !empty($do) ) {
header('Content-type: text/html');
//$dir = plugin_dir_path( __FILE__ );
if (file_exists(dirname(realpath(__FILE__)).'/includes/silent-refresh.html')) {
echo "<html>
<body>
<script>
var checks = [
/[\?|&|#]code=/,
/[\?|&|#]error=/,
/[\?|&|#]token=/,
/[\?|&|#]id_token=/
];
function isResponse(str) {
if (!str) return false;
for (var i = 0; i < checks.length; i++) {
if (str.match(checks[i])) return true;
}
return false;
}
var message = isResponse(location.hash)
? location.hash
: '#' + location.search;
// console.log('message', message);
if (window.parent && window.parent !== window) {
// if loaded as an iframe during silent refresh
window.parent.postMessage(message, location.origin);
} else if (window.opener && window.opener !== window) {
// if loaded as a popup during initial login
window.opener.postMessage(message, location.origin);
} else {
// last resort for a popup which has been through redirects and can't use window.opener
localStorage.setItem('auth_hash', message);
localStorage.removeItem('auth_hash');
}
</script>
</body>
</html>";
}
die();
}
}
add_action( 'parse_query', 'winkRenderSilentRefresh' );

register_activation_hook( __FILE__, 'winkActivationRewrite' );
add_action( 'init' , 'winkAddRewriteRules', 10, 2 );

function winkActivationRewrite() {
winkAddRewriteRules();
flush_rewrite_rules();
}

0 comments on commit f09c7c1

Please sign in to comment.