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:
<?php
class Inbound_Shared_ACF_BootStrap {
public function __construct() {
self::load_acf();
self::load_acf_extended_fields();
}
public static function load_acf() {
if( !class_exists('acf') || defined('ACF_PRELOADED') ) {
define( 'ACF_LITE', true );
define( 'ACF_FREE', true );
include_once( INBOUNDNOW_SHARED_PATH . 'assets/plugins/advanced-custom-fields/acf.php');
add_filter('acf/settings/path', array( __CLASS__, 'define_acf_settings_path' ) );
add_filter('acf/settings/dir', array( __CLASS__, 'define_acf_settings_url' ) );
add_filter('acf/settings/show_admin', '__return_false');
} else {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( !function_exists('acf_add_local_field_group') ) {
define( 'ACF_FREE', true );
} else {
add_filter('lp_init' , array(__CLASS__,'acf_register_global') , 20 , 1 );
}
}
}
public static function load_acf_extended_fields() {
if (!function_exists('register_fields_font_awesome')) {
include_once( INBOUNDNOW_SHARED_PATH . 'assets/plugins/advanced-custom-fields-font-awesome/acf-font-awesome.php');
include_once( INBOUNDNOW_SHARED_PATH . 'assets/plugins/acf-field-date-time-picker/acf-date-time-picker.php');
}
}
public static function acf_register_global( $field_group ) {
$GLOBALS['acf_register_field_group'][] = array(
'fields' => acf_local()->fields
);
}
public static function define_acf_settings_path( $path ) {
$path = INBOUNDNOW_SHARED_PATH . 'assets/plugins/advanced-custom-fields/';
return $path;
}
public static function define_acf_settings_url( $url ) {
$url = INBOUNDNOW_SHARED_PATH . 'assets/plugins/advanced-custom-fields/';
return $url;
}
}
new Inbound_Shared_ACF_BootStrap;