PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.2.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.2.1
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | weforms.php +67 -133 1.6.281.2.1 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: weForms
4 4 * Description: The best contact form plugin for WordPress
5 - * Plugin URI: https://weformspro.com/
6 - * Author: weForms
7 - * Author URI: https://weformspro.com/
8 - * Version: 1.6.28
5 + * Plugin URI: https://wedevs.com/weforms/
6 + * Author: weDevs
7 + * Author URI: https://wedevs.com/
8 + * Version: 1.2.1
9 9 * License: GPL2 or later
10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 11 * Text Domain: weforms
12 12 * Domain Path: /languages
@@ -12,9 +12,9 @@
12 12 * Domain Path: /languages
13 13 */
14 14
15 15 /**
16 - * Copyright (c) 2020 weForms LLC (email: support@weformspro.com). All rights reserved.
16 + * Copyright (c) 2017 weDevs LLC (email: info@wedevs.com). All rights reserved.
17 17 *
18 18 * Released under the GPL license
19 19 * http://www.opensource.org/licenses/gpl-license.php
20 20 *
@@ -38,11 +38,9 @@
38 38 * **********************************************************************
39 39 */
40 40
41 41 // don't call the file directly
42 -if ( !defined( 'ABSPATH' ) ) {
43 - exit;
44 -}
42 +if ( !defined( 'ABSPATH' ) ) exit;
45 43
46 44 /**
47 45 * WeForms class
48 46 *
@@ -54,9 +52,9 @@
54 52 * Plugin version
55 53 *
56 54 * @var string
57 55 */
58 - public $version = '1.6.28';
56 + public $version = '1.2.1';
59 57
60 58 /**
61 59 * Form field value seperator
62 60 *
@@ -61,9 +59,9 @@
61 59 * Form field value seperator
62 60 *
63 61 * @var string
64 62 */
65 - public static $field_separator = '| ';
63 + static $field_separator = '| ';
66 64
67 65 /**
68 66 * Holds various class instances
69 67 *
@@ -68,17 +66,19 @@
68 66 * Holds various class instances
69 67 *
70 68 * @var array
71 69 */
72 - private $container = [];
70 + private $container = array();
73 71
72 +
74 73 /**
75 74 * Minimum PHP version required
76 75 *
77 76 * @var string
78 77 */
79 - private $min_php = '7.2.5';
78 + private $min_php = '5.4.0';
80 79
80 +
81 81 /**
82 82 * Constructor for the WeForms class
83 83 *
84 84 * Sets up all the appropriate hooks and actions
@@ -84,22 +84,22 @@
84 84 * Sets up all the appropriate hooks and actions
85 85 * within our plugin.
86 86 */
87 87 public function __construct() {
88 +
88 89 $this->define_constants();
89 90
90 - if ( !$this->is_supported_php() ) {
91 - register_activation_hook( __FILE__, [ $this, 'auto_deactivate' ] );
92 - add_action( 'admin_notices', [ $this, 'php_version_notice' ] );
93 -
91 + if ( ! $this->is_supported_php() ) {
92 + register_activation_hook( __FILE__, array( $this, 'auto_deactivate' ) );
93 + add_action( 'admin_notices', array( $this, 'php_version_notice' ) );
94 94 return;
95 95 }
96 96
97 - register_activation_hook( __FILE__, [ $this, 'activate' ] );
98 - register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
97 + register_activation_hook( __FILE__, array( $this, 'activate' ) );
98 + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
99 99
100 - add_action( 'admin_init', [ $this, 'plugin_upgrades' ] );
101 - add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
100 + add_action( 'plugins_loaded', array( $this, 'plugin_upgrades') );
101 + add_action( 'plugins_loaded', array( $this, 'init_plugin' ) );
102 102 }
103 103
104 104 /**
105 105 * Magic getter to bypass referencing plugin.
@@ -135,10 +135,9 @@
135 135 */
136 136 public static function init() {
137 137 static $instance = false;
138 138
139 - if ( !$instance ) {
140 - self::log();
139 + if ( ! $instance ) {
141 140 $instance = new WeForms();
142 141 }
143 142
144 143 return $instance;
@@ -151,9 +150,9 @@
151 150 */
152 151 private function define_constants() {
153 152 define( 'WEFORMS_VERSION', $this->version );
154 153 define( 'WEFORMS_FILE', __FILE__ );
155 - define( 'WEFORMS_ROOT', __DIR__ );
154 + define( 'WEFORMS_ROOT', dirname( __FILE__ ) );
156 155 define( 'WEFORMS_INCLUDES', WEFORMS_ROOT . '/includes' );
157 156 define( 'WEFORMS_ROOT_URI', plugins_url( '', __FILE__ ) );
158 157 define( 'WEFORMS_ASSET_URI', WEFORMS_ROOT_URI . '/assets' );
159 158 }
@@ -163,8 +162,9 @@
163 162 *
164 163 * @return void
165 164 */
166 165 public function init_plugin() {
166 +
167 167 $this->includes();
168 168 $this->init_hooks();
169 169
170 170 do_action( 'weforms_loaded' );
@@ -181,17 +181,17 @@
181 181 require_once WEFORMS_INCLUDES . '/class-field-manager.php';
182 182 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
183 183 require_once WEFORMS_INCLUDES . '/class-template-manager.php';
184 184
185 - if ( !array_key_exists( 'fields', $this->container ) ) {
185 + if ( ! array_key_exists( 'fields', $this->container ) ) {
186 186 $this->container['fields'] = new WeForms_Field_Manager();
187 187 }
188 188
189 - if ( !array_key_exists( 'form', $this->container ) ) {
189 + if ( ! array_key_exists( 'form', $this->container ) ) {
190 190 $this->container['form'] = new WeForms_Form_Manager();
191 191 }
192 192
193 - if ( !array_key_exists( 'templates', $this->container ) ) {
193 + if ( ! array_key_exists( 'templates', $this->container ) ) {
194 194 $this->container['templates'] = new WeForms_Template_Manager();
195 195 }
196 196
197 197 $installer = new WeForms_Installer();
@@ -203,8 +203,9 @@
203 203 *
204 204 * Nothing being called here yet.
205 205 */
206 206 public function deactivate() {
207 +
207 208 }
208 209
209 210 /**
210 211 * Include the required classes
@@ -211,11 +212,12 @@
211 212 *
212 213 * @return void
213 214 */
214 215 public function includes() {
216 +
215 217 require_once WEFORMS_INCLUDES . '/compat/class-abstract-wpuf-integration.php';
216 218
217 - if ( $this->is_request( 'admin' ) ) {
219 + if ( is_admin() ) {
218 220 // compatibility
219 221 require_once WEFORMS_INCLUDES . '/class-template-manager.php';
220 222
221 223 require_once WEFORMS_INCLUDES . '/admin/class-admin.php';
@@ -222,27 +224,21 @@
222 224 require_once WEFORMS_INCLUDES . '/admin/class-admin-welcome.php';
223 225 require_once WEFORMS_INCLUDES . '/class-importer-manager.php';
224 226
225 227 require_once WEFORMS_INCLUDES . '/admin/class-pro-upgrades.php';
226 - require_once WEFORMS_INCLUDES . '/admin/class-promotion.php';
227 - require_once WEFORMS_INCLUDES . '/admin/class-shortcode-button.php';
228 - require_once WEFORMS_INCLUDES . '/admin/class-privacy.php';
228 +
229 229 } else {
230 230
231 + require_once WEFORMS_INCLUDES . '/class-frontend-form.php';
232 +
231 233 // add reCaptcha library if not found
232 - if ( !function_exists( 'recaptcha_get_html' ) ) {
234 + if ( ! function_exists( 'recaptcha_get_html' ) ) {
233 235 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib.php';
234 236 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib_noCaptcha.php';
235 237 }
236 238 }
237 239
238 - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) {
239 - require_once WEFORMS_INCLUDES . '/class-frontend-form.php';
240 - }
241 - require_once WEFORMS_INCLUDES . '/api/class-weforms-api-rest-controller.php';
242 - require_once WEFORMS_INCLUDES . '/class-weforms-api.php';
243 240 require_once WEFORMS_INCLUDES . '/class-scripts-styles.php';
244 - require_once WEFORMS_INCLUDES . '/admin/class-gutenblock.php';
245 241 require_once WEFORMS_INCLUDES . '/class-emailer.php';
246 242 require_once WEFORMS_INCLUDES . '/class-field-manager.php';
247 243 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 244 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
@@ -247,9 +243,8 @@
247 243 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 244 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
249 245 require_once WEFORMS_INCLUDES . '/class-form-entry.php';
250 246 require_once WEFORMS_INCLUDES . '/class-form.php';
251 - require_once WEFORMS_INCLUDES . '/class-form-widget.php';
252 247
253 248 require_once WEFORMS_INCLUDES . '/integrations/class-abstract-integration.php';
254 249 require_once WEFORMS_INCLUDES . '/class-integration-manager.php';
255 250
@@ -256,9 +251,8 @@
256 251 require_once WEFORMS_INCLUDES . '/class-ajax.php';
257 252 require_once WEFORMS_INCLUDES . '/class-ajax-upload.php';
258 253 require_once WEFORMS_INCLUDES . '/class-notification.php';
259 254 require_once WEFORMS_INCLUDES . '/class-form-preview.php';
260 - require_once WEFORMS_INCLUDES . '/class-dokan-integration.php';
261 255 require_once WEFORMS_INCLUDES . '/functions.php';
262 256 }
263 257
264 258 /**
@@ -267,10 +261,11 @@
267 261 * @since 1.1.2
268 262 *
269 263 * @return void
270 264 */
271 - public function plugin_upgrades() {
272 - if ( !current_user_can( 'manage_options' ) ) {
265 + function plugin_upgrades() {
266 +
267 + if ( ! is_admin() && ! current_user_can( 'manage_options' ) ) {
273 268 return;
274 269 }
275 270
276 271 require_once WEFORMS_INCLUDES . '/class-upgrades.php';
@@ -289,15 +284,15 @@
289 284 */
290 285 public function init_hooks() {
291 286
292 287 // Localize our plugin
293 - add_action( 'init', [ $this, 'localization_setup' ] );
288 + add_action( 'init', array( $this, 'localization_setup' ) );
294 289
295 290 // initialize the classes
296 - add_action( 'init', [ $this, 'init_classes' ] );
297 - add_action( 'init', [ $this, 'wpdb_table_shortcuts' ], 0 );
291 + add_action( 'init', array( $this, 'init_classes' ) );
292 + add_action( 'init', array( $this, 'wpdb_table_shortcuts' ), 0 );
298 293
299 - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'plugin_action_links' ] );
294 + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
300 295 }
301 296
302 297 /**
303 298 * Set WPDB table shortcut names
@@ -325,71 +320,45 @@
325 320 *
326 321 * @return void
327 322 */
328 323 public function init_classes() {
329 - if ( $this->is_request( 'admin' ) ) {
324 +
325 + if ( is_admin() ) {
330 326 $this->container['admin'] = new WeForms_Admin();
331 327 // $this->container['welcome'] = new WeForms_Admin_Welcome();
332 328 $this->container['templates'] = new WeForms_Template_Manager();
333 329 $this->container['pro_upgrades'] = new WeForms_Pro_Upgrades();
334 330 $this->container['importer'] = new WeForms_Importer_Manager();
335 - $this->container['promo_offer'] = new WeForms_Admin_Promotion();
336 - $this->container['privacy'] = new WeForms_Privacy();
331 + } else {
332 + $this->container['frontend'] = new WeForms_Frontend_Form();
337 333 }
338 334
339 - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) {
340 - $this->container['frontend'] = new WeForms_Frontend_Form();
341 - }
335 + $this->container['emailer'] = new WeForms_Emailer();
336 + $this->container['form'] = new WeForms_Form_Manager();
337 + $this->container['fields'] = new WeForms_Field_Manager();
338 + $this->container['integrations'] = new WeForms_Integration_Manager();
339 + $this->container['preview'] = new WeForms_Form_Preview();
340 + $this->container['scripts'] = new WeForms_Scripts_Styles();
342 341
343 - $this->container['emailer'] = new WeForms_Emailer();
344 - $this->container['form'] = new WeForms_Form_Manager();
345 - $this->container['fields'] = new WeForms_Field_Manager();
346 - $this->container['integrations'] = new WeForms_Integration_Manager();
347 - $this->container['preview'] = new WeForms_Form_Preview();
348 - $this->container['scripts'] = new WeForms_Scripts_Styles();
349 - $this->container['block'] = new weForms_FormBlock();
350 - $this->container['dokan_integration'] = new weForms_Dokan_Integration();
351 342 // instantiate the integrations
352 343 $this->integrations->get_integrations();
353 344
354 - if ( $this->is_request( 'ajax' ) ) {
345 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
355 346 $this->container['ajax'] = new WeForms_Ajax();
356 347 $this->container['ajax_upload'] = new WeForms_Ajax_Upload();
357 348 }
358 - $this->container['weforms_api'] = new WeForms_Api();
359 349 }
360 350
361 351 /**
362 - * The main logging function
363 - *
364 - * @uses error_log
365 - *
366 - * @param string $type type of the error. e.g: debug, error, info
367 - * @param string $msg
368 - */
369 - public static function log( $type = '', $msg = '' ) {
370 -
371 - if(file_exists(WP_CONTENT_DIR . '/weforms.log')){
372 - unlink(WP_CONTENT_DIR . '/weforms.log');
373 - }
374 - return;
375 - // default we are turning the debug mood on, but can be turned off
376 - if ( defined( 'WEFORMS_DEBUG_LOG' ) && false === WEFORMS_DEBUG_LOG ) {
377 - return;
378 - }
379 - $msg = sprintf( "[%s][%s] %s\n", date( 'd.m.Y h:i:s' ), $type, $msg );
380 - @error_log( $msg, 3, weforms_log_file_path() );
381 - }
382 -
383 - /**
384 352 * Plugin action links
385 353 *
386 - * @param array $links
354 + * @param array $links
387 355 *
388 356 * @return array
389 357 */
390 - public function plugin_action_links( $links ) {
391 - $links[] = '<a href="https://weformspro.com/?utm_source=weforms-action-link&utm_medium=textlink&utm_campaign=plugin-docs-link" target="_blank">' . __( 'Docs', 'weforms' ) . '</a>';
358 + function plugin_action_links( $links ) {
359 +
360 + $links[] = '<a href="https://wedevs.com/docs/weforms/?utm_source=weforms-action-link&utm_medium=textlink&utm_campaign=plugin-docs-link" target="_blank">' . __( 'Docs', 'weforms' ) . '</a>';
392 361 $links[] = '<a href="' . admin_url( 'admin.php?page=weforms' ) . '">' . __( 'Settings', 'weforms' ) . '</a>';
393 362
394 363 return $links;
395 364 }
@@ -399,11 +368,12 @@
399 368 *
400 369 * @return bool
401 370 */
402 371 public function is_supported_php( $min_php = null ) {
372 +
403 373 $min_php = $min_php ? $min_php : $this->min_php;
404 374
405 - if ( version_compare( PHP_VERSION, $min_php, '<=' ) ) {
375 + if ( version_compare( PHP_VERSION, $min_php , '<=' ) ) {
406 376 return false;
407 377 }
408 378
409 379 return true;
@@ -413,27 +383,31 @@
413 383 * Show notice about PHP version
414 384 *
415 385 * @return void
416 386 */
417 - public function php_version_notice() {
387 + function php_version_notice() {
388 +
418 389 if ( $this->is_supported_php() || !current_user_can( 'manage_options' ) ) {
419 390 return;
420 391 }
421 392
422 - $error = __( 'Your installed PHP Version is: ', 'weforms' ) . PHP_VERSION . '. ';
423 - $error .= __( 'The <strong>weForms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater.', 'weforms' ); ?>
393 + $error = __( 'Your installed PHP Version is: ', 'erp' ) . PHP_VERSION . '. ';
394 + $error .= __( 'The <strong>weForms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater.', 'weforms' );
395 + ?>
424 396 <div class="error">
425 - <p><?php printf( wp_kses_post ( $error ) ); ?></p>
397 + <p><?php printf( $error ); ?></p>
426 398 </div>
427 399 <?php
428 400 }
429 401
402 +
403 +
430 404 /**
431 405 * Bail out if the php version is lower than
432 406 *
433 407 * @return void
434 408 */
435 - public function auto_deactivate() {
409 + function auto_deactivate() {
436 410 if ( $this->is_supported_php() ) {
437 411 return;
438 412 }
439 413
@@ -444,52 +418,12 @@
444 418 $error .= __( '<p>The <strong>weforms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater', 'weforms' );
445 419 $error .= __( '<p>The version of your PHP is ', 'weforms' ) . '<a href="http://php.net/supported-versions.php" target="_blank"><strong>' . __( 'unsupported and old', 'weforms' ) . '</strong></a>.';
446 420 $error .= __( 'You should update your PHP software or contact your host regarding this matter.</p>', 'weforms' );
447 421
448 - wp_die( wp_kses_post( $error ), esc_html_e( 'Plugin Activation Error', 'weforms' ), [ 'back_link' => true ] );
422 + wp_die( $error, __( 'Plugin Activation Error', 'weforms' ), array( 'back_link' => true ) );
449 423 }
450 424
451 - /**
452 - * What type of request is this?
453 - *
454 - * @since 1.2.3
455 - *
456 - * @param string $type admin, ajax, cron, api or frontend
457 - *
458 - * @return bool
459 - */
460 - private function is_request( $type ) {
461 - switch ( $type ) {
462 - case 'admin':
463 - return is_admin();
464 425
465 - case 'ajax':
466 - return defined( 'DOING_AJAX' );
467 -
468 - case 'cron':
469 - return defined( 'DOING_CRON' );
470 -
471 - case 'api':
472 - return defined( 'REST_REQUEST' );
473 -
474 - case 'frontend':
475 - return ( !is_admin() || defined( 'DOING_AJAX' ) ) && !defined( 'DOING_CRON' );
476 - }
477 - }
478 -
479 - /**
480 - * Init appsero tracker
481 - */
482 - private function init_appsero() {
483 - if ( ! class_exists( 'Appsero\Client' ) ) {
484 - require_once WEFORMS_INCLUDES . '/library/appsero/Client.php';
485 - }
486 -
487 - $client = new Appsero\Client( '213fd70e-0bf3-4710-a35e-934b5a376e13', 'weForms', __FILE__ );
488 -
489 - // Active insights
490 - $client->insights()->init();
491 - }
492 426 } // WeForms
493 427
494 428 /**
495 429 * Initialize the plugin