Skip to content

Commit

Permalink
0.1.31
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiofan committed Dec 12, 2024
1 parent 2dc58d1 commit 88c1d2d
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 44 deletions.
21 changes: 15 additions & 6 deletions blocks/class-blockstrap-widget-contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,17 +791,24 @@ public function output( $args = array(), $widget_args = array(), $content = '' )
}
}


// Captcha Input
$captcha_input = apply_filters( 'blockstrap_blocks_contact_form_captcha_input', '', $args );

// recaptcha
$recaptcha_enabled = false;
if ( defined( 'BLOCKSTRAP_VERSION' ) && empty( $args['field_recaptcha'] ) ) {
if ( !$captcha_input && defined( 'BLOCKSTRAP_VERSION' ) && empty( $args['field_recaptcha'] ) ) {
$keys = function_exists( 'blockstrap_get_option' ) ? blockstrap_get_option( 'blockstrap_recaptcha_keys' ) : get_option( 'blockstrap_recaptcha_keys' );
if ( ! empty( $keys['site_key'] ) && ! empty( $keys['site_secret'] ) ) {
$field_content .= '<div class="g-recaptcha mb-3" id="x" data-sitekey="' . esc_attr( $keys['site_key'] ) . '"></div>';
$recaptcha_enabled = true;
$field_content .= '<div class="g-recaptcha mb-3" data-sitekey="' . esc_attr( $keys['site_key'] ) . '"></div>';
$recaptcha_enabled = 'g-recaptcha-response';
//if(!$is_lightbox){
add_action( 'wp_footer', array( $this, 'get_recaptcha_js' ) );
//}
}
} elseif ( $captcha_input ) {
$field_content .= $captcha_input;
$recaptcha_enabled = 'cf-turnstile-response';
}

// add to footer
Expand All @@ -820,7 +827,7 @@ public function output( $args = array(), $widget_args = array(), $content = '' )
(string) esc_attr( $send_bcc ),
(string) esc_attr( $subject ),
(string) absint( $post_id ),
(string) absint( $recaptcha_enabled ),
(string) esc_attr( $recaptcha_enabled ),
(string) esc_attr( $newsletter ),
);

