PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.4.9
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.4.9
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 7 years ago includes 7 years ago languages 7 years ago lite 7 years ago src 7 years ago autoloader.php 7 years ago changelog.txt 7 years ago readme.txt 7 years ago uninstall.php 8 years ago wpforms.php 7 years ago
wpforms.php
415 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.9
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 add_action( 'admin_init', 'wpforms_deactivate' );
50
51 /**
52 * Display notice after deactivation.
53 *
54 * @since 1.0.0
55 */
56 function wpforms_lite_notice() {
57
58 echo '<div class="notice notice-warning"><p>' . esc_html__( 'Please deactivate WPForms Lite before activating WPForms.', 'wpforms' ) . '</p></div>';
59
60 if ( isset( $_GET['activate'] ) ) {
61 unset( $_GET['activate'] );
62 }
63 }
64 add_action( 'admin_notices', 'wpforms_lite_notice' );
65
66 } else {
67
68 /**
69 * Main WPForms class.
70 *
71 * @since 1.0.0
72 *
73 * @package WPForms
74 */
75 final class WPForms {
76
77 /**
78 * One is the loneliest number that you'll ever do.
79 *
80 * @since 1.0.0
81 *
82 * @var WPForms
83 */
84 private static $instance;
85
86 /**
87 * Plugin version for enqueueing, etc.
88 *
89 * @since 1.0.0
90 *
91 * @var string
92 */
93 public $version = '1.4.9';
94
95 /**
96 * The form data handler instance.
97 *
98 * @since 1.0.0
99 *
100 * @var WPForms_Form_Handler
101 */
102 public $form;
103
104 /**
105 * The entry data handler instance (Pro).
106 *
107 * @since 1.0.0
108 *
109 * @var WPForms_Entry_Handler
110 */
111 public $entry;
112
113 /**
114 * The entry fields data handler instance (Pro).
115 *
116 * @since 1.4.3
117 *
118 * @var WPForms_Entry_Fields_Handler
119 */
120 public $entry_fields;
121
122 /**
123 * The entry meta data handler instance (Pro).
124 *
125 * @since 1.1.6
126 *
127 * @var WPForms_Entry_Meta_Handler
128 */
129 public $entry_meta;
130
131 /**
132 * The front-end instance.
133 *
134 * @since 1.0.0
135 *
136 * @var WPForms_Frontend
137 */
138 public $frontend;
139
140 /**
141 * The process instance.
142 *
143 * @since 1.0.0
144 *
145 * @var WPForms_Process
146 */
147 public $process;
148
149 /**
150 * The smart tags instance.
151 *
152 * @since 1.0.0
153 *
154 * @var WPForms_Smart_Tags
155 */
156 public $smart_tags;
157
158 /**
159 * The Logging instance.
160 *
161 * @since 1.0.0
162 *
163 * @var WPForms_Logging
164 */
165 public $logs;
166
167 /**
168 * The Preview instance.
169 *
170 * @since 1.1.9
171 *
172 * @var WPForms_Preview
173 */
174 public $preview;
175
176 /**
177 * The License class instance (Pro).
178 *
179 * @since 1.0.0
180 *
181 * @var WPForms_License
182 */
183 public $license;
184
185 /**
186 * Paid returns true, free (Lite) returns false.
187 *
188 * @since 1.3.9
189 *
190 * @var boolean
191 */
192 public $pro = false;
193
194 /**
195 * Main WPForms Instance.
196 *
197 * Insures that only one instance of WPForms exists in memory at any one
198 * time. Also prevents needing to define globals all over the place.
199 *
200 * @since 1.0.0
201 *
202 * @return WPForms
203 */
204 public static function instance() {
205
206 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPForms ) ) {
207
208 self::$instance = new WPForms();
209 self::$instance->constants();
210 self::$instance->conditional_logic_addon_check();
211 self::$instance->includes();
212
213 // Load Pro or Lite specific files.
214 if ( self::$instance->pro ) {
215 require_once WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php';
216 } else {
217 require_once WPFORMS_PLUGIN_DIR . 'lite/wpforms-lite.php';
218 }
219
220 add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ), 10 );
221 add_action( 'plugins_loaded', array( self::$instance, 'objects' ), 10 );
222 }
223
224 return self::$instance;
225 }
226
227 /**
228 * Setup plugin constants.
229 *
230 * @since 1.0.0
231 */
232 private function constants() {
233
234 // Plugin version.
235 if ( ! defined( 'WPFORMS_VERSION' ) ) {
236 define( 'WPFORMS_VERSION', $this->version );
237 }
238
239 // Plugin Folder Path.
240 if ( ! defined( 'WPFORMS_PLUGIN_DIR' ) ) {
241 define( 'WPFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
242 }
243
244 // Plugin Folder URL.
245 if ( ! defined( 'WPFORMS_PLUGIN_URL' ) ) {
246 define( 'WPFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
247 }
248
249 // Plugin Root File.
250 if ( ! defined( 'WPFORMS_PLUGIN_FILE' ) ) {
251 define( 'WPFORMS_PLUGIN_FILE', __FILE__ );
252 }
253
254 // Plugin Slug - Determine plugin type and set slug accordingly.
255 if ( apply_filters( 'wpforms_allow_pro_version', file_exists( WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php' ) ) ) {
256 $this->pro = true;
257 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms' );
258 } else {
259 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms-lite' );
260 }
261 }
262
263 /**
264 * Loads the plugin language files.
265 *
266 * @since 1.0.0
267 */
268 public function load_textdomain() {
269
270 load_plugin_textdomain( 'wpforms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
271 }
272
273 /**
274 * Check to see if the conditional logic addon is running, if so then
275 * deactivate the plugin to prevent conflicts.
276 *
277 * @since 1.3.8
278 */
279 private function conditional_logic_addon_check() {
280
281 if ( function_exists( 'wpforms_conditional_logic' ) ) {
282
283 // Load core files needed to activate deactivate_plugins().
284 require_once ABSPATH . 'wp-admin/includes/plugin.php';
285 require_once ABSPATH . 'wp-includes/pluggable.php';
286
287 // Deactivate Conditional Logic addon.
288 deactivate_plugins( 'wpforms-conditional-logic/wpforms-conditional-logic.php' );
289
290 // To avoid namespace collisions, reload current page.
291 $url = esc_url_raw( remove_query_arg( 'wpforms-test' ) );
292 wp_redirect( $url );
293 exit;
294 }
295 }
296
297 /**
298 * Include files.
299 *
300 * @since 1.0.0
301 */
302 private function includes() {
303
304 $this->includes_magic();
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 // TODO: class-templates.php should be loaded in admin area only.
313 require_once WPFORMS_PLUGIN_DIR . 'includes/class-templates.php';
314 // TODO: class-providers.php should be loaded in admin area only.
315 require_once WPFORMS_PLUGIN_DIR . 'includes/class-providers.php';
316 require_once WPFORMS_PLUGIN_DIR . 'includes/class-process.php';
317 require_once WPFORMS_PLUGIN_DIR . 'includes/class-smart-tags.php';
318 require_once WPFORMS_PLUGIN_DIR . 'includes/class-logging.php';
319 require_once WPFORMS_PLUGIN_DIR . 'includes/class-widget.php';
320 require_once WPFORMS_PLUGIN_DIR . 'includes/class-preview.php';
321 require_once WPFORMS_PLUGIN_DIR . 'includes/class-conditional-logic-core.php';
322 require_once WPFORMS_PLUGIN_DIR . 'includes/emails/class-emails.php';
323 require_once WPFORMS_PLUGIN_DIR . 'includes/integrations.php';
324
325 // Admin/Dashboard only includes, also in ajax.
326 if ( is_admin() ) {
327 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/admin.php';
328 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-notices.php';
329 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-menu.php';
330 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/overview/class-overview.php';
331 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/class-builder.php';
332 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/functions.php';
333 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-settings.php';
334 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-welcome.php';
335 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-tools.php';
336 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-editor.php';
337 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-review.php';
338 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-importers.php';
339 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/ajax-actions.php';
340 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-notification.php';
341 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-deactivation-survey.php';
342 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-dashboard-widget-extend-feed.php';
343 }
344 }
345
346 /**
347 * Including the new files with PHP 5.3 style.
348 *
349 * @since 1.4.7
350 */
351 private function includes_magic() {
352
353 // We require PHP 5.3 for that to work.
354 if ( version_compare( phpversion(), '5.3', '<' ) ) {
355 return;
356 }
357
358 // Autoloader is put into its own file to save space here.
359 require_once WPFORMS_PLUGIN_DIR . 'autoloader.php';
360
361 /*
362 * Properly init the providers loader, that will handle all the related logic and further loading.
363 */
364 add_action( 'wpforms_loaded', array( '\WPForms\Providers\Loader', 'get_instance' ) );
365
366 /*
367 * Properly init the integrations loader, that will handle all the related logic and further loading.
368 */
369 add_action( 'wpforms_loaded', array( '\WPForms\Integrations\Loader', 'get_instance' ) );
370 }
371
372 /**
373 * Setup objects.
374 *
375 * @since 1.0.0
376 */
377 public function objects() {
378
379 // Global objects.
380 $this->form = new WPForms_Form_Handler();
381 $this->frontend = new WPForms_Frontend();
382 $this->process = new WPForms_Process();
383 $this->smart_tags = new WPForms_Smart_Tags();
384 $this->logs = new WPForms_Logging();
385 $this->preview = new WPForms_Preview();
386
387 if ( is_admin() ) {
388 if ( ! wpforms_setting( 'hide-announcements', false ) ) {
389 new AM_Notification( WPFORMS_PLUGIN_SLUG, $this->version );
390 }
391
392 if ( $this->pro || ( ! $this->pro && ! file_exists( WP_PLUGIN_DIR . '/wpforms/wpforms.php' ) ) ) {
393 new AM_Deactivation_Survey( 'WPForms', basename( dirname( __FILE__ ) ) );
394 }
395 }
396
397 // Hook now that all of the WPForms stuff is loaded.
398 do_action( 'wpforms_loaded' );
399 }
400 }
401
402 /**
403 * The function which returns the one WPForms instance.
404 *
405 * @since 1.0.0
406 *
407 * @return WPForms
408 */
409 function wpforms() {
410
411 return WPForms::instance();
412 }
413 wpforms();
414 }
415