| @@ -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.8 | |
| 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.8'; | |
| 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 = '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,22 +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' ] ); | |
| 102 | - | |
| 103 | - $this->init_appsero(); | |
| 84 | + add_action( 'plugins_loaded', array( $this, 'init_plugin' ) ); | |
| 104 | 85 | } |
| 105 | 86 | |
| 106 | 87 | /** |
| 107 | 88 | * Magic getter to bypass referencing plugin. |
| @@ -137,10 +118,9 @@ | ||
| 137 | 118 | */ |
| 138 | 119 | public static function init() { |
| 139 | 120 | static $instance = false; |
| 140 | 121 | |
| 141 | - if ( !$instance ) { | |
| 142 | - self::log(); | |
| 122 | + if ( ! $instance ) { | |
| 143 | 123 | $instance = new WeForms(); |
| 144 | 124 | } |
| 145 | 125 | |
| 146 | 126 | return $instance; |
| @@ -151,11 +131,11 @@ | ||
| 151 | 131 | * |
| 152 | 132 | * @return void |
| 153 | 133 | */ |
| 154 | 134 | private function define_constants() { |
| 155 | - define( 'WEFORMS_VERSION', $this->version ); | |
| 135 | + define( 'WEFORMS_VERSION', '1.1.0' ); | |
| 156 | 136 | define( 'WEFORMS_FILE', __FILE__ ); |
| 157 | - define( 'WEFORMS_ROOT', __DIR__ ); | |
| 137 | + define( 'WEFORMS_ROOT', dirname( __FILE__ ) ); | |
| 158 | 138 | define( 'WEFORMS_INCLUDES', WEFORMS_ROOT . '/includes' ); |
| 159 | 139 | define( 'WEFORMS_ROOT_URI', plugins_url( '', __FILE__ ) ); |
| 160 | 140 | define( 'WEFORMS_ASSET_URI', WEFORMS_ROOT_URI . '/assets' ); |
| 161 | 141 | } |
| @@ -177,23 +157,22 @@ | ||
| 177 | 157 | */ |
| 178 | 158 | public function activate() { |
| 179 | 159 | |
| 180 | 160 | // prepare the environment |
| 181 | - require_once WEFORMS_INCLUDES . '/functions.php'; | |
| 182 | 161 | require_once WEFORMS_INCLUDES . '/class-installer.php'; |
| 183 | 162 | require_once WEFORMS_INCLUDES . '/class-field-manager.php'; |
| 184 | 163 | require_once WEFORMS_INCLUDES . '/class-form-manager.php'; |
| 185 | 164 | require_once WEFORMS_INCLUDES . '/class-template-manager.php'; |
| 186 | 165 | |
| 187 | - if ( !array_key_exists( 'fields', $this->container ) ) { | |
| 166 | + if ( ! array_key_exists( 'fields', $this->container ) ) { | |
| 188 | 167 | $this->container['fields'] = new WeForms_Field_Manager(); |
| 189 | 168 | } |
| 190 | 169 | |
| 191 | - if ( !array_key_exists( 'form', $this->container ) ) { | |
| 170 | + if ( ! array_key_exists( 'form', $this->container ) ) { | |
| 192 | 171 | $this->container['form'] = new WeForms_Form_Manager(); |
| 193 | 172 | } |
| 194 | 173 | |
| 195 | - if ( !array_key_exists( 'templates', $this->container ) ) { | |
| 174 | + if ( ! array_key_exists( 'templates', $this->container ) ) { | |
| 196 | 175 | $this->container['templates'] = new WeForms_Template_Manager(); |
| 197 | 176 | } |
| 198 | 177 | |
| 199 | 178 | $installer = new WeForms_Installer(); |
| @@ -205,8 +184,9 @@ | ||
| 205 | 184 | * |
| 206 | 185 | * Nothing being called here yet. |
| 207 | 186 | */ |
| 208 | 187 | public function deactivate() { |
| 188 | + | |
| 209 | 189 | } |
| 210 | 190 | |
| 211 | 191 | /** |
| 212 | 192 | * Include the required classes |
| @@ -213,11 +193,12 @@ | ||
| 213 | 193 | * |
| 214 | 194 | * @return void |
| 215 | 195 | */ |
| 216 | 196 | public function includes() { |
| 197 | + | |
| 217 | 198 | require_once WEFORMS_INCLUDES . '/compat/class-abstract-wpuf-integration.php'; |
| 218 | 199 | |
| 219 | - if ( $this->is_request( 'admin' ) ) { | |
| 200 | + if ( is_admin() ) { | |
| 220 | 201 | // compatibility |
| 221 | 202 | require_once WEFORMS_INCLUDES . '/class-template-manager.php'; |
| 222 | 203 | |
| 223 | 204 | require_once WEFORMS_INCLUDES . '/admin/class-admin.php'; |
| @@ -224,27 +205,21 @@ | ||
| 224 | 205 | require_once WEFORMS_INCLUDES . '/admin/class-admin-welcome.php'; |
| 225 | 206 | require_once WEFORMS_INCLUDES . '/class-importer-manager.php'; |
| 226 | 207 | |
| 227 | 208 | 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'; | |
| 209 | + | |
| 231 | 210 | } else { |
| 232 | 211 | |
| 212 | + require_once WEFORMS_INCLUDES . '/class-frontend-form.php'; | |
| 213 | + | |
| 233 | 214 | // add reCaptcha library if not found |
| 234 | - if ( !function_exists( 'recaptcha_get_html' ) ) { | |
| 215 | + if ( ! function_exists( 'recaptcha_get_html' ) ) { | |
| 235 | 216 | require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib.php'; |
| 236 | 217 | require_once WEFORMS_INCLUDES . '/library/reCaptcha/recaptchalib_noCaptcha.php'; |
| 237 | 218 | } |
| 238 | 219 | } |
| 239 | 220 | |
| 240 | - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) { | |
| 241 | - require_once WEFORMS_INCLUDES . '/class-frontend-form.php'; | |
| 242 | - } | |
| 243 | - require_once WEFORMS_INCLUDES . '/api/class-weforms-api-rest-controller.php'; | |
| 244 | - require_once WEFORMS_INCLUDES . '/class-weforms-api.php'; | |
| 245 | 221 | require_once WEFORMS_INCLUDES . '/class-scripts-styles.php'; |
| 246 | - require_once WEFORMS_INCLUDES . '/admin/class-gutenblock.php'; | |
| 247 | 222 | require_once WEFORMS_INCLUDES . '/class-emailer.php'; |
| 248 | 223 | require_once WEFORMS_INCLUDES . '/class-field-manager.php'; |
| 249 | 224 | require_once WEFORMS_INCLUDES . '/class-form-manager.php'; |
| 250 | 225 | require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php'; |
| @@ -249,9 +224,8 @@ | ||
| 249 | 224 | require_once WEFORMS_INCLUDES . '/class-form-manager.php'; |
| 250 | 225 | require_once WEFORMS_INCLUDES . '/class-form-entry-manager.php'; |
| 251 | 226 | require_once WEFORMS_INCLUDES . '/class-form-entry.php'; |
| 252 | 227 | require_once WEFORMS_INCLUDES . '/class-form.php'; |
| 253 | - require_once WEFORMS_INCLUDES . '/class-form-widget.php'; | |
| 254 | 228 | |
| 255 | 229 | require_once WEFORMS_INCLUDES . '/integrations/class-abstract-integration.php'; |
| 256 | 230 | require_once WEFORMS_INCLUDES . '/class-integration-manager.php'; |
| 257 | 231 | |
| @@ -258,34 +232,12 @@ | ||
| 258 | 232 | require_once WEFORMS_INCLUDES . '/class-ajax.php'; |
| 259 | 233 | require_once WEFORMS_INCLUDES . '/class-ajax-upload.php'; |
| 260 | 234 | require_once WEFORMS_INCLUDES . '/class-notification.php'; |
| 261 | 235 | require_once WEFORMS_INCLUDES . '/class-form-preview.php'; |
| 262 | - require_once WEFORMS_INCLUDES . '/class-dokan-integration.php'; | |
| 263 | 236 | require_once WEFORMS_INCLUDES . '/functions.php'; |
| 264 | 237 | } |
| 265 | 238 | |
| 266 | 239 | /** |
| 267 | - * Do plugin upgrades | |
| 268 | - * | |
| 269 | - * @since 1.1.2 | |
| 270 | - * | |
| 271 | - * @return void | |
| 272 | - */ | |
| 273 | - public function plugin_upgrades() { | |
| 274 | - if ( !current_user_can( 'manage_options' ) ) { | |
| 275 | - return; | |
| 276 | - } | |
| 277 | - | |
| 278 | - require_once WEFORMS_INCLUDES . '/class-upgrades.php'; | |
| 279 | - | |
| 280 | - $upgrader = new WeForms_Upgrades(); | |
| 281 | - | |
| 282 | - if ( $upgrader->needs_update() ) { | |
| 283 | - $upgrader->perform_updates(); | |
| 284 | - } | |
| 285 | - } | |
| 286 | - | |
| 287 | - /** | |
| 288 | 240 | * Initialize the hooks |
| 289 | 241 | * |
| 290 | 242 | * @return void |
| 291 | 243 | */ |
| @@ -291,15 +243,15 @@ | ||
| 291 | 243 | */ |
| 292 | 244 | public function init_hooks() { |
| 293 | 245 | |
| 294 | 246 | // Localize our plugin |
| 295 | - add_action( 'init', [ $this, 'localization_setup' ] ); | |
| 247 | + add_action( 'init', array( $this, 'localization_setup' ) ); | |
| 296 | 248 | |
| 297 | 249 | // initialize the classes |
| 298 | - add_action( 'init', [ $this, 'init_classes' ] ); | |
| 299 | - 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 ); | |
| 300 | 252 | |
| 301 | - 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' ) ); | |
| 302 | 254 | } |
| 303 | 255 | |
| 304 | 256 | /** |
| 305 | 257 | * Set WPDB table shortcut names |
| @@ -327,171 +279,50 @@ | ||
| 327 | 279 | * |
| 328 | 280 | * @return void |
| 329 | 281 | */ |
| 330 | 282 | public function init_classes() { |
| 331 | - if ( $this->is_request( 'admin' ) ) { | |
| 283 | + | |
| 284 | + if ( is_admin() ) { | |
| 332 | 285 | $this->container['admin'] = new WeForms_Admin(); |
| 333 | 286 | // $this->container['welcome'] = new WeForms_Admin_Welcome(); |
| 334 | 287 | $this->container['templates'] = new WeForms_Template_Manager(); |
| 335 | 288 | $this->container['pro_upgrades'] = new WeForms_Pro_Upgrades(); |
| 336 | 289 | $this->container['importer'] = new WeForms_Importer_Manager(); |
| 337 | - $this->container['promo_offer'] = new WeForms_Admin_Promotion(); | |
| 338 | - $this->container['privacy'] = new WeForms_Privacy(); | |
| 290 | + } else { | |
| 291 | + $this->container['frontend'] = new WeForms_Frontend_Form(); | |
| 339 | 292 | } |
| 340 | 293 | |
| 341 | - if ( $this->is_request( 'frontend' ) || $this->is_request( 'ajax' ) ) { | |
| 342 | - $this->container['frontend'] = new WeForms_Frontend_Form(); | |
| 343 | - } | |
| 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(); | |
| 344 | 300 | |
| 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(); | |
| 353 | 301 | // instantiate the integrations |
| 354 | 302 | $this->integrations->get_integrations(); |
| 355 | 303 | |
| 356 | - if ( $this->is_request( 'ajax' ) ) { | |
| 304 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { | |
| 357 | 305 | $this->container['ajax'] = new WeForms_Ajax(); |
| 358 | 306 | $this->container['ajax_upload'] = new WeForms_Ajax_Upload(); |
| 359 | 307 | } |
| 360 | - $this->container['weforms_api'] = new WeForms_Api(); | |
| 361 | 308 | } |
| 362 | 309 | |
| 363 | 310 | /** |
| 364 | - * The main logging function | |
| 365 | - * | |
| 366 | - * @uses error_log | |
| 367 | - * | |
| 368 | - * @param string $type type of the error. e.g: debug, error, info | |
| 369 | - * @param string $msg | |
| 370 | - */ | |
| 371 | - public static function log( $type = '', $msg = '' ) { | |
| 372 | - | |
| 373 | - if(file_exists(WP_CONTENT_DIR . '/weforms.log')){ | |
| 374 | - unlink(WP_CONTENT_DIR . '/weforms.log'); | |
| 375 | - } | |
| 376 | - return; | |
| 377 | - // 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; | |
| 380 | - } | |
| 381 | - $msg = sprintf( "[%s][%s] %s\n", date( 'd.m.Y h:i:s' ), $type, $msg ); | |
| 382 | - @error_log( $msg, 3, weforms_log_file_path() ); | |
| 383 | - } | |
| 384 | - | |
| 385 | - /** | |
| 386 | 311 | * Plugin action links |
| 387 | 312 | * |
| 388 | - * @param array $links | |
| 313 | + * @param array $links | |
| 389 | 314 | * |
| 390 | 315 | * @return array |
| 391 | 316 | */ |
| 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>'; | |
| 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>'; | |
| 394 | 320 | $links[] = '<a href="' . admin_url( 'admin.php?page=weforms' ) . '">' . __( 'Settings', 'weforms' ) . '</a>'; |
| 395 | 321 | |
| 396 | 322 | return $links; |
| 397 | 323 | } |
| 398 | 324 | |
| 399 | - /** | |
| 400 | - * Check if the PHP version is supported | |
| 401 | - * | |
| 402 | - * @return bool | |
| 403 | - */ | |
| 404 | - public function is_supported_php( $min_php = null ) { | |
| 405 | - $min_php = $min_php ? $min_php : $this->min_php; | |
| 406 | - | |
| 407 | - if ( version_compare( PHP_VERSION, $min_php, '<=' ) ) { | |
| 408 | - return false; | |
| 409 | - } | |
| 410 | - | |
| 411 | - return true; | |
| 412 | - } | |
| 413 | - | |
| 414 | - /** | |
| 415 | - * Show notice about PHP version | |
| 416 | - * | |
| 417 | - * @return void | |
| 418 | - */ | |
| 419 | - public function php_version_notice() { | |
| 420 | - if ( $this->is_supported_php() || !current_user_can( 'manage_options' ) ) { | |
| 421 | - return; | |
| 422 | - } | |
| 423 | - | |
| 424 | - $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' ); ?> | |
| 426 | - <div class="error"> | |
| 427 | - <p><?php printf( wp_kses_post ( $error ) ); ?></p> | |
| 428 | - </div> | |
| 429 | - <?php | |
| 430 | - } | |
| 431 | - | |
| 432 | - /** | |
| 433 | - * Bail out if the php version is lower than | |
| 434 | - * | |
| 435 | - * @return void | |
| 436 | - */ | |
| 437 | - public function auto_deactivate() { | |
| 438 | - if ( $this->is_supported_php() ) { | |
| 439 | - return; | |
| 440 | - } | |
| 441 | - | |
| 442 | - deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 443 | - | |
| 444 | - $error = __( '<h1>An Error Occured</h1>', 'weforms' ); | |
| 445 | - $error .= __( '<h2>Your installed PHP Version is: ', 'weforms' ) . PHP_VERSION . '</h2>'; | |
| 446 | - $error .= __( '<p>The <strong>weforms</strong> plugin requires PHP version <strong>', 'weforms' ) . $this->min_php . __( '</strong> or greater', 'weforms' ); | |
| 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>.'; | |
| 448 | - $error .= __( 'You should update your PHP software or contact your host regarding this matter.</p>', 'weforms' ); | |
| 449 | - | |
| 450 | - wp_die( wp_kses_post( $error ), esc_html_e( 'Plugin Activation Error', 'weforms' ), [ 'back_link' => true ] ); | |
| 451 | - } | |
| 452 | - | |
| 453 | - /** | |
| 454 | - * What type of request is this? | |
| 455 | - * | |
| 456 | - * @since 1.2.3 | |
| 457 | - * | |
| 458 | - * @param string $type admin, ajax, cron, api or frontend | |
| 459 | - * | |
| 460 | - * @return bool | |
| 461 | - */ | |
| 462 | - private function is_request( $type ) { | |
| 463 | - switch ( $type ) { | |
| 464 | - case 'admin': | |
| 465 | - return is_admin(); | |
| 466 | - | |
| 467 | - case 'ajax': | |
| 468 | - return defined( 'DOING_AJAX' ); | |
| 469 | - | |
| 470 | - case 'cron': | |
| 471 | - return defined( 'DOING_CRON' ); | |
| 472 | - | |
| 473 | - case 'api': | |
| 474 | - return defined( 'REST_REQUEST' ); | |
| 475 | - | |
| 476 | - case 'frontend': | |
| 477 | - return ( !is_admin() || defined( 'DOING_AJAX' ) ) && !defined( 'DOING_CRON' ); | |
| 478 | - } | |
| 479 | - } | |
| 480 | - | |
| 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 | - | |
| 489 | - $client = new Appsero\Client( '213fd70e-0bf3-4710-a35e-934b5a376e13', 'weForms', __FILE__ ); | |
| 490 | - | |
| 491 | - // Active insights | |
| 492 | - $client->insights()->init(); | |
| 493 | - } | |
| 494 | 325 | } // WeForms |
| 495 | 326 | |
| 496 | 327 | /** |
| 497 | 328 | * Initialize the plugin |