Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function is_acf_part_of_theme() {
- return (
- class_exists('ACF') &&
- apply_filters('wcfm_is_allow_acf_fields', true) &&
- !WCFMu_Dependencies::wcfm_acf_pro_active_check() &&
- !WCFMu_Dependencies::wcfm_acf_active_check()
- );
- }
- add_action('wcfm_init', function() {
- if (is_acf_part_of_theme()) {
- global $WCFMu;
- // Advanced Custom Fields(ACF) Pro - Products Support - 3.3.7
- add_action('after_wcfm_products_manage_tabs_content', [ $WCFMu->wcfmu_integrations, 'wcfm_acf_pro_product_manage_fields' ], 60);
- add_action('end_wcfm_articles_manage', [ $WCFMu->wcfmu_integrations, 'wcfm_acf_pro_article_manage_fields' ], 160);
- // Advanced Custom Fields(ACF) Pro - Profile Support - 6.5.2
- if (wcfm_is_vendor()) {
- add_action('end_wcfm_user_profile', [ $WCFMu->wcfmu_integrations, 'wcfmmp_profile_acf_info' ], 80);
- }
- add_action('after_wcfm_vendors_manage_form', [ $WCFMu->wcfmu_integrations, 'wcfmmp_profile_acf_info' ], 12);
- add_action('wcfm_profile_update', [ $WCFMu->wcfmu_integrations, 'wcfmmp_profile_acf_info_update' ], 75, 2);
- add_action('wcfm_vendor_manage_profile_update', [ $WCFMu->wcfmu_integrations, 'wcfmmp_profile_acf_info_update' ], 75, 2);
- add_action('wcfm_load_scripts', 'wcfm_load_acf_scripts', 81);
- add_action('after_wcfm_load_scripts', 'wcfm_load_acf_scripts', 81);
- add_action('after_wcfm_ajax_controller', 'wcfm_acf_ajax_controller', 11);
- }//end if
- }, 13);
- function wcfm_load_acf_scripts($endpoints) {
- global $WCFM, $WCFMu;
- switch ($endpoints) {
- case 'wcfm-articles-manage':
- $WCFM->library->load_timepicker_lib();
- wp_enqueue_script('wcfmu_acf_pro_articles_manage_js', $WCFMu->library->js_lib_url.'integrations/acf/wcfmu-script-acf-pro-articles-manage.js', [ 'jquery', 'wcfm_articles_manage_js' ], $WCFMu->version, true);
- $scheme = is_ssl() ? 'https' : 'http';
- $acf_map_key = acf_get_setting('google_api_key');
- if ($acf_map_key) {
- wp_enqueue_script('jquery-ui-autocomplete');
- wp_enqueue_script('wcfm-acf-pro-pm-google-maps', $scheme.'://maps.googleapis.com/maps/api/js?key='.$acf_map_key.'&libraries=places');
- }
- break;
- case 'wcfm-products-manage':
- $WCFM->library->load_timepicker_lib();
- wp_enqueue_script('wcfmu_acf_pro_products_manage_js', $WCFMu->library->js_lib_url.'integrations/acf/wcfmu-script-acf-pro-products-manage.js', [ 'jquery', 'wcfm_products_manage_js' ], $WCFMu->version, true);
- $scheme = is_ssl() ? 'https' : 'http';
- $acf_map_key = acf_get_setting('google_api_key');
- if ($acf_map_key) {
- wp_enqueue_script('jquery-ui-autocomplete');
- wp_enqueue_script('wcfm-acf-pro-pm-google-maps', $scheme.'://maps.googleapis.com/maps/api/js?key='.$acf_map_key.'&libraries=places');
- }
- break;
- }
- }
- function wcfm_acf_ajax_controller() {
- //skipped nonce check as loaded with 11 priority after wcfmu_thirdparty_ajax_controller (10)
- global $WCFMu;
- if (isset($_POST['controller'])) {
- $controllers_path = $WCFMu->plugin_path.'controllers/integrations/';
- $controller = $_POST['controller'];
- switch ($controller) {
- case 'wcfm-articles-manage':
- include_once $controllers_path.'acf/wcfmu-controller-acf-pro-articles-manage.php';
- new WCFMu_ACF_Pro_Articles_Manage_Controller();
- break;
- case 'wcfm-products-manage':
- include_once $controllers_path.'acf/wcfmu-controller-acf-pro-products-manage.php';
- new WCFMu_ACF_Pro_Products_Manage_Controller();
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement