PluginProbe
Disable Comments & Delete All Comments / 1.0.9
Disable Comments & Delete All Comments v1.0.9
1.3.3 1.3.2 trunk 1.0.0 1.0.4 1.0.5 1.0.8 1.0.9 1.1.1 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.3.0 1.3.1
comments-plus / libs / factory / forms / boot.php

boot.php in Disable Comments & Delete All Comments 1.0.9, at libs/factory/forms/boot.php

271 lines 9.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Factory Forms
4 *
5 * @author Alex Kovalev <alex.kovalevv@gmail.com>
6 * @copyright (c) 2018, Webcraftic Ltd
7 *
8 * @package factory-forms
9 * @since 1.0.1
10 */
11
12 // Exit if accessed directly
13 if( !defined('ABSPATH') ) {
14 exit;
15 }
16
17 // the module provides function for the admin area only
18
19 if( !is_admin() ) {
20 return;
21 }
22
23 // checks if the module is already loaded in order to
24 // prevent loading the same version of the module twice.
25 if( defined('FACTORY_FORMS_400_LOADED') ) {
26 return;
27 }
28
29 define('FACTORY_FORMS_400_LOADED', true);
30
31 // absolute path and URL to the files and resources of the module.
32 define('FACTORY_FORMS_400_DIR', dirname(__FILE__));
33 define('FACTORY_FORMS_400_URL', plugins_url(null, __FILE__));
34
35 #comp merge
36 require_once(FACTORY_FORMS_400_DIR . '/includes/providers/value-provider.interface.php');
37 require_once(FACTORY_FORMS_400_DIR . '/includes/providers/meta-value-provider.class.php');
38 require_once(FACTORY_FORMS_400_DIR . '/includes/providers/options-value-provider.class.php');
39
40 require_once(FACTORY_FORMS_400_DIR . '/includes/form.class.php');
41 #endcomp
42
43 load_plugin_textdomain('wbcr_factory_forms_400', false, dirname(plugin_basename(__FILE__)) . '/langs');
44
45 /**
46 * We add this code into the hook because all these controls quite heavy. So in order to get better perfomance,
47 * we load the form controls only on pages where the forms are created.
48 *
49 * @see the 'wbcr_factory_forms_400_register_controls' hook
50 *
51 * @since 3.0.7
52 */
53 if( !function_exists('wbcr_factory_forms_400_register_default_controls') ) {
54
55 /**
56 * @param Wbcr_Factory400_Plugin $plugin
57 * @throws Exception
58 */
59 function wbcr_factory_forms_400_register_default_controls(Wbcr_Factory400_Plugin $plugin)
60 {
61
62 if( $plugin && !isset($plugin->forms) ) {
63 throw new Exception("The module Factory Forms is not loaded for the plugin '{$plugin->getPluginName()}'.");
64 }
65
66 require_once(FACTORY_FORMS_400_DIR . '/includes/html-builder.class.php');
67 require_once(FACTORY_FORMS_400_DIR . '/includes/form-element.class.php');
68 require_once(FACTORY_FORMS_400_DIR . '/includes/control.class.php');
69 require_once(FACTORY_FORMS_400_DIR . '/includes/complex-control.class.php');
70 require_once(FACTORY_FORMS_400_DIR . '/includes/holder.class.php');
71 require_once(FACTORY_FORMS_400_DIR . '/includes/control-holder.class.php');
72 require_once(FACTORY_FORMS_400_DIR . '/includes/custom-element.class.php');
73 require_once(FACTORY_FORMS_400_DIR . '/includes/form-layout.class.php');
74
75 // registration of controls
76 $plugin->forms->registerControls(array(
77 array(
78 'type' => 'checkbox',
79 'class' => 'Wbcr_FactoryForms400_CheckboxControl',
80 'include' => FACTORY_FORMS_400_DIR . '/controls/checkbox.php'
81 ),
82 array(
83 'type' => 'list',
84 'class' => 'Wbcr_FactoryForms400_ListControl',
85 'include' => FACTORY_FORMS_400_DIR . '/controls/list.php'
86 ),
87 array(
88 'type' => 'dropdown',
89 'class' => 'Wbcr_FactoryForms400_DropdownControl',
90 'include' => FACTORY_FORMS_400_DIR . '/controls/dropdown.php'
91 ),
92 array(
93 'type' => 'dropdown-and-colors',
94 'class' => 'Wbcr_FactoryForms400_DropdownAndColorsControl',
95 'include' => FACTORY_FORMS_400_DIR . '/controls/dropdown-and-colors.php'
96 ),
97 array(
98 'type' => 'hidden',
99 'class' => 'Wbcr_FactoryForms400_HiddenControl',
100 'include' => FACTORY_FORMS_400_DIR . '/controls/hidden.php'
101 ),
102 array(
103 'type' => 'hidden',
104 'class' => 'Wbcr_FactoryForms400_HiddenControl',
105 'include' => FACTORY_FORMS_400_DIR . '/controls/hidden.php'
106 ),
107 array(
108 'type' => 'radio',
109 'class' => 'Wbcr_FactoryForms400_RadioControl',
110 'include' => FACTORY_FORMS_400_DIR . '/controls/radio.php'
111 ),
112 array(
113 'type' => 'radio-colors',
114 'class' => 'Wbcr_FactoryForms400_RadioColorsControl',
115 'include' => FACTORY_FORMS_400_DIR . '/controls/radio-colors.php'
116 ),
117 array(
118 'type' => 'textarea',
119 'class' => 'Wbcr_FactoryForms400_TextareaControl',
120 'include' => FACTORY_FORMS_400_DIR . '/controls/textarea.php'
121 ),
122 array(
123 'type' => 'textbox',
124 'class' => 'Wbcr_FactoryForms400_TextboxControl',
125 'include' => FACTORY_FORMS_400_DIR . '/controls/textbox.php'
126 ),
127 array(
128 'type' => 'multiple-textbox',
129 'class' => 'Wbcr_FactoryForms400_MultipleTextboxControl',
130 'include' => FACTORY_FORMS_400_DIR . '/controls/multiple-textbox.php'
131 ),
132 array(
133 'type' => 'datetimepicker-range',
134 'class' => 'Wbcr_FactoryForms400_DatepickerRangeControl',
135 'include' => FACTORY_FORMS_400_DIR . '/controls/datepicker-range.php'
136 ),
137 array(
138 'type' => 'url',
139 'class' => 'Wbcr_FactoryForms400_UrlControl',
140 'include' => FACTORY_FORMS_400_DIR . '/controls/url.php'
141 ),
142 array(
143 'type' => 'wp-editor',
144 'class' => 'Wbcr_FactoryForms400_WpEditorControl',
145 'include' => FACTORY_FORMS_400_DIR . '/controls/wp-editor.php'
146 ),
147 array(
148 'type' => 'color',
149 'class' => 'Wbcr_FactoryForms400_ColorControl',
150 'include' => FACTORY_FORMS_400_DIR . '/controls/color.php'
151 ),
152 array(
153 'type' => 'color-and-opacity',
154 'class' => 'Wbcr_FactoryForms400_ColorAndOpacityControl',
155 'include' => FACTORY_FORMS_400_DIR . '/controls/color-and-opacity.php'
156 ),
157 array(
158 'type' => 'gradient',
159 'class' => 'Wbcr_FactoryForms400_GradientControl',
160 'include' => FACTORY_FORMS_400_DIR . '/controls/gradient.php'
161 ),
162 array(
163 'type' => 'font',
164 'class' => 'Wbcr_FactoryForms400_FontControl',
165 'include' => FACTORY_FORMS_400_DIR . '/controls/font.php'
166 ),
167 array(
168 'type' => 'google-font',
169 'class' => 'Wbcr_FactoryForms400_GoogleFontControl',
170 'include' => FACTORY_FORMS_400_DIR . '/controls/google-font.php'
171 ),
172 array(
173 'type' => 'pattern',
174 'class' => 'Wbcr_FactoryForms400_PatternControl',
175 'include' => FACTORY_FORMS_400_DIR . '/controls/pattern.php'
176 ),
177 array(
178 'type' => 'integer',
179 'class' => 'Wbcr_FactoryForms400_IntegerControl',
180 'include' => FACTORY_FORMS_400_DIR . '/controls/integer.php'
181 ),
182 array(
183 'type' => 'control-group',
184 'class' => 'Wbcr_FactoryForms400_ControlGroupHolder',
185 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/control-group.php'
186 ),
187 array(
188 'type' => 'paddings-editor',
189 'class' => 'Wbcr_FactoryForms400_PaddingsEditorControl',
190 'include' => FACTORY_FORMS_400_DIR . '/controls/paddings-editor.php'
191 ),
192 ));
193
194 // registration of control holders
195 $plugin->forms->registerHolders(array(
196 array(
197 'type' => 'tab',
198 'class' => 'Wbcr_FactoryForms400_TabHolder',
199 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/tab.php'
200 ),
201 array(
202 'type' => 'tab-item',
203 'class' => 'Wbcr_FactoryForms400_TabItemHolder',
204 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/tab-item.php'
205 ),
206 array(
207 'type' => 'accordion',
208 'class' => 'Wbcr_FactoryForms400_AccordionHolder',
209 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/accordion.php'
210 ),
211 array(
212 'type' => 'accordion-item',
213 'class' => 'Wbcr_FactoryForms400_AccordionItemHolder',
214 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/accordion-item.php'
215 ),
216 array(
217 'type' => 'control-group',
218 'class' => 'Wbcr_FactoryForms400_ControlGroupHolder',
219 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/control-group.php'
220 ),
221 array(
222 'type' => 'control-group-item',
223 'class' => 'Wbcr_FactoryForms400_ControlGroupItem',
224 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/control-group-item.php'
225 ),
226 array(
227 'type' => 'form-group',
228 'class' => 'Wbcr_FactoryForms400_FormGroupHolder',
229 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/form-group.php'
230 ),
231 array(
232 'type' => 'more-link',
233 'class' => 'Wbcr_FactoryForms400_MoreLinkHolder',
234 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/more-link.php'
235 ),
236 array(
237 'type' => 'div',
238 'class' => 'Wbcr_FactoryForms400_DivHolder',
239 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/div.php'
240 ),
241 array(
242 'type' => 'columns',
243 'class' => 'Wbcr_FactoryForms400_ColumnsHolder',
244 'include' => FACTORY_FORMS_400_DIR . '/controls/holders/columns.php'
245 )
246 ));
247
248 // registration custom form elements
249 $plugin->forms->registerCustomElements(array(
250 array(
251 'type' => 'html',
252 'class' => 'Wbcr_FactoryForms400_Html',
253 'include' => FACTORY_FORMS_400_DIR . '/controls/customs/html.php',
254 ),
255 array(
256 'type' => 'separator',
257 'class' => 'Wbcr_FactoryForms400_Separator',
258 'include' => FACTORY_FORMS_400_DIR . '/controls/customs/separator.php',
259 ),
260 ));
261
262 // registration of form layouts
263 $plugin->forms->registerFormLayout(array(
264 'name' => 'bootstrap-3',
265 'class' => 'Wbcr_FactoryForms400_Bootstrap3FormLayout',
266 'include' => FACTORY_FORMS_400_DIR . '/layouts/bootstrap-3/bootstrap-3.php'
267 ));
268 }
269
270 add_action('wbcr_factory_forms_400_register_controls', 'wbcr_factory_forms_400_register_default_controls');
271 }