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