Version Description
Added a Generate API KEY button for easier generation of API KEY - ADDED
Download this release
Release Info
Developer | stiofansisland |
Plugin | API KEY for Google Maps |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- api-key-for-google-maps.php +42 -7
- gd_banner.jpg +0 -0
- languages/gmaps-api-key.mo +0 -0
- languages/gmaps-api-key.po +30 -11
- readme.txt +11 -2
api-key-for-google-maps.php
CHANGED
@@ -11,13 +11,13 @@
|
|
11 |
* Plugin Name: API KEY for Google Maps
|
12 |
* Plugin URI: http://wpgeodirectory.com/
|
13 |
* Description: Adds API KEY to Google maps calls if they have been enqueue correctly.
|
14 |
-
* Version: 1.
|
15 |
* Author: GeoDirectory
|
16 |
* Author URI: https://wpgeodirectory.com
|
17 |
* Text Domain: gmaps-api-key
|
18 |
* Domain Path: /languages
|
19 |
* Requires at least: 3.1
|
20 |
-
* Tested up to: 4.
|
21 |
*/
|
22 |
|
23 |
// If this file is called directly, abort.
|
@@ -30,8 +30,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
-
define( "GMAPIKEY_VERSION", "1.
|
34 |
-
|
35 |
|
36 |
|
37 |
add_action( 'plugins_loaded', 'rgmk_load_textdomain' );
|
@@ -69,7 +68,7 @@ function rgmk_find_add_key( $url, $original_url, $_context ) {
|
|
69 |
if ( strstr( $url, "maps.google.com/maps/api/js" ) !== false || strstr( $url, "maps.googleapis.com/maps/api/js" ) !== false ) {// it's a Google maps url
|
70 |
|
71 |
if ( strstr( $url, "key=" ) === false ) {// it needs a key
|
72 |
-
$url = add_query_arg( 'key'
|
73 |
$url = str_replace( "&", "&", $url ); // or $url = $original_url
|
74 |
}
|
75 |
|
@@ -94,9 +93,11 @@ function rgmk_add_admin_menu() {
|
|
94 |
* The html output for the settings page.
|
95 |
*
|
96 |
* @since 1.0.0
|
|
|
97 |
* @package GMAPIKEY
|
98 |
*/
|
99 |
function rgmk_add_admin_menu_html() {
|
|
|
100 |
$updated = false;
|
101 |
if ( isset( $_POST['rgmk_google_map_api_key'] ) ) {
|
102 |
$key = esc_attr( $_POST['rgmk_google_map_api_key'] );
|
@@ -111,14 +112,25 @@ function rgmk_add_admin_menu_html() {
|
|
111 |
<div class="wrap">
|
112 |
|
113 |
<h2><?php _e( 'Retro Add Google Maps API KEY', 'gmaps-api-key' ); ?></h2>
|
114 |
-
<p><?php _e( 'This plugin will attempt to add your Google API KEY to any Google Maps JS file that has properly been
|
115 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
<form method="post" action="options-general.php?page=gmaps-api-key">
|
118 |
<label for="rgmk_google_map_api_key"><?php _e( 'Enter Google Maps API KEY', 'gmaps-api-key' ); ?></label>
|
119 |
<input title="<?php _e( 'Add Google Maps API KEY', 'gmaps-api-key' ); ?>" type="text"
|
120 |
name="rgmk_google_map_api_key" id="rgmk_google_map_api_key"
|
|
|
|
|
121 |
value="<?php echo esc_attr( get_option( 'rgmk_google_map_api_key' ) ); ?>"/>
|
|
|
122 |
<?php
|
123 |
|
124 |
submit_button();
|
@@ -129,3 +141,26 @@ function rgmk_add_admin_menu_html() {
|
|
129 |
</div><!-- /.wrap -->
|
130 |
<?php
|
131 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
* Plugin Name: API KEY for Google Maps
|
12 |
* Plugin URI: http://wpgeodirectory.com/
|
13 |
* Description: Adds API KEY to Google maps calls if they have been enqueue correctly.
|
14 |
+
* Version: 1.1.0
|
15 |
* Author: GeoDirectory
|
16 |
* Author URI: https://wpgeodirectory.com
|
17 |
* Text Domain: gmaps-api-key
|
18 |
* Domain Path: /languages
|
19 |
* Requires at least: 3.1
|
20 |
+
* Tested up to: 4.7
|
21 |
*/
|
22 |
|
23 |
// If this file is called directly, abort.
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
+
define( "GMAPIKEY_VERSION", "1.1.0" );
|
|
|
34 |
|
35 |
|
36 |
add_action( 'plugins_loaded', 'rgmk_load_textdomain' );
|
68 |
if ( strstr( $url, "maps.google.com/maps/api/js" ) !== false || strstr( $url, "maps.googleapis.com/maps/api/js" ) !== false ) {// it's a Google maps url
|
69 |
|
70 |
if ( strstr( $url, "key=" ) === false ) {// it needs a key
|
71 |
+
$url = add_query_arg( 'key', $key, $url );
|
72 |
$url = str_replace( "&", "&", $url ); // or $url = $original_url
|
73 |
}
|
74 |
|
93 |
* The html output for the settings page.
|
94 |
*
|
95 |
* @since 1.0.0
|
96 |
+
* @since 1.1.0 Added button to generate API KEY from wp-admin.
|
97 |
* @package GMAPIKEY
|
98 |
*/
|
99 |
function rgmk_add_admin_menu_html() {
|
100 |
+
add_thickbox();
|
101 |
$updated = false;
|
102 |
if ( isset( $_POST['rgmk_google_map_api_key'] ) ) {
|
103 |
$key = esc_attr( $_POST['rgmk_google_map_api_key'] );
|
112 |
<div class="wrap">
|
113 |
|
114 |
<h2><?php _e( 'Retro Add Google Maps API KEY', 'gmaps-api-key' ); ?></h2>
|
115 |
+
<p><?php _e( 'This plugin will attempt to add your Google API KEY to any Google Maps JS file that has properly been enqueued.', 'gmaps-api-key' ); ?></p>
|
116 |
+
<p>
|
117 |
+
|
118 |
+
<a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["maps_backend","geocoding_backend","directions_backend","distance_matrix_backend","elevation_backend","places_backend"],null]&TB_iframe=true&width=600&height=400'
|
119 |
+
class="thickbox button-primary"
|
120 |
+
name="<?php _e( 'Generate API Key - ( MUST be logged in to your Google account )', 'gmaps-api-key' ); ?>">
|
121 |
+
<?php _e( 'Generate API Key', 'gmaps-api-key' ); ?>
|
122 |
+
</a>
|
123 |
+
<?php echo sprintf( __( 'or %sclick here%s to Get a Google Maps API KEY', 'geodirectory' ), '<a target="_blank" href=\'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true\'>', '</a>' ) ?>
|
124 |
+
</p>
|
125 |
|
126 |
<form method="post" action="options-general.php?page=gmaps-api-key">
|
127 |
<label for="rgmk_google_map_api_key"><?php _e( 'Enter Google Maps API KEY', 'gmaps-api-key' ); ?></label>
|
128 |
<input title="<?php _e( 'Add Google Maps API KEY', 'gmaps-api-key' ); ?>" type="text"
|
129 |
name="rgmk_google_map_api_key" id="rgmk_google_map_api_key"
|
130 |
+
placeholder="<?php _e( 'Enter your API KEY here', 'gmaps-api-key' ); ?>"
|
131 |
+
style="padding: 6px; width:50%; display: block;"
|
132 |
value="<?php echo esc_attr( get_option( 'rgmk_google_map_api_key' ) ); ?>"/>
|
133 |
+
|
134 |
<?php
|
135 |
|
136 |
submit_button();
|
141 |
</div><!-- /.wrap -->
|
142 |
<?php
|
143 |
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Add special offer banner on settings page.
|
147 |
+
*
|
148 |
+
* @since 1.1.0
|
149 |
+
* @package GMAPIKEY
|
150 |
+
*/
|
151 |
+
function rgmk_show_geodirectory_offer() {
|
152 |
+
if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'gmaps-api-key' ) {
|
153 |
+
|
154 |
+
if ( defined( 'GEODIRECTORY_VERSION' ) || get_option( 'geodirectory_db_version' ) ) {
|
155 |
+
return;
|
156 |
+
}
|
157 |
+
?>
|
158 |
+
<div class="notice notice-info is-dismissible rgmk-offer-notice">
|
159 |
+
<img src="<?php echo plugin_dir_url( __FILE__ ) . '/gd_banner.jpg'; ?>"/>
|
160 |
+
<p><?php echo sprintf( __( 'API KEY for Google Maps was created for free by %sGeoDirecotry%s - The WordPress directory pluign. Discount Code: APIKEY25OFF', 'sample-text-domain' ), '<a target="_blank" href="https://wpgeodirectory.com/" >', '</a>' ); ?></p>
|
161 |
+
</div>
|
162 |
+
<?php
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
add_action( 'admin_notices', 'rgmk_show_geodirectory_offer' );
|
gd_banner.jpg
ADDED
Binary file
|
languages/gmaps-api-key.mo
CHANGED
Binary file
|
languages/gmaps-api-key.po
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Google Maps API KEY 1.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2016-
|
6 |
-
"PO-Revision-Date: 2016-
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: GeoDirectory <info@ayecode.io>\n"
|
9 |
"Language: en_US\n"
|
@@ -18,29 +18,48 @@ msgstr ""
|
|
18 |
"X-Generator: Poedit 1.8.7.1\n"
|
19 |
"X-Poedit-SearchPath-0: .\n"
|
20 |
|
21 |
-
#:
|
22 |
msgid "Kay Updated!"
|
23 |
msgstr ""
|
24 |
|
25 |
-
#:
|
26 |
msgid "Retro Add Google Maps API KEY"
|
27 |
msgstr ""
|
28 |
|
29 |
-
#:
|
30 |
msgid ""
|
31 |
"This plugin will attempt to add your Google API KEY to any Google Maps JS "
|
32 |
-
"file that has properly been
|
33 |
msgstr ""
|
34 |
|
35 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
#, php-format
|
37 |
-
msgid "
|
38 |
msgstr ""
|
39 |
|
40 |
-
#:
|
41 |
msgid "Enter Google Maps API KEY"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#:
|
45 |
msgid "Add Google Maps API KEY"
|
46 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Google Maps API KEY 1.1.0\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2016-12-15 14:30+0000\n"
|
6 |
+
"PO-Revision-Date: 2016-12-15 14:30+0000\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: GeoDirectory <info@ayecode.io>\n"
|
9 |
"Language: en_US\n"
|
18 |
"X-Generator: Poedit 1.8.7.1\n"
|
19 |
"X-Poedit-SearchPath-0: .\n"
|
20 |
|
21 |
+
#: api-key-for-google-maps.php:108
|
22 |
msgid "Kay Updated!"
|
23 |
msgstr ""
|
24 |
|
25 |
+
#: api-key-for-google-maps.php:114
|
26 |
msgid "Retro Add Google Maps API KEY"
|
27 |
msgstr ""
|
28 |
|
29 |
+
#: api-key-for-google-maps.php:115
|
30 |
msgid ""
|
31 |
"This plugin will attempt to add your Google API KEY to any Google Maps JS "
|
32 |
+
"file that has properly been enqueued."
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: api-key-for-google-maps.php:120
|
36 |
+
msgid "Generate API Key - ( MUST be logged in to your Google account )"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: api-key-for-google-maps.php:121
|
40 |
+
msgid "Generate API Key"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: api-key-for-google-maps.php:123
|
44 |
#, php-format
|
45 |
+
msgid "or %sclick here%s to Get a Google Maps API KEY"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: api-key-for-google-maps.php:127
|
49 |
msgid "Enter Google Maps API KEY"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: api-key-for-google-maps.php:128
|
53 |
msgid "Add Google Maps API KEY"
|
54 |
msgstr ""
|
55 |
+
|
56 |
+
#: api-key-for-google-maps.php:130
|
57 |
+
msgid "Enter your API KEY here"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: api-key-for-google-maps.php:160
|
61 |
+
#, php-format
|
62 |
+
msgid ""
|
63 |
+
"API KEY for Google Maps was created for free by %sGeoDirecotry%s - The "
|
64 |
+
"WordPress directory pluign. Discount Code: APIKEY25OFF"
|
65 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: stiofansisland, paoltaia
|
|
3 |
Tags: Google Maps, Google Maps KEY, Google Maps API KEY
|
4 |
Donate link: https://wpgeodirectory.com
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -18,6 +18,8 @@ Simply activate, go to Settings>Google API KEY and enter your key.
|
|
18 |
The plugin will then attempt to add this key to all the places it is needed on the front of your website.
|
19 |
NOTE: this will only work if the Google API has been added as per WordPress standards)
|
20 |
|
|
|
|
|
21 |
== Installation ==
|
22 |
|
23 |
= Minimum Requirements =
|
@@ -46,9 +48,16 @@ Ask and they shall be answered
|
|
46 |
|
47 |
== Screenshots ==
|
48 |
|
|
|
|
|
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= 1.0.0 =
|
53 |
|
54 |
initial release
|
3 |
Tags: Google Maps, Google Maps KEY, Google Maps API KEY
|
4 |
Donate link: https://wpgeodirectory.com
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
18 |
The plugin will then attempt to add this key to all the places it is needed on the front of your website.
|
19 |
NOTE: this will only work if the Google API has been added as per WordPress standards)
|
20 |
|
21 |
+
The plugin was created by the GeoDirectory team: <https://wpgeodirectory.com>
|
22 |
+
|
23 |
== Installation ==
|
24 |
|
25 |
= Minimum Requirements =
|
48 |
|
49 |
== Screenshots ==
|
50 |
|
51 |
+
1. Settings page.
|
52 |
+
2. Generate API KEY.
|
53 |
+
3. Copy API KEY, paste in Settings and save.
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 1.1.0 =
|
58 |
+
|
59 |
+
Added a Generate API KEY button for easier generation of API KEY - ADDED
|
60 |
+
|
61 |
= 1.0.0 =
|
62 |
|
63 |
initial release
|