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