1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199:
<?php
if (!class_exists('Inbound_Load_Shared')) {
class Inbound_Load_Shared {
public static function init() {
if (defined('INBOUNDNOW_SHARED')) {
return;
}
self::load_constants();
self::load_hooks();
self::load_files();
self::load_files_after_theme_setup();
self::load_activation_rules();
}
public static function load_hooks() {
add_action('after_theme_setup', array(__CLASS__, 'load_files_after_theme_setup'));
}
public static function load_constants() {
define('INBOUNDNOW_SHARED', 'loaded');
define('INBOUNDNOW_SHARED_DBRV', '2.0.3');
define('INBOUNDNOW_SHARED_PATH', self::get_shared_path());
define('INBOUNDNOW_SHARED_URLPATH', self::get_shared_urlpath());
define('INBOUNDNOW_SHARED_FILE', self::get_shared_file());
if (!defined('INBOUNDNOW_TEXT_DOMAIN')) {
define('INBOUNDNOW_TEXT_DOMAIN', self::get_text_domain());
}
}
public static function load_files() {
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.post-type.wp-lead.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.form.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.menus.adminbar.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.debug.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.templating-engine.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.email-template.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.shortcodes.cookie-values.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.lead-fields.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.list-double-optin.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.confirm-double-optin.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.options-api.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.events.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.lead-storage.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.ajax.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-api.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-customizer.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.load-assets.php');
include_once(INBOUNDNOW_SHARED_PATH . 'shortcodes/inbound-shortcodes.php');
include_once(INBOUNDNOW_SHARED_PATH . 'functions/legacy.php');
include_once(INBOUNDNOW_SHARED_PATH . 'functions/shared.php');
if (is_admin()) {
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.database-routines.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.licensing.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.master-license.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.notifications.php');
require_once(INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-api.api-key-generation.php');
require_once(INBOUNDNOW_SHARED_PATH . 'classes/class.inbound-api.api-keys-table.php');
require_once(INBOUNDNOW_SHARED_PATH . 'classes/class.marketing-button.php');
require_once(INBOUNDNOW_SHARED_PATH . 'classes/class.template-utils.php');
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.acf-bootstrap.php');
require_once(INBOUNDNOW_SHARED_PATH . 'functions/shared.php');
}
}
public static function load_files_after_theme_setup() {
include_once(INBOUNDNOW_SHARED_PATH . 'classes/class.acf-bootstrap.php');
}
public static function get_shared_path() {
if (defined('INBOUND_PRO_PATH')) {
return INBOUND_PRO_PATH . 'core/shared/';
} else if (defined('WP_CTA_PATH')) {
return WP_CTA_PATH . 'shared/';
} else if (defined('LANDINGPAGES_PATH')) {
return LANDINGPAGES_PATH . 'shared/';
} else if (defined('WPL_PATH')) {
return WPL_PATH . 'shared/';
}
}
public static function get_shared_urlpath() {
if (defined('INBOUND_PRO_URLPATH')) {
return INBOUND_PRO_URLPATH . 'core/shared/';
} else if (defined('WP_CTA_URLPATH')) {
return WP_CTA_URLPATH . 'shared/';
} else if (defined('LANDINGPAGES_URLPATH')) {
return LANDINGPAGES_URLPATH . '/shared/';
} else if (defined('WPL_URLPATH')) {
return WPL_URLPATH . '/shared/';
}
}
public static function get_shared_file() {
if (defined('WP_CTA_FILE')) {
return WP_CTA_FILE;
} else if (defined('LANDINGPAGES_URLPATH')) {
return LANDINGPAGES_FILE;
} else if (defined('WPL_FILE')) {
return WPL_FILE;
}
}
public static function get_text_domain() {
if (defined('INBOUND_PRO_PATH')) {
return 'inbound-pro';
} else if (defined('WP_CTA_PATH')) {
return 'cta';
} else if (defined('LANDINGPAGES_PATH')) {
return 'landing-pages';
} else if (defined('WPL_PATH')) {
return 'leads';
}
}
public static function load_activation_rules() {
add_action('admin_init', array(__CLASS__, 'run_activation_rules'));
}
public static function run_activation_rules() {
if (!is_admin() || !get_option('Inbound_Activate')) {
return;
}
do_action('inbound_shared_activate');
delete_option('Inbound_Activate');
}
}
}