Expand Down Expand Up @@ -1039,17 +1046,19 @@ function bpbb_send_contact_form($form){

if (data.success) {
jQuery($form).html( '<div class="alert alert-success" role="alert">'+$message+'</div>' );
aui_toast('blockstrap_page_management_error','success', $message );
aui_toast('blockstrap_contact_form_success','success', $message );
}else{
var message = data.data ? data.data : '<?php esc_html_e( 'Something went wrong, please try again', 'blockstrap-page-builder-blocks' ); ?>';
aui_toast('blockstrap_contact_corm_error','error', message );
aui_toast('','error', message );
jQuery($form).find('.btn-primary').prop('disabled', false).find('.spinner-border').addClass('d-none');
document.dispatchEvent(new Event('ayecode_reset_captcha'));
}

},
error: function(xhr) { // if error occured
jQuery($form).find('.btn-primary').prop('disabled', false).find('.spinner-border').addClass('d-none');
alert("Error occured.please try again");
document.dispatchEvent(new Event('ayecode_reset_captcha'));
},
complete: function() {
jQuery($form).find('.btn-primary').prop('disabled', false).find('.spinner-border').addClass('d-none');
Expand Down
4 changes: 2 additions & 2 deletions blockstrap-page-builder-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: BlockStrap Page Builder Blocks
* Plugin URI: https://ayecode.io/
* Description: BlockStrap - A FSE page builder for WordPress
* Version: 0.1.30
* Version: 0.1.31
* Author: AyeCode
* Author URI: https://ayecode.io
* Text Domain: blockstrap-page-builder-blocks
Expand All @@ -21,7 +21,7 @@
*/


define( 'BLOCKSTRAP_BLOCKS_VERSION', '0.1.30' );
define( 'BLOCKSTRAP_BLOCKS_VERSION', '0.1.31' );

/**
* The BlockStrap Class
Expand Down
18 changes: 16 additions & 2 deletions classes/class-blockstrap-blocks-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,11 @@ public static function contact_form_block_send() {
$bcc = isset( $_POST['settings'][1] ) ? esc_attr( $_POST['settings'][1] ) : '';
$subject = ! empty( $_POST['settings'][2] ) ? esc_attr( $_POST['settings'][2] ) : $subject;
$post_id = absint( $_POST['settings'][3] );
$recaptcha_enabled = absint( $_POST['settings'][4] );
$recaptcha_enabled = esc_attr( $_POST['settings'][4] );
$newsletter = isset( $_POST['settings'][5] ) ? esc_attr( $_POST['settings'][5] ) : '';

if ( $recaptcha_enabled && empty( $data['g-recaptcha-response'] ) ) {

if ( $recaptcha_enabled && empty( $data[$recaptcha_enabled] ) ) {
wp_send_json_error( __( 'Please complete the recaptcha', 'blockstrap-page-builder-blocks' ) );
wp_die();
} elseif ( $recaptcha_enabled && ! empty( $data['g-recaptcha-response'] ) ) {
Expand Down Expand Up @@ -161,6 +162,19 @@ public static function contact_form_block_send() {
wp_die();
}
}
} elseif ( $recaptcha_enabled && ! empty( $data[$recaptcha_enabled] ) ) {
$valid = apply_filters( 'blockstrap_blocks_contact_form_captcha_valid', false, $data );

if( is_wp_error( $valid ) ){
wp_send_json_error( $valid->get_error_message() );
wp_die();
} elseif ( ! $valid ) {
wp_send_json_error( __( 'Captcha error, please refresh and try again', 'blockstrap-page-builder-blocks' ) );
wp_die();
}

// unset the captcha so it's not sent in the email
unset( $data[$recaptcha_enabled] );
}

$email = self::get_email( $to, $post_id );
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://ayecode.io
Tags: page builder, bootstrap, blocks, builder, design
Requires at least: 6.0
Tested up to: 6.7
Stable tag: 0.1.30
Stable tag: 0.1.31
Requires PHP: 7.2
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -176,6 +176,9 @@ Automatic updates should work seamlessly. To avoid unforeseen problems, we alway

== Changelog ==

= 0.1.31 - 2024-12-12 =
* Changes to better support AyeCode Connect Turnstile Captcha - ADDED

= 0.1.30 - 2024-11-28 =
* Read time can show 0m in some cases - FIXED

Expand Down
6 changes: 3 additions & 3 deletions vendor/ayecode/wp-ayecode-ui/assets-v5/css/ayecode-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
add_action('after_setup_theme', function () {
global $ayecode_ui_version,$ayecode_ui_file_key;
$this_version = "0.2.29";
$this_version = "0.2.30";
if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
$ayecode_ui_version = $this_version ;
$ayecode_ui_file_key = wp_hash( __FILE__ );
Expand Down
3 changes: 3 additions & 0 deletions vendor/ayecode/wp-ayecode-ui/change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
= 0.2.30 - 2024-12-12 =
* Minor JS fix for resetting value of field - FIXED

= 0.2.29 - 2024-11-28 =
* Load Select2 JavaScript only when required - CHANGED

Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-ayecode-ui/example-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: AyeCode UI
Plugin URI: https://ayecode.io/
Description: This is an example plugin to test AyeCode UI Quickly.
Version: 0.2.29
Version: 0.2.30
Author: AyeCode Ltd
Author URI: https://userswp.io
License: GPL-2.0+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AyeCode_UI_Settings {
*
* @var string
*/
public $version = '0.2.29';
public $version = '0.2.30';

/**
* Class textdomain.
Expand Down Expand Up @@ -2959,6 +2959,9 @@ function aui_cf_field_get_default_value($el) {
* Reset field default value.
*/
function aui_cf_field_reset_default_value($el, bHide, setVal) {
if (!($el && $el.length)) {
return;
}
var type = aui_cf_field_get_type($el), key = $el.data('rule-key'), field = aui_cf_field_default_values[key];
if (typeof setVal === 'undefined' || (typeof setVal !== 'undefined' && setVal === null)) {
setVal = field.value;
Expand Down
3 changes: 3 additions & 0 deletions vendor/ayecode/wp-super-duper/change-log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
= 1.2.16 - 2024-12-12 =
* Changes for Bricks output class to add AyeCode UI class and show icons as icon picker - ADDED

= 1.2.15 - 2024-11-28 =
* Class added for Bricks element conversion - ADDED

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public function __construct( $element = null ) {
$this->category = !empty($this->widget->options['textdomain']) ? esc_attr( $this->widget->options['textdomain'] ) : 'Super Duper';
$this->name = $this->widget->id_base;
$this->icon = (strpos($block_icon, 'fa') === 0) ? esc_attr($this->widget->options['block-icon']) : 'fas fa-globe-americas';
// $this->scripts = [ 'bricksIsotope' ];

parent::__construct($element);
}
Expand Down Expand Up @@ -98,11 +97,49 @@ public function sd_get_arguments() {
* @return void
*/
public function render() {
$settings = $this->settings;
$settings = $this->sd_maybe_convert_values( $this->settings );


// set the AyeCode UI calss on the wrapper
$this->set_attribute( '_root', 'class', 'bsui' );

// we might need to add a placeholder here for previews.

// add the bricks attributes to wrapper
echo "<div {$this->render_attributes( '_root' )}>";
echo $this->widget->output($settings);
echo '</div>';
}

/**
* Values can never be arrays so convert if bricks setting make it an array.
*
* @param $settings
* @return mixed
*/
public function sd_maybe_convert_values( $settings ) {


if (!empty($settings)) {
foreach( $settings as $k => $v ) {
if(is_array($v)) {
$value = '';
// is color
if (isset($v['hex'])) {
$value = $v['hex'];
} elseif (isset($v['icon'])) {
$value = $v['icon'];
}


// set the value
$settings[$k] = $value;
}

}
}

return $settings;
}

/**
Expand Down Expand Up @@ -142,6 +179,11 @@ public function sd_convert_arguments()
unset($arg['element_require']);
}

// icons
if ('icon' === $key) {
$arg['type'] = 'icon';
}

$bricks_args[$key] = $arg;

}
Expand Down
4 changes: 2 additions & 2 deletions vendor/ayecode/wp-super-duper/sd-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* @wordpress-plugin
* Plugin Name: Super Duper - Examples
* Description: This is a Hello World test plugin for WP Super Duper Class.
* Version: 1.2.15
* Version: 1.2.16
* Author: AyeCode
* Author URI: https://ayecode.io
* Text Domain: super-duper
* Domain Path: /languages
* Requires at least: 4.5
* Tested up to: 6.6
* Tested up to: 6.7
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion vendor/ayecode/wp-super-duper/wp-super-duper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if ( ! class_exists( 'WP_Super_Duper' ) ) {

define( 'SUPER_DUPER_VER', '1.2.15' );
define( 'SUPER_DUPER_VER', '1.2.16' );

/**
* A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
Expand Down
28 changes: 14 additions & 14 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@
},
{
"name": "ayecode/wp-ayecode-ui",
"version": "0.2.29",
"version_normalized": "0.2.29.0",
"version": "0.2.30",
"version_normalized": "0.2.30.0",
"source": {
"type": "git",
"url": "https://github.com/AyeCode/wp-ayecode-ui.git",
"reference": "e082ff5a19219b783f16a4da9b6c67ef55ad8f79"
"reference": "3c9d60b1ce980ba7985e85cd58fb684b04270cd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/e082ff5a19219b783f16a4da9b6c67ef55ad8f79",
"reference": "e082ff5a19219b783f16a4da9b6c67ef55ad8f79",
"url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/3c9d60b1ce980ba7985e85cd58fb684b04270cd1",
"reference": "3c9d60b1ce980ba7985e85cd58fb684b04270cd1",
"shasum": ""
},
"time": "2024-11-28T12:53:52+00:00",
"time": "2024-12-12T12:42:09+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -101,7 +101,7 @@
],
"support": {
"issues": "https://github.com/AyeCode/wp-ayecode-ui/issues",
"source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.29"
"source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.30"
},
"install-path": "../ayecode/wp-ayecode-ui"
},
Expand Down Expand Up @@ -206,24 +206,24 @@
},
{
"name": "ayecode/wp-super-duper",
"version": "1.2.15",
"version_normalized": "1.2.15.0",
"version": "1.2.16",
"version_normalized": "1.2.16.0",
"source": {
"type": "git",
"url": "https://github.com/AyeCode/wp-super-duper.git",
"reference": "d8a08da82ff7760e73dab21b510ec5a37c0508f7"
"reference": "507e0cdf97c76fb5956c5a508624d586888e8d31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/d8a08da82ff7760e73dab21b510ec5a37c0508f7",
"reference": "d8a08da82ff7760e73dab21b510ec5a37c0508f7",
"url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/507e0cdf97c76fb5956c5a508624d586888e8d31",
"reference": "507e0cdf97c76fb5956c5a508624d586888e8d31",
"shasum": ""
},
"require": {
"composer/installers": "~1.0",
"php": ">=5.4.0"
},
"time": "2024-11-28T12:44:57+00:00",
"time": "2024-12-12T12:38:04+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -255,7 +255,7 @@
],
"support": {
"issues": "https://github.com/AyeCode/wp-super-duper/issues",
"source": "https://github.com/AyeCode/wp-super-duper/tree/1.2.15"
"source": "https://github.com/AyeCode/wp-super-duper/tree/1.2.16"
},
"install-path": "../ayecode/wp-super-duper"
},
Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'ayecode/blockstrap-page-builder-blocks',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '40e56baaea40b2b5c7d2936aee01f786be0708e6',
'reference' => '2dc58d1e1943e03c07f1c3462a71e73f2fd04787',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -22,16 +22,16 @@
'ayecode/blockstrap-page-builder-blocks' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '40e56baaea40b2b5c7d2936aee01f786be0708e6',
'reference' => '2dc58d1e1943e03c07f1c3462a71e73f2fd04787',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'ayecode/wp-ayecode-ui' => array(
'pretty_version' => '0.2.29',
'version' => '0.2.29.0',
'reference' => 'e082ff5a19219b783f16a4da9b6c67ef55ad8f79',
'pretty_version' => '0.2.30',
'version' => '0.2.30.0',
'reference' => '3c9d60b1ce980ba7985e85cd58fb684b04270cd1',
'type' => 'library',
'install_path' => __DIR__ . '/../ayecode/wp-ayecode-ui',
'aliases' => array(),
Expand All @@ -56,9 +56,9 @@
'dev_requirement' => false,
),
'ayecode/wp-super-duper' => array(
'pretty_version' => '1.2.15',
'version' => '1.2.15.0',
'reference' => 'd8a08da82ff7760e73dab21b510ec5a37c0508f7',
'pretty_version' => '1.2.16',
'version' => '1.2.16.0',
'reference' => '507e0cdf97c76fb5956c5a508624d586888e8d31',
'type' => 'library',
'install_path' => __DIR__ . '/../ayecode/wp-super-duper',
'aliases' => array(),
Expand Down

0 comments on commit 88c1d2d

Please sign in to comment.