array(
'href' => true,
'title' => true,
'target' => true,
'rel' => true,
),
'b' => array(),
'strong' => array(),
'i' => array(),
'em' => array(),
'span' => array(
'class' => true,
'style' => true,
),
'br' => array(),
'u' => array(),
);
/**
* Method generate_inline_style.
*
* @param array $attributes is block attributes.
*
* @return void
*/
public function generate_inline_style( $attributes ) {
$css_class = new DynamicCssGenerator( $attributes );
$dynamic_css = $css_class->eab_generate_dynamic_css();
$block_name = $attributes['blockName'] ?? '';
$css_key = $block_name . '_eab_dynamic_css';
wp_register_style( $css_key, false );
wp_enqueue_style( $css_key );
wp_add_inline_style( $css_key, $dynamic_css );
}
/**
* Method accordion_header_renderer.
*
* @param array $attributes block attributes.
*
* @return string
*/
public function accordion_header_renderer( $attributes ) {
$unique_id = $attributes['uniqueId'] ?? '';
$parent_id = $attributes['parentId'] ?? '';
$template = $attributes['template'] ?? 'vertical-one';
$parent_block_name = $attributes['parentBlockName'] ?? 'vertical-accordion';
$accordion_title_tag = $attributes['accordionTitleTag'] ?? 'h3';
$accordion_title = $attributes['accordionTitle'] ?? 'No Title';
$title_alignment = $attributes['titleAlignment'] ?? 'start';
$enable_toggle_icon = $attributes['enableExpandAndCollapseIcon'] ?? true;
$toggle_icons_set = $attributes['toggleIconsSet'] ?? array();
$icon_position = $attributes['toggleIconPosition'] ?? 'end';
$toggle_rotate_sets = in_array( $toggle_icons_set['set'], array( 1, 4, 5, 6, 9, 10, 12 ), true );
ob_start();
?>
< class=''
>
>
/', '', $content );
// Remove all tags except
.
$schema_content = strip_tags( $schema_content, '
' );
// Normalize whitespace.
$schema_content = trim( preg_replace( '/\s+/', ' ', $schema_content ) );
self::$accordion_items_data[] = array(
'title' => $accordion_title ?? '',
'description' => $schema_content ?? '',
);
}
// template based dynamic class.
$wrapper_class = "sp-eab-accordion-item eab-item-$parent_id" . ( $custom_class_name ? " $custom_class_name" : '' );
ob_start();
?>
>
accordion_header_renderer( $attributes ); // phpcs:ignore
?>
$accordion_mode,
'activeEvent' => $active_event,
'defaultAccordionOpen' => $default_accordion_open,
'selectedItemOpen' => (int) ( $open_selected_item - 1 ),
'openMultiItemAtaTime' => $open_multi_item_ata_time,
'scrollToTopOnLoad' => $scroll_to_top_on_load,
'scrollToTopOnClick' => false,
'accordionItemToUrl' => false,
'animationEffect' => $animation_effect,
'applyAccessibility' => $eab_accessibility,
);
ob_start();
?>
"
>
preloader_html( $preloader, $unique_id );//phpcs:ignore
echo self::eab_video_player_bg( $background ); //phpcs:ignore
?>
$value ) {
$bg_style .= sprintf( '%s:%s;', esc_attr( $var ), esc_attr( $value ) );
}
// --- Add to schema array if enabled
$schema_markup = $parent_settings['schemaMarkup'] ?? false;
if ( $schema_markup ) {
self::$accordion_items_data[] = array(
'title' => $single_img_title ?? 'No Title',
'description' => $single_img_desc ?? '',
);
}
// Target attribute.
$image_effects = $parent_settings['imageEffects'] ?? '';
// Determine if we need to render the overlay.
$show_overlay = $show_title || $show_desc;
$show_overlay_content = ( $show_title && $single_img_title ) || ( $show_desc && $single_img_desc );
// Classes for overlay wrapper.
$overlay_classes = array(
'sp-eab-overlay',
"eab-content-alignment-{$content_alignment}",
);
// Classes for content wrapper.
$content_wrapper_classes = array(
'eab-img-content-wrapper',
'sp-d-flex',
'sp-align-center',
'sp-flex-col',
'eab-animation',
);
ob_start();
?>
" data-image-effect="" data-hover-gray-scale="">
< class="sp-eab-image-title">
title_allowed_inline_tags ); ?>
>
title_allowed_inline_tags ); ?>
>
"
data-default-open=""
data-active-event=""
data-autoplay-delay=""
data-selected-accordion=""
data-scroll-to-active-item=""
data-animation=""
data-eab-accessibility="">
preloader_html( $preloader, $unique_id );//phpcs:ignore
echo self::eab_video_player_bg( $background ); //phpcs:ignore
?>
$accordion_mode,
'activeEvent' => $active_event,
'defaultAccordionOpen' => $default_accordion_open,
'openMultiItemAtaTime' => $open_multi_item_ata_time,
'scrollToTopOnLoad' => $scroll_to_top_on_load,
'scrollToTopOnClick' => false,
'accordionItemToUrl' => false,
'animationEffect' => $animation_effect,
);
ob_start();
?>
data-eab-accessibility=""
>
preloader_html( $preloader, $unique_id );//phpcs:ignore
?>
$post_query,
'attributes' => $attributes,
)
);
?>
wp_strip_all_tags( $post['title'] ),
'description' => wp_strip_all_tags( $post['content'] ),
);
}
// Only output schema if we have valid items.
if ( ! empty( self::$accordion_items_data ) ) {
Blocks_Helper::eab_schema(
$unique_id,
self::$accordion_items_data
);
}
}
return ob_get_clean();
}
/**
* Render accordion content when taxonomy list is disabled.
*
* @param array $args Render arguments.
*/
public static function render_non_list_accordion_content( array $args ) {
$post_query = $args['post_query'] ?? array();
$attributes = $args['attributes'] ?? array();
// Default post accordion output.
foreach ( $post_query as $data ) :
echo Template_parts::post_single_item( $data, $attributes );// phpcs:ignore
endforeach;
}
/**
* Preloader_html
*
* @param mixed $preloader preloader.
* @param mixed $unique_id unique id.
* @return statement
*/
private function preloader_html( $preloader, $unique_id ) {
if ( ! $preloader ) {
return '';
}
ob_start();
?>
inner_blocks ) ) {
return '';
}
$tabs = $block->inner_blocks;
// attributes.
$unique_id = $attributes['uniqueId'] ?? '';
$template = $attributes['template'] ?? 'sidebar-tab-one';
$align = $attributes['align'] ?? 'wide';
$active_event = $attributes['activeEvent'] ?? 'click';
$default_accordion_open = $attributes['defaultAccordionOpen'] ?? 'first-item';
$open_selected_item = $attributes['openSelectedItem'] ?? 1;
$content_height = $attributes['contentHeight'] ?? 'auto';
$background = $attributes['eabBackground'] ?? array();
$preloader = $attributes['preloader'] ?? false;
// tabs attr data.
$data_tab_accordion = array(
'activeEvent' => $active_event,
'defaultOpenItem' => $default_accordion_open,
'selectedItemOpen' => (int) $open_selected_item,
'scrollToTopOnLoad' => true,
'accordionItemToUrl' => true,
'contentHeight' => $content_height,
'template' => $template,
);
ob_start();
?>