| @@ -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.2.8 | |
| 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.26'; | |
| 58 | + public $version = '1.2.8'; | |
| 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 = '7.2.5'; | |
| 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,22 +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 | + add_action( 'admin_init', array( $this, 'plugin_upgrades' ) ); | |
| 103 | + add_action( 'plugins_loaded', array( $this, 'init_plugin' ) ); | |
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 106 | /** |
| 105 | 107 | * Magic getter to bypass referencing plugin. |
| @@ -135,10 +137,9 @@ | ||
| 135 | 137 | */ |
| 136 | 138 | public static function init() { |
| 137 | 139 | static $instance = false; |
| 138 | 140 | |
| 139 | - if ( !$instance ) { | |
| 140 | - self::log(); | |
| 141 | + if ( ! $instance ) { | |
| 141 | 142 | $instance = new WeForms(); |
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | return $instance; |
| @@ -151,9 +152,9 @@ | ||
| 151 | 152 | */ |
| 152 | 153 | private function define_constants() { |
| 153 | 154 | define( 'WEFORMS_VERSION', $this->version ); |
| 154 | 155 | define( 'WEFORMS_FILE', __FILE__ ); |
| 155 | - define( 'WEFORMS_ROOT', __DIR__ ); | |
| 156 | + define( 'WEFORMS_ROOT', dirname( __FILE__ ) ); | |
| 156 | 157 | define( 'WEFORMS_INCLUDES', WEFORMS_ROOT . '/includes' ); |
| 157 | 158 | define( 'WEFORMS_ROOT_URI', plugins_url( '', __FILE__ ) ); |
| 158 | 159 | define( 'WEFORMS_ASSET_URI', WEFORMS_ROOT_URI . '/assets' ); |
| 159 | 160 | } |
| @@ -163,8 +164,9 @@ | ||
| 163 | 164 | * |
| 164 | 165 | * @return void |
| 165 | 166 | */ |
| 166 | 167 | public function init_plugin() { |
| 168 | + | |
| 167 | 169 | $this->includes(); |
| 168 | 170 | $this->init_hooks(); |
| 169 | 171 | |
| 170 | 172 | do_action( 'weforms_loaded' ); |
| @@ -181,17 +183,17 @@ | ||
| 181 | 183 | require_once WEFORMS_INCLUDES . '/class-field-manager.php'; |
| 182 | 184 | require_once WEFORMS_INCLUDES . '/class-form-manager.php'; |
| 183 | 185 | require_once WEFORMS_INCLUDES . '/class-template-manager.php'; |
| 184 | 186 | |
| 185 | - if ( !array_key_exists( 'fields', $this->container ) ) { | |
| 187 | + if ( ! array_key_exists( 'fields', $this->container ) ) { | |
| 186 | 188 | $this->container['fields'] = new WeForms_Field_Manager(); |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | - if ( !array_key_exists( 'form', $this->container ) ) { | |
| 191 | + if ( ! array_key_exists( 'form', $this->container ) ) { | |
| 190 | 192 | $this->container['form'] = new WeForms_Form_Manager(); |
| 191 | 193 | } |
| 192 | 194 | |
| 193 | - if ( !array_key_exists( 'templates', $this->container ) ) { | |
| 195 | + if ( ! array_key_exists( 'templates', $this->container ) ) { | |
| 194 | 196 | $this->container['templates'] = new WeForms_Template_Manager(); |
| 195 | 197 | } |
| 196 | 198 | |
| 197 | 199 | $installer = new WeForms_Installer(); |
| @@ -203,8 +205,9 @@ | ||
| 203 | 205 | * |
| 204 | 206 | * Nothing being called here yet. |
| 205 | 207 | */ |
| 206 | 208 | public function deactivate() { |
| 209 | + | |
| 207 | 210 | } |
| 208 | 211 | |
| 209 | 212 | /** |
| 210 | 213 | * Include the required classes |
| @@ -211,8 +214,9 @@ | ||
| 211 | 214 | * |
| 212 | 215 | * @return void |
| 213 | 216 | */ |
| 214 | 217 | public function includes() { |
| 218 | + | |
| 215 | 219 | require_once WEFORMS_INCLUDES . '/compat/class-abstract-wpuf-integration.php'; |
| 216 | 220 | |
| 217 | 221 | if ( $this->is_request( 'admin' ) ) { |
| 218 | 222 | // compatibility |
| @@ -223,14 +227,13 @@ | ||
| 223 | 227 | require_once WEFORMS_INCLUDES . '/class-importer-manager.php'; |
| 224 | 228 | |
| 225 | 229 | require_once WEFORMS_INCLUDES . '/admin/class-pro-upgrades.php'; |
| 226 | 230 | 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'; | |
| 231 | + | |
| 229 | 232 | } else { |
| 230 | 233 | |
| 231 | 234 | // add reCaptcha library if not found |
| 232 | - if ( !function_exists( 'recaptcha_get_html' ) ) { | |
| 235 | + if ( ! function_exists( 'recaptcha_get_html' ) ) { | |
| 233 | 236 | require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib.php'; |
| 234 | 237 | require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib_noCaptcha.php'; |
| 235 | 238 | } |
| 236 | 239 | } |
| @@ -237,10 +240,10 @@ | ||
| 237 | 240 | |
| 238 | 241 | if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) { |
| 239 | 242 | require_once WEFORMS_INCLUDES . '/class-frontend-form.php'; |
| 240 | 243 | } |
| 241 | - require_once WEFORMS_INCLUDES . '/api/class-weforms-api-rest-controller.php'; | |
| 242 | - require_once WEFORMS_INCLUDES . '/class-weforms-api.php'; | |
| 244 | + | |
| 245 | + require_once WEFORMS_INCLUDES . '/admin/class-wedevs-insights.php'; | |
| 243 | 246 | require_once WEFORMS_INCLUDES . '/class-scripts-styles.php'; |
| 244 | 247 | require_once WEFORMS_INCLUDES . '/admin/class-gutenblock.php'; |
| 245 | 248 | require_once WEFORMS_INCLUDES . '/class-emailer.php'; |
| 246 | 249 | require_once WEFORMS_INCLUDES . '/class-field-manager.php'; |
| @@ -256,9 +259,8 @@ | ||
| 256 | 259 | require_once WEFORMS_INCLUDES . '/class-ajax.php'; |
| 257 | 260 | require_once WEFORMS_INCLUDES . '/class-ajax-upload.php'; |
| 258 | 261 | require_once WEFORMS_INCLUDES . '/class-notification.php'; |
| 259 | 262 | require_once WEFORMS_INCLUDES . '/class-form-preview.php'; |
| 260 | - require_once WEFORMS_INCLUDES . '/class-dokan-integration.php'; | |
| 261 | 263 | require_once WEFORMS_INCLUDES . '/functions.php'; |
| 262 | 264 | } |
| 263 | 265 | |
| 264 | 266 | /** |
| @@ -267,10 +269,11 @@ | ||
| 267 | 269 | * @since 1.1.2 |
| 268 | 270 | * |
| 269 | 271 | * @return void |
| 270 | 272 | */ |
| 271 | - public function plugin_upgrades() { | |
| 272 | - if ( !current_user_can( 'manage_options' ) ) { | |
| 273 | + function plugin_upgrades() { | |
| 274 | + | |
| 275 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 273 | 276 | return; |
| 274 | 277 | } |
| 275 | 278 | |
| 276 | 279 | require_once WEFORMS_INCLUDES . '/class-upgrades.php'; |
| @@ -289,15 +292,15 @@ | ||
| 289 | 292 | */ |
| 290 | 293 | public function init_hooks() { |
| 291 | 294 | |
| 292 | 295 | // Localize our plugin |
| 293 | - add_action( 'init', [ $this, 'localization_setup' ] ); | |
| 296 | + add_action( 'init', array( $this, 'localization_setup' ) ); | |
| 294 | 297 | |
| 295 | 298 | // initialize the classes |
| 296 | - add_action( 'init', [ $this, 'init_classes' ] ); | |
| 297 | - add_action( 'init', [ $this, 'wpdb_table_shortcuts' ], 0 ); | |
| 299 | + add_action( 'init', array( $this, 'init_classes' ) ); | |
| 300 | + add_action( 'init', array( $this, 'wpdb_table_shortcuts' ), 0 ); | |
| 298 | 301 | |
| 299 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'plugin_action_links' ] ); | |
| 302 | + add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); | |
| 300 | 303 | } |
| 301 | 304 | |
| 302 | 305 | /** |
| 303 | 306 | * Set WPDB table shortcut names |
| @@ -325,8 +328,9 @@ | ||
| 325 | 328 | * |
| 326 | 329 | * @return void |
| 327 | 330 | */ |
| 328 | 331 | public function init_classes() { |
| 332 | + | |
| 329 | 333 | if ( $this->is_request( 'admin' ) ) { |
| 330 | 334 | $this->container['admin'] = new WeForms_Admin(); |
| 331 | 335 | // $this->container['welcome'] = new WeForms_Admin_Welcome(); |
| 332 | 336 | $this->container['templates'] = new WeForms_Template_Manager(); |
| @@ -332,9 +336,8 @@ | ||
| 332 | 336 | $this->container['templates'] = new WeForms_Template_Manager(); |
| 333 | 337 | $this->container['pro_upgrades'] = new WeForms_Pro_Upgrades(); |
| 334 | 338 | $this->container['importer'] = new WeForms_Importer_Manager(); |
| 335 | 339 | $this->container['promo_offer'] = new WeForms_Admin_Promotion(); |
| 336 | - $this->container['privacy'] = new WeForms_Privacy(); | |
| 337 | 340 | } |
| 338 | 341 | |
| 339 | 342 | if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) { |
| 340 | 343 | $this->container['frontend'] = new WeForms_Frontend_Form(); |
| @@ -339,16 +342,16 @@ | ||
| 339 | 342 | if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) { |
| 340 | 343 | $this->container['frontend'] = new WeForms_Frontend_Form(); |
| 341 | 344 | } |
| 342 | 345 | |
| 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(); | |
| 346 | + $this->container['insights'] = new WeDevs_Insights( 'weforms', 'weForms', __FILE__ ); | |
| 347 | + $this->container['emailer'] = new WeForms_Emailer(); | |
| 348 | + $this->container['form'] = new WeForms_Form_Manager(); | |
| 349 | + $this->container['fields'] = new WeForms_Field_Manager(); | |
| 350 | + $this->container['integrations'] = new WeForms_Integration_Manager(); | |
| 351 | + $this->container['preview'] = new WeForms_Form_Preview(); | |
| 352 | + $this->container['scripts'] = new WeForms_Scripts_Styles(); | |
| 353 | + $this->container['block'] = new weForms_FormBlock(); | |
| 351 | 354 | // instantiate the integrations |
| 352 | 355 | $this->integrations->get_integrations(); |
| 353 | 356 | |
| 354 | 357 | if ( $this->is_request( 'ajax' ) ) { |
| @@ -354,9 +357,8 @@ | ||
| 354 | 357 | if ( $this->is_request( 'ajax' ) ) { |
| 355 | 358 | $this->container['ajax'] = new WeForms_Ajax(); |
| 356 | 359 | $this->container['ajax_upload'] = new WeForms_Ajax_Upload(); |
| 357 | 360 | } |
| 358 | - $this->container['weforms_api'] = new WeForms_Api(); | |
| 359 | 361 | } |
| 360 | 362 | |
| 361 | 363 | /** |
| 362 | 364 | * The main logging function |
| @@ -361,22 +363,18 @@ | ||
| 361 | 363 | /** |
| 362 | 364 | * The main logging function |
| 363 | 365 | * |
| 364 | 366 | * @uses error_log |
| 365 | - * | |
| 366 | 367 | * @param string $type type of the error. e.g: debug, error, info |
| 367 | 368 | * @param string $msg |
| 368 | 369 | */ |
| 369 | 370 | public static function log( $type = '', $msg = '' ) { |
| 370 | 371 | |
| 371 | - if(file_exists(WP_CONTENT_DIR . '/weforms.log')){ | |
| 372 | - unlink(WP_CONTENT_DIR . '/weforms.log'); | |
| 373 | - } | |
| 374 | - return; | |
| 375 | 372 | // 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; | |
| 373 | + if ( defined( 'WEFORMS_DEBUG_LOG' ) && false === WEFORMS_DEBUG_LOG ) { | |
| 374 | + return; | |
| 378 | 375 | } |
| 376 | + | |
| 379 | 377 | $msg = sprintf( "[%s][%s] %s\n", date( 'd.m.Y h:i:s' ), $type, $msg ); |
| 380 | 378 | @error_log( $msg, 3, weforms_log_file_path() ); |
| 381 | 379 | } |
| 382 | 380 | |
| @@ -382,14 +380,15 @@ | ||
| 382 | 380 | |
| 383 | 381 | /** |
| 384 | 382 | * Plugin action links |
| 385 | 383 | * |
| 386 | - * @param array $links | |
| 384 | + * @param array $links | |
| 387 | 385 | * |
| 388 | 386 | * @return array |
| 389 | 387 | */ |
| 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>'; | |
| 388 | + function plugin_action_links( $links ) { | |
| 389 | + | |
| 390 | + $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 | 391 | $links[] = '<a href="' . admin_url( 'admin.php?page=weforms' ) . '">' . __( 'Settings', 'weforms' ) . '</a>'; |
| 393 | 392 | |
| 394 | 393 | return $links; |
| 395 | 394 | } |
| @@ -399,11 +398,12 @@ | ||
| 399 | 398 | * |
| 400 | 399 | * @return bool |
| 401 | 400 | */ |
| 402 | 401 | public function is_supported_php( $min_php = null ) { |
| 402 | + | |
| 403 | 403 | $min_php = $min_php ? $min_php : $this->min_php; |
| 404 | 404 | |
| 405 | - if ( version_compare( PHP_VERSION, $min_php, '<=' ) ) { | |
| 405 | + if ( version_compare( PHP_VERSION, $min_php , '<=' ) ) { | |
| 406 | 406 | return false; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | return true; |
| @@ -413,17 +413,19 @@ | ||
| 413 | 413 | * Show notice about PHP version |
| 414 | 414 | * |
| 415 | 415 | * @return void |
| 416 | 416 | */ |
| 417 | - public function php_version_notice() { | |
| 418 | - if ( $this->is_supported_php() || !current_user_can( 'manage_options' ) ) { | |
| 417 | + function php_version_notice() { | |
| 418 | + | |
| 419 | + if ( $this->is_supported_php() || ! current_user_can( 'manage_options' ) ) { | |
| 419 | 420 | return; |
| 420 | 421 | } |
| 421 | 422 | |
| 422 | 423 | $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 | + $error .= __( 'The <strong>weForms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater.', 'weforms' ); | |
| 425 | + ?> | |
| 424 | 426 | <div class="error"> |
| 425 | - <p><?php printf( wp_kses_post ( $error ) ); ?></p> | |
| 427 | + <p><?php printf( $error ); ?></p> | |
| 426 | 428 | </div> |
| 427 | 429 | <?php |
| 428 | 430 | } |
| 429 | 431 | |
| @@ -431,9 +433,9 @@ | ||
| 431 | 433 | * Bail out if the php version is lower than |
| 432 | 434 | * |
| 433 | 435 | * @return void |
| 434 | 436 | */ |
| 435 | - public function auto_deactivate() { | |
| 437 | + function auto_deactivate() { | |
| 436 | 438 | if ( $this->is_supported_php() ) { |
| 437 | 439 | return; |
| 438 | 440 | } |
| 439 | 441 | |
| @@ -444,9 +446,9 @@ | ||
| 444 | 446 | $error .= __( '<p>The <strong>weforms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater', 'weforms' ); |
| 445 | 447 | $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 | 448 | $error .= __( 'You should update your PHP software or contact your host regarding this matter.</p>', 'weforms' ); |
| 447 | 449 | |
| 448 | - wp_die( wp_kses_post( $error ), esc_html_e( 'Plugin Activation Error', 'weforms' ), [ 'back_link' => true ] ); | |
| 450 | + wp_die( $error, __( 'Plugin Activation Error', 'weforms' ), array( 'back_link' => true ) ); | |
| 449 | 451 | } |
| 450 | 452 | |
| 451 | 453 | /** |
| 452 | 454 | * What type of request is this? |
| @@ -452,44 +454,33 @@ | ||
| 452 | 454 | * What type of request is this? |
| 453 | 455 | * |
| 454 | 456 | * @since 1.2.3 |
| 455 | 457 | * |
| 456 | - * @param string $type admin, ajax, cron, api or frontend | |
| 458 | + * @param string $type admin, ajax, cron, api or frontend. | |
| 457 | 459 | * |
| 458 | 460 | * @return bool |
| 459 | 461 | */ |
| 460 | 462 | private function is_request( $type ) { |
| 463 | + | |
| 461 | 464 | switch ( $type ) { |
| 462 | - case 'admin': | |
| 465 | + case 'admin' : | |
| 463 | 466 | return is_admin(); |
| 464 | 467 | |
| 465 | - case 'ajax': | |
| 468 | + case 'ajax' : | |
| 466 | 469 | return defined( 'DOING_AJAX' ); |
| 467 | 470 | |
| 468 | - case 'cron': | |
| 471 | + case 'cron' : | |
| 469 | 472 | return defined( 'DOING_CRON' ); |
| 470 | 473 | |
| 471 | 474 | case 'api': |
| 472 | 475 | return defined( 'REST_REQUEST' ); |
| 473 | 476 | |
| 474 | - case 'frontend': | |
| 475 | - return ( !is_admin() || defined( 'DOING_AJAX' ) ) && !defined( 'DOING_CRON' ); | |
| 477 | + case 'frontend' : | |
| 478 | + return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ); | |
| 476 | 479 | } |
| 477 | 480 | } |
| 478 | 481 | |
| 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 | 482 | |
| 487 | - $client = new Appsero\Client( '213fd70e-0bf3-4710-a35e-934b5a376e13', 'weForms', __FILE__ ); | |
| 488 | - | |
| 489 | - // Active insights | |
| 490 | - $client->insights()->init(); | |
| 491 | - } | |
| 492 | 483 | } // WeForms |
| 493 | 484 | |
| 494 | 485 | /** |
| 495 | 486 | * Initialize the plugin |
| @@ -500,5 +491,5 @@ | ||
| 500 | 491 | return WeForms::init(); |
| 501 | 492 | } |
| 502 | 493 | |
| 503 | 494 | // kick-off |
| 504 | -weforms(); | |
| 495 | +weforms(); | |