embed_google_map_page

The Embed Google Map embed google map page function.

Description

embed_google_map_page(); 

Usage

  1. if ( !function_exists( 'embed_google_map_page' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'embed-google-map/embed_google_map.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = embed_google_map_page(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/embed_google_map.php  
  1. function embed_google_map_page() { 
  2. screen_icon(); 
  3. ?> 
  4. <div class="wrap"> 
  5. <h2>Embed Google Map Settings</h2> 
  6. <p> 
  7. Embed Google Map is a plugin for embedding one or more Google Maps to WordPress posts and pages. Adding maps is very simple, just add the address or the coordinates which location you want to show an a map inside google_map tags to a post or a page, and that's it! 
  8. </p> 
  9. <p> 
  10. The plugin supports Google Maps, Google Maps Classic and Google Maps Embed API. The version to be used can be set by using the Version setting (supported values: new, classic, embed). Google Maps and Google Maps Classic do not require an API key, but for Google Maps Embed API an API key is required instead. Not all theparametersare supported by all the versions. Please see the supportedparametersbelow. 
  11. </p> 
  12. <p> 
  13. It's possible to define the version of Google Maps, the type of the map (normal, satellite, hybrid, terrain), the size of the map, the language of the Google Maps interface, zoom level, border width, border color, border style, link to the full size map, custom labels and hide/show the info label. Both HTTP and HTTPS protocols are supported. The settings defined in this page are the default settings used for all the maps in the site, and they can be overridden for individual maps. 
  14. </p> 
  15. <form method="post" action="options.php"> 
  16. <?php  
  17. settings_fields('embed_google_map-settings-group'); 
  18. $options = get_option('embed_google_map_options'); 
  19. ?> 
  20. <table class="form-table"> 
  21. <tr valign="top"> 
  22. <th scope="row"><span title="Google Maps version.">Version:</span></th> 
  23. <td> 
  24. <select name="embed_google_map_options[version]"> 
  25. <option value="new" <?php echo ($options['version'] == "new") ? 'selected="selected"' : ''; ?>>Google Maps</option> 
  26. <option value="classic" <?php echo ($options['version'] == "classic") ? 'selected="selected"' : ''; ?>>Google Maps Classic</option> 
  27. <option value="embed" <?php echo ($options['version'] == "embed") ? 'selected="selected"' : ''; ?>>Google Maps Embed API</option> 
  28. </select> 
  29. </td> 
  30. </tr>  
  31. <tr valign="top"> 
  32. <th scope="row"><span title="Map type.">Map type:</span></th> 
  33. <td> 
  34. <select name="embed_google_map_options[map_type]"> 
  35. <option value="m" <?php echo ($options['map_type'] == "m") ? 'selected="selected"' : ''; ?>>Normal map</option> 
  36. <option value="k" <?php echo ($options['map_type'] == "k") ? 'selected="selected"' : ''; ?>>Satellite</option> 
  37. <option value="h" <?php echo ($options['map_type'] == "h") ? 'selected="selected"' : ''; ?>>Hybrid</option> 
  38. <option value="p" <?php echo ($options['map_type'] == "p") ? 'selected="selected"' : ''; ?>>Terrain</option> 
  39. </select> 
  40. </td> 
  41. </tr> 
  42. <tr valign="top"> 
  43. <th scope="row"><span title="Zoom level.">Zoom level:</span></th> 
  44. <td> 
  45. <select name="embed_google_map_options[zoom_level]"> 
  46. <option value="0" <?php echo ($options['zoom_level'] == "0") ? 'selected="selected"' : ''; ?>>0</option> 
  47. <option value="1" <?php echo ($options['zoom_level'] == "1") ? 'selected="selected"' : ''; ?>>1</option> 
  48. <option value="2" <?php echo ($options['zoom_level'] == "2") ? 'selected="selected"' : ''; ?>>2</option> 
  49. <option value="3" <?php echo ($options['zoom_level'] == "3") ? 'selected="selected"' : ''; ?>>3</option> 
  50. <option value="4" <?php echo ($options['zoom_level'] == "4") ? 'selected="selected"' : ''; ?>>4</option> 
  51. <option value="5" <?php echo ($options['zoom_level'] == "5") ? 'selected="selected"' : ''; ?>>5</option> 
  52. <option value="6" <?php echo ($options['zoom_level'] == "6") ? 'selected="selected"' : ''; ?>>6</option> 
  53. <option value="7" <?php echo ($options['zoom_level'] == "7") ? 'selected="selected"' : ''; ?>>7</option> 
  54. <option value="8" <?php echo ($options['zoom_level'] == "8") ? 'selected="selected"' : ''; ?>>8</option> 
  55. <option value="9" <?php echo ($options['zoom_level'] == "9") ? 'selected="selected"' : ''; ?>>9</option> 
  56. <option value="10" <?php echo ($options['zoom_level'] == "10") ? 'selected="selected"' : ''; ?>>10</option> 
  57. <option value="11" <?php echo ($options['zoom_level'] == "11") ? 'selected="selected"' : ''; ?>>11</option> 
  58. <option value="12" <?php echo ($options['zoom_level'] == "12") ? 'selected="selected"' : ''; ?>>12</option> 
  59. <option value="13" <?php echo ($options['zoom_level'] == "13") ? 'selected="selected"' : ''; ?>>13</option> 
  60. <option value="14" <?php echo ($options['zoom_level'] == "14" || !isset($options['zoom_level'])) ? 'selected="selected"' : ''; ?>>14</option> 
  61. <option value="15" <?php echo ($options['zoom_level'] == "15") ? 'selected="selected"' : ''; ?>>15</option> 
  62. <option value="16" <?php echo ($options['zoom_level'] == "16") ? 'selected="selected"' : ''; ?>>16</option> 
  63. <option value="17" <?php echo ($options['zoom_level'] == "17") ? 'selected="selected"' : ''; ?>>17</option> 
  64. <option value="18" <?php echo ($options['zoom_level'] == "18") ? 'selected="selected"' : ''; ?>>18</option> 
  65. <option value="19" <?php echo ($options['zoom_level'] == "29") ? 'selected="selected"' : ''; ?>>19</option> 
  66. <option value="20" <?php echo ($options['zoom_level'] == "20") ? 'selected="selected"' : ''; ?>>20</option> 
  67. <option value="21" <?php echo ($options['zoom_level'] == "21") ? 'selected="selected"' : ''; ?>>21</option>  
  68. </select> 
  69. </td> 
  70. </tr> 
  71. <tr valign="top"> 
  72. <th scope="row"><span title="Language.">Language:</span></th> 
  73. <td> 
  74. <select name="embed_google_map_options[language]"> 
  75. <option value="-">Undefined</option> 
  76. <option value="ar"<?php echo ($options['language'] == "ar") ? 'selected="selected"' : ''; ?>>Arabic</option> 
  77. <option value="eu" <?php echo ($options['language'] == "eu") ? 'selected="selected"' : ''; ?>>Basque</option> 
  78. <option value="bn" <?php echo ($options['language'] == "bn") ? 'selected="selected"' : ''; ?>>Bengali</option> 
  79. <option value="bg" <?php echo ($options['language'] == "bg") ? 'selected="selected"' : ''; ?>>Bulgarian</option> 
  80. <option value="ca" <?php echo ($options['language'] == "ca") ? 'selected="selected"' : ''; ?>>Catalan</option> 
  81. <option value="zh-CN" <?php echo ($options['language'] == "zh-CN") ? 'selected="selected"' : ''; ?>>Chinese (simplified)</option> 
  82. <option value="zh-TW" <?php echo ($options['language'] == "zh-TW") ? 'selected="selected"' : ''; ?>>Chinese (traditional)</option> 
  83. <option value="hr" <?php echo ($options['language'] == "hr") ? 'selected="selected"' : ''; ?>>Croatian</option> 
  84. <option value="cs" <?php echo ($options['language'] == "cs") ? 'selected="selected"' : ''; ?>>Czech</option> 
  85. <option value="da" <?php echo ($options['language'] == "da") ? 'selected="selected"' : ''; ?>>Danish</option> 
  86. <option value="nl" <?php echo ($options['language'] == "nl") ? 'selected="selected"' : ''; ?>>Dutch</option> 
  87. <option value="en" <?php echo ($options['language'] == "en") ? 'selected="selected"' : ''; ?>>English</option> 
  88. <option value="en-AU" <?php echo ($options['language'] == "en-AU") ? 'selected="selected"' : ''; ?>>English (Australian)</option> 
  89. <option value="en-GB" <?php echo ($options['language'] == "en-GB") ? 'selected="selected"' : ''; ?>>English (Great Britain)</option> 
  90. <option value="fa" <?php echo ($options['language'] == "fa") ? 'selected="selected"' : ''; ?>>Farsi</option> 
  91. <option value="fil" <?php echo ($options['language'] == "fil") ? 'selected="selected"' : ''; ?>>Filipino</option> 
  92. <option value="fi" <?php echo ($options['language'] == "fi") ? 'selected="selected"' : ''; ?>>Finnish</option> 
  93. <option value="fr" <?php echo ($options['language'] == "fr") ? 'selected="selected"' : ''; ?>>French</option> 
  94. <option value="gl" <?php echo ($options['language'] == "gl") ? 'selected="selected"' : ''; ?>>Galician</option> 
  95. <option value="de" <?php echo ($options['language'] == "de") ? 'selected="selected"' : ''; ?>>German</option> 
  96. <option value="el" <?php echo ($options['language'] == "el") ? 'selected="selected"' : ''; ?>>Greek</option> 
  97. <option value="gu" <?php echo ($options['language'] == "gu") ? 'selected="selected"' : ''; ?>>Gujarati</option> 
  98. <option value="iw" <?php echo ($options['language'] == "iw") ? 'selected="selected"' : ''; ?>>Hebrew</option> 
  99. <option value="hi" <?php echo ($options['language'] == "hi") ? 'selected="selected"' : ''; ?>>Hindi</option> 
  100. <option value="hu" <?php echo ($options['language'] == "hu") ? 'selected="selected"' : ''; ?>>Hungarian</option> 
  101. <option value="id" <?php echo ($options['language'] == "id") ? 'selected="selected"' : ''; ?>>Indonesian</option> 
  102. <option value="it" <?php echo ($options['language'] == "it") ? 'selected="selected"' : ''; ?>>Italian</option> 
  103. <option value="ja" <?php echo ($options['language'] == "ja") ? 'selected="selected"' : ''; ?>>Japanese</option> 
  104. <option value="kn" <?php echo ($options['language'] == "kn") ? 'selected="selected"' : ''; ?>>Kannada</option> 
  105. <option value="ko" <?php echo ($options['language'] == "ko") ? 'selected="selected"' : ''; ?>>Korean</option> 
  106. <option value="lv" <?php echo ($options['language'] == "lv") ? 'selected="selected"' : ''; ?>>Latvian</option> 
  107. <option value="lt" <?php echo ($options['language'] == "lt") ? 'selected="selected"' : ''; ?>>Lithuanian</option> 
  108. <option value="ml" <?php echo ($options['language'] == "ml") ? 'selected="selected"' : ''; ?>>Malayalam</option> 
  109. <option value="mr" <?php echo ($options['language'] == "mr") ? 'selected="selected"' : ''; ?>>Marathi</option> 
  110. <option value="no" <?php echo ($options['language'] == "no") ? 'selected="selected"' : ''; ?>>Norwegian</option> 
  111. <option value="nn" <?php echo ($options['language'] == "nn") ? 'selected="selected"' : ''; ?>>Norwegian Nynorsk</option> 
  112. <option value="or" <?php echo ($options['language'] == "or") ? 'selected="selected"' : ''; ?>>Oriya</option> 
  113. <option value="pl" <?php echo ($options['language'] == "pl") ? 'selected="selected"' : ''; ?>>Polish</option> 
  114. <option value="pt" <?php echo ($options['language'] == "pt") ? 'selected="selected"' : ''; ?>>Portuguese</option> 
  115. <option value="pt-BR" <?php echo ($options['language'] == "pt-BR") ? 'selected="selected"' : ''; ?>>Portuguese (Brazil)</option> 
  116. <option value="pt-PT" <?php echo ($options['language'] == "pt-PT") ? 'selected="selected"' : ''; ?>>Portuguese (Portugal)</option> 
  117. <option value="ro" <?php echo ($options['language'] == "ro") ? 'selected="selected"' : ''; ?>>Romanian</option> 
  118. <option value="rm" <?php echo ($options['language'] == "rm") ? 'selected="selected"' : ''; ?>>Romansch</option> 
  119. <option value="ru" <?php echo ($options['language'] == "ru") ? 'selected="selected"' : ''; ?>>Russian</option> 
  120. <option value="sk" <?php echo ($options['language'] == "sk") ? 'selected="selected"' : ''; ?>>Slovak</option> 
  121. <option value="sl" <?php echo ($options['language'] == "sl") ? 'selected="selected"' : ''; ?>>Slovenian</option> 
  122. <option value="sr" <?php echo ($options['language'] == "sr") ? 'selected="selected"' : ''; ?>>Serbian</option> 
  123. <option value="es" <?php echo ($options['language'] == "es") ? 'selected="selected"' : ''; ?>>Spanish</option> 
  124. <option value="sv" <?php echo ($options['language'] == "sv") ? 'selected="selected"' : ''; ?>>Swedish</option> 
  125. <option value="tl" <?php echo ($options['language'] == "tl") ? 'selected="selected"' : ''; ?>>Tagalog</option> 
  126. <option value="ta" <?php echo ($options['language'] == "ta") ? 'selected="selected"' : ''; ?>>Tamil</option> 
  127. <option value="te" <?php echo ($options['language'] == "te") ? 'selected="selected"' : ''; ?>>Telugu</option> 
  128. <option value="th" <?php echo ($options['language'] == "th") ? 'selected="selected"' : ''; ?>>Thai</option> 
  129. <option value="tr" <?php echo ($options['language'] == "tr") ? 'selected="selected"' : ''; ?>>Turkish</option> 
  130. <option value="uk" <?php echo ($options['language'] == "uk") ? 'selected="selected"' : ''; ?>>Ukrainian</option> 
  131. <option value="vi" <?php echo ($options['language'] == "vi") ? 'selected="selected"' : ''; ?>>Vietnamese</option> 
  132. </select> 
  133. </td> 
  134. </tr> 
  135. <tr valign="top"> 
  136. <th scope="row"><span title="Add link to Google Maps.">Add link:</span></th> 
  137. <td><input name="embed_google_map_options[add_link]" type="checkbox" value="1" <?php checked('1', $options['add_link']); ?> /></td> 
  138. </tr> 
  139. <tr valign="top"> 
  140. <th scope="row"><span title="Link label.">Link label:</span></th> 
  141. <td><input type="text" name="embed_google_map_options[link_label]" value="<?php echo $options['link_label']; ?>" /></td> 
  142. </tr> 
  143. <tr valign="top"> 
  144. <th scope="row"><span title="Open link in full screen mode.">Link full:</span></th> 
  145. <td><input name="embed_google_map_options[link_full]" type="checkbox" value="1" <?php checked('1', $options['link_full']); ?> /></td> 
  146. </tr>  
  147. <tr valign="top"> 
  148. <th scope="row"><span title="Show info label.">Show info:</span></th> 
  149. <td><input name="embed_google_map_options[show_info]" type="checkbox" value="1" <?php checked('1', $options['show_info']); ?> /></td> 
  150. </tr> 
  151. <tr valign="top"> 
  152. <th scope="row"><span title="Custom info label.">Info label:</span></th> 
  153. <td><input type="text" name="embed_google_map_options[info_label]" value="<?php echo $options['info_label']; ?>" /></td> 
  154. </tr>  
  155. <tr valign="top"> 
  156. <th scope="row"><span title="Default height.">Height:</span></th> 
  157. <td><input type="text" name="embed_google_map_options[height]" value="<?php echo $options['height']; ?>" /></td> 
  158. </tr> 
  159. <tr valign="top"> 
  160. <th scope="row"><span title="Default width.">Width:</span></th> 
  161. <td><input type="text" name="embed_google_map_options[width]" value="<?php echo $options['width']; ?>" /></td> 
  162. </tr> 
  163. <tr valign="top"> 
  164. <th scope="row"><span title="Frame border width.">Border:</span></th> 
  165. <td> 
  166. <select name="embed_google_map_options[border]"> 
  167. <option value="0" <?php echo ($options['border'] == "0") ? 'selected="selected"' : ''; ?>>0</option> 
  168. <option value="1" <?php echo ($options['border'] == "1") ? 'selected="selected"' : ''; ?>>1</option> 
  169. <option value="2" <?php echo ($options['border'] == "2") ? 'selected="selected"' : ''; ?>>2</option> 
  170. <option value="3" <?php echo ($options['border'] == "3") ? 'selected="selected"' : ''; ?>>3</option> 
  171. <option value="4" <?php echo ($options['border'] == "4") ? 'selected="selected"' : ''; ?>>4</option> 
  172. <option value="5" <?php echo ($options['border'] == "5") ? 'selected="selected"' : ''; ?>>5</option> 
  173. <option value="6" <?php echo ($options['border'] == "6") ? 'selected="selected"' : ''; ?>>6</option> 
  174. <option value="7" <?php echo ($options['border'] == "7") ? 'selected="selected"' : ''; ?>>7</option> 
  175. <option value="8" <?php echo ($options['border'] == "8") ? 'selected="selected"' : ''; ?>>8</option> 
  176. <option value="9" <?php echo ($options['border'] == "9") ? 'selected="selected"' : ''; ?>>9</option> 
  177. <option value="10" <?php echo ($options['border'] == "10") ? 'selected="selected"' : ''; ?>>10</option> 
  178. </select> 
  179. </td> 
  180. </tr> 
  181. <tr valign="top"> 
  182. <th scope="row"><span title="Frame border style.">Border style:</span></th> 
  183. <td> 
  184. <select name="embed_google_map_options[border_style]"> 
  185. <option value="none" <?php echo ($options['border_style'] == "none") ? 'selected="selected"' : ''; ?>>None</option> 
  186. <option value="hidden" <?php echo ($options['border_style'] == "hidden") ? 'selected="selected"' : ''; ?>>Hidden</option> 
  187. <option value="dotted" <?php echo ($options['border_style'] == "dotted") ? 'selected="selected"' : ''; ?>>Dotted</option> 
  188. <option value="dashed" <?php echo ($options['border_style'] == "dashed") ? 'selected="selected"' : ''; ?>>Dashed</option> 
  189. <option value="solid" <?php echo ($options['border_style'] == "solid") ? 'selected="selected"' : ''; ?>>Solid</option> 
  190. <option value="double" <?php echo ($options['border_style'] == "double") ? 'selected="selected"' : ''; ?>>Double</option> 
  191. </select> 
  192. </td> 
  193. </tr>  
  194. <tr valign="top"> 
  195. <th scope="row"><span title="Frame border color in hexadecimal format.">Border color:</span></th> 
  196. <td><input type="text" name="embed_google_map_options[border_color]" value="<?php echo $options['border_color']; ?>" /></td> 
  197. </tr>  
  198. <tr valign="top"> 
  199. <th scope="row"><span title="Use HTTPS protocol.">HTTPS:</span></th> 
  200. <td><input name="embed_google_map_options[https]" type="checkbox" value="1" <?php checked('1', $options['https']); ?> /></td> 
  201. </tr>  
  202. <tr valign="top"> 
  203. <th scope="row"><span title="Google Maps Embed API key. Required only when Google Maps Embed API version is used.">Embed API key:</span></th> 
  204. <td><input type="text" name="embed_google_map_options[embed_api_key]" value="<?php echo $options['embed_api_key']; ?>" /></td> 
  205. </tr>  
  206. </table> 
  207. <p class="submit"> 
  208. <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 
  209. </p> 
  210. </form> 
  211.  
  212. <h3>Basic Usage</h3> 
  213. <p>To embed a map in a post or a page use the following code:</p> 
  214. <ul> 
  215. <li>{google_map}address{/google_map}</li> 
  216. </ul> 
  217. <h3>Overriding default settings</h3> 
  218. <p>To override one or more default settings use the following code:</p> 
  219. <ul>  
  220. <li>{google_map}address{/google_map}</li> 
  221. <li>{google_map}address|version:classic{/google_map}</li> 
  222. <li>{google_map}address|zoom:10{/google_map}</li> 
  223. <li>{google_map}address|zoom:10|lang:it{/google_map}</li> 
  224. <li>{google_map}address|width:200|height:200|border:1|border_style:solid|border_color:#000000{/google_map}</li> 
  225. <li>{google_map}address|width:200|height:200|link:yes|link_label:Label{/google_map}</li> 
  226. <li>{google_map}address|link:yes{/google_map}</li> 
  227. <li>{google_map}address|type:satellite{/google_map}</li> 
  228. <li>{google_map}address|show_info:yes|info_label:Label{/google_map}</li> 
  229. <li>{google_map}address|link_full:yes{/google_map}</li> 
  230. <li>{google_map}address|https:yes{/google_map}</li>  
  231. <li><b>*</b>{google_map}latitude, longitude{/google_map}</li> 
  232. </ul> 
  233.  
  234. <p><b>*</b> latitude, longitude = coordinates in decimal degrees</p> 
  235.  
  236. <h3>Google Map Versions</h3> 
  237. <p> 
  238. The plugin supports Google Maps, Google Maps Classic and Google Maps Embed API. The version to be used can be set by using the Version setting (supported values: new, classic, embed). Google Maps and Google Maps Classic do not require an API key, but for Google Maps Embed API an API key is required instead. Not all theparametersare supported by all the versions. Please see the supportedparametersbelow. 
  239. </p> 
  240.  
  241. <h3>Google Maps</h3> 
  242. <ul> 
  243. <li>map type (normal, satellite)</li> 
  244. <li>zoom level</li> 
  245. <li> 
  246. language - By default, visitors will see a map in their own language which is defined by the locale of their browser. The setting takes effect only when a map is opened through the additional link to Google Maps 
  247. </li> 
  248. <li>add link</li> 
  249. <li>link label</li> 
  250. <li>height</li> 
  251. <li>width</li> 
  252. <li>border</li> 
  253. <li>border style</li> 
  254. <li>border color</li> 
  255. <li>HTTPS</li> 
  256. </ul> 
  257.  
  258. <h3>Google Maps Classic</h3> 
  259. <ul> 
  260. <li>map type (normal, satellite, hybrid, terrain)</li> 
  261. <li>zoom level</li> 
  262. <li>language</li> 
  263. <li>add link</li> 
  264. <li>link label</li> 
  265. <li>link to full screen</li> 
  266. <li>show info</li> 
  267. <li>info label</li> 
  268. <li>height</li> 
  269. <li>width</li> 
  270. <li>border</li> 
  271. <li>border style</li> 
  272. <li>border color</li> 
  273. <li>HTTPS</li> 
  274. </ul> 
  275.  
  276. <h3>Google Maps Embed API</h3> 
  277. <ul> 
  278. <li>map type (normal, satellite)</li> 
  279. <li>zoom level</li> 
  280. <li>language</li> 
  281. <li>height</li> 
  282. <li>width</li> 
  283. <li>border</li> 
  284. <li>border style</li> 
  285. <li>border color</li> 
  286. <li>HTTPS</li> 
  287. </ul> 
  288.  
  289. <?php