PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 1.1.7
JetFormBuilder — Dynamic Blocks Form Builder v1.1.7
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / includes / shortcodes / shortcode.php

shortcode.php in JetFormBuilder — Dynamic Blocks Form Builder 1.1.7, at includes/shortcodes/shortcode.php

37 lines 736 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Jet_Form_Builder\Shortcodes;
5
6
7 abstract class Shortcode {
8
9 public function __construct() {
10 add_shortcode( $this->get_name(), array( $this, 'add_shortcode_callback' ) );
11 }
12
13 abstract public function get_name();
14
15 abstract public function generate( $settings );
16
17 protected function default_args() {
18 return array();
19 }
20
21 protected function prepare_attributes( $attrs ) {
22 $result = array();
23
24 foreach ( $attrs as $name => $attr ) {
25 $result[ $name ] = $attr['default'];
26 }
27
28 return $result;
29 }
30
31 public function add_shortcode_callback( $atts ) {
32 $settings = shortcode_atts( $this->default_args(), $atts, $this->get_name() );
33
34 return $this->generate( $settings );
35 }
36
37 }