PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / libs / factory / forms / boot.php
robin-image-optimizer / libs / factory / forms Last commit date
assets 5 months ago controls 5 months ago includes 5 months ago layouts 5 months ago boot.php 5 months ago index.php 5 months ago
boot.php
276 lines
1 <?php
2 /**
3 * Factory Forms
4 *
5 * @since 1.0.1
6 * @package factory-forms
7 */
8
9 // Exit if accessed directly
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 // checks if the module is already loaded in order to
15 // prevent loading the same version of the module twice.
16 if ( defined( 'FACTORY_FORMS_600_LOADED' ) ) {
17 return;
18 }
19
20 define( 'FACTORY_FORMS_600_LOADED', true );
21 define( 'FACTORY_FORMS_600_VERSION', '6.0.0' );
22
23 // absolute path and URL to the files and resources of the module.
24 define( 'FACTORY_FORMS_600_DIR', __DIR__ );
25 define( 'FACTORY_FORMS_600_URL', plugins_url( '', __FILE__ ) );
26
27 // comp merge
28 require_once FACTORY_FORMS_600_DIR . '/includes/providers/value-provider.interface.php';
29 require_once FACTORY_FORMS_600_DIR . '/includes/providers/meta-value-provider.class.php';
30 require_once FACTORY_FORMS_600_DIR . '/includes/providers/options-value-provider.class.php';
31
32 require_once FACTORY_FORMS_600_DIR . '/includes/form.class.php';
33 // endcomp
34
35 add_action(
36 'init',
37 function () {
38 load_plugin_textdomain( 'robin-image-optimizer', false, dirname( plugin_basename( __FILE__ ) ) . '/langs' );
39 }
40 );
41
42 /**
43 * We add this code into the hook because all these controls quite heavy. So in order to get better perfomance,
44 * we load the form controls only on pages where the forms are created.
45 *
46 * @since 3.0.7
47 * @see the 'wbcr_factory_forms_600_register_controls' hook
48 */
49 if ( ! function_exists( 'wbcr_factory_forms_600_register_default_controls' ) ) {
50
51 /**
52 * @param Wbcr_Factory600_Plugin $plugin
53 *
54 * @throws Exception
55 */
56 function wbcr_factory_forms_600_register_default_controls( Wbcr_Factory600_Plugin $plugin ) {
57
58 if ( $plugin && ! isset( $plugin->forms ) ) {
59 throw new Exception( "The module Factory Forms is not loaded for the plugin '{$plugin->getPluginName()}'." );
60 }
61
62 require_once FACTORY_FORMS_600_DIR . '/includes/html-builder.class.php';
63 require_once FACTORY_FORMS_600_DIR . '/includes/form-element.class.php';
64 require_once FACTORY_FORMS_600_DIR . '/includes/control.class.php';
65 require_once FACTORY_FORMS_600_DIR . '/includes/complex-control.class.php';
66 require_once FACTORY_FORMS_600_DIR . '/includes/holder.class.php';
67 require_once FACTORY_FORMS_600_DIR . '/includes/control-holder.class.php';
68 require_once FACTORY_FORMS_600_DIR . '/includes/custom-element.class.php';
69 require_once FACTORY_FORMS_600_DIR . '/includes/form-layout.class.php';
70
71 // registration of controls
72 $plugin->forms->registerControls(
73 [
74 [
75 'type' => 'checkbox',
76 'class' => 'Wbcr_FactoryForms600_CheckboxControl',
77 'include' => FACTORY_FORMS_600_DIR . '/controls/checkbox.php',
78 ],
79 [
80 'type' => 'list',
81 'class' => 'Wbcr_FactoryForms600_ListControl',
82 'include' => FACTORY_FORMS_600_DIR . '/controls/list.php',
83 ],
84 [
85 'type' => 'dropdown',
86 'class' => 'Wbcr_FactoryForms600_DropdownControl',
87 'include' => FACTORY_FORMS_600_DIR . '/controls/dropdown.php',
88 ],
89 [
90 'type' => 'dropdown-and-colors',
91 'class' => 'Wbcr_FactoryForms600_DropdownAndColorsControl',
92 'include' => FACTORY_FORMS_600_DIR . '/controls/dropdown-and-colors.php',
93 ],
94 [
95 'type' => 'hidden',
96 'class' => 'Wbcr_FactoryForms600_HiddenControl',
97 'include' => FACTORY_FORMS_600_DIR . '/controls/hidden.php',
98 ],
99 [
100 'type' => 'hidden',
101 'class' => 'Wbcr_FactoryForms600_HiddenControl',
102 'include' => FACTORY_FORMS_600_DIR . '/controls/hidden.php',
103 ],
104 [
105 'type' => 'radio',
106 'class' => 'Wbcr_FactoryForms600_RadioControl',
107 'include' => FACTORY_FORMS_600_DIR . '/controls/radio.php',
108 ],
109 [
110 'type' => 'radio-colors',
111 'class' => 'Wbcr_FactoryForms600_RadioColorsControl',
112 'include' => FACTORY_FORMS_600_DIR . '/controls/radio-colors.php',
113 ],
114 [
115 'type' => 'textarea',
116 'class' => 'Wbcr_FactoryForms600_TextareaControl',
117 'include' => FACTORY_FORMS_600_DIR . '/controls/textarea.php',
118 ],
119 [
120 'type' => 'textbox',
121 'class' => 'Wbcr_FactoryForms600_TextboxControl',
122 'include' => FACTORY_FORMS_600_DIR . '/controls/textbox.php',
123 ],
124 [
125 'type' => 'multiple-textbox',
126 'class' => 'Wbcr_FactoryForms600_MultipleTextboxControl',
127 'include' => FACTORY_FORMS_600_DIR . '/controls/multiple-textbox.php',
128 ],
129 [
130 'type' => 'datetimepicker-range',
131 'class' => 'Wbcr_FactoryForms600_DatepickerRangeControl',
132 'include' => FACTORY_FORMS_600_DIR . '/controls/datepicker-range.php',
133 ],
134 [
135 'type' => 'url',
136 'class' => 'Wbcr_FactoryForms600_UrlControl',
137 'include' => FACTORY_FORMS_600_DIR . '/controls/url.php',
138 ],
139 [
140 'type' => 'wp-editor',
141 'class' => 'Wbcr_FactoryForms600_WpEditorControl',
142 'include' => FACTORY_FORMS_600_DIR . '/controls/wp-editor.php',
143 ],
144 [
145 'type' => 'color',
146 'class' => 'Wbcr_FactoryForms600_ColorControl',
147 'include' => FACTORY_FORMS_600_DIR . '/controls/color.php',
148 ],
149 [
150 'type' => 'color-and-opacity',
151 'class' => 'Wbcr_FactoryForms600_ColorAndOpacityControl',
152 'include' => FACTORY_FORMS_600_DIR . '/controls/color-and-opacity.php',
153 ],
154 [
155 'type' => 'gradient',
156 'class' => 'Wbcr_FactoryForms600_GradientControl',
157 'include' => FACTORY_FORMS_600_DIR . '/controls/gradient.php',
158 ],
159 [
160 'type' => 'font',
161 'class' => 'Wbcr_FactoryForms600_FontControl',
162 'include' => FACTORY_FORMS_600_DIR . '/controls/font.php',
163 ],
164 [
165 'type' => 'google-font',
166 'class' => 'Wbcr_FactoryForms600_GoogleFontControl',
167 'include' => FACTORY_FORMS_600_DIR . '/controls/google-font.php',
168 ],
169 [
170 'type' => 'pattern',
171 'class' => 'Wbcr_FactoryForms600_PatternControl',
172 'include' => FACTORY_FORMS_600_DIR . '/controls/pattern.php',
173 ],
174 [
175 'type' => 'integer',
176 'class' => 'Wbcr_FactoryForms600_IntegerControl',
177 'include' => FACTORY_FORMS_600_DIR . '/controls/integer.php',
178 ],
179 [
180 'type' => 'control-group',
181 'class' => 'Wbcr_FactoryForms600_ControlGroupHolder',
182 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/control-group.php',
183 ],
184 [
185 'type' => 'paddings-editor',
186 'class' => 'Wbcr_FactoryForms600_PaddingsEditorControl',
187 'include' => FACTORY_FORMS_600_DIR . '/controls/paddings-editor.php',
188 ],
189 ]
190 );
191
192 // registration of control holders
193 $plugin->forms->registerHolders(
194 [
195 [
196 'type' => 'tab',
197 'class' => 'Wbcr_FactoryForms600_TabHolder',
198 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/tab.php',
199 ],
200 [
201 'type' => 'tab-item',
202 'class' => 'Wbcr_FactoryForms600_TabItemHolder',
203 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/tab-item.php',
204 ],
205 [
206 'type' => 'accordion',
207 'class' => 'Wbcr_FactoryForms600_AccordionHolder',
208 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/accordion.php',
209 ],
210 [
211 'type' => 'accordion-item',
212 'class' => 'Wbcr_FactoryForms600_AccordionItemHolder',
213 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/accordion-item.php',
214 ],
215 [
216 'type' => 'control-group',
217 'class' => 'Wbcr_FactoryForms600_ControlGroupHolder',
218 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/control-group.php',
219 ],
220 [
221 'type' => 'control-group-item',
222 'class' => 'Wbcr_FactoryForms600_ControlGroupItem',
223 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/control-group-item.php',
224 ],
225 [
226 'type' => 'form-group',
227 'class' => 'Wbcr_FactoryForms600_FormGroupHolder',
228 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/form-group.php',
229 ],
230 [
231 'type' => 'more-link',
232 'class' => 'Wbcr_FactoryForms600_MoreLinkHolder',
233 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/more-link.php',
234 ],
235 [
236 'type' => 'div',
237 'class' => 'Wbcr_FactoryForms600_DivHolder',
238 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/div.php',
239 ],
240 [
241 'type' => 'columns',
242 'class' => 'Wbcr_FactoryForms600_ColumnsHolder',
243 'include' => FACTORY_FORMS_600_DIR . '/controls/holders/columns.php',
244 ],
245 ]
246 );
247
248 // registration custom form elements
249 $plugin->forms->registerCustomElements(
250 [
251 [
252 'type' => 'html',
253 'class' => 'Wbcr_FactoryForms600_Html',
254 'include' => FACTORY_FORMS_600_DIR . '/controls/customs/html.php',
255 ],
256 [
257 'type' => 'separator',
258 'class' => 'Wbcr_FactoryForms600_Separator',
259 'include' => FACTORY_FORMS_600_DIR . '/controls/customs/separator.php',
260 ],
261 ]
262 );
263
264 // registration of form layouts
265 $plugin->forms->registerFormLayout(
266 [
267 'name' => 'bootstrap-3',
268 'class' => 'Wbcr_FactoryForms600_Bootstrap3FormLayout',
269 'include' => FACTORY_FORMS_600_DIR . '/layouts/bootstrap-3/bootstrap-3.php',
270 ]
271 );
272 }
273
274 add_action( 'wbcr_factory_forms_600_register_controls', 'wbcr_factory_forms_600_register_default_controls' );
275 }
276