Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/otter-blocks/build/blocks/blocks.asset.php
+++ b/otter-blocks/build/blocks/blocks.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-primitives', 'wp-rich-text', 'wp-server-side-render', 'wp-url'), 'version' => '0215a545317599238a1d');
+<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-primitives', 'wp-rich-text', 'wp-server-side-render', 'wp-url'), 'version' => '5069d4fcffd3d15125ad');
--- a/otter-blocks/inc/class-main.php
+++ b/otter-blocks/inc/class-main.php
@@ -30,7 +30,7 @@
*/
public function init() {
if ( ! defined( 'THEMEISLE_BLOCKS_VERSION' ) ) {
- define( 'THEMEISLE_BLOCKS_VERSION', '3.2.12' );
+ define( 'THEMEISLE_BLOCKS_VERSION', '3.2.13' );
}
add_action( 'init', array( $this, 'autoload_classes' ), 9 );
--- a/otter-blocks/inc/css/class-css-utility.php
+++ b/otter-blocks/inc/css/class-css-utility.php
@@ -296,7 +296,13 @@
}
$value = $value . $pattern_value['unit'];
- $pattern = preg_replace( '/b' . $value_key . 'b/', $value, $pattern );
+ $pattern = preg_replace_callback(
+ '/b' . $value_key . 'b/',
+ function () use ( $value ) {
+ return $value;
+ },
+ $pattern
+ );
}
}
--- a/otter-blocks/inc/integrations/class-form-email.php
+++ b/otter-blocks/inc/integrations/class-form-email.php
@@ -275,6 +275,9 @@
* @since 2.0.3
*/
public function build_test_email( $form_data ) {
+ $site = $form_data->get_data_from_payload( 'site' );
+ $site = is_string( $site ) ? esc_url( $site, array( 'http', 'https' ) ) : '';
+
return sprintf(
'
<!doctype html>
@@ -295,14 +298,14 @@
',
sprintf(
// translators: %s is the admin email address.
- __( 'Mail From: %s', 'otter-blocks' ),
- sanitize_email( get_option( 'admin_email' ) )
+ esc_html__( 'Mail From: %s', 'otter-blocks' ),
+ esc_html( sanitize_email( get_option( 'admin_email' ) ) )
),
esc_html__( 'This a test email. If you receive this email, your SMTP set-up is working for sending emails via Form Block.', 'otter-blocks' ),
sprintf(
// translators: %s is the URL of the site from which the email was sent.
- __( 'Location: %s', 'otter-blocks' ),
- '<a href="' . $form_data->get_data_from_payload( 'site' ) . '">' . esc_html__( 'link', 'otter-blocks' ) . '</a>'
+ esc_html__( 'Location: %s', 'otter-blocks' ),
+ '<a href="' . $site . '">' . esc_html__( 'link', 'otter-blocks' ) . '</a>'
)
);
}
--- a/otter-blocks/inc/integrations/class-form-settings-data.php
+++ b/otter-blocks/inc/integrations/class-form-settings-data.php
@@ -248,6 +248,21 @@
}
/**
+ * Resolve the settings key for a Form block, including forms not opened in the editor.
+ *
+ * @param array<string, mixed> $attributes Parsed block attributes.
+ * @phpstan-param array{optionName?: mixed, id?: mixed, ...} $attributes
+ * @return string
+ */
+ public static function get_form_option_name( array $attributes ) {
+ if ( isset( $attributes['optionName'] ) && is_string( $attributes['optionName'] ) && '' !== $attributes['optionName'] ) {
+ return $attributes['optionName'];
+ }
+
+ return isset( $attributes['id'] ) && is_string( $attributes['id'] ) ? $attributes['id'] : '';
+ }
+
+ /**
* Get the 3rd party integration settings from WP options given the form option ID.
*
* @param string $form_option The ID of the form.
--- a/otter-blocks/inc/plugins/class-abilities.php
+++ b/otter-blocks/inc/plugins/class-abilities.php
@@ -11,6 +11,7 @@
namespace ThemeIsleGutenbergBlocksPlugins;
use ThemeIsleGutenbergBlocksPro;
+use ThemeIsleGutenbergBlocksIntegrationForm_Settings_Data;
use WP_Error;
use WP_Query;
@@ -724,7 +725,7 @@
foreach ( $this->find_blocks( parse_blocks( $post->post_content ), array( self::FORM_BLOCK ) ) as $block ) {
$attrs = isset( $block['attrs'] ) && is_array( $block['attrs'] ) ? $block['attrs'] : array();
- $form_id = isset( $attrs['optionName'] ) && is_string( $attrs['optionName'] ) ? $attrs['optionName'] : '';
+ $form_id = Form_Settings_Data::get_form_option_name( $attrs );
$block_id = isset( $attrs['id'] ) && is_string( $attrs['id'] ) ? $attrs['id'] : '';
$saved = isset( $settings[ $form_id ] ) ? $settings[ $form_id ] : array();
--- a/otter-blocks/inc/plugins/class-atomic-wind-blocks.php
+++ b/otter-blocks/inc/plugins/class-atomic-wind-blocks.php
@@ -1428,7 +1428,7 @@
break;
}
if ( $value ) {
- $escaped = esc_html( $value );
+ $escaped = Dynamic_Content::instance()->escape_comment_magic_tags( esc_html( $value ) );
$block_content = preg_replace_callback(
'/^s*(<[^>]+>).*(</[a-zA-Z0-9]+>)s*$/s',
function ( $m ) use ( $escaped ) {
@@ -1466,11 +1466,11 @@
break;
}
if ( $url ) {
- $href = 'href="' . esc_url( $url ) . '"';
+ $href = esc_url( $url );
if ( false !== strpos( $block_content, 'href="' ) ) {
- $block_content = preg_replace( '/href="[^"]*"/', $href, $block_content );
+ $block_content = $this->replace_attribute( $block_content, 'href', $href );
} else {
- $block_content = preg_replace( '/^(s*<ab)/', '$1 ' . $href, $block_content );
+ $block_content = $this->append_to_opening_tag( $block_content, '/^(s*<ab)/', ' href="' . Dynamic_Content::instance()->escape_comment_magic_tags( $href ) . '"' );
}
}
} elseif ( 'atomic-wind/image' === $block_name ) {
@@ -1484,14 +1484,14 @@
if ( ! $alt ) {
$alt = get_the_title();
}
- $block_content = preg_replace( '/src="[^"]*"/', 'src="' . esc_url( $src ) . '"', $block_content );
- $block_content = preg_replace( '/alt="[^"]*"/', 'alt="' . esc_attr( $alt ) . '"', $block_content );
+ $block_content = $this->replace_attribute( $block_content, 'src', esc_url( $src ) );
+ $block_content = $this->replace_attribute( $block_content, 'alt', esc_attr( $alt ) );
} elseif ( 'author_avatar' === $post_field ) {
$avatar_url = get_avatar_url( get_the_author_meta( 'ID' ), array( 'size' => 256 ) );
if ( $avatar_url ) {
$alt = get_the_author();
- $block_content = preg_replace( '/src="[^"]*"/', 'src="' . esc_url( $avatar_url ) . '"', $block_content );
- $block_content = preg_replace( '/alt="[^"]*"/', 'alt="' . esc_attr( $alt ) . '"', $block_content );
+ $block_content = $this->replace_attribute( $block_content, 'src', esc_url( $avatar_url ) );
+ $block_content = $this->replace_attribute( $block_content, 'alt', esc_attr( $alt ) );
}
}
}
@@ -1500,6 +1500,49 @@
}
/**
+ * Replace the value of every `$attribute="..."` in the markup.
+ *
+ * Dynamic markers in the value are kept literal, so a parent block's render does not resolve them.
+ *
+ * @param string $html Block markup.
+ * @param string $attribute Attribute name.
+ * @param string $escaped_value Value already escaped for the attribute.
+ * @return string
+ */
+ private function replace_attribute( $html, $attribute, $escaped_value ) {
+ $escaped_value = Dynamic_Content::instance()->escape_comment_magic_tags( $escaped_value );
+
+ // A callback, so `$0` or ` ` in the value is not read as a backreference.
+ return (string) preg_replace_callback(
+ '/' . $attribute . '="[^"]*"/',
+ function () use ( $attribute, $escaped_value ) {
+ return $attribute . '="' . $escaped_value . '"';
+ },
+ $html
+ );
+ }
+
+ /**
+ * Insert attribute markup after the opening tag name the pattern's first group matches.
+ *
+ * @param string $html Block markup.
+ * @param string $pattern Pattern anchored at the start, capturing the tag name.
+ * @param string $attrs Escaped attribute markup, with a leading space.
+ * @return string
+ */
+ private function append_to_opening_tag( $html, $pattern, $attrs ) {
+ // A callback, so `$1` or `1` in an attribute value is not read as a backreference.
+ return (string) preg_replace_callback(
+ $pattern,
+ function ( $m ) use ( $attrs ) {
+ return $m[1] . $attrs;
+ },
+ $html,
+ 1
+ );
+ }
+
+ /**
* Inject data-animation attributes into server-rendered blocks.
*
* @param string $block_content Block content.
@@ -1532,7 +1575,7 @@
$attrs .= ' data-animation-delay="' . esc_attr( $delay ) . '"';
}
- return preg_replace( '/^(<[a-zA-Z][a-zA-Z0-9]*)b/', '$1' . $attrs, $block_content, 1 );
+ return $this->append_to_opening_tag( $block_content, '/^(<[a-zA-Z][a-zA-Z0-9]*)b/', $attrs );
}
/**
@@ -1591,7 +1634,7 @@
return $block_content;
}
- return preg_replace( '/^(s*<[a-zA-Z][a-zA-Z0-9]*)b/', '$1' . $attrs, $block_content, 1 );
+ return $this->append_to_opening_tag( $block_content, '/^(s*<[a-zA-Z][a-zA-Z0-9]*)b/', $attrs );
}
/**
--- a/otter-blocks/inc/plugins/class-dynamic-content.php
+++ b/otter-blocks/inc/plugins/class-dynamic-content.php
@@ -25,6 +25,11 @@
const MAGIC_TAG_REGEX = '{(otterDynamic?[^"'<>}]*)}';
/**
+ * Any marker a resolver acts on, tokenized as the resolvers read it.
+ */
+ const MARKER_TOKEN_REGEX = '/{otterDynamic?[^"'<>}]*}|otterDynamicLink[^"'<>]*|otter/v1/dynamic[^"'<>]*|<o-dynamic(?:-link)?b[^>]*>/';
+
+ /**
* Literal representations of dynamic marker prefixes.
*
* @var array<string, string>
@@ -44,10 +49,22 @@
private static $rendering_content = array();
/**
+ * Saved menu the Navigation block being rendered refers to, or 0.
+ *
+ * @var int
+ */
+ private static $navigation_menu_ref = 0;
+
+ /**
* Initialize the class
*/
public function init() {
- add_filter( 'render_block', array( $this, 'escape_visitor_block_magic_tags' ), 9, 2 );
+ add_filter( 'render_block_data', array( $this, 'register_authored_block' ), PHP_INT_MAX, 3 );
+ add_filter( 'register_block_type_args', array( $this, 'protect_render_attributes' ) );
+ add_filter( 'wp_kses_allowed_html', array( $this, 'allow_authored_elements' ), PHP_INT_MAX );
+ add_filter( 'block_core_navigation_render_inner_blocks', array( $this, 'register_navigation_menu_blocks' ) );
+ add_filter( 'block_bindings_source_value', array( $this, 'escape_bound_value_magic_tags' ), 10, 5 );
+ add_filter( 'render_block', array( $this, 'escape_visitor_block_magic_tags' ), 9, 3 );
add_filter( 'render_block', array( $this, 'apply_dynamic_content' ) );
add_filter( 'render_block', array( $this, 'apply_dynamic_magic_tags' ) );
add_filter( 'render_block', array( $this, 'apply_dynamic_link' ) );
@@ -63,55 +80,329 @@
add_filter( 'wp_generate_tag_cloud_data', array( $this, 'escape_tag_cloud_magic_tags' ) );
add_filter( 'wp_setup_nav_menu_item', array( $this, 'escape_taxonomy_menu_magic_tags' ) );
add_filter( 'list_cats', array( $this, 'escape_comment_magic_tags' ) );
- foreach ( array( 'get_avatar', 'the_author', 'get_the_author_display_name', 'get_the_author_description', 'get_the_author_user_description', 'comment_form_field_author', 'comment_form_field_email', 'comment_form_field_url', 'comment_form_logged_in' ) as $hook ) {
+ // After core builds a missing excerpt from the content.
+ add_filter( 'get_the_excerpt', array( $this, 'escape_comment_magic_tags' ), 20 );
+ add_filter( 'wp_get_attachment_image_attributes', array( $this, 'escape_image_alt_magic_tags' ) );
+ // Before WooCommerce renders blocks in the short description.
+ add_filter( 'woocommerce_short_description', array( $this, 'escape_comment_magic_tags' ), 8 );
+ foreach ( array( 'the_title', 'get_the_archive_title', 'woocommerce_product_get_name', 'woocommerce_product_variation_get_name', 'woocommerce_product_get_short_description', 'woocommerce_product_get_sku', 'woocommerce_product_variation_get_sku', 'get_avatar', 'the_author', 'get_the_author_display_name', 'get_the_author_description', 'get_the_author_user_description', 'comment_form_field_author', 'comment_form_field_email', 'comment_form_field_url', 'comment_form_logged_in' ) as $hook ) {
add_filter( $hook, array( $this, 'escape_comment_magic_tags' ) );
}
}
/**
- * Protect rendered visitor values before the generic Magic Tag filters run.
+ * Mark saved inputs before renderers mix them with stored or remote data.
*
- * @param string $content Rendered markup.
- * @param array{blockName?: mixed, attrs?: array{id?: string, idBase?: string}} $block Parsed block.
- * @return string
+ * @param array<string, mixed> $parsed_block Parsed block.
+ * @param array<string, mixed>|null $source_block Parsed block before filters, or null for direct HTML rendering.
+ * @param WP_Block|null $parent_block Parent block.
+ * @return array<string, mixed>
*/
- public function escape_visitor_block_magic_tags( $content, $block ) {
- if ( ! isset( $block['blockName'] ) || ! is_string( $block['blockName'] ) ) {
- return $content;
+ public function register_authored_block( $parsed_block, $source_block = null, $parent_block = null ) {
+ if ( isset( $parsed_block['blockName'] ) && 'core/navigation' === $parsed_block['blockName'] ) {
+ self::$navigation_menu_ref = isset( $parsed_block['attrs']['ref'] ) ? (int) $parsed_block['attrs']['ref'] : 0;
}
- if ( 'core/term-description' === $block['blockName'] ) {
- return $this->escape_comment_magic_tags( $content );
+ // Parsed attributes also feed context and parent renderers' state; mark them only for HTML callbacks.
+ return $this->mark_authored_block( $parsed_block, null === $source_block );
+ }
+
+ /**
+ * Protect explicit attributes even when a dynamic block is rendered directly by WP_Block.
+ *
+ * @param array<string, mixed> $args Block registration arguments, as defined by WordPress.
+ * @return array<string, mixed>
+ */
+ public function protect_render_attributes( $args ) {
+ if ( ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) {
+ return $args;
}
- $patterns = array(
- 'core/avatar' => '/(<ab[^>]*saria-label=")([^"]*)(")/',
- 'core/search' => '/(<inputb(?=[^>]*stype="(?:search|text)")(?=[^>]*sname="s")[^>]*svalue=")([^"]*)(")/',
- 'core/query-title' => '/(>)([^<]*)(<)/',
- 'core/post-terms' => '/(<ab[^>]*>)([^<]*)(</a>)/',
- 'core/term-name' => '/(>)([^<]*)(<)/',
- );
- if ( 'core/legacy-widget' === $block['blockName'] ) {
- $widget = isset( $block['attrs']['idBase'] ) ? $block['attrs']['idBase'] : '';
- if ( isset( $block['attrs']['id'] ) ) {
- $widget = $block['attrs']['id'];
+ $render = $args['render_callback'];
+ $args['render_callback'] = function ( $attributes, $content, $block ) use ( $render ) {
+ $original = $block->attributes;
+ $wrapper_block = WP_Block_Supports::$block_to_render;
+ $marked = $this->mark_authored_block( array( 'attrs' => $attributes ) );
+ $block->attributes = $marked['attrs'];
+ WP_Block_Supports::$block_to_render = array( 'attrs' => $marked['attrs'] ) + $block->parsed_block;
+ try {
+ return call_user_func( $render, $marked['attrs'], $content, $block );
+ } finally {
+ $block->attributes = $original;
+ WP_Block_Supports::$block_to_render = $wrapper_block;
}
- if ( 'search' === _get_widget_id_base( $widget ) ) {
- // A null form filter makes core use its unfiltered fallback markup.
- $patterns['core/legacy-widget'] = '/(<formb)(.*?)(</form>)/is';
+ };
+
+ return $args;
+ }
+
+ /**
+ * Mark saved Navigation menu blocks; fallback items built from pages or classic menus remain data.
+ *
+ * @param WP_Block_List $inner_blocks Blocks the Navigation block renders.
+ * @return WP_Block_List
+ */
+ public function register_navigation_menu_blocks( $inner_blocks ) {
+ $menu = self::$navigation_menu_ref ? get_post( self::$navigation_menu_ref ) : null;
+ self::$navigation_menu_ref = 0;
+ if ( $menu instanceof WP_Post && 'wp_navigation' === $menu->post_type ) {
+ $this->mark_navigation_blocks( $inner_blocks );
+ }
+
+ return $inner_blocks;
+ }
+
+ /**
+ * Update existing Navigation instances without losing their inherited context.
+ *
+ * @param WP_Block_List $blocks Saved menu blocks.
+ * @return void
+ */
+ private function mark_navigation_blocks( $blocks ) {
+ foreach ( $blocks as $block ) {
+ $block->parsed_block = $this->mark_authored_block( $block->parsed_block, false );
+ $block->inner_html = $block->parsed_block['innerHTML'];
+ $block->inner_content = $block->parsed_block['innerContent'];
+ $this->mark_navigation_blocks( $block->inner_blocks );
+ }
+ }
+
+ /**
+ * Carry provenance through HTML/URL escaping without granting equal data markers permission to resolve.
+ *
+ * The image prefix remains recognizable to CSS image resolvers that run before render_block.
+ *
+ * @return array<string, string>
+ */
+ private static function authored_prefixes() {
+ static $prefixes = null;
+ if ( null === $prefixes ) {
+ $nonce = strtolower( self::unguessable_placeholder( 'otterauthored' ) );
+ $prefixes = array(
+ '{otterDynamic?' => '{' . $nonce . '?',
+ 'otterDynamicLink' => $nonce . 'link',
+ 'otter/v1/dynamic' => 'otter/v1/dynamic/' . $nonce,
+ '<o-dynamic' => '<' . $nonce . 'element',
+ );
+ }
+
+ return $prefixes;
+ }
+
+ /**
+ * Mark a whole tree because older core versions construct children before filtering them.
+ *
+ * @param array<string, mixed> $block Parsed block.
+ * @param bool $mark_attributes Whether attributes are being consumed by an HTML renderer.
+ * @return array<string, mixed>
+ */
+ private function mark_authored_block( $block, $mark_attributes = true ) {
+ $prefixes = self::authored_prefixes();
+ // strtr uses the longest key, keeping already marked image URLs unchanged.
+ $replacements = array_combine( array_values( $prefixes ), array_values( $prefixes ) ) + $prefixes;
+ $replace = static function ( &$value ) use ( $replacements ) {
+ if ( is_string( $value ) ) {
+ $value = strtr( $value, $replacements );
}
+ };
+ if ( $mark_attributes && isset( $block['attrs'] ) ) {
+ $attributes = array_diff_key( $block['attrs'], self::data_bound_attributes( $block ), array( 'metadata' => true ) );
+ array_walk_recursive( $attributes, $replace );
+ $block['attrs'] = array_replace( $block['attrs'], $attributes );
+ }
+
+ foreach ( array( 'innerContent', 'innerHTML' ) as $key ) {
+ if ( isset( $block[ $key ] ) ) {
+ if ( is_array( $block[ $key ] ) ) {
+ array_walk_recursive( $block[ $key ], $replace );
+ } else {
+ $replace( $block[ $key ] );
+ }
+ }
+ }
+ if ( isset( $block['innerBlocks'] ) ) {
+ $block['innerBlocks'] = array_map(
+ function ( $inner_block ) use ( $mark_attributes ) {
+ return $this->mark_authored_block( $inner_block, $mark_attributes );
+ },
+ $block['innerBlocks']
+ );
+ }
+
+ return $block;
+ }
+
+ /**
+ * Keep markers literal in rich text a block binding reads from post meta or another data source.
+ *
+ * Core inserts rich text as HTML, so the escaped prefix displays as written. An attribute value is escaped again
+ * when core sets it, so the render gate handles those instead. Pattern overrides
+ * are the post's own content, so their markers stay authored.
+ *
+ * @param mixed $value Bound value.
+ * @param string $source_name Binding source.
+ * @param array<mixed> $source_args Binding arguments.
+ * @param WP_Block|null $block_instance Bound block.
+ * @param string $attribute_name Bound attribute.
+ * @return mixed
+ */
+ public function escape_bound_value_magic_tags( $value, $source_name, $source_args = array(), $block_instance = null, $attribute_name = '' ) {
+ if ( ! is_string( $value ) || 'core/pattern-overrides' === $source_name || ! $block_instance instanceof WP_Block || null === $block_instance->block_type ) {
+ return $value;
}
- if ( ! isset( $patterns[ $block['blockName'] ] ) ) {
+
+ $schema = isset( $block_instance->block_type->attributes[ $attribute_name ] ) ? $block_instance->block_type->attributes[ $attribute_name ] : array();
+
+ return isset( $schema['source'] ) && in_array( $schema['source'], array( 'rich-text', 'html' ), true ) ? $this->escape_comment_magic_tags( $value ) : $value;
+ }
+
+ /**
+ * Keep markers literal in HTML attributes whose value a block binding read from a data source.
+ *
+ * Only the bound attribute is changed, so the same marker written into another attribute still resolves.
+ *
+ * @param string $content Rendered markup.
+ * @param array<string, mixed> $block Parsed block.
+ * @param WP_Block|null $instance Block instance.
+ * @return string
+ */
+ private function escape_bound_attribute_markers( $content, $block, $instance ) {
+ if ( ! $instance instanceof WP_Block || null === $instance->block_type ) {
return $content;
}
- return preg_replace_callback(
- $patterns[ $block['blockName'] ],
- function ( $matches ) {
- return $matches[1] . $this->escape_comment_magic_tags( $matches[2] ) . $matches[3];
+ foreach ( array_keys( self::data_bound_attributes( $block ) ) as $name ) {
+ $schema = isset( $instance->block_type->attributes[ $name ] ) ? $instance->block_type->attributes[ $name ] : array();
+ $value = isset( $instance->attributes[ $name ] ) ? $instance->attributes[ $name ] : null;
+ if ( is_string( $value ) && isset( $schema['source'], $schema['attribute'] ) && 'attribute' === $schema['source'] && preg_match( self::MARKER_TOKEN_REGEX, $value ) ) {
+ $content = $this->escape_markers_in_attribute( $content, $schema['attribute'], $value );
+ }
+ }
+
+ return $content;
+ }
+
+ /**
+ * Escape the markers in every HTML attribute of the given name that holds the given value.
+ *
+ * The HTML API escapes what it sets, so the value goes in with placeholders that are swapped for the escapes after.
+ *
+ * @param string $content Markup.
+ * @param string $attribute HTML attribute name.
+ * @param string $value Decoded attribute value.
+ * @return string
+ */
+ private function escape_markers_in_attribute( $content, $attribute, $value ) {
+ $placeholders = array();
+ $escapes = array();
+ foreach ( self::$literal_marker_escapes as $prefix => $escape ) {
+ $placeholder = self::unguessable_placeholder( 'otter-bound-' );
+ $placeholders[ $prefix ] = $placeholder;
+ $escapes[ $placeholder ] = $escape;
+ }
+
+ // WordPress 6.6 returns raw CR/CRLF from get_attribute(), while 6.7+ normalizes to LF.
+ $normalized_value = str_replace( array( "rn", "r" ), "n", $value );
+ $processor = new WP_HTML_Tag_Processor( $content );
+ while ( $processor->next_tag() ) {
+ $current = $processor->get_attribute( $attribute );
+ if ( is_string( $current ) && str_replace( array( "rn", "r" ), "n", $current ) === $normalized_value ) {
+ $processor->set_attribute( $attribute, strtr( $normalized_value, $placeholders ) );
+ }
+ }
+
+ return strtr( $processor->get_updated_html(), $escapes );
+ }
+
+ /**
+ * Escape data markers before restoring only the prefixes marked on block inputs.
+ *
+ * @param string $content Rendered markup.
+ * @param array<string, mixed> $block Parsed block.
+ * @param WP_Block|null $instance Block instance.
+ * @return string
+ */
+ public function escape_visitor_block_magic_tags( $content, $block, $instance = null ) {
+ $content = $this->escape_bound_attribute_markers( $content, $block, $instance );
+ $prefixes = self::authored_prefixes();
+ $content = (string) preg_replace_callback(
+ self::MARKER_TOKEN_REGEX,
+ function ( $matches ) use ( $prefixes ) {
+ return 0 === strpos( $matches[0], $prefixes['otter/v1/dynamic'] ) ? $matches[0] : $this->escape_comment_magic_tags( $matches[0] );
},
$content
);
+
+ return $this->restore_authored_markers( $content );
+ }
+
+ /**
+ * Restore marked prefixes without resolving their dynamic values.
+ *
+ * @param string $content Marked text or markup.
+ * @return string
+ */
+ public function restore_authored_markers( $content ) {
+ $prefixes = self::authored_prefixes();
+ $restored = array_flip( $prefixes );
+ foreach ( $prefixes as $original => $marked ) {
+ $restored[ esc_attr( $marked ) ] = esc_attr( $original );
+ }
+
+ return strtr( $content, $restored );
+ }
+
+ /**
+ * Restore saved attributes for consumers outside the HTML render pipeline.
+ *
+ * @param array<string, mixed> $attributes Marked block attributes.
+ * @return array<string, mixed>
+ */
+ public function restore_authored_attributes( $attributes ) {
+ return map_deep(
+ $attributes,
+ function ( $value ) {
+ return is_string( $value ) ? $this->restore_authored_markers( $value ) : $value;
+ }
+ );
+ }
+
+ /**
+ * Give marked Dynamic Value elements the same KSES policy as their saved forms.
+ *
+ * @param array<string, array<string, mixed>> $tags Allowed elements and attributes.
+ * @return array<string, array<string, mixed>>
+ */
+ public function allow_authored_elements( $tags ) {
+ $prefixes = self::authored_prefixes();
+ $marked = substr( $prefixes['<o-dynamic'], 1 );
+ foreach ( array(
+ 'o-dynamic' => $marked,
+ 'o-dynamic-link' => $marked . '-link',
+ ) as $original => $element ) {
+ if ( isset( $tags[ $original ] ) ) {
+ $tags[ $element ] = $tags[ $original ];
+ }
+ }
+
+ return $tags;
+ }
+
+ /**
+ * Attributes whose value a binding reads from a data source rather than the post's own pattern overrides.
+ *
+ * @param array<string, mixed> $block Parsed block.
+ * @return array<string, true>
+ */
+ private static function data_bound_attributes( $block ) {
+ $bound = array();
+ foreach ( isset( $block['attrs']['metadata']['bindings'] ) ? $block['attrs']['metadata']['bindings'] : array() as $attribute => $binding ) {
+ if ( ! isset( $binding['source'] ) || 'core/pattern-overrides' !== $binding['source'] ) {
+ $bound[ $attribute ] = true;
+ }
+ }
+
+ return $bound;
}
/**
@@ -154,6 +445,20 @@
}
/**
+ * Keep an attachment image's alt text literal.
+ *
+ * @param array<string, string> $attr Image attributes.
+ * @return array<string, string>
+ */
+ public function escape_image_alt_magic_tags( $attr ) {
+ if ( isset( $attr['alt'] ) ) {
+ $attr['alt'] = $this->escape_comment_magic_tags( $attr['alt'] );
+ }
+
+ return $attr;
+ }
+
+ /**
* Keep breadcrumb labels literal without changing their links or allowed markup.
*
* @param array<array{label: string, url?: string, allow_html?: bool}> $items Breadcrumb items.
@@ -365,6 +670,9 @@
$escaped_literals[ wp_kses_normalize_entities( $prefix ) ] = $prefix;
}
$markup = $this->protect_literals( $matches['tag'], $escaped_literals, $literal_markers );
+ // Attribute values are decoded below, so only openers written literally may resolve.
+ $opener = self::unguessable_placeholder( 'otter-opener-' );
+ $markup = str_replace( '{otterDynamic?', $opener, $markup );
$closing_tag = '</' . $tag[1] . '>';
$processor = new WP_HTML_Tag_Processor( $markup . $closing_tag );
@@ -374,9 +682,11 @@
foreach ( (array) $processor->get_attribute_names_with_prefix( '' ) as $attribute ) {
$value = $processor->get_attribute( $attribute );
- if ( ! is_string( $value ) || false === strpos( $value, '{otterDynamic?' ) ) {
+ if ( ! is_string( $value ) || false === strpos( $value, $opener ) ) {
continue;
}
+ $value = $this->protect_literals( $value, array( '{otterDynamic?' => self::$literal_marker_escapes['{otterDynamic?'] ), $literal_markers );
+ $value = str_replace( $opener, '{otterDynamic?', $value );
if ( 0 === strpos( $attribute, 'on' ) || 'srcdoc' === $attribute ) {
$processor->remove_attribute( $attribute );
@@ -414,7 +724,7 @@
}
$markup = substr( $processor->get_updated_html(), 0, -strlen( $closing_tag ) );
- $markup = str_replace( '{otterDynamic?', self::$literal_marker_escapes['{otterDynamic?'], $markup );
+ $markup = str_replace( array( $opener, '{otterDynamic?' ), self::$literal_marker_escapes['{otterDynamic?'], $markup );
return strtr( $markup, $literal_markers );
}
@@ -717,7 +1027,7 @@
if ( isset( $data['default'] ) && false !== strpos( $data['default'], '<o-dynamic-link' ) ) {
$link = $this->apply_dynamic_link( $data['default'], $key );
if ( ! empty( $link ) ) {
- $_value = preg_replace( '/(<a.*?>).*?(</a>)/', '$1' . $_value . '$2', $link );
+ $_value = $this->wrap_in_link( $link, $_value );
}
}
@@ -732,13 +1042,32 @@
if ( isset( $data['default'] ) && false !== strpos( $data['default'], '<o-dynamic-link' ) ) {
$link = $this->apply_dynamic_link( $data['default'] );
- return preg_replace( '/(<a.*?>).*?(</a>)/', '$1' . $value . '$2', $link );
+ return $this->wrap_in_link( $link, $value );
}
return $value;
}
/**
+ * Replace the text of each link in the markup.
+ *
+ * @param string $link Link markup.
+ * @param int|string $value Link text.
+ *
+ * @return string
+ */
+ private function wrap_in_link( $link, $value ) {
+ // A callback, so `$0` or ` ` in the value is not read as a backreference.
+ return (string) preg_replace_callback(
+ '/(<a.*?>).*?(</a>)/',
+ function ( $m ) use ( $value ) {
+ return $m[1] . $value . $m[2];
+ },
+ $link
+ );
+ }
+
+ /**
* Apply formatting.
*
* @param string $value Dynamic value.
--- a/otter-blocks/inc/plugins/class-stripe-api.php
+++ b/otter-blocks/inc/plugins/class-stripe-api.php
@@ -104,6 +104,36 @@
}
/**
+ * Keep dynamic markers literal in the merchant-entered product fields that blocks print.
+ *
+ * @param StripeProduct $product Retrieved product.
+ * @return StripeProduct
+ */
+ private function escape_product_markers( $product ) {
+ $dynamic_content = Dynamic_Content::instance();
+ $escaped = array();
+
+ foreach ( array( 'name', 'description' ) as $field ) {
+ if ( is_string( $product[ $field ] ) ) {
+ $escaped[ $field ] = $dynamic_content->escape_comment_magic_tags( $product[ $field ] );
+ }
+ }
+
+ if ( is_array( $product['images'] ) ) {
+ $escaped['images'] = array_map( array( $dynamic_content, 'escape_comment_magic_tags' ), $product['images'] );
+ }
+
+ // StripeObject rejects an empty string, so write back only the values the escape changed.
+ foreach ( $escaped as $field => $value ) {
+ if ( $value !== $product[ $field ] ) {
+ $product[ $field ] = $value;
+ }
+ }
+
+ return $product;
+ }
+
+ /**
* Make Stripe Request
*
* @param string $path Request path.
@@ -125,7 +155,7 @@
$response = $this->stripe->products->all( $args );
break;
case 'product':
- $response = $this->stripe->products->retrieve( $args );
+ $response = $this->escape_product_markers( $this->stripe->products->retrieve( $args ) );
break;
case 'prices':
$response = $this->stripe->prices->all( $args );
--- a/otter-blocks/inc/render/class-plugin-card-block.php
+++ b/otter-blocks/inc/render/class-plugin-card-block.php
@@ -7,6 +7,8 @@
namespace ThemeIsleGutenbergBlocksRender;
+use ThemeIsleGutenbergBlocksPluginsDynamic_Content;
+
/**
* Class Plugin_Card_Block
*/
@@ -30,6 +32,7 @@
if ( ! is_wp_error( $results['data'] ) ) {
$results = $results['data'];
+ $this->escape_author_text_markers( $results );
$icon = '';
if ( isset( $results->icons['svg'] ) ) {
@@ -93,6 +96,24 @@
}
}
+ /**
+ * Keep dynamic markers literal in the plugin text WordPress.org returns from its author.
+ *
+ * @param object|string $plugin Plugin information, updated in place, or the error flag from search().
+ * @return void
+ */
+ private function escape_author_text_markers( $plugin ) {
+ if ( ! is_object( $plugin ) ) {
+ return;
+ }
+
+ foreach ( array( 'name', 'author', 'short_description' ) as $field ) {
+ if ( isset( $plugin->$field ) && is_string( $plugin->$field ) ) {
+ $plugin->$field = Dynamic_Content::instance()->escape_comment_magic_tags( $plugin->$field );
+ }
+ }
+ }
+
/**
* Search WordPress Plugin
*
--- a/otter-blocks/inc/render/class-review-block.php
+++ b/otter-blocks/inc/render/class-review-block.php
@@ -8,6 +8,7 @@
namespace ThemeIsleGutenbergBlocksRender;
use ThemeIsleGutenbergBlocksPro;
+use ThemeIsleGutenbergBlocksPluginsDynamic_Content;
/**
* Class Review_Block
@@ -39,15 +40,16 @@
// Add a static variable to track if the schema has already been added.
if ( isset( $attributes['title'] ) && ! empty( $attributes['title'] ) && isset( $attributes['features'] ) && count( $attributes['features'] ) > 0 && get_option( 'themeisle_blocks_settings_disable_review_schema', true ) ) {
- $post_id = get_the_ID();
+ $post_id = get_the_ID();
+ $schema_attributes = Dynamic_Content::instance()->restore_authored_attributes( $attributes );
add_action(
'wp_footer',
- function () use ( $attributes, $post_id ) {
+ function () use ( $schema_attributes, $post_id ) {
$added_schemas = &Review_Block::$added_schemas; // Reference the static property explicitly.
if ( ! isset( $added_schemas[ $post_id ] ) ) {
- echo '<script type="application/ld+json">' . wp_json_encode( $this->get_json_ld( $attributes, $post_id ) ) . '</script>';
+ echo '<script type="application/ld+json">' . wp_json_encode( $this->get_json_ld( $schema_attributes, $post_id ) ) . '</script>';
$added_schemas[ $post_id ] = true; // Mark schema as added for this post ID.
}
}
--- a/otter-blocks/inc/render/class-stripe-checkout-block.php
+++ b/otter-blocks/inc/render/class-stripe-checkout-block.php
@@ -8,6 +8,7 @@
namespace ThemeIsleGutenbergBlocksRender;
use ThemeIsleGutenbergBlocksPluginsStripe_API;
+use ThemeIsleGutenbergBlocksPluginsDynamic_Content;
use ThemeIsleGutenbergBlocksRenderReview_Block;
@@ -136,7 +137,7 @@
if ( 'success' === $status ) {
$message = isset( $attributes['successMessage'] ) ? wp_kses_post( $attributes['successMessage'] ) : __( 'Your payment was successful. If you have any questions, please email orders@example.com.', 'otter-blocks' );
- do_action( 'otter_blocks_stripe_checkout_success', $attributes, $this->stripe_api, $session_id );
+ do_action( 'otter_blocks_stripe_checkout_success', Dynamic_Content::instance()->restore_authored_attributes( $attributes ), $this->stripe_api, $session_id );
} else {
$message = isset( $attributes['cancelMessage'] ) ? wp_kses_post( $attributes['cancelMessage'] ) : __( 'Your payment was unsuccessful. If you have any questions, please email orders@example.com.', 'otter-blocks' );
}
--- a/otter-blocks/inc/server/class-form-server.php
+++ b/otter-blocks/inc/server/class-form-server.php
@@ -75,6 +75,30 @@
const ADMIN_ALERT_EXPIRATION_TIME = HOUR_IN_SECONDS;
/**
+ * Keep rendered forms on the same settings key used by discovery.
+ *
+ * @param string $block_content Rendered form markup.
+ * @param array<string, mixed> $block Parsed Form block.
+ * @phpstan-param array{attrs?: array{optionName?: mixed, id?: mixed, ...}|null, ...} $block
+ * @return string
+ */
+ public function set_form_option_name( $block_content, array $block ) {
+ $attributes = array_key_exists( 'attrs', $block ) && is_array( $block['attrs'] ) ? $block['attrs'] : array();
+ $option = Form_Settings_Data::get_form_option_name( $attributes );
+
+ if ( '' === $option ) {
+ return $block_content;
+ }
+
+ $html = new WP_HTML_Tag_Processor( $block_content );
+ if ( $html->next_tag( array( 'class_name' => 'wp-block-themeisle-blocks-form' ) ) ) {
+ $html->set_attribute( 'data-option-name', $option );
+ }
+
+ return $html->get_updated_html();
+ }
+
+ /**
* Initialize the class
*
* @since 2.0.0
@@ -84,6 +108,7 @@
* Register the REST API endpoints.
*/
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
+ add_filter( 'render_block_themeisle-blocks/form', array( $this, 'set_form_option_name' ), 10, 2 );
/**
* Register email providers that can be used to send emails or subscribe to a service.
@@ -1188,7 +1213,7 @@
*
* @param Form_Data_Request $data The form data.
*
- * @return mixed|string
+ * @return string One valid email address, or an empty string.
* @since 2.0.3
*/
public function get_email_from_form_input( Form_Data_Request $data ) {
@@ -1196,7 +1221,18 @@
if ( is_array( $inputs ) ) {
foreach ( $inputs as $input_field ) {
if ( isset( $input_field['type'] ) && 'email' == $input_field['type'] ) {
- return $input_field['value'];
+ $value = isset( $input_field['value'] ) && is_string( $input_field['value'] ) ? $input_field['value'] : '';
+ $at = strrpos( $value, '@' );
+ $domain = false !== $at ? substr( $value, $at + 1 ) : '';
+
+ // Convert an internationalized domain to ASCII, as wp_mail() does. sanitize_email() would remove its characters and change the address.
+ if ( function_exists( 'idn_to_ascii' ) && preg_match( '/[^x00-x7F]/', $domain ) ) {
+ $domain = idn_to_ascii( $domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46 );
+ $value = false !== $domain ? substr( $value, 0, $at + 1 ) . $domain : '';
+ }
+
+ // is_email() accepts exactly one address: it rejects the "," and ";" that wp_mail() uses to split a list.
+ return is_email( $value ) ? $value : '';
}
}
}
--- a/otter-blocks/otter-blocks.php
+++ b/otter-blocks/otter-blocks.php
@@ -7,7 +7,7 @@
* Plugin Name: Otter – Page Builder Blocks & Extensions for Gutenberg
* Plugin URI: https://themeisle.com/plugins/otter-blocks
* Description: Create beautiful and attracting posts, pages, and landing pages with Otter – Page Builder Blocks & Extensions for Gutenberg. Otter comes with dozens of Gutenberg blocks that are all you need to build beautiful pages.
- * Version: 3.2.12
+ * Version: 3.2.13
* Author: ThemeIsle
* Author URI: https://themeisle.com
* Requires at least: 6.6
@@ -27,7 +27,7 @@
define( 'OTTER_BLOCKS_BASEFILE', __FILE__ );
define( 'OTTER_BLOCKS_URL', plugins_url( '/', __FILE__ ) );
define( 'OTTER_BLOCKS_PATH', __DIR__ );
-define( 'OTTER_BLOCKS_VERSION', '3.2.12' );
+define( 'OTTER_BLOCKS_VERSION', '3.2.13' );
define( 'OTTER_BLOCKS_PRO_SUPPORT', true );
define( 'OTTER_BLOCKS_SHOW_NOTICES', false );
define( 'OTTER_PRODUCT_SLUG', basename( OTTER_BLOCKS_PATH ) );
--- a/otter-blocks/vendor/autoload.php
+++ b/otter-blocks/vendor/autoload.php
@@ -19,4 +19,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
-return ComposerAutoloaderInitb4969883688d05099f3b5104a47e6509::getLoader();
+return ComposerAutoloaderInit40334d9e23da480b5821676946675147::getLoader();
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/assets/js/build/support_hub/support-hub.asset.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/assets/js/build/support_hub/support-hub.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array(), 'version' => 'f76623f102b0d57fa656');
+<?php return array('dependencies' => array(), 'version' => '0a18eb5bfc9ccd4f3ea6');
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/load.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/load.php
@@ -14,7 +14,7 @@
return;
}
// Current SDK version and path.
-$themeisle_sdk_version = '3.3.72';
+$themeisle_sdk_version = '3.3.74';
$themeisle_sdk_path = dirname( __FILE__ );
global $themeisle_sdk_max_version;
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Loader.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Loader.php
@@ -29,12 +29,6 @@
*/
private static $instance;
/**
- * Current loader version.
- *
- * @var string $version The class version.
- */
- private static $version = '2.0.0';
- /**
* Holds registered products.
*
* @var array<Product> The products which use the SDK.
@@ -207,12 +201,33 @@
'button_submit' => 'Submit & Deactivate',
'button_cancel' => 'Skip & Deactivate',
'disclosure' => [
- 'title' => 'Below is a detailed view of all data that Themeisle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
- 'version' => '%s %s version %s %s %s %s',
- 'website' => '%sCurrent website:%s %s %s %s',
- 'usage' => '%sUsage time:%s %s %s%s',
- 'reason' => '%s Uninstall reason %s %s Selected reason from the above survey %s ',
- 'diagnostics' => '%sCrash diagnostics:%s Anonymized technical details of errors recorded for this product, if any.',
+ 'title' => 'Below is a detailed view of all data that Themeisle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
+ 'version' => '%s %s version %s %s %s %s',
+ 'website' => '%sCurrent website:%s %s %s %s',
+ 'usage' => '%sUsage time:%s %s %s%s',
+ 'reason' => '%s Uninstall reason %s %s Selected reason from the above survey %s ',
+ 'diagnostics' => '%sCrash diagnostics:%s Anonymized technical details of errors recorded for this product, if any.',
+ // Products with the Support Hub: what goes along when the user asks support for help under a reason.
+ 'title_support' => 'Below is a detailed view of all data that Themeisle will receive if you fill in this survey. No IP addresses are transmitted after you submit the survey.',
+ 'email' => '%s Email address %s %s Reply to address, if you contact support %s',
+ 'plan' => '%s Plan %s %s Free or Pro, if you contact support %s',
+ 'site_info' => '%sSite info:%s WordPress and PHP versions, language, active theme and plugins, license status and error details for this product, if you contact support.',
+ ],
+ // Products with the Support Hub: fields under the reasons support can help with.
+ 'support' => [
+ 'help' => 'Want us to look into it?',
+ 'contact' => 'Contact support',
+ // translators: %s is the email address support will reply to.
+ 'reply' => 'We'll reply to %s',
+ 'change' => 'Change',
+ 'email' => 'Reply to',
+ 'email_invalid' => 'Enter a full email address, like name@example.com.',
+ 'cancel' => 'Cancel',
+ 'keep_active' => 'Send and keep the plugin active',
+ 'button_send' => 'Send & Deactivate',
+ 'sent_title' => 'Message sent',
+ 'sent_text' => 'The plugin stays active. We usually reply within 1 business day.',
+ 'error' => 'We could not send your message. Please try again.',
],
'options' => [
@@ -235,7 +250,9 @@
'placeholder' => 'What problem are you experiencing?',
],
'id7' => [
- 'title' => 'I don't know how to make it look like demo',
+ 'title' => 'I don't know how to make it look like demo',
+ // Shown only for products with the Support Hub, where this reason gets a comment box.
+ 'placeholder' => 'Which demo, and what is different?',
],
'id8' => [
@@ -416,103 +433,40 @@
],
],
'support_hub' => [
- 'launcher' => 'Help',
- 'launcher_aria' => 'Open help',
- 'close' => 'Close',
- 'title' => 'Got a question, idea or problem?',
- // translators: %s is the product name.
- 'subtitle' => 'Ask us anything about %s. We usually reply within 1 business day.',
- 'message_label' => 'Your message',
- 'message_placeholder' => 'What can we help you with?',
- 'email_label' => 'Reply to',
- 'site_info_label' => 'Include my site info so we can help faster',
- 'site_info_toggle' => 'What's included',
- 'site_info_description' => 'Product name, version and plan, WordPress and PHP versions, your active theme, the list of active plugins, and pending crash reports (messages, file locations and product trace frames). Never license keys, tokens or payment data.',
- 'send' => 'Send message',
- 'sending' => 'Sending…',
- 'sent_title' => 'Message sent',
- 'sent_text' => 'Thanks! We usually reply within 1 business day.',
- 'nudge_help' => 'Get help',
- 'nudge_dismiss' => 'Dismiss',
- 'error_attached' => 'Error attached',
- 'error_link' => 'Get help with this',
- 'error_form_title' => 'Something not working?',
- 'error_form_text' => 'Tell us what you were doing. The error details are attached. We usually reply within 1 business day.',
- 'error_placeholder' => 'e.g. I clicked Save on my settings and got this error',
+ 'launcher' => 'Help',
+ 'launcher_aria' => 'Open help',
+ 'close' => 'Close',
+ 'title' => 'Got a question, idea or problem?',
// translators: %s is the product name.
- 'setup_title' => 'Need a hand setting up %s?',
- 'setup_text' => 'Tell us where you got stuck and we'll help you finish.',
- 'setup_prefill' => 'I need help finishing the setup: ',
- 'error_permission' => 'You are not allowed to do this.',
- 'error_product' => 'Unknown product.',
- 'error_empty' => 'Please write a message first.',
- 'error_email' => 'Please enter a valid email address.',
- 'error_throttled' => 'Please wait a moment before sending another message.',
- 'error_send' => 'We could not send your message. Opening your email app instead.',
- 'mailto_subject' => '[%s] Support request',
- 'deactivation_title' => 'Quick question before you go',
+ 'subtitle' => 'Ask us anything about %s. We usually reply within 1 business day.',
+ 'message_label' => 'Your message',
+ 'message_placeholder' => 'What can we help you with?',
+ 'email_label' => 'Reply to',
+ 'site_info_label' => 'Include my site info to get help faster',
+ 'site_info_toggle' => 'What's included',
+ 'site_info_description' => 'Product name, version and plan, WordPress and PHP versions, your active theme, the list of active plugins, and pending crash reports (messages, file locations and product trace frames). Never license keys, tokens or payment data.',
+ 'send' => 'Send message',
+ 'sending' => 'Sending…',
+ 'sent_title' => 'Message sent',
+ 'sent_text' => 'Thanks! We usually reply within 1 business day.',
+ 'nudge_help' => 'Get help',
+ 'nudge_dismiss' => 'Dismiss',
+ 'error_attached' => 'Error attached',
+ 'error_link' => 'Get help with this',
+ 'error_form_title' => 'Something not working?',
+ 'error_form_text' => 'Tell us what you were doing. The error details are attached. We usually reply within 1 business day.',
+ 'error_placeholder' => 'e.g. I clicked Save on my settings and got this error',
// translators: %s is the product name.
- 'deactivation_subtitle' => 'Why are you deactivating %s?',
- 'deactivation_email' => 'Reply to',
- 'deactivation_site_info' => 'Include site info',
- 'deactivation_keep_active' => 'Keep the plugin active until you reply',
- 'deactivation_cancel' => 'Cancel',
- 'deactivation_deactivate' => 'Deactivate',
- 'deactivation_send_deactivate' => 'Send & deactivate',
- 'deactivation_send' => 'Send & keep active',
- // Themes (Add Themes screen): same window, other wording. Keys with `_theme` win over the plugin ones.
- 'deactivation_title_theme' => 'Looking for a different theme?',
- // translators: %s is the theme name.
- 'deactivation_subtitle_theme' => 'What does not work for you in %s?',
- 'deactivation_send_theme' => 'Send',
- 'reasons' => [
- 'not_working' => [
- 'label' => 'Couldn't get it working',
- 'placeholder' => 'What were you trying to do? Tell us and we'll help you get it working, free.',
- ],
- 'missing' => [
- 'label' => 'Missing something I need',
- 'placeholder' => 'What do you need? It may already exist, or we can build it.',
- ],
- 'no_longer_need' => [
- 'label' => 'I no longer need it',
- 'placeholder' => '',
- ],
- 'switching' => [
- 'label' => 'Switching to another plugin',
- 'placeholder' => '',
- ],
- 'temporary' => [
- 'label' => 'Just temporary',
- 'placeholder' => '',
- ],
- 'other' => [
- 'label' => 'Something else',
- 'placeholder' => 'Tell us what happened and we'll get back to you.',
- ],
- ],
- 'reasons_theme' => [
- 'not_like_demo' => [
- 'label' => 'Couldn't make it look like the demo',
- 'placeholder' => 'Which demo, and what is different? We'll help you get there, free.',
- ],
- 'missing' => [
- 'label' => 'Missing something I need',
- 'placeholder' => 'What do you need? It may already exist, or we can build it.',
- ],
- 'plugin_conflict' => [
- 'label' => 'Not working with a plugin I need',
- 'placeholder' => 'Which plugin? We'll look into it.',
- ],
- 'new_design' => [
- 'label' => 'Trying a different design',
- 'placeholder' => '',
- ],
- 'other' => [
- 'label' => 'Something else',
- 'placeholder' => 'Tell us what happened and we'll get back to you.',
- ],
- ],
+ 'setup_title' => 'Need a hand setting up %s?',
+ 'setup_text' => 'Tell us where you got stuck and we'll help you finish.',
+ 'setup_prefill' => 'I need help finishing the setup: ',
+ 'error_permission' => 'You are not allowed to do this.',
+ 'error_product' => 'Unknown product.',
+ 'error_empty' => 'Please write a message first.',
+ 'error_email' => 'Please enter a valid email address.',
+ 'error_throttled' => 'Please wait a moment before sending another message.',
+ 'error_send' => 'We could not send your message. Opening your email app instead.',
+ 'mailto_subject' => '[%s] Support request',
],
];
@@ -626,7 +580,7 @@
$cache_token = get_transient( 'themeisle_sdk_cache_token' );
if ( false === $cache_token ) {
$cache_token = wp_generate_password( 6, false );
- set_transient( $cache_token, WEEK_IN_SECONDS );
+ set_transient( 'themeisle_sdk_cache_token', $cache_token, WEEK_IN_SECONDS );
}
return $cache_token;
@@ -701,11 +655,14 @@
}
/**
- * Get the version of the SDK.
+ * Get the version of the SDK that load.php picked: the highest one any
+ * active product ships.
*
* @return string The version.
*/
public static function get_version() {
- return self::$version;
+ global $themeisle_sdk_max_version;
+
+ return (string) $themeisle_sdk_max_version;
}
}
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/About_us.php
@@ -50,9 +50,9 @@
/**
* Hand-picked display order for featured products, keyed by WP.org slug.
*
- * @var array
+ * @var array<string, int>
*/
- const COMMON_PRODUCTS_PRIORITY = [
+ private static $common_products_priority = [
'neve' => 0,
'otter-blocks' => 1,
'wp-cloudflare-page-cache' => 2,
@@ -66,9 +66,9 @@
/**
* Sort weight per install status, lowest shows first.
*
- * @var array
+ * @var array<string, int>
*/
- const STATUS_PRIORITY = [
+ private static $status_priority = [
'not-installed' => 0,
'installed' => 1,
'active' => 2,
@@ -357,15 +357,16 @@
],
];
- return array_filter(
- $pages,
- function ( $page_data, $page_key ) use ( $product_pages ) {
- return in_array( $page_key, $product_pages, true ) &&
- isset( $page_data['plugin']['status'] ) &&
- $page_data['plugin']['status'] === 'not-installed';
- },
- ARRAY_FILTER_USE_BOTH
- );
+ $filtered = [];
+ foreach ( $pages as $page_key => $page_data ) {
+ if ( in_array( $page_key, $product_pages, true ) &&
+ isset( $page_data['plugin']['status'] ) &&
+ $page_data['plugin']['status'] === 'not-installed' ) {
+ $filtered[ $page_key ] = $page_data;
+ }
+ }
+
+ return $filtered;
}
/**
@@ -503,8 +504,10 @@
uksort(
$products,
function ( $left_slug, $right_slug ) use ( $products ) {
- return $this->get_product_sort_key( $left_slug, $products )
- <=> $this->get_product_sort_key( $right_slug, $products );
+ $left = $this->get_product_sort_key( $left_slug, $products );
+ $right = $this->get_product_sort_key( $right_slug, $products );
+
+ return $left < $right ? -1 : ( $left > $right ? 1 : 0 );
}
);
@@ -522,11 +525,11 @@
private function get_product_sort_key( $slug, $products ) {
$status = isset( $products[ $slug ]['status'] ) ? $products[ $slug ]['status'] : 'not-installed';
$is_active = 'active' === $status ? 1 : 0;
- $common_weight = isset( self::COMMON_PRODUCTS_PRIORITY[ $slug ] ) ? self::COMMON_PRODUCTS_PRIORITY[ $slug ] : self::SORT_WEIGHT_UNRANKED;
+ $common_weight = isset( self::$common_products_priority[ $slug ] ) ? self::$common_products_priority[ $slug ] : self::SORT_WEIGHT_UNRANKED;
// Install status only breaks ties between unranked products.
$status_weight = self::SORT_WEIGHT_UNRANKED === $common_weight
- ? ( isset( self::STATUS_PRIORITY[ $status ] ) ? self::STATUS_PRIORITY[ $status ] : self::SORT_WEIGHT_UNRANKED )
+ ? ( isset( self::$status_priority[ $status ] ) ? self::$status_priority[ $status ] : self::SORT_WEIGHT_UNRANKED )
: 0;
// Tuple order = sort precedence: active last, featured rank, status, then slug.
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Ai_connect.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Ai_connect.php
@@ -64,7 +64,7 @@
* After a dismissal nothing is shown for this long; then the next product
* the user has not dismissed gets its turn.
*/
- const REMIND_AFTER = 30 * DAY_IN_SECONDS;
+ const REMIND_AFTER = 2592000; // 30 days.
/**
* A user is asked this many times at most, however many products opted in.
@@ -80,7 +80,7 @@
* And this long after the module first ran on the site, so an update does
* not greet a long-time user with it.
*/
- const MINIMUM_SINCE = 2 * DAY_IN_SECONDS;
+ const MINIMUM_SINCE = 172800; // 2 days.
/**
* When the module first ran on this site.
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Announcements.php
@@ -24,7 +24,7 @@
class Announcements extends Abstract_Module {
const SALE_DURATION_BLACK_FRIDAY = '+7 days'; // DateTime modifier. (Include Cyber Monday)
- const MINIMUM_INSTALL_AGE = 3 * DAY_IN_SECONDS;
+ const MINIMUM_INSTALL_AGE = 259200; // 3 days.
/**
* Mark if the notice was already loaded.
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Compatibilities.php
@@ -195,17 +195,19 @@
$should_block = true;
}
if ( $should_block ) {
- echo( sprintf(
- esc_html( Loader::$labels['compatibilities']['notice2'] ),
- esc_attr( $product->get_friendly_name() ),
- esc_attr( $requirement->get_friendly_name() ),
- '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
- '</a>',
- esc_attr( $requirement->get_friendly_name() ),
- esc_attr( $requirement->is_theme() ? Loader::$labels['compatibilities']['theme'] : Loader::$labels['compatibilities']['plugin'] )
- ) );
- $upgrader->maintenance_mode( false );
- die();
+ // Returning a WP_Error aborts only this item; a die() here would kill bulk, cron and WP-CLI runs.
+ return new WP_Error(
+ 'themeisle_sdk_requirement_not_met',
+ sprintf(
+ esc_html( Loader::$labels['compatibilities']['notice2'] ),
+ esc_attr( $product->get_friendly_name() ),
+ esc_attr( $requirement->get_friendly_name() ),
+ '<a href="' . esc_url( admin_url( $requirement->is_theme() ? 'themes.php' : 'plugins.php' ) ) . '">',
+ '</a>',
+ esc_attr( $requirement->get_friendly_name() ),
+ esc_attr( $requirement->is_theme() ? Loader::$labels['compatibilities']['theme'] : Loader::$labels['compatibilities']['plugin'] )
+ )
+ );
}
return $return;
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Float_widget.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Float_widget.php
@@ -77,7 +77,7 @@
}
// The Support Hub replaces this widget for the products that opted into it.
- if ( ! empty( apply_filters( $product->get_key() . '_support_hub_metadata', array() ) ) ) {
+ if ( apply_filters( $product->get_key() . '_support_hub_metadata', array() ) ) {
return false;
}
--- a/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php
+++ b/otter-blocks/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php
@@ -861,7 +861,8 @@
),
array(
'timeout' => 15, //phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout, Inherited by wp_remote_get only, for vip environment we use defaults.
- 'sslverify' => false,
+ // Kill switch for hosts with broken trust stores: return false to skip certificate checks on the update feed.
+ 'sslverify' => apply_filters( 'themeisle_sdk_update_sslverify', true ),
)
);
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
@@ -965,23 +966,6 @@
}
/**
- * Disable SSL verification in order to prevent download update failures.
- *
- * @param array $args Http args.
- * @param string $url Url to check.
- *
- * @return array $array
- */
- public function http_request_args( $args, $url ) {
- // If it is an https request and we are performing a package download, disable ssl verification.
- if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
- $args['sslverify'] = false;
- }
-
- return $args;
- }
-
- /**
* Check if we should load the module for this product.
*
* @param Product $product Product data.
@@ -1020,7 +1004,7 @@
add_filter( 'themeisle_sdk_license/is-valid', [ __CLASS__, 'is_valid' ], 999, 1 );
add_filter( 'themeisle_sdk_license/plan', [ __CLASS__, 'plan' ], 999, 1 );
add_filter( 'themeisle_sdk_license/key', [ __CLASS__, 'key' ], 999, 1 );
- $globals_loaded = true;
+ self::$globals_loaded = true;
}
$namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_bas