PluginProbe
Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. / 0.13
Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. v0.13
trunk 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13
blocks-to-shortcode / includes / Helper.php

Helper.php in Blocks to Shortcode – Use blocks everywhere: in page templates, Elementor, etc. 0.13, at includes/Helper.php

38 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace BTSC;
3
4 if ( !defined( 'ABSPATH' ) ) { exit; }
5
6 class Helper {
7 static function animationProps( $animation ) {
8 if ( !is_array( $animation ) ) {
9 return '';
10 }
11
12 extract( $animation );
13 $type = $type ?? '';
14 $duration = $duration ?? 1;
15 $delay = $delay ?? 0.05;
16 $once = ( $once ?? false ) ? 'true' : 'false';
17 $mirror = ( $mirror ?? true ) ? 'true' : 'false';
18 $offset = $offset ?? 120;
19 $easing = $easing ?? 'ease';
20 $anchor = $animation['anchor-placement'] ?? 'top-bottom';
21
22 return $type ? "data-aos=$type data-aos-duration=$duration data-aos-delay=$delay data-aos-once=$once data-aos-mirror=$mirror data-aos-offset=$offset data-aos-easing=$easing data-aos-anchor-placement=$anchor" : '';
23 }
24
25 static function createShortcode( $attributes ) {
26 $shortcode = '[btsc]';
27
28 if ( isset( $attributes['id'] ) && $attributes['id'] ) {
29 $shortcode = preg_replace(
30 '/\]$/',
31 ' id="' . $attributes['id'] . '"]',
32 $shortcode
33 );
34 }
35
36 return $shortcode;
37 }
38 }