PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.0.3
JetFormBuilder — Dynamic Blocks Form Builder v2.0.3
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 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / framework / vue-ui / cherry-x-vue-ui.php
jetformbuilder / framework / vue-ui Last commit date
assets 4 years ago components 4 years ago .gitignore 4 years ago babel.config.js 4 years ago cherry-x-vue-ui.php 4 years ago
cherry-x-vue-ui.php
196 lines
1 <?php
2 /**
3 * Vue.js based Interface Builder module
4 *
5 * Version: 1.1.1
6 */
7
8 // If this file is called directly, abort.
9 if ( ! defined( 'WPINC' ) ) {
10 die;
11 }
12
13 if ( ! class_exists( 'CX_Vue_UI' ) ) {
14
15 /**
16 * Class Cherry Interface Builder.
17 *
18 * @since 1.0.0
19 */
20 class CX_Vue_UI {
21
22 /**
23 * Module directory path.
24 *
25 * @since 1.0.0
26 * @access protected
27 * @var srting.
28 */
29 protected $path;
30
31 /**
32 * Module directory URL.
33 *
34 * @since 1.0.0
35 * @access protected
36 * @var srting.
37 */
38 protected $url;
39
40 /**
41 * Module version
42 *
43 * @var string
44 */
45 protected $version = '1.1.1';
46
47 /**
48 * [$assets_enqueued description]
49 *
50 * @var boolean
51 */
52 protected $assets_enqueued = false;
53
54 /**
55 * CX_Vue_UI constructor.
56 *
57 * @since 1.0.0
58 * @access public
59 * @return void
60 */
61 public function __construct( array $args = array() ) {
62
63 $this->path = ! empty( $args['path'] ) ? $args['path'] : false;
64 $this->url = ! empty( $args['url'] ) ? $args['url'] : false;
65
66 if ( ! $this->path || ! $this->url ) {
67 wp_die(
68 'CX_Vue_UI not initialized. Module URL and Path should be passed into constructor',
69 'CX_Vue_UI Error'
70 );
71 }
72
73 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
74
75 }
76
77 /**
78 * Enqueue builder assets
79 *
80 * @return void
81 */
82 public function enqueue_assets() {
83
84 if ( $this->assets_enqueued ) {
85 return;
86 }
87
88 wp_enqueue_media();
89
90 $suffix = '.min';
91
92 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
93 $suffix = '';
94 }
95
96 wp_register_script(
97 'cx-vue',
98 $this->url . 'assets/js/vue' . $suffix . '.js',
99 array(),
100 '2.6.10',
101 true
102 );
103
104 wp_enqueue_script(
105 'cx-vue-ui',
106 $this->url . 'assets/js/cx-vue-ui.js',
107 array( 'cx-vue' ),
108 $this->version,
109 true
110 );
111
112 add_action( 'admin_footer', array( $this, 'print_templates' ), 0 );
113
114 $this->assets_enqueued = true;
115
116 }
117
118 /**
119 * Returns registered components list
120 *
121 * @return array
122 */
123 public function components_list() {
124 return apply_filters(
125 'cx-vue-ui/components-list',
126 array(
127
128 // Layout elements
129 'title',
130 'collapse',
131 'component-wrapper',
132 'button',
133 'repeater',
134 'repeater-item',
135 'popup',
136 'list-table',
137 'list-table-heading',
138 'list-table-item',
139 'tabs',
140 'tabs-panel',
141 'pagination',
142 'notice',
143
144 // Form elements
145 'input',
146 'time',
147 'textarea',
148 'switcher',
149 'iconpicker',
150 'select',
151 'f-select',
152 'checkbox',
153 'radio',
154 'colorpicker',
155 'wp-media',
156 'dimensions',
157 )
158 );
159 }
160
161 /**
162 * Print components templates
163 *
164 * @return void
165 */
166 public function print_templates() {
167
168 $path = $this->path . 'components/*.php';
169 $whitelisted = $this->components_list();
170
171 foreach ( glob( $path ) as $file ) {
172
173 $slug = basename( $file, '.php' );
174
175 if ( ! in_array( $slug, $whitelisted ) ) {
176 continue;
177 }
178
179 ob_start();
180 include $file;
181 $template = ob_get_clean();
182
183 printf(
184 '<script type="text/x-template" id="%2$s">%1$s</script>',
185 $template,
186 'cx-vui-' . $slug
187 );
188
189 }
190
191 }
192
193 }
194
195 }
196