Skip to content

Commit 0c202ee

Browse files
release: version 2.2.4
- Add Preview for Dynamic Data in the Popover Control - Add New Patterns & Templates - Add New Closing/Opening Anchor Actions in Popup - Add Autoresponder Option to Form Block - WordPress 6.2 Compatibility Testing & Fixes - Fix CSS Class Not Being Removed If Custom CSS Is Empty - Fix Custom CSS Not Reflected on Front-end When Used with FSE - Fix Block Styles Not Loading with Custom Layouts - Fix WooCommerce Blocks Not Working with the Latest Version of Woo
2 parents 865b901 + c0c7713 commit 0c202ee

File tree

46 files changed

+1964
-945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1964
-945
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"phpcompatibility/php-compatibility": "^9",
1010
"dealerdirect/phpcodesniffer-composer-installer": "0.7.1",
1111
"automattic/vipwpcs": "^1.0.0",
12-
"phpunit/phpunit": "7.5.9",
12+
"phpunit/phpunit": "9.6.5",
1313
"yoast/phpunit-polyfills": "^1.0"
1414
},
1515
"license": "GPL-2.0+",

Diff for: composer.lock

+627-595
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: inc/class-base-css.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ public function get_animation_css( $blocks ) {
352352
} else {
353353
$parser = new Parser( file_get_contents( OTTER_BLOCKS_PATH . '/build/animation/index.css' ) ); // phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
354354
}
355-
355+
356356
$content = $parser->parse()->getContents();
357357

358-
set_transient( 'otter_animations_parsed', $content, MONTH_IN_SECONDS );
358+
set_transient( 'otter_animations_parsed', $content, MONTH_IN_SECONDS );
359359
}
360360

361361
$format = OutputFormat::createCompact();
@@ -369,15 +369,15 @@ public function get_animation_css( $blocks ) {
369369
}
370370
continue;
371371
}
372-
372+
373373
/*
374374
* This is used to get the reduced-motion animation styles.
375375
*/
376376
if ( $rule instanceof AtRuleBlockList ) {
377377
if ( false === in_array( $rule->atRuleArgs(), array( '(prefers-reduced-motion:reduce),print', 'screen' ) ) ) {
378378
continue;
379379
}
380-
380+
381381
$style .= $rule->render( $format );
382382
continue;
383383
}

Diff for: inc/class-blocks-css.php

