Changeset 1607853
- Timestamp:
- 03/04/2017 03:58:25 PM (9 years ago)
- Location:
- wp-geometa
- Files:
-
- 87 added
- 16 deleted
- 21 edited
-
assets/assets.svg (deleted)
-
assets/banner-1544x500-rtl.png (deleted)
-
assets/banner-1544x500.png (modified) (previous)
-
assets/banner-1880x609-rtl.png (deleted)
-
assets/banner-1880x609.png (deleted)
-
assets/banner-772x250-rtl.png (deleted)
-
assets/banner-772x250.png (modified) (previous)
-
assets/icon-128x128.png (modified) (previous)
-
assets/icon-256x256.png (modified) (previous)
-
assets/icon.svg (deleted)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
assets/screenshot-4.png (modified) (previous)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (added)
-
trunk/assets/assets.svg (deleted)
-
trunk/assets/banner-1544x500.png (added)
-
trunk/assets/banner-772x250.png (added)
-
trunk/assets/cimbura_logo.png (deleted)
-
trunk/assets/function_list.ods (deleted)
-
trunk/assets/github_banner.png (deleted)
-
trunk/assets/icon-128x128.png (added)
-
trunk/assets/icon-256x256.png (added)
-
trunk/assets/icon.png (deleted)
-
trunk/assets/leaflet (deleted)
-
trunk/assets/screenshot-1.png (added)
-
trunk/assets/screenshot-2.png (added)
-
trunk/assets/screenshot-3.png (added)
-
trunk/assets/screenshot-4.png (added)
-
trunk/assets/wheel.gif (deleted)
-
trunk/assets/wpgeometa.css (deleted)
-
trunk/assets/wpgeometa.js (deleted)
-
trunk/lang/wp-geometa-pt_BR.mo (modified) (previous)
-
trunk/lang/wp-geometa-pt_BR.po (modified) (19 diffs)
-
trunk/lib/leaflet-php (added)
-
trunk/lib/leaflet-php/README.md (added)
-
trunk/lib/leaflet-php/assets (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/MIT-LICENSE.md (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/layers-2x.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/layers.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/marker-icon-2x.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/marker-icon.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/marker-shadow.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/spritesheet-2x.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/spritesheet.png (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/images/spritesheet.svg (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/leaflet.draw-src.css (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/leaflet.draw-src.js (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/leaflet.draw-src.map (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/leaflet.draw.css (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/dist/leaflet.draw.js (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/docs (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/docs/highlight (added)
-
trunk/lib/leaflet-php/assets/Leaflet.draw/docs/highlight/LICENSE (added)
-
trunk/lib/leaflet-php/assets/VERSIONS.md (added)
-
trunk/lib/leaflet-php/assets/leaflet (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/LICENSE (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.css (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.mapbox.css (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.mapbox.min.css (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.mapbox.min.css.map (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.min.css (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.min.css.map (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.min.js (added)
-
trunk/lib/leaflet-php/assets/leaflet-locatecontrol/dist/L.Control.Locate.min.js.map (added)
-
trunk/lib/leaflet-php/assets/leaflet/images (added)
-
trunk/lib/leaflet-php/assets/leaflet/images/layers-2x.png (added)
-
trunk/lib/leaflet-php/assets/leaflet/images/layers.png (added)
-
trunk/lib/leaflet-php/assets/leaflet/images/marker-icon-2x.png (added)
-
trunk/lib/leaflet-php/assets/leaflet/images/marker-icon.png (added)
-
trunk/lib/leaflet-php/assets/leaflet/images/marker-shadow.png (added)
-
trunk/lib/leaflet-php/assets/leaflet/leaflet-src.js (added)
-
trunk/lib/leaflet-php/assets/leaflet/leaflet-src.map (added)
-
trunk/lib/leaflet-php/assets/leaflet/leaflet.css (added)
-
trunk/lib/leaflet-php/assets/leaflet/leaflet.js (added)
-
trunk/lib/leaflet-php/assets/leafletphp.css (added)
-
trunk/lib/leaflet-php/leaflet-php-loader.php (added)
-
trunk/lib/leaflet-php/leaflet-php.php (added)
-
trunk/lib/wp-geometa-dash.php (modified) (29 diffs)
-
trunk/lib/wp-geometa-lib/CHANGELOG.md (modified) (1 diff)
-
trunk/lib/wp-geometa-lib/HACKING.md (modified) (2 diffs)
-
trunk/lib/wp-geometa-lib/README.md (modified) (23 diffs)
-
trunk/lib/wp-geometa-lib/geoPHP/geoPHP.inc (modified) (1 diff)
-
trunk/lib/wp-geometa-lib/test (added)
-
trunk/lib/wp-geometa-lib/test/README.md (added)
-
trunk/lib/wp-geometa-lib/test/phpcbf_wordpress_lint.sh (added)
-
trunk/lib/wp-geometa-lib/test/phpcs_wordpress_lint.sh (added)
-
trunk/lib/wp-geometa-lib/test/syntax_check.sh (added)
-
trunk/lib/wp-geometa-lib/test/tests (added)
-
trunk/lib/wp-geometa-lib/test/tests/DeleteLatLngMeta.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/HandleMultiMetaClause.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/LoadDataTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/LoadLatLng.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/PopulateTable.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryOneGeomBoolTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryOneGeomInValTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryOneGeomValTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryOrderByDistance.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryOrderByTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/QueryTwoGeomBoolTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/TablesCreatedTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/UnloadDataTest.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/__SqlFormatter.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/__load.php (added)
-
trunk/lib/wp-geometa-lib/test/tests/data.geojson (added)
-
trunk/lib/wp-geometa-lib/test/testsuite.php (added)
-
trunk/lib/wp-geometa-lib/wp-geometa-lib-loader.php (modified) (3 diffs)
-
trunk/lib/wp-geometa-lib/wp-geometa-lib.php (added)
-
trunk/lib/wp-geometa-lib/wp-geometa.php (modified) (15 diffs)
-
trunk/lib/wp-geometa-lib/wp-geoutil.php (modified) (23 diffs)
-
trunk/media (added)
-
trunk/media/luminfire_logo.png (added)
-
trunk/media/wheel.gif (added)
-
trunk/media/wpgeometa.css (added)
-
trunk/media/wpgeometa.js (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/test (deleted)
-
trunk/wp-geometa.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-geometa/trunk/CHANGELOG.md
r1557784 r1607853 1 1 Changes 2 2 ------- 3 4 ### 0.3.2 5 * Update to wp-geometa-lib 0.3.2. 6 * Updated internal filter callback function names to match the filter they're for. 7 * Updated branding to reflect company name change. 8 * Updated handling if submodules aren't checked out. 3 9 4 10 ### 0.3.1 -
wp-geometa/trunk/lang/wp-geometa-pt_BR.po
r1488557 r1607853 2 2 msgstr "" 3 3 "Project-Id-Version: WP-GeoMeta\n" 4 "POT-Creation-Date: 201 6-08-24 11:43-0500\n"5 "PO-Revision-Date: 201 6-08-24 11:47-0500\n"4 "POT-Creation-Date: 2017-03-01 02:08-0600\n" 5 "PO-Revision-Date: 2017-03-01 02:08-0600\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.8. 8\n"12 "X-Generator: Poedit 1.8.11\n" 13 13 "X-Poedit-Basepath: ..\n" 14 14 "Plural-Forms: nplurals=2; plural=(n > 1);\n" … … 19 19 "X-Poedit-SearchPath-1: .\n" 20 20 21 #: lib/wp-geometa-dash.php: 4521 #: lib/wp-geometa-dash.php:54 22 22 msgid "Spatial Relationship Tests" 23 23 msgstr "Testes Relação Espacial" 24 24 25 #: lib/wp-geometa-dash.php: 4625 #: lib/wp-geometa-dash.php:55 26 26 msgid "Test topological relationships between two geometries." 27 27 msgstr "Teste relações topológicas entre duas geometrias." 28 28 29 #: lib/wp-geometa-dash.php:8 029 #: lib/wp-geometa-dash.php:89 30 30 msgid "Geometry Properties" 31 31 msgstr "Propriedades de Geometria" 32 32 33 #: lib/wp-geometa-dash.php: 8133 #: lib/wp-geometa-dash.php:90 34 34 msgid "Analyize spatial properties of a single geometry." 35 35 msgstr "Analisar propriedades de uma geometria." 36 36 37 #: lib/wp-geometa-dash.php:1 0437 #: lib/wp-geometa-dash.php:113 38 38 msgid "Geometry Disection" 39 39 msgstr "Dissecação de Geometria" 40 40 41 #: lib/wp-geometa-dash.php:1 0541 #: lib/wp-geometa-dash.php:114 42 42 msgid "Investigate the type and sub-parts of a geometry." 43 43 msgstr "Pesquisar o tipo e sub-partes de uma geometria." 44 44 45 #: lib/wp-geometa-dash.php:1 3545 #: lib/wp-geometa-dash.php:144 46 46 msgid "Generate new Geometry" 47 47 msgstr "Gerar novo Geometria" 48 48 49 #: lib/wp-geometa-dash.php:1 3649 #: lib/wp-geometa-dash.php:145 50 50 msgid "" 51 51 "Create a new geometry based on existing geometries and spatial operations." … … 54 54 "espaciais." 55 55 56 #: lib/wp-geometa-dash.php:1 5756 #: lib/wp-geometa-dash.php:166 57 57 msgid "Data Format Helpers" 58 58 msgstr "Ajudantes de Formatar Dados" 59 59 60 #: lib/wp-geometa-dash.php:1 5860 #: lib/wp-geometa-dash.php:167 61 61 msgid "Create or convert geometries from various input and output formats." 62 62 msgstr "Criar ou converter geometrias de vários formas de entrada e saída." 63 63 64 #: lib/wp-geometa-dash.php:2 2964 #: lib/wp-geometa-dash.php:238 65 65 msgid "Miscellaneous Functions" 66 66 msgstr "Funções Diversas" 67 67 68 #: lib/wp-geometa-dash.php:23 068 #: lib/wp-geometa-dash.php:239 69 69 msgid "Other little-used functions." 70 70 msgstr "Outros funções poucos usados." 71 71 72 #: lib/wp-geometa-dash.php:296 72 #: lib/wp-geometa-dash.php:252 73 msgid "Custom Functions" 74 msgstr "" 75 76 #: lib/wp-geometa-dash.php:253 77 msgid "" 78 "These are custom functions, usually written in SQL using `CREATE FUNCTION` " 79 "statements. They will probably be slower than native functions." 80 msgstr "" 81 82 #: lib/wp-geometa-dash.php:317 73 83 #, php-format 74 84 msgid "Are you sure you want to %1$s?" 75 85 msgstr "Tem certeza que você quer %1$s?" 76 86 77 #: lib/wp-geometa-dash.php:3 2287 #: lib/wp-geometa-dash.php:343 78 88 msgid "Your Data" 79 89 msgstr "Seus Dados" 80 90 81 #: lib/wp-geometa-dash.php:3 23 lib/wp-geometa-dash.php:86082 #: lib/wp-geometa-dash.php: 88991 #: lib/wp-geometa-dash.php:344 lib/wp-geometa-dash.php:917 92 #: lib/wp-geometa-dash.php:946 83 93 msgid "Quick Start" 84 94 msgstr "Inicio Rapido" 85 95 86 #: lib/wp-geometa-dash.php:3 2496 #: lib/wp-geometa-dash.php:345 87 97 msgid "Your Functions" 88 98 msgstr "Seus Funções" 89 99 90 #: lib/wp-geometa-dash.php:3 25100 #: lib/wp-geometa-dash.php:346 91 101 msgid "Resources" 92 102 msgstr "Recursos" 93 103 94 #: lib/wp-geometa-dash.php:3 26 lib/wp-geometa-dash.php:860104 #: lib/wp-geometa-dash.php:347 lib/wp-geometa-dash.php:917 95 105 msgid "System Status" 96 106 msgstr "Status do Sistema" 97 107 98 #: lib/wp-geometa-dash.php: 390108 #: lib/wp-geometa-dash.php:411 99 109 msgid "Geo Tables Exist!" 100 110 msgstr "Tabelas Geo Existem!" 101 111 102 #: lib/wp-geometa-dash.php: 390112 #: lib/wp-geometa-dash.php:411 103 113 msgid "All geometa tables exist." 104 114 msgstr "Todos as tabelas de geometa existem." 105 115 106 #: lib/wp-geometa-dash.php: 392116 #: lib/wp-geometa-dash.php:413 107 117 msgid "Some Geo Tables Exist" 108 118 msgstr "Algumas Tabelas Geo Existem" 109 119 110 #: lib/wp-geometa-dash.php: 392120 #: lib/wp-geometa-dash.php:413 111 121 #, php-format 112 122 msgid "" … … 117 127 "ter uma problema. %1$s existem. %2$s não existem." 118 128 119 #: lib/wp-geometa-dash.php: 394129 #: lib/wp-geometa-dash.php:415 120 130 msgid "No Geo Tables Exist!" 121 131 msgstr "Nenhum Tabela Geo Existe!" 122 132 123 #: lib/wp-geometa-dash.php: 394133 #: lib/wp-geometa-dash.php:415 124 134 msgid "" 125 135 "No geo tables exist. You can try recreating them with the tools at the " … … 129 139 "deste pagina." 130 140 131 #: lib/wp-geometa-dash.php:4 18141 #: lib/wp-geometa-dash.php:439 132 142 msgid "Geo Tables Indexed!" 133 143 msgstr "Tabelas Geo Indexado!" 134 144 135 #: lib/wp-geometa-dash.php:4 18145 #: lib/wp-geometa-dash.php:439 136 146 #, php-format 137 147 msgid "All %1$s geometa tables have spatial indexes" 138 148 msgstr "Todas as %1$s tabelas geometa tem índices espaciais" 139 149 140 #: lib/wp-geometa-dash.php:4 20150 #: lib/wp-geometa-dash.php:441 141 151 msgid "Some Geo Tables Not Indexed" 142 152 msgstr "Algumas tabelas geo não indexados" 143 153 144 #: lib/wp-geometa-dash.php:4 20154 #: lib/wp-geometa-dash.php:441 145 155 #, php-format 146 156 msgid "" … … 151 161 "lento nos seguintes tabelas: %1$s" 152 162 153 #: lib/wp-geometa-dash.php:4 22163 #: lib/wp-geometa-dash.php:443 154 164 msgid "No Spatial Indexes!" 155 165 msgstr "Nenhum Índice Espacial!" 156 166 157 #: lib/wp-geometa-dash.php:4 22167 #: lib/wp-geometa-dash.php:443 158 168 msgid "No spatial indexes found. Spatial queries will be slow." 159 169 msgstr "Nenhum Índice espacial encontrado. Pesquisas espaciais vão ser lentos." 160 170 161 #: lib/wp-geometa-dash.php:4 36171 #: lib/wp-geometa-dash.php:457 162 172 msgid "Good Database Version!" 163 173 msgstr "Banco de Dados Versão Boa!" 164 174 165 #: lib/wp-geometa-dash.php:4 36175 #: lib/wp-geometa-dash.php:457 166 176 #, php-format 167 177 msgid "" … … 171 181 "Seu versão de banco de dados (%1$s) suporte vários funções espaciais úteis." 172 182 173 #: lib/wp-geometa-dash.php:4 38183 #: lib/wp-geometa-dash.php:459 174 184 msgid "OK Database Version" 175 185 msgstr "Banco de Dados Versão OK" 176 186 177 #: lib/wp-geometa-dash.php:4 38187 #: lib/wp-geometa-dash.php:459 178 188 #, php-format 179 189 msgid "" … … 186 196 "ou MariaDB 5.3.3 ou superior." 187 197 188 #: lib/wp-geometa-dash.php:4 40198 #: lib/wp-geometa-dash.php:461 189 199 msgid "Bad Database Version!" 190 200 msgstr "Banco de Dados Versão Ruim!" 191 201 192 #: lib/wp-geometa-dash.php:4 40202 #: lib/wp-geometa-dash.php:461 193 203 #, php-format 194 204 msgid "" … … 199 209 "não poderia guardar ou utilizar dados espaciais." 200 210 201 #: lib/wp-geometa-dash.php:461 211 #: lib/wp-geometa-dash.php:495 212 msgid "Odd Situation!" 213 msgstr "" 214 215 #: lib/wp-geometa-dash.php:495 216 #, php-format 217 msgid "" 218 "You have the latest version of WP-GeoMeta, but another plugin is providing " 219 "an older version WP-GeoMeta-Lib Please update the plugin(s) not providing " 220 "version %1$s in the list below!" 221 msgstr "" 222 223 #: lib/wp-geometa-dash.php:500 202 224 msgid "Up To Date!" 203 225 msgstr "Atualizado!" 204 226 205 #: lib/wp-geometa-dash.php: 461206 #, php-format 207 msgid "You are running the most recent version of WP GeoMeta(%1$s)."208 msgstr " Você esta usando o versão mais recente de WP GeoMeta (%1$s)."209 210 #: lib/wp-geometa-dash.php: 463227 #: lib/wp-geometa-dash.php:500 228 #, php-format 229 msgid "You are using the most recent version of WP-GeoMeta-Lib (%1$s)." 230 msgstr "" 231 232 #: lib/wp-geometa-dash.php:506 211 233 msgid "Out Of Date." 212 234 msgstr "Desactualizado." 213 235 214 #: lib/wp-geometa-dash.php:463 215 #, php-format 216 msgid "" 217 "A plugin you are using is providing the most recent version of the WP " 218 "GeoMeta library (%1$s), but this plugin is out of date." 219 msgstr "" 220 "Um plugin você esta usando esta providenciando o versão mais recente do " 221 "módulo WP GeoMeta (%1$s), mas este plugin esta desactualizado." 222 223 #: lib/wp-geometa-dash.php:465 236 #: lib/wp-geometa-dash.php:506 237 #, php-format 238 msgid "" 239 "A plugin you are using is providing the most recent version of the WP-" 240 "GeoMeta-Lib (%1$s), but this plugin is out of date." 241 msgstr "" 242 243 #: lib/wp-geometa-dash.php:511 224 244 msgid "Out Of Date!" 225 245 msgstr "Desactualizado!" 226 246 227 #: lib/wp-geometa-dash.php:465 228 #, php-format 229 msgid "" 230 "You are running an outdated version of WP GeoMeta (%1$s). Please upgrade!" 231 msgstr "" 232 "Você esta usando um versão desatualizado de WP GeoMeta (%1$s). Atualiza " 233 "porfavor!" 234 235 #: lib/wp-geometa-dash.php:518 247 #: lib/wp-geometa-dash.php:511 248 #, php-format 249 msgid "" 250 "You are running an outdated version of WP-GeoMeta-Lib (%1$s). Please upgrade " 251 "to %2$s!" 252 msgstr "" 253 254 #: lib/wp-geometa-dash.php:564 236 255 msgid "All Spatial Data Loaded!" 237 256 msgstr "Todos os dados espaciais carregado!" 238 257 239 #: lib/wp-geometa-dash.php:5 18258 #: lib/wp-geometa-dash.php:564 240 259 #, php-format 241 260 msgid "All %1$s spatial records are loaded!" 242 261 msgstr "Todos os %1$s recordes espaciais foram carregado!" 243 262 244 #: lib/wp-geometa-dash.php:5 20263 #: lib/wp-geometa-dash.php:566 245 264 msgid "Some Spatial Data Loaded" 246 265 msgstr "Algumas dados espaciais carregado!" 247 266 248 #: lib/wp-geometa-dash.php:5 20267 #: lib/wp-geometa-dash.php:566 249 268 #, php-format 250 269 msgid "" … … 255 274 "carregados). Tenta usa o ferimento %3$s%4$s%5$s para carregá-los." 256 275 257 #: lib/wp-geometa-dash.php:5 20 lib/wp-geometa-dash.php:522258 #: lib/wp-geometa-dash.php:1 061259 msgid "Populate WP GeoMeta Tables"260 msgstr " Popular as tabelas WP GeoMeta"261 262 #: lib/wp-geometa-dash.php:5 22276 #: lib/wp-geometa-dash.php:566 lib/wp-geometa-dash.php:568 277 #: lib/wp-geometa-dash.php:1124 278 msgid "Populate WP-GeoMeta Tables" 279 msgstr "" 280 281 #: lib/wp-geometa-dash.php:568 263 282 msgid "No Spatial Data Loaded!" 264 283 msgstr "Nenhum Dados Espacial Carregado!" 265 284 266 #: lib/wp-geometa-dash.php:5 22285 #: lib/wp-geometa-dash.php:568 267 286 #, php-format 268 287 msgid "" … … 273 292 "ferramenta %1$s%2$s%3$s em baixo para carregar os dados." 274 293 275 #: lib/wp-geometa-dash.php:802 276 msgid "The WP GeoMeta tables should be gone now." 277 msgstr "As tabelas WP GeoMeta devem ser ido agora." 278 279 #: lib/wp-geometa-dash.php:807 280 msgid "The WP GeoMeta tables should exist now." 281 msgstr "As tabelas WP GeoMeta devem existir agora." 282 283 #: lib/wp-geometa-dash.php:812 284 msgid "The WP GeoMeta tables should be empty now." 285 msgstr "As tabelas WP GeoMeta devem estar vazios agora." 286 287 #: lib/wp-geometa-dash.php:818 288 msgid "The WP GeoMeta tables should be populated now." 289 msgstr "As tabelas WP GeoMeta devem estar preenchido agora." 290 291 #: lib/wp-geometa-dash.php:821 294 #: lib/wp-geometa-dash.php:847 295 msgid "The WP-GeoMeta tables should be gone now." 296 msgstr "" 297 298 #: lib/wp-geometa-dash.php:852 299 msgid "The WP-GeoMeta tables and functions should exist now." 300 msgstr "" 301 302 #: lib/wp-geometa-dash.php:857 303 msgid "The WP-GeoMeta tables should be empty now." 304 msgstr "" 305 306 #: lib/wp-geometa-dash.php:863 307 msgid "The WP-GeoMeta tables should be populated now." 308 msgstr "" 309 310 #: lib/wp-geometa-dash.php:867 311 msgid "The cache of spatial functions should be rebuilt now." 312 msgstr "" 313 314 #: lib/wp-geometa-dash.php:870 292 315 msgid "I don't understand what I'm supposed to do." 293 316 msgstr "Eu não entendo que eu devo fazer." 294 317 295 #: lib/wp-geometa-dash.php: 854318 #: lib/wp-geometa-dash.php:903 296 319 msgid "Your Spatial Data" 297 320 msgstr "Seus Dados Espaciais." 298 321 299 #: lib/wp-geometa-dash.php: 855322 #: lib/wp-geometa-dash.php:912 300 323 msgid "Found Spatial Metadata Types" 301 324 msgstr "Tipos de Metadados Espaciais Encontrados" 302 325 303 #: lib/wp-geometa-dash.php: 860326 #: lib/wp-geometa-dash.php:917 304 327 #, php-format 305 328 msgid "" … … 312 335 "%6$s." 313 336 314 #: lib/wp-geometa-dash.php: 863337 #: lib/wp-geometa-dash.php:920 315 338 msgid "Type" 316 339 msgstr "Tipo" 317 340 318 #: lib/wp-geometa-dash.php: 864341 #: lib/wp-geometa-dash.php:921 319 342 msgid "Meta Key" 320 343 msgstr "Chave Meta" 321 344 322 #: lib/wp-geometa-dash.php: 865345 #: lib/wp-geometa-dash.php:922 323 346 msgid "Number of Records" 324 347 msgstr "Número de Recordes" 325 348 326 #: lib/wp-geometa-dash.php: 866349 #: lib/wp-geometa-dash.php:923 327 350 msgid "View Sample Data (500 records max)" 328 351 msgstr "Veja Amostra De Dados (500 recordes no máximo)" 329 352 330 #: lib/wp-geometa-dash.php: 874353 #: lib/wp-geometa-dash.php:931 331 354 msgid "View Data" 332 355 msgstr "Veja Dados" 333 356 334 #: lib/wp-geometa-dash.php:891 335 msgid "" 336 "WP GeoMeta uses the standard WordPress metadata functions. If you are " 337 "familiar with these functions, you already know how to use WP GeoMeta." 338 msgstr "" 339 "WP GeoMeta usa os funções WordPress metadata padrão. Se você já tem " 340 "familiaridade com estes funções, você ja sabe como usar o WP GeoMeta." 341 342 #: lib/wp-geometa-dash.php:893 343 msgid "" 344 "WP GeoMeta watches for GeoJSON metadata values being saved to the database. " 357 #: lib/wp-geometa-dash.php:948 358 msgid "" 359 "WP-GeoMeta uses the standard WordPress metadata functions. If you are " 360 "familiar with these functions, you already know how to use WP-GeoMeta." 361 msgstr "" 362 363 #: lib/wp-geometa-dash.php:950 364 msgid "" 365 "WP-GeoMeta watches for GeoJSON metadata values being saved to the database. " 345 366 "It saves the GeoJSON like WordPress expects, but also converts the GeoJSON " 346 367 "into a spatial format MySQL understands and saves that to special geo-meta " 347 368 "tables which can handle spatial data and which have spatial indexes." 348 369 msgstr "" 349 "WP GeoMeta fica de olho para valores metadados tipo GeoJSON sendo guardados " 350 "no banco de dados. O escreve o GeoJSON como WordPress espera, mas também " 351 "converta o GeoJSON em um formato espaciais que MySQL compreende, e guarda " 352 "aquele em tabelas especiais de geo-meta que podem utilizar dados espaciais e " 353 "que tem índices espaciais." 354 355 #: lib/wp-geometa-dash.php:895 370 371 #: lib/wp-geometa-dash.php:952 356 372 msgid "Adding and Updating Data" 357 373 msgstr "Adição e Atualização de Dados" 358 374 359 #: lib/wp-geometa-dash.php: 896375 #: lib/wp-geometa-dash.php:953 360 376 msgid "" 361 377 "To add spatial data, use the usual add_post_meta or update_post_meta " … … 367 383 "GeoJSON para o valor. " 368 384 369 #: lib/wp-geometa-dash.php:9 09385 #: lib/wp-geometa-dash.php:966 370 386 msgid "Fetching and Using Data" 371 387 msgstr "Buscando e Usando Dados" 372 388 373 #: lib/wp-geometa-dash.php:9 11374 msgid "" 375 "WP GeoMeta doesn't do anything when fetching data. You will get back the "389 #: lib/wp-geometa-dash.php:968 390 msgid "" 391 "WP-GeoMeta doesn't do anything when fetching data. You will get back the " 376 392 "same GeoJSON value that you stored previously." 377 393 msgstr "" 378 "WP GeoMeta não faz nada quando buscando dados. Você receberá o mesmo valor " 379 "de GeoJSON que você adicionou anteriormente." 380 381 #: lib/wp-geometa-dash.php:912 394 395 #: lib/wp-geometa-dash.php:969 382 396 msgid "" 383 397 "GeoJSON can be used by any of the popular web map software available today." … … 386 400 "hoje." 387 401 388 #: lib/wp-geometa-dash.php:9 20402 #: lib/wp-geometa-dash.php:977 389 403 msgid "Running Spatial Queries" 390 404 msgstr "Executando Consultas Espaciais" 391 405 392 #: lib/wp-geometa-dash.php:9 22406 #: lib/wp-geometa-dash.php:979 393 407 msgid "" 394 408 "The real power of GIS and Spatial data becomes evident when you start doing " 395 "real spatial searches. WP GeoMeta integrates with WP_Query, get_posts and "409 "real spatial searches. WP-GeoMeta integrates with WP_Query, get_posts and " 396 410 "other functions that use WP_Meta_Query under the hood." 397 411 msgstr "" 398 "O verdadero pode de SIG e dados espaciais se tornam evidente quando você " 399 "começa a fazer buscas espaciais reais. WP GeoMeta integra com WP_Query, " 400 "get_posts e outros funções que usam WP_Meta_Query sob o capô." 401 402 #: lib/wp-geometa-dash.php:961 412 413 #: lib/wp-geometa-dash.php:1018 403 414 msgid "Available Spatial Functions" 404 415 msgstr "Funções Espaciais Disponíveis" 405 416 406 #: lib/wp-geometa-dash.php: 962417 #: lib/wp-geometa-dash.php:1019 407 418 msgid "These functions are available in this version of MySQL." 408 419 msgstr "Estes funções estão disponíveis em este versão de MySQL." 409 420 410 #: lib/wp-geometa-dash.php: 963421 #: lib/wp-geometa-dash.php:1020 411 422 #, php-format 412 423 msgid "" … … 419 430 "um analise completa." 420 431 421 #: lib/wp-geometa-dash.php: 964432 #: lib/wp-geometa-dash.php:1021 422 433 msgid "Function Group" 423 434 msgstr "Grupo de Funções" 424 435 425 #: lib/wp-geometa-dash.php: 964436 #: lib/wp-geometa-dash.php:1021 426 437 msgid "Functions" 427 438 msgstr "Funções" 428 439 429 #: lib/wp-geometa-dash.php: 978440 #: lib/wp-geometa-dash.php:1035 430 441 msgid "List of Installs" 431 442 msgstr "Lista de Instalações" 432 443 433 #: lib/wp-geometa-dash.php:979 434 msgid "" 435 "WP GeoMeta can be installed as a plugin or used as a library by other " 436 "plugins. This list includes all installed versions of WP GeoMeta and which " 437 "plugin they came with." 438 msgstr "" 439 "WP GeoMeta pode ser instalado como um plugin ou utilizado como um biblioteca " 440 "por outros plugins. Este lista inclui todos os versões de WP GeoMeta " 441 "installados e com qual plugin eles foram incluídos." 442 443 #: lib/wp-geometa-dash.php:980 444 msgid "" 445 "WP GeoMeta always uses the most up to date version installed, even if a " 444 #: lib/wp-geometa-dash.php:1036 445 msgid "" 446 "The WP-GeoMeta-Lib library may be used by multiple plugins. This list " 447 "includes all installed versions of WP-GeoMeta-Lib and which plugin they came " 448 "with." 449 msgstr "" 450 451 #: lib/wp-geometa-dash.php:1037 452 msgid "" 453 "WP-GeoMeta always uses the most up to date version installed, even if a " 446 454 "plugin bundles an older version." 447 455 msgstr "" 448 "WP GeoMeta sempre usa o versão mais recente instalado, mesmo se um plugin " 449 "inclue um versão mais velho." 450 451 #: lib/wp-geometa-dash.php:982 456 457 #: lib/wp-geometa-dash.php:1039 452 458 msgid "Plugin Name" 453 459 msgstr "Nome do Plugin" 454 460 455 #: lib/wp-geometa-dash.php:982 456 msgid "WP GeoMeta Version" 457 msgstr "Versão de WP GeoMeta" 458 459 #: lib/wp-geometa-dash.php:995 460 msgid "WP GeoMeta Meta and Resources" 461 msgstr "WP GeoMeta Meta e Recursos" 462 463 #: lib/wp-geometa-dash.php:998 464 #, php-format 465 msgid "" 466 "WP GeoMeta is a work of love from the GIS+WordPress development team at %1$s" 467 msgstr "" 468 "WP GeoMeta é um obra de amor to time de desenvolvimento de GIS+WordPress de " 469 "%1$s." 470 471 #: lib/wp-geometa-dash.php:1000 461 #: lib/wp-geometa-dash.php:1039 462 msgid "WP-GeoMeta Version" 463 msgstr "" 464 465 #: lib/wp-geometa-dash.php:1058 466 msgid "WP-GeoMeta Meta and Resources" 467 msgstr "" 468 469 #: lib/wp-geometa-dash.php:1061 470 #, php-format 471 msgid "" 472 "WP-GeoMeta is a work of love from the GIS+WordPress development team at %1$s" 473 msgstr "" 474 475 #: lib/wp-geometa-dash.php:1063 472 476 #, php-format 473 477 msgid "" … … 478 482 "requests (especialmente com casos teste)%4$s." 479 483 480 #: lib/wp-geometa-dash.php:10 02484 #: lib/wp-geometa-dash.php:1065 481 485 #, php-format 482 486 msgid "" … … 487 491 "contacta%2$s com detalhes sobre que você quer fazer." 488 492 489 #: lib/wp-geometa-dash.php:10 05493 #: lib/wp-geometa-dash.php:1068 490 494 msgid "Our Sites" 491 495 msgstr "Nossos Sites" 492 496 493 #: lib/wp-geometa-dash.php:10 07497 #: lib/wp-geometa-dash.php:1070 494 498 msgid "Our home on the web" 495 499 msgstr "Nossa lar no web" 496 500 497 #: lib/wp-geometa-dash.php:1008 498 msgid "WP GeoMeta on GitHub" 499 msgstr "WP GeoMeta no GitHub" 500 501 #: lib/wp-geometa-dash.php:1009 502 msgid "WherePress.com — Our WordPress/GIS Blog Site" 503 msgstr "WherePress.com — Nossa Blog de WordPress/SIG " 504 505 #: lib/wp-geometa-dash.php:1012 501 #: lib/wp-geometa-dash.php:1071 502 msgid "WP-GeoMeta on GitHub" 503 msgstr "" 504 505 #: lib/wp-geometa-dash.php:1075 506 506 msgid "Documentation" 507 507 msgstr "Documentação" 508 508 509 #: lib/wp-geometa-dash.php:10 14509 #: lib/wp-geometa-dash.php:1077 510 510 msgid "MySQL (5.7) Spatial Analysis Functions Documentation" 511 511 msgstr "Documentação de Funções de Analise Espacial de MySQL (5.7)" 512 512 513 #: lib/wp-geometa-dash.php:10 15513 #: lib/wp-geometa-dash.php:1078 514 514 msgid "MariaDB Geographic Features Documentation" 515 515 msgstr "Documentação de Objectos Geográficas MariaDB" 516 516 517 #: lib/wp-geometa-dash.php:10 16517 #: lib/wp-geometa-dash.php:1079 518 518 msgid "MySQL/MariaDB Spatial Support Matrix" 519 519 msgstr "Matriz de Apoio Espacial MySQL/MariaDB" 520 520 521 #: lib/wp-geometa-dash.php:10 17521 #: lib/wp-geometa-dash.php:1080 522 522 #, php-format 523 523 msgid "%1$sAdd%2$s, %3$sUpdate%4$s and %5$sDelete%6$s post meta" 524 524 msgstr "%1$sAdicionar%2$s, %3$sAtualizar%4$s e %5$sDelete%6$s post meta" 525 525 526 #: lib/wp-geometa-dash.php:10 18526 #: lib/wp-geometa-dash.php:1081 527 527 #, php-format 528 528 msgid "%1$sWP_Query%2$s and %3$sWP_Meta_Query%4$s" 529 529 msgstr "%1$sWP_Query%2$s e %3$sWP_Meta_Query%4$s" 530 530 531 #: lib/wp-geometa-dash.php:10 19531 #: lib/wp-geometa-dash.php:1082 532 532 msgid "GeoJSON Specification" 533 533 msgstr "Specificação GeoJSON" 534 534 535 #: lib/wp-geometa-dash.php:10 20535 #: lib/wp-geometa-dash.php:1083 536 536 msgid "Leaflet.js - Our recommended map software" 537 537 msgstr "Leaflet.js - Nosso software de mapas recomendado" 538 538 539 #: lib/wp-geometa-dash.php:10 23539 #: lib/wp-geometa-dash.php:1086 540 540 msgid "GIS Communities" 541 541 msgstr "Communidades SIG" 542 542 543 #: lib/wp-geometa-dash.php:10 25543 #: lib/wp-geometa-dash.php:1088 544 544 msgid "GIS StackExchange" 545 545 msgstr "StackExchange SIG" 546 546 547 #: lib/wp-geometa-dash.php:10 35547 #: lib/wp-geometa-dash.php:1098 548 548 msgid "The Danger Zone" 549 549 msgstr "Zona Perigosa" 550 550 551 #: lib/wp-geometa-dash.php:1 037551 #: lib/wp-geometa-dash.php:1100 552 552 #, php-format 553 553 msgid "" … … 561 561 "os existem." 562 562 563 #: lib/wp-geometa-dash.php:1 040563 #: lib/wp-geometa-dash.php:1103 564 564 msgid "Enter The Danger Zone" 565 565 msgstr "Entre a Zona Perigosa" 566 566 567 #: lib/wp-geometa-dash.php:1 045567 #: lib/wp-geometa-dash.php:1108 568 568 msgid "Run Regression Tests" 569 569 msgstr "Corre Provas de Regressão" 570 570 571 #: lib/wp-geometa-dash.php:1046 572 msgid "Run the built-in regression tests" 573 msgstr "Corre as provas de regressão integral." 574 575 #: lib/wp-geometa-dash.php:1049 576 msgid "Remove WP GeoMeta Tables" 577 msgstr "Remover Tabelas WP GeoMeta" 578 579 #: lib/wp-geometa-dash.php:1050 580 msgid "" 581 "All WP GeoMeta data is stored in its own tables. Your original data is " 582 "untouched. Removing WP GeoMeta tables will break any spatial queries you may " 571 #: lib/wp-geometa-dash.php:1109 572 msgid "" 573 "Run the built-in regression tests against the in-use vesion of WP-GeoMeta-Lib" 574 msgstr "" 575 576 #: lib/wp-geometa-dash.php:1112 577 msgid "Remove WP-GeoMeta Tables" 578 msgstr "" 579 580 #: lib/wp-geometa-dash.php:1113 581 msgid "" 582 "All WP-GeoMeta data is stored in its own tables. Your original data is " 583 "untouched. Removing WP-GeoMeta tables will break any spatial queries you may " 583 584 "be using." 584 585 msgstr "" 585 "Todos os dados de WP GeoMeta estão salvados em seus próprios tabelas. Seus " 586 "dados originais não é modificados. Apagando as tabelas WP GeoMeta vai " 587 "quebrar qualquer pesquisas espaciais você pode estar usando." 588 589 #: lib/wp-geometa-dash.php:1053 590 msgid "Create WP GeoMeta Tables" 591 msgstr "Criar Tabelas WP GeoMeta" 592 593 #: lib/wp-geometa-dash.php:1054 594 msgid "" 595 "WP GeoMeta tables are created on plugin activation or upgrade, but you can " 596 "manually create them here. WP GeoMeta uses dbDelta, so running this multiple " 586 587 #: lib/wp-geometa-dash.php:1116 588 msgid "Create WP-GeoMeta Tables and Functions" 589 msgstr "" 590 591 #: lib/wp-geometa-dash.php:1117 592 msgid "" 593 "WP-GeoMeta tables are created on plugin activation or upgrade, but you can " 594 "manually create them here. WP-GeoMeta uses dbDelta, so running this multiple " 597 595 "times will have no bad effects." 598 596 msgstr "" 599 "Tabelas WP GeoMeta estão criados quando o plugin esta activado ou " 600 "atualizado, mas você pode as criar aqui manualmente. WP GeoMeta usa dbDelta, " 601 "então fazendo isso vários vezes não teria efeitos maus." 602 603 #: lib/wp-geometa-dash.php:1057 604 msgid "Truncate WP GeoMeta Tables" 605 msgstr "Truncar Tabelas WP GeoMeta" 606 607 #: lib/wp-geometa-dash.php:1058 597 598 #: lib/wp-geometa-dash.php:1120 599 msgid "Truncate WP-GeoMeta Tables" 600 msgstr "" 601 602 #: lib/wp-geometa-dash.php:1121 608 603 msgid "Clears existing spatial data, but doesn't remove the tables." 609 604 msgstr "Apagar dados espaciais atuais, mas não apagar as tabelas." 610 605 611 #: lib/wp-geometa-dash.php:1 062606 #: lib/wp-geometa-dash.php:1125 612 607 msgid "" 613 608 "Detect any spatial data (GeoJSON) in the non-spatial meta tables which is " 614 "not stored in WP GeoMeta and load it. This may take a while!" 615 msgstr "" 616 "Detectar dados espaciais (GeoJSON) nas tabelas meta não-espaciais que não " 617 "esta salvado em WP GeoMeta, e carregá-lo. Este ação pode demorar!" 609 "not stored in WP-GeoMeta and load it. This may take a while!" 610 msgstr "" 611 612 #: lib/wp-geometa-dash.php:1128 613 msgid "Rebuild spatial function cache" 614 msgstr "" 615 616 #: lib/wp-geometa-dash.php:1129 617 msgid "Re-check and cache which MySQL spatial functions are supported." 618 msgstr "" 619 620 #~ msgid "You are running the most recent version of WP GeoMeta (%1$s)." 621 #~ msgstr "Você esta usando o versão mais recente de WP GeoMeta (%1$s)." 622 623 #~ msgid "" 624 #~ "A plugin you are using is providing the most recent version of the WP " 625 #~ "GeoMeta library (%1$s), but this plugin is out of date." 626 #~ msgstr "" 627 #~ "Um plugin você esta usando esta providenciando o versão mais recente do " 628 #~ "módulo WP GeoMeta (%1$s), mas este plugin esta desactualizado." 629 630 #~ msgid "" 631 #~ "You are running an outdated version of WP GeoMeta (%1$s). Please upgrade!" 632 #~ msgstr "" 633 #~ "Você esta usando um versão desatualizado de WP GeoMeta (%1$s). Atualiza " 634 #~ "porfavor!" 635 636 #~ msgid "Populate WP GeoMeta Tables" 637 #~ msgstr "Popular as tabelas WP GeoMeta" 638 639 #~ msgid "The WP GeoMeta tables should be gone now." 640 #~ msgstr "As tabelas WP GeoMeta devem ser ido agora." 641 642 #~ msgid "The WP GeoMeta tables should exist now." 643 #~ msgstr "As tabelas WP GeoMeta devem existir agora." 644 645 #~ msgid "The WP GeoMeta tables should be empty now." 646 #~ msgstr "As tabelas WP GeoMeta devem estar vazios agora." 647 648 #~ msgid "The WP GeoMeta tables should be populated now." 649 #~ msgstr "As tabelas WP GeoMeta devem estar preenchido agora." 650 651 #~ msgid "" 652 #~ "WP GeoMeta uses the standard WordPress metadata functions. If you are " 653 #~ "familiar with these functions, you already know how to use WP GeoMeta." 654 #~ msgstr "" 655 #~ "WP GeoMeta usa os funções WordPress metadata padrão. Se você já tem " 656 #~ "familiaridade com estes funções, você ja sabe como usar o WP GeoMeta." 657 658 #~ msgid "" 659 #~ "WP GeoMeta watches for GeoJSON metadata values being saved to the " 660 #~ "database. It saves the GeoJSON like WordPress expects, but also converts " 661 #~ "the GeoJSON into a spatial format MySQL understands and saves that to " 662 #~ "special geo-meta tables which can handle spatial data and which have " 663 #~ "spatial indexes." 664 #~ msgstr "" 665 #~ "WP GeoMeta fica de olho para valores metadados tipo GeoJSON sendo " 666 #~ "guardados no banco de dados. O escreve o GeoJSON como WordPress espera, " 667 #~ "mas também converta o GeoJSON em um formato espaciais que MySQL " 668 #~ "compreende, e guarda aquele em tabelas especiais de geo-meta que podem " 669 #~ "utilizar dados espaciais e que tem índices espaciais." 670 671 #~ msgid "" 672 #~ "WP GeoMeta doesn't do anything when fetching data. You will get back the " 673 #~ "same GeoJSON value that you stored previously." 674 #~ msgstr "" 675 #~ "WP GeoMeta não faz nada quando buscando dados. Você receberá o mesmo " 676 #~ "valor de GeoJSON que você adicionou anteriormente." 677 678 #~ msgid "" 679 #~ "The real power of GIS and Spatial data becomes evident when you start " 680 #~ "doing real spatial searches. WP GeoMeta integrates with WP_Query, " 681 #~ "get_posts and other functions that use WP_Meta_Query under the hood." 682 #~ msgstr "" 683 #~ "O verdadero pode de SIG e dados espaciais se tornam evidente quando você " 684 #~ "começa a fazer buscas espaciais reais. WP GeoMeta integra com WP_Query, " 685 #~ "get_posts e outros funções que usam WP_Meta_Query sob o capô." 686 687 #~ msgid "" 688 #~ "WP GeoMeta can be installed as a plugin or used as a library by other " 689 #~ "plugins. This list includes all installed versions of WP GeoMeta and " 690 #~ "which plugin they came with." 691 #~ msgstr "" 692 #~ "WP GeoMeta pode ser instalado como um plugin ou utilizado como um " 693 #~ "biblioteca por outros plugins. Este lista inclui todos os versões de WP " 694 #~ "GeoMeta installados e com qual plugin eles foram incluídos." 695 696 #~ msgid "" 697 #~ "WP GeoMeta always uses the most up to date version installed, even if a " 698 #~ "plugin bundles an older version." 699 #~ msgstr "" 700 #~ "WP GeoMeta sempre usa o versão mais recente instalado, mesmo se um plugin " 701 #~ "inclue um versão mais velho." 702 703 #~ msgid "WP GeoMeta Version" 704 #~ msgstr "Versão de WP GeoMeta" 705 706 #~ msgid "WP GeoMeta Meta and Resources" 707 #~ msgstr "WP GeoMeta Meta e Recursos" 708 709 #~ msgid "" 710 #~ "WP GeoMeta is a work of love from the GIS+WordPress development team at " 711 #~ "%1$s" 712 #~ msgstr "" 713 #~ "WP GeoMeta é um obra de amor to time de desenvolvimento de GIS+WordPress " 714 #~ "de %1$s." 715 716 #~ msgid "WP GeoMeta on GitHub" 717 #~ msgstr "WP GeoMeta no GitHub" 718 719 #~ msgid "WherePress.com — Our WordPress/GIS Blog Site" 720 #~ msgstr "WherePress.com — Nossa Blog de WordPress/SIG " 721 722 #~ msgid "Run the built-in regression tests" 723 #~ msgstr "Corre as provas de regressão integral." 724 725 #~ msgid "Remove WP GeoMeta Tables" 726 #~ msgstr "Remover Tabelas WP GeoMeta" 727 728 #~ msgid "" 729 #~ "All WP GeoMeta data is stored in its own tables. Your original data is " 730 #~ "untouched. Removing WP GeoMeta tables will break any spatial queries you " 731 #~ "may be using." 732 #~ msgstr "" 733 #~ "Todos os dados de WP GeoMeta estão salvados em seus próprios tabelas. " 734 #~ "Seus dados originais não é modificados. Apagando as tabelas WP GeoMeta " 735 #~ "vai quebrar qualquer pesquisas espaciais você pode estar usando." 736 737 #~ msgid "Create WP GeoMeta Tables" 738 #~ msgstr "Criar Tabelas WP GeoMeta" 739 740 #~ msgid "" 741 #~ "WP GeoMeta tables are created on plugin activation or upgrade, but you " 742 #~ "can manually create them here. WP GeoMeta uses dbDelta, so running this " 743 #~ "multiple times will have no bad effects." 744 #~ msgstr "" 745 #~ "Tabelas WP GeoMeta estão criados quando o plugin esta activado ou " 746 #~ "atualizado, mas você pode as criar aqui manualmente. WP GeoMeta usa " 747 #~ "dbDelta, então fazendo isso vários vezes não teria efeitos maus." 748 749 #~ msgid "Truncate WP GeoMeta Tables" 750 #~ msgstr "Truncar Tabelas WP GeoMeta" 751 752 #~ msgid "" 753 #~ "Detect any spatial data (GeoJSON) in the non-spatial meta tables which is " 754 #~ "not stored in WP GeoMeta and load it. This may take a while!" 755 #~ msgstr "" 756 #~ "Detectar dados espaciais (GeoJSON) nas tabelas meta não-espaciais que não " 757 #~ "esta salvado em WP GeoMeta, e carregá-lo. Este ação pode demorar!" 618 758 619 759 #~ msgid "" -
wp-geometa/trunk/lib/wp-geometa-dash.php
r1557784 r1607853 1 1 <?php 2 2 /** 3 * This class and file are respnsible for the WP GeoMeta WordPress dashboard page. This file doesn't need to be loaded 4 * when WP GeoMeta is used as a library. 3 * This class and file are respnsible for the WP-GeoMeta WordPress dashboard page. 5 4 * 6 5 * @package wp-geometa 7 6 * @link https://github.com/cimburadotcom/WP-GeoMeta 8 * @author Michael Moore / michael _m@cimbura.com / https://profiles.wordpress.org/stuporglue/9 * @copyright Cimbura.com, 20167 * @author Michael Moore / michael.moore@luminfire.com / https://profiles.wordpress.org/stuporglue/ 8 * @copyright LuminFire.com, 2016, 2017 10 9 * @license GNU GPL v2 11 10 */ … … 292 291 protected function __construct() { 293 292 add_action( 'admin_menu', array( $this, 'admin_menu' ) ); 294 add_action( 'wp_ajax_wpgm_get_sample_data', array( $this, ' ajax_wpgm_get_sample_data' ) );295 add_action( 'wp_ajax_wpgm_dangerzone', array( $this, ' ajax_wpgm_dangerzone' ) );293 add_action( 'wp_ajax_wpgm_get_sample_data', array( $this, 'wp_ajax_wpgm_get_sample_data' ) ); 294 add_action( 'wp_ajax_wpgm_dangerzone', array( $this, 'wp_ajax_wpgm_dangerzone' ) ); 296 295 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 297 add_filter( 'wpgmd_sample_data_to_json', array( $this, ' sample_latlng_to_json' ));296 add_filter( 'wpgmd_sample_data_to_json', array( $this, 'wpgmd_sample_data_to_json' ), 10, 2 ); 298 297 } 299 298 … … 308 307 } 309 308 310 $plugin_dir = plugin_dir_url( __FILE__ ) . '/../../ assets/';309 $plugin_dir = plugin_dir_url( __FILE__ ) . '/../../media/'; 311 310 312 311 wp_enqueue_script( 'leafletjs', $plugin_dir . 'leaflet/leaflet.js', array(), null ); … … 317 316 $translation_array = array( 318 317 'action_confirm_dialog' => __( 'Are you sure you want to %1$s?' , 'wp-geometa' ), 319 );318 ); 320 319 wp_localize_script( 'wpgeometadashjs', 'wpgmjs_strings', $translation_array ); 321 320 wp_enqueue_script( 'wpgeometadashjs' ); … … 329 328 */ 330 329 public function admin_menu() { 331 add_management_page( 'WP GeoMeta', 'WPGeoMeta', 'install_plugins', 'wp-geometa', array( $this, 'show_dashboard' ) );330 add_management_page( 'WP-GeoMeta', 'WP-GeoMeta', 'install_plugins', 'wp-geometa', array( $this, 'show_dashboard' ) ); 332 331 } 333 332 … … 470 469 471 470 $all_plugins = get_plugin_updates(); 472 473 471 $this_plugin = basename( dirname( dirname( __FILE__ ) ) ) . '/wp-geometa.php'; 472 $plugin_data = get_plugin_data( dirname( dirname( __FILE__ ) ) . '/wp-geometa.php' ); 473 $geometa_dash_version = $plugin_data['Version']; 474 475 $latest_version = WP_GEOMETA_VERSION; 476 477 if ( !empty( $all_plugins[ $this_plugin ] ) && !empty( $all_plugins[ $this_plugin ]->update->new_version ) ) { 478 $update_version = $all_plugins[ $this_plugin ]->update->new_version; 479 480 if ( 0 >= version_compare( $latest_version, $update_version ) ) { 481 $latest_version = $update_version; 482 } 483 } 474 484 475 485 /* 476 486 * Three statuses. 477 * Poor. There are updates and WP_GEOMETA_DASH_VERSIONand WP_GEOMETA_VERSION are the same and both are out of date478 * OK. There are updates, and WP_GEOMETA_DASH_VERSIONis out of date, but WP_GEOMETA_VERSION is up to date (some other plugin has an updated version)479 * Good. There are no updates: WP_GEOMETA_DASH_VERSIONis up to date and WP_GEOMETA_VERSION is up to date487 * Poor. There are updates and $geometa_dash_version and WP_GEOMETA_VERSION are the same and both are out of date 488 * OK. There are updates, and $geometa_dash_version is out of date, but WP_GEOMETA_VERSION is up to date (some other plugin has an updated version) 489 * Good. There are no updates: $geometa_dash_version is up to date and WP_GEOMETA_VERSION is up to date 480 490 */ 481 491 482 if ( empty( $all_plugins[ $this_plugin ] ) ) { 483 $this->make_status_block( 'good', esc_html__( 'Up To Date!' , 'wp-geometa' ), sprintf( esc_html__( 'You are running the most recent version of WP GeoMeta (%1$s).', 'wp-geometa' ), WP_GEOMETA_VERSION ) ); 484 } else if ( 0 === version_compare( WP_GEOMETA_VERSION, $all_plugins[ $this_plugin ]->Version ) && -1 === version_compare( WP_GEOMETA_DASH_VERSION, $all_plugins[ $this_plugin ]->Version ) ) { 485 $this->make_status_block( 'fair', esc_html__( 'Out Of Date.' , 'wp-geometa' ), sprintf( esc_html__( 'A plugin you are using is providing the most recent version of the WP GeoMeta library (%1$s), but this plugin is out of date.', 'wp-geometa' ), WP_GEOMETA_VERSION ) ); 486 } else { 487 $this->make_status_block( 'poor', esc_html__( 'Out Of Date!' , 'wp-geometa' ), sprintf( esc_html__( 'You are running an outdated version of WP GeoMeta (%1$s). Please upgrade!', 'wp-geometa' ), WP_GEOMETA_VERSION ) ); 492 493 // Poor. We have the latest, but it's not in use. This is unexpected. 494 if ( -1 === version_compare( WP_GEOMETA_VERSION, $geometa_dash_version ) ) { 495 $this->make_status_block( 'poor', esc_html__( 'Odd Situation!' , 'wp-geometa' ), sprintf( esc_html__( 'You have the latest version of WP-GeoMeta, but another plugin is providing an older version WP-GeoMeta-Lib Please update the plugin(s) not providing version %1$s in the list below!', 'wp-geometa' ), $latest_version ) ); 496 } 497 498 // Good: We've got the latest. 499 else if ( 0 >= version_compare( $latest_version, $geometa_dash_version ) ) { 500 $this->make_status_block( 'good', esc_html__( 'Up To Date!' , 'wp-geometa' ), sprintf( esc_html__( 'You are using the most recent version of WP-GeoMeta-Lib (%1$s).', 'wp-geometa' ), WP_GEOMETA_VERSION ) ); 501 } 502 503 504 // OK. Some other plugin is providing the latest version. 505 else if ( 1 === version_compare( $latest_version, $geometa_dash_version ) && 0 === version_compare( WP_GEOMETA_VERSION, $latest_version ) ) { 506 $this->make_status_block( 'fair', esc_html__( 'Out Of Date.' , 'wp-geometa' ), sprintf( esc_html__( 'A plugin you are using is providing the most recent version of the WP-GeoMeta-Lib (%1$s), but this plugin is out of date.', 'wp-geometa' ), WP_GEOMETA_VERSION ) ); 507 } 508 509 // Poor: There are updates and no plugin has them. 510 else { 511 $this->make_status_block( 'poor', esc_html__( 'Out Of Date!' , 'wp-geometa' ), sprintf( esc_html__( 'You are running an outdated version of WP-GeoMeta-Lib (%1$s). Please upgrade to %2$s!', 'wp-geometa' ), WP_GEOMETA_VERSION, $latest_version ) ); 488 512 } 489 513 } … … 540 564 $this->make_status_block( 'good', esc_html__( 'All Spatial Data Loaded!' , 'wp-geometa' ), sprintf( esc_html__( 'All %1$s spatial records are loaded!' , 'wp-geometa' ), $total_meta ) ); 541 565 } else if ( $total_percent > 0 ) { 542 $this->make_status_block( 'fair', esc_html__( 'Some Spatial Data Loaded' , 'wp-geometa' ), sprintf( esc_html__( '%1$s%% of spatial records are loaded (%2$s records not loaded). Try using the %3$s%4$s%5$s tool below to load them.', 'wp-geometa' ), $total_percent, ( $total_meta - $total_geo ), '<em>', esc_html__( 'Populate WP GeoMeta Tables', 'wp-geometa' ), '</em>' ) );566 $this->make_status_block( 'fair', esc_html__( 'Some Spatial Data Loaded' , 'wp-geometa' ), sprintf( esc_html__( '%1$s%% of spatial records are loaded (%2$s records not loaded). Try using the %3$s%4$s%5$s tool below to load them.', 'wp-geometa' ), $total_percent, ( $total_meta - $total_geo ), '<em>', esc_html__( 'Populate WP-GeoMeta Tables', 'wp-geometa' ), '</em>' ) ); 543 567 } else { 544 $this->make_status_block( 'poor', esc_html__( 'No Spatial Data Loaded!' , 'wp-geometa' ), sprintf( esc_html__( 'Please verify that the spatial tables exist, then use the %1$s%2$s%3$s tool below to load the data.' , 'wp-geometa' ), '<em>', esc_html__( 'Populate WP GeoMeta Tables' ), '</em>' ) );568 $this->make_status_block( 'poor', esc_html__( 'No Spatial Data Loaded!' , 'wp-geometa' ), sprintf( esc_html__( 'Please verify that the spatial tables exist, then use the %1$s%2$s%3$s tool below to load the data.' , 'wp-geometa' ), '<em>', esc_html__( 'Populate WP-GeoMeta Tables' ), '</em>' ) ); 545 569 } 546 570 } … … 584 608 ORDER BY p.post_type, geo.meta_key'; 585 609 586 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $geometa ) { // @codingStandardsIgnoreLine587 588 $post_type_object = get_post_type_object( $geometa['post_type'] );589 590 $found_data[] = array(591 'name' => $post_type_object->labels->name . ' (post)',592 'type' => 'post',593 'the_meta_key' => $geometa['meta_key'],594 'quantity' => $geometa['quantity'],595 'sub_type' => $geometa['post_type'],596 );597 }610 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $geometa ) { // @codingStandardsIgnoreLine 611 612 $post_type_object = get_post_type_object( $geometa['post_type'] ); 613 614 $found_data[] = array( 615 'name' => $post_type_object->labels->name . ' (post)', 616 'type' => 'post', 617 'the_meta_key' => $geometa['meta_key'], 618 'quantity' => $geometa['quantity'], 619 'sub_type' => $geometa['post_type'], 620 ); 621 } 598 622 } 599 623 … … 607 631 */ 608 632 // @codingStandardsIgnoreStart 609 $q = 'SELECT 610 meta_key, 611 COUNT(umeta_id) AS quantity 612 FROM 613 ' . $wpdb->usermeta . '_geo geo 614 GROUP BY 615 meta_key'; 616 617 // @codingStandardsIgnoreEnd 618 619 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $usermeta ) { // @codingStandardsIgnoreLine 633 $q = 'SELECT meta_key, COUNT(umeta_id) AS quantity FROM ' . $wpdb->usermeta . '_geo geo GROUP BY meta_key'; 634 // @codingStandardsIgnoreEnd 635 636 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $usermeta ) { // @codingStandardsIgnoreLine 620 637 $found_data[] = array( 621 638 'name' => 'Users', … … 623 640 'the_meta_key' => $usermeta['meta_key'], 624 641 'quantity' => $usermeta['quantity'], 625 );642 ); 626 643 } 627 644 } … … 646 663 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $termmeta ) { // @codingStandardsIgnoreLine 647 664 648 $found_data[] = array(649 'name' => $termmeta['name'] . ' (term)',650 'type' => 'user',651 'the_meta_key' => $termmeta['meta_key'],652 'quantity' => $termmeta['quantity'],653 );654 }665 $found_data[] = array( 666 'name' => $termmeta['name'] . ' (term)', 667 'type' => 'user', 668 'the_meta_key' => $termmeta['meta_key'], 669 'quantity' => $termmeta['quantity'], 670 ); 671 } 655 672 } 656 673 … … 666 683 667 684 foreach ( $wpdb->get_results( $q, ARRAY_A ) as $commentmeta ) { // @codingStandardsIgnoreLine 668 $found_data[] = array(669 'name' => 'Comments',670 'type' => 'comment',671 'the_meta_key' => $commentmeta['meta_key'],672 'quantity' => $commentmeta['quantity'],673 );674 }685 $found_data[] = array( 686 'name' => 'Comments', 687 'type' => 'comment', 688 'the_meta_key' => $commentmeta['meta_key'], 689 'quantity' => $commentmeta['quantity'], 690 ); 691 } 675 692 } 676 693 … … 685 702 * Get 500 random spatial records from a post type. 686 703 */ 687 public function ajax_wpgm_get_sample_data() {704 public function wp_ajax_wpgm_get_sample_data() { 688 705 global $wpdb; 689 706 … … 748 765 if ( ! empty( $_GET['subtype'] ) ) { // @codingStandardsIgnoreLine 749 766 $post_type_object = get_post_type_object( $_GET['subtype'] ); // @codingStandardsIgnoreLine 750 $type = $post_type_object->labels->name . ' (post)';767 $type_label = $post_type_object->labels->name . ' (post)'; 751 768 } else { 752 $type = ucfirst( $type );769 $type_label = ucfirst( $type ); 753 770 } 754 771 755 772 foreach ( $res as $record ) { 756 773 757 $record = apply_filters( 'wpgmd_sample_data_to_json', $record );774 $record = apply_filters( 'wpgmd_sample_data_to_json', $record, $type ); 758 775 759 776 $feature_collection = WP_GeoUtil::merge_geojson( $record['meta_value'] ); 760 777 $feature_collection = json_decode( $feature_collection, true ); 761 778 foreach ( $feature_collection['features'] as &$feature ) { 762 $feature['title'] = $type . ' id ' . $record['the_id'];779 $feature['title'] = $type_label . ' id ' . $record['the_id']; 763 780 } 764 781 $geojson[] = $feature_collection; … … 777 794 778 795 /** 779 * Generate a list of WP GeoMeta installs.796 * Generate a list of WP-GeoMeta installs. 780 797 */ 781 798 function get_list_of_installs() { … … 812 829 * Handle the danger zone actions 813 830 */ 814 public function ajax_wpgm_dangerzone() {831 public function wp_ajax_wpgm_dangerzone() { 815 832 $real_action = $_GET['action_type']; // @codingStandardsIgnoreLine 816 833 … … 818 835 case 'run-tests': 819 836 ob_start(); 820 require_once( dirname( __FILE__ ) . '/ ../test/testsuite.php' );837 require_once( dirname( __FILE__ ) . '/wp-geometa-lib/test/testsuite.php' ); 821 838 $res = ob_get_clean(); 822 839 $res = trim( $res ); … … 828 845 $wpgm = WP_GeoMeta::get_instance(); 829 846 $wpgm->uninstall(); 830 print esc_html__( 'The WP GeoMeta tables should be gone now.' , 'wp-geometa' );847 print esc_html__( 'The WP-GeoMeta tables should be gone now.' , 'wp-geometa' ); 831 848 break; 832 849 case 'create-tables': 833 850 $wpgm = WP_GeoMeta::get_instance(); 834 851 $wpgm->create_geo_tables(); 835 print esc_html__( 'The WP GeoMeta tables should exist now.' , 'wp-geometa' );852 print esc_html__( 'The WP-GeoMeta tables and functions should exist now.' , 'wp-geometa' ); 836 853 break; 837 854 case 'truncate-tables': 838 855 $wpgm = WP_GeoMeta::get_instance(); 839 856 $wpgm->truncate_tables(); 840 print esc_html__( 'The WP GeoMeta tables should be empty now.' , 'wp-geometa' );857 print esc_html__( 'The WP-GeoMeta tables should be empty now.' , 'wp-geometa' ); 841 858 break; 842 859 break; … … 844 861 $wpgm = WP_GeoMeta::get_instance(); 845 862 $wpgm->populate_geo_tables(); 846 print esc_html__( 'The WP GeoMeta tables should be populated now.' , 'wp-geometa' );863 print esc_html__( 'The WP-GeoMeta tables should be populated now.' , 'wp-geometa' ); 847 864 break; 848 865 case 'rebuild-function-cache': … … 861 878 */ 862 879 public function section_header() { 863 $icon = plugin_dir_url( __FILE__ ) . '/../../assets/icon .png';864 print '<div class="wpgm-header header noborder"><h2><img src="' . esc_attr( $icon ). '" title="WP GeoMeta Logo"/>WPGeoMeta</h2></div>';880 $icon = plugin_dir_url( __FILE__ ) . '/../../assets/icon-256x256.png'; 881 print '<div class="wpgm-header header noborder"><h2><img src="' . esc_attr( $icon ). '" title="WP-GeoMeta Logo"/>WP-GeoMeta</h2></div>'; 865 882 } 866 883 … … 884 901 */ 885 902 public function section_data() { 886 print '<div class="wpgm-data"><h3>' . esc_html__( 'Your Spatial Data' , 'wp-geometa' ) . '<span id="yourdata-spinner"></span></h3><div id="wpgmmap"></div><div class="posttypegeotable">'; 903 print '<div class="wpgm-data"><h3>' . esc_html__( 'Your Spatial Data' , 'wp-geometa' ) . '<span id="yourdata-spinner"></span></h3>'; 904 905 $map = new LeafletPHP(array( 906 'scrollWheelZoom' => false 907 ),'wpgmleaflet'); 908 909 print $map; 910 911 print '<div class="posttypegeotable">'; 887 912 print '<h4>' . esc_html__( 'Found Spatial Metadata Types' , 'wp-geometa' ) . '</h4>'; 888 913 … … 921 946 print '<div><h3>' . esc_html__( 'Quick Start' , 'wp-geometa' ) .'</h3>'; 922 947 923 print '<p>' . esc_html__( 'WP GeoMeta uses the standard WordPress metadata functions. If you are familiar with these functions, you already know how to use WPGeoMeta.' , 'wp-geometa' ) . '</p>';924 925 print '<p>' . esc_html__( 'WP GeoMeta watches for GeoJSON metadata values being saved to the database. It saves the GeoJSON like WordPress expects, but also converts the GeoJSON into a spatial format MySQL understands and saves that to special geo-meta tables which can handle spatial data and which have spatial indexes.' , 'wp-geometa' ) . '</p>';948 print '<p>' . esc_html__( 'WP-GeoMeta uses the standard WordPress metadata functions. If you are familiar with these functions, you already know how to use WP-GeoMeta.' , 'wp-geometa' ) . '</p>'; 949 950 print '<p>' . esc_html__( 'WP-GeoMeta watches for GeoJSON metadata values being saved to the database. It saves the GeoJSON like WordPress expects, but also converts the GeoJSON into a spatial format MySQL understands and saves that to special geo-meta tables which can handle spatial data and which have spatial indexes.' , 'wp-geometa' ) . '</p>'; 926 951 927 952 print '<h4>' . esc_html__( 'Adding and Updating Data' , 'wp-geometa' ) . '</h4>'; … … 941 966 print '<h4>' . esc_html__( 'Fetching and Using Data' , 'wp-geometa' ) . '</h4>'; 942 967 943 print '<p>' . esc_html__( 'WP GeoMeta doesn\'t do anything when fetching data. You will get back the same GeoJSON value that you stored previously.' , 'wp-geometa' ) . '</p>';968 print '<p>' . esc_html__( 'WP-GeoMeta doesn\'t do anything when fetching data. You will get back the same GeoJSON value that you stored previously.' , 'wp-geometa' ) . '</p>'; 944 969 print '<p>' . esc_html__( 'GeoJSON can be used by any of the popular web map software available today.' , 'wp-geometa' ) . '</p>'; 945 970 print '<pre><code>'; … … 952 977 print '<h4>' . esc_html__( 'Running Spatial Queries' , 'wp-geometa' ) . '</h4>'; 953 978 954 print '<p>' . esc_html__( 'The real power of GIS and Spatial data becomes evident when you start doing real spatial searches. WP GeoMeta integrates with WP_Query, get_posts and other functions that use WP_Meta_Query under the hood.' , 'wp-geometa' ) . '</p>';979 print '<p>' . esc_html__( 'The real power of GIS and Spatial data becomes evident when you start doing real spatial searches. WP-GeoMeta integrates with WP_Query, get_posts and other functions that use WP_Meta_Query under the hood.' , 'wp-geometa' ) . '</p>'; 955 980 956 981 print '<pre><code>'; … … 1005 1030 1006 1031 /** 1007 * Print the list of WP GeoMeta installs.1032 * Print the list of WP-GeoMeta installs. 1008 1033 */ 1009 1034 public function section_installs() { 1010 1035 print '<div class="listofinstalls"><h3>' . esc_html__( 'List of Installs' , 'wp-geometa' ) . '</h3>'; 1011 print '<p>' . esc_html__( ' WP GeoMeta can be installed as a plugin or used as a library by other plugins. This list includes all installed versions of WP GeoMetaand which plugin they came with.' ) . '</p>';1012 print '<p>' . esc_html__( 'WP GeoMeta always uses the most up to date version installed, even if a plugin bundles an older version.' , 'wp-geometa' ) . '</p>';1013 1014 print '<table class="wpgminstalllist"><tr><th>' . esc_html__( 'Plugin Name' , 'wp-geometa' ) . '</th><th>' . esc_html__( 'WP GeoMeta Version' , 'wp-geometa' ) . '</th></tr>';1036 print '<p>' . esc_html__( 'The WP-GeoMeta-Lib library may be used by multiple plugins. This list includes all installed versions of WP-GeoMeta-Lib and which plugin they came with.' ) . '</p>'; 1037 print '<p>' . esc_html__( 'WP-GeoMeta always uses the most up to date version installed, even if a plugin bundles an older version.' , 'wp-geometa' ) . '</p>'; 1038 1039 print '<table class="wpgminstalllist"><tr><th>' . esc_html__( 'Plugin Name' , 'wp-geometa' ) . '</th><th>' . esc_html__( 'WP-GeoMeta Version' , 'wp-geometa' ) . '</th></tr>'; 1015 1040 1016 1041 $installs = $this->get_list_of_installs(); … … 1031 1056 */ 1032 1057 public function section_resources() { 1033 print '<div><h3>' . esc_html__( 'WP GeoMeta Meta and Resources' , 'wp-geometa' ) . '</h3>';1034 1035 $logo = plugin_dir_url( __FILE__ ) . '/../../ assets/cimbura_logo.png';1036 print '<p><img src="' . esc_attr( $logo ) . '" class="logo">' . sprintf( esc_html__( 'WP GeoMeta is a work of love from the GIS+WordPress development team at %1$s' , 'wp-geometa' ), '<a href="http://cimbura.com" target="_blank">Cimbura.com</a>' );1058 print '<div><h3>' . esc_html__( 'WP-GeoMeta Meta and Resources' , 'wp-geometa' ) . '</h3>'; 1059 1060 $logo = plugin_dir_url( __FILE__ ) . '/../../media/luminfire_logo.png'; 1061 print '<p><img src="' . esc_attr( $logo ) . '" class="logo">' . sprintf( esc_html__( 'WP-GeoMeta is a work of love from the GIS+WordPress development team at %1$s' , 'wp-geometa' ), '<a href="https://luminfire.com" target="_blank">LuminFire.com</a>' ); 1037 1062 print ' '; 1038 1063 printf( esc_html__( 'We appreciate %1$sbug reports, feature requests%2$s and %3$spull requests (especially with test cases)%4$s.', 'wp-geometa' ), '<a href="https://github.com/cimburadotcom/WP-GeoMeta/issues" target="_blank">', '</a>','<a href="https://github.com/cimburadotcom/WP-GeoMeta/pulls" target="_blank">', '</a>' ); … … 1043 1068 print '<h4>' . esc_html__( 'Our Sites' , 'wp-geometa' ) . '</h4>'; 1044 1069 print '<ul>'; 1045 print '<li><a href="https:// cimbura.com" target="_blank">Cimbura.com — ' . esc_html__( 'Our home on the web' , 'wp-geometa' ) . '</a></li>';1046 print '<li><a href="https://github.com/cimburadotcom/WP-GeoMeta" target="_blank">' . esc_html__( 'WP GeoMeta on GitHub' , 'wp-geometa' ) . '</a></li>';1047 print '<li><a href="http://wherepress.com/" target="_blank">' . esc_html__( 'WherePress.com — Our WordPress/GIS Blog Site' , 'wp-geometa' ) . '</a></li>';1070 print '<li><a href="https://luminfire.com" target="_blank">LuminFire.com — ' . esc_html__( 'Our home on the web' , 'wp-geometa' ) . '</a></li>'; 1071 print '<li><a href="https://github.com/cimburadotcom/WP-GeoMeta" target="_blank">' . esc_html__( 'WP-GeoMeta on GitHub' , 'wp-geometa' ) . '</a></li>'; 1072 // print '<li><a href="http://wherepress.com/" target="_blank">' . esc_html__( 'WherePress.com — Our WordPress/GIS Blog Site' , 'wp-geometa' ) . '</a></li>'; 1048 1073 print '</ul>'; 1049 1074 … … 1082 1107 // Run tests. 1083 1108 print '<tr><td><button data-action="run-tests" class="wpgm-danger-action">' . esc_html__( 'Run Regression Tests' , 'wp-geometa' ) . '</button></td>'; 1084 print '<td>' . esc_html__( 'Run the built-in regression tests ' , 'wp-geometa' ) . '</td></tr>';1085 1086 // Remove WP GeoMeta Tables.1087 print '<tr><td><button data-action="remove-tables" class="wpgm-danger-action">' . esc_html__( 'Remove WP GeoMeta Tables' , 'wp-geometa' ) . '</button></td>';1088 print '<td>' . esc_html__( 'All WP GeoMeta data is stored in its own tables. Your original data is untouched. Removing WPGeoMeta tables will break any spatial queries you may be using.' , 'wp-geometa' ) . '</td></tr>';1089 1090 // Create WP GeoMeta Tables.1091 print '<tr><td><button data-action="create-tables" class="wpgm-danger-action">' . esc_html__( 'Create WP GeoMeta Tables' , 'wp-geometa' ) . '</button></td>';1092 print '<td>' . esc_html__( 'WP GeoMeta tables are created on plugin activation or upgrade, but you can manually create them here. WPGeoMeta uses dbDelta, so running this multiple times will have no bad effects.' , 'wp-geometa' ) . '</td></tr>';1093 1094 // Truncate WP GeoMeta Tables.1095 print '<tr><td><button data-action="truncate-tables" class="wpgm-danger-action">' . esc_html__( 'Truncate WP GeoMeta Tables' , 'wp-geometa' ) . '</button></td>';1109 print '<td>' . esc_html__( 'Run the built-in regression tests against the in-use vesion of WP-GeoMeta-Lib' , 'wp-geometa' ) . '</td></tr>'; 1110 1111 // Remove WP-GeoMeta Tables. 1112 print '<tr><td><button data-action="remove-tables" class="wpgm-danger-action">' . esc_html__( 'Remove WP-GeoMeta Tables' , 'wp-geometa' ) . '</button></td>'; 1113 print '<td>' . esc_html__( 'All WP-GeoMeta data is stored in its own tables. Your original data is untouched. Removing WP-GeoMeta tables will break any spatial queries you may be using.' , 'wp-geometa' ) . '</td></tr>'; 1114 1115 // Create WP-GeoMeta Tables. 1116 print '<tr><td><button data-action="create-tables" class="wpgm-danger-action">' . esc_html__( 'Create WP-GeoMeta Tables and Functions' , 'wp-geometa' ) . '</button></td>'; 1117 print '<td>' . esc_html__( 'WP-GeoMeta tables are created on plugin activation or upgrade, but you can manually create them here. WP-GeoMeta uses dbDelta, so running this multiple times will have no bad effects.' , 'wp-geometa' ) . '</td></tr>'; 1118 1119 // Truncate WP-GeoMeta Tables. 1120 print '<tr><td><button data-action="truncate-tables" class="wpgm-danger-action">' . esc_html__( 'Truncate WP-GeoMeta Tables' , 'wp-geometa' ) . '</button></td>'; 1096 1121 print '<td>' . esc_html__( 'Clears existing spatial data, but doesn\'t remove the tables.' , 'wp-geometa' ) . '</td></tr>'; 1097 1122 1098 // Populate WP GeoMeta Tables.1099 print '<tr><td><button data-action="populate-tables" class="wpgm-danger-action">' . esc_html__( 'Populate WP GeoMeta Tables' , 'wp-geometa' ) . '</button></td>';1100 print '<td>' . esc_html__( 'Detect any spatial data (GeoJSON) in the non-spatial meta tables which is not stored in WP GeoMeta and load it. This may take a while!', 'wp-geometa' ) . '</td></tr>';1101 1102 // Populate WP GeoMeta Tables.1123 // Populate WP-GeoMeta Tables. 1124 print '<tr><td><button data-action="populate-tables" class="wpgm-danger-action">' . esc_html__( 'Populate WP-GeoMeta Tables' , 'wp-geometa' ) . '</button></td>'; 1125 print '<td>' . esc_html__( 'Detect any spatial data (GeoJSON) in the non-spatial meta tables which is not stored in WP-GeoMeta and load it. This may take a while!', 'wp-geometa' ) . '</td></tr>'; 1126 1127 // Populate WP-GeoMeta Tables. 1103 1128 print '<tr><td><button data-action="rebuild-function-cache" class="wpgm-danger-action">' . esc_html__( 'Rebuild spatial function cache' , 'wp-geometa' ) . '</button></td>'; 1104 1129 print '<td>' . esc_html__( 'Re-check and cache which MySQL spatial functions are supported.', 'wp-geometa' ) . '</td></tr>'; … … 1120 1145 * @param string $metatype The type of object this meta is for (post, user, etc.). 1121 1146 */ 1122 public function sample_latlng_to_json( $record, $metatype ) {1147 public function wpgmd_sample_data_to_json( $record, $metatype ) { 1123 1148 if ( array_key_exists( $record['meta_key'], WP_GeoMeta::$latlngs_index ) ) { 1124 1149 $record['meta_value'] = '{"type":"Feature","geometry":' . WP_GeoUtil::geom_to_geojson( $record['geo_meta_value'] ) . ',"properties":[]}'; // @codingStandardsIgnoreLine -
wp-geometa/trunk/lib/wp-geometa-lib/CHANGELOG.md
r1557784 r1607853 1 1 Changes 2 2 ------- 3 4 ### 0.3.2 5 * WP_GeoUtil::is_geom now has a shortcircuit for strings that don't even look like WKT 6 * Updated documentation! 7 * WP_GeoUtil::run_spatial_query now uses a non-warning-generating method to detect if a value is spatial or not 8 * Updated WP_GeoUtil::is_geojson to detect non-GeoJSON without trying to parse it. 9 * Improved metaval_to_geom 10 * Improved handling of MySQL geometry function call results, wrapping bare geometry GeoJSON with {"type":"Feature", "geometry": {the geometry}} 11 * Split out creation of tables from creation of custom SQL functions. 12 * Added filter to allow plugin devs to include their own custom SQL function files. 13 * Standardized filter name prefixes to wpgm\_ (old filters will stick around for a few versions, even though I don't think anyone is using them). 14 * Standardized internal callback functions to use the same name as the filter that they're callbacks for. 15 * Tests are now included and work within WP-GeoMeta-Lib instead of in WP-GeoMeta. 16 * Allow WP_GeoUtil::get_capabilities to be run without accessing the options table and without caching the results. 17 * Cleaner loader file, working towards using spl_autoload_register in a future release. 18 * Only loads geoPHP if it's needed. 3 19 4 20 ### 0.3.1 -
wp-geometa/trunk/lib/wp-geometa-lib/HACKING.md
r1544952 r1607853 68 68 object and array representations of GeoJSON are be accepted. 69 69 70 WP-GeoMeta stores data in EPSG:4326 by default, which is (a) the defaultformat70 WP-GeoMeta stores data in EPSG:4326 by default, which is (a) the official format 71 71 for GeoJSON and (b) the most common format for web maps. 72 72 … … 78 78 79 79 See the [README.md](README.md) for examples of how to use WP_GeoQuery. 80 81 Related Projects82 ----------------83 * https://github.com/cimburadotcom/WP-GeoJSON-Loader84 * https://github.com/cimburadotcom/MySQL_Stored_Geo_Functions85 * https://github.com/cimburadotcom/wp-spatial-capabilities-check -
wp-geometa/trunk/lib/wp-geometa-lib/README.md
r1557784 r1607853 1 WP-GeoMeta Lib1 WP-GeoMeta-Lib 2 2 ============== 3 3 4 WP-GeoMeta is a spatial foundationfor WordPress. It provides a solid foundation5 for spatial data using MySQL's native spatial support. With WP-GeoMeta you can store4 WP-GeoMeta-Lib is a spatial framework for WordPress. It provides a solid foundation 5 for spatial data using MySQL's native spatial support. With WP-GeoMeta-Lib you can store 6 6 and search spatial metadata like you do any other metadata, but using MySQL spatial indexes. 7 7 8 WP-GeoMeta was created with developers in mind. If you find it cumbersome, buggy or8 WP-GeoMeta-Lib was created with developers in mind. If you find it cumbersome, buggy or 9 9 missing features, let us know! 10 10 … … 15 15 - [Writing and Reading Data](#writing-and-reading-data) 16 16 - [Querying](#querying) 17 - [ORDER BY](#order-by) 17 - [Support Comparison Operations](#support-comparison-operations) 18 - [ORDER BY](#order-by) 19 - [WordPress Hooks](#wordpress-hooks) 20 - [Filters](#filters) 21 - [Actions](#actions) 22 - [Calling Spatial Functions From PHP](#calling-spatial-functions-from-php) 23 - [Examples](#examples) 24 - [Custom Auxiliary Functions](#custom-auxiliary-functions) 25 - [Why WP-GeoMeta-Lib?](#why-wp-geometa-lib) 26 - [Integration with Other Plugins](#integration-with-other-plugins) 27 - [Why not separate lat and long fields?](#why-not-separate-lat-and-long-fields) 28 - [OK, fine, but I really need separate fields](#ok-fine-but-i-really-need-separate-fields) 29 - [Important Notes](#important-notes) 18 30 - [Server Requirements](#server-requirements) 19 31 - [WordPress](#wordpress) 32 - [MySQL](#mysql) 20 33 - [PHP](#php) 21 - [Frequently Asked Questions](#frequently-asked-questions)22 - [What spatial comparisons are supported?](#what-spatial-comparisons-are-supported)23 - [Hooks: Filters and Actions](#hooks-filters-and-actions)24 - [Why WP-GeoMeta?](#why-wp-geometa)25 - [Integration with Other Plugins](#integration-with-other-plugins)26 - [Why not separate lat and long fields?](#why-not-separate-lat-and-long-fields)27 - [OK, fine, but I really need separate fields](#ok-fine-but-i-really-need-separate-fields)28 - [How to Use WP-GeoMeta](#how-to-use-wp-geometa)29 - [Important Notes](#important-notes)30 34 - [Hacking](#hacking) 31 35 - [Quotes](#quotes) … … 36 40 ----------- 37 41 38 1. Download WP-GeoMeta Lib to your plugin.42 1. Download WP-GeoMeta-Lib to your plugin. 39 43 40 44 ``` … … 47 51 ``` 48 52 49 3. Save GeoJSON metadata! 53 3. Set up an activation hook to install WP_GeoMeta when your plugin activates. 54 55 ``` 56 register_activation_hook( __FILE__ , array('WP_GeoMeta','install')); 57 ``` 58 59 If you already have your own activation hook, you can simply add WP_GeoMeta::install() to your hook. 60 61 4. Save GeoJSON metadata! 50 62 51 63 ``` … … 55 67 Once you are storing spatial data you (or anyone else!) can query it 56 68 using spatial queries! 57 58 69 59 70 Usage … … 89 100 1. Query comparing geometries 90 101 91 This style of query is for all spatial functions which accept two geometries as arguments and which 92 return a boolean as a result. For example ST_INTERSECTS, CONTAINS or MBROverlaps. 93 94 The meta_query _compare_ is the function to use, and the _value_ should be a GeoJSON representation 95 of the geometry to use for the second argument. The geometry meta field indicated by the _key_ parameter 96 will be used as the first argument to the _compare_ function. 97 102 This style of query is for all spatial functions which accept two geometries as arguments and which 103 return a boolean as a result. For example ST_INTERSECTS, CONTAINS or MBROverlaps. 104 105 The meta_query _compare_ is the function to use, and the _value_ should be a GeoJSON representation 106 of the geometry to use for the second argument. The geometry meta field indicated by the _key_ parameter 107 will be used as the first argument to the _compare_ function. 108 109 ``` 98 110 $q = new WP_Query( array( 99 111 'meta_query' => array( … … 110 122 print "\t* " . get_the_title() . "\n"; 111 123 } 124 ``` 112 125 113 126 2. Query geometry properties 114 127 115 This style of query is for all spatial functions which accept a single geometry as an argument and 116 which return a boolean as a result. For example ST_IsSimple, IsClosed or ST_IsEmpty. 117 118 The _compare_ argument should be the function just like above, but no value is needed. 119 128 This style of query is for all spatial functions which accept a single geometry as an argument and 129 which return a boolean as a result. For example ST_IsSimple, IsClosed or ST_IsEmpty. 130 131 The _compare_ argument should be the function just like above, but no value is needed. 132 133 ``` 120 134 $q = new WP_Query(array( 121 135 'meta_query' => array( … … 125 139 ) 126 140 ))); 141 ``` 127 142 128 143 3. Compare the results of geometry functions 129 144 130 This style of query is for spatial functions which accept a single geometry as an argument but return 131 a non-boolean response. For example, GLength, ST_Area or ST_SRID. 132 133 In these queries you may want to use a normal meta_query comparison (=, >, BETWEEN, etc.) but against 134 the result of a spatial function. To accomodate this type of case, you will need to add an additional 135 parameter _geom_op_. 136 137 The _key_, _compare_ and _value_ are used in the regular WP_Query way, but the comparison will be 138 made against the result of applying the geometry function to the spatial metadata specified. 139 145 This style of query is for spatial functions which accept a single geometry as an argument but return 146 a non-boolean response. For example, GLength, ST_Area or ST_SRID. 147 148 In these queries you may want to use a normal meta_query comparison (=, >, BETWEEN, etc.) but against 149 the result of a spatial function. To accomodate this type of case, you will need to add an additional 150 parameter _geom_op_. 151 152 The _key_, _compare_ and _value_ are used in the regular WP_Query way, but the comparison will be 153 made against the result of applying the geometry function to the spatial metadata specified. 154 155 ``` 140 156 $q = new WP_Query(array( 141 157 'meta_query' => array( … … 147 163 ) 148 164 ))); 149 150 ### ORDER BY 151 152 orderby with named meta clauses should work. It's a new feature though, so send me bug reports. 165 ``` 166 167 #### Support Comparison Operations 168 169 Any spatial operation that takes two geometries and returns a boolean, 170 or which takes one geometry and returns a boolean or a value is 171 supported, if your version of MySQL supports it. 172 173 The following function should work, if your install of MySQL supports them: 174 175 <table> 176 <tr> 177 <td>Area</td> 178 <td>Contains</td> 179 <td>Crosses</td> 180 <td>Dimension</td> 181 </tr> 182 <tr> 183 <td>Disjoint</td> 184 <td>Equals</td> 185 <td>GLength</td> 186 <td>GeometryType</td> 187 </tr> 188 <tr> 189 <td>Intersects</td> 190 <td>IsClosed</td> 191 <td>IsEmpty</td> 192 <td>IsRing</td> 193 </tr> 194 <tr> 195 <td>IsSimple</td> 196 <td>MBRContains</td> 197 <td>MBRCoveredBy</td> 198 <td>MBRDisjoint</td> 199 </tr> 200 <tr> 201 <td>MBREqual</td> 202 <td>MBREquals</td> 203 <td>MBRIntersects</td> 204 <td>MBROverlaps</td> 205 </tr> 206 <tr> 207 <td>MBRTouches</td> 208 <td>MBRWithin</td> 209 <td>NumGeometries</td> 210 <td>NumInteriorRings</td> 211 </tr> 212 <tr> 213 <td>NumPoints</td> 214 <td>Overlaps</td> 215 <td>SRID</td> 216 <td>ST_Area</td> 217 </tr> 218 <tr> 219 <td>ST_Contains</td> 220 <td>ST_Crosses</td> 221 <td>ST_Difference</td> 222 <td>ST_Dimension</td> 223 </tr> 224 <tr> 225 <td>ST_Disjoint</td> 226 <td>ST_Distance</td> 227 <td>ST_Distance_Sphere</td> 228 <td>ST_Equals</td> 229 </tr> 230 <tr> 231 <td>ST_GeometryType</td> 232 <td>ST_Intersects</td> 233 <td>ST_IsClosed</td> 234 <td>ST_IsEmpty</td> 235 </tr> 236 <tr> 237 <td>ST_IsRing</td> 238 <td>ST_IsSimple</td> 239 <td>ST_IsValid</td> 240 <td>ST_Length</td> 241 </tr> 242 <tr> 243 <td>ST_NumPoints</td> 244 <td>ST_Overlaps</td> 245 <td>ST_SRID</td> 246 <td>ST_Touches</td> 247 </tr> 248 <tr> 249 <td>ST_Within</td> 250 <td>Touches</td> 251 <td>Within</td> 252 <td></td> 253 </tr> 254 </table> 255 256 To see what your install of MySQL supports, install 257 [WP Spatial Capabilities Check](https://wordpress.org/plugins/wp-spatial-capabilities-check/). 258 We recommend using MySQL 5.6.1 or higher since it included many important updates to 259 spatial operators. 260 261 #### ORDER BY 262 263 orderby with named meta clauses should work. 153 264 154 265 1) Single arg orderby (eg. Dimension, GLength, ST_Area) … … 181 292 182 293 183 184 Server Requirements 294 ### WordPress Hooks 185 295 ------------------- 186 296 187 ### WordPress 188 This library supports storing spatial metadata for posts, users, comments and 189 terms. 190 191 Setting, getting and querying values should work in 4.1 with some missing functionality. 192 Running orderby doesn't work until 4.2 193 Searching term metadata arrived in WordPress 4.4, but other 194 functionality should still work in older versions of WordPress. 195 196 MySQL 5.6.1 or higher is strongly recommended. Lower than MySQL 5.1.72 is untested. 197 198 WP_GeoMeta will probably work on MySQL 5.4, but spatial support was pretty weak 199 before version 5.6.1. 200 201 Before MySQL 5.6.1 spatial functions worked against the mininum bounding rectangle 202 instead of the actual geometry. 203 204 MySQL 5.7 brough spatial indexes to InnoDB tables. Before that only MyISAM tables 205 supported spatial indexes. Anything else required a full table scan. 206 207 If you are using MySQL 5.7, good for you, and consider converting your geo tables 208 to InnoDB! (and let me know how it goes). 209 210 ### PHP 211 PHP 5.2.4 and higher are supported, just like WordPress's minimum version. 212 Please report any PHP errors you come across and we'll fix them up. 213 214 Frequently Asked Questions 215 -------------------------- 216 217 ### What spatial comparisons are supported? 218 219 Any spatial operation that takes two geometries and returns a boolean, 220 or which takes one geometry and returns a boolean or a value is 221 supported, if your version of MySQL supports it. 222 223 The following function should work, if your install of MySQL supports them: 224 225 <table> 226 <tr> 227 <td>Area</td> 228 <td>Contains</td> 229 <td>Crosses</td> 230 <td>Dimension</td> 231 </tr> 232 <tr> 233 <td>Disjoint</td> 234 <td>Equals</td> 235 <td>GLength</td> 236 <td>GeometryType</td> 237 </tr> 238 <tr> 239 <td>Intersects</td> 240 <td>IsClosed</td> 241 <td>IsEmpty</td> 242 <td>IsRing</td> 243 </tr> 244 <tr> 245 <td>IsSimple</td> 246 <td>MBRContains</td> 247 <td>MBRCoveredBy</td> 248 <td>MBRDisjoint</td> 249 </tr> 250 <tr> 251 <td>MBREqual</td> 252 <td>MBREquals</td> 253 <td>MBRIntersects</td> 254 <td>MBROverlaps</td> 255 </tr> 256 <tr> 257 <td>MBRTouches</td> 258 <td>MBRWithin</td> 259 <td>NumGeometries</td> 260 <td>NumInteriorRings</td> 261 </tr> 262 <tr> 263 <td>NumPoints</td> 264 <td>Overlaps</td> 265 <td>SRID</td> 266 <td>ST_Area</td> 267 </tr> 268 <tr> 269 <td>ST_Contains</td> 270 <td>ST_Crosses</td> 271 <td>ST_Difference</td> 272 <td>ST_Dimension</td> 273 </tr> 274 <tr> 275 <td>ST_Disjoint</td> 276 <td>ST_Distance</td> 277 <td>ST_Distance_Sphere</td> 278 <td>ST_Equals</td> 279 </tr> 280 <tr> 281 <td>ST_GeometryType</td> 282 <td>ST_Intersects</td> 283 <td>ST_IsClosed</td> 284 <td>ST_IsEmpty</td> 285 </tr> 286 <tr> 287 <td>ST_IsRing</td> 288 <td>ST_IsSimple</td> 289 <td>ST_IsValid</td> 290 <td>ST_Length</td> 291 </tr> 292 <tr> 293 <td>ST_NumPoints</td> 294 <td>ST_Overlaps</td> 295 <td>ST_SRID</td> 296 <td>ST_Touches</td> 297 </tr> 298 <tr> 299 <td>ST_Within</td> 300 <td>Touches</td> 301 <td>Within</td> 302 <td></td> 303 </tr> 304 </table> 305 306 To see what your install of MySQL supports, install 307 [WP Spatial Capabilities Check](https://wordpress.org/plugins/wp-spatial-capabilities-check/). 308 We recommend using MySQL 5.6.1 or higher since it included many important updates to 309 spatial operators. 310 311 Hooks: Filters and Actions 312 -------------------------- 313 314 * *Filter*: wpgm_pre_metaval_to_geom 297 The power of WordPress come partly from its Hooks system. WP-GeoMeta-Lib tries to provide the neccessary hooks 298 so that you can extend it to suit your needs. If there's a hook that you need send me a pull request or file an issue. 299 300 #### Filters 301 302 * wpgm_pre_metaval_to_geom 315 303 316 304 This filter is called right before WP-GeoMeta tries to convert the incoming meta value … … 343 331 ``` 344 332 345 * *Filter*:wpgm_pre_delete_geometa333 * wpgm_pre_delete_geometa 346 334 347 335 This filter is called after a meta value has been deleted from the regular meta table, right … … 373 361 ``` 374 362 375 * *Filter*: wp_geoquery_srid363 * wpgm_geoquery_srid 376 364 377 365 This filter is called during plugins_loaded. It sets the [SRID](https://en.wikipedia.org/wiki/Spatial_reference_system) … … 383 371 you know what you're doing. 384 372 385 * *Filter*: wpgq_metaval_to_geom373 * wpgm_metaval_to_geom 386 374 387 375 This filter is called within WP_GeoUtil::metaval_to_geom. It offers an opportunity to … … 393 381 Usage: 394 382 ``` 395 add_filter( 'wpg q_metaval_to_geom', 'kml_to_geometry' );383 add_filter( 'wpgm_metaval_to_geom', 'kml_to_geometry' ); 396 384 397 385 /** … … 410 398 ``` 411 399 412 * *Filter*: wpgq_geom_to_geojson400 * wpgm_geom_to_geojson 413 401 414 402 This filter is called when converting a geometry from the database into GeoJSON … … 420 408 Usage: 421 409 ``` 422 add_filter( 'wpg q_geom_to_geojson', 'myplugin_geom_to_geojson' );410 add_filter( 'wpgm_geom_to_geojson', 'myplugin_geom_to_geojson' ); 423 411 424 412 /** … … 434 422 ``` 435 423 436 * *Filter*: wpgmd_sample_data_to_json 437 438 This filter is called when loading a random sample of data for the map of spatial data 439 in the dashboard. It is used internally to create a GeoJSON representation of lat/lng 440 fields for display on the map. 441 442 Usage: 443 ``` 444 add_filter( 'wpgmd_sample_data_to_json', 'custom_sample_data' ); 445 446 /** 447 * 448 * @param array $record A single database query result array. 449 * $record['the_id'] -- The object ID the metadata belongs to 450 * $record['meta_key'] -- The meta_key for the metadata (from the postmeta (etc.) table, not the possibly modified version in the postmeta_geo (etc.) table ) 451 * $record['meta_value'] -- The meta_value for the metadata (from the postmeta (etc.) table, not the spatial version from the postmeta_geo (etc.) table) 452 * $record['geo_meta_value'] -- The meta_value from the postmeta_geo (etc.) table 453 * $record['geo_meta_key'] -- The meta_key from the postmeta_geo (etc.) table 454 * 455 * @param string $metatype The type of object this meta is for (post, user, etc.) 456 */ 457 function custom_sample_data( $record, $metatype ) { 458 if ( 'my_special_geo_meta_key' === $record[ 'geo_meta_key'] ) { 459 // Do something. 460 $record[ 'meta_value' ] = my_custom_geojson( $record[ 'geo_meta_value' ] ); 461 } 462 463 return $record; 464 } 465 ``` 466 467 * *Filter*: wpgq_known_capabilities 424 * wpgm_known_capabilities 468 425 469 426 This filter is available so you can make your custom MySQL functions known to other users of WP-GeoMeta-Lib. … … 479 436 Usage: 480 437 ``` 481 add_filter( 'wpg q_known_capabilities', 'myplugin_add_support_for_my_func' );438 add_filter( 'wpgm_known_capabilities', 'myplugin_add_support_for_my_func' ); 482 439 483 440 function myplugin_add_support_for_my_func( $all_funcs ) { … … 496 453 ``` 497 454 498 * *Action*: wpgm_populate_geo_tables 455 * wpgm_extra_sql_functions 456 457 This filter allows you to add additional custom SQL functions to MySQL. Combined with wpgm_known_capabilites 458 you can fully integrate your custom SQL into WP-GeoMeta-Lib. 459 460 This filter produces an array of file system paths to files containing SQL functions. The files should use 461 `$$` as the delimiter for the function. Please see any of the .sql files in this project for examples. 462 463 Usage: 464 ``` 465 add_filter( 'wpgm_extra_sql_functions', 'myplugin_add_extra_sql' ); 466 467 function myplugin_add_extra_sql( $all_sql_files ) { 468 469 $my_sql_files = array( 470 'custom_func1.sql', 471 'custom_func2.sql' 472 ); 473 474 foreach( $my_sql_files as $my_file ) { 475 $full_path = dirname( __FILE__ ) . '/sql/' . $my_file; 476 477 if ( !in_array( $full_path, $all_sql_files ) ) { 478 $all_sql_files[] = $full_path; 479 } 480 } 481 482 return $all_sql_files; 483 } 484 ``` 485 486 #### Actions 487 488 * wpgm_populate_geo_tables 499 489 500 490 This action is called at the end of WP_GeoMeta->populate_geo_tables() to give you … … 525 515 526 516 527 528 Why WP-GeoMeta? 529 --------------- 517 ### Calling Spatial Functions From PHP 518 519 Sometimes you might just need to run a spatial operation on a spatial value. WP-GeoMeta-Lib makes 520 this easy! 521 522 You can call any spatial function your install of MySQL supports as a static method of WP_GeoUtil. 523 These functions conveniently accept GeoJSON geometry so you don't have to convert your spatial 524 data into Well Known Text (WKT) for MySQL. 525 526 #### Examples 527 528 Check if two GeoJSON shapes intersect 529 ``` 530 $do_they_intersect = WP_GeoUtil::ST_Intersects({PointGeoJSON},{PolygonGeoJSON}); 531 ``` 532 533 Union (combine) two GeoJSON polygons 534 ``` 535 $spatial_union = WP_GeoUtil::ST_Union({PolygonGeoJSON_1},{PolygonGeoJSON_2}); 536 ``` 537 538 ### Custom Auxiliary Functions 539 540 Besides the default spatial functions included with MySQL, WP-GeoMeta-Lib 541 provides the filter wpgq_known_capabilities which lets you add support 542 for your own spatial SQL functions. These can be UDF (User Defined Functions) or Stored Functions. 543 544 WP-GeoMeta-Lib includes several stored functions for your convenience. 545 546 The functions included are: 547 548 * **wp_buffer_point_m( p POINT, radius FLOAT, segments INT)** 549 550 Buffer a point by a number of meters. Returns a polygon approximating a circle. 551 552 - _p_ A single point geometry with coordinates in EPSG:4326 (the common latitude/longitude format, like 45.0,-93.3) 553 - _radius_ The distance to buffer the point, in meters. 554 - _segments_ The number of segments per quarter of a circle. Eg. If you set this to 4, then your resulting polygon will have 16 segments. 555 556 * **wp_buffer_point_mi( p POINT, radius FLOAT, segments INT)** 557 558 Buffer a point by a number of miles. Returns a polygon approximating a circle. 559 560 - _p_ A single point geometry with coordinates in EPSG:4326. 561 - _radius_ The distance to buffer the point, in miles. 562 - _segments_ The number of segments per quarter of a circle. Eg. If you set this to 4, then your resulting polygon will have 16 segments. 563 564 * **wp_buffer_point_real( p POINT, radius FLOAT, segments INT, eradius INTEGER)** 565 566 Buffer a point assuming an earth with a specified radius. Returns a polygon approximating a circle. 567 568 - _p_ A single point geometry with coordinates in EPSG:4326. 569 - _radius_ The distance to buffer the point, in any units. 570 - _segments_ The number of segments per quarter of a circle. Eg. If you set this to 4, then your resulting polygon will have 16 segments. 571 - _eradius_ The radius of the earth in the same units as _radius_ 572 573 * **wp_distance_point_m( p1 POINT, p2 POINT)** 574 575 Get the distance between two points in meters. 576 577 - _p1_ A single point geometry with coordinates in EPSG:4326. 578 - _p2_ A single point geometry with coordinates in EPSG:4326. 579 580 * **wp_distance_point_mi( p1 POINT, p2 POINT)** 581 582 Get the distance between two points in miles. 583 584 - _p1_ A single point geometry with coordinates in EPSG:4326. 585 - _p2_ A single point geometry with coordinates in EPSG:4326. 586 587 * **wp_distance_point_real( p1 POINT, p2 POINT, radius FLOAT)** 588 589 Get the distance between two points for a given radius of the earth. 590 591 - _p1_ A single point geometry with coordinates in EPSG:4326. 592 - _p2_ A single point geometry with coordinates in EPSG:4326. 593 - _radius_ The radius of the earth in the units you want your results in. 594 595 * **wp_first_geom( p GEOMETRY )** 596 597 Get the first geometry from a multi-geometry. If _p_ is not a multi-geometry, it will be returned unchanged. 598 599 - _p_ A geometry object. 600 601 * **wp_point_bearing_distance_to_line_m(p POINT, bearing FLOAT, distance FLOAT)** 602 603 Create a linestring given a starting point, a bearing and a distance in meters. 604 605 _p_ A single point geometry with coordinates in EPSG:4326. 606 _bearing_ The bearing to travel in degrees. 0 degrees is north. 607 _distance_ The number of meters to travel. 608 609 * **wp_point_bearing_distance_to_line_mi(p POINT, bearing FLOAT, distance FLOAT)** 610 611 Create a linestring given a starting point, a bearing and a distance in miles. 612 613 _p_ A single point geometry with coordinates in EPSG:4326. 614 _bearing_ The bearing to travel in degrees. 0 degrees is north. 615 _distance_ The number of miles to travel. 616 617 * **wp_point_bearing_distance_to_line(p POINT, bearing FLOAT, distance FLOAT, eradius INTEGER)** 618 619 Create a linestring given a starting point, a bearing, a distance and the radius of the earth. 620 621 _p_ A single point geometry with coordinates in EPSG:4326. 622 _bearing_ The bearing to travel in degrees. 0 degrees is north. 623 _distance_ The distance to travel. 624 _eradius_ The radius of the earth in the same units as _distance_. 625 626 627 * **wp_point_bearing_distance_coord_pair(p POINT, bearing FLOAT, distance FLOAT, eradius INTEGER)** 628 629 Get the point a given distance from a starting point on a given bearing for a given radius of the earth. 630 631 _p_ A single point geometry with coordinates in EPSG:4326. 632 _bearing_ The bearing to travel in degrees. 0 degrees is north. 633 _distance_ The distance to travel. 634 _eradius_ The radius of the earth in the same units as _distance_. 635 636 637 Why WP-GeoMeta-Lib? 638 ------------------- 639 640 If your plugin or website uses location data, then you should be using WP-GeoMeta-Lib. WP-GeoMeta-Lib 641 makes using spatial data *easy* and *efficient*. 642 643 All metadata goes into a big meta table, regardless of what type of data it is. All values are stored 644 as longtext and there's not even an index on the column. This is fine for looking up values if you 645 know the post ID and the key name. It's less than ideal if you need to search for a certain value 646 and it's absolutely terrible if you want to store or search for spatial data. 647 648 WP-GeoMeta-Lib detects when you are storing or querying spatial data and transparently re-routes those 649 data and queries to a set of spatial metadata tables. These spatial metadata tables are indexed and give you 650 the ability to use all of the spatial functions built in to MySQL. 651 530 652 531 653 ### Integration with Other Plugins 532 654 533 You might not need spatial queries yourself, but by using WP-GeoMeta you allowother developers to655 Even if you don't need spatial queries yourself, using WP-GeoMeta-Lib allows other developers to 534 656 query your data more easily. 535 657 … … 543 665 Storing lat and long in separate fields means that you have to implement your own 544 666 [complicated queries](http://stackoverflow.com/questions/20795835/wordpress-and-haversine-formula) 545 if you want to search by distance. 546 547 You'll only be able to store points, and you won't have indexing available. 548 549 ### OK, fine, but I really need separate fields 550 667 if you want to search by distance. You won't be able to store lines or polygons, 668 there's no indexing on your points and geographers everywhere will cry. 669 670 #### OK, fine, but I really need separate fields 671 672 If you really need (or already are using) separate longitude and latitude fields 551 673 Using separate Latitude and Longitude fields is slightly more complex, but is 552 674 supported by WP-GeoMeta. You will need to register your new latitude/longitude … … 573 695 supported out of the box. 574 696 575 How to Use WP-GeoMeta576 ---------------------577 578 1. Download [the latest version](https://github.com/cimburadotcom/WP-GeoMeta/releases) of WP-GeoMeta to579 a sub-directory inside your plugin — ```myplugin/wp-geometa```580 581 2. Within your plugin require *wp-geometa.php* — ```require_once( dirname( __FILE__ ) . 'wp-geometa/wp-geometa.php' )```582 583 3. Add an activation hook to your plugin to create the spatial tables584 585 ```586 function my_activation_hook() {587 $wpgeo = WP_GeoMeta::get_instance();588 $wpgeo->create_geo_tables();589 }590 register_activation_hook( __FILE__ , 'my_activation_hook' );591 ```592 593 594 4. Use the usual postmeta functions within your plugin (update_post_meta, update_user_meta, etc.)595 using GeoJSON as the values.596 597 5. See the [README.md](README.md) document for instructions on how to query your data.598 599 600 697 Important Notes 601 698 --------------- … … 608 705 * Some MySQL spatial functions only work on the Bounding Box of the shape and not the actual geometry. For details about 609 706 when and why this is a problem, see [this 2013 blog post from Percona](https://www.percona.com/blog/2013/10/21/using-the-new-mysql-spatial-functions-5-6-for-geo-enabled-applications/). 707 708 Server Requirements 709 ------------------- 710 711 ### WordPress 712 This library supports storing spatial metadata for posts, users, comments and 713 terms. 714 715 Setting, getting and querying values should work in 4.1 with some missing functionality. 716 Running orderby doesn't work until 4.2 717 Searching term metadata arrived in WordPress 4.4, but other 718 functionality should still work in older versions of WordPress. 719 720 ### MySQL 721 722 MySQL 5.6.1 or higher is strongly recommended. Lower than MySQL 5.1.72 is untested. 723 724 WP_GeoMeta will probably work on MySQL 5.4, but spatial support was pretty weak 725 before version 5.6.1. 726 727 Before MySQL 5.6.1 spatial functions worked against the mininum bounding rectangle 728 instead of the actual geometry. 729 730 MySQL 5.7 brough spatial indexes to InnoDB tables. Before that only MyISAM tables 731 supported spatial indexes. Anything else required a full table scan. 732 733 If you are using MySQL 5.7, good for you, and consider converting your geo tables 734 to InnoDB! (and let me know how it goes). 735 736 ### PHP 737 PHP 5.2.4 and higher are supported, just like WordPress's minimum version. 738 Please report any PHP errors you come across and we'll fix them up. 610 739 611 740 Hacking -
wp-geometa/trunk/lib/wp-geometa-lib/geoPHP/geoPHP.inc
r1544952 r1607853 9 9 10 10 // Adapters 11 include_once( "lib/adapters/GeoAdapter.class.php"); // Abtract class12 include_once( "lib/adapters/GeoJSON.class.php");13 include_once( "lib/adapters/WKT.class.php");14 include_once( "lib/adapters/EWKT.class.php");15 include_once( "lib/adapters/WKB.class.php");16 include_once( "lib/adapters/EWKB.class.php");17 include_once( "lib/adapters/KML.class.php");18 include_once( "lib/adapters/GPX.class.php");19 include_once( "lib/adapters/GeoRSS.class.php");20 include_once( "lib/adapters/GoogleGeocode.class.php");21 include_once( "lib/adapters/GeoHash.class.php");11 include_once(dirname(__FILE__) . "/lib/adapters/GeoAdapter.class.php"); // Abtract class 12 include_once(dirname(__FILE__) . "/lib/adapters/GeoJSON.class.php"); 13 include_once(dirname(__FILE__) . "/lib/adapters/WKT.class.php"); 14 include_once(dirname(__FILE__) . "/lib/adapters/EWKT.class.php"); 15 include_once(dirname(__FILE__) . "/lib/adapters/WKB.class.php"); 16 include_once(dirname(__FILE__) . "/lib/adapters/EWKB.class.php"); 17 include_once(dirname(__FILE__) . "/lib/adapters/KML.class.php"); 18 include_once(dirname(__FILE__) . "/lib/adapters/GPX.class.php"); 19 include_once(dirname(__FILE__) . "/lib/adapters/GeoRSS.class.php"); 20 include_once(dirname(__FILE__) . "/lib/adapters/GoogleGeocode.class.php"); 21 include_once(dirname(__FILE__) . "/lib/adapters/GeoHash.class.php"); 22 22 23 23 // Geometries 24 include_once( "lib/geometry/Geometry.class.php"); // Abtract class25 include_once( "lib/geometry/Point.class.php");26 include_once( "lib/geometry/Collection.class.php"); // Abtract class27 include_once( "lib/geometry/LineString.class.php");28 include_once( "lib/geometry/MultiPoint.class.php");29 include_once( "lib/geometry/Polygon.class.php");30 include_once( "lib/geometry/MultiLineString.class.php");31 include_once( "lib/geometry/MultiPolygon.class.php");32 include_once( "lib/geometry/GeometryCollection.class.php");24 include_once(dirname(__FILE__) . "/lib/geometry/Geometry.class.php"); // Abtract class 25 include_once(dirname(__FILE__) . "/lib/geometry/Point.class.php"); 26 include_once(dirname(__FILE__) . "/lib/geometry/Collection.class.php"); // Abtract class 27 include_once(dirname(__FILE__) . "/lib/geometry/LineString.class.php"); 28 include_once(dirname(__FILE__) . "/lib/geometry/MultiPoint.class.php"); 29 include_once(dirname(__FILE__) . "/lib/geometry/Polygon.class.php"); 30 include_once(dirname(__FILE__) . "/lib/geometry/MultiLineString.class.php"); 31 include_once(dirname(__FILE__) . "/lib/geometry/MultiPolygon.class.php"); 32 include_once(dirname(__FILE__) . "/lib/geometry/GeometryCollection.class.php"); 33 33 34 34 class geoPHP -
wp-geometa/trunk/lib/wp-geometa-lib/wp-geometa-lib-loader.php
r1557784 r1607853 1 1 <?php 2 3 2 /** 4 * This is the loader file for WP-GeoMeta-lib. 3 * This is the loader file for WP-GeoMeta-lib. 4 * 5 * @package wp-geometa-lib 6 * 7 * Version: 0.3.2 5 8 * 6 9 * To include spatial metadata support in your plugin, simply include this file. … … 8 11 * WP-GeoMeta-lib handles having multiple versions of itself installed corretly, always loading the latest version. 9 12 * 10 * It also handles setting up the spatial meta tables, so this file should be included directly, and not inside a hook or action 11 * 13 * It also handles setting up the spatial meta tables, so this file should be included directly, and not inside a hook or action. 12 14 */ 13 14 15 15 16 defined( 'ABSPATH' ) or die( 'No direct access' ); 16 17 17 $wp_geometa_version = '0.3.1'; // Also change down in wp_geometa_load_older_version() 18 $wp_geometa_version = '0.3.2'; 19 20 if ( ! class_exists( 'WP_GeoMeta_Installs' ) ) { 21 /** 22 * This class is deliberately simple, because if it ever changes 23 * the changes need to be backwards compatible. 24 * 25 * We're using a singleton instead of a global array to capture 26 * each WP-GeoMeta's version and location. 27 */ 28 class WP_GeoMeta_Installs { 29 /** 30 * List of installs 31 * 32 * @var $installs 33 */ 34 public static $installs = array(); 35 36 /** 37 * List of versions 38 * 39 * @var $versions 40 */ 41 public static $versions = array(); 42 43 /** 44 * Add an install listing 45 * 46 * @param string $file __FILE__ of wp-geometa.php. 47 * @param string $version the version of wp-geometa.php. 48 */ 49 public static function add( $file, $version ) { 50 WP_GeoMeta_Installs::$installs[ $file ] = $version; 51 WP_GeoMeta_Installs::$versions[ $version ] = $file; 52 } 53 54 /** 55 * Get the list of installs with versions. 56 */ 57 public static function get_list() { 58 return WP_GeoMeta_Installs::$installs; 59 } 60 61 /** 62 * A loader function for apl_autoload_register. 63 * 64 * This gets called by PHP if LeafletPHP is not a class. 65 * 66 * This is preferable to always loading the class, since 67 * this will avoid loading it if it's not needed. 68 * 69 * @param string $class_name The class name that PHP is looking for. 70 */ 71 public static function load( $class_name ) { 72 if ( in_array( $class_name, array( 'WP_GeoMeta', 'WP_GeoQuery', 'WP_GeoUtil' ), true ) ) { 73 WP_GeoMeta_Installs::load_now(); 74 } 75 } 76 77 /** 78 * This method will go away eventually. 79 */ 80 public static function load_now() { 81 // Sort keys by version_compare. 82 uksort( WP_GeoMeta_Installs::$versions, 'version_compare' ); 83 84 // Go to the end of the array and require the file. 85 // Then get the directory. 86 $this_dir = dirname( end( WP_GeoMeta_Installs::$versions ) ); 87 88 // Require the wp-geometa-lib file which will handle DB upgrades, initializing stuff and setting up needed hooks. 89 require_once( $this_dir . '/wp-geometa-lib.php' ); 90 } 91 } 92 93 // Let PHP auto loading only include the file if needed. 94 spl_autoload_register( array( 'WP_GeoMeta_Installs', 'load' ) ); 95 96 add_action( 'plugins_loaded', array( 'WP_GeoMeta_Installs', 'load_now' ) ); 97 } 98 99 // Add ourself to the list of installs. 100 WP_GeoMeta_Installs::add( __FILE__, $wp_geometa_version ); 18 101 19 102 /** 20 * Gather some self metadata so that if WP-GeoMeta is included as a lib in multiple plugins 21 * and/or as a plugin itself, we can determine which one to load. 103 * Legacy handling 104 * 105 * If we detect an older version of WP_GeoMeta, do the old stuff to make sure we get loaded. 22 106 */ 23 107 $wp_geometa_max_version = get_option( 'wp_geometa_version', '0.0.0' ); 24 $wp_geometa_db_version = get_option( 'wp_geometa_db_version', '0.0.0' );25 108 26 109 /** … … 29 112 * 1 means our version is higher. 30 113 */ 31 $wp_geometa_version_status = version_compare( $wp_geometa_version, $wp_geometa_max_version ); 114 if ( '0.0.0' !== $wp_geometa_max_version && 1 === version_compare( $wp_geometa_version, $wp_geometa_max_version ) ) { 115 require_once( dirname( __FILE__ ) . '/wp-geometa-lib.php' ); 32 116 117 if ( ! function_exists( 'wp_geometa_load_older_version' ) ) { 118 /** 119 * Do nothing, just stop older versions from defining this function which would cause them to load. 120 */ 121 function wp_geometa_load_older_version() { 122 } 123 } 33 124 34 // If our version is higher than the version in wp_options, then bump the DB version 35 // so that our verison will be the one to load next time. 36 if ( 1 === $wp_geometa_version_status ) { 37 update_option( 'wp_geometa_version', $wp_geometa_version ); 38 } 39 40 // If our version is equal or higher to the db version, try to load our instance 41 if ( 0 >= $wp_geometa_version_status || '0.0.0' === $wp_geometa_max_version ) { 42 43 // Other instances of WP_GeoMeta shouldn't have loaded these classes 44 // unless they're the same version as this instance. 45 if ( ! class_exists( 'WP_GeoMeta' ) ) { 46 require_once( dirname( __FILE__ ) . '/wp-geoquery.php' ); 47 require_once( dirname( __FILE__ ) . '/wp-geometa.php' ); 48 $wpgeo = WP_GeoMeta::get_instance(); 49 $wpgq = WP_GeoQuery::get_instance(); 50 51 define( 'WP_GEOMETA_VERSION', $wp_geometa_version ); 52 53 // Since we just got loaded, make sure that the database reflects any 54 // changes that the latest version of WP_GeoMeta might have added. 55 $db_version_compare = version_compare( $wp_geometa_version, $wp_geometa_db_version ); 56 if ( $db_version_compare > 0 ) { 57 $wpgeo->create_geo_tables(); 58 59 $wp_geoutil = WP_GeoUtil::get_instance(); 60 $wp_geoutil->get_capabilities( true ); 61 update_option( 'wp_geometa_db_version', $wp_geometa_version ); 125 if ( ! function_exists( 'wpgeometa_setup_latlng_fields' ) ) { 126 /** 127 * Do nothing, just stop older versions from defining this function. 128 */ 129 function wpgeometa_setup_latlng_fields() { 62 130 } 63 131 } 64 132 } 65 66 /**67 * There's a chance that someone installed a newer version of the plugin,68 * (or a plugin that used the library) which caused the option to get set,69 * then removed that plugin, which would mean that we aren't loading the70 * usual way.71 *72 * Add an action to try to load our classes after the rest of the plugins73 * get a chance to load.74 */75 if ( ! function_exists( 'wp_geometa_load_older_version' ) ) {76 /**77 * Load this instance's libraries.78 */79 function wp_geometa_load_older_version() {80 if ( ! class_exists( 'WP_GeoMeta' ) ) {81 82 require_once( dirname( __FILE__ ) . '/wp-geoquery.php' );83 require_once( dirname( __FILE__ ) . '/wp-geometa.php' );84 $wpgeo = WP_GeoMeta::get_instance();85 $wpgq = WP_GeoQuery::get_instance();86 87 $wp_geometa_version = '0.3.1';88 $wp_geometa_max_version = get_option( 'wp_geometa_version', '0.0.0' );89 $wp_geometa_db_version = get_option( 'wp_geometa_db_version', '0.0.0' );90 91 // Since we just got loaded, make sure that the database reflects any92 // changes that the latest version of WP_GeoMeta might have added.93 $db_version_compare = version_compare( $wp_geometa_version, $wp_geometa_db_version );94 if ( 0 > $db_version_compare ) {95 $wpgeo->create_geo_tables();96 97 $wp_geoutil = WP_GeoUtil::get_instance();98 $wp_geoutil->get_capabilities( true );99 update_option( 'wp_geometa_db_version', $wp_geometa_version );100 }101 102 /*103 * If we got downgraded, then the first found wp-geometa will have been104 * loaded. Lowering the version to this instance's version will allow105 * WP GeoMeta to pick the highest version again on the next run.106 *107 * Eg. This is v5 and is the first one that WP finds. v6 is also installed108 * and v7 was installed. When v7 is no longer found, this (v5) will run since109 * it was the first one found and will set wp_geometa_version to v5.110 *111 * On the next run, it would find that v6 is the higher version and would update112 * wp_geometa_version. On the run after that v6 would be loaded.113 */114 update_option( 'wp_geometa_version', $wp_geometa_version );115 }116 }117 add_action( 'plugins_loaded', 'wp_geometa_load_older_version' );118 }119 120 121 /**122 * Handle tasks that only matter if we're on the dashboard.123 *124 * The dashboard allows some actions that should be admin only.125 */126 if ( is_admin() ) {127 if ( ! class_exists( 'WP_GeoMeta_Installs' ) ) {128 /**129 * This class is deliberately simple, because if it ever changes130 * the changes need to be backwards compatible.131 *132 * We're using a singleton instead of a global array to capture133 * each WP-GeoMeta's version and location.134 */135 class WP_GeoMeta_Installs {136 /**137 * Singleton variable138 *139 * @var $_instance140 */141 private static $_instance = null;142 143 /**144 * Get the singleton instance.145 */146 public static function get_instance() {147 return ( is_null( self::$_instance ) ? new self : self::$_instance );148 }149 150 /**151 * Add an install listing152 *153 * @param string $file __FILE__ of wp-geometa.php.154 * @param string $version the version of wp-geometa.php.155 */156 public static function add( $file, $version ) {157 $self = self::$_instance = WP_GeoMeta_Installs::get_instance();158 $self->installs[ $file ] = $version;159 }160 161 /**162 * Get the list of installs with versions.163 */164 public static function get_list() {165 $self = WP_GeoMeta_Installs::get_instance();166 return $self->installs;167 }168 }169 }170 171 // Add ourself to the list of installs.172 WP_GeoMeta_Installs::add( __FILE__, $wp_geometa_version );173 }174 175 /**176 * Set up an activation hook for when this is a plugin.177 *178 * Plugins using this as a lib should run $wpgeo->create_geo_tables() themselves179 */180 if ( ! function_exists( 'wpgeometa_activation_hook' ) ) {181 /**182 * Simple callback for the activation hook. Creates the spatial tables.183 */184 function wpgeometa_activation_hook() {185 require_once( dirname( __FILE__ ) . '/wp-geometa.php' );186 $wpgeo = WP_GeoMeta::get_instance();187 $wpgeo->create_geo_tables();188 }189 register_activation_hook( __FILE__ , 'wpgeometa_activation_hook' );190 }191 192 /**193 * Set up handling for standard latlng fields194 */195 if ( ! function_exists( 'wpgeometa_setup_latlng_fields' ) ) {196 /**197 * A simple callback function to register the WordPress Geodata standard latitude and longitude fields198 *199 * See also https://codex.wordpress.org/Geodata for more info.200 */201 function wpgeometa_setup_latlng_fields() {202 WP_GeoMeta::add_latlng_field( 'geo_latitude', 'geo_longitude', 'geo_' );203 }204 add_action( 'init', 'wpgeometa_setup_latlng_fields' );205 } -
wp-geometa/trunk/lib/wp-geometa-lib/wp-geometa.php
r1557784 r1607853 1 1 <?php 2 2 /** 3 * This class handles creating spatial tables saving geo metadata3 * This class handles creating spatial tables and saving geo metadata 4 4 * 5 5 * @package wp-geometa … … 10 10 */ 11 11 12 defined( 'ABSPATH' ) or die( 'No direct access' );13 14 /**15 * This class uses GeoUtil16 */17 require_once( dirname( __FILE__ ) . '/wp-geoutil.php' );18 19 12 /** 20 13 * WP_GeoMeta is responsible for detecting when the user … … 24 17 class WP_GeoMeta { 25 18 /** 19 * The version of WP_GeoMeta. 20 * 21 * Gets set by autoloader 22 * 23 * @var $version 24 */ 25 public static $version; 26 27 /** 26 28 * Seems like if we call dbDelta twice in rapid succession then we end up 27 29 * with a MySQL error, at least on MySQL 5.5. Other versions untested. … … 69 71 public static $latlngs_index = array(); 70 72 73 /** 74 * List of extra SQL files to load. 75 * 76 * @var $extra_sql 77 */ 78 private $extra_sql = array( 'first_geometry.sql', 'buffer_point.sql' , 'distance_point.sql', 'point_bearing_distance.sql' ); 71 79 72 80 /** … … 85 93 } 86 94 95 if ( ! defined( 'WP_GEOMETA_VERSION' ) && ! empty( WP_GeoMeta::$version ) ) { 96 define( 'WP_GEOMETA_VERSION', WP_GeoMeta::$version ); 97 } 98 87 99 return self::$_instance; 88 100 } … … 100 112 } 101 113 102 add_filter( 'wpgm_pre_metaval_to_geom', array( $this, 'handle_latlng_meta' ), 10, 2 ); 103 add_filter( 'wpgm_populate_geo_tables', array( $this, 'populate_latlng_geo' ) ); 104 add_filter( 'wpgm_pre_delete_geometa', array( $this, 'delete_latlng_geo' ), 10, 5 ); 114 WP_GeoMeta::add_latlng_field( 'geo_latitude', 'geo_longitude', 'geo_' ); 115 116 add_filter( 'wpgm_pre_metaval_to_geom', array( $this, 'wpgm_pre_metaval_to_geom' ), 10, 2 ); 117 add_filter( 'wpgm_populate_geo_tables', array( $this, 'wpgm_populate_geo_tables' ) ); 118 add_filter( 'wpgm_pre_delete_geometa', array( $this, 'wpgm_pre_delete_geometa' ), 10, 5 ); 119 add_filter( 'wpgm_extra_sql_functions', array( $this, 'wpgm_extra_sql_functions' ) ); 120 } 121 122 /** 123 * Install the tables and custom SQL queries 124 */ 125 public static function install() { 126 $wpgm = WP_GeoMeta::get_instance(); 127 update_option( 'wp_geometa_db_version', WP_GEOMETA_VERSION ); 128 129 // This will go away once autoloading is configured. 130 update_option( 'wp_geometa_version', WP_GEOMETA_VERSION ); 131 $wpgm->create_geo_tables(); 132 $wpgm->install_extra_sql_functions(); 133 } 134 135 /** 136 * Upgrade databases, if they exist. 137 */ 138 public function upgrade() { 139 $this->create_geo_tables(); 140 $this->install_extra_sql_functions(); 141 142 update_option( 'wp_geometa_db_version', WP_GEOMETA_VERSION ); 143 update_option( 'wp_geometa_version', WP_GEOMETA_VERSION ); 144 145 $wp_geoutil = WP_GeoUtil::get_instance(); 146 $wp_geoutil->get_capabilities( true ); 105 147 } 106 148 … … 190 232 foreach ( $this->meta_types as $type ) { 191 233 $show_index = 'SHOW INDEX FROM ' . _get_meta_table( $type ) . '_geo WHERE Key_name=\'meta_val_spatial_idx\';'; 192 $add_index = 'CREATE SPATIAL INDEX meta_val_spatial_idx ON ' . _get_meta_table( $type ) . '_geo (meta_value);'; 193 194 $found_query = $wpdb->query( $show_index ); 234 $add_index = 'CREATE SPATIAL INDEX meta_val_spatial_idx ON ' . _get_meta_table( $type ) . '_geo (meta_value);'; 235 236 $found_query = $wpdb->query( $show_index ); // @codingStandardsIgnoreLine 195 237 if ( $found_query === 0 ) { 196 $wpdb->query( $add_index ); 238 $wpdb->query( $add_index ); // @codingStandardsIgnoreLine 197 239 } 198 240 } … … 200 242 $wpdb->suppress_errors( $suppress ); 201 243 $wpdb->show_errors( $errors ); 202 203 // These files add extra SQL support 204 $extra_sql = array( 'first_geometry.sql', 'buffer_point.sql' , 'distance_point.sql', 'point_bearing_distance.sql' ); 205 foreach( $extra_sql as $sql_file ) { 206 $sql_code = file_get_contents( __DIR__ . '/sql/' . $sql_file ); 207 // $sql_code = preg_replace('DELIMITER.*','',$sql_code ); 208 $sql_code = explode('$$', $sql_code); 209 $sql_code = array_map('trim',$sql_code); 210 $sql_code = array_filter($sql_code, function($statement){ 244 } 245 246 /** 247 * Install handy extra SQL functions 248 */ 249 public function install_extra_sql_functions() { 250 global $wpdb; 251 252 $sql_files = apply_filters( 'wpgm_extra_sql_functions', array() ); 253 254 $suppress = $wpdb->suppress_errors( true ); 255 $errors = $wpdb->show_errors( false ); 256 257 // These files add extra SQL support. 258 foreach ( $sql_files as $sql_file ) { 259 260 if ( ! is_file( $sql_file ) ) { 261 continue; 262 } 263 264 $sql_code = file_get_contents( $sql_file ); // @codingStandardsIgnoreLine 265 $sql_code = explode( '$$', $sql_code ); 266 $sql_code = array_map( 'trim',$sql_code ); 267 $sql_code = array_filter($sql_code, function( $statement ) { 211 268 if ( empty( $statement ) ) { 212 269 return false; 213 270 } 214 if ( strpos( $statement, 'DELIMITER') !== FALSE) {271 if ( strpos( $statement, 'DELIMITER' ) !== false ) { 215 272 return false; 216 273 } 217 274 return true; 218 275 }); 219 foreach( $sql_code as $statement ) { 220 $res = $wpdb->query( $statement ); 221 $a = 1; 222 } 223 } 276 foreach ( $sql_code as $statement ) { 277 $res = $wpdb->query( $statement ); // @codingStandardsIgnoreLine 278 } 279 } 280 281 $wpdb->suppress_errors( $suppress ); 282 $wpdb->show_errors( $errors ); 224 283 } 225 284 … … 228 287 */ 229 288 public function uninstall() { 289 $this->uninstall_tables(); 290 $this->uninstall_extra_sql_functions(); 291 } 292 293 /** 294 * Un-create the geo tables 295 */ 296 public function uninstall_tables() { 230 297 global $wpdb; 231 298 … … 238 305 } 239 306 240 $extra_sql = array( 'first_geometry.sql', 'buffer_point.sql' , 'distance_point.sql', 'point_bearing_distance.sql' ); 241 242 foreach( $extra_sql as $sql_file ) { 243 $sql_code = file_get_contents( __DIR__ . '/sql/' . $sql_file ); 244 // $sql_code = preg_replace('DELIMITER.*','',$sql_code ); 245 $sql_code = explode('$$', $sql_code); 246 $sql_code = array_map('trim',$sql_code); 247 $sql_code = array_filter($sql_code, function($statement){ 248 if ( strpos($statement, 'DROP FUNCTION') === FALSE ) { 307 $wpdb->suppress_errors( $suppress ); 308 $wpdb->show_errors( $errors ); 309 } 310 311 /** 312 * Remove the extra SQL functions 313 */ 314 public function uninstall_extra_sql_functions() { 315 global $wpdb; 316 317 $sql_files = apply_filters( 'wpgm_extra_sql_functions', array() ); 318 319 $suppress = $wpdb->suppress_errors( true ); 320 $errors = $wpdb->show_errors( false ); 321 322 foreach ( $sql_files as $sql_file ) { 323 324 if ( ! is_file( $sql_file ) ) { 325 continue; 326 } 327 328 $sql_code = file_get_contents( $sql_file ); // @codingStandardsIgnoreLine 329 $sql_code = explode( '$$', $sql_code ); 330 $sql_code = array_map( 'trim',$sql_code ); 331 $sql_code = array_filter($sql_code, function( $statement ) { 332 if ( strpos( $statement, 'DROP FUNCTION' ) === false ) { 249 333 return false; 250 334 } 251 335 return true; 252 336 }); 253 foreach( $sql_code as $statement ) { 254 $res = $wpdb->query( $statement ); 255 $a = 1; 337 foreach ( $sql_code as $statement ) { 338 $res = $wpdb->query( $statement ); // @codingStandardsIgnoreLine 256 339 } 257 340 } … … 463 546 ORDER BY $metatable.$meta_pkey 464 547 LIMIT 100"; 465 548 466 549 $res = $wpdb->get_results( $q,ARRAY_A ); // @codingStandardsIgnoreLine 467 550 $found_rows = count( $res ); … … 519 602 * @param string $object_type Which WP type is it? (comment/user/post/term). 520 603 */ 521 public static function handle_latlng_meta( $meta_args, $object_type ) {604 public static function wpgm_pre_metaval_to_geom( $meta_args, $object_type ) { 522 605 $object_id = $meta_args[1]; 523 606 $metakey = $meta_args[2]; … … 565 648 * It gives us an opportunity to re-populate the meta table if needed. 566 649 */ 567 public function populate_latlng_geo() {650 public function wpgm_populate_geo_tables() { 568 651 global $wpdb; 569 652 … … 642 725 * @return The array of meta IDs to delete. 643 726 */ 644 public function delete_latlng_geo( $meta_ids, $type, $object_id, $meta_key, $meta_value ) {727 public function wpgm_pre_delete_geometa( $meta_ids, $type, $object_id, $meta_key, $meta_value ) { 645 728 global $wpdb; 646 729 … … 673 756 return $meta_ids; 674 757 } 758 759 /** 760 * Callback to turn $this->extra_sql into absolute paths. 761 * 762 * @param array $sql_files An array of extra SQL files to load functions from. 763 */ 764 public function wpgm_extra_sql_functions( $sql_files ) { 765 foreach ( $this->extra_sql as $extra_sql ) { 766 $full_path = dirname( __FILE__ ) . '/sql/' . $extra_sql; 767 if ( ! in_array( $full_path, $sql_files, true ) ) { 768 $sql_files[] = $full_path; 769 } 770 } 771 return $sql_files; 772 } 675 773 } -
wp-geometa/trunk/lib/wp-geometa-lib/wp-geoutil.php
r1557784 r1607853 9 9 * @license GNU GPL v2 10 10 */ 11 12 defined( 'ABSPATH' ) or die( 'No direct access' );13 14 /**15 * Include geoPHP for this function16 */17 require_once( dirname( __FILE__ ) . '/geoPHP/geoPHP.inc' );18 11 19 12 /** … … 234 227 235 228 /** 229 * Has plugins loaded been run yet? 230 * 231 * @var $plugins_loaded_run 232 */ 233 public static $plugins_loaded_run = false; 234 235 /** 236 236 * The instance variable 237 237 * … … 246 246 public static function get_instance() { 247 247 if ( is_null( self::$_instance ) ) { 248 global $wp_actions; 248 249 self::$_instance = new self; 249 self::$geojson = new GeoJSON();250 self::$geowkt = new WKT();251 250 self::$srid = 4326; 252 add_action( 'plugins_loaded', array( 'WP_GeoUtil', 'plugins_loaded' ) ); 251 252 if ( isset( $wp_actions['plugins_loaded'] ) ) { 253 WP_GeoUtil::plugins_loaded(); 254 } else { 255 add_action( 'plugins_loaded', array( 'WP_GeoUtil', 'plugins_loaded' ) ); 256 } 257 258 spl_autoload_register( array( 'WP_GeoUtil', 'spl_autoload_register' ) ); 253 259 } 254 260 255 261 return self::$_instance; 262 } 263 264 /** 265 * Handle autoloading when looking for the geoPHP class. 266 * 267 * @param string $class_name The class name that PHP is looking for. 268 */ 269 public static function spl_autoload_register( $class_name ) { 270 if ( in_array( $class_name, array( 'WKT', 'GeoJSON' ), true ) ) { 271 /** 272 * Include geoPHP for this function 273 */ 274 require_once( dirname( __FILE__ ) . '/geoPHP/geoPHP.inc' ); 275 } 256 276 } 257 277 … … 261 281 */ 262 282 public static function plugins_loaded() { 263 WP_GeoUtil::$srid = apply_filters( 'wp_geoquery_srid', 4326 ); 264 265 $orig_funcs = array_map('strtolower',WP_GeoUtil::$all_funcs); 266 WP_GeoUtil::$all_funcs = apply_filters( 'wpgq_known_capabilities', WP_GeoUtil::$all_funcs); 267 $new_funcs = array_map('strtolower',WP_GeoUtil::$all_funcs); 283 284 WP_GeoUtil::$srid = apply_filters( 'wpgm_geoquery_srid', 4326 ); 285 286 /* This filter has been deprecated and will be removed in a future version. */ 287 WP_GeoUtil::$srid = apply_filters( 'wp_geoquery_srid', WP_GeoUtil::$srid ); 288 289 $orig_funcs = array_map( 'strtolower',WP_GeoUtil::$all_funcs ); 290 291 WP_GeoUtil::get_all_funcs(); 292 293 WP_GeoUtil::$plugins_loaded_run = true; 294 295 $new_funcs = array_map( 'strtolower',WP_GeoUtil::$all_funcs ); 296 268 297 $diff = array_diff( $new_funcs, $orig_funcs ); 269 298 if ( count( $diff ) > 0 ) { 270 299 WP_GeoUtil::get_capabilities( true, false ); 271 300 } 301 } 302 303 /** 304 * This function loads all known functions, including applying filters to load from other plugins. 305 */ 306 public static function get_all_funcs() { 307 WP_GeoUtil::$all_funcs = apply_filters( 'wpgm_known_capabilities', WP_GeoUtil::$all_funcs ); 308 309 /* This filter has been deprecated and will be removed in a future version. */ 310 WP_GeoUtil::$all_funcs = apply_filters( 'wpgq_known_capabilities', WP_GeoUtil::$all_funcs ); 311 312 WP_GeoUtil::$all_funcs = array_unique( WP_GeoUtil::$all_funcs ); 313 314 return WP_GeoUtil::$all_funcs; 272 315 } 273 316 … … 337 380 * 338 381 * @param anything $metaval The value to turn into GeoJSON. 339 * @param string $return_type The supported types are 'string' and 'array'.382 * @param string $return_type The supported types are 'string' and 'array'. 340 383 */ 341 384 public static function metaval_to_geojson( $metaval, $return_type = 'string' ) { 342 343 // Quick exit344 if ( empty( $metaval) ) {345 return false;346 }347 348 // Could be a serialized array349 385 $metaval = maybe_unserialize( $metaval ); 350 386 351 // If we've been asked for a string and it's a GeoJSON string, 352 // we can just return now. 353 if ( self::is_geojson( $metaval, ( 'string' === $return_type ) ) ) { 387 if ( self::is_geojson( $metaval ) ) { 354 388 return $metaval; 389 } 390 391 if ( empty( $metaval ) ) { 392 return false; 393 } 394 395 // Exit early if we're a non-GeoJSON string. 396 if ( is_string( $metaval ) ) { 397 if ( strpos( $metaval,'{' ) === false || strpos( $metaval,'Feature' ) === false || strpos( $metaval,'geometry' ) === false ) { 398 return false; 399 } else { 400 $metaval = json_decode( $metaval,true ); 401 } 355 402 } 356 403 … … 363 410 $string_metaval = wp_json_encode( $metaval ); 364 411 365 if ( ! self::is_geojson( $string_metaval, 'true') ) {412 if ( ! self::is_geojson( $metaval ) ) { 366 413 return false; 367 414 } … … 378 425 * 379 426 * @param mixed $metaval The meta value to try to convert to WKT. 380 * @param bool $force_multi Should the value be turned into a MULTI type geometry? Default is false. This is set to true by WP-GeoMeta before storing values in the database.427 * @param bool $force_multi Should the value be turned into a MULTI type geometry? Default is false. This is set to true by WP-GeoMeta before storing values in the database. 381 428 * 382 429 * @return A WKT geometry string. 383 430 */ 384 public static function metaval_to_geom( $metaval = false, $force_multi = false) { 385 386 $maybe_geom = apply_filters( 'wpgq_metaval_to_geom', $metaval ); 431 public static function metaval_to_geom( $metaval = false, $force_multi = false ) { 432 433 $maybe_geom = apply_filters( 'wpgm_metaval_to_geom', $metaval ); 434 435 /* This filter has been deprecated and will be removed in a future version. */ 436 $maybe_geom = apply_filters( 'wpgq_metaval_to_geom', $maybe_geom ); 437 387 438 if ( self::is_geom( $maybe_geom ) ) { 388 439 return $maybe_geom; 389 440 } 390 441 391 // Everything becomes GeoJSON so that the rest of this function will be simpler 392 $metaval = self::metaval_to_geojson( $metaval, 'string' ); 393 394 if ( $metaval === false ) { 442 // Everything becomes GeoJSON so that the rest of this function will be simpler. 443 $make_string = ( $force_multi ? 'string' : 'array' ); 444 $metaval = self::metaval_to_geojson( $metaval, $make_string ); 445 446 if ( false === $metaval ) { 395 447 return $metaval; 396 448 } 397 449 398 450 if ( $force_multi ) { 399 451 $metaval = self::merge_geojson( $metaval ); … … 404 456 } 405 457 458 // Stringify any arrays. 459 if ( is_array( $metaval ) ) { 460 $metaval = wp_json_encode( $metaval ); 461 } 462 406 463 // Convert GeoJSON to WKT. 407 464 try { 408 $geom = self:: $geojson->read( (string) $metaval );465 $geom = self::get_geojson()->read( (string) $metaval ); 409 466 if ( is_null( $geom ) ) { 410 467 return false; … … 415 472 416 473 try { 417 $wkt = self:: $geowkt->write( $geom );474 $wkt = self::get_wkt()->write( $geom ); 418 475 419 476 /* … … 443 500 */ 444 501 public static function geom_to_geojson( $wkt ) { 445 $maybe_geojson = apply_filters( 'wpgq_geom_to_geojson', $wkt ); 502 $maybe_geojson = apply_filters( 'wpgm_geom_to_geojson', $wkt ); 503 504 /* This filter has been deprecated and will be removed in a future version. */ 505 $maybe_geojson = apply_filters( 'wpgq_geom_to_geojson', $maybe_geojson ); 446 506 if ( self::is_geojson( $maybe_geojson ) ) { 447 507 return $maybe_geojson; … … 460 520 stripos( $maybe_geojson, 'MULTIPOINT' ) !== 0 && 461 521 stripos( $maybe_geojson, 'MULTILINESTRING' ) !== 0 && 462 stripos( $maybe_geojson, 'MULTIPOLYGON' ) !== 0 522 stripos( $maybe_geojson, 'MULTIPOLYGON' ) !== 0 && 523 stripos( $maybe_geojson, 'GEOMETRYCOLLECTION' ) !== 0 463 524 ) { 464 525 return false; … … 466 527 467 528 try { 468 $geom = self::$geowkt->read( $maybe_geojson ); 469 $geojson = self::$geojson->write( $geom ); 470 if ( strpos( $maybe_geojson, '{' ) === false || strpos( $maybe_geojson, 'Feature' ) === false || strpos( $maybe_geojson, 'geometry' ) === false ) { 529 $geom = self::get_wkt()->read( $maybe_geojson ); 530 $geojson = self::get_geojson()->write( $geom ); 531 532 // Do we need to wrap it? 533 if ( ! empty( $geojson ) && strpos( $geojson, '"type":"Feature"' ) === false ) { 471 534 $geojson = '{"type":"Feature","geometry":' . $geojson . ',"properties":{}}'; 472 535 } 536 473 537 return $geojson; 474 538 } catch ( Exception $e ) { … … 490 554 } 491 555 492 $what = self::$geowkt->read( (string) $maybe_geom ); 556 if ( stripos( $maybe_geom, 'POINT' ) !== 0 && 557 stripos( $maybe_geom, 'LINESTRING' ) !== 0 && 558 stripos( $maybe_geom, 'POLYGON' ) !== 0 && 559 stripos( $maybe_geom, 'MULTIPOINT' ) !== 0 && 560 stripos( $maybe_geom, 'MULTILINESTRING' ) !== 0 && 561 stripos( $maybe_geom, 'MULTIPOLYGON' ) !== 0 && 562 stripos( $maybe_geom, 'GEOMETRYCOLLECTION' ) !== 0 563 ) { 564 return false; 565 } 566 567 $what = self::get_wkt()->read( (string) $maybe_geom ); 493 568 if ( null !== $what ) { 494 569 return true; … … 505 580 * 506 581 * @param anything $maybe_geojson Check if a value is GeoJSON or not. 507 * @param bool $string_only Should GeoJSON compatible strings and objects be counted as GeoJSON? Default is false (allow arrays/objects).582 * @param bool $string_only Should GeoJSON compatible strings and objects be counted as GeoJSON? Default is false (allow arrays/objects). 508 583 * 509 584 * @return boolean … … 512 587 try { 513 588 514 if ( ! is_string( $maybe_geojson ) && $string_only ) {589 if ( ! is_string( $maybe_geojson ) && $string_only ) { 515 590 return false; 516 591 } 517 592 518 593 if ( is_array( $maybe_geojson ) || is_object( $maybe_geojson ) ) { 519 $maybe_geojson = json_encode( $maybe_geojson ); 520 } 594 $maybe_geojson = wp_json_encode( $maybe_geojson ); 595 } 596 597 $maybe_geojson = (string) $maybe_geojson; 521 598 522 599 if ( strpos( $maybe_geojson, '{' ) === false || strpos( $maybe_geojson, 'Feature' ) === false || strpos( $maybe_geojson, 'geometry' ) === false ) { 523 600 return false; 524 } 525 526 $what = self::$geojson->read( (string) $maybe_geojson ); 527 601 } 602 603 $what = self::get_geojson()->read( $maybe_geojson ); 528 604 if ( null !== $what ) { 529 605 return true; … … 546 622 * @param bool $retest Should we re-check and re-store our capabilities. 547 623 * @param bool $lower Should all functions be lower-cased before returning. 548 */ 549 public static function get_capabilities( $retest = false, $lower = true ) { 624 * @param bool $cache_results Should our known functions be cached once they're generated. 625 */ 626 public static function get_capabilities( $retest = false, $lower = true, $cache_results = true ) { 550 627 global $wpdb; 628 629 if ( true !== WP_GeoUtil::$plugins_loaded_run ) { 630 WP_GeoUtil::plugins_loaded(); 631 } 551 632 552 633 if ( ! $retest ) { … … 572 653 foreach ( WP_GeoUtil::$all_funcs as $func ) { 573 654 574 // First, check to see if a custom function exists 655 // First, check to see if a custom function exists. 575 656 $q = "SELECT IF( COUNT(*) = 0, 'F' , 'T' ) AS ProcedureExists FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = '{$wpdb->dbname}' AND ROUTINE_TYPE = 'FUNCTION' AND UCASE(ROUTINE_NAME) = UCASE('$func');"; 576 $custom_func = $wpdb->get_var( $q ); 657 $custom_func = $wpdb->get_var( $q ); // @codingStandardsIgnoreLine 577 658 578 659 if ( 'T' === $custom_func ) { … … 581 662 } 582 663 583 // Otherwise check if it's a built-in 664 // Otherwise check if it's a built-in. 584 665 $q = "SELECT $func() AS worked"; 585 666 $wpdb->query( $q ); // @codingStandardsIgnoreLine … … 594 675 $wpdb->show_errors( $errors ); 595 676 596 update_option( 'wp_geometa_capabilities',self::$found_funcs, false ); 597 598 return self::get_capabilities( false, $lower ); 677 if ( $cache_results ) { 678 update_option( 'wp_geometa_capabilities',self::$found_funcs, false ); 679 } 680 681 return self::get_capabilities( false, $lower, $cache_results ); 599 682 } 600 683 … … 607 690 608 691 /** 609 * Support calling any geometry function. 610 * 611 * eg. 612 * WP_GeoUtil::Buffer( $geometry, $distance); 692 * Static magic method to support calling any geometry function. 693 * 694 * Eg. WP_GeoUtil::Buffer( $geometry, $distance); 695 * 696 * @param string $name The name of the function that is being called. 697 * @param array $arguments The arguments for the function. 613 698 */ 614 699 public static function __callStatic( $name, $arguments ) { 615 if ( in_array( strtolower( $name ), self::get_capabilities() ) ) {700 if ( in_array( strtolower( $name ), self::get_capabilities(), true ) ) { 616 701 return self::run_spatial_query( $name, $arguments ); 617 702 } … … 619 704 620 705 /** 621 * Run the actual spatial query 622 * 623 * Any geometries should be GeoJSON compatible 624 * 625 * Geometry responses will be returned as GeoJSON 626 * 627 * Other responses will be returned as is 706 * Run the actual spatial query. 707 * 708 * Any geometries should be GeoJSON compatible. 709 * 710 * Geometry responses will be returned as GeoJSON. 711 * 712 * Other responses will be returned as is. 713 * 714 * @param string $name The name of the function that is being called. 715 * @param array $arguments The arguments for the function. 628 716 */ 629 717 private static function run_spatial_query( $name, $arguments = array() ) { 630 718 global $wpdb; 631 719 632 if ( empty( $arguments ) ) {720 if ( empty( $arguments ) ) { 633 721 return false; 634 722 } 635 723 636 724 $q = 'SELECT ' . $name . '('; 637 foreach ( $arguments as $idx => $arg ) {725 foreach ( $arguments as $idx => $arg ) { 638 726 639 727 if ( $idx > 0 ) { … … 642 730 643 731 $maybe_geom = self::metaval_to_geom( $arg ); 644 if ( $maybe_geom !== false) {645 $arguments[ $idx] = $maybe_geom;732 if ( false !== $maybe_geom ) { 733 $arguments[ $idx ] = $maybe_geom; 646 734 $q .= 'GeomCollFromText(%s)'; 647 735 } else { … … 651 739 $q .= ')'; 652 740 653 $real_q = 'SELECT IF( GeometryType( retval ) IS NULL, retval, AsText( retval ) ) AS res FROM ( ' . $q . ' AS retval ) rq'; 654 655 $sql = $wpdb->prepare( $real_q, $arguments ); 656 657 $res = $wpdb->get_var( $sql ); 741 /* 742 -- Detect geometry. 743 -- Data is WKB, with a 4 byte leading SRID (which may be 00 00 00 00) 744 -- In big endian it will look like this: 745 -- E6 10 00 00 01 02 00 746 -- srid endianness WKB integer code 747 748 -- In little endian it should look like this: 749 -- 10 E6 01 01 00 00 02 750 -- srid endianness WKB integer code 751 -- Note: MySQL appears to use the Z codes, though I can't find actual support for Z values 752 */ 753 754 $real_q = 'SELECT IF( 755 COALESCE( SUBSTR(HEX(retval),5,10) IN ( 756 757 -- big endian 758 \'0000010000\', -- geometry 759 \'0000010100\', -- point 760 \'0000010200\', -- line 761 \'0000010300\', -- polygon 762 \'0000010400\', -- multipoint 763 \'0000010500\', -- multiline 764 \'0000010600\', -- multipolygon 765 766 -- little endian 767 \'0001000000\', -- geometry 768 \'0001000001\', -- point 769 \'0001000002\', -- line 770 \'0001000003\', -- polygon 771 \'0001000004\', -- multipoint 772 \'0001000005\', -- multiline 773 \'0001000006\' -- multipolygon 774 ), false) , AsText( retval ), retval ) AS res FROM ( ' . $q . ' AS retval ) rq'; 775 776 $sql = $wpdb->prepare( $real_q, $arguments ); // @codingStandardsIgnoreLine 777 778 $res = $wpdb->get_var( $sql ); // @codingStandardsIgnoreLine 658 779 659 780 $maybe_geojson = self::geom_to_geojson( $res ); 660 if ( $maybe_geojson !== false) {781 if ( false !== $maybe_geojson ) { 661 782 return $maybe_geojson; 662 } 783 } 663 784 664 785 return $res; 665 786 } 787 788 /** 789 * Get the GeoJSON object, creating it if needed. 790 */ 791 private static function get_geojson() { 792 if ( ! isset( self::$geojson ) ) { 793 self::$geojson = new GeoJSON(); 794 } 795 796 return self::$geojson; 797 } 798 799 /** 800 * Get the WKT object, creating it if needed. 801 */ 802 private static function get_wkt() { 803 if ( ! isset( self::$geowkt ) ) { 804 self::$geowkt = new WKT(); 805 } 806 return self::$geowkt; 807 } 666 808 } 667 668 WP_GeoUtil::get_instance(); -
wp-geometa/trunk/readme.txt
r1557784 r1607853 1 1 === WP-GeoMeta === 2 Contributors: stuporglue, cimburacom3 Donate link: https:// cimbura.com/contact-us/make-a-payment/4 Tags: GIS, spatial, mysql, mariadb, geography, mapping, meta, metadata2 Contributors: stuporglue, luminfire 3 Donate link: https://LuminFire.com/contact-us/make-a-payment/ 4 Tags: GIS, geo, spatial, mysql, mariadb, geography, mapping, meta, metadata 5 5 Requires at least: 4.4.0 6 Tested up to: 4.7. 07 Stable tag: trunk6 Tested up to: 4.7.2 7 Stable tag: 0.3.2 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 50 50 For community support try [WherePress.com](http://WherePress.com/), or [The Spatial Community](https://julien24.typeform.com/to/kGPqYr). 51 51 52 For commercial support you can contact the plugin developer at [Cimbura.com](https://cimbura.com/contact-us/project-request-form/) 52 For commercial support you can contact the plugin developer at 53 [LuminFire.com](https://LuminFire.com/contact-us/project-request-form/) 53 54 54 55 For fast and short questions you can [contact me](https://twitter.com/stuporglue) on twitter … … 130 131 == Upgrade Notice == 131 132 133 = 0.3.2 = 134 * Update to wp-geometa-lib 0.3.2. 135 * Updated internal filter callback function names to match the filter they're for. 136 * Updated branding to reflect company name change. 137 * Updated handling if submodules aren't checked out. 138 132 139 = 0.3.1 = 133 140 * This release brings support for stored spatial functions, a new button to -
wp-geometa/trunk/wp-geometa.php
r1557784 r1607853 11 11 * Description: Store and search spatial metadata while taking advantage of MySQL spatial types and indexes. 12 12 * Author: Michael Moore 13 * Author URI: http:// cimbura.com14 * Version: 0.3. 113 * Author URI: http://LuminFire.com 14 * Version: 0.3.2 15 15 * Text Domain: wp-geometa 16 16 * Domain Path: /lang … … 19 19 */ 20 20 21 22 23 21 /** 24 22 * Always include wp-geometa-lib so that it's available for others to use 25 23 */ 26 require_once( dirname( __FILE__ ) . '/lib/wp-geometa-lib/wp-geometa-lib-loader.php' ); 24 $wp_geometa_lib_loader = dirname( __FILE__ ) . '/lib/wp-geometa-lib/wp-geometa-lib-loader.php'; 25 26 if ( file_exists( $wp_geometa_lib_loader ) ) { 27 require_once( $wp_geometa_lib_loader ); 28 register_activation_hook( __FILE__ , array('WP_GeoMeta','install')); 29 } else { 30 error_log( __( "Could not load wp-geometa-lib. You probably cloned wp-geometa from git and didn't check out submodules!", 'wp-geometa' ) ); 31 32 if ( is_admin() ) { 33 print esc_html__( "Could not load wp-geometa-lib. You probably cloned wp-geometa from git and didn't check out submodules!", 'wp-geometa' ); 34 } 35 } 27 36 28 37 /** … … 31 40 if ( is_admin() ) { 32 41 require_once( dirname( __FILE__ ) . '/lib/wp-geometa-dash.php' ); 42 43 $leaflet_php_loader = dirname( __FILE__ ) . '/lib/leaflet-php/leaflet-php-loader.php'; 44 45 if ( file_exists( $leaflet_php_loader ) ) { 46 require_once( $leaflet_php_loader ); 47 } else { 48 error_log( __( "Could not load leaflet-php-loader. You probably cloned wp-geometa from git and didn't check out submodules!", 'wp-geometa' ) ); 49 print esc_html__( "Could not load leaflet-php-loader. You probably cloned wp-geometa from git and didn't check out submodules!", 'wp-geometa' ); 50 } 51 33 52 WP_GeoMeta_Dash::get_instance(); 34 53
Note: See TracChangeset
for help on using the changeset viewer.