encoding = 'utf-8';
$dom->loadHTML( utf8_decode( $content ) );
$xpath = new DOMXpath($dom);
$items = $xpath->query('//div[contains(@class, "carousel-item")]');
$class = trim(
areoi_get_class_name_str( array(
'carousel',
'slide',
( !empty( $attributes['className'] ) ? $attributes['className'] : '' ),
( !empty( $attributes['style'] ) ? $attributes['style'] : '' ),
( !empty( $attributes['transition'] ) ? $attributes['transition'] : '' ),
( !empty( $attributes['align'] ) ? 'align' . $attributes['align'] : '' ),
) )
. ' ' .
areoi_get_display_class_str( $attributes, 'block' )
);
$buttons = null;
if ( !empty( $attributes['controls'] ) && $items->length > 1 ) {
$buttons = '
';
}
$indicators = null;
if ( !empty( $attributes['indicators'] ) && $items->length > 1 ) {
$indicators = '
';
foreach ( $items as $item_key => $item ) {
$indicators .= '
';
}
$indicators .= '
';
}
$newdoc = new DOMDocument();
if ( !empty( $items ) ) {
foreach ( $items as $item_key => $item ) {
$cloned = $item->cloneNode(TRUE);
if ( $item_key == 0 ) {
$cloned->setAttribute( 'class', 'carousel-item active' );
}
$newdoc->appendChild($newdoc->importNode($cloned,TRUE));
}
$content = $newdoc->saveHTML();
}
$auto_scroll = false;
if ( empty( $attributes['auto_scroll'] ) && $attributes['interval'] === true ) $auto_scroll = 'carousel';
if ( !empty( $attributes['auto_scroll'] ) ) $auto_scroll = ( $attributes['auto_scroll'] ? 'carousel' : 'false' );
$interval = false;
if ( $attributes['interval'] ) $interval = $attributes['interval'];
if ( $attributes['interval'] === true ) $interval = 4000;
if ( $auto_scroll != 'carousel' ) $interval = false;
$output = '
';
return $output;
}