コード例 #1
0
ファイル: wpsl-functions.php プロジェクト: taeche/SoDoEx
/**
 * Make sure the provided map type is valid.
 * 
 * If the map type is invalid the default is used ( roadmap ).
 * 
 * @since 2.0.0
 * @param  string $map_type The provided map type
 * @return string $map_type A valid map type
 */
function wpsl_valid_map_type($map_type)
{
    $allowed_map_types = wpsl_get_map_types();
    if (!array_key_exists($map_type, $allowed_map_types)) {
        $map_type = wpsl_get_default_setting('map_type');
    }
    return $map_type;
}
コード例 #2
0
 /**
  * Create dropdown lists.
  * 
  * @since 2.0.0
  * @param  string $type     The type of dropdown
  * @return string $dropdown The html output for the dropdown
  */
 public function create_dropdown($type)
 {
     global $wpsl_settings;
     $dropdown_lists = array('hour_input' => array('values' => array('textarea' => __('Textarea', 'wpsl'), 'dropdown' => __('Dropdowns (recommended)', 'wpsl')), 'id' => 'wpsl-editor-hour-input', 'name' => 'wpsl_editor[hour_input]', 'selected' => $wpsl_settings['editor_hour_input']), 'marker_effects' => array('values' => array('bounce' => __('Bounces up and down', 'wpsl'), 'info_window' => __('Will open the info window', 'wpsl'), 'ignore' => __('Does not respond', 'wpsl')), 'id' => 'wpsl-marker-effect', 'name' => 'wpsl_ux[marker_effect]', 'selected' => $wpsl_settings['marker_effect']), 'more_info' => array('values' => array('store listings' => __('In the store listings', 'wpsl'), 'info window' => __('In the info window on the map', 'wpsl')), 'id' => 'wpsl-more-info-list', 'name' => 'wpsl_ux[more_info_location]', 'selected' => $wpsl_settings['more_info_location']), 'map_types' => array('values' => wpsl_get_map_types(), 'id' => 'wpsl-map-type', 'name' => 'wpsl_map[type]', 'selected' => $wpsl_settings['map_type']), 'editor_map_types' => array('values' => wpsl_get_map_types(), 'id' => 'wpsl-editor-map-type', 'name' => 'wpsl_editor[map_type]', 'selected' => $wpsl_settings['editor_map_type']), 'max_zoom_level' => array('values' => wpsl_get_max_zoom_levels(), 'id' => 'wpsl-max-auto-zoom', 'name' => 'wpsl_map[max_auto_zoom]', 'selected' => $wpsl_settings['auto_zoom_level']), 'address_format' => array('values' => wpsl_get_address_formats(), 'id' => 'wpsl-address-format', 'name' => 'wpsl_ux[address_format]', 'selected' => $wpsl_settings['address_format']));
     $dropdown = '<select id="' . esc_attr($dropdown_lists[$type]['id']) . '" name="' . esc_attr($dropdown_lists[$type]['name']) . '" autocomplete="off">';
     foreach ($dropdown_lists[$type]['values'] as $key => $value) {
         $selected = $key == $dropdown_lists[$type]['selected'] ? 'selected="selected"' : '';
         $dropdown .= "<option value='" . esc_attr($key) . "' {$selected}>" . esc_html($value) . "</option>";
     }
     $dropdown .= '</select>';
     return $dropdown;
 }