├── 404.php ├── LICENSE ├── README.md ├── archive.php ├── comments.php ├── content-embed.php ├── content-featured.php ├── content-map-group.php ├── content-map.php ├── content-marker-bubble.php ├── content-share.php ├── css ├── base.css ├── dashicons.css ├── lsf.css ├── main.css ├── main.less └── skeleton.css ├── fonts ├── LigatureSymbols-2.11.eot ├── LigatureSymbols-2.11.otf ├── LigatureSymbols-2.11.svg ├── LigatureSymbols-2.11.ttf ├── LigatureSymbols-2.11.woff ├── jeoicons.eot ├── jeoicons.svg ├── jeoicons.ttf └── jeoicons.woff ├── footer.php ├── functions.php ├── header.php ├── img ├── light.png ├── marker.png ├── marker_active.png ├── marker_small.png └── marker_small_active.png ├── inc ├── admin │ ├── admin-page-framework.php │ └── settings.php ├── api.php ├── core.php ├── css │ ├── embed.css │ ├── jeo.css │ ├── marker-icons.css │ ├── range-slider.css │ └── share-widget.css ├── embed.php ├── featured.php ├── img │ ├── fullscreen-button.png │ └── widget-sprite.png ├── js │ ├── filter-layers.js │ ├── fullscreen.js │ ├── geocode.box.js │ ├── geocode.js │ ├── groups.js │ ├── hash.js │ ├── jeo.js │ ├── marker-icons.js │ ├── markers.js │ ├── range-slider.js │ ├── share-widget.js │ ├── streetview.js │ └── ui.js ├── layers.php ├── marker-icons.php ├── markers.php ├── range-slider.php ├── share-widget.php ├── streetview.php ├── ui.php └── wp-api.php ├── index.php ├── js └── site.js ├── languages ├── es_ES.mo ├── es_ES.po ├── it_IT.mo ├── it_IT.po ├── pt_BR.mo └── pt_BR.po ├── lib ├── cartodb.css ├── cartodb.js ├── cartodb.mod.torque.js ├── chosen.jquery.min.js ├── d3.v2.min.js ├── jquery.imagesloaded.min.js ├── jquery.isotope.min.js ├── jquery.mousewheel.js ├── knockout-3.2.0.js ├── leaflet │ ├── MarkerCluster.Default.css │ ├── MarkerCluster.Default.ie.css │ ├── MarkerCluster.css │ ├── images │ │ ├── layers-2x.png │ │ ├── layers.png │ │ ├── marker-icon-2x.png │ │ ├── marker-icon.png │ │ └── marker-shadow.png │ ├── leaflet-src.js │ ├── leaflet.css │ ├── leaflet.ie.css │ ├── leaflet.js │ ├── leaflet.markercluster-src.js │ └── leaflet.markercluster.js ├── mapbox.css ├── mapbox.js ├── mapbox │ ├── images │ │ ├── icons-000000@2x.png │ │ ├── icons-ffffff@2x.png │ │ ├── icons.svg │ │ ├── images │ │ │ ├── layers-2x.png │ │ │ ├── layers.png │ │ │ ├── marker-icon-2x.png │ │ │ ├── marker-icon.png │ │ │ └── marker-shadow.png │ │ └── render.sh │ ├── mapbox.css │ ├── mapbox.ie.css │ ├── mapbox.js │ ├── mapbox.standalone.css │ └── mapbox.standalone.js ├── moment.js ├── moment.pt.js ├── range-slider │ ├── css │ │ ├── classic-min.css │ │ ├── classic.css │ │ └── icons-classic │ │ │ ├── label.png │ │ │ ├── resultset_next.png │ │ │ └── resultset_previous.png │ ├── jQAllRangeSliders-min.js │ └── jQAllRangeSliders-withRuler-min.js └── underscore-min.js ├── loop.php ├── metaboxes ├── images │ └── sort.gif ├── map-relation │ └── map-relation.php ├── mapbox │ ├── mapbox.css │ ├── mapbox.js │ └── mapbox.php ├── mapgroup │ ├── mapgroup.css │ ├── mapgroup.js │ └── mapgroup.php └── metaboxes.php ├── page.php ├── screenshot.png ├── search.php ├── searchform.php ├── single-map.php ├── single.php └── style.css /404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |
6 |
7 |

8 |
9 |
10 |
11 |
12 |
13 |

14 | 15 |
16 |
17 | 22 |
23 |
24 |
25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This file is part of JEO. 2 | 3 | JEO is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | JEO is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with JEO. If not, see . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #JEO 2 | v1.0.8 3 | 4 | JEO WordPress Theme acts as a geojournalism platform which allows news organizations, bloggers and NGOs to publish news stories as layers of information on digital maps. With JEO, creating the interaction between data layers and contextual information is much more intuitive and interactive. The theme is ready for multilingual content and facilitates the publishing tasks. 5 | 6 | You can post geotagged stories and create richly designed pages for each one of the featured stories. At same time, by simply imputing the ids of layers hosted on MapBox, you can manage sophisticated maps without loosing perfomance, add legends directly with HTML and set the map paramethers. All direct at the WordPress dashboard. 7 | 8 | JEO wants to help journalists and NGOs to improve storytelling with maps. Creating a child theme with all its functionality is easy since it contains all the necessary hooks to customize layouts and data visualization. 9 | 10 | ## Mix and visualize your custom maps with WordPress 11 | Download the file and upload to your `wp-content/themes/` directory, on your [self-hosted WordPress installation](http://codex.wordpress.org/WordPress_Quick_Start_Guide). 12 | 13 | Or you can use git: 14 | 15 | ``` 16 | $ cd wp-content/themes 17 | $ git clone git://github.com/cardume/jeo.git 18 | ``` 19 | 20 | After setting the files, go to **Appearance > Themes** and activate **JEO**. 21 | 22 | ## Features 23 | - Leaflet map library 24 | - Custom tile layers 25 | - [MapBox](http://mapbox.com) maps 26 | - [CartoDB](http://cartodb.com) maps 27 | - Layer filtering options, allowing you to mix tile layer, MapBox and CartoDB. 28 | - Geocoding WordPress posts using OpenStreetMaps or Google Maps supporting custom post types. 29 | - Google Street View support for Google Maps geocoding. 30 | - Customizable marker icons that can be associated to categories, custom taxonomies or posts directly. 31 | - Map markers query integrated to posts query. 32 | - GeoJSON API (any content `/?geojson` gives the geojson output). *E.g.: yourwebsite.com/category/one/?geojson* 33 | - Support [qTranslate](http://wordpress.org/extend/plugins/qtranslate/) multilanguage plugin 34 | 35 | ## Wiki 36 | 37 | Checkout our [wiki](https://github.com/oeco/jeo/wiki) for tutorials and detailed developer documentation. 38 | 39 | ## Using JEO 40 | 41 | ### First map 42 | After activating your theme, you'll see a big message on your homepage to create your first map. Do it! You can start by selecting one of our presetted open layers, or already add custom layers if you have any. 43 | 44 | ### Settings and contents 45 | After setting your first map, go to the bottom of your dashboard's menu and click on JEO Settings to change website styles, map behaviours and basic settings to set it up the way you need it. 46 | 47 | Now you can go manage your posts, geolocate them and add custom marker icons! 48 | 49 | ### Authors and Contributors 50 | 51 | JEO is a collaboration between [@oeco](https://github.com/oeco/), [@cardume](https://github.com/cardume/), [@memelab](https://github.com/memelab/) and [@icfjknight](https://github.com/icfjknight/). Developed after the theme was built for [InfoAmazonia](http://infoamazonia.org/) and supported by [Internew´s Earth Journalism Network ](http://www.earthjournalism.net/). 52 | 53 | ### Support or Contact 54 | Having trouble with JEO? Go to our [issues page](https://github.com/oeco/jeo/issues) and we'll help you there! 55 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 |
8 |

21 |
22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /comments.php: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | 8 | 9 |

10 | 14 |

15 | 16 |
    17 | 'ol', 20 | 'short_ping' => true, 21 | 'avatar_size' => 60, 22 | 'callback' => 'jeo_comment' 23 | ) ); 24 | ?> 25 |
26 | 27 | 1 && get_option( 'page_comments' ) ) : 30 | ?> 31 | 36 | 37 | 38 | 39 |

40 | 41 | 42 | 43 | 44 | 45 | 46 |
-------------------------------------------------------------------------------- /content-embed.php: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 4 | <?php 5 | global $page, $paged; 6 | 7 | wp_title( '|', true, 'right' ); 8 | 9 | bloginfo( 'name' ); 10 | 11 | $site_description = get_bloginfo('description', 'display'); 12 | if ( $site_description && ( is_home() || is_front_page() ) ) 13 | echo " | $site_description"; 14 | 15 | if ( $paged >= 2 || $page >= 2 ) 16 | echo ' | ' . __('Page', 'jeo') . max($paged, $page); 17 | 18 | ?> 19 | 20 | 21 | 22 | 23 | 24 | 25 | > 26 | 27 | 28 | 29 |
30 |

 

