/** * User profile edit related scripts * * @param string $hook * * @return void */ function user_profile_scripts($hook) { if (!in_array($hook, array('profile.php', 'user-edit.php'))) { return; } $scheme = is_ssl() ? 'https' : 'http'; if (!checkChinaIP() && !wp_script_is('google-maps', 'enqueued')) { wp_enqueue_script('google-maps', $scheme . '://maps.google.com/maps/api/js?sensor=true'); } wp_enqueue_script('jquery-ui-autocomplete'); }
function enqueue_script() { global $pagenow; if (!in_array($pagenow, array('profile.php', 'post-new.php', 'post.php', 'user-edit.php'))) { return; } $scheme = is_ssl() ? 'https' : 'http'; wp_enqueue_style('jquery-ui', WPUF_ASSET_URI . '/css/jquery-ui-1.9.1.custom.css'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('jquery-ui-timepicker', WPUF_ASSET_URI . '/js/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker')); if (!checkChinaIP() && !wp_script_is('google-maps', 'enqueued')) { wp_enqueue_script('google-maps', $scheme . '://maps.google.com/maps/api/js?sensor=true'); } wp_enqueue_script('wpuf-upload', WPUF_ASSET_URI . '/js/upload.js', array('jquery', 'plupload-handlers')); wp_localize_script('wpuf-upload', 'wpuf_frontend_upload', array('confirmMsg' => __('Are you sure?', 'wpuf'), 'ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('wpuf_nonce'), 'plupload' => array('url' => admin_url('admin-ajax.php') . '?nonce=' . wp_create_nonce('wpuf_featured_img'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true))); }
/** * JS / CSS scripts * @since 1.0 **/ function epl_am_enqueue_scripts() { //Gmap Scripts wp_enqueue_style('epl-am-style', EPL_AM_PLUGIN_URL . 'css/style.css', array(), EPL_AM_VERSION); wp_dequeue_script('google-map-v-3'); if (!checkChinaIP() && !wp_script_is('google-maps', 'enqueued')) { wp_enqueue_script('epl-am-map-api', '//maps.googleapis.com/maps/api/js?sensor=false', array('jquery'), EPL_AM_VERSION); } if (checkChinaIP()) { wp_enqueue_style('mapbox-style', 'https://api.mapbox.com/mapbox.js/v2.3.0/mapbox.css', array(), null); wp_enqueue_script('mapbox', 'https://api.mapbox.com/mapbox.js/v2.3.0/mapbox.js', array(), null); } wp_enqueue_script('epl-am-gmap', EPL_AM_PLUGIN_URL . 'js/gmap3.min.js', array('epl-am-map-api'), EPL_AM_VERSION); wp_enqueue_script('epl-am-markerclusterer-script', EPL_AM_PLUGIN_URL . 'js/markerclusterer.js', array('epl-am-map-api'), EPL_AM_VERSION); wp_enqueue_script('epl-am-scripts', EPL_AM_PLUGIN_URL . 'js/scripts.js', array('epl-am-map-api'), EPL_AM_VERSION); //Bpopup Scripts wp_enqueue_style('bpopup-style', EPL_AM_PLUGIN_URL . 'css/bpopup.css', array(), EPL_AM_VERSION); wp_enqueue_script('bpopup-script', EPL_AM_PLUGIN_URL . 'js/jquery.bpopup.min.js', array('jquery'), EPL_AM_VERSION); wp_enqueue_script('jquery-easing-script', EPL_AM_PLUGIN_URL . 'js/jquery.easing.1.3.js', array('bpopup-script'), EPL_AM_VERSION); }
/** * Load and enqueue front end scripts and stylesheets */ function epl_wp_enqueue_scripts() { global $epl_settings; $epl_default_view_type = isset($epl_settings['display_archive_view_type']) ? $epl_settings['display_archive_view_type'] : 'list'; $current_dir_path = plugins_url('', __FILE__); wp_register_script('epl-front-scripts', $current_dir_path . '/js/jquery-front-scripts.js', array('jquery'), EPL_PROPERTY_VER); if (is_epl_post() && shortcode_exists('listing_map')) { if (!checkChinaIP()) { wp_enqueue_script('google-map-v-3', 'https://maps.googleapis.com/maps/api/js?v=3.exp'); } } if (isset($epl_settings['epl_use_core_css']) && $epl_settings['epl_use_core_css'] == 'on') { } else { wp_enqueue_style('epl-front-styles', $current_dir_path . '/css/style-front.css', FALSE, EPL_PROPERTY_VER); wp_enqueue_style('epl-css-lib', $current_dir_path . '/css/epl.css', FALSE, EPL_PROPERTY_VER); } $js_vars = array('epl_default_view_type' => $epl_default_view_type, 'ajaxurl' => admin_url('admin-ajax.php')); wp_enqueue_script('epl-js-lib', $current_dir_path . '/js/epl.js', array('jquery'), EPL_PROPERTY_VER); wp_localize_script('epl-front-scripts', 'epl_frontend_vars', $js_vars); wp_enqueue_script('epl-front-scripts'); }
function epl_am_tabbed_map_top($tablocation = 'top', $width = '100%', $zoom = 16) { global $epl_settings; $enabled_tabs = array(); foreach (epl_am_get_default_tab_list() as $key => $label) { if (isset($epl_settings['epl_am_enable_' . $key . '_view'])) { if ($epl_settings['epl_am_enable_' . $key . '_view'] == 1) { $enabled_tabs[$key] = $label; } } else { if ($key !== 'street') { $enabled_tabs[$key] = $label; } } } $tabs = apply_filters('epl_adv_tabs', $enabled_tabs); /** * for custom post types, option to override settings and add/remove tabs based on post_type * the function must return the tabs array **/ if (function_exists('epl_am_post_type_' . str_replace('-', '_', get_post_type()) . '_map_tabs')) { $tabs = call_user_func('epl_am_post_type_' . str_replace('-', '_', get_post_type()) . '_map_tabs'); } if (!checkChinaIP()) { ?> <div id="epl-advanced-map-single" class="epl-advanced-map-single epl_tabbed_maps_wrapper epl-am-infobox-<?php echo $infobox_class; ?> epl-clearfix"> <div class="epl_tabbed_map_control"> <ul class="epl_adv_map_list map-tabs"> <?php $tabcounter = 1; foreach ($tabs as $tab_key => $tab_label) { $maptab_current = $tabcounter == 1 ? 'maptab-current' : ''; echo '<li class="' . $maptab_current . '" data-map="' . $tab_key . '">' . $tab_label . '</li>'; $tabcounter++; } ?> </ul> </div> <div class="epl_tabbed_map_wrapper "> <?php // reset tab counter $tabcounter = 1; foreach ($tabs as $tab_key => $tab_label) { $style = $tabcounter == 1 ? 'display:block;' : ''; $maptab_current = $tabcounter == 1 ? 'maptab-current' : ''; echo '<div class="epl_adv_tab_map" id="epl_adv_tab_map_' . $tab_key . '" style="width:' . $width . '; height:100%;max-height:100%; ' . $style . '" >'; if (function_exists("epl_adv_tab_map_{$tab_key}")) { call_user_func("epl_adv_tab_map_{$tab_key}"); } echo '</div>'; $tabcounter++; } ?> </div> </div> <?php } else { ?> <div class="panel panel-info"> <div class="panel-header"><h5 class="epl-tab-title epl-tab-title-property-features tab-title"> <?php echo __('Map', 'custom_sp'); ?> </div></h5> <div class="panel-body"> <div id="map-alt"></div> </div> </div> <?php } }
/** * Enqueues Styles and Scripts when the shortcodes are used only * * @uses has_shortcode() * @since 0.2 */ function enqueue_scripts() { global $post; $scheme = is_ssl() ? 'https' : 'http'; if (!checkChinaIP() && !wp_script_is('google-maps', 'enqueued')) { wp_enqueue_script('google-maps', $scheme . '://maps.google.com/maps/api/js?sensor=true'); } if (isset($post->ID)) { wp_enqueue_script('wpuf-form', WPUF_ASSET_URI . '/js/frontend-form.js', array('jquery')); wp_enqueue_script('wpuf-conditional-logic', WPUF_ASSET_URI . '/js/conditional-logic.js', array('jquery'), false, true); } wp_enqueue_style('wpuf-css', WPUF_ASSET_URI . '/css/frontend-forms.css'); wp_enqueue_script('wpuf-subscriptions', WPUF_ASSET_URI . '/js/subscriptions.js', array('jquery'), false, true); if (wpuf_get_option('load_script', 'wpuf_general', 'on') == 'on') { $this->plugin_scripts(); } else { if (wpuf_has_shortcode('wpuf_form') || wpuf_has_shortcode('wpuf_edit') || wpuf_has_shortcode('wpuf_profile') || wpuf_has_shortcode('wpuf_dashboard')) { $this->plugin_scripts(); } } }