+18-7
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function enqueue_editor_assets() {
4949

5050
wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
5151

52-
wp_add_inline_script(
53-
'wp-codemirror',
52+
wp_add_inline_script(
53+
'wp-codemirror',
5454
'window.CodeMirror = wp.CodeMirror;'
5555
);
5656

@@ -88,7 +88,7 @@ public function enqueue_editor_assets() {
8888

8989
/**
9090
* Render server-side CSS
91-
*
91+
*
9292
* @since 1.0.0
9393
* @access public
9494
*/
@@ -100,7 +100,18 @@ public function render_server_side_css() {
100100
return;
101101
}
102102

103-
$blocks = parse_blocks( $post->post_content );
103+
if (
104+
! defined( 'OTTER_BLOCKS_VERSION' ) &&
105+
get_queried_object() === null &&
106+
function_exists( 'wp_is_block_theme' ) &&
107+
wp_is_block_theme() &&
108+
current_theme_supports( 'block-templates' )
109+
) {
110+
global $_wp_current_template_content;
111+
$blocks = parse_blocks( $_wp_current_template_content );
112+
} else {
113+
$blocks = parse_blocks( $post->post_content );
114+
}
104115

105116
if ( ! is_array( $blocks ) || empty( $blocks ) ) {
106117
return;
@@ -125,7 +136,7 @@ public function render_server_side_css() {
125136
*
126137
* @param array $inner_blocks Array of blocks.
127138
* @param int $id Post ID.
128-
*
139+
*
129140
* @since 1.0.0
130141
* @access public
131142
*/
@@ -188,9 +199,9 @@ public function add_attributes_to_blocks() {
188199
}
189200

190201
/**
191-
* Append Block CSS to Otter's CSS file..
202+
* Append Block CSS to Otter's CSS file.
192203
*
193-
* @param int $block Block.
204+
* @param array $block Block.
194205
*
195206
* @since 1.1.4
196207
* @access public

Diff for: inc/class-registration.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static function () {
8989
wp_enqueue_style( 'font-awesome-5' );
9090
wp_enqueue_style( 'font-awesome-4-shims' );
9191
}
92-
}
92+
},
93+
11
9394
);
9495
}
9596

Diff for: inc/css/class-block-frontend.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ public function enqueue_styles( $post_id = '' ) {
275275
'wp_footer',
276276
function () use ( $post_id ) {
277277
return $this->get_post_css( $post_id );
278-
}
278+
},
279+
'the_content' === current_filter() ? PHP_INT_MAX : 10
279280
);
280281

281282
return;
@@ -290,7 +291,8 @@ function () use ( $post_id ) {
290291
'wp_footer',
291292
function () use ( $post_id ) {
292293
return $this->get_post_css( $post_id );
293-
}
294+
},
295+
'the_content' === current_filter() ? PHP_INT_MAX : 10
294296
);
295297

296298
return;
@@ -321,13 +323,19 @@ function () use ( $post_id ) {
321323
'wp_footer',
322324
function () use ( $post_id ) {
323325
return $this->get_post_css( $post_id );
324-
}
326+
},
327+
'the_content' === current_filter() ? PHP_INT_MAX : 10
325328
);
326329

327330
$this->total_inline_size += (int) $file_size;
328331
return;
329332
}
330333

334+
if ( 'the_content' === current_filter() ) {
335+
wp_enqueue_style( 'otter-' . $file_name, $file_url, array(), OTTER_BLOCKS_VERSION );
336+
return;
337+
}
338+
331339
add_action(
332340
'wp_footer',
333341
function () use ( $file_name, $file_url, $file_path ) {

Diff for: inc/integrations/class-form-settings-data.php

+41
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ class Form_Settings_Data {
105105
*/
106106
private $bcc = '';
107107

108+
/**
109+
* The autoresponder data.
110+
*
111+
* @var array
112+
*/
113+
private $autoresponder = array();
114+
108115
/**
109116
* The default constructor.
110117
*
@@ -209,6 +216,9 @@ public static function get_form_setting_from_wordpress_options( $form_option ) {
209216
if ( isset( $form['bcc'] ) ) {
210217
$integration->set_bcc( $form['bcc'] );
211218
}
219+
if ( isset( $form['autoresponder'] ) ) {
220+
$integration->set_autoresponder( $form['autoresponder'] );
221+
}
212222
if ( isset( $form['integration'] ) ) {
213223
$integration->extract_integration_data( $form['integration'] );
214224
}
@@ -371,6 +381,16 @@ public function has_from_name() {
371381
return isset( $this->from_name ) && '' !== $this->from_name;
372382
}
373383

384+
/**
385+
* Check if it has an autoresponder.
386+
*
387+
* @return bool
388+
* @since 2.0.3
389+
*/
390+
public function has_autoresponder() {
391+
return isset( $this->autoresponder ) && ! empty( $this->autoresponder );
392+
}
393+
374394
/**
375395
* Set the redirect link.
376396
*
@@ -596,4 +616,25 @@ public function set_bcc( $bcc ) {
596616
$this->bcc = $bcc;
597617
return $this;
598618
}
619+
620+
/**
621+
* Get the autoresponder.
622+
*
623+
* @return array
624+
*/
625+
public function get_autoresponder() {
626+
return $this->autoresponder;
627+
}
628+
629+
/**
630+
* Set the autoresponder.
631+
*
632+
* @param array $autoresponder The email bcc.
633+
* @return Form_Settings_Data
634+
*/
635+
public function set_autoresponder( $autoresponder ) {
636+
$this->autoresponder = $autoresponder;
637+
return $this;
638+
}
639+
599640
}

Diff for: inc/plugins/class-options-settings.php

+35
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ function ( $item ) {
294294
if ( isset( $item['bcc'] ) ) {
295295
$item['bcc'] = sanitize_text_field( $item['bcc'] );
296296
}
297+
if ( isset( $item['autoresponder']['body'] ) ) {
298+
$item['autoresponder']['body'] = wp_kses( $item['autoresponder']['body'], $this::get_allowed_mail_html() );
299+
}
300+
if ( isset( $item['autoresponder']['subject'] ) ) {
301+
$item['autoresponder']['subject'] = sanitize_text_field( $item['autoresponder']['subject'] );
302+
}
297303
if ( isset( $item['submitMessage'] ) ) {
298304
$item['submitMessage'] = sanitize_text_field( $item['submitMessage'] );
299305
}
@@ -353,6 +359,17 @@ function ( $item ) {
353359
'bcc' => array(
354360
'type' => 'string',
355361
),
362+
'autoresponder' => array(
363+
'type' => 'object',
364+
'properties' => array(
365+
'subject' => array(
366+
'type' => 'string',
367+
),
368+
'body' => array(
369+
'type' => 'string',
370+
),
371+
),
372+
),
356373
'integration' => array(
357374
'type' => 'object',
358375
'properties' => array(
@@ -463,6 +480,24 @@ public function default_block() {
463480
);
464481
}
465482

483+
/**
484+
* Get allowed HTML for mail body.
485+
*
486+
* @static
487+
* @access public
488+
* @return array
489+
*/
490+
public static function get_allowed_mail_html() {
491+
$allowed_html = wp_kses_allowed_html( 'post' );
492+
493+
$not_allowed_tags = array( 'input', 'label', 'form', 'select', 'textarea', 'button', 'fieldset', 'legend', 'datalist', 'output', 'option', 'optgroup', 'video', 'audio' );
494+
foreach ( $not_allowed_tags as $tag ) {
495+
unset( $allowed_html[ $tag ] );
496+
}
497+
498+
return $allowed_html;
499+
}
500+
466501
/**
467502
* The instance method for the static class.
468503
* Defines and returns the instance of the static class.

Diff for: inc/server/class-form-server.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function frontend( $request ) {
248248
do_action( 'otter_form_after_submit', $form_data );
249249
} else {
250250
$res->set_code( Form_Data_Response::ERROR_BOT_DETECTED );
251-
}
251+
}
252252
} catch ( Exception $e ) {
253253
$res->set_code( Form_Data_Response::ERROR_RUNTIME_ERROR );
254254
$res->add_reason( $e->getMessage() );
@@ -728,10 +728,11 @@ public function build_email_error_content( $error, $content ) {
728728
* Get the first email from the input's form.
729729
*
730730
* @param Form_Data_Request $data The form data.
731+
*
731732
* @return mixed|string
732733
* @since 2.0.3
733734
*/
734-
private function get_email_from_form_input( Form_Data_Request $data ) {
735+
public function get_email_from_form_input( Form_Data_Request $data ) {
735736
$inputs = $data->get_payload_field( 'formInputsData' );
736737
if ( is_array( $inputs ) ) {
737738
foreach ( $data->get_payload_field( 'formInputsData' ) as $input_field ) {

Diff for: plugins/blocks-animation/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: themeisle, hardeepasrani, mariamunteanu1
33
Tags: gutenberg, block, block editor, editor, animation, animations, animate, styles, block animations
44
Requires at least: 5.9
5-
Tested up to: 6.1
5+
Tested up to: 6.2
66
Requires PHP: 5.4
77
Stable tag: trunk
88
License: GPLv3

Diff for: plugins/blocks-css/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: themeisle, hardeepasrani
33
Tags: gutenberg, block, css, css editor, blocks css
44
Requires at least: 5.9
5-
Tested up to: 6.1
5+
Tested up to: 6.2
66
Requires PHP: 5.4
77
Stable tag: trunk
88
License: GPLv3

Diff for: plugins/blocks-export-import/readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: themeisle, hardeepasrani
33
Tags: gutenberg, block, blocks, export, import, exporter, importer, block exporter, block export, block import, block importer
44
Requires at least: 5.9
5-
Tested up to: 6.1
5+
Tested up to: 6.2
66
Requires PHP: 5.4
77
Stable tag: trunk
88
License: GPLv3

Diff for: plugins/otter-pro/inc/class-main.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function init() {
4848
/**
4949
* Autoload classes.
5050
*
51-
* @param string $classnames Block Classnames.
51+
* @param array $classnames Block Classnames.
5252
*
5353
* @since 2.0.1
5454
* @access public
@@ -58,6 +58,7 @@ public function autoload_classes( $classnames ) {
5858
'\ThemeIsle\OtterPro\Plugins\Block_Conditions',
5959
'\ThemeIsle\OtterPro\Plugins\Dynamic_Content',
6060
'\ThemeIsle\OtterPro\Plugins\Fonts_Module',
61+
'\ThemeIsle\OtterPro\Plugins\Form_Block',
6162
'\ThemeIsle\OtterPro\Plugins\License',
6263
'\ThemeIsle\OtterPro\Plugins\Live_Search',
6364
'\ThemeIsle\OtterPro\Plugins\Options_Settings',
@@ -177,7 +178,7 @@ public function enqueue_block_editor_assets() {
177178
$asset_file['version'],
178179
true
179180
);
180-
181+
181182
wp_set_script_translations( 'otter-pro', 'otter-pro' );
182183

183184
wp_localize_script(

0 commit comments

Comments
 (0)