PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.4.0.1
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.4.0.1
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 wpforms.php 8 years ago
wpforms.php
354 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.0.1
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>' . __( '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 * @package WPForms
73 */
74 final class WPForms {
75
76 /**
77 * One is the loneliest number that you'll ever do.
78 *
79 * @since 1.0.0
80 * @var object
81 */
82 private static $instance;
83
84 /**
85 * Plugin version for enqueueing, etc.
86 *
87 * @since 1.0.0
88 * @var sting
89 */
90 public $version = '1.4.0.1';
91
92 /**
93 * The form data handler instance.
94 *
95 * @var object WPForms_Form_Handler
96 * @since 1.0.0
97 */
98 public $form;
99
100 /**
101 * The entry data handler instance (Pro).
102 *
103 * @var object WPForms_Entry_Handler
104 * @since 1.0.0
105 */
106 public $entry;
107
108 /**
109 * The entry meta data handler instance (Pro).
110 *
111 * @var object WPForms_Entry_Meta_Handler
112 * @since 1.1.6
113 */
114 public $entry_meta;
115
116 /**
117 * The front-end instance.
118 *
119 * @var object WPForms_Frontend
120 * @since 1.0.0
121 */
122 public $frontend;
123
124 /**
125 * The process instance.
126 *
127 * @var object WPForms_Process
128 * @since 1.0.0
129 */
130 public $process;
131
132 /**
133 * The smart tags instance.
134 *
135 * @var object WPForms_Smart_Tags
136 * @since 1.0.0
137 */
138 public $smart_tags;
139
140 /**
141 * The Logging instance.
142 *
143 * @var object WPForms_Logging
144 * @since 1.0.0
145 */
146 public $logs;
147
148 /**
149 * The Preview instance.
150 *
151 * @var object WPForms_Preview
152 * @since 1.1.9
153 */
154 public $preview;
155
156 /**
157 * The License class instance (Pro).
158 *
159 * @var object WPForms_License
160 * @since 1.0.0
161 */
162 public $license;
163
164 /**
165 * Paid returns true, free (Lite) returns false.
166 *
167 * @var boolean
168 * @since 1.3.9
169 */
170 public $pro = false;
171
172 /**
173 * Main WPForms Instance.
174 *
175 * Insures that only one instance of WPForms exists in memory at any one
176 * time. Also prevents needing to define globals all over the place.
177 *
178 * @since 1.0.0
179 * @return WPForms
180 */
181 public static function instance() {
182
183 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPForms ) ) {
184
185 self::$instance = new WPForms;
186 self::$instance->constants();
187 self::$instance->load_textdomain();
188 self::$instance->conditional_logic_addon_check();
189 self::$instance->includes();
190
191 // Load Pro or Lite specific files
192 if ( self::$instance->pro ) {
193 require_once WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php';
194 } else {
195 require_once WPFORMS_PLUGIN_DIR . 'lite/wpforms-lite.php';
196 }
197
198 add_action( 'plugins_loaded', array( self::$instance, 'objects' ), 10 );
199 }
200 return self::$instance;
201 }
202
203 /**
204 * Setup plugin constants.
205 *
206 * @since 1.0.0
207 */
208 private function constants() {
209
210 // Plugin version.
211 if ( ! defined( 'WPFORMS_VERSION' ) ) {
212 define( 'WPFORMS_VERSION', $this->version );
213 }
214
215 // Plugin Folder Path.
216 if ( ! defined( 'WPFORMS_PLUGIN_DIR' ) ) {
217 define( 'WPFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
218 }
219
220 // Plugin Folder URL.
221 if ( ! defined( 'WPFORMS_PLUGIN_URL' ) ) {
222 define( 'WPFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
223 }
224
225 // Plugin Root File.
226 if ( ! defined( 'WPFORMS_PLUGIN_FILE' ) ) {
227 define( 'WPFORMS_PLUGIN_FILE', __FILE__ );
228 }
229
230 // Plugin Slug - Determine plugin type and set slug accordingly.
231 if ( file_exists( WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php' ) ) {
232 $this->pro = true;
233 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms' );
234 } else {
235 define( 'WPFORMS_PLUGIN_SLUG', 'wpforms-lite' );
236 }
237 }
238
239 /**
240 * Loads the plugin language files.
241 *
242 * @since 1.0.0
243 */
244 public function load_textdomain() {
245
246 load_plugin_textdomain( 'wpforms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
247 }
248
249 /**
250 * Check to see if the conditional logic addon is running, if so then
251 * deactivate the plugin to prevent conflicts.
252 *
253 * @since 1.3.8
254 */
255 private function conditional_logic_addon_check() {
256
257 if ( function_exists( 'wpforms_conditional_logic' ) ) {
258
259 // Load core files needed to activate deactivate_plugins().
260 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
261 require_once( ABSPATH . 'wp-includes/pluggable.php' );
262
263 // Deactivate Conditional Logic addon.
264 deactivate_plugins( 'wpforms-conditional-logic/wpforms-conditional-logic.php' );
265
266 // To avoid namespace collisions, reload current page.
267 $url = esc_url_raw( remove_query_arg( 'wpforms-test' ) );
268 wp_redirect( $url );
269 exit;
270 }
271 }
272
273 /**
274 * Include files.
275 *
276 * @since 1.0.0
277 */
278 private function includes() {
279
280 // Global includes.
281 require_once WPFORMS_PLUGIN_DIR . 'includes/functions.php';
282 require_once WPFORMS_PLUGIN_DIR . 'includes/class-install.php';
283 require_once WPFORMS_PLUGIN_DIR . 'includes/class-form.php';
284 require_once WPFORMS_PLUGIN_DIR . 'includes/class-fields.php';
285 require_once WPFORMS_PLUGIN_DIR . 'includes/class-frontend.php';
286 require_once WPFORMS_PLUGIN_DIR . 'includes/class-templates.php';
287 require_once WPFORMS_PLUGIN_DIR . 'includes/class-providers.php';
288 require_once WPFORMS_PLUGIN_DIR . 'includes/class-process.php';
289 require_once WPFORMS_PLUGIN_DIR . 'includes/class-smart-tags.php';
290 require_once WPFORMS_PLUGIN_DIR . 'includes/class-logging.php';
291 require_once WPFORMS_PLUGIN_DIR . 'includes/class-widget.php';
292 require_once WPFORMS_PLUGIN_DIR . 'includes/class-preview.php';
293 require_once WPFORMS_PLUGIN_DIR . 'includes/class-conditional-logic-core.php';
294 require_once WPFORMS_PLUGIN_DIR . 'includes/emails/class-emails.php';
295 require_once WPFORMS_PLUGIN_DIR . 'includes/integrations.php';
296
297 // Admin/Dashboard only includes.
298 if ( is_admin() ) {
299 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/admin.php';
300 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-notices.php';
301 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-menu.php';
302 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/overview/class-overview.php';
303 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/class-builder.php';
304 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/functions.php';
305 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-settings.php';
306 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-welcome.php';
307 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-tools.php';
308 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-editor.php';
309 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-review.php';
310 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/ajax-actions.php';
311 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-notification.php';
312 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-am-deactivation-survey.php';
313 }
314 }
315
316 /**
317 * Setup objects.
318 *
319 * @since 1.0.0
320 */
321 public function objects() {
322
323 // Global objects.
324 $this->form = new WPForms_Form_Handler;
325 $this->frontend = new WPForms_Frontend;
326 $this->process = new WPForms_Process;
327 $this->smart_tags = new WPForms_Smart_Tags;
328 $this->logs = new WPForms_Logging;
329 $this->preview = new WPForms_Preview;
330
331 if ( is_admin() ) {
332 new AM_Notification( WPFORMS_PLUGIN_SLUG, $this->version );
333 new AM_Deactivation_Survey( 'WPForms', basename( dirname( __FILE__ ) ) );
334 }
335
336 // Hook now that all of the WPForms stuff is loaded.
337 do_action( 'wpforms_loaded' );
338 }
339 }
340
341 /**
342 * The function which returns the one WPForms instance.
343 *
344 * @since 1.0.0
345 * @return object
346 */
347 function wpforms() {
348
349 return WPForms::instance();
350 }
351 wpforms();
352
353 } // End if().
354