31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /content-featured.php: -------------------------------------------------------------------------------- 1 | 1, 'posts_per_page' => 4)); ?> 2 | 3 | 49 | 52 | 53 | -------------------------------------------------------------------------------- /content-map-group.php: -------------------------------------------------------------------------------- 1 | 12 |
13 |
14 |
15 |
    16 | 21 |
  • 22 | 25 | 26 |
  • 27 | 28 |
      29 | 33 |
    • 34 | 37 |
    • 38 |
    39 |
  • 40 | 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /content-map.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 | 7 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /content-marker-bubble.php: -------------------------------------------------------------------------------- 1 | 6 | 7 |

-------------------------------------------------------------------------------- /content-share.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | ID) == 'map') 9 | $page_title = __('Share', 'jeo') . ' ' . get_the_title($map->ID); 10 | else 11 | $map = false; 12 | } 13 | 14 | // All maps 15 | $maps = get_posts(array('post_type' => 'map', 'posts_per_page' => -1)); 16 | 17 | // Single map 18 | if(!$map && count($maps) <= 1) { 19 | $map = array_shift($maps); 20 | $page_title = __('Share the map', 'jeo'); 21 | } 22 | 23 | // check for layer count 24 | 25 | $allow_layers = true; 26 | $layers = false; 27 | 28 | if($allow_layers) { 29 | if(isset($_GET['layers'])) { 30 | $layers = explode(',', $_GET['layers']); 31 | } elseif($map) { 32 | $layers = jeo_get_map_layers($map->ID); 33 | if(count($layers) <= 1) { 34 | $layers = false; 35 | } 36 | } 37 | } 38 | 39 | // post 40 | $post_id = false; 41 | if(isset($_GET['p'])) 42 | $post_id = $_GET['p']; 43 | 44 | // share url 45 | if($post_id) { 46 | $share_url = jeo_get_share_url(array('p' => $post_id)); 47 | } else { 48 | $share_url = jeo_get_share_url(); 49 | } 50 | ?> 51 | 52 |
53 | 60 |
61 |
62 |
63 | 1 || ($map && $layers)) : 66 | ?> 67 |
68 |
69 | 70 |

71 | 72 | 73 | ? 74 | 75 | 76 | 77 | 78 |

79 |
80 | 85 | 86 | 87 | 88 |
89 | 90 | ID; ?> 91 |

92 | 93 | 94 | 95 | 96 | 97 | 98 | ? 99 | 100 | 101 | 102 | 103 |

104 |
105 | 106 | 117 | 118 | 119 | 1) : ?> 120 |

121 | 122 |
123 | 124 |

 

125 | 126 |

127 | 128 |
129 |
130 | 131 | 132 | 135 | 136 |
137 |
138 |

139 | 140 | 141 | ? 142 | 143 | 144 | 145 | 146 |

147 |
148 | 178 |
179 |
180 |
181 | 182 |
183 |
184 |

185 | 186 | 187 | ? 188 | 189 | 190 | 191 | 192 |

193 |
    194 |
  • 195 |
  • 196 |
  • 197 |
198 |
199 |
200 | 201 |
202 |
203 |

204 | 206 | 207 | 208 | ? 209 | 210 | 211 | 212 | 213 |

214 | 215 |
216 |
217 | 219 | 220 | 221 | ? 222 | 223 | 224 | 225 | 226 |
227 | 228 |
229 |
230 |
231 | 232 | 251 | 252 |
253 |
254 | 255 |
256 |
257 |

