Some housekeeping
This commit is contained in:
@@ -37,9 +37,6 @@ class SP_Admin_Assets {
|
||||
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
|
||||
// Admin styles for SP pages only
|
||||
wp_enqueue_style( 'jquery-chosen', SP()->plugin_url() . '/assets/css/chosen.css', array(), '1.1.0' );
|
||||
//OpenStreetMaps
|
||||
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
||||
wp_enqueue_style( 'control-geocoder', SP()->plugin_url() . '/assets/css/Control.Geocoder.css', array() );
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION );
|
||||
} elseif ( strpos( $screen->id, 'sportspress-config' ) !== false ) {
|
||||
@@ -87,11 +84,6 @@ class SP_Admin_Assets {
|
||||
|
||||
wp_register_script( 'jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), '1.1', true );
|
||||
|
||||
//OpenStreetMaps
|
||||
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
|
||||
wp_register_script( 'sportspress-admin-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
||||
|
||||
wp_register_script( 'sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable' ), SP_VERSION, true );
|
||||
|
||||
wp_register_script( 'sportspress-admin-colorpicker', SP()->plugin_url() . '/assets/js/admin/colorpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_VERSION, true );
|
||||
@@ -132,12 +124,6 @@ class SP_Admin_Assets {
|
||||
wp_enqueue_script( 'sportspress-admin-widgets' );
|
||||
}
|
||||
|
||||
// Edit venue pages
|
||||
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
|
||||
wp_enqueue_script( 'leaflet_js' );
|
||||
wp_enqueue_script( 'control-geocoder' );
|
||||
}
|
||||
|
||||
// Edit color
|
||||
if ( in_array( $screen->id, array( 'sp_outcome' ) ) ) {
|
||||
wp_enqueue_script( 'sportspress-admin-colorpicker' );
|
||||
|
||||
@@ -101,10 +101,10 @@ class SP_Admin_Setup_Wizard {
|
||||
|
||||
wp_register_script( 'chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
|
||||
wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true );
|
||||
wp_register_script( 'google-maps', '//tboy.co/maps_js' );
|
||||
wp_register_script( 'sportspress-setup', SP()->plugin_url() . '/assets/js/admin/sportspress-setup.js', array( 'jquery', 'chosen', 'jquery-tiptip' ), SP_VERSION, true );
|
||||
|
||||
if ( class_exists( 'SportsPress_GoogleMaps' ) ) {
|
||||
wp_register_script( 'google-maps', '//tboy.co/maps_js' );
|
||||
wp_register_script( 'jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array( 'jquery', 'google-maps' ), '0.1.6', true );
|
||||
wp_register_script( 'sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array( 'jquery', 'jquery-locationpicker' ), SP_VERSION, true );
|
||||
} else {
|
||||
@@ -544,7 +544,7 @@ class SP_Admin_Setup_Wizard {
|
||||
<th scope="row"><?php _e( 'Address', 'sportspress' ); ?></th>
|
||||
<td>
|
||||
<input name="address" id="sp_address" class="sp-address" type="text" value="Marvel Stadium, Melbourne">
|
||||
<div id="sp-location-picker" style="width: 95%; height: 320px"></div>
|
||||
<div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div>
|
||||
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
|
||||
<input name="latitude" id="sp_latitude" class="sp-latitude" type="hidden" value="-37.8165647">
|
||||
<input name="longitude" id="sp_longitude" class="sp-longitude" type="hidden" value="144.9475055">
|
||||
|
||||
@@ -114,7 +114,7 @@ class SP_Admin_Taxonomies {
|
||||
endif;
|
||||
?>
|
||||
<div class="form-field">
|
||||
<p><div id="sp-location-picker" style="width: 95%; height: 320px"></div></p>
|
||||
<p><div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div></p>
|
||||
<p><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
|
||||
</div>
|
||||
<div class="form-field">
|
||||
@@ -149,16 +149,10 @@ class SP_Admin_Taxonomies {
|
||||
$latitude = is_numeric( esc_attr( $term_meta['sp_latitude'] ) ) ? esc_attr( $term_meta['sp_latitude'] ) : '';
|
||||
$longitude = is_numeric( esc_attr( $term_meta['sp_longitude'] ) ) ? esc_attr( $term_meta['sp_longitude'] ) : '';
|
||||
$address = esc_attr( $term_meta['sp_address'] ) ? esc_attr( $term_meta['sp_address'] ) : '';
|
||||
|
||||
if ( class_exists( 'SportsPress_GoogleMaps' ) ) {
|
||||
do_action ( 'sp_venue_edit_googlemaps', $latitude, $longitude, $address );
|
||||
}else{
|
||||
do_action ( 'sp_venue_edit_openstreetmap', $latitude, $longitude, $address );
|
||||
}
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<td colspan="2">
|
||||
<p><div id="sp-location-picker" style="width: 95%; height: 320px"></div></p>
|
||||
<p><div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div></p>
|
||||
<p class="description"><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -74,10 +74,6 @@ class SP_Frontend_Scripts {
|
||||
wp_enqueue_script( 'jquery-datatables', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.10.4', true );
|
||||
wp_enqueue_script( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sportspress.js', array( 'jquery' ), SP()->version, true );
|
||||
|
||||
if( is_single() && get_post_type()=='sp_event' ){
|
||||
wp_enqueue_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||
}
|
||||
|
||||
// Localize scripts
|
||||
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ), 'previous' => __( 'Previous', 'sportspress' ), 'next' => __( 'Next', 'sportspress' ) ) );
|
||||
|
||||
@@ -104,10 +100,6 @@ class SP_Frontend_Scripts {
|
||||
foreach ( $enqueue_styles as $handle => $args )
|
||||
wp_enqueue_style( $handle, $args['src'], $args['deps'], $args['version'], $args['media'] );
|
||||
endif;
|
||||
|
||||
if( is_single() && get_post_type()=='sp_event' ){
|
||||
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,8 +30,9 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && ! class_exists( 'SportsPre
|
||||
$this->define_constants();
|
||||
|
||||
// Actions
|
||||
//add_action( 'sp_venue_add_openstreetmap', array( $this, 'add_venue_openstreetmap' ), 10, 3 );
|
||||
//add_action( 'sp_venue_edit_openstreetmap', array( $this, 'edit_venue_openstreetmap' ), 10, 3 );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
|
||||
add_action( 'sp_venue_show_openstreetmap', array( $this, 'show_venue_openstreetmap' ), 10, 4 );
|
||||
|
||||
// Filters
|
||||
@@ -54,20 +55,42 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && ! class_exists( 'SportsPre
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate OpenStreetMap (Add Venue)
|
||||
*
|
||||
* @return mix
|
||||
* Enqueue admin styles
|
||||
*/
|
||||
//public function add_venue_openstreetmap( $latitude, $longitude, $address ) {
|
||||
//}
|
||||
public function admin_styles( $hook ) {
|
||||
$screen = get_current_screen();
|
||||
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
|
||||
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
||||
wp_enqueue_style( 'control-geocoder', SP()->plugin_url() . '/assets/css/Control.Geocoder.css', array() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate OpenStreetMap (Edit Venue)
|
||||
*
|
||||
* @return mix
|
||||
* Enqueue admin scripts
|
||||
*/
|
||||
//public function edit_venue_openstreetmap( $latitude, $longitude, $address ) {
|
||||
//}
|
||||
public function admin_scripts( $hook ) {
|
||||
$screen = get_current_screen();
|
||||
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
|
||||
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||
wp_register_script( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
|
||||
wp_register_script( 'sportspress-admin-geocoder', SP()->plugin_url() . '/assets/js/admin/sp-geocoder.js', array( 'leaflet_js', 'control-geocoder' ), SP_VERSION, true );
|
||||
}
|
||||
// Edit venue pages
|
||||
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
|
||||
wp_enqueue_script( 'leaflet_js' );
|
||||
wp_enqueue_script( 'control-geocoder' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue frontend scripts
|
||||
*/
|
||||
public function frontend_scripts() {
|
||||
if( is_single() && get_post_type()=='sp_event' ){
|
||||
wp_enqueue_style( 'leaflet_stylesheet', SP()->plugin_url() . '/assets/css/leaflet.css', array(), '1.4.0' );
|
||||
wp_enqueue_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Integrate OpenStreetMap (Show Venue)
|
||||
|
||||
Reference in New Issue
Block a user