File: /var/www/html/wp-content/plugins/allspice/includes/blocks.php
<?php
// blocks.php
if (!defined('ABSPATH')) exit;
function allspice_clamp_int($v, int $min, int $max, int $fallback): int {
if ($v === null) return $fallback;
if (is_string($v)) $v = trim($v);
if ($v === '' || !is_numeric($v)) return $fallback;
$n = (int) $v;
if ($n < $min) return $min;
if ($n > $max) return $max;
return $n;
}
function allspice_premade_defaults(string $id): ?array {
$id = trim($id);
if ($id === 'WIDCON-ea5d') return ['reserve_w'=>220,'reserve_h'=>196,'flow'=>false];
if ($id === 'WIDCON-d29x') return ['reserve_w'=>96,'reserve_h'=>96,'flow'=>false];
if ($id === 'WIDCON-h6ia') return ['reserve_w'=>720,'reserve_h'=>520,'flow'=>true];
if ($id === 'WIDCON-n18z') return ['reserve_w'=>720,'reserve_h'=>280,'flow'=>true];
if ($id === 'WIDCON-y17r') return ['reserve_w'=>720,'reserve_h'=>452,'flow'=>true];
if ($id === 'WIDCON-u34j') return ['reserve_w'=>720,'reserve_h'=>452,'flow'=>true];
if ($id === 'WIDCON-f92u') return ['reserve_w'=>720,'reserve_h'=>280,'flow'=>true];
if ($id === 'WIDCON-a75g') return ['reserve_w'=>720,'reserve_h'=>320,'flow'=>true];
if ($id === 'WIDCON-b64k') return ['reserve_w'=>720,'reserve_h'=>320,'flow'=>true];
return null;
}
/**
* Enqueue Gutenberg editor scripts for Allspice blocks.
*/
add_action('enqueue_block_editor_assets', function () {
$scripts = array(
'allspice-floating-button-block' => 'assets/blocks/allspice-floating-button-block.js',
'allspice-rail-block' => 'assets/blocks/allspice-rail-block.js',
'allspice-inline-chat-block' => 'assets/blocks/allspice-inline-chat-block.js',
'allspice-inline-search-block' => 'assets/blocks/allspice-inline-search-block.js',
'allspice-inline-overview-block-style-1' => 'assets/blocks/allspice-inline-overview-style-1-block.js',
'allspice-inline-overview-block-style-2' => 'assets/blocks/allspice-inline-overview-style-2-block.js',
'allspice-inline-cooking-cta' => 'assets/blocks/allspice-inline-cooking-cta-block.js',
'allspice-inline-save-recipe-form-block' => 'assets/blocks/allspice-inline-save-recipe-form-block.js',
'allspice-inline-newsletter-form-block' => 'assets/blocks/allspice-inline-newsletter-form-block.js',
);
foreach ($scripts as $handle => $rel) {
$path = ALLSPICE_WIDGET_LOADER_PATH . $rel;
wp_enqueue_script(
$handle,
ALLSPICE_WIDGET_LOADER_URL . $rel,
array('wp-blocks', 'wp-element', 'wp-components', 'wp-block-editor'),
file_exists($path) ? filemtime($path) : '1.0.0',
true
);
}
});
/**
* Register blocks.
*/
add_action('init', function () {
register_block_type('allspice/floating-button', array(
'render_callback' => 'allspice_render_floating_button_block',
'attributes' => array(
'id' => array('type' => 'string', 'default' => ''),
'reserve_w' => array('type' => 'number', 'default' => 220),
'reserve_h' => array('type' => 'number', 'default' => 196),
'floating' => array('type' => 'boolean', 'default' => false),
'offset_right' => array('type' => 'number', 'default' => 20),
'offset_bottom' => array('type' => 'number', 'default' => 20),
'hide_near_bottom' => array('type' => 'boolean', 'default' => true),
),
));
register_block_type('allspice/rail', array(
'render_callback' => 'allspice_render_rail_block',
'attributes' => array(
'id' => array('type' => 'string', 'default' => 'WIDCON-d29x'),
'reserve_w' => array('type' => 'number', 'default' => 96),
'reserve_h' => array('type' => 'number', 'default' => 96),
),
));
register_block_type('allspice/inline-chat', array(
'render_callback' => 'allspice_render_inline_chat_block',
'attributes' => array(),
));
register_block_type('allspice/inline-search', array(
'render_callback' => 'allspice_render_inline_search_block',
'attributes' => array(),
));
register_block_type('allspice/inline-overview-style-1', array(
'render_callback' => 'allspice_render_inline_overview_style_one_block',
'attributes' => array(
'pad_top' => array('type' => 'number', 'default' => 16),
'pad_bottom' => array('type' => 'number', 'default' => 16),
),
));
register_block_type('allspice/inline-overview-style-2', array(
'render_callback' => 'allspice_render_inline_overview_style_two_block',
'attributes' => array(
'pad_top' => array('type' => 'number', 'default' => 16),
'pad_bottom' => array('type' => 'number', 'default' => 16),
),
));
register_block_type('allspice/inline-cooking-cta', array(
'render_callback' => 'allspice_render_inline_cooking_cta_block',
'attributes' => array(
'pad_top' => array('type' => 'number', 'default' => 16),
'pad_bottom' => array('type' => 'number', 'default' => 16),
),
));
register_block_type('allspice/inline-save-recipe-form', array(
'render_callback' => 'allspice_render_inline_save_recipe_form_block',
'attributes' => array(
'pad_top' => array('type' => 'number', 'default' => 16),
'pad_bottom' => array('type' => 'number', 'default' => 16),
),
));
register_block_type('allspice/inline-newsletter-form', array(
'render_callback' => 'allspice_render_inline_newsletter_form_block',
'attributes' => array(
'pad_top' => array('type' => 'number', 'default' => 16),
'pad_bottom' => array('type' => 'number', 'default' => 16),
),
));
});
/**
* Render Floating Button block (premade).
*/
function allspice_render_floating_button_block($attributes) {
$id = !empty($attributes['id']) ? $attributes['id'] : 'WIDCON-ea5d';
$reserve_w = isset($attributes['reserve_w']) ? intval($attributes['reserve_w']) : 220;
$reserve_h = isset($attributes['reserve_h']) ? intval($attributes['reserve_h']) : 196;
$right = isset($attributes['offset_right']) ? intval($attributes['offset_right']) : 20;
$bottom = isset($attributes['offset_bottom']) ? intval($attributes['offset_bottom']) : 20;
$hide = !empty($attributes['hide_near_bottom']) ? '1' : '0';
$slot = do_shortcode(sprintf(
'[allspice_button id="%s" reserve_w="%d" reserve_h="%d"]',
esc_attr($id),
$reserve_w,
$reserve_h
));
return sprintf(
'<div class="asx-floatwrap" data-asx-hide="%s" style="position:fixed; right:%dpx; bottom:%dpx; transform:translateY(calc(-1 * var(--asx-bottom-offset, 0px))); will-change:transform; z-index:9000;">%s</div>',
esc_attr($hide),
$right,
$bottom,
$slot
);
}
/**
* Render Rail block (premade).
*/
function allspice_render_rail_block($attributes) {
$id = 'WIDCON-d29x';
$slot = do_shortcode(sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d"]',
esc_attr($id),
1,
1
));
$initial_dock = 'mr';
if (!empty($attributes['default_position'])) {
$candidate = strtolower(trim((string)$attributes['default_position']));
$valid_docks = array('tl', 'tr', 'bl', 'br', 'ml', 'mr');
if (in_array($candidate, $valid_docks, true)) {
$initial_dock = $candidate;
}
}
$float_side = in_array($initial_dock, array('tl', 'bl', 'ml'), true)
? 'left'
: 'right';
$wrap_style = 'position:fixed;inset:0;width:auto;height:auto;max-width:none;margin:0;padding:0;overflow:visible;pointer-events:none;z-index:9000;';
return sprintf(
'<div class="asx-floatwrap asx-railwrap" data-asx-hide="1" data-asx-side="%s" data-asx-initial-dock="%s" data-asx-surface="rail" style="%s">%s</div>',
esc_attr($float_side),
esc_attr($initial_dock),
esc_attr($wrap_style),
$slot
);
}
/**
* Render Inline Chat block (premade).
* IMPORTANT:
* - The wrapper has data-allspice-layout="flow" so page.js can avoid clipping (height:auto).
* - reserve_h is set "reasonably large" but flow mode should make it irrelevant after the JS patch.
*/
function allspice_render_inline_chat_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-h6ia" flow="1"]');
$wrapper_attrs = get_block_wrapper_attributes(array(
'data-allspice-layout' => 'flow',
'style' => 'width:100%;display:block;',
));
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Search block (premade).
*/
function allspice_render_inline_search_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-n18z" flow="1"]');
$wrapper_attrs = get_block_wrapper_attributes(array(
'data-allspice-layout' => 'flow',
'style' => 'width:100%;display:block;',
));
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Overview Style 1 block (premade).
*/
function allspice_render_inline_overview_style_one_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-y17r" flow="1"]');
$pad_top = allspice_clamp_int($attributes['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($attributes['pad_bottom'] ?? null, 0, 200, 16);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
$wrapper_attrs = function_exists('get_block_wrapper_attributes')
? get_block_wrapper_attributes(array(
'class' => 'asx-flowwrap asx-inlineoverview-wrap',
'data-allspice-layout' => 'flow',
'style' => $style,
))
: 'class="wp-block-allspice-inline-overview asx-flowwrap asx-inlineoverview-wrap" data-allspice-layout="flow" style="' . esc_attr($style) . '"';
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Overview Style 2 block (premade).
*/
function allspice_render_inline_overview_style_two_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-u34j" flow="1"]');
$pad_top = allspice_clamp_int($attributes['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($attributes['pad_bottom'] ?? null, 0, 200, 16);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
$wrapper_attrs = function_exists('get_block_wrapper_attributes')
? get_block_wrapper_attributes(array(
'class' => 'asx-flowwrap asx-inlineoverview-wrap',
'data-allspice-layout' => 'flow',
'style' => $style,
))
: 'class="wp-block-allspice-inline-overview asx-flowwrap asx-inlineoverview-wrap" data-allspice-layout="flow" style="' . esc_attr($style) . '"';
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Cooking CTA block (premade).
*/
function allspice_render_inline_cooking_cta_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-f92u" flow="1"]');
$pad_top = allspice_clamp_int($attributes['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($attributes['pad_bottom'] ?? null, 0, 200, 16);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
$wrapper_attrs = function_exists('get_block_wrapper_attributes')
? get_block_wrapper_attributes(array(
'class' => 'asx-flowwrap asx-inlinecookingcta-wrap',
'data-allspice-layout' => 'flow',
'style' => $style,
))
: 'class="wp-block-allspice-inline-cooking-cta asx-flowwrap asx-inlinecookingcta-wrap" data-allspice-layout="flow" style="' . esc_attr($style) . '"';
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Save Recipe Form block (premade WIDCON-a75g).
*/
function allspice_render_inline_save_recipe_form_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-a75g" flow="1"]');
$pad_top = allspice_clamp_int($attributes['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($attributes['pad_bottom'] ?? null, 0, 200, 16);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
$wrapper_attrs = function_exists('get_block_wrapper_attributes')
? get_block_wrapper_attributes(array(
'class' => 'asx-flowwrap asx-inlinesaverecipeform-wrap',
'data-allspice-layout' => 'flow',
'style' => $style,
))
: 'class="wp-block-allspice-inline-save-recipe-form asx-flowwrap asx-inlinesaverecipeform-wrap" data-allspice-layout="flow" style="' . esc_attr($style) . '"';
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* Render Inline Newsletter Form block (premade WIDCON-b64k).
*/
function allspice_render_inline_newsletter_form_block($attributes, $content, $block) {
$html = do_shortcode('[Allspice_Button id="WIDCON-b64k" flow="1"]');
$pad_top = allspice_clamp_int($attributes['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($attributes['pad_bottom'] ?? null, 0, 200, 16);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
$wrapper_attrs = function_exists('get_block_wrapper_attributes')
? get_block_wrapper_attributes(array(
'class' => 'asx-flowwrap asx-inlinenewsletterform-wrap',
'data-allspice-layout' => 'flow',
'style' => $style,
))
: 'class="wp-block-allspice-inline-newsletter-form asx-flowwrap asx-inlinenewsletterform-wrap" data-allspice-layout="flow" style="' . esc_attr($style) . '"';
return sprintf('<div %s>%s</div>', $wrapper_attrs, $html);
}
/**
* ------------------------------------------------------------
* Shortcodes
* ------------------------------------------------------------
*/
/**
* [allspice_floating_button]
* Example:
* [allspice_floating_button id="WIDCON-ea5d" reserve_w="220" reserve_h="196" offset_right="20" offset_bottom="20" hide_near_bottom="1" z="9000"]
*/
function allspice_shortcode_floating_button($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-ea5d',
'reserve_w' => '',
'reserve_h' => '',
'offset_right' => 20,
'offset_bottom' => 20,
'hide_near_bottom' => 1,
'z' => 9000,
], $atts, 'allspice_floating_button');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h']);
$right = intval($atts['offset_right']);
$bottom = intval($atts['offset_bottom']);
$hide = intval($atts['hide_near_bottom']) ? '1' : '0';
$z = intval($atts['z']);
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
$html = do_shortcode($inner);
return sprintf(
'<div class="asx-floatwrap" data-asx-hide="%s" style="position:fixed; right:%dpx; bottom:%dpx; transform:translateY(calc(-1 * var(--asx-bottom-offset, 0px))); will-change:transform; z-index:%d;">%s</div>',
esc_attr($hide),
$right,
$bottom,
$z,
$html
);
}
add_shortcode('allspice_floating_button', 'allspice_shortcode_floating_button');
/**
* [allspice_inline_chat]
* Example:
* [allspice_inline_chat id="WIDCON-h6ia" reserve_w="720" reserve_h="520"]
* Note: wraps in data-allspice-layout="flow"
*/
function allspice_shortcode_inline_chat($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-h6ia',
'reserve_w' => '',
'reserve_h' => '',
], $atts, 'allspice_inline_chat');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h']);
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d" flow="1"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
return sprintf(
'<div class="asx-flowwrap asx-inlinechat-wrap" data-allspice-layout="flow" style="width:100%%;display:block;">%s</div>',
do_shortcode($inner)
);
}
add_shortcode('allspice_inline_chat', 'allspice_shortcode_inline_chat');
/**
* [allspice_inline_search]
* Example:
* [allspice_inline_search id="WIDCON-n18z" reserve_w="720" reserve_h="280"]
* Note: wraps in data-allspice-layout="flow"
*/
function allspice_shortcode_inline_search($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-n18z',
'reserve_w' => '',
'reserve_h' => '',
'class' => '', // optional extra class on the wrapper
], $atts, 'allspice_inline_search');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h']);
$wrapper_class = 'asx-flowwrap asx-inlinesearch-wrap';
if (!empty($atts['class'])) {
$wrapper_class .= ' ' . sanitize_html_class($atts['class']);
}
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d" flow="1"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
return sprintf(
'<div class="%s" data-allspice-layout="flow" style="width:100%%;display:block;">%s</div>',
esc_attr($wrapper_class),
do_shortcode($inner)
);
}
add_shortcode('allspice_inline_search', 'allspice_shortcode_inline_search');
/**
* [allspice_inline_overview_style_one]
* Example:
* [allspice_inline_overview_style_one id="WIDCON-y17r" reserve_w="720" reserve_h="340"]
* Note: wraps in data-allspice-layout="flow"
*/
function allspice_shortcode_inline_overview_style_one($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-y17r',
'reserve_w' => '',
'reserve_h' => '',
'class' => '',
'pad_top' => 16,
'pad_bottom' => 16,
], $atts, 'allspice_inline_overview_style_one');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h'] ?? 452);
$wrapper_class = 'asx-flowwrap asx-inlineoverview-wrap';
if (!empty($atts['class'])) {
$wrapper_class .= ' ' . sanitize_html_class($atts['class']);
}
$pad_top = allspice_clamp_int($atts['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($atts['pad_bottom'] ?? null, 0, 200, 16);
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d" flow="1"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
return sprintf(
'<div class="%s" data-allspice-layout="flow" style="%s">%s</div>',
esc_attr($wrapper_class),
esc_attr($style),
do_shortcode($inner)
);
}
add_shortcode('allspice_inline_overview_style_one', 'allspice_shortcode_inline_overview_style_one');
/**
* [allspice_inline_overview_style_two]
* Example:
* [allspice_inline_overview_style_two id="WIDCON-u34j" reserve_w="720" reserve_h="340"]
* Note: wraps in data-allspice-layout="flow"
*/
function allspice_shortcode_inline_overview_style_two($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-u34j',
'reserve_w' => '',
'reserve_h' => '',
'class' => '',
'pad_top' => 16,
'pad_bottom' => 16,
], $atts, 'allspice_inline_overview_style_two');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h'] ?? 452);
$wrapper_class = 'asx-flowwrap asx-inlineoverview-wrap';
if (!empty($atts['class'])) {
$wrapper_class .= ' ' . sanitize_html_class($atts['class']);
}
$pad_top = allspice_clamp_int($atts['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($atts['pad_bottom'] ?? null, 0, 200, 16);
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d" flow="1"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
return sprintf(
'<div class="%s" data-allspice-layout="flow" style="%s">%s</div>',
esc_attr($wrapper_class),
esc_attr($style),
do_shortcode($inner)
);
}
add_shortcode('allspice_inline_overview_style_two', 'allspice_shortcode_inline_overview_style_two');
/**
* [allspice_inline_cooking_cta]
* Example:
* [allspice_inline_cooking_cta id="WIDCON-f92u" reserve_w="720" reserve_h="340"]
* Note: wraps in data-allspice-layout="flow"
*/
function allspice_shortcode_inline_cooking_cta($atts = []) {
$atts = shortcode_atts([
'id' => 'WIDCON-f92u',
'reserve_w' => '',
'reserve_h' => '',
'class' => '',
'pad_top' => 16,
'pad_bottom' => 16,
], $atts, 'allspice_inline_cooking_cta');
$id = sanitize_text_field($atts['id']);
$d = allspice_premade_defaults($id);
$reserve_w = ($atts['reserve_w'] !== '' && is_numeric($atts['reserve_w']))
? intval($atts['reserve_w'])
: intval($d['reserve_w'] ?? 720);
$reserve_h = ($atts['reserve_h'] !== '' && is_numeric($atts['reserve_h']))
? intval($atts['reserve_h'])
: intval($d['reserve_h'] ?? 280);
$wrapper_class = 'asx-flowwrap asx-inlinecookingcta-wrap';
if (!empty($atts['class'])) {
$wrapper_class .= ' ' . sanitize_html_class($atts['class']);
}
$pad_top = allspice_clamp_int($atts['pad_top'] ?? null, 0, 200, 16);
$pad_bottom = allspice_clamp_int($atts['pad_bottom'] ?? null, 0, 200, 16);
$inner = sprintf(
'[Allspice_Button id="%s" reserve_w="%d" reserve_h="%d" flow="1"]',
esc_attr($id),
$reserve_w,
$reserve_h
);
$style = sprintf(
'width:100%%;display:block;display:flow-root;padding-top:%dpx;padding-bottom:%dpx;',
$pad_top,
$pad_bottom
);
return sprintf(
'<div class="%s" data-allspice-layout="flow" style="%s">%s</div>',
esc_attr($wrapper_class),
esc_attr($style),
do_shortcode($inner)
);
}
add_shortcode('allspice_inline_cooking_cta', 'allspice_shortcode_inline_cooking_cta');
// [Allspice_Button id="WIDCON-ea5d" offset_right="20" offset_bottom="20" hide_near_bottom="1"]
// [Allspice_Button id="WIDCON-h6ia"]
// [Allspice_Button id="WIDCON-n18z"]
// [Allspice_Button id="WIDCON-y17r" pad_top="16" pad_bottom="16"] // overview
// [Allspice_Button id="WIDCON-x82b"] // overview, no description
// [Allspice_Button id="WIDCON-u31p"] // overview, no key points
// [Allspice_Button id="WIDCON-z71g"] // overview, no faqs
// [Allspice_Button id="WIDCON-q95e"] // overview, no ingredients