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. It's possible to define 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. 
  11. </p> 
  12. <form method="post" action="options.php"> 
  13. <?php  
  14. settings_fields('embed_google_map-settings-group'); 
  15. $options = get_option('embed_google_map_options'); 
  16. ?> 
  17. <table class="form-table"> 
  18. <tr valign="top"> 
  19. <th scope="row"><span title="Map type.">Map type:</span></th> 
  20. <td> 
  21. <select name="embed_google_map_options[map_type]"> 
  22. <option value="m" <? echo ($options['map_type'] == "m") ? 'selected="selected"' : ''; ?>>Normal map</option> 
  23. <option value="k" <? echo ($options['map_type'] == "k") ? 'selected="selected"' : ''; ?>>Satellite</option> 
  24. <option value="h" <? echo ($options['map_type'] == "h") ? 'selected="selected"' : ''; ?>>Hybrid</option> 
  25. <option value="p" <? echo ($options['map_type'] == "p") ? 'selected="selected"' : ''; ?>>Terrain</option> 
  26. </select> 
  27. </td> 
  28. </tr> 
  29. <tr valign="top"> 
  30. <th scope="row"><span title="Zoom level.">Zoom level:</span></th> 
  31. <td> 
  32. <select name="embed_google_map_options[zoom_level]"> 
  33. <option value="0" <? echo ($options['zoom_level'] == "0") ? 'selected="selected"' : ''; ?>>0</option> 
  34. <option value="1" <? echo ($options['zoom_level'] == "1") ? 'selected="selected"' : ''; ?>>1</option> 
  35. <option value="2" <? echo ($options['zoom_level'] == "2") ? 'selected="selected"' : ''; ?>>2</option> 
  36. <option value="3" <? echo ($options['zoom_level'] == "3") ? 'selected="selected"' : ''; ?>>3</option> 
  37. <option value="4" <? echo ($options['zoom_level'] == "4") ? 'selected="selected"' : ''; ?>>4</option> 
  38. <option value="5" <? echo ($options['zoom_level'] == "5") ? 'selected="selected"' : ''; ?>>5</option> 
  39. <option value="6" <? echo ($options['zoom_level'] == "6") ? 'selected="selected"' : ''; ?>>6</option> 
  40. <option value="7" <? echo ($options['zoom_level'] == "7") ? 'selected="selected"' : ''; ?>>7</option> 
  41. <option value="8" <? echo ($options['zoom_level'] == "8") ? 'selected="selected"' : ''; ?>>8</option> 
  42. <option value="9" <? echo ($options['zoom_level'] == "9") ? 'selected="selected"' : ''; ?>>9</option> 
  43. <option value="10" <? echo ($options['zoom_level'] == "10") ? 'selected="selected"' : ''; ?>>10</option> 
  44. <option value="11" <? echo ($options['zoom_level'] == "11") ? 'selected="selected"' : ''; ?>>11</option> 
  45. <option value="12" <? echo ($options['zoom_level'] == "12") ? 'selected="selected"' : ''; ?>>12</option> 
  46. <option value="13" <? echo ($options['zoom_level'] == "13") ? 'selected="selected"' : ''; ?>>13</option> 
  47. <option value="14" <? echo ($options['zoom_level'] == "14" || !isset($options['zoom_level'])) ? 'selected="selected"' : ''; ?>>14</option> 
  48. <option value="15" <? echo ($options['zoom_level'] == "15") ? 'selected="selected"' : ''; ?>>15</option> 
  49. <option value="16" <? echo ($options['zoom_level'] == "16") ? 'selected="selected"' : ''; ?>>16</option> 
  50. <option value="17" <? echo ($options['zoom_level'] == "17") ? 'selected="selected"' : ''; ?>>17</option> 
  51. <option value="18" <? echo ($options['zoom_level'] == "18") ? 'selected="selected"' : ''; ?>>18</option> 
  52. <option value="19" <? echo ($options['zoom_level'] == "29") ? 'selected="selected"' : ''; ?>>19</option> 
  53. <option value="20" <? echo ($options['zoom_level'] == "20") ? 'selected="selected"' : ''; ?>>20</option> 
  54. <option value="21" <? echo ($options['zoom_level'] == "21") ? 'selected="selected"' : ''; ?>>21</option>  
  55. </select> 
  56. </td> 
  57. </tr> 
  58. <tr valign="top"> 
  59. <th scope="row"><span title="Language.">Language:</span></th> 
  60. <td> 
  61. <select name="embed_google_map_options[language]"> 
  62. <option value="-">Undefined</option> 
  63. <option value="ar"<? echo ($options['language'] == "ar") ? 'selected="selected"' : ''; ?>>Arabic</option> 
  64. <option value="eu" <? echo ($options['language'] == "eu") ? 'selected="selected"' : ''; ?>>Basque</option> 
  65. <option value="bn" <? echo ($options['language'] == "bn") ? 'selected="selected"' : ''; ?>>Bengali</option> 
  66. <option value="bg" <? echo ($options['language'] == "bg") ? 'selected="selected"' : ''; ?>>Bulgarian</option> 
  67. <option value="ca" <? echo ($options['language'] == "ca") ? 'selected="selected"' : ''; ?>>Catalan</option> 
  68. <option value="zh-CN" <? echo ($options['language'] == "zh-CN") ? 'selected="selected"' : ''; ?>>Chinese (simplified)</option> 
  69. <option value="zh-TW" <? echo ($options['language'] == "zh-TW") ? 'selected="selected"' : ''; ?>>Chinese (traditional)</option> 
  70. <option value="hr" <? echo ($options['language'] == "hr") ? 'selected="selected"' : ''; ?>>Croatian</option> 
  71. <option value="cs" <? echo ($options['language'] == "cs") ? 'selected="selected"' : ''; ?>>Czech</option> 
  72. <option value="da" <? echo ($options['language'] == "da") ? 'selected="selected"' : ''; ?>>Danish</option> 
  73. <option value="nl" <? echo ($options['language'] == "nl") ? 'selected="selected"' : ''; ?>>Dutch</option> 
  74. <option value="en" <? echo ($options['language'] == "en") ? 'selected="selected"' : ''; ?>>English</option> 
  75. <option value="en-AU" <? echo ($options['language'] == "en-AU") ? 'selected="selected"' : ''; ?>>English (Australian)</option> 
  76. <option value="en-GB" <? echo ($options['language'] == "en-GB") ? 'selected="selected"' : ''; ?>>English (Great Britain)</option> 
  77. <option value="fa" <? echo ($options['language'] == "fa") ? 'selected="selected"' : ''; ?>>Farsi</option> 
  78. <option value="fil" <? echo ($options['language'] == "fil") ? 'selected="selected"' : ''; ?>>Filipino</option> 
  79. <option value="fi" <? echo ($options['language'] == "fi") ? 'selected="selected"' : ''; ?>>Finnish</option> 
  80. <option value="fr" <? echo ($options['language'] == "fr") ? 'selected="selected"' : ''; ?>>French</option> 
  81. <option value="gl" <? echo ($options['language'] == "gl") ? 'selected="selected"' : ''; ?>>Galician</option> 
  82. <option value="de" <? echo ($options['language'] == "de") ? 'selected="selected"' : ''; ?>>German</option> 
  83. <option value="el" <? echo ($options['language'] == "el") ? 'selected="selected"' : ''; ?>>Greek</option> 
  84. <option value="gu" <? echo ($options['language'] == "gu") ? 'selected="selected"' : ''; ?>>Gujarati</option> 
  85. <option value="iw" <? echo ($options['language'] == "iw") ? 'selected="selected"' : ''; ?>>Hebrew</option> 
  86. <option value="hi" <? echo ($options['language'] == "hi") ? 'selected="selected"' : ''; ?>>Hindi</option> 
  87. <option value="hu" <? echo ($options['language'] == "hu") ? 'selected="selected"' : ''; ?>>Hungarian</option> 
  88. <option value="id" <? echo ($options['language'] == "id") ? 'selected="selected"' : ''; ?>>Indonesian</option> 
  89. <option value="it" <? echo ($options['language'] == "it") ? 'selected="selected"' : ''; ?>>Italian</option> 
  90. <option value="ja" <? echo ($options['language'] == "ja") ? 'selected="selected"' : ''; ?>>Japanese</option> 
  91. <option value="kn" <? echo ($options['language'] == "kn") ? 'selected="selected"' : ''; ?>>Kannada</option> 
  92. <option value="ko" <? echo ($options['language'] == "ko") ? 'selected="selected"' : ''; ?>>Korean</option> 
  93. <option value="lv" <? echo ($options['language'] == "lv") ? 'selected="selected"' : ''; ?>>Latvian</option> 
  94. <option value="lt" <? echo ($options['language'] == "lt") ? 'selected="selected"' : ''; ?>>Lithuanian</option> 
  95. <option value="ml" <? echo ($options['language'] == "ml") ? 'selected="selected"' : ''; ?>>Malayalam</option> 
  96. <option value="mr" <? echo ($options['language'] == "mr") ? 'selected="selected"' : ''; ?>>Marathi</option> 
  97. <option value="no" <? echo ($options['language'] == "no") ? 'selected="selected"' : ''; ?>>Norwegian</option> 
  98. <option value="nn" <? echo ($options['language'] == "nn") ? 'selected="selected"' : ''; ?>>Norwegian Nynorsk</option> 
  99. <option value="or" <? echo ($options['language'] == "or") ? 'selected="selected"' : ''; ?>>Oriya</option> 
  100. <option value="pl" <? echo ($options['language'] == "pl") ? 'selected="selected"' : ''; ?>>Polish</option> 
  101. <option value="pt" <? echo ($options['language'] == "pt") ? 'selected="selected"' : ''; ?>>Portuguese</option> 
  102. <option value="pt-BR" <? echo ($options['language'] == "pt-BR") ? 'selected="selected"' : ''; ?>>Portuguese (Brazil)</option> 
  103. <option value="pt-PT" <? echo ($options['language'] == "pt-PT") ? 'selected="selected"' : ''; ?>>Portuguese (Portugal)</option> 
  104. <option value="ro" <? echo ($options['language'] == "ro") ? 'selected="selected"' : ''; ?>>Romanian</option> 
  105. <option value="rm" <? echo ($options['language'] == "rm") ? 'selected="selected"' : ''; ?>>Romansch</option> 
  106. <option value="ru" <? echo ($options['language'] == "ru") ? 'selected="selected"' : ''; ?>>Russian</option> 
  107. <option value="sk" <? echo ($options['language'] == "sk") ? 'selected="selected"' : ''; ?>>Slovak</option> 
  108. <option value="sl" <? echo ($options['language'] == "sl") ? 'selected="selected"' : ''; ?>>Slovenian</option> 
  109. <option value="sr" <? echo ($options['language'] == "sr") ? 'selected="selected"' : ''; ?>>Serbian</option> 
  110. <option value="es" <? echo ($options['language'] == "es") ? 'selected="selected"' : ''; ?>>Spanish</option> 
  111. <option value="sv" <? echo ($options['language'] == "sv") ? 'selected="selected"' : ''; ?>>Swedish</option> 
  112. <option value="tl" <? echo ($options['language'] == "tl") ? 'selected="selected"' : ''; ?>>Tagalog</option> 
  113. <option value="ta" <? echo ($options['language'] == "ta") ? 'selected="selected"' : ''; ?>>Tamil</option> 
  114. <option value="te" <? echo ($options['language'] == "te") ? 'selected="selected"' : ''; ?>>Telugu</option> 
  115. <option value="th" <? echo ($options['language'] == "th") ? 'selected="selected"' : ''; ?>>Thai</option> 
  116. <option value="tr" <? echo ($options['language'] == "tr") ? 'selected="selected"' : ''; ?>>Turkish</option> 
  117. <option value="uk" <? echo ($options['language'] == "uk") ? 'selected="selected"' : ''; ?>>Ukrainian</option> 
  118. <option value="vi" <? echo ($options['language'] == "vi") ? 'selected="selected"' : ''; ?>>Vietnamese</option> 
  119. </select> 
  120. </td> 
  121. </tr> 
  122. <tr valign="top"> 
  123. <th scope="row"><span title="Add link to Google Maps.">Add link:</span></th> 
  124. <td><input name="embed_google_map_options[add_link]" type="checkbox" value="1" <?php checked('1', $options['add_link']); ?> /></td> 
  125. </tr> 
  126. <tr valign="top"> 
  127. <th scope="row"><span title="Link label.">Link label:</span></th> 
  128. <td><input type="text" name="embed_google_map_options[link_label]" value="<?php echo $options['link_label']; ?>" /></td> 
  129. </tr> 
  130. <tr valign="top"> 
  131. <th scope="row"><span title="Open link in full screen mode.">Link full:</span></th> 
  132. <td><input name="embed_google_map_options[link_full]" type="checkbox" value="1" <?php checked('1', $options['link_full']); ?> /></td> 
  133. </tr>  
  134. <tr valign="top"> 
  135. <th scope="row"><span title="Show info label.">Show info:</span></th> 
  136. <td><input name="embed_google_map_options[show_info]" type="checkbox" value="1" <?php checked('1', $options['show_info']); ?> /></td> 
  137. </tr> 
  138. <tr valign="top"> 
  139. <th scope="row"><span title="Custom info label.">Info label:</span></th> 
  140. <td><input type="text" name="embed_google_map_options[info_label]" value="<?php echo $options['info_label']; ?>" /></td> 
  141. </tr>  
  142. <tr valign="top"> 
  143. <th scope="row"><span title="Default height.">Height:</span></th> 
  144. <td><input type="text" name="embed_google_map_options[height]" value="<?php echo $options['height']; ?>" /></td> 
  145. </tr> 
  146. <tr valign="top"> 
  147. <th scope="row"><span title="Default width.">Width:</span></th> 
  148. <td><input type="text" name="embed_google_map_options[width]" value="<?php echo $options['width']; ?>" /></td> 
  149. </tr> 
  150. <tr valign="top"> 
  151. <th scope="row"><span title="Frame border width.">Border:</span></th> 
  152. <td> 
  153. <select name="embed_google_map_options[border]"> 
  154. <option value="0" <? echo ($options['border'] == "0") ? 'selected="selected"' : ''; ?>>0</option> 
  155. <option value="1" <? echo ($options['border'] == "1") ? 'selected="selected"' : ''; ?>>1</option> 
  156. <option value="2" <? echo ($options['border'] == "2") ? 'selected="selected"' : ''; ?>>2</option> 
  157. <option value="3" <? echo ($options['border'] == "3") ? 'selected="selected"' : ''; ?>>3</option> 
  158. <option value="4" <? echo ($options['border'] == "4") ? 'selected="selected"' : ''; ?>>4</option> 
  159. <option value="5" <? echo ($options['border'] == "5") ? 'selected="selected"' : ''; ?>>5</option> 
  160. <option value="6" <? echo ($options['border'] == "6") ? 'selected="selected"' : ''; ?>>6</option> 
  161. <option value="7" <? echo ($options['border'] == "7") ? 'selected="selected"' : ''; ?>>7</option> 
  162. <option value="8" <? echo ($options['border'] == "8") ? 'selected="selected"' : ''; ?>>8</option> 
  163. <option value="9" <? echo ($options['border'] == "9") ? 'selected="selected"' : ''; ?>>9</option> 
  164. <option value="10" <? echo ($options['border'] == "10") ? 'selected="selected"' : ''; ?>>10</option> 
  165. </select> 
  166. </td> 
  167. </tr> 
  168. <tr valign="top"> 
  169. <th scope="row"><span title="Frame border style.">Border style:</span></th> 
  170. <td> 
  171. <select name="embed_google_map_options[border_style]"> 
  172. <option value="none" <? echo ($options['border_style'] == "none") ? 'selected="selected"' : ''; ?>>None</option> 
  173. <option value="hidden" <? echo ($options['border_style'] == "hidden") ? 'selected="selected"' : ''; ?>>Hidden</option> 
  174. <option value="dotted" <? echo ($options['border_style'] == "dotted") ? 'selected="selected"' : ''; ?>>Dotted</option> 
  175. <option value="dashed" <? echo ($options['border_style'] == "dashed") ? 'selected="selected"' : ''; ?>>Dashed</option> 
  176. <option value="solid" <? echo ($options['border_style'] == "solid") ? 'selected="selected"' : ''; ?>>Solid</option> 
  177. <option value="double" <? echo ($options['border_style'] == "double") ? 'selected="selected"' : ''; ?>>Double</option> 
  178. </select> 
  179. </td> 
  180. </tr>  
  181. <tr valign="top"> 
  182. <th scope="row"><span title="Frame border color in hexadecimal format.">Border color:</span></th> 
  183. <td><input type="text" name="embed_google_map_options[border_color]" value="<?php echo $options['border_color']; ?>" /></td> 
  184. </tr>  
  185. <tr valign="top"> 
  186. <th scope="row"><span title="Use HTTPS protocol.">HTTPS:</span></th> 
  187. <td><input name="embed_google_map_options[https]" type="checkbox" value="1" <?php checked('1', $options['https']); ?> /></td> 
  188. </tr>  
  189. </table> 
  190. <p class="submit"> 
  191. <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 
  192. </p> 
  193. </form> 
  194.  
  195. <h3>Basic Usage</h3> 
  196. <p>To embed a map in a post or a page use the following code:</p> 
  197. <ul> 
  198. <li>{google_map}address{/google_map}</li> 
  199. </ul> 
  200. <h3>Overriding default settings</h3> 
  201. <p>To override one or more default settings use the following code:</p> 
  202. <ul>  
  203. <li>{google_map}address{/google_map}</li> 
  204. <li>{google_map}address|zoom:10{/google_map}</li> 
  205. <li>{google_map}address|zoom:10|lang:it{/google_map}</li> 
  206. <li>{google_map}address|width:200|height:200|border:1|border_style:solid|border_color:#000000{/google_map}</li> 
  207. <li>{google_map}address|width:200|height:200|link:yes|link_label:Label{/google_map}</li> 
  208. <li>{google_map}address|link:yes{/google_map}</li> 
  209. <li>{google_map}address|type:satellite{/google_map}</li> 
  210. <li>{google_map}address|show_info:yes|info_label:Label{/google_map}</li> 
  211. <li>{google_map}address|link_full:yes{/google_map}</li> 
  212. <li>{google_map}address|https:yes{/google_map}</li>  
  213. <li><b>*</b>{google_map}latitude, longitude{/google_map}</li> 
  214. </ul> 
  215.  
  216. <p><b>*</b> latitude, longitude = coordinates in decimal degrees</p> 
  217. <?