| 1 |
<?php |
| 2 |
/** |
| 3 |
* @wordpress-plugin |
| 4 |
* Plugin Name: Connector Wizard (formerly LC Wizard) |
| 5 |
* Plugin URI: https://betterwizard.com/lead-connector-wizard/ |
| 6 |
* Description: Connect WordPress with the popular LeadConnector CRM(HighLevel) and combine the power of automation and excellent user experience. Including memberships, content protection, WooCommerce automation, custom fields & many more... |
| 7 |
* Version: 2.2.8 |
| 8 |
* Author: Better Wizard |
| 9 |
* Author URI: https://connectorwizard.app/ |
| 10 |
* Requires PHP: 7.4 |
| 11 |
* Requires at least: 6.2 |
| 12 |
* License: GPLv2 or later |
| 13 |
* Text Domain: ghl-wizard |
| 14 |
*/ |
| 15 |
|
| 16 |
if ( ! defined( 'ABSPATH' )) { |
| 17 |
exit(); |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
/*********************************** |
| 22 |
Create Tables |
| 23 |
@ v: 1.1 |
| 24 |
***********************************/ |
| 25 |
register_activation_hook( __FILE__, "lcw_activation_hook" ); |
| 26 |
|
| 27 |
if ( ! function_exists( 'lcw_activation_hook' ) ) { |
| 28 |
function lcw_activation_hook() { |
| 29 |
|
| 30 |
// create db table |
| 31 |
lcw_create_location_and_contact_table(); |
| 32 |
|
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
/*********************************** |
| 38 |
Default Values |
| 39 |
***********************************/ |
| 40 |
define( 'HLWPW_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 41 |
define( 'HLWPW_LOCATION_CONNECTED', false ); |
| 42 |
define( 'LCW_PLUGIN_VERSION', '2.2.8' ); |
| 43 |
define( 'LCW_DB_VERSION', '1.3' ); |
| 44 |
define( 'LCW_PLUGIN_FILE', __FILE__ ); |
| 45 |
|
| 46 |
/*********************************** |
| 47 |
Load JS & CSS Files |
| 48 |
***********************************/ |
| 49 |
if ( ! function_exists( 'hlwpw_style_and_scripts' ) ) { |
| 50 |
function hlwpw_style_and_scripts() { |
| 51 |
|
| 52 |
wp_enqueue_style( 'hlwpw_style', plugins_url( '/css/styles.css', __FILE__ ), '', LCW_PLUGIN_VERSION ); |
| 53 |
wp_enqueue_script( 'hlwpw_script', plugins_url( '/js/scripts.js', __FILE__ ) , array('jquery'), LCW_PLUGIN_VERSION, true); |
| 54 |
wp_enqueue_script( 'lcw_autologin_script', plugins_url( '/js/autologin.js', __FILE__ ) , '', LCW_PLUGIN_VERSION, false); |
| 55 |
wp_localize_script( 'hlwpw_script', 'hlwpw_ajax', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
| 56 |
wp_localize_script( 'lcw_autologin_script', 'hlwpw_ajax', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); |
| 57 |
|
| 58 |
} |
| 59 |
add_action( 'wp_enqueue_scripts', 'hlwpw_style_and_scripts' ); |
| 60 |
} |
| 61 |
|
| 62 |
/*********************************** |
| 63 |
Load JS & CSS for admin screen |
| 64 |
***********************************/ |
| 65 |
if ( ! function_exists( 'hlwpw_admin_style_and_scripts' ) ) { |
| 66 |
function hlwpw_admin_style_and_scripts() { |
| 67 |
|
| 68 |
wp_enqueue_script( 'select2', plugins_url( '/js/select2.min.js', __FILE__ ) , array('jquery'), LCW_PLUGIN_VERSION, true ); |
| 69 |
wp_enqueue_script( 'hlwpw_admin_script', plugins_url( '/js/admin-scripts.js', __FILE__ ) , array('jquery'), LCW_PLUGIN_VERSION, true ); |
| 70 |
wp_localize_script( |
| 71 |
'hlwpw_admin_script', |
| 72 |
'lcw_admin_ajax', |
| 73 |
array( |
| 74 |
'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 75 |
'nonce' => wp_create_nonce( 'lcw_calendar_timeslots_nonce' ), |
| 76 |
) |
| 77 |
); |
| 78 |
wp_enqueue_style( 'select2_css', plugins_url( '/css/select2.min.css', __FILE__ ), [], LCW_PLUGIN_VERSION ); |
| 79 |
wp_enqueue_style( 'hlwpw_admin_style', plugins_url( '/css/admin-styles.css', __FILE__ ), [], LCW_PLUGIN_VERSION ); |
| 80 |
} |
| 81 |
add_action( 'admin_enqueue_scripts', 'hlwpw_admin_style_and_scripts' ); |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
/*********************************** |
| 86 |
Admin Notice |
| 87 |
***********************************/ |
| 88 |
|
| 89 |
add_action( 'admin_notices', function(){ |
| 90 |
|
| 91 |
$hlwpw_location_connected = get_option( 'hlwpw_location_connected', HLWPW_LOCATION_CONNECTED ); |
| 92 |
|
| 93 |
if ( $hlwpw_location_connected == 1 ) { |
| 94 |
return; |
| 95 |
} |
| 96 |
|
| 97 |
$class = 'notice notice-error'; |
| 98 |
$url = admin_url('admin.php?page=connector-wizard-app'); |
| 99 |
$link_text = __('Connect Here','hlwpw'); |
| 100 |
$message = __( 'Your WordPress isn\'t connected with the CRM. You must connect it to make "Connector Wizard" plugin work.', 'hlwpw' ); |
| 101 |
|
| 102 |
printf( '<div class="%1$s"><p>%2$s <a href="%3$s"> %4$s </a></p></div>', esc_attr( $class ), esc_html( $message ), $url, esc_html($link_text) ); |
| 103 |
|
| 104 |
}); |
| 105 |
|
| 106 |
|
| 107 |
/** |
| 108 |
* Initialize the plugin tracker |
| 109 |
* |
| 110 |
* @return void |
| 111 |
*/ |
| 112 |
function appsero_init_tracker_ghl_wizard() { |
| 113 |
|
| 114 |
if ( ! class_exists( 'Appsero\Client' ) ) { |
| 115 |
require_once __DIR__ . '/lib/client/src/Client.php'; |
| 116 |
} |
| 117 |
|
| 118 |
$client = new Appsero\Client( '72d4c258-70c6-4454-84a7-67dd3938836b', 'LeadConnector Wizard', __FILE__ ); |
| 119 |
|
| 120 |
// Active insights |
| 121 |
$opt_in_message = "Allow <strong>Connector Wizard</strong> to collect diagnostic data to enhance your journey. We never collect any sensitive data. Allow now for a smoother, personalized experience!"; |
| 122 |
$client->insights() |
| 123 |
->notice( $opt_in_message ) |
| 124 |
->init(); |
| 125 |
|
| 126 |
} |
| 127 |
appsero_init_tracker_ghl_wizard(); |
| 128 |
|
| 129 |
|
| 130 |
/*********************************** |
| 131 |
Required Files |
| 132 |
***********************************/ |
| 133 |
|
| 134 |
require_once( plugin_dir_path( __FILE__ ) . 'api/apis.php' ); |
| 135 |
require_once( plugin_dir_path( __FILE__ ) . 'inc/includes.php' ); |
| 136 |
|