| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: FormsCRM |
| 4 |
* Plugin URI: https://closemarketing.net/formscrm |
| 5 |
* Description: Connects Forms with CRM. |
| 6 |
* Version: 3.5 |
| 7 |
* Author: Closemarketing |
| 8 |
* Author URI: https://close.marketing |
| 9 |
* Text Domain: formscrm |
| 10 |
* Domain Path: /languages |
| 11 |
* License: GPL-2.0+ |
| 12 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 |
* |
| 14 |
* @package WordPress |
| 15 |
* @author Closemarketing |
| 16 |
* @copyright 2021 Closemarketing |
| 17 |
* @license GPL-2.0+ |
| 18 |
* |
| 19 |
* @wordpress-plugin |
| 20 |
* |
| 21 |
* Prefix: fcrm |
| 22 |
*/ |
| 23 |
|
| 24 |
defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); |
| 25 |
|
| 26 |
define( 'FORMSCRM_VERSION', '3.5' ); |
| 27 |
|
| 28 |
add_action( 'plugins_loaded', 'fcrm_plugin_init' ); |
| 29 |
/** |
| 30 |
* Load localization files |
| 31 |
* |
| 32 |
* @return void |
| 33 |
*/ |
| 34 |
function fcrm_plugin_init() { |
| 35 |
load_plugin_textdomain( 'formscrm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); |
| 36 |
} |
| 37 |
|
| 38 |
require_once 'includes/debug.php'; |
| 39 |
require_once 'includes/class-library-crm.php'; |
| 40 |
require_once 'includes/class-admin-options.php'; |
| 41 |
|
| 42 |
// Prevents fatal error is_plugin_active. |
| 43 |
if ( ! function_exists( 'is_plugin_active' ) ) { |
| 44 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 45 |
} |
| 46 |
|
| 47 |
if ( is_plugin_active( 'gravityforms/gravityforms.php' ) || is_plugin_active( 'gravity-forms/gravityforms.php' ) ) { |
| 48 |
add_action( 'gform_loaded', array( 'FC_CRM_Bootstrap', 'load' ), 5 ); |
| 49 |
class FC_CRM_Bootstrap { |
| 50 |
|
| 51 |
public static function load() { |
| 52 |
|
| 53 |
if ( ! method_exists( 'GFForms', 'include_feed_addon_framework' ) ) { |
| 54 |
return; |
| 55 |
} |
| 56 |
|
| 57 |
require_once 'includes/class-gravityforms.php'; |
| 58 |
|
| 59 |
GFAddOn::register( 'GFCRM' ); |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
function gf_crm() { |
| 64 |
return FCCRM::get_instance(); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
// ContactForms7. |
| 69 |
if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { |
| 70 |
require_once 'includes/class-contactform7.php'; |
| 71 |
} |
| 72 |
|
| 73 |
// WooCommerce. |
| 74 |
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { |
| 75 |
require_once 'includes/class-woocommerce.php'; |
| 76 |
} |
| 77 |
|
| 78 |
if ( ! function_exists( 'formscrm_fs' ) ) { |
| 79 |
// Create a helper function for easy SDK access. |
| 80 |
function formscrm_fs() { |
| 81 |
global $formscrm_fs; |
| 82 |
|
| 83 |
if ( ! isset( $formscrm_fs ) ) { |
| 84 |
// Include Freemius SDK. |
| 85 |
require_once dirname( __FILE__ ) . '/vendor/freemius/wordpress-sdk/start.php'; |
| 86 |
|
| 87 |
$formscrm_fs = fs_dynamic_init( |
| 88 |
array( |
| 89 |
'id' => '8504', |
| 90 |
'slug' => 'formscrm', |
| 91 |
'type' => 'plugin', |
| 92 |
'public_key' => 'pk_fa93ef3eb788d04ac4803d15c1511', |
| 93 |
'is_premium' => false, |
| 94 |
'has_addons' => true, |
| 95 |
'has_paid_plans' => false, |
| 96 |
'navigation' => 'tabs', |
| 97 |
'menu' => array( |
| 98 |
'slug' => 'formscrm', |
| 99 |
'first-path' => 'admin.php?page=formscrm', |
| 100 |
), |
| 101 |
) |
| 102 |
); |
| 103 |
} |
| 104 |
|
| 105 |
return $formscrm_fs; |
| 106 |
} |
| 107 |
|
| 108 |
// Init Freemius. |
| 109 |
formscrm_fs(); |
| 110 |
// Signal that SDK was initiated. |
| 111 |
do_action( 'formscrm_fs_loaded' ); |
| 112 |
} |
| 113 |
|