Skip to content

Commit 2552767

Browse files
committed
add sandbox support
1 parent 5f37f00 commit 2552767

4 files changed

Lines changed: 49 additions & 39 deletions

File tree

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: helloasso, paiement, association, crowdfunding, don
55
Requires at least: 4.0
66
Tested up to: 6.7.2
77
Requires PHP: 7.2.34
8-
Stable tag: 1.1.17
8+
Stable tag: 1.1.18
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -81,6 +81,9 @@ Please report security bugs found in the source code of the helloasso plugin thr
8181

8282
== Changelog ==
8383

84+
= 1.1.18 =
85+
* Ajout du support de la sandbox
86+
8487
= 1.1.17 =
8588
* Suppression de code utiliser pour analyse
8689

admin/js/hello-asso-admin.js

Lines changed: 17 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hello-asso.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: HelloAsso
1717
* Plugin URI: https://centredaide.helloasso.com/s/article/paiement-en-ligne-wordpress-integrer-vos-campagnes-helloasso
1818
* Description: HelloAsso est la solution gratuite des associations pour collecter des paiements et des dons sur internet.
19-
* Version: 1.1.17
19+
* Version: 1.1.18
2020
* Author: HelloAsso
2121
* Author URI: https://helloasso.com
2222
* License: GPL-2.0+
@@ -36,7 +36,7 @@
3636
* Start at version 1.0.0 and use SemVer - https://semver.org
3737
* Rename this for your plugin and update it as you release new versions.
3838
*/
39-
define('HELLO_ASSO_VERSION', '1.1.17');
39+
define('HELLO_ASSO_VERSION', '1.1.18');
4040

4141
/**
4242
* The code that runs during plugin activation.

public/class-hello-asso-public.php

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
* @subpackage Hello_Asso/public
2121
* @author HelloAsso
2222
*/
23-
class Hello_Asso_Public {
23+
class Hello_Asso_Public
24+
{
2425

2526
/**
2627
* The ID of this plugin.
@@ -47,19 +48,20 @@ class Hello_Asso_Public {
4748
* @param string $plugin_name The name of the plugin.
4849
* @param string $version The version of this plugin.
4950
*/
50-
public function __construct( $plugin_name, $version ) {
51+
public function __construct($plugin_name, $version)
52+
{
5153

5254
$this->plugin_name = $plugin_name;
5355
$this->version = $version;
54-
5556
}
5657

5758
/**
5859
* Register the stylesheets for the public-facing side of the site.
5960
*
6061
* @since 1.0.0
6162
*/
62-
public function enqueue_styles() {
63+
public function enqueue_styles()
64+
{
6365

6466
/**
6567
* This function is provided for demonstration purposes only.
@@ -73,16 +75,16 @@ public function enqueue_styles() {
7375
* class.
7476
*/
7577

76-
wp_enqueue_style( $this->plugin_name, esc_html(plugin_dir_url( __FILE__ )) . 'css/hello-asso-public.css', array(), $this->version, 'all' );
77-
78+
wp_enqueue_style($this->plugin_name, esc_html(plugin_dir_url(__FILE__)) . 'css/hello-asso-public.css', array(), $this->version, 'all');
7879
}
7980

8081
/**
8182
* Register the JavaScript for the public-facing side of the site.
8283
*
8384
* @since 1.0.0
8485
*/
85-
public function enqueue_scripts() {
86+
public function enqueue_scripts()
87+
{
8688

8789
/**
8890
* This function is provided for demonstration purposes only.
@@ -96,56 +98,49 @@ public function enqueue_scripts() {
9698
* class.
9799
*/
98100

99-
wp_enqueue_script( $this->plugin_name, esc_html(plugin_dir_url( __FILE__ )) . 'js/hello-asso-public.js', array( 'jquery' ), $this->version, false );
100-
101+
wp_enqueue_script($this->plugin_name, esc_html(plugin_dir_url(__FILE__)) . 'js/hello-asso-public.js', array('jquery'), $this->version, false);
101102
}
102103

103104
public function loadShortcode()
104-
{
105-
add_shortcode( 'helloasso', 'ha_shortcode' );
105+
{
106+
add_shortcode('helloasso', 'ha_shortcode');
106107

107108
function ha_shortcode($atts)
108109
{
109110
$url = $atts['campaign'];
110111
$type = $atts['type'];
111112
$allowed_styles = array(
112-
'style' => array(
113-
'width' => array(),
114-
'height' => array(),
115-
'border' => array(),
113+
'style' => array(
114+
'width' => array(),
115+
'height' => array(),
116+
'border' => array(),
116117
),
117118
);
118119

119120
$pattern = '/^\d+px$/';
120121

121-
if($type == "widget-bouton")
122-
{
122+
if ($type == "widget-bouton") {
123123
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "70px";
124-
$styleIframe = 'style="width:200px; height:'. $height . '; border:none;"';
125-
}
126-
else if($type == "widget")
127-
{
124+
$styleIframe = 'style="width:200px; height:' . $height . '; border:none;"';
125+
} else if ($type == "widget") {
128126
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "750px";
129-
$styleIframe = 'style="width:100%; height:'. $height . '; border:none;"';
130-
}
131-
else if($type == "widget-vignette")
132-
{
127+
$styleIframe = 'style="width:100%; height:' . $height . '; border:none;"';
128+
} else if ($type == "widget-vignette") {
133129
$height = preg_match($pattern, $atts['height'] ?? 0) ? $atts['height'] : "450px";
134-
$styleIframe = 'style="width:350px; height:'. $height . '; border:none;"';
130+
$styleIframe = 'style="width:350px; height:' . $height . '; border:none;"';
135131
} else {
136132
$type = "";
137133
}
138134

139-
if(!str_starts_with($url, "https://www.helloasso.com/")) {
135+
if (!str_starts_with($url, "https://www.helloasso.com/") && !str_starts_with($url, "https://www.helloasso-sandbox.com/")) {
140136
$url = "";
141137
}
142138

143139
ob_start();
144-
?>
145-
<iframe src="<?= esc_url($url); ?><?= esc_html($type); ?>" id="idIframe" <?= wp_kses($styleIframe, $allowed_styles); ?> border="0"></iframe>
146-
<?php
140+
?>
141+
<iframe src="<?= esc_url($url); ?><?= esc_html($type); ?>" id="idIframe" <?= wp_kses($styleIframe, $allowed_styles); ?> border="0"></iframe>
142+
<?php
147143
return ob_get_clean();
148144
}
149145
}
150-
151146
}

0 commit comments

Comments
 (0)