PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.9.3.1
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.9.3.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 1 year ago includes 1 year ago lite 1 year ago src 1 year ago templates 1 year ago vendor 1 year ago vendor_prefixed 1 year ago changelog.txt 1 year ago readme.txt 1 year ago uninstall.php 1 year ago wpforms.php 1 year ago
wpforms.php
348 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 * Requires at least: 5.5
7 * Requires PHP: 7.1
8 * Author: WPForms
9 * Author URI: https://wpforms.com
10 * Version: 1.9.3.1
11 * License: GPL v2 or later
12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 * Text Domain: wpforms-lite
14 * Domain Path: /assets/languages
15 *
16 * WPForms is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 2 of the License, or
19 * any later version.
20 *
21 * WPForms is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with WPForms. If not, see <https://www.gnu.org/licenses/>.
28 */
29
30 // Exit if accessed directly.
31 if ( ! defined( 'ABSPATH' ) ) {
32 exit;
33 }
34
35 if ( is_multisite() ) {
36 $is_pro = file_exists( __DIR__ . '/pro/wpforms-pro.php' );
37
38 if ( ! $is_pro ) { // <- is lite.
39 $lite_base = plugin_basename( __FILE__ );
40
41 $active_plugins = get_option( 'active_plugins', [] );
42 $active_network_plugins = get_site_option( 'active_sitewide_plugins' );
43
44 if (
45 isset( $active_network_plugins[ $lite_base ] )
46 && in_array( 'wpforms/wpforms.php', $active_plugins, true )
47 ) {
48 // Keep plugin active but silent.
49 return;
50 }
51 }
52 }
53
54 if ( ! defined( 'WPFORMS_VERSION' ) ) {
55 /**
56 * Plugin version.
57 *
58 * @since 1.0.0
59 */
60 define( 'WPFORMS_VERSION', '1.9.3.1' );
61 }
62
63 // Plugin Folder Path.
64 if ( ! defined( 'WPFORMS_PLUGIN_DIR' ) ) {
65 define( 'WPFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
66 }
67
68 // Plugin Folder URL.
69 if ( ! defined( 'WPFORMS_PLUGIN_URL' ) ) {
70 define( 'WPFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
71 }
72
73 // Plugin Root File.
74 if ( ! defined( 'WPFORMS_PLUGIN_FILE' ) ) {
75 define( 'WPFORMS_PLUGIN_FILE', __FILE__ );
76 }
77
78 // Don't allow multiple versions to be active.
79 if ( function_exists( 'wpforms' ) ) {
80
81 if ( ! function_exists( 'wpforms_pro_just_activated' ) ) {
82 /**
83 * When we activate a Pro version, we need to do additional operations:
84 * 1) deactivate a Lite version;
85 * 2) register option which help to run all activation process for Pro version (custom tables creation, etc.).
86 *
87 * @since 1.6.2
88 * @deprecated 1.8.7
89 */
90 function wpforms_pro_just_activated() {
91
92 _deprecated_function( __METHOD__, '1.8.7 of the WPForms plugin' );
93
94 wpforms_deactivate();
95 add_option( 'wpforms_install', 1 );
96 }
97 }
98
99 if ( ! function_exists( 'wpforms_lite_just_activated' ) ) {
100 /**
101 * Store temporarily that the Lite version of the plugin was activated.
102 * This is needed because WP does a redirect after activation and
103 * we need to preserve this state to know whether user activated Lite or not.
104 *
105 * @since 1.5.8
106 */
107 function wpforms_lite_just_activated() {
108
109 set_transient( 'wpforms_lite_just_activated', true );
110 }
111 add_action( 'activate_wpforms-lite/wpforms.php', 'wpforms_lite_just_activated' );
112 }
113
114 if ( ! function_exists( 'wpforms_lite_just_deactivated' ) ) {
115 /**
116 * Store temporarily that Lite plugin was deactivated.
117 * Convert temporary "activated" value to a global variable,
118 * so it is available through the request. Remove from the storage.
119 *
120 * @since 1.5.8
121 * @deprecated 1.8.7
122 */
123 function wpforms_lite_just_deactivated() {
124
125 _deprecated_function( __METHOD__, '1.8.7 of the WPForms plugin' );
126
127 global $wpforms_lite_just_activated, $wpforms_lite_just_deactivated;
128
129 $wpforms_lite_just_activated = (bool) get_transient( 'wpforms_lite_just_activated' );
130 $wpforms_lite_just_deactivated = true;
131
132 delete_transient( 'wpforms_lite_just_activated' );
133 }
134 }
135
136 if ( ! function_exists( 'wpforms_deactivate' ) ) {
137 /**
138 * Deactivate Lite if WPForms already activated.
139 *
140 * @since 1.0.0
141 */
142 function wpforms_deactivate() {
143
144 $pro_file = wpforms()->is_pro() ? WPFORMS_PLUGIN_FILE : __FILE__;
145 $lite_file = wpforms()->is_pro() ? __FILE__ : WPFORMS_PLUGIN_FILE;
146
147 $lite_base = plugin_basename( $lite_file );
148 $pro_base = plugin_basename( $pro_file );
149
150 if (
151 ! is_multisite()
152 || is_plugin_active_for_network( $pro_base )
153 || ( ! is_plugin_active_for_network( $pro_base ) && ! is_plugin_active_for_network( $lite_base ) )
154 ) {
155 deactivate_plugins( $lite_base );
156
157 /**
158 * Fires on plugin deactivation.
159 *
160 * @since 1.6.3.1
161 *
162 * @param string $plugin_basename The plugin basename.
163 */
164 do_action( 'wpforms_plugin_deactivated', $lite_base );
165
166 // Run the installation on the next admin visit.
167 add_option( 'wpforms_install', 1 );
168 }
169 }
170 }
171 add_action( 'admin_init', 'wpforms_deactivate' );
172
173 if ( ! function_exists( 'wpforms_lite_notice' ) ) {
174 /**
175 * Display the notice after deactivation when Pro is still active
176 * and user wanted to activate the Lite version of the plugin.
177 *
178 * @since 1.0.0
179 */
180 function wpforms_lite_notice() {
181
182 $pro_file = wpforms()->is_pro() ? WPFORMS_PLUGIN_FILE : __FILE__;
183 $lite_file = wpforms()->is_pro() ? __FILE__ : WPFORMS_PLUGIN_FILE;
184
185 $lite_base = plugin_basename( $lite_file );
186 $pro_base = plugin_basename( $pro_file );
187
188 // Do not show the notice if upgrade from Lite to Pro.
189 if ( (bool) get_transient( 'wpforms_lite_just_activated' ) === false ) {
190 return;
191 }
192
193 if (
194 ! is_multisite()
195 || is_plugin_active_for_network( $pro_base )
196 || ( ! is_plugin_active_for_network( $pro_base ) && ! is_plugin_active_for_network( $lite_base ) )
197 ) {
198 $message = sprintf(
199 /* translators: %s - Path to installed plugins. */
200 __( 'Your site already has WPForms Pro activated. If you want to switch to WPForms Lite, please first go to %s and deactivate WPForms. Then, you can activate WPForms Lite.', 'wpforms-lite' ),
201 is_multisite() ? __( 'Network Admin → Plugins → Installed Plugins', 'wpforms-lite' ) : __( 'Plugins → Installed Plugins', 'wpforms-lite' )
202 );
203
204 // Currently tried to activate Lite with Pro still active, so display the message.
205 printf(
206 '<div class="notice wpforms-notice notice-warning wpforms-license-notice" id="wpforms-notice-pro-active">
207 <h3 style="margin: .75em 0 0 0;">
208 <img src="%1$s" style="vertical-align: text-top; width: 20px; margin-right: 7px;">%2$s
209 </h3>
210 <p>%3$s</p>
211 </div>',
212 esc_url( WPFORMS_PLUGIN_URL . 'assets/images/exclamation-triangle.svg' ),
213 esc_html__( 'Heads up!', 'wpforms-lite' ),
214 esc_html( $message )
215 );
216
217 delete_transient( 'wpforms_lite_just_activated' );
218
219 if ( isset( $_GET['activate'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
220 unset( $_GET['activate'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
221 }
222 }
223 }
224 }
225 add_action( 'admin_notices', 'wpforms_lite_notice' );
226 add_action( 'network_admin_notices', 'wpforms_lite_notice' );
227
228 // Do not process the plugin code further.
229 return;
230 }
231
232 // We require PHP version 7.1+ for the whole plugin to work.
233 if ( version_compare( phpversion(), '7.1', '<' ) ) {
234
235 if ( ! function_exists( 'wpforms_php52_notice' ) ) {
236
237 /**
238 * Display the notice about incompatible PHP version after deactivation.
239 *
240 * @since 1.5.0
241 */
242 function wpforms_php52_notice() {
243
244 ?>
245 <div class="notice notice-error">
246 <p>
247 <?php
248 printf(
249 wp_kses(
250 /* translators: %s - WPBeginner URL for recommended WordPress hosting. */
251 __( 'Your site is running an <strong>insecure version</strong> of PHP that is no longer supported. Please contact your web hosting provider to update your PHP version or switch to a <a href="%s" target="_blank" rel="noopener noreferrer">recommended WordPress hosting company</a>.', 'wpforms-lite' ),
252 [
253 'a' => [
254 'href' => [],
255 'target' => [],
256 'rel' => [],
257 ],
258 'strong' => [],
259 ]
260 ),
261 'https://www.wpbeginner.com/wordpress-hosting/'
262 );
263 ?>
264 <br><br>
265 <?php
266 printf(
267 wp_kses(
268 /* translators: %s - WPForms.com URL for documentation with more details. */
269 __( '<strong>Note:</strong> The WPForms plugin is disabled on your site until you fix the issue. <a href="%s" target="_blank" rel="noopener noreferrer">Read more for additional information.</a>', 'wpforms-lite' ),
270 [
271 'a' => [
272 'href' => [],
273 'target' => [],
274 'rel' => [],
275 ],
276 'strong' => [],
277 ]
278 ),
279 'https://wpforms.com/docs/supported-php-version/'
280 );
281 ?>
282 </p>
283 </div>
284
285 <?php
286 // In case this is on plugin activation.
287 // phpcs:disable WordPress.Security.NonceVerification.Recommended
288 if ( isset( $_GET['activate'] ) ) {
289 unset( $_GET['activate'] );
290 }
291 // phpcs:enable WordPress.Security.NonceVerification.Recommended
292 }
293 }
294
295 add_action( 'admin_notices', 'wpforms_php52_notice' );
296
297 // Do not process the plugin code further.
298 return;
299 }
300
301 // We require WP version 5.5+ for the whole plugin to work.
302 if ( version_compare( $GLOBALS['wp_version'], '5.5', '<' ) ) {
303
304 if ( ! function_exists( 'wpforms_wp_notice' ) ) {
305
306 /**
307 * Display the notice about incompatible WP version after deactivation.
308 *
309 * @since 1.7.3
310 */
311 function wpforms_wp_notice() {
312
313 ?>
314 <div class="notice notice-error">
315 <p>
316 <?php
317 printf(
318 /* translators: %s - WordPress version. */
319 esc_html__( 'The WPForms plugin is disabled because it requires WordPress %s or later.', 'wpforms-lite' ),
320 '5.5'
321 );
322 ?>
323 </p>
324 </div>
325
326 <?php
327 // In case this is on plugin activation.
328 // phpcs:disable WordPress.Security.NonceVerification.Recommended
329 if ( isset( $_GET['activate'] ) ) {
330 unset( $_GET['activate'] );
331 }
332 // phpcs:enable WordPress.Security.NonceVerification.Recommended
333 }
334 }
335
336 add_action( 'admin_notices', 'wpforms_wp_notice' );
337
338 // Do not process the plugin code further.
339 return;
340 }
341
342 // Define the class and the function.
343 require_once __DIR__ . '/src/WPForms.php';
344
345 if ( function_exists( 'wpforms' ) ) {
346 wpforms();
347 }
348