added apikey field

This commit is contained in:
Harald Milz 2019-03-28 16:30:04 +01:00
parent 20edb9f18a
commit d0edf39842

View file

@ -116,6 +116,7 @@ function gcal_geocoding_section_text() {
function gcal_geocoding_setting_string() { function gcal_geocoding_setting_string() {
$options = get_option('gcal_options'); $options = get_option('gcal_options');
$current = ( isset ($options['gcal_geocoding']) ? $options['gcal_geocoding'] : 'off' ); // default off $current = ( isset ($options['gcal_geocoding']) ? $options['gcal_geocoding'] : 'off' ); // default off
$apikey = ( isset ($options['gcal_apikey']) ? $options['gcal_apikey'] : '' ); // default empty
$coders = array( $coders = array(
array( array(
@ -124,7 +125,7 @@ function gcal_geocoding_setting_string() {
), ),
array( array(
'option' => 'official', 'option' => 'official',
'name' => 'Google official (in Entwicklung; erfordert einen API Key)', 'name' => 'Google official - in Entwicklung; erfordert einen API Key --> ',
), ),
array( array(
'option' => 'inofficial', 'option' => 'inofficial',
@ -132,13 +133,18 @@ function gcal_geocoding_setting_string() {
), ),
array( array(
'option' => 'osm', 'option' => 'osm',
'name' => 'OpenStreetMap (in Entwicklung)', 'name' => 'OpenStreetMap - in Entwicklung',
), ),
); );
foreach ( $coders as $coder ) { foreach ( $coders as $coder ) {
$checked = ( $current == $coder['option'] ? 'checked' : '' ); $checked = ( $current == $coder['option'] ? 'checked' : '' );
echo '<input type="radio" id="gcal_geocoding" name="gcal_options[gcal_geocoding]" value ="' . $coder['option'] . '" ' . $checked . '> ' . $coder['name'] . '</br>' ; echo '<input type="radio" id="gcal_geocoding" name="gcal_options[gcal_geocoding]" value ="' . $coder['option'] . '" ' . $checked . '> ' . $coder['name'];
if ( $coder['option'] == 'official' ) {
echo '<input type="text" size="32" id="gcal_geocoding" name="gcal_options[gcal_apikey]" value="' . $apikey . '">';
}
echo '</br>' ;
} }
} }