PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.1.0
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.1.0
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 +43 -225 1.6.161.1.0 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.16
5 + * Plugin URI: https://wedevs.com/weforms/
6 + * Author: weDevs
7 + * Author URI: https://wedevs.com/
8 + * Version: 1.1.0
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.16';
56 + public $version = '1.1.0';
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 = '5.6.0';
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 }
@@ -171,30 +153,14 @@
171 153 }
172 154
173 155 /**
174 156 * Placeholder for activation function
157 + *
158 + * Nothing being called here yet.
175 159 */
176 160 public function activate() {
177 -
178 - // prepare the environment
179 - require_once WEFORMS_INCLUDES . '/functions.php';
180 161 require_once WEFORMS_INCLUDES . '/class-installer.php';
181 - require_once WEFORMS_INCLUDES . '/class-field-manager.php';
182 - require_once WEFORMS_INCLUDES . '/class-form-manager.php';
183 - require_once WEFORMS_INCLUDES . '/class-template-manager.php';
184 162
185 - if ( !array_key_exists( 'fields', $this->container ) ) {
186 - $this->container['fields'] = new WeForms_Field_Manager();
187 - }
188 -
189 - if ( !array_key_exists( 'form', $this->container ) ) {
190 - $this->container['form'] = new WeForms_Form_Manager();
191 - }
192 -
193 - if ( !array_key_exists( 'templates', $this->container ) ) {
194 - $this->container['templates'] = new WeForms_Template_Manager();
195 - }
196 -
197 163 $installer = new WeForms_Installer();
198 164 $installer->install();
199 165 }
200 166
@@ -203,8 +169,9 @@
203 169 *
204 170 * Nothing being called here yet.
205 171 */
206 172 public function deactivate() {
173 +
207 174 }
208 175
209 176 /**
210 177 * Include the required classes
@@ -211,11 +178,12 @@
211 178 *
212 179 * @return void
213 180 */
214 181 public function includes() {
182 +
215 183 require_once WEFORMS_INCLUDES . '/compat/class-abstract-wpuf-integration.php';
216 184
217 - if ( $this->is_request( 'admin' ) ) {
185 + if ( is_admin() ) {
218 186 // compatibility
219 187 require_once WEFORMS_INCLUDES . '/class-template-manager.php';
220 188
221 189 require_once WEFORMS_INCLUDES . '/admin/class-admin.php';
@@ -222,27 +190,21 @@
222 190 require_once WEFORMS_INCLUDES . '/admin/class-admin-welcome.php';
223 191 require_once WEFORMS_INCLUDES . '/class-importer-manager.php';
224 192
225 193 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';
194 +
229 195 } else {
230 196
197 + require_once WEFORMS_INCLUDES . '/class-frontend-form.php';
198 +
231 199 // add reCaptcha library if not found
232 - if ( !function_exists( 'recaptcha_get_html' ) ) {
200 + if ( ! function_exists( 'recaptcha_get_html' ) ) {
233 201 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib.php';
234 202 require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib_noCaptcha.php';
235 203 }
236 204 }
237 205
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 206 require_once WEFORMS_INCLUDES . '/class-scripts-styles.php';
244 - require_once WEFORMS_INCLUDES . '/admin/class-gutenblock.php';
245 207 require_once WEFORMS_INCLUDES . '/class-emailer.php';
246 208 require_once WEFORMS_INCLUDES . '/class-field-manager.php';
247 209 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 210 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
@@ -247,9 +209,8 @@
247 209 require_once WEFORMS_INCLUDES . '/class-form-manager.php';
248 210 require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php';
249 211 require_once WEFORMS_INCLUDES . '/class-form-entry.php';
250 212 require_once WEFORMS_INCLUDES . '/class-form.php';
251 - require_once WEFORMS_INCLUDES . '/class-form-widget.php';
252 213
253 214 require_once WEFORMS_INCLUDES . '/integrations/class-abstract-integration.php';
254 215 require_once WEFORMS_INCLUDES . '/class-integration-manager.php';
255 216
@@ -256,34 +217,12 @@
256 217 require_once WEFORMS_INCLUDES . '/class-ajax.php';
257 218 require_once WEFORMS_INCLUDES . '/class-ajax-upload.php';
258 219 require_once WEFORMS_INCLUDES . '/class-notification.php';
259 220 require_once WEFORMS_INCLUDES . '/class-form-preview.php';
260 - require_once WEFORMS_INCLUDES . '/class-dokan-integration.php';
261 221 require_once WEFORMS_INCLUDES . '/functions.php';
262 222 }
263 223
264 224 /**
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 225 * Initialize the hooks
287 226 *
288 227 * @return void
289 228 */
@@ -289,15 +228,15 @@
289 228 */
290 229 public function init_hooks() {
291 230
292 231 // Localize our plugin
293 - add_action( 'init', [ $this, 'localization_setup' ] );
232 + add_action( 'init', array( $this, 'localization_setup' ) );
294 233
295 234 // initialize the classes
296 - add_action( 'init', [ $this, 'init_classes' ] );
297 - add_action( 'init', [ $this, 'wpdb_table_shortcuts' ], 0 );
235 + add_action( 'init', array( $this, 'init_classes' ) );
236 + add_action( 'init', array( $this, 'wpdb_table_shortcuts' ), 0 );
298 237
299 - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'plugin_action_links' ] );
238 + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
300 239 }
301 240
302 241 /**
303 242 * Set WPDB table shortcut names
@@ -325,171 +264,50 @@
325 264 *
326 265 * @return void
327 266 */
328 267 public function init_classes() {
329 - if ( $this->is_request( 'admin' ) ) {
268 +
269 + if ( is_admin() ) {
330 270 $this->container['admin'] = new WeForms_Admin();
331 271 // $this->container['welcome'] = new WeForms_Admin_Welcome();
332 272 $this->container['templates'] = new WeForms_Template_Manager();
333 273 $this->container['pro_upgrades'] = new WeForms_Pro_Upgrades();
334 274 $this->container['importer'] = new WeForms_Importer_Manager();
335 - $this->container['promo_offer'] = new WeForms_Admin_Promotion();
336 - $this->container['privacy'] = new WeForms_Privacy();
275 + } else {
276 + $this->container['frontend'] = new WeForms_Frontend_Form();
337 277 }
338 278
339 - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) {
340 - $this->container['frontend'] = new WeForms_Frontend_Form();
341 - }
279 + $this->container['emailer'] = new WeForms_Emailer();
280 + $this->container['form'] = new WeForms_Form_Manager();
281 + $this->container['fields'] = new WeForms_Field_Manager();
282 + $this->container['integrations'] = new WeForms_Integration_Manager();
283 + $this->container['preview'] = new WeForms_Form_Preview();
284 + $this->container['scripts'] = new WeForms_Scripts_Styles();
342 285
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 286 // instantiate the integrations
352 287 $this->integrations->get_integrations();
353 288
354 - if ( $this->is_request( 'ajax' ) ) {
289 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
355 290 $this->container['ajax'] = new WeForms_Ajax();
356 291 $this->container['ajax_upload'] = new WeForms_Ajax_Upload();
357 292 }
358 - $this->container['weforms_api'] = new WeForms_Api();
359 293 }
360 294
361 295 /**
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 296 * Plugin action links
385 297 *
386 - * @param array $links
298 + * @param array $links
387 299 *
388 300 * @return array
389 301 */
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>';
302 + function plugin_action_links( $links ) {
303 +
304 + $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 305 $links[] = '<a href="' . admin_url( 'admin.php?page=weforms' ) . '">' . __( 'Settings', 'weforms' ) . '</a>';
393 306
394 307 return $links;
395 308 }
396 309
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 310 } // WeForms
493 311
494 312 /**
495 313 * Initialize the plugin