258 |
259 |
260 |
261 |
262 | 263 |
264 |
265 | 266 |
267 |
268 | 269 | 274 | 275 | -------------------------------------------------------------------------------- /css/base.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skeleton V1.2 3 | * Copyright 2011, Dave Gamache 4 | * www.getskeleton.com 5 | * Free to use under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 6/20/2012 8 | */ 9 | 10 | 11 | /* Table of Content 12 | ================================================== 13 | #Reset & Basics 14 | #Basic Styles 15 | #Site Styles 16 | #Typography 17 | #Links 18 | #Lists 19 | #Images 20 | #Buttons 21 | #Forms 22 | #Misc */ 23 | 24 | 25 | /* #Reset & Basics (Inspired by E. Meyers) 26 | ================================================== */ 27 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { 28 | margin: 0; 29 | padding: 0; 30 | border: 0; 31 | font-size: 100%; 32 | font: inherit; 33 | vertical-align: baseline; } 34 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { 35 | display: block; } 36 | body { 37 | line-height: 1; } 38 | ol, ul { 39 | list-style: none; } 40 | blockquote, q { 41 | quotes: none; } 42 | blockquote:before, blockquote:after, 43 | q:before, q:after { 44 | content: ''; 45 | content: none; } 46 | table { 47 | border-collapse: collapse; 48 | border-spacing: 0; } 49 | 50 | 51 | /* #Basic Styles 52 | ================================================== */ 53 | body { 54 | background: #fff; 55 | font: 14px/21px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 56 | color: #444; 57 | -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ 58 | -webkit-text-size-adjust: 100%; 59 | } 60 | 61 | 62 | /* #Typography 63 | ================================================== */ 64 | h1, h2, h3, h4, h5, h6 { 65 | color: #181818; 66 | font-family: "Georgia", "Times New Roman", serif; 67 | font-weight: normal; } 68 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-weight: inherit; } 69 | h1 { font-size: 46px; line-height: 50px; margin-bottom: 14px;} 70 | h2 { font-size: 35px; line-height: 40px; margin-bottom: 10px; } 71 | h3 { font-size: 28px; line-height: 34px; margin-bottom: 8px; } 72 | h4 { font-size: 21px; line-height: 30px; margin-bottom: 4px; } 73 | h5 { font-size: 17px; line-height: 24px; } 74 | h6 { font-size: 14px; line-height: 21px; } 75 | .subheader { color: #777; } 76 | 77 | p { margin: 0 0 20px 0; } 78 | p img { margin: 0; } 79 | p.lead { font-size: 21px; line-height: 27px; color: #777; } 80 | 81 | em { font-style: italic; } 82 | strong { font-weight: bold; color: #333; } 83 | small { font-size: 80%; } 84 | 85 | /* Blockquotes */ 86 | blockquote, blockquote p { font-size: 17px; line-height: 24px; color: #777; font-style: italic; } 87 | blockquote { margin: 0 0 20px; padding: 9px 20px 0 19px; border-left: 1px solid #ddd; } 88 | blockquote cite { display: block; font-size: 12px; color: #555; } 89 | blockquote cite:before { content: "\2014 \0020"; } 90 | blockquote cite a, blockquote cite a:visited, blockquote cite a:visited { color: #555; } 91 | 92 | hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px; height: 0; } 93 | 94 | 95 | /* #Links 96 | ================================================== */ 97 | a, a:visited { color: #333; text-decoration: underline; outline: 0; } 98 | a:hover, a:focus { color: #000; } 99 | p a, p a:visited { line-height: inherit; } 100 | 101 | 102 | /* #Lists 103 | ================================================== */ 104 | ul, ol { margin-bottom: 20px; } 105 | ul { list-style: none outside; } 106 | ol { list-style: decimal; } 107 | ol, ul.square, ul.circle, ul.disc { margin-left: 30px; } 108 | ul.square { list-style: square outside; } 109 | ul.circle { list-style: circle outside; } 110 | ul.disc { list-style: disc outside; } 111 | ul ul, ul ol, 112 | ol ol, ol ul { margin: 4px 0 5px 30px; font-size: 90%; } 113 | ul ul li, ul ol li, 114 | ol ol li, ol ul li { margin-bottom: 6px; } 115 | li { line-height: 18px; margin-bottom: 12px; } 116 | ul.large li { line-height: 21px; } 117 | li p { line-height: 21px; } 118 | 119 | /* #Images 120 | ================================================== */ 121 | 122 | img.scale-with-grid { 123 | max-width: 100%; 124 | height: auto; } 125 | 126 | 127 | /* #Forms 128 | ================================================== */ 129 | 130 | form { 131 | margin-bottom: 20px; } 132 | fieldset { 133 | margin-bottom: 20px; } 134 | input[type="text"], 135 | input[type="password"], 136 | input[type="email"], 137 | textarea, 138 | select { 139 | border: 1px solid #ccc; 140 | padding: 6px 4px; 141 | outline: none; 142 | -moz-border-radius: 2px; 143 | -webkit-border-radius: 2px; 144 | border-radius: 2px; 145 | font: 13px "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; 146 | color: #777; 147 | margin: 0; 148 | width: 210px; 149 | max-width: 100%; 150 | display: block; 151 | margin-bottom: 20px; 152 | background: #fff; } 153 | select { 154 | padding: 0; } 155 | input[type="text"]:focus, 156 | input[type="password"]:focus, 157 | input[type="email"]:focus, 158 | textarea:focus { 159 | border: 1px solid #aaa; 160 | color: #444; 161 | -moz-box-shadow: 0 0 3px rgba(0,0,0,.2); 162 | -webkit-box-shadow: 0 0 3px rgba(0,0,0,.2); 163 | box-shadow: 0 0 3px rgba(0,0,0,.2); } 164 | textarea { 165 | min-height: 60px; } 166 | label, 167 | legend { 168 | display: block; 169 | font-weight: bold; 170 | font-size: 13px; } 171 | select { 172 | width: 220px; } 173 | input[type="checkbox"] { 174 | display: inline; } 175 | label span, 176 | legend span { 177 | font-weight: normal; 178 | font-size: 13px; 179 | color: #444; } 180 | 181 | /* #Misc 182 | ================================================== */ 183 | .remove-bottom { margin-bottom: 0 !important; } 184 | .half-bottom { margin-bottom: 10px !important; } 185 | .add-bottom { margin-bottom: 20px !important; } 186 | 187 | 188 | -------------------------------------------------------------------------------- /css/dashicons.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'jeo-dashicons'; 3 | src:url('../fonts/jeoicons.eot'); 4 | src:url('../fonts/jeoicons.eot?#iefix') format('embedded-opentype'), 5 | url('../fonts/jeoicons.ttf') format('truetype'), 6 | url('../fonts/jeoicons.woff') format('woff'), 7 | url('../fonts/jeoicons.svg#jeoicons') format('svg'); 8 | font-weight: normal; 9 | font-style: normal; 10 | } -------------------------------------------------------------------------------- /css/lsf.css: -------------------------------------------------------------------------------- 1 | /* 2 | * LigatureSymbols font 3 | */ 4 | 5 | @font-face { 6 | font-family: 'LigatureSymbols'; 7 | src: url('../fonts/LigatureSymbols-2.11.eot'); 8 | src: url('../fonts/LigatureSymbols-2.11.eot?#iefix') format('embedded-opentype'), 9 | url('../fonts/LigatureSymbols-2.11.woff') format('woff'), 10 | url('../fonts/LigatureSymbols-2.11.ttf') format('truetype'), 11 | url('../fonts/LigatureSymbols-2.11.svg#LigatureSymbols') format('svg'); 12 | src: url('../fonts/LigatureSymbols-2.11.ttf') format('truetype'); 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | .lsf, .lsf-icon:before { 18 | font-family: 'LigatureSymbols'; 19 | -webkit-text-rendering: optimizeLegibility; 20 | -moz-text-rendering: optimizeLegibility; 21 | -ms-text-rendering: optimizeLegibility; 22 | -o-text-rendering: optimizeLegibility; 23 | text-rendering: optimizeLegibility; 24 | -webkit-font-smoothing: antialiased; 25 | -moz-font-smoothing: antialiased; 26 | -ms-font-smoothing: antialiased; 27 | -o-font-smoothing: antialiased; 28 | font-smoothing: antialiased; 29 | font-weight: normal !important; 30 | font-style: normal !important; 31 | text-transform: none !important; 32 | font-size: 150%; 33 | } 34 | 35 | .lsf-icon:before { 36 | content:attr(title); 37 | margin-right:0.3em; 38 | font-size:130%; 39 | } 40 | 41 | .lsf-icon.amazon:before { 42 | content: '\E007'; 43 | } -------------------------------------------------------------------------------- /fonts/LigatureSymbols-2.11.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/LigatureSymbols-2.11.eot -------------------------------------------------------------------------------- /fonts/LigatureSymbols-2.11.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/LigatureSymbols-2.11.otf -------------------------------------------------------------------------------- /fonts/LigatureSymbols-2.11.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/LigatureSymbols-2.11.ttf -------------------------------------------------------------------------------- /fonts/LigatureSymbols-2.11.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/LigatureSymbols-2.11.woff -------------------------------------------------------------------------------- /fonts/jeoicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/jeoicons.eot -------------------------------------------------------------------------------- /fonts/jeoicons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /fonts/jeoicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/jeoicons.ttf -------------------------------------------------------------------------------- /fonts/jeoicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/fonts/jeoicons.woff -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | __('Header menu', 'jeo'), 23 | 'footer_menu' => __('Footer menu', 'jeo') 24 | )); 25 | 26 | //sidebars 27 | register_sidebar(array( 28 | 'name' => __('Post sidebar', 'jeo'), 29 | 'id' => 'post', 30 | 'before_title' => '

', 31 | 'after_title' => '

' 32 | )); 33 | register_sidebar(array( 34 | 'name' => __('General sidebar', 'jeo'), 35 | 'id' => 'general', 36 | 'before_title' => '

', 37 | 'after_title' => '

' 38 | )); 39 | register_sidebar(array( 40 | 'name' => __('Front page', 'jeo'), 41 | 'id' => 'front_page', 42 | 'before_title' => '

', 43 | 'after_title' => '

' 44 | )); 45 | 46 | } 47 | add_action('after_setup_theme', 'jeo_setup'); 48 | 49 | function jeo_theme_scripts() { 50 | // styles 51 | wp_register_style('jeo-lsf', get_template_directory_uri() . '/css/lsf.css'); 52 | wp_register_style('jeo-base', get_template_directory_uri() . '/css/base.css', array(), '1.2'); 53 | wp_register_style('jeo-skeleton', get_template_directory_uri() . '/css/skeleton.css', array('jeo-base'), '1.2'); 54 | wp_register_style('font-opensans', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'); 55 | wp_register_style('jeo-main', get_template_directory_uri() . '/css/main.css', array('jeo-skeleton', 'jeo-lsf', 'font-opensans'), '0.0.3'); 56 | 57 | wp_register_script('jquery-isotope', get_template_directory_uri() . '/lib/jquery.isotope.min.js', array('jquery'), '1.5.25'); 58 | 59 | wp_register_script('jeo-site', get_template_directory_uri() . '/js/site.js', array('jquery', 'jquery-isotope')); 60 | } 61 | add_action('wp_enqueue_scripts', 'jeo_theme_scripts', 5); 62 | 63 | function jeo_enqueue_theme_scripts() { 64 | if(wp_style_is('jeo-main', 'registered')) 65 | wp_enqueue_style('jeo-main'); 66 | 67 | if(wp_script_is('jeo-site', 'registered')) 68 | wp_enqueue_script('jeo-site'); 69 | 70 | if (is_singular()) 71 | wp_enqueue_script( "comment-reply" ); 72 | 73 | } 74 | add_action('wp_enqueue_scripts', 'jeo_enqueue_theme_scripts', 12); 75 | 76 | function jeo_flush_rewrite() { 77 | global $pagenow; 78 | if(is_admin() && $_REQUEST['activated'] && $pagenow == 'themes.php') { 79 | global $wp_rewrite; 80 | $wp_rewrite->init(); 81 | $wp_rewrite->flush_rules(); 82 | } 83 | } 84 | add_action('init', 'jeo_flush_rewrite'); 85 | 86 | function jeo_comment( $comment, $args, $depth ) { 87 | $GLOBALS['comment'] = $comment; 88 | switch ( $comment->comment_type ) : 89 | case 'pingback' : 90 | case 'trackback' : 91 | // Display trackbacks differently than normal comments. 92 | ?> 93 |
  • id="comment-"> 94 |

    ', '' ); ?>

    95 |
  • 96 | 102 |
  • id="li-comment-"> 103 |
    104 |
    105 | 106 |
    107 |
    108 | 109 | %1$s', 111 | get_comment_author_link() 112 | ); 113 | ?> 114 | | 115 | 116 | ', 118 | esc_url( get_comment_link( $comment->comment_ID ) ), 119 | get_comment_time( 'c' ), 120 | /* translators: 1: date, 2: time */ 121 | sprintf( __( '%1$s at %2$s', 'humus' ), get_comment_date(), get_comment_time() ) 122 | ); 123 | ?> 124 | 125 | ', ''); ?> 126 |
    127 |
    128 | comment_approved ) : ?> 129 |

    130 | 131 | 132 |
    133 | 134 |
    135 | 136 |
    137 | __( 'Reply', 'humus' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> 138 |
    139 |
    140 |
    141 | 146 | -------------------------------------------------------------------------------- /header.php: -------------------------------------------------------------------------------- 1 | 2 | > 3 | 4 | 5 | <?php 6 | global $page, $paged; 7 | 8 | wp_title( '|', true, 'right' ); 9 | 10 | bloginfo( 'name' ); 11 | 12 | $site_description = get_bloginfo('description', 'display'); 13 | if ( $site_description && ( is_home() || is_front_page() ) ) 14 | echo " | $site_description"; 15 | 16 | if ( $paged >= 2 || $page >= 2 ) 17 | echo ' | ' . __('Page', 'jeo') . max($paged, $page); 18 | 19 | ?> 20 | 21 | 22 | 23 | 24 | 25 | 26 | > 27 |
    28 |
    29 |
    30 |
    31 |

    32 | 33 | 34 | 35 |

    36 |

    37 |
    38 |
    39 |
    40 |
    41 |
    42 | 45 | 46 |
    47 |
    48 |
    49 |
    50 |
    -------------------------------------------------------------------------------- /img/light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/img/light.png -------------------------------------------------------------------------------- /img/marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/img/marker.png -------------------------------------------------------------------------------- /img/marker_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/img/marker_active.png -------------------------------------------------------------------------------- /img/marker_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/img/marker_small.png -------------------------------------------------------------------------------- /img/marker_small_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/img/marker_small_active.png -------------------------------------------------------------------------------- /inc/admin/settings.php: -------------------------------------------------------------------------------- 1 | AddSubMenu( 13 | __('JEO Settings', 'jeo'), 14 | $this->page_slug 15 | ); 16 | 17 | $this->ShowPageHeadingTabs(false); 18 | 19 | // Add in-page tabs in the first page. 20 | 21 | $page_tabs = apply_filters('jeo_settings_tabs', array( 22 | 'home' => __('Front page', 'jeo'), 23 | 'map' => __('Maps', 'jeo'), 24 | 'geocode' => __('Geocode', 'jeo'), 25 | 'mapbox' => __('MapBox', 'jeo') 26 | )); 27 | 28 | $this->AddInPageTabs($this->page_slug, $page_tabs); 29 | 30 | /* 31 | * Data 32 | */ 33 | 34 | $maps = get_posts(array('post_type' => array('map', 'map-group'), 'posts_per_page' => -1)); 35 | 36 | $maps_input = array(); 37 | if($maps) { 38 | foreach($maps as $map) { 39 | $maps_input[$map->ID] = $map->post_title . ' (' . get_post_type($map->ID) . ')'; 40 | } 41 | } else { 42 | $maps_input[0] = __('No maps were found', 'jeo'); 43 | } 44 | 45 | $mapped = jeo_get_mapped_post_types(); 46 | 47 | $mapped_post_types = array(); 48 | foreach($mapped as $post_type) { 49 | $mapped_post_types[$post_type] = true; 50 | } 51 | 52 | $pts = get_post_types(array('public' => true, '_builtin' => false)); 53 | $pts = $pts + array('post', 'page'); 54 | unset($pts['map']); 55 | unset($pts['map-group']); 56 | 57 | $post_types = array(); 58 | foreach($pts as $pt) { 59 | $post_types[$pt] = $pt; 60 | } 61 | 62 | // Add form elements. 63 | // Here we have four sections as an example. 64 | // If you wonder what array keys are need to be used, please refer to http://en.michaeluno.jp/admin-page-framework/methods/ 65 | 66 | $form_sections = apply_filters('jeo_settings_form_sections', array( 67 | array( 68 | 'pageslug' => $this->page_slug, 69 | 'tabslug' => 'home', 70 | 'id' => 'front_page', 71 | 'title' => __('Front page settings', 'jeo'), 72 | 'description' => __('Set your front page contents.', 'jeo'), 73 | 'fields' => array( // Field Arrays 74 | // Dropdown List 75 | array( 76 | 'id' => 'front_page_map', 77 | 'title' => __('Front page map', 'jeo'), 78 | 'description' => __('Select if the front page map should be the featured map with latest content or a selection of featured posts.', 'jeo'), 79 | 'type' => 'radio', 80 | 'default' => 'latest', 81 | 'label' => array('latest' => __('Featured map with latest posts', 'jeo'), 'featured' => __('Selection of featured posts', 'jeo') . ' (' . __('featured map cannot be a map-group', 'jeo') . ')') 82 | ), 83 | array( 84 | 'id' => 'featured_map', 85 | 'title' => __('Featured map', 'jeo'), 86 | 'description' => __('Select the map to be featured on the homepage and posts.', 'jeo'), 87 | 'type' => 'select', 88 | 'default' => 0, 89 | 'label' => $maps_input 90 | ) 91 | ) 92 | ), 93 | array( 94 | 'pageslug' => $this->page_slug, 95 | 'tabslug' => 'geocode', 96 | 'id' => 'geocode', 97 | 'title' => __('Geocode settings', 'jeo'), 98 | 'description' => '', 99 | 'fields' => array( // Field Arrays 100 | // Text Field 101 | array( 102 | 'id' => 'type', 103 | 'title' => __('Geocode type', 'jeo'), 104 | 'description' => __('Choose simple latitude/longitude inputs or complete address lookup geocoding system', 'jeo'), // additional notes besides the form field 105 | 'type' => 'radio', 106 | 'default' => 'default', 107 | 'label' => array('default' => __('Address geocoding with interactive map (default)', 'jeo'), 'latlng' => __('Latitude/longitude inputs', 'jeo')) 108 | ), 109 | array( 110 | 'id' => 'service', 111 | 'title' => __('Geocode service', 'jeo'), 112 | 'description' => __('Choose the geocoding service to be used', 'jeo'), 113 | 'type' => 'radio', 114 | 'default' => 'osm', 115 | 'label' => array('osm' => __('OpenStreetMaps with Nominatim', 'jeo'), 'gmaps' => 'Google Maps') 116 | ), 117 | array( 118 | 'id' => 'gmaps_api_key', 119 | 'title' => __('Google Maps API Key', 'jeo'), 120 | 'description' => sprintf(__('Key to use the Google Maps geocoding services. Click here to get one.', 'jeo'), 'https://developers.google.com/maps/documentation/javascript/tutorial#api_key'), 121 | 'type' => 'text', 122 | 'size' => 100 123 | ) 124 | ) 125 | ), 126 | array( 127 | 'pageslug' => $this->page_slug, 128 | 'tabslug' => 'map', 129 | 'id' => 'map', 130 | 'title' => __('Map behaviours', 'jeo'), 131 | 'fields' => array( 132 | array( 133 | 'id' => 'use_hash', 134 | 'title' => __('Fragment hash', 'jeo'), 135 | 'description' => __('Enable use of fragment hash url to share map location, selected maps on mapgroup and fullscreen state.
    E.g.: yoursite.com/#!/loc=-23,-42,7&map=12&full=true', 'jeo'), 136 | 'type' => 'checkbox', 137 | 'default' => true, 138 | 'label' => __('Enable', 'jeo') 139 | ), 140 | array( 141 | 'id' => 'enable_clustering', 142 | 'title' => __('Enable marker clustering', 'jeo'), 143 | 'description' => __('Enable marker clustering system.', 'jeo'), 144 | 'type' => 'checkbox', 145 | 'default' => true, 146 | 'label' => __('Enable', 'jeo') 147 | ), 148 | array( 149 | 'id' => 'use_map_query', 150 | 'title' => __('Map query', 'jeo'), 151 | 'description' => __('Display posts only associated to the viewing map', 'jeo'), 152 | 'type' => 'checkbox', 153 | 'default' => true, 154 | 'label' => __('Enable', 'jeo') 155 | ), 156 | array( 157 | 'id' => 'mapped_post_types', 158 | 'title' => __('Mapped post types', 'jeo'), 159 | 'description' => __('Post types to enable map functionalities', 'jeo'), 160 | 'type' => 'checkbox', 161 | 'default' => $mapped_post_types, 162 | 'label' => $post_types 163 | ), 164 | ) 165 | ), 166 | array( 167 | 'pageslug' => $this->page_slug, 168 | 'tabslug' => 'mapbox', 169 | 'id' => 'mapbox', 170 | 'title' => __('MapBox', 'jeo'), 171 | 'description' => '', 172 | 'fields' => array( 173 | array( 174 | 'id' => 'access_token', 175 | 'title' => __('Access token', 'jeo'), 176 | 'description' => __('MapBox access token'), 177 | 'type' => 'text', 178 | 'size' => 100 179 | ), 180 | ) 181 | ), 182 | ), $this->page_slug); 183 | 184 | $this->AddFormSections($form_sections); 185 | 186 | } 187 | 188 | function do_jeo_settings() { 189 | 190 | if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'about' ) return; 191 | 192 | submit_button(); 193 | 194 | } 195 | 196 | function content_jeo_settings_about( $strContent ) { 197 | 198 | return $strContent . '

    Documentation

    ' 199 | . '' 205 | . '

    Participate in the Project

    ' 206 | . '

    The repository is available at GitHub. https://github.com/michaeluno/admin-page-framework

    ' 207 | ; 208 | 209 | } 210 | 211 | } 212 | 213 | function jeo_init_settings_page() { 214 | $GLOBALS['jeo_admin'] = new JEO_Settings_Page('jeo_settings', __FILE__); 215 | } 216 | add_action('jeo_init', 'jeo_init_settings_page', 100); 217 | 218 | function jeo_admin_add_form_sections($sections = array()) { 219 | if(is_array($sections) && !empty($sections)) { 220 | global $jeo_admin; 221 | $jeo_admin->AddFormSections($sections); 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /inc/api.php: -------------------------------------------------------------------------------- 1 | is_enabled()) { 16 | add_rewrite_endpoint('geojson', EP_ALL); 17 | add_filter('query_vars', array($this, 'query_var')); 18 | add_filter('jeo_markers_geojson', array($this, 'jsonp_callback')); 19 | add_filter('jeo_markers_data', array($this, 'filter_markers'), 10, 2); 20 | add_filter('jeo_geojson_content_type', array($this, 'content_type')); 21 | add_action('jeo_markers_before_print', array($this, 'headers')); 22 | add_action('pre_get_posts', array($this, 'pre_get_posts')); 23 | add_action('template_redirect', array($this, 'template_redirect')); 24 | } 25 | } 26 | 27 | /* 28 | * Admin settings 29 | */ 30 | 31 | function is_enabled() { 32 | $options = jeo_get_options(); 33 | return ($options && isset($options['api']) && $options['api']['enable']); 34 | } 35 | 36 | function admin_settings_tab($tabs = array()) { 37 | $tabs['api'] = __('GeoJSON API', 'jeo'); 38 | return $tabs; 39 | } 40 | 41 | function admin_settings_form_section($sections = array(), $page_slug) { 42 | 43 | $section = array( 44 | 'pageslug' => $page_slug, 45 | 'tabslug' => 'api', 46 | 'id' => 'api', 47 | 'title' => __('GeoJSON API Settings', 'jeo'), 48 | 'description' => '', 49 | 'fields' => array( 50 | array( 51 | 'id' => 'enable', 52 | 'title' => __('Enable API', 'jeo'), 53 | 'description' => __('Select if you\'d like to enable the GeoJSON API', 'jeo'), 54 | 'type' => 'checkbox', 55 | 'default' => false, 56 | 'label' => __('Enable', 'jeo') 57 | ) 58 | ) 59 | ); 60 | 61 | if($this->is_enabled()) { 62 | $section['description'] = sprintf(__('Your API is enabled! Click here to learn more.', 'jeo'), 'http://dev.cardume.art.br/jeo/features/geojson-api/') . '

    ' . $section['description']; 63 | } 64 | 65 | $sections[] = $section; 66 | return $sections; 67 | } 68 | 69 | function get_options() { 70 | $options = jeo_get_options(); 71 | if($options && isset($options['api'])) { 72 | return $options['api']; 73 | } 74 | } 75 | 76 | function query_var($vars) { 77 | $vars[] = 'geojson'; 78 | $vars[] = 'download'; 79 | return $vars; 80 | } 81 | 82 | function filter_markers($data, $query) { 83 | if(isset($query->query['geojson'])) { 84 | $features_with_geometry = array(); 85 | foreach($data['features'] as $feature) { 86 | if(isset($feature['geometry'])) 87 | $features_with_geometry[] = $feature; 88 | } 89 | $data['features'] = $features_with_geometry; 90 | } 91 | return $data; 92 | } 93 | 94 | function pre_get_posts($query) { 95 | if(isset($query->query['geojson'])) { 96 | $query->set('offset', null); 97 | $query->set('nopaging', null); 98 | $query->set('paged', (get_query_var('paged')) ? get_query_var('paged') : 1); 99 | } 100 | } 101 | 102 | function template_redirect() { 103 | global $wp_query; 104 | if(isset($wp_query->query['geojson'])) { 105 | $query = $this->query(); 106 | $this->get_data(apply_filters('jeo_geojson_api_query', $query)); 107 | exit; 108 | } 109 | } 110 | 111 | function jsonp_callback($geojson) { 112 | global $wp_query; 113 | if(isset($wp_query->query['geojson']) && isset($_GET['callback'])) { 114 | $jsonp_callback = preg_replace('/[^a-zA-Z0-9$_]/s', '', $_GET['callback']); 115 | $geojson = "$jsonp_callback($geojson)"; 116 | } 117 | return $geojson; 118 | } 119 | 120 | function content_type($content_type) { 121 | global $wp_query; 122 | if(isset($wp_query->query['geojson']) && isset($_GET['callback'])) { 123 | $content_type = 'application/javascript'; 124 | } 125 | return $content_type; 126 | } 127 | 128 | function headers() { 129 | global $wp_query; 130 | if(isset($wp_query->query['geojson'])) { 131 | header('X-Total-Count: ' . $wp_query->found_posts); 132 | header('Access-Control-Allow-Origin: *'); 133 | if(isset($_GET['download'])) { 134 | $filename = apply_filters('jeo_geojson_filename', sanitize_title(get_bloginfo('name') . ' ' . wp_title(null, false))); 135 | header('Content-Disposition: attachment; filename="' . $filename . '.geojson"'); 136 | } 137 | } 138 | } 139 | 140 | function get_api_url($query_args = array()) { 141 | global $wp_query; 142 | $query_args = (empty($query_args)) ? $wp_query->query : $query_args; 143 | $query_args = $query_args + array('geojson' => 1); 144 | return add_query_arg($query_args, home_url('/')); 145 | } 146 | 147 | function get_download_url($query_args = array()) { 148 | return add_query_arg(array('download' => 1), $this->get_api_url($query_args)); 149 | } 150 | } 151 | 152 | $GLOBALS['jeo_api'] = new JEO_API; 153 | 154 | function jeo_get_api_url($query_args = array()) { 155 | return $GLOBALS['jeo_api']->get_api_url($query_args); 156 | } 157 | 158 | function jeo_get_api_download_url($query_args = array()) { 159 | return $GLOBALS['jeo_api']->get_download_url($query_args); 160 | } 161 | -------------------------------------------------------------------------------- /inc/css/embed.css: -------------------------------------------------------------------------------- 1 | html#map-embed, 2 | html#mab-embed body { 3 | margin: 0; 4 | padding: 0; 5 | overflow: hidden; 6 | } 7 | 8 | html#map-embed .map-container { 9 | position: absolute; 10 | top: 0; 11 | left: 0; 12 | right: 0; 13 | bottom: 30px; 14 | min-height: 0; 15 | width: auto; 16 | height: auto; 17 | margin: 0; 18 | padding: 0; 19 | } 20 | 21 | html#map-embed header { 22 | position: fixed; 23 | bottom: 0; 24 | left: 0; 25 | right: 0; 26 | height: 30px; 27 | background: #101010; 28 | margin: 0; 29 | padding: 0; 30 | } 31 | 32 | 33 | html#map-embed header h1 { 34 | float: right; 35 | font-family: 'OpenSansCondensedBold'; 36 | text-transform: uppercase; 37 | display: block; 38 | line-height: 30px; 39 | font-size: 14px; 40 | margin: 0 10px; 41 | } 42 | 43 | html#map-embed header h1 a { 44 | color: #666; 45 | text-decoration: none; 46 | } 47 | 48 | html#map-embed header h1 a:hover { 49 | color: #d0d0d0; 50 | } -------------------------------------------------------------------------------- /inc/css/jeo.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Map styles 3 | */ 4 | 5 | .map-container { 6 | position: relative; 7 | } 8 | 9 | .map-container .map { 10 | width: 100%; 11 | height: 100%; 12 | } 13 | 14 | .map .cartodb-logo { 15 | display: none !important; 16 | } 17 | 18 | .fullscreen-map, 19 | .fullscreen-map.map-container { 20 | z-index: 9999999; 21 | position: fixed !important; 22 | top: 0; 23 | bottom:0; 24 | left: 0; 25 | right: 0; 26 | width: auto !important; 27 | height: auto !important; 28 | } 29 | 30 | .map-fullscreen .mapgroup-container, 31 | .map-fullscreen .mapgroup-container .mapgroup, 32 | .map-fullscreen.map-container { 33 | background: #fff; 34 | position: absolute; 35 | top: 0; 36 | width: 100%; 37 | height: 100%; 38 | z-index: 100; 39 | } 40 | 41 | .leaflet-control .map-fullscreen { 42 | background-image: url(../img/fullscreen-button.png); 43 | background-position: 6px 6px; 44 | background-repeat: no-repeat; 45 | } 46 | 47 | .fullscreen-map .leaflet-control .map-fullscreen { 48 | background-position: -18px 6px; 49 | } 50 | 51 | .lang-en, 52 | .lang-pt, 53 | .lang-es { 54 | display: none; 55 | } 56 | 57 | body.locale-en-us .lang-en, 58 | body.locale-pt-br .lang-pt, 59 | body.locale-es-es .lang-es { 60 | display: block; 61 | } 62 | 63 | body.pt-BR .lang-pt, 64 | body.en-US .lang-en, 65 | body.es-ES .lang-es { 66 | display: block; 67 | } 68 | 69 | .leaflet-control .widget-title { 70 | padding: 5px; 71 | text-transform: uppercase; 72 | font-weight: bold; 73 | font-size: 80%; 74 | display: block; 75 | } 76 | 77 | /* 78 | * Search form 79 | */ 80 | 81 | .leaflet-control.jeo-geocode { 82 | max-width: 300px; 83 | background: #fff; 84 | } 85 | 86 | .leaflet-control.jeo-geocode .map-search { 87 | margin: 0; 88 | padding: 0; 89 | display: block; 90 | border-bottom: 1px solid #eee; 91 | } 92 | 93 | .leaflet-control.jeo-geocode .map-search input { 94 | border: 0; 95 | background: transparent; 96 | width: 100%; 97 | box-sizing: border-box; 98 | padding: 5px; 99 | display: block; 100 | outline: none; 101 | margin: 0; 102 | } 103 | 104 | .leaflet-control.jeo-geocode .geocode-results .widget-title { 105 | border-top: 1px solid #f0f0f0; 106 | } 107 | 108 | .leaflet-control.jeo-geocode .geocode-results ul { 109 | padding: 0; 110 | margin: 0; 111 | list-style: none; 112 | } 113 | 114 | .leaflet-control.jeo-geocode .geocode-results ul li { 115 | padding: 3px 5px; 116 | margin: 0; 117 | border-bottom: 1px solid #f3f3f3; 118 | cursor: pointer; 119 | } 120 | 121 | .leaflet-control.jeo-geocode .geocode-results ul li:hover { 122 | background-color: #f3f3f3; 123 | } 124 | 125 | .leaflet-control.jeo-geocode .geocode-results .clear-search { 126 | float: right; 127 | font-size: 80%; 128 | padding: 5px; 129 | } 130 | 131 | /* 132 | * Switch layers 133 | */ 134 | 135 | .leaflet-control.jeo-filter-layers { 136 | background: #fff; 137 | max-width: 300px; 138 | } 139 | 140 | .leaflet-control.jeo-filter-layers .switch-layers, 141 | .leaflet-control.jeo-filter-layers .swap-layers { 142 | margin: 0; 143 | padding: 0; 144 | list-style: none; 145 | } 146 | 147 | .leaflet-control.jeo-filter-layers .switch-layers li, 148 | .leaflet-control.jeo-filter-layers .swap-layers li { 149 | margin: 0; 150 | padding: 5px; 151 | cursor: pointer; 152 | border-bottom: 1px solid #f3f3f3; 153 | -webkit-border-radius: 3px; 154 | -moz-border-radius: 3px; 155 | -khtml-border-radius: 3px; 156 | -o-border-radius: 3px; 157 | border-radius: 3px; 158 | opacity: .5; 159 | } 160 | 161 | .leaflet-control.jeo-filter-layers .switch-layers li.active, 162 | .leaflet-control.jeo-filter-layers .swap-layers li.active { 163 | opacity: 1; 164 | } 165 | 166 | .leaflet-control.jeo-filter-layers .switch-layers li:hover, 167 | .leaflet-control.jeo-filter-layers .swap-layers li:hover { 168 | opacity: .7; 169 | } 170 | 171 | .leaflet-control.jeo-filter-layers .swap-layers li.active:hover { 172 | opacity: 1; 173 | } 174 | 175 | .map-container { 176 | overflow: hidden; 177 | } 178 | 179 | 180 | /* 181 | * Markers 182 | */ 183 | .leaflet-popup-content { 184 | max-width: 150px; 185 | margin: 10px; 186 | } 187 | .leaflet-popup-close-button { 188 | display: none !important; 189 | } 190 | .leaflet-popup-content small { 191 | color: #96979C; 192 | } 193 | .leaflet-popup-content h4 { 194 | margin: 0; 195 | } -------------------------------------------------------------------------------- /inc/css/marker-icons.css: -------------------------------------------------------------------------------- 1 | #marker-icon-metabox .marker-icon-container { 2 | float: left; 3 | width: 33%; 4 | position: relative; 5 | padding-top: 310px; 6 | box-sizing: border-box; 7 | -moz-box-sizing: border-box; 8 | } 9 | 10 | #marker-icon-metabox .marker-icon-container .tip { 11 | display: none; 12 | } 13 | 14 | #marker-icon-metabox .marker-icon-selector { 15 | position: absolute; 16 | top: 0; 17 | left: 0; 18 | right: 0; 19 | height: 300px; 20 | overflow: hidden; 21 | border: 1px solid #cfcfcf; 22 | background: #fefefe; 23 | border-radius: 3px; 24 | } 25 | 26 | #marker-icon-metabox .marker-icon-selector.editing { 27 | cursor: crosshair; 28 | background: #eee; 29 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQXAS03w2/5YAAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAVSURBVAjXY2DAAu7evft/4AQZGBgATWoVhQLfozMAAAAASUVORK5CYII=); 30 | } 31 | 32 | #marker-icon-metabox .marker-icon-selector .point { 33 | position: absolute; 34 | top: 50%; 35 | left: 50%; 36 | width: 20px; 37 | height: 20px; 38 | margin-top: -10px; 39 | margin-left: -10px; 40 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQXATU2NnNRrwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAsSURBVDjLY2AgEhgbG/8nVi0TAw3AqKGjhg4FQxlJySlUB6PZdNTQUUOJAAA0EgTuMnmHIQAAAABJRU5ErkJggg==); 41 | } 42 | 43 | #marker-icon-metabox .marker-icon-selector .console { 44 | font-size: 9px; 45 | line-height: 9px; 46 | display: none; 47 | margin: 5px; 48 | text-transform: uppercase; 49 | font-family: monospace; 50 | } 51 | 52 | #marker-icon-metabox .marker-icon-selector button.use-default { 53 | position: absolute; 54 | bottom: 5px; 55 | right: 67%; 56 | left: 5px; 57 | } 58 | 59 | 60 | #marker-icon-metabox .marker-icon-selector button.cancel { 61 | position: absolute; 62 | bottom: 5px; 63 | left: 34%; 64 | right: 34%; 65 | } 66 | #marker-icon-metabox .marker-icon-selector button.save { 67 | position: absolute; 68 | bottom: 5px; 69 | left: 67%; 70 | right: 5px; 71 | } 72 | 73 | #marker-icon-metabox .marker-icon-selector.editing .console { 74 | display: block; 75 | } 76 | 77 | #marker-icon-metabox .marker-icon-selector img { 78 | position: absolute; 79 | top: 50%; 80 | left: 50%; 81 | } 82 | 83 | #marker-icon-metabox .marker-icon-settings { 84 | display: none; 85 | } 86 | 87 | #marker-icon-metabox .marker-icon-setting { 88 | width: 33%; 89 | float: left; 90 | box-sizing: border-box; 91 | -moz-box-sizing: border-box; 92 | padding: 0 0 0 40px; 93 | } 94 | 95 | /* 96 | * Relationship metabox 97 | */ 98 | 99 | #marker-icon-relationship-metabox ul li { 100 | float: left; 101 | padding: 10px; 102 | border: 1px solid #ccc; 103 | border-radius: 3px; 104 | -moz-border-radius: 3px; 105 | text-align: center; 106 | margin: 0 10px 0 0; 107 | } 108 | 109 | #marker-icon-relationship-metabox ul li label { 110 | display: block; 111 | margin-bottom: 5px; 112 | } -------------------------------------------------------------------------------- /inc/css/range-slider.css: -------------------------------------------------------------------------------- 1 | .jeo-date-range-slider { 2 | min-width: 300px; 3 | background: #fff; 4 | box-shadow: 1px 1px 1px rgba(0,0,0,0.1); 5 | padding: 5px 30px; 6 | margin-top: 50px; 7 | } 8 | 9 | .jeo-date-range-slider-container { 10 | } 11 | 12 | .leaflet-hidden { 13 | display: none; 14 | } 15 | 16 | .ui-rangeSlider { 17 | height: 16px; 18 | } 19 | 20 | .ui-rangeSlider .ui-rangeSlider-innerBar { 21 | background: #f0f0f0; 22 | box-shadow: inset 2px 2px 6px rgba(0,0,0,0.1); 23 | border-top: 1px solid rgba(0,0,0,0.15); 24 | border-left: 1px solid rgba(0,0,0,0.15); 25 | border-bottom: 1px solid #fff; 26 | border-right: 1px solid #fff; 27 | margin: 2px 0; 28 | height: 10px; 29 | } 30 | 31 | .ui-rangeSlider .ui-rangeSlider-bar { 32 | background: #777; 33 | margin: 2px 6px; 34 | height: 12px; 35 | } 36 | 37 | .ui-rangeSlider .ui-rangeSlider-handle { 38 | background: rgba(0,0,0,0.6); 39 | width: 2px; 40 | height: 16px; 41 | } 42 | 43 | .ui-rangeSlider-arrow { 44 | height: 14px; 45 | } 46 | 47 | .ui-rangeSlider-arrow.ui-rangeSlider-rightArrow { 48 | right: -10px !important; 49 | } 50 | 51 | .ui-rangeSlider-arrow.ui-rangeSlider-leftArrow { 52 | left: -10px !important; 53 | } 54 | 55 | .ui-rangeSlider-label { 56 | background: transparent; 57 | margin-bottom: 5px; 58 | padding: 3px 5px 7px; 59 | } 60 | 61 | .ui-rangeSlider-label .ui-rangeSlider-label-value { 62 | background: #f0f0f0; 63 | padding: 5px 7px; 64 | font-weight: 600; 65 | font-size: 12px; 66 | font-family: "Open Sans"; 67 | display: block; 68 | margin: 0; 69 | box-shadow: 1px 1px 1px rgba(0,0,0,0.3); 70 | } 71 | 72 | .ui-rangeSlider-label:after, 73 | .ui-rangeSlider-label:before { 74 | content: ''; 75 | width: 0; 76 | height: 0; 77 | border-left: 6px solid transparent; 78 | border-right: 6px solid transparent; 79 | border-top: 6px solid #f0f0f0; 80 | position: absolute; 81 | bottom: 2px; 82 | left: 50%; 83 | margin-left: -6px; 84 | z-index: 1000; 85 | } 86 | 87 | .ui-rangeSlider-label:before { 88 | border-left: 7px solid transparent; 89 | border-right: 7px solid transparent; 90 | border-top: 7px solid rgba(0,0,0,0.1); 91 | bottom: 0; 92 | margin-left: -7px; 93 | } -------------------------------------------------------------------------------- /inc/embed.php: -------------------------------------------------------------------------------- 1 | query_var; 20 | return $vars; 21 | } 22 | 23 | function generate_rewrite_rule($wp_rewrite) { 24 | $widgets_rule = array( 25 | $this->slug . '$' => 'index.php?' . $this->query_var . '=1' 26 | ); 27 | $wp_rewrite->rules = $widgets_rule + $wp_rewrite->rules; 28 | } 29 | 30 | function template_redirect() { 31 | if(get_query_var($this->query_var)) { 32 | 33 | // Set embed map 34 | if(isset($_GET['map_id'])) { 35 | jeo_set_map(get_post($_GET['map_id'])); 36 | } else { 37 | $maps = get_posts(array('post_type' => 'map', 'posts_per_page' => 1)); 38 | if($maps) { 39 | jeo_set_map(array_shift($maps)); 40 | } else { 41 | exit; 42 | } 43 | } 44 | 45 | // Set tax 46 | if(isset($_GET['tax'])) { 47 | global $wp_query; 48 | $wp_query->set('tax_query', array( 49 | array( 50 | 'taxonomy' => $_GET['tax'], 51 | 'field' => 'slug', 52 | 'terms' => $_GET['term'] 53 | ) 54 | )); 55 | } 56 | 57 | add_filter('show_admin_bar', '__return_false'); 58 | do_action('jeo_before_embed'); 59 | $this->template(); 60 | do_action('jeo_after_embed'); 61 | exit; 62 | } 63 | } 64 | 65 | function template() { 66 | wp_enqueue_style('jeo-embed', get_template_directory_uri() . '/inc/css/embed.css'); 67 | get_template_part('content', 'embed'); 68 | exit; 69 | } 70 | 71 | function get_embed_url($vars = array()) { 72 | $query = http_build_query($vars); 73 | return apply_filters('jeo_embed_url', home_url('/' . $this->slug) . '/?' . $query); 74 | } 75 | 76 | function get_map_conf() { 77 | $conf = array(); 78 | $conf['containerID'] = 'map_embed'; 79 | $conf['disableHash'] = true; 80 | $conf['mainMap'] = true; 81 | if(isset($_GET['map_id'])) { 82 | $conf['postID'] = $_GET['map_id']; 83 | } else { 84 | $conf['postID'] = jeo_get_the_ID(); 85 | } 86 | if(isset($_GET['map_only'])) { 87 | $conf['disableMarkers'] = true; 88 | } 89 | if(isset($_GET['layers'])) { 90 | $conf['layers'] = explode(',', $_GET['layers']); 91 | if(isset($conf['postID'])) 92 | unset($conf['postID']); 93 | } 94 | if(isset($_GET['zoom'])) { 95 | $conf['zoom'] = $_GET['zoom']; 96 | } 97 | if(isset($_GET['lat']) && isset($_GET['lon'])) { 98 | $conf['center'] = array($_GET['lat'], $_GET['lon']); 99 | $conf['forceCenter'] = true; 100 | } 101 | $conf['disable_mousewheel'] = false; 102 | 103 | $conf = apply_filters('jeo_map_embed_conf', $conf); 104 | 105 | return apply_filters('jeo_map_embed_geojson_conf', json_encode($conf)); 106 | } 107 | } 108 | 109 | $GLOBALS['jeo_embed'] = new JEO_Embed(); 110 | 111 | function jeo_get_embed_url($vars = array()) { 112 | return $GLOBALS['jeo_embed']->get_embed_url($vars); 113 | } 114 | 115 | function jeo_get_map_embed_conf() { 116 | return $GLOBALS['jeo_embed']->get_map_conf(); 117 | } 118 | -------------------------------------------------------------------------------- /inc/featured.php: -------------------------------------------------------------------------------- 1 | setup_query(); 24 | $this->set_post_types(); 25 | add_action('add_meta_boxes', array($this, 'add_metabox')); 26 | add_action('save_post', array($this, 'save')); 27 | } 28 | 29 | function set_post_types() { 30 | $this->post_types = apply_filters('jeo_featured_post_types', $this->post_types); 31 | return $this->post_types; 32 | } 33 | 34 | function setup_query() { 35 | 36 | global $wp; 37 | $wp->add_query_var($this->featured_var); 38 | 39 | add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); 40 | add_filter('jeo_marker_base_query', array($this, 'get_query')); 41 | } 42 | 43 | function pre_get_posts($query) { 44 | if($query->get($this->featured_var)) { 45 | $this->query = $this->query($query); 46 | return $this->query; 47 | } 48 | return $query; 49 | } 50 | 51 | function get_query($query) { 52 | if($this->query) { 53 | return $this->query; 54 | } 55 | 56 | return $query; 57 | } 58 | 59 | function query($query) { 60 | 61 | $query_vars = $query->query_vars; 62 | 63 | if(!$query_vars['meta_query']) 64 | $query_vars['meta_query'] = array(); 65 | 66 | $query_vars['meta_query'][] = array( 67 | 'key' => $this->featured_meta, 68 | 'value' => 1 69 | ); 70 | 71 | //unset($query_vars[$this->featured_var]); 72 | 73 | $query->query_vars = $query_vars; 74 | 75 | return $query; 76 | } 77 | 78 | function add_metabox() { 79 | foreach($this->post_types as $post_type) { 80 | add_meta_box( 81 | 'featured-metabox', 82 | __('Featured', 'jeo'), 83 | array($this, 'box'), 84 | $post_type, 85 | 'advanced', 86 | 'high' 87 | ); 88 | } 89 | } 90 | 91 | function box($post = false) { 92 | $featured = ($post) ? $this->is_featured($post->ID) : false; 93 | ?> 94 | 98 | featured_meta, $_REQUEST['featured_content']); 114 | else 115 | delete_post_meta($post_id, $this->featured_meta); 116 | } 117 | 118 | function is_featured($post_id) { 119 | global $post; 120 | $post_id = $post_id ? $post_id : $post->ID; 121 | return get_post_meta($post_id, $this->featured_meta, true); 122 | } 123 | 124 | function get_featured($query = false) { 125 | if(!$query) 126 | $query = array(); 127 | 128 | $query = array_merge($query, $this->query($query)); 129 | 130 | return get_posts($query); 131 | } 132 | 133 | } 134 | 135 | $featured = new JEO_Featured; 136 | 137 | function jeo_is_featured($post_id = false) { 138 | global $featured; 139 | return $featured->is_featured($post_id); 140 | } 141 | 142 | function jeo_get_featured($query = false) { 143 | global $featured; 144 | return $featured->get_featured($query); 145 | } -------------------------------------------------------------------------------- /inc/img/fullscreen-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/inc/img/fullscreen-button.png -------------------------------------------------------------------------------- /inc/img/widget-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oeco/jeo/bc70004d4f7191f346b7c515cf324acb7f3db3ea/inc/img/widget-sprite.png -------------------------------------------------------------------------------- /inc/js/filter-layers.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 3 | jeo.filterLayers = L.Control.extend({ 4 | 5 | options: { 6 | position: 'bottomleft' 7 | }, 8 | 9 | onAdd: function(map) { 10 | 11 | if(!this._map.conf.filteringLayers || this._map.conf.disableInteraction) 12 | return false; 13 | 14 | var self = this; 15 | 16 | this._map = map; 17 | 18 | this._map.filterLayers = this; 19 | 20 | this._container = L.DomUtil.create('div', 'jeo-filter-layers'); 21 | 22 | this._$ = $(this._container); 23 | 24 | this._layers = map.conf.filteringLayers; 25 | 26 | this._swapWidget; 27 | this._switchWidget; 28 | 29 | this._layers.status = []; 30 | _.each(this._map.conf.layers, function(layer) { 31 | self._layers.status.push({ 32 | ID: layer.ID, 33 | on: true 34 | }); 35 | }); 36 | 37 | this._build(); 38 | 39 | return this._container; 40 | 41 | }, 42 | 43 | _build: function() { 44 | 45 | var self = this; 46 | 47 | /* 48 | * Swapables 49 | */ 50 | if(this._layers.swapLayers && this._layers.swapLayers.length >= 2) { 51 | var swap = this._layers.swapLayers; 52 | var list = ''; 53 | _.each(swap, function(layer) { 54 | var attrs = ''; 55 | if(layer.first) 56 | attrs = 'class="active"'; 57 | else 58 | self._disableLayer(layer.ID); 59 | list += '
  • ' + layer.title + '
  • '; 60 | }); 61 | 62 | this._swapWidget = ''; 63 | this._$.append(this._swapWidget); 64 | 65 | this._$.on('click', '.swap-layers li', function() { 66 | self._swapLayer($(this).data('layer')); 67 | }); 68 | } 69 | 70 | /* 71 | * Switchables 72 | */ 73 | if(this._layers.switchLayers && this._layers.switchLayers.length) { 74 | var switchable = this._layers.switchLayers; 75 | var list = ''; 76 | _.each(switchable, function(layer) { 77 | var attrs = 'class="active"'; 78 | if(layer.hidden) { 79 | attrs = ''; 80 | self._disableLayer(layer.ID); 81 | } 82 | list += '
  • ' + layer.title + '
  • '; 83 | }); 84 | 85 | this._switchWidget = ''; 86 | this._$.append(this._switchWidget); 87 | 88 | this._$.on('click', '.switch-layers li', function() { 89 | self._switchLayer($(this).data('layer')); 90 | }); 91 | 92 | } 93 | 94 | this._update(); 95 | 96 | return this._container; 97 | 98 | }, 99 | 100 | _switchLayer: function(layer) { 101 | 102 | if(this._getStatus(layer).on) { 103 | 104 | this._disableLayer(layer); 105 | this._$.find('li[data-layer="' + layer + '"]').removeClass('active'); 106 | 107 | } else { 108 | 109 | this._enableLayer(layer); 110 | this._$.find('li[data-layer="' + layer + '"]').addClass('active'); 111 | 112 | } 113 | 114 | this._update(); 115 | 116 | }, 117 | 118 | _swapLayer: function(layer) { 119 | 120 | var self = this; 121 | 122 | if(this._getStatus(layer).on) 123 | return; 124 | 125 | _.each(this._layers.swapLayers, function(swapLayer) { 126 | 127 | if(swapLayer.ID == layer) { 128 | 129 | self._enableLayer(layer); 130 | 131 | self._$.find('li[data-layer="' + layer + '"]').addClass('active'); 132 | 133 | } else { 134 | 135 | if(self._getStatus(swapLayer.ID).on) { 136 | 137 | self._disableLayer(swapLayer.ID); 138 | 139 | self._$.find('li[data-layer="' + swapLayer.ID + '"]').removeClass('active'); 140 | 141 | } 142 | 143 | } 144 | }); 145 | this._update(); 146 | 147 | }, 148 | 149 | _disableLayer: function(layer) { 150 | 151 | this._layers.status[this._getStatusIndex(layer)] = { 152 | ID: layer, 153 | on: false 154 | }; 155 | 156 | }, 157 | 158 | _enableLayer: function(layer) { 159 | 160 | this._layers.status[this._getStatusIndex(layer)] = { 161 | ID: layer, 162 | on: true 163 | }; 164 | 165 | }, 166 | 167 | _update: function() { 168 | 169 | this._map.$.find('.map-tooltip').hide(); 170 | jeo.loadLayers(this._map, jeo.parseLayers(this._map, this._getActiveLayers())); 171 | 172 | }, 173 | 174 | _getStatus: function(layer) { 175 | return _.find(this._layers.status, function(l) { return layer == l.ID; }); 176 | }, 177 | 178 | _getStatusIndex: function(layer) { 179 | 180 | var index; 181 | _.each(this._layers.status, function(l, i) { 182 | if(layer == l.ID) 183 | index = i; 184 | }); 185 | return index; 186 | 187 | }, 188 | 189 | _getActiveLayers: function() { 190 | var self = this; 191 | var activeLayers = []; 192 | _.each(this._layers.status, function(layer) { 193 | if(layer.on) { 194 | var actualLayer = _.find(self._map.conf.layers, function(l) { return l.ID == layer.ID; }); 195 | activeLayers.push(actualLayer); 196 | } 197 | }); 198 | return activeLayers; 199 | 200 | } 201 | 202 | }); 203 | 204 | })(jQuery); 205 | -------------------------------------------------------------------------------- /inc/js/fullscreen.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 3 | jeo.fullscreen = L.Control.extend({ 4 | 5 | options: { 6 | position: 'topleft' 7 | }, 8 | 9 | onAdd: function(map) { 10 | 11 | this._container = L.DomUtil.create('div', 'jeo-fullscreen leaflet-bar leaflet-control'); 12 | this._$ = $(this._container); 13 | 14 | this._map = map; 15 | 16 | this._map.fullscreen = this; 17 | 18 | this._$.append(''); 19 | 20 | this._bindEvents(); 21 | 22 | return this._container; 23 | 24 | }, 25 | 26 | _bindEvents: function() { 27 | var self = this; 28 | 29 | this._$.click(function() { 30 | 31 | self.toggle(); 32 | return false; 33 | 34 | }); 35 | }, 36 | 37 | toggle: function() { 38 | 39 | var container; 40 | 41 | if(this._map.$.parents('.content-map').length) 42 | container = this._map.$.parents('.content-map'); 43 | else 44 | container = this._map.$.parents('.map-container'); 45 | 46 | if(container.hasClass('fullscreen-map')) { 47 | 48 | $('body').removeClass('map-fullscreen'); 49 | container.removeClass('fullscreen-map'); 50 | 51 | } else { 52 | 53 | $('body').addClass('map-fullscreen'); 54 | container.addClass('fullscreen-map'); 55 | 56 | } 57 | 58 | this._map.invalidateSize(true); 59 | 60 | } 61 | }); 62 | 63 | })(jQuery); -------------------------------------------------------------------------------- /inc/js/geocode.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 3 | jeo.geocode = L.Control.extend({ 4 | 5 | options: { 6 | position: 'topleft' 7 | }, 8 | 9 | onAdd: function(map) { 10 | 11 | var self = this; 12 | 13 | this._map = map; 14 | 15 | this._map.geocode = this; 16 | 17 | this._container = L.DomUtil.create('div', 'jeo-geocode'); 18 | 19 | this._$ = $(this._container); 20 | 21 | var map_id = map.map_id; 22 | var form = '
    '; 23 | 24 | this._$.append($(form)); 25 | 26 | this._resultsContainer = this._$.find('.geocode-results'); 27 | 28 | // bind submit event 29 | this._$.find('form').submit(function() { 30 | 31 | self._get($(this).find('input').val()); 32 | return false; 33 | 34 | }); 35 | 36 | return this._container; 37 | 38 | }, 39 | 40 | _submit: function() { 41 | 42 | this._get(this._$.find('input[type=text]').val()); 43 | return false; 44 | 45 | }, 46 | 47 | _get: function(search) { 48 | 49 | var self = this; 50 | 51 | if(typeof search == 'undefined') 52 | return; 53 | 54 | // nominatim query 55 | search = search.replace('%20','+'); 56 | var query = { 57 | q: search, 58 | polygon_geojson: 1, 59 | format: 'json' 60 | } 61 | 62 | // clear previous search on map 63 | this._clear(); 64 | 65 | // set query viewbox from map 66 | if(this._map.conf.bounds) { 67 | var viewbox = this._map.conf.bounds[0][1] + ',' + this._map.conf.bounds[1][0] + ',' + this._map.conf.bounds[1][1] + ',' + this._map.conf.bounds[0][0]; 68 | query.viewbox = viewbox; 69 | query.bounded = 1; 70 | } 71 | 72 | $.getJSON('//nominatim.openstreetmap.org/search.php?json_callback=?', query, function(data) { 73 | if(data.length) 74 | self._draw(data); 75 | else 76 | this._resultsContainer.append('' + jeo_labels.not_found + ''); 77 | }); 78 | 79 | }, 80 | 81 | _clear: function() { 82 | 83 | this._resultsContainer.empty(); 84 | 85 | if(this._resultsLayer) 86 | this._map.removeLayer(this._resultsLayer); 87 | 88 | }, 89 | 90 | _draw: function(data) { 91 | 92 | var self = this; 93 | 94 | /* 95 | * Map 96 | */ 97 | 98 | var geojson = { type: 'FeatureCollection', features: [] } 99 | 100 | $.each(data, function(i, r) { 101 | var item = { 102 | type: 'Feature', 103 | geometry: r.geojson, 104 | properties: { 105 | display_name: r.display_name 106 | } 107 | }; 108 | geojson.features.push(item); 109 | }); 110 | 111 | this._resultsLayer = L.geoJson(geojson, { 112 | onEachFeature: function(f, l) { 113 | l.bindPopup(f.properties.display_name); 114 | } 115 | }); 116 | 117 | this._resultsLayer.addTo(this._map); 118 | 119 | /* 120 | * List 121 | */ 122 | 123 | this._resultsContainer.empty(); 124 | this._resultsContainer.append('' + jeo_labels.clear_search + '' + jeo_labels.results_title + '