Final Commit

This commit is contained in:
savvasha
2019-02-22 18:07:29 +02:00
parent eaf73961d7
commit 2392b582d9
5 changed files with 16 additions and 15 deletions

View File

@@ -103,10 +103,10 @@ class SP_Admin_Setup_Wizard {
wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true ); wp_register_script( 'jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true );
wp_register_script( 'sportspress-setup', SP()->plugin_url() . '/assets/js/admin/sportspress-setup.js', array( 'jquery', 'chosen', 'jquery-tiptip' ), SP_VERSION, true ); 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' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
wp_register_script( 'google-maps', '//tboy.co/maps_js' ); 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( 'jquery-locationpicker', SP_GOOGLEMAPS_URL . '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 ); wp_register_script( 'sportspress-admin-locationpicker', SP_GOOGLEMAPS_URL . 'js/admin/locationpicker.js', array( 'jquery', 'google-maps', 'jquery-locationpicker' ), SP_GOOGLEMAPS_VERSION, true );
} else { } else {
wp_register_script( 'leaflet_js', SP()->plugin_url() . '/assets/js/leaflet.js', array(), '1.4.0' ); 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( 'control-geocoder', SP()->plugin_url() . '/assets/js/Control.Geocoder.js', array( 'leaflet_js' ) );
@@ -523,7 +523,7 @@ class SP_Admin_Setup_Wizard {
* Venue Step. * Venue Step.
*/ */
public function sp_setup_venue() { public function sp_setup_venue() {
if ( class_exists( 'SportsPress_GoogleMaps' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
wp_print_scripts( 'google-maps' ); wp_print_scripts( 'google-maps' );
}else{ }else{
wp_print_scripts( 'leaflet_js' ); wp_print_scripts( 'leaflet_js' );
@@ -559,7 +559,7 @@ class SP_Admin_Setup_Wizard {
</p> </p>
</form> </form>
<?php <?php
if ( class_exists( 'SportsPress_GoogleMaps' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
wp_print_scripts( 'sportspress-admin-locationpicker' ); wp_print_scripts( 'sportspress-admin-locationpicker' );
} else { } else {
wp_print_scripts( 'sportspress-admin-setup-geocoder' ); wp_print_scripts( 'sportspress-admin-setup-geocoder' );

View File

@@ -114,7 +114,7 @@ class SP_Admin_Taxonomies {
endif; endif;
?> ?>
<div class="form-field"> <div class="form-field">
<p><div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div></p> <div id="sp-location-picker" class="sp-location-picker" style="width: 95%; height: 320px"></div>
<p><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p> <p><?php _e( "Drag the marker to the venue's location.", 'sportspress' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
@@ -130,7 +130,7 @@ class SP_Admin_Taxonomies {
<input type="text" class="sp-longitude" name="term_meta[sp_longitude]" id="term_meta[sp_longitude]" value="<?php echo esc_attr( $longitude ); ?>"> <input type="text" class="sp-longitude" name="term_meta[sp_longitude]" id="term_meta[sp_longitude]" value="<?php echo esc_attr( $longitude ); ?>">
</div> </div>
<?php <?php
if ( class_exists( 'SportsPress_GoogleMaps' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
wp_print_scripts( 'sportspress-admin-locationpicker' ); wp_print_scripts( 'sportspress-admin-locationpicker' );
} else { } else {
wp_print_scripts( 'sportspress-admin-geocoder' ); wp_print_scripts( 'sportspress-admin-geocoder' );
@@ -175,7 +175,7 @@ class SP_Admin_Taxonomies {
</td> </td>
</tr> </tr>
<?php <?php
if ( class_exists( 'SportsPress_GoogleMaps' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
wp_print_scripts( 'sportspress-admin-locationpicker' ); wp_print_scripts( 'sportspress-admin-locationpicker' );
} else { } else {
wp_print_scripts( 'sportspress-admin-geocoder' ); wp_print_scripts( 'sportspress-admin-geocoder' );

View File

@@ -181,8 +181,8 @@ class SP_Settings_Events extends SP_Settings_Page {
), ),
array( array(
'title' => __( 'OpenStreetMaps', 'sportspress' ), 'title' => __( 'Venue Map', 'sportspress' ),
'desc' => __( 'Display maps', 'sportspress' ), 'desc' => __( 'Display venue map', 'sportspress' ),
'id' => 'sportspress_event_show_maps', 'id' => 'sportspress_event_show_maps',
'default' => 'yes', 'default' => 'yes',
'type' => 'checkbox', 'type' => 'checkbox',

View File

@@ -11,7 +11,7 @@ Version: 2.7
// Exit if accessed directly // Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit; if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && ! class_exists( 'SportsPress_GoogleMaps' ) ) : if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'no' ) :
/** /**
* Main SportsPress OpenStreetMap Class * Main SportsPress OpenStreetMap Class
@@ -131,5 +131,6 @@ if ( ! class_exists( 'SportsPress_OpenStreetMap' ) && ! class_exists( 'SportsPre
} }
endif; endif;
if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'no' ) {
new SportsPress_OpenStreetMap(); new SportsPress_OpenStreetMap();
}

View File

@@ -24,8 +24,8 @@ if ( '' === $address ) $address = '+';
if ( 'satellite' !== $maptype ) $maptype = 'roadmap'; if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
if ( $latitude != null && $longitude != null ){ if ( $latitude != null && $longitude != null ){
if ( class_exists( 'SportsPress_GoogleMaps' ) ) { if ( get_option( 'sportspress_load_googlemaps_module', 'no' ) == 'yes' ) {
do_action ( 'sp_venue_show_googlemaps', $latitude, $longitude, $zoom, $maptype ); do_action ( 'sp_venue_show_googlemaps', $latitude, $longitude, $address, $zoom, $maptype );
}else{ }else{
do_action ( 'sp_venue_show_openstreetmap', $latitude, $longitude, $zoom, $maptype ); do_action ( 'sp_venue_show_openstreetmap', $latitude, $longitude, $zoom, $maptype );
} }