-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rb192 #197
base: master
Are you sure you want to change the base?
Rb192 #197
Changes from all commits
72c26ee
11baaef
6bf0211
d5b0fd4
28c766f
867318e
8a616ff
2998b27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,22 +152,19 @@ static function handle_venuemap_shortcode($atts) { | |
|
||
$venue_slugs = explode(',',$atts['venue']); | ||
|
||
$args = shortcode_atts( array( | ||
'zoom' => 15, 'scrollwheel'=>'true','zoomcontrol'=>'true', | ||
'rotatecontrol'=>'true','pancontrol'=>'true','overviewmapcontrol'=>'true', | ||
'streetviewcontrol'=>'true','maptypecontrol'=>'true','draggable'=>'true', | ||
'maptypeid' => 'ROADMAP', | ||
'width' => '100%','height' => '200px','class' => '', | ||
'tooltip'=>'false' | ||
), $atts ); | ||
|
||
//Cast options as boolean: | ||
$bool_options = array('tooltip','scrollwheel','zoomcontrol','rotatecontrol','pancontrol','overviewmapcontrol','streetviewcontrol','draggable','maptypecontrol'); | ||
foreach( $bool_options as $option ){ | ||
$args[$option] = ( $args[$option] == 'false' ? false : true ); | ||
// Cast options as boolean: | ||
$boolean_keys = array_filter(eo_venue_map_defaults(), "is_bool"); | ||
if (!function_exists("cast_to_boolean_if_possible")) { | ||
function cast_to_boolean_if_possible($attribute) { | ||
return ("false" === $attribute ? false : true); | ||
} | ||
} | ||
$booleans = array_intersect_key($atts, $boolean_keys); | ||
$booleans_cast = array_map("cast_to_boolean_if_possible", $booleans); | ||
$non_booleans = array_diff_key($atts, $boolean_keys); | ||
$all_atts = array_merge($booleans_cast, $non_booleans); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is defining/ using
And remove lines 164 & 165. |
||
|
||
return eo_get_venue_map($venue_slugs, $args); | ||
return eo_get_venue_map($venue_slugs, $all_atts); | ||
} | ||
|
||
|
||
|
@@ -421,7 +418,6 @@ static function print_script() { | |
)); | ||
|
||
if( !empty(self::$calendars) || !empty(self::$map) || !empty(self::$widget_calendars) ): | ||
wp_enqueue_script( 'eo_qtip2'); | ||
wp_enqueue_script( 'eo_front'); | ||
|
||
if( !eventorganiser_get_option( 'disable_css' ) ){ | ||
|
@@ -430,8 +426,11 @@ static function print_script() { | |
} | ||
endif; | ||
|
||
if( !empty( self::$map ) ) | ||
if( !empty( self::$map ) ) { | ||
wp_enqueue_script( 'eo_GoogleMap' ); | ||
} else { | ||
wp_enqueue_script( 'eo_qtip2'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would enqueue qtip2 whenever a map isn't used. We only wanted enqueued if |
||
} | ||
} | ||
} | ||
|
||
|
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how the boolean keys are treated, but I think the defaults should be an array rather than a separate function. That way the default values are obvious within the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, defaults are used in two separate places. I see the reasoning now...
The default values, however are different for the function/shortcode (
tooltip
as far as I can tell).