Skip to content

Commit e50770d

Browse files
authored
Merge pull request #34 from daanrijpkemacb/1.3.31
1.3.31: Rewrite rule fixes
2 parents 5bcf09c + fc23812 commit e50770d

File tree

5 files changed

+48
-27
lines changed

5 files changed

+48
-27
lines changed

bluem-integrations.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ function bluem_woocommerce_integration_wpcf7_ajax()
231231
$preferences = get_option('bluem_woocommerce_options');
232232

233233
// Convert UTF-8 to ISO
234-
// if (!empty($bluem_mandate_reason)) {
235-
// $bluem_config->eMandateReason = $bluem_mandate_reason . ' (' . $debtorReference . ')';
236-
// } else
237234
if (!empty($bluem_config->eMandateReason)) {
238235
$bluem_config->eMandateReason = mb_convert_encoding($bluem_config->eMandateReason, 'ISO-8859-1', 'UTF-8');
239236
} else {

bluem.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* Plugin Name: Bluem ePayments, iDIN, eMandates services and integration for WooCommerce
5-
* Version: 1.3.30
5+
* Version: 1.3.31
66
* Plugin URI: https://bluem.nl/en/
77
* Description: Bluem integration for WordPress and WooCommerce for Payments, eMandates, iDIN identity verification and more
88
* Author: Bluem Payment Services
@@ -146,10 +146,21 @@ function bluem_is_permalinks_enabled(): bool
146146
}
147147

148148
// Plug-in activation
149-
function bluem_woocommerce_plugin_activate()
149+
function bluem_woocommerce_plugin_activate(): void
150150
{
151151
update_option('bluem_plugin_registration', false);
152152

153+
bluem_add_rewrites();
154+
// Flush the rules after adding them
155+
flush_rewrite_rules();
156+
}
157+
158+
register_activation_hook(__FILE__, 'bluem_woocommerce_plugin_activate');
159+
160+
161+
function bluem_add_rewrites(): void
162+
{
163+
153164
// Rewrite rules:
154165
add_rewrite_rule('^bluem-woocommerce/idin_execute/?$', 'index.php?bluem_idin_shortcode_execute=1', 'top');
155166
add_rewrite_rule('^bluem-woocommerce/idin_shortcode_callback/?$', 'index.php?bluem_idin_shortcode_callback=1', 'top');
@@ -174,11 +185,9 @@ function bluem_woocommerce_plugin_activate()
174185
add_rewrite_rule('^bluem-woocommerce/bluem-integrations/gform_callback?$', 'index.php?bluem_woocommerce_integration_gform_callback=1', 'top');
175186
add_rewrite_rule('^bluem-woocommerce/bluem-integrations/gform_callback/?$', 'index.php?bluem_woocommerce_integration_gform_callback=1', 'top');
176187

177-
// Flush the rules after adding them
178-
flush_rewrite_rules();
179-
}
180188

181-
register_activation_hook(__FILE__, 'bluem_woocommerce_plugin_activate');
189+
}
190+
add_action('init', 'bluem_add_rewrites');
182191

183192
add_filter('query_vars', function ($vars) {
184193
$bluem_vars = [

build.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PLUGIN_VERSION=1.3.30
1+
PLUGIN_VERSION=1.3.31

readme.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: Bluem,Payments,iDIN,iDEAL,eMandates
44
Requires at least: 5.0
55
Tested up to: 6.6
66
Requires PHP: 8.0
7-
Stable tag: 1.3.30
7+
Stable tag: 1.3.31
88
License: GPLv3
99
License URI: http://www.gnu.org/licenses/gpl-3.0.html
1010

@@ -77,6 +77,7 @@ Shortcode: `[bluem_identificatieformulier]`
7777
It is possible to programmatically block display and functionality on your site based on the verification status. Please contact us if you are interested in developing this in your site.
7878

7979
== Changelog ==
80+
- 1.3.31: Ensure rewrite rules are registered on init
8081
- 1.3.30: Fixed eMandates return bug; improved error messages in UI
8182
- 1.3.29: Callback URL fix for iDIN shortcode
8283
- 1.3.28: Refactor SNS to ASN and update BIC list

views/status.php

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,36 @@ function bluem_display_woocommerce_logs(): string
125125
style="color: #4F800D;"></span></li>
126126
<?php } ?>
127127
</ul>
128+
129+
<div class="wrap">
130+
<h2><?php esc_html_e('Refresh rewrite rules','bluem'); ?></h2>
131+
<p><?php esc_html_e('Zijn er problemen met het tonen/leveren van pagina\'s van de plug-in in je site? Klik dan hieronder om de Bluem pagina opnieuw te registreren. Dit zorgt er doorgaans voor dat de website de modernere vorm van pagina\'s kan tonen. ' ,'bluem'); ?></p>
132+
133+
<form method="post" action="">
134+
<?php wp_nonce_field('flush_rewrite_rules_nonce', 'flush_rewrite_rules_nonce'); ?>
135+
<input type="submit" name="flush_rewrite_rules" class="button button-primary" value="<?php esc_html_e('Refresh rewrite rules','bluem'); ?>">
136+
</form>
137+
</div>
138+
<?php
139+
if (isset($_POST['flush_rewrite_rules']) && check_admin_referer('flush_rewrite_rules_nonce', 'flush_rewrite_rules_nonce')) {
140+
flush_rewrite_rules();
141+
echo '<div class="updated"><p>
142+
'. esc_html("Refreshed rewrite rules successfully","bluem").'
143+
</p>';
144+
echo '</div>';
145+
} ?>
146+
147+
<h3>Available Bluem rules</h3>
148+
<ul><?php
149+
$rules = get_option( 'rewrite_rules' );
150+
foreach ($rules as $key => $value) {
151+
if(str_contains($key, 'bluem')) {
152+
$key = str_replace(['^bluem-woocommerce/','','$'], '', $key);
153+
echo '<li>✅ <strong>'.esc_html($key).'</strong></li>';
154+
}
155+
}
156+
?>
157+
</ul>
128158
</div>
129159

130160
<div id="logs" class="tab-content">
@@ -140,23 +170,7 @@ function bluem_display_woocommerce_logs(): string
140170
<?php echo wp_kses_post(bluem_display_woocommerce_logs()); ?>
141171
</div>
142172

143-
<div class="wrap">
144-
<h2><?php esc_html_e('Refresh rewrite rules','bluem'); ?></h2>
145-
<p><?php esc_html_e('Zijn er problemen met het tonen/leveren van pagina\'s van de plug-in in je site? Klik dan hieronder om de Bluem pagina opnieuw te registreren. Dit zorgt er doorgaans voor dat de website de modernere vorm van pagina\'s kan tonen. ' ,'bluem'); ?></p>
146173

147-
<form method="post" action="">
148-
<?php wp_nonce_field('flush_rewrite_rules_nonce', 'flush_rewrite_rules_nonce'); ?>
149-
<input type="submit" name="flush_rewrite_rules" class="button button-primary" value="<?php esc_html_e('Refresh rewrite rules','bluem'); ?>">
150-
</form>
151-
</div>
152-
<?php
153-
154-
if (isset($_POST['flush_rewrite_rules']) && check_admin_referer('flush_rewrite_rules_nonce', 'flush_rewrite_rules_nonce')) {
155-
flush_rewrite_rules();
156-
echo '<div class="updated"><p>
157-
'. esc_html("Refreshed rewrite rules successfully","bluem").'
158-
</p></div>';
159-
} ?>
160174
</div>
161175

162176
<?php bluem_render_footer(); ?>

0 commit comments

Comments
 (0)