PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.1.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.1.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 +44 -211 1.6.261.1.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.26
5 + * Plugin URI: https://wedevs.com/weforms/
6 + * Author: weDevs
7 + * Author URI: https://wedevs.com/
8 + * Version: 1.1.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.26';
56 + public $version = '1.1.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,18 +66,11 @@
68 66 * Holds various class instances
69 67 *
70 68 * @var array
71 69 */
72 - private $container = [];
70 + private $container = array();
73 71
74 72 /**
75 - * Minimum PHP version required
76 - *
77 - * @var string
78 - */
79 - private $min_php = '7.2.5';
80 -
81 - /**
82 73 * Constructor for the WeForms class
83 74 *
84 75 * Sets up all the appropriate hooks and actions
85 76 * within our plugin.
@@ -86,20 +77,12 @@
86 77 */
87 78 public function __construct() {
88 79 $this->define_constants();
89 80
90 - if ( !$this->is_supported_php() ) {
91 - register_activation_hook( __FILE__, [ $this, 'auto_deactivate' ] );
92 - add_action( 'admin_notices', [ $this, 'php_version_notice' ] );
81 + register_activation_hook( __FILE__, array( $this, 'activate' ) );
82 + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
93 83
94 - return;
95 - }
96 -
97 - register_activation_hook( __FILE__, [ $this, 'activate' ] );
98 - register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
99 -
100 - add_action( 'admin_init', [ $this, 'plugin_upgrades' ] );
101 - add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
84 + add_action( 'plugins_loaded', array( $this, 'init_plugin' ) );
102 85 }
103 86
104 87 /**
105 88 * Magic getter to bypass referencing plugin.
@@ -135,10 +118,9 @@
135 118 */
136 119 public static function init() {
137 120 static $instance = false;
138 121
139 - if ( !$instance ) {
140 - self::log();
122 + if ( ! $instance ) {
141 123 $instance = new WeForms();
142 124 }
143 125
144 126 return $instance;
@@ -149,11 +131,11 @@
149 131 *
150 132 * @return void
151 133 */
152 134 private function define_constants() {
153 - define( 'WEFORMS_VERSION', $this->version );
135 + define( 'WEFORMS_VERSION', '1.1.0' );
154 136 define( 'WEFORMS_FILE', __FILE__ );
155 - define( 'WEFORMS_ROOT', __DIR__ );
137 + define( 'WEFORMS_ROOT', dirname( __FILE__ ) );
156 138 define( 'WEFORMS_INCLUDES', WEFORMS_ROOT . '/includes' );
157 139 define( 'WEFORMS_ROOT_URI', plugins_url( '', __FILE__ ) );
158 140 define( 'WEFORMS_ASSET_URI', WEFORMS_ROOT_URI . '/assets' );
159 141 }
@@ -175,23 +157,22 @@
175 157 */
176 158 public function activate() {
177 159
178 160 // prepare the environment
179 - require_once WEFORMS_INCLUDES . '/functions.php';
180 161 require_once WEFORMS_INCLUDES . '/class-installer.php';
181 162 require_once WEFORMS_INCLUDES . '/class-field-manager.php';
182 163 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
183 164 require_once WEFORMS_INCLUDES . '/class-template-manager.php';
184 165
185 - if ( !array_key_exists( 'fields', $this->container ) ) {
166 + if ( ! array_key_exists( 'fields', $this->container ) ) {
186 167 $this->container['fields'] = new WeForms_Field_Manager();
187 168 }
188 169
189 - if ( !array_key_exists( 'form', $this->container ) ) {
170 + if ( ! array_key_exists( 'form', $this->container ) ) {
190 171 $this->container['form'] = new WeForms_Form_Manager();
191 172 }
192 173
193 - if ( !array_key_exists( 'templates', $this->container ) ) {
174 + if ( ! array_key_exists( 'templates', $this->container ) ) {
194 175 $this->container['templates'] = new WeForms_Template_Manager();
195 176 }
196 177
197 178 $installer = new WeForms_Installer();
@@ -203,8 +184,9 @@
203 184 *
204 185 * Nothing being called here yet.
205 186 */
206 187 public function deactivate() {
188 +
207 189 }
208 190
209 191 /**
210 192 * Include the required classes
@@ -211,11 +193,12 @@
211 193 *
212 194 * @return void
213 195 */
214 196 public function includes() {
197 +
215 198 require_once WEFORMS_INCLUDES . '/compat/class-abstract-wpuf-integration.php';
216 199
217 - if ( $this->is_request( 'admin' ) ) {
200 + if ( is_admin() ) {
218 201 // compatibility
219 202 require_once WEFORMS_INCLUDES . '/class-template-manager.php';
220 203
221 204 require_once WEFORMS_INCLUDES . '/admin/class-admin.php';
@@ -222,27 +205,21 @@
222 205 require_once WEFORMS_INCLUDES . '/admin/class-admin-welcome.php';
223 206 require_once WEFORMS_INCLUDES . '/class-importer-manager.php';
224 207
225 208 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';
209 +
229 210 } else {
230 211
212 + require_once WEFORMS_INCLUDES . '/class-frontend-form.php';
213 +
231 214 // add reCaptcha library if not found
232 - if ( !function_exists( 'recaptcha_get_html' ) ) {
215 + if ( ! function_exists( 'recaptcha_get_html' ) ) {
233 216 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib.php';
234 217 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib_noCaptcha.php';
235 218 }
236 219 }
237 220
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 221 require_once WEFORMS_INCLUDES . '/class-scripts-styles.php';
244 - require_once WEFORMS_INCLUDES . '/admin/class-gutenblock.php';
245 222 require_once WEFORMS_INCLUDES . '/class-emailer.php';
246 223 require_once WEFORMS_INCLUDES . '/class-field-manager.php';
247 224 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 225 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
@@ -247,9 +224,8 @@
247 224 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 225 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
249 226 require_once WEFORMS_INCLUDES . '/class-form-entry.php';
250 227 require_once WEFORMS_INCLUDES . '/class-form.php';
251 - require_once WEFORMS_INCLUDES . '/class-form-widget.php';
252 228
253 229 require_once WEFORMS_INCLUDES . '/integrations/class-abstract-integration.php';
254 230 require_once WEFORMS_INCLUDES . '/class-integration-manager.php';
255 231
@@ -256,34 +232,12 @@
256 232 require_once WEFORMS_INCLUDES . '/class-ajax.php';
257 233 require_once WEFORMS_INCLUDES . '/class-ajax-upload.php';
258 234 require_once WEFORMS_INCLUDES . '/class-notification.php';
259 235 require_once WEFORMS_INCLUDES . '/class-form-preview.php';
260 - require_once WEFORMS_INCLUDES . '/class-dokan-integration.php';
261 236 require_once WEFORMS_INCLUDES . '/functions.php';
262 237 }
263 238
264 239 /**
265 - * Do plugin upgrades
266 - *
267 - * @since 1.1.2
268 - *
269 - * @return void
270 - */
271 - public function plugin_upgrades() {
272 - if ( !current_user_can( 'manage_options' ) ) {
273 - return;
274 - }
275 -
276 - require_once WEFORMS_INCLUDES . '/class-upgrades.php';
277 -
278 - $upgrader = new WeForms_Upgrades();
279 -
280 - if ( $upgrader->needs_update() ) {
281 - $upgrader->perform_updates();
282 - }
283 - }
284 -
285 - /**
286 240 * Initialize the hooks
287 241 *
288 242 * @return void
289 243 */
@@ -289,15 +243,15 @@
289 243 */
290 244 public function init_hooks() {
291 245
292 246 // Localize our plugin
293 - add_action( 'init', [ $this, 'localization_setup' ] );
247 + add_action( 'init', array( $this, 'localization_setup' ) );
294 248
295 249 // initialize the classes
296 - add_action( 'init', [ $this, 'init_classes' ] );
297 - add_action( 'init', [ $this, 'wpdb_table_shortcuts' ], 0 );
250 + add_action( 'init', array( $this, 'init_classes' ) );
251 + add_action( 'init', array( $this, 'wpdb_table_shortcuts' ), 0 );
298 252
299 - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'plugin_action_links' ] );
253 + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
300 254 }
301 255
302 256 /**
303 257 * Set WPDB table shortcut names
@@ -325,171 +279,50 @@
325 279 *
326 280 * @return void
327 281 */
328 282 public function init_classes() {
329 - if ( $this->is_request( 'admin' ) ) {
283 +
284 + if ( is_admin() ) {
330 285 $this->container['admin'] = new WeForms_Admin();
331 286 // $this->container['welcome'] = new WeForms_Admin_Welcome();
332 287 $this->container['templates'] = new WeForms_Template_Manager();
333 288 $this->container['pro_upgrades'] = new WeForms_Pro_Upgrades();
334 289 $this->container['importer'] = new WeForms_Importer_Manager();
335 - $this->container['promo_offer'] = new WeForms_Admin_Promotion();
336 - $this->container['privacy'] = new WeForms_Privacy();
290 + } else {
291 + $this->container['frontend'] = new WeForms_Frontend_Form();
337 292 }
338 293
339 - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) {
340 - $this->container['frontend'] = new WeForms_Frontend_Form();
341 - }
294 + $this->container['emailer'] = new WeForms_Emailer();
295 + $this->container['form'] = new WeForms_Form_Manager();
296 + $this->container['fields'] = new WeForms_Field_Manager();
297 + $this->container['integrations'] = new WeForms_Integration_Manager();
298 + $this->container['preview'] = new WeForms_Form_Preview();
299 + $this->container['scripts'] = new WeForms_Scripts_Styles();
342 300
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 301 // instantiate the integrations
352 302 $this->integrations->get_integrations();
353 303
354 - if ( $this->is_request( 'ajax' ) ) {
304 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
355 305 $this->container['ajax'] = new WeForms_Ajax();
356 306 $this->container['ajax_upload'] = new WeForms_Ajax_Upload();
357 307 }
358 - $this->container['weforms_api'] = new WeForms_Api();
359 308 }
360 309
361 310 /**
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 311 * Plugin action links
385 312 *
386 - * @param array $links
313 + * @param array $links
387 314 *
388 315 * @return array
389 316 */
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>';
317 + function plugin_action_links( $links ) {
318 +
319 + $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 320 $links[] = '<a href="' . admin_url( 'admin.php?page=weforms' ) . '">' . __( 'Settings', 'weforms' ) . '</a>';
393 321
394 322 return $links;
395 323 }
396 324
397 - /**
398 - * Check if the PHP version is supported
399 - *
400 - * @return bool
401 - */
402 - public function is_supported_php( $min_php = null ) {
403 - $min_php = $min_php ? $min_php : $this->min_php;
404 -
405 - if ( version_compare( PHP_VERSION, $min_php, '<=' ) ) {
406 - return false;
407 - }
408 -
409 - return true;
410 - }
411 -
412 - /**
413 - * Show notice about PHP version
414 - *
415 - * @return void
416 - */
417 - public function php_version_notice() {
418 - if ( $this->is_supported_php() || !current_user_can( 'manage_options' ) ) {
419 - return;
420 - }
421 -
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' ); ?>
424 - <div class="error">
425 - <p><?php printf( wp_kses_post ( $error ) ); ?></p>
426 - </div>
427 - <?php
428 - }
429 -
430 - /**
431 - * Bail out if the php version is lower than
432 - *
433 - * @return void
434 - */
435 - public function auto_deactivate() {
436 - if ( $this->is_supported_php() ) {
437 - return;
438 - }
439 -
440 - deactivate_plugins( plugin_basename( __FILE__ ) );
441 -
442 - $error = __( '<h1>An Error Occured</h1>', 'weforms' );
443 - $error .= __( '<h2>Your installed PHP Version is: ', 'weforms' ) . PHP_VERSION . '</h2>';
444 - $error .= __( '<p>The <strong>weforms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater', 'weforms' );
445 - $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 - $error .= __( 'You should update your PHP software or contact your host regarding this matter.</p>', 'weforms' );
447 -
448 - wp_die( wp_kses_post( $error ), esc_html_e( 'Plugin Activation Error', 'weforms' ), [ 'back_link' => true ] );
449 - }
450 -
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 -
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 325 } // WeForms
493 326
494 327 /**
495 328 * Initialize the plugin