/** * Markup for settings tab switcher * * @since 2.1.0 * * @uses "gmb_settings_tabs" action */ public function settings_tabs($active_tab) { gmb_include_view('admin/views/settings-tabs.php', false, $this->view_data($this->tab_settings($active_tab), true)); }
/** * Maps activation banner. * * Welcome the user and provide instructions to create and add a Google Maps API key. * * @see http://stackoverflow.com/questions/2769148/whats-the-api-key-for-in-google-maps-api-v3/37994162#37994162 * * @since 1.0 */ public function activation_notice() { $current_user = wp_get_current_user(); // If the user has already dismissed our alert, bounce. if (get_user_meta($current_user->ID, $this->nag_meta_key)) { return; } //Only display if an API key is not entered. $api_key = gmb_get_option('gmb_maps_api_key'); if (!empty($api_key)) { return; } //Only display if this is a new install (no maps). $count_maps = wp_count_posts('google_maps'); if ($count_maps->publish != 0) { return; } //Don't show on the plugin's settings screen. if (isset($_GET['page']) && $_GET['page'] == 'gmb_settings') { return; } //Free pr //@TODO: Provide support link $support_link = 'https://wordpress.org/plugins/google-maps-builder/'; ?> <style> div.gmb-svg-banner { float: left; } div.gmb-svg-banner > svg { width: 50px; height: 50px; float: left; } div.gmb-api-alert.updated { padding: 1em 2em; position: relative; border-color: #66BB6A; } div.gmb-api-alert img { max-width: 50px; position: relative; top: 1em; } div.gmb-banner-content-wrap { margin: 0 30px 0 70px; } div.gmb-api-alert h3 { font-weight: 300; margin: 5px 0 0; } div.gmb-api-alert h3 span { font-weight: 600; color: #66BB6A; } div.gmb-api-alert .alert-actions { position: relative; left: 70px; } div.gmb-api-alert a { color: #66BB6A; } div.gmb-api-alert .alert-actions a { text-decoration: underline; color: #808080; } div.gmb-api-alert .alert-actions a:hover { color: #555555; } div.gmb-api-alert .alert-actions a span { text-decoration: none; margin-right: 5px; } div.gmb-api-alert .dismiss { position: absolute; right: 15px; height: 100%; top: 50%; margin-top: -10px; outline: none; box-shadow: none; text-decoration: none; color: #333; } </style> <div class="updated gmb-api-alert"> <div class="gmb-svg-banner"><?php gmb_include_view('admin/views/mascot-svg.php'); ?> </div> <div class="gmb-banner-content-wrap"> <h3><?php printf(__("Welcome to %s! Let's get started.", 'google-maps-builder'), '<span>' . $this->plugin_name() . '</span>'); ?> </h3> <p><?php echo sprintf(__('You\'re almost ready to start building awesome Google Maps! But first, in order to use %1$s you need to enter a Google Maps API key in the %2$splugin settings%5$s. An API key with Maps and Places APIs is now required by Google to access their mapping services. Don\'t worry, getting an API key is free and easy.<br> %3$sLearn How to Create a Maps API Key » %5$s | %4$s Google API Console » %5$s', 'google-maps-builder'), $this->plugin_name(), '<a href="' . esc_url(admin_url('edit.php?post_type=google_maps&page=gmb_settings')) . '">', '<a href="https://wordimpress.com/documentation/maps-builder-pro/creating-maps-api-key/" target="_blank">', '<a href="https://console.cloud.google.com/" target="_blank">', '</a>'); ?> </p> </div> <a href="<?php //The Dismiss Button $nag_admin_dismiss_url = add_query_arg(array($this->nag_meta_key => 0), admin_url()); echo esc_url($nag_admin_dismiss_url); ?> " class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> <div class="alert-actions"> <a href="<?php echo esc_url(admin_url('edit.php?post_type=google_maps&page=gmb_settings')); ?> "><span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'google-maps-builder'); ?> </a> <a href="https://wordimpress.com/documentation/maps-builder-pro" target="_blank" style="margin-left:30px;"><span class="dashicons dashicons-media-text"></span><?php _e('Plugin Documentation', 'google-maps-builder'); ?> </a> <a href="<?php echo $support_link; ?> " target="_blank" style="margin-left:30px;"> <span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'google-maps-builder'); ?> </a> </div> </div> <?php }
<h1 class="nav-tab-wrapper"><?php do_action('gmb_settings_tabs', $active_tab); ?> </h1> <?php /** * Get the appropriate tab */ switch ($active_tab) { case 'map_options': $view = 'tab-map-options.php'; break; case 'general_settings': $view = 'tab-general-settings.php'; break; case 'license': $view = 'tab-license.php'; break; case 'system_info': $view = 'tab-system-info.php'; break; default: $view = 'tab-map-options.php'; break; } gmb_include_view('admin/views/' . $view, false, $data); ?> </div>
/** * Custom Google Geocoder field * @since 1.0.0 */ function cmb2_render_google_maps_preview($field, $meta) { global $post; $meta = wp_parse_args($meta, array()); $wh_value = get_post_meta($post->ID, 'gmb_width_height', true); $lat_lng = get_post_meta($post->ID, 'gmb_lat_lng', true); $default_options = $this->get_default_map_options(); $output = '<div class="places-loading wpgp-loading">' . __('Loading Places', 'google-maps-builder') . '</div>'; $output .= '<div id="google-map-wrap">'; $output .= '<div id="map" style="height:600px; width:100%;"></div>'; //Toolbar $output .= '<div id="map-toolbar">'; $output .= '<button class="add-location button button-small gmb-magnific-inline" data-target="cmb2-id-gmb-geocoder" data-auto-focus="true"><span class="dashicons dashicons-pressthis"></span>' . __('Add Location', 'google-maps-builder') . '</button>'; $output .= '<button class="drop-marker button button-small"><span class="dashicons dashicons-location"></span>' . __('Drop a Marker', 'google-maps-builder') . '</button>'; $output .= '<button class="goto-location button button-small gmb-magnific-inline" data-target="map-autocomplete-wrap" data-auto-focus="true"><span class="dashicons dashicons-admin-site"></span>' . __('Goto Location', 'google-maps-builder') . '</button>'; $output .= '<button class="edit-title button button-small gmb-magnific-inline" data-target="map-title-wrap" data-auto-focus="true"><span class="dashicons dashicons-edit"></span>' . __('Edit Map Title', 'google-maps-builder') . '</button>'; $output .= '<div class="live-lat-lng-wrap clearfix">'; $output .= '<button disabled class="update-lat-lng button button-small">' . __('Set Lat/Lng', 'google-maps-builder') . '</button>'; $output .= '<div class="live-latitude-wrap"><span class="live-latitude-label">' . __('Lat:', 'google-maps-builder') . '</span><span class="live-latitude">' . (isset($lat_lng['latitude']) ? $lat_lng['latitude'] : '') . '</span></div>'; $output .= '<div class="live-longitude-wrap"><span class="live-longitude-label">' . __('Lng:', 'google-maps-builder') . '</span><span class="live-longitude">' . (isset($lat_lng['longitude']) ? $lat_lng['longitude'] : '') . '</span></div>'; $output .= '</div>'; //End .live-lat-lng-wrap $output .= '</div>'; //End #map-toolbar $output .= '</div>'; //End #map $output .= '<div class="white-popup mfp-hide map-title-wrap">'; $output .= '<div class="inner-modal-wrap">'; $output .= '<div class="inner-modal-container">'; $output .= '<div class="inner-modal">'; $output .= '<label for="post_title" class="map-title">' . __('Map Title', 'google-maps-builder') . '</label>'; $output .= '<p class="cmb2-metabox-description">' . __('Give your Map a descriptive title', 'google-maps-builder') . '</p>'; $output .= '<input type="text" name="model_post_title" size="30" value="' . get_the_title() . '" id="modal_title" spellcheck="true" autocomplete="off" placeholder="' . __('Enter map title', 'google-maps-builder') . '">'; $output .= '<button type="button" class="gmb-modal-close">×</button>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '<div class="white-popup mfp-hide map-autocomplete-wrap">'; $output .= '<div class="inner-modal-wrap">'; $output .= '<div class="inner-modal-container">'; $output .= '<div class="inner-modal">'; $output .= '<label for="map-location-autocomplete" class="map-title">' . __('Enter a Location', 'google-maps-builder') . '</label>'; $output .= '<p class="cmb2-metabox-description">' . __('Type your point of interest below and the map will be re-centered over that location', 'google-maps-builder') . '</p>'; $output .= '<button type="button" class="gmb-modal-close">×</button>'; $output .= '<input type="text" name="" size="30" id="map-location-autocomplete">'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; //Markers Modal gmb_include_view('admin/views/markers.php', false, $this->view_data()); //Places search $output = $this->places_search($output); echo apply_filters('google_maps_preview', $output); }