Skip to content

Contact Info Widget: Add a filter for a Google API Key#4265

Merged
jeherve merged 4 commits intomasterfrom
add/google-map-api-key-41
Jul 1, 2016
Merged

Contact Info Widget: Add a filter for a Google API Key#4265
jeherve merged 4 commits intomasterfrom
add/google-map-api-key-41

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Jul 1, 2016

See #4240

The smallest delta to keep functionality up. #4242 is still valid and the home to a more long-term intermediate fix :)

Google now requires an API key for all new domains. This add the ability to add one via a filter.

Users should enable both the Google Maps JS API and the Google Maps Embed API for their given key for the best long-term performance.
@kraftbj kraftbj added Bug When a feature is broken and / or not performing as intended [Feature] Extra Sidebar Widgets [Status] Needs Review This PR is ready for review. labels Jul 1, 2016
@kraftbj kraftbj added this to the 4.1 milestone Jul 1, 2016

wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?sensor=false' );
wp_enqueue_script( 'google-maps', esc_url( $google_url ) );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be escaping this? At very least, I'd check to make sure that encoding the & doesn't break the script import (noticed some issues with this in earlier iterations of changes).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_query_arg doesn't provide any protection and since it is an user-provided value, we should. But, you're right, I'm using esc_url in the default display context. Changing it to send null context will save the ampersands.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Jul 1, 2016
@jeherve
Copy link
Copy Markdown
Member

jeherve commented Jul 1, 2016

This looks good to merge. I'll merge this once the tests pass.

@jeherve jeherve merged commit f60e400 into master Jul 1, 2016
@jeherve jeherve deleted the add/google-map-api-key-41 branch July 1, 2016 16:44
@jeherve jeherve removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jul 1, 2016
jeherve added a commit that referenced this pull request Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Extra Sidebar Widgets Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants