PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.4.5.2
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.4.5.2
1.10.1 1.10.0.5 trunk 1.1.4 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.6.1 1.1.7 1.1.7.1 1.1.7.2 1.1.8 1.1.8.1 1.1.8.2 1.1.8.3 1.1.8.4 1.10.0.1 1.10.0.2 1.10.0.3 1.10.0.4 1.2.0 1.2.0.1 1.2.1 1.2.2 1.2.2.1 1.2.2.2 1.2.3 1.2.3.1 1.2.3.2 1.2.4 1.2.4.1 1.2.5 1.2.5.1 1.2.6 1.2.7 1.2.8 1.2.8.1 1.2.9 1.3.0 1.3.1 1.3.1.1 1.3.1.2 1.3.2 1.3.3 1.3.5 1.3.6 1.3.6.1 1.3.6.2 1.3.7.2 1.3.7.3 1.3.7.4 1.3.8 1.3.9.1 1.4.0.1 1.4.1.1 1.4.2 1.4.2.1 1.4.2.2 1.4.3 1.4.4 1.4.4.1 1.4.5 1.4.5.1 1.4.5.2 1.4.5.3 1.4.6 1.4.7.1 1.4.7.2 1.4.8.1 1.4.9 1.5.0.1 1.5.0.3 1.5.0.4 1.5.1 1.5.1.1 1.5.1.3 1.5.2.1 1.5.2.2 1.5.2.3 1.5.3 1.5.3.1 1.5.4.1 1.5.4.2 1.5.5 1.5.5.1 1.5.6 1.5.6.2 1.5.7 1.5.8.2 1.5.9.1 1.5.9.4 1.5.9.5 1.6.0.1 1.6.0.2 1.6.1 1.6.2.2 1.6.2.3 1.6.3.1 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.7 1.6.7.1 1.6.7.2 1.6.7.3 1.6.8 1.6.8.1 1.6.9 1.7.0 1.7.1.1 1.7.1.2 1.7.2 1.7.2.1 1.7.3 1.7.4 1.7.4.1 1.7.4.2 1.7.5.1 1.7.5.2 1.7.5.3 1.7.5.5 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.7.9.1 1.8.0.1 1.8.0.2 1.8.1.1 1.8.1.2 1.8.1.3 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.3.1 1.8.4 1.8.4.1 1.8.5.2 1.8.5.3 1.8.5.4 1.8.6.2 1.8.6.3 1.8.6.4 1.8.7.2 1.8.8.2 1.8.8.3 1.8.9.1 1.8.9.2 1.8.9.4 1.8.9.5 1.8.9.6 1.9.0.1 1.9.0.2 1.9.0.3 1.9.0.4 1.9.1.1 1.9.1.2 1.9.1.3 1.9.1.4 1.9.1.5 1.9.1.6 1.9.2.1 1.9.2.2 1.9.2.3 1.9.3.1 1.9.3.2 1.9.4.1 1.9.4.2 1.9.5 1.9.5.1 1.9.5.2 1.9.6 1.9.6.1 1.9.6.2 1.9.7.1 1.9.7.2 1.9.7.3 1.9.8.1 1.9.8.2 1.9.8.4 1.9.8.7 1.9.9.2 1.9.9.3 1.9.9.4
wpforms-lite / wpforms.php
wpforms-lite Last commit date
assets 8 years ago includes 8 years ago languages 8 years ago lite 8 years ago changelog.txt 8 years ago readme.txt 8 years ago uninstall.php 8 years ago wpforms.php 8 years ago
wpforms.php
388 lines
1 <?php
2 /**
3 * Plugin Name: WPForms Lite
4 * Plugin URI: https://wpforms.com
5 * Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
6 * Author: WPForms
7 * Author URI: https://wpforms.com
8 * Version: 1.4.5.2
9 * Text Domain: wpforms
10 * Domain Path: languages
11 *
12 * WPForms is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 2 of the License, or
15 * any later version.
16 *
17 * WPForms is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with WPForms. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * @package WPForms
26 * @author WPForms
27 * @since 1.0.0
28 * @license GPL-2.0+
29 * @copyright Copyright (c) 2016, WPForms LLC
30 */
31
32 // Exit if accessed directly.
33 if ( ! defined( 'ABSPATH' ) ) {
34 exit;
35 }
36
37 // Don't allow multiple versions to be active
38 if ( class_exists( 'WPForms' ) ) {
39
40 /**
41 * Deactivate if WPForms already activated.
42 *
43 * @since 1.0.0
44 */
45 function wpforms_deactivate() {
46
47 deactivate_plugins( plugin_basename( __FILE__ ) );
48 }
49
50 add_action( 'admin_init', 'wpforms_deactivate' );
51
52 /**
53 * Display notice after deactivation.
54 *
55 * @since 1.0.0
56 */
57 function wpforms_lite_notice() {
58
59 echo '<div class="notice notice-warning"><p>' . esc_html__( 'Please deactivate WPForms Lite before activating WPForms.', 'wpforms' ) . '</p></div>';
60
61 if ( isset( $_GET['activate'] ) ) {
62 unset( $_GET['activate'] );
63 }
64 }
65
66 add_action( 'admin_notices', 'wpforms_lite_notice' );
67
68 } else {
69
70 /**
71 * Main WPForms class.
72 *
73 * @since 1.0.0
74 *
75 * @package WPForms
76 */
77 final class WPForms {
78
79 /**
80 * One is the loneliest number that you'll ever do.
81 *
82 * @since 1.0.0
83 *
84 * @var WPForms
85 */
86 private static $instance;
87
88 /**
89 * Plugin version for enqueueing, etc.
90 *
91 * @since 1.0.0
92 *
93 * @var string
94 */
95 public $version = '1.4.5.2';
96
97 /**
98 * The form data handler instance.
99 *
100 * @since 1.0.0
101 *
102 * @var WPForms_Form_Handler
103 */
104 public $form;
105
106 /**
107 * The entry data handler instance (Pro).
108 *
109 * @since 1.0.0
110 *
111 * @var WPForms_Entry_Handler
112 */
113 public $entry;
114
115 /**
116 * The entry fields data handler instance (Pro).
117 *
118 * @since 1.4.3
119 *
120 * @var WPForms_Entry_Fields_Handler
121 */
122 public $entry_fields;
123
124 /**
125 * The entry meta data handler instance (Pro).
126 *
127 * @since 1.1.6
128 *
129 * @var WPForms_Entry_Meta_Handler
130 */
131 public $entry_meta;
132
133 /**
134 * The front-end instance.
135 *
136 * @since 1.0.0
137 *
138 * @var WPForms_Frontend
139 */
140 public $frontend;
141
142 /**
143 * The process instance.
144 *
145 * @since 1.0.0
146 *
147 * @var WPForms_Process
148 */
149 public $process;
150
151 /**
152 * The smart tags instance.
153 *
154 * @since 1.0.0
155 *
156 * @var WPForms_Smart_Tags
157 */
158 public $smart_tags;
159
160 /**
161 * The Logging instance.
162 *
163 * @since 1.0.0
164 *
165 * @var WPForms_Logging
166 */
167 public $logs;
168
169 /**
170 * The Preview instance.
171 *
172 * @since 1.1.9
173 *
174 * @var WPForms_Preview
175 */
176 public $preview;
177
178 /**
179 * The License class instance (Pro).
180 *
181 * @since 1.0.0
182 *
183 * @var WPForms_License
184 */
185 public $license;
186
187 /**
188 * Paid returns true, free (Lite) returns false.
189 *
190 * @since 1.3.9
191 *
192 * @var boolean
193 */
194 public $pro = false;
195
196 /**
197 * Main WPForms Instance.
198 *
199 * Insures that only one instance of WPForms exists in memory at any one
200 * time. Also prevents needing to define globals all over the place.
201 *
202 * @since 1.0.0
203 *
204 * @return WPForms
205 */
206 public static function instance() {
207
208 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPForms ) ) {
209
210 self::$instance = new WPForms;
211 self::$instance->constants();
212 self::$instance->conditional_logic_addon_check();
213 self::$instance->includes();
214
215 // Load Pro or Lite specific files.
216 if ( self::$instance->pro ) {
217 require_once WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php';
218 } else {
219 require_once WPFORMS_PLUGIN_DIR . 'lite/wpforms-lite.php';
220 }
221
222 add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ), 10 );
223 add_action( 'plugins_loaded', array( self::$instance, 'objects' ), 10 );
224 }
225
226 return self::$instance;
227 }
228
229 /**
230 * Setup plugin constants.
231 *
232 * @since 1.0.0
233 */
234 private function constants() {
235
236 // Plugin version.
237 if ( ! defined( 'WPFORMS_VERSION' ) ) {
238 define( 'WPFORMS_VERSION', $this->version );
239 }
240
241 // Plugin Folder Path.
242 if ( ! defined( 'WPFORMS_PLUGIN_DIR' ) ) {
243 define( 'WPFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
244 }
245
246 // Plugin Folder URL.
247 if ( ! defined( 'WPFORMS_PLUGIN_URL' ) ) {
248 define( 'WPFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
249 }
250
251 // Plugin Root File.
252 if ( ! defined( 'WPFORMS_PLUGIN_FILE' ) ) {
253 define( 'WPFORMS_PLUGIN_FILE', __FILE__ );
254 }
255
256 // Plugin Slug - Determine plugin type and set slug accordingly.
257 if ( file_exists( WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php' ) ) {
258 $this->pro = true;
259 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms' );
260 } else {
261 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms-lite' );
262 }
263 }
264
265 /**
266 * Loads the plugin language files.
267 *
268 * @since 1.0.0
269 */
270 public function load_textdomain() {
271
272 load_plugin_textdomain( 'wpforms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
273 }
274
275 /**
276 * Check to see if the conditional logic addon is running, if so then
277 * deactivate the plugin to prevent conflicts.
278 *
279 * @since 1.3.8
280 */
281 private function conditional_logic_addon_check() {
282
283 if ( function_exists( 'wpforms_conditional_logic' ) ) {
284
285 // Load core files needed to activate deactivate_plugins().
286 require_once ABSPATH . 'wp-admin/includes/plugin.php';
287 require_once ABSPATH . 'wp-includes/pluggable.php';
288
289 // Deactivate Conditional Logic addon.
290 deactivate_plugins( 'wpforms-conditional-logic/wpforms-conditional-logic.php' );
291
292 // To avoid namespace collisions, reload current page.
293 $url = esc_url_raw( remove_query_arg( 'wpforms-test' ) );
294 wp_redirect( $url );
295 exit;
296 }
297 }
298
299 /**
300 * Include files.
301 *
302 * @since 1.0.0
303 */
304 private function includes() {
305
306 // Global includes.
307 require_once WPFORMS_PLUGIN_DIR . 'includes/functions.php';
308 require_once WPFORMS_PLUGIN_DIR . 'includes/class-install.php';
309 require_once WPFORMS_PLUGIN_DIR . 'includes/class-form.php';
310 require_once WPFORMS_PLUGIN_DIR . 'includes/class-fields.php';
311 require_once WPFORMS_PLUGIN_DIR . 'includes/class-frontend.php';
312 require_once WPFORMS_PLUGIN_DIR . 'includes/class-templates.php';
313 require_once WPFORMS_PLUGIN_DIR . 'includes/class-providers.php';
314 require_once WPFORMS_PLUGIN_DIR . 'includes/class-process.php';
315 require_once WPFORMS_PLUGIN_DIR . 'includes/class-smart-tags.php';
316 require_once WPFORMS_PLUGIN_DIR . 'includes/class-logging.php';
317 require_once WPFORMS_PLUGIN_DIR . 'includes/class-widget.php';
318 require_once WPFORMS_PLUGIN_DIR . 'includes/class-preview.php';
319 require_once WPFORMS_PLUGIN_DIR . 'includes/class-conditional-logic-core.php';
320 require_once WPFORMS_PLUGIN_DIR . 'includes/emails/class-emails.php';
321 require_once WPFORMS_PLUGIN_DIR . 'includes/integrations.php';
322
323 // Admin/Dashboard only includes.
324 if ( is_admin() ) {
325 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/admin.php';
326 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-notices.php';
327 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-menu.php';
328 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/overview/class-overview.php';
329 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/class-builder.php';
330 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/functions.php';
331 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-settings.php';
332 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-welcome.php';
333 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-tools.php';
334 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-editor.php';
335 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-review.php';
336 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-importers.php';
337 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/ajax-actions.php';
338 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-notification.php';
339 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-deactivation-survey.php';
340 }
341 }
342
343 /**
344 * Setup objects.
345 *
346 * @since 1.0.0
347 */
348 public function objects() {
349
350 // Global objects.
351 $this->form = new WPForms_Form_Handler;
352 $this->frontend = new WPForms_Frontend;
353 $this->process = new WPForms_Process;
354 $this->smart_tags = new WPForms_Smart_Tags;
355 $this->logs = new WPForms_Logging;
356 $this->preview = new WPForms_Preview;
357
358 if ( is_admin() ) {
359 if ( ! wpforms_setting( 'hide-announcements', false ) ) {
360 new AM_Notification( WPFORMS_PLUGIN_SLUG, $this->version );
361 }
362
363 if ( $this->pro || ( ! $this->pro && ! file_exists( WP_PLUGIN_DIR . '/wpforms/wpforms.php' ) ) ) {
364 new AM_Deactivation_Survey( 'WPForms', basename( dirname( __FILE__ ) ) );
365 }
366 }
367
368 // Hook now that all of the WPForms stuff is loaded.
369 do_action( 'wpforms_loaded' );
370 }
371 }
372
373 /**
374 * The function which returns the one WPForms instance.
375 *
376 * @since 1.0.0
377 *
378 * @return WPForms
379 */
380 function wpforms() {
381
382 return WPForms::instance();
383 }
384
385 wpforms();
386
387 } // End if().
388