Changeset 148320
- Timestamp:
- 08/23/2009 09:52:20 AM (17 years ago)
- Location:
- xml-google-maps/trunk
- Files:
-
- 5 edited
-
readme.txt (modified) (2 diffs)
-
xmlgooglemaps.php (modified) (14 diffs)
-
xmlgooglemaps_gpxParser2.php (modified) (3 diffs)
-
xmlgooglemaps_helper.php (modified) (1 diff)
-
xmlgooglemaps_show.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
xml-google-maps/trunk/readme.txt
r144007 r148320 4 4 Requires at least: 2.1 5 5 Tested up to: 2.8 6 Stable tag: 1.1 16 Stable tag: 1.12 7 7 Donate link: http://www.matusz.ch/donate_xmlgooglemapswpplugin.htm 8 8 … … 59 59 60 60 == Changes == 61 Version 1.12 62 <ul> 63 <li>New GPX Parser included. This second parser can handle larger files than the first parser, but uses a lot of database space! You can choose between these two parsers!</li> 64 <li>Since plugin uses curl (if installed), gpx files will not work anymore in a password protected wordpress blog. You have to include user and password directly in the URL. Eg. http://testusr:testpwd@www.somedomain.ch/test.gpx - this plugin supports links with the '@'-sign now.</li> 65 <li>Database ID columns changed to bigint</li> 66 <li>Donation and settings link on all other plugins, will disappear!</li> 67 </ul> 68 61 69 Version 1.11 62 70 <ul> -
xml-google-maps/trunk/xmlgooglemaps.php
r146734 r148320 5 5 Feed URI: http://www.matusz.ch/blog/tags/xml-google-maps-wp-plugin/feed/ 6 6 Description: This plugin allows you to easily insert Google Map or Google Earth Plugin Maps into your blog. Supports KML, KMZ, GPX, geoRSS filelinks. Supports Default, Satellite, Hybrid, Physical and Google Earth Plugin Maptypes 7 Version: 1.1 17 Version: 1.12 8 8 Author: Patrick Matusz 9 9 Author URI: http://www.matusz.ch/blog/ … … 13 13 14 14 //Versionsinformationen 15 define("XML_GOOGLE_MAPS_VERSION","1.1 1",true);15 define("XML_GOOGLE_MAPS_VERSION","1.12",true); 16 16 define("XML_GOOGLE_MAPS_DB_VERSION",2,true); 17 17 … … 162 162 function xmlgooglemaps_converter_kmx($content) { 163 163 164 preg_match_all('#\<a([^\>]*?)href=["\']([a-zA-Z0-9 \/:\-\._?&=;~]*?\.km[lz])["\']([^\>]*?)\>(.*?)\<\/a\>#i', $content, $found);164 preg_match_all('#\<a([^\>]*?)href=["\']([a-zA-Z0-9@\/:\-\._?&=;~]*?\.km[lz])["\']([^\>]*?)\>(.*?)\<\/a\>#i', $content, $found); 165 165 166 166 for ($i=0; $i< count($found[0]);$i++) { … … 225 225 226 226 227 preg_match_all('#\<a([^\>]*?)href=["\']([a-zA-Z0-9 \/:\-\._?&=;~]*?\.gpx)["\']([^\>]*?)\>(.*?)\<\/a\>#i', $content, $found);227 preg_match_all('#\<a([^\>]*?)href=["\']([a-zA-Z0-9@\/:\-\._?&=;~]*?\.gpx)["\']([^\>]*?)\>(.*?)\<\/a\>#i', $content, $found); 228 228 229 229 for ($i=0; $i< count($found[0]);$i++) { … … 259 259 if (($params->gpxElevationChart == "show") || ($params->gpxSpeedChart == "show") || ($params->gpxCheckpointTable == "show") || ($params->gpxHeartRateChart == "show") ) { 260 260 //GPX Mode 1 261 if ($params->gpxParseMode==1) { //todo261 if ($params->gpxParseMode==1) { 262 262 $gpxfile = new xmlgooglemaps_gpxParser(); 263 263 //GPX Mode 2 264 } else if ($params->gpxParseMode==2) { //todo264 } else if ($params->gpxParseMode==2) { 265 265 $gpxfile = new xmlgooglemaps_gpxParser2(); 266 266 } … … 268 268 $gpxfile->parse($file); 269 269 } 270 270 271 $gpxdata = $gpxfile->output; 271 272 if (($params->gpxView == "all") || ($params->gpxView == "trk")) { … … 279 280 $dist = 0; 280 281 //GPX Mode 1 281 if ($params->gpxParseMode==1) { //todo282 if ($params->gpxParseMode==1) { 282 283 $trkmax = $gpxdata["trk_count"]; 283 284 //GPX Mode 2 284 } else if ($params->gpxParseMode==2) { //todo285 } else if ($params->gpxParseMode==2) { 285 286 $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK'); 286 287 } 287 288 for ($trkcount=0;$trkcount<$trkmax; $trkcount++) { 288 289 //GPX Mode 1 289 if ($params->gpxParseMode==1) { //todo290 if ($params->gpxParseMode==1) { 290 291 $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"]; 291 292 //GPX Mode 2 292 } else if ($params->gpxParseMode==2) { //todo293 } else if ($params->gpxParseMode==2) { 293 294 $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount); 294 295 $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id); … … 297 298 for ($trkptcount=0;$trkptcount<$trkptmax; $trkptcount++, $trkptcountsub++) { 298 299 //GPX Mode 1 299 if ($params->gpxParseMode==1) { //todo300 if ($params->gpxParseMode==1) { 300 301 $pt = $gpxdata["trk".$trkcount]["trkpt".$trkptcount]; 301 302 if ($ptcount==0) { … … 315 316 } 316 317 //GPX Mode 2 317 } else if ($params->gpxParseMode==2) { //todo318 } else if ($params->gpxParseMode==2) { 318 319 if ($trkptcount % $params->gpxParseMode2MaxLimit == 0) { 319 320 $trkpts = xmlgooglemaps_dbfunctions::gpxGetSubItems($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id,$trkptcount,$params->gpxParseMode2MaxLimit); … … 490 491 $lastheartrate = 0; 491 492 //GPX Mode 1 492 if ($params->gpxParseMode==1) { //todo493 if ($params->gpxParseMode==1) { 493 494 $trkmax = $gpxdata["trk_count"]; 494 495 //GPX Mode 2 495 } else if ($params->gpxParseMode==2) { //todo496 } else if ($params->gpxParseMode==2) { 496 497 $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK'); 497 498 } … … 500 501 for ($trkcount=0;$trkcount<$trkmax; $trkcount++) { 501 502 //GPX Mode 1 502 if ($params->gpxParseMode==1) { //todo503 if ($params->gpxParseMode==1) { 503 504 $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"]; 504 505 //GPX Mode 2 505 } else if ($params->gpxParseMode==2) { //todo506 } else if ($params->gpxParseMode==2) { 506 507 $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount); 507 508 $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id); … … 510 511 if (($params->gpxCheckpointInterval>0) ) { 511 512 //GPX Mode 1 512 if ($params->gpxParseMode==1) { //todo513 if ($params->gpxParseMode==1) { 513 514 $include = $trkptcount % $params->gpxInterval; 514 515 $pt = $gpxdata["trk".$trkcount]["trkpt".$trkptcount]; … … 680 681 for ($trkcount=0;$trkcount<$trkmax; $trkcount++) { 681 682 //GPX Mode 1 682 if ($params->gpxParseMode==1) { //todo683 if ($params->gpxParseMode==1) { 683 684 $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"]; 684 685 for ($trkptcount=0;$trkptcount<$trkptmax; $trkptcount++) { … … 688 689 } 689 690 //GPX Mode 2 690 } else if ($params->gpxParseMode==2) { //todo691 } else if ($params->gpxParseMode==2) { 691 692 $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount); 692 693 $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id); -
xml-google-maps/trunk/xmlgooglemaps_gpxParser2.php
r146734 r148320 18 18 var $state = "init"; 19 19 var $innertext; 20 var $lasterror = "";21 20 22 21 //ID's … … 42 41 $this->url_lastmodified = xmlgooglemaps_helper::getFileModifiedDate($this->url); 43 42 44 if ( xmlgooglemaps_dbfunctions::gpxGetFileModDate($this->gpxfileid)!= $this->url_lastmodified) {43 if ((xmlgooglemaps_dbfunctions::gpxGetFileModDate($this->gpxfileid)!= $this->url_lastmodified) || ($this->url_lastmodified==0)) { 45 44 return true; 46 45 } else { … … 63 62 $filecontent = xmlgooglemaps_helper::getFileContent($url); 64 63 $this->url_lastmodified = xmlgooglemaps_helper::getFileModifiedDate($url); 65 64 66 65 if ($filecontent === false) { 67 66 xml_parser_free($this->xml_obj); 68 67 $err=error_get_last(); 69 $this->lasterror = sprintf("PHP Error: %s in %s at line %d",$err["message"],$err["file"],$err["line"]);70 68 error_reporting($old); 69 die(sprintf("PHP Error: %s in %s at line %d",$err["message"],$err["file"],$err["line"])); 71 70 return false; 72 71 } else { 73 error_reporting($old); 72 if ($this->url_lastmodified==0) { 73 xml_parser_free($this->xml_obj); 74 error_reporting($old); 75 die(sprintf("Cannot get modified date from the file you like to parse! Like this, it is not possible to use this file that way!")); 76 return false; 77 } else { 78 error_reporting($old); 79 } 74 80 } 75 81 76 82 if (!xml_parse($this->xml_obj, $filecontent)) { 77 $this->lasterror =sprintf("XML error: %s at line %d",83 die(sprintf("XML error: %s at line %d", 78 84 xml_error_string(xml_get_error_code($this->xml_obj)), 79 xml_get_current_line_number($this->xml_obj)) ;85 xml_get_current_line_number($this->xml_obj))); 80 86 xml_parser_free($this->xml_obj); 81 87 return false; -
xml-google-maps/trunk/xmlgooglemaps_helper.php
r146734 r148320 33 33 34 34 function getFileModifiedDate($url, $user='', $password='') { 35 if (function_exists("curl_init")) { 36 $ch = curl_init(); 37 curl_setopt($ch, CURLOPT_URL, $url); 38 curl_setopt($ch, CURLOPT_HEADER, 1); 39 curl_setopt($ch, CURLOPT_NOBODY, 1); 40 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 if (($user != '') || ($password != '')) { 42 curl_setopt($ch, CURLAUTH_NTLM); 43 curl_setopt ($ch, CURLOPT_USERPWD, "$username:$password"); 44 } 45 $headers = curl_exec ($ch); 46 curl_close($ch); 47 $headers = substr(stristr($headers, "Last-Modified:"),15); 48 $lines=split("\n",$headers); 49 if (count($lines)>0) { 50 return strtotime($lines[0]); 35 try { 36 if (function_exists("curl_init")) { 37 $ch = curl_init(); 38 curl_setopt($ch, CURLOPT_URL, $url); 39 curl_setopt($ch, CURLOPT_HEADER, 1); 40 curl_setopt($ch, CURLOPT_NOBODY, 1); 41 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 if (($user != '') || ($password != '')) { 43 curl_setopt($ch, CURLAUTH_NTLM); 44 curl_setopt ($ch, CURLOPT_USERPWD, "$username:$password"); 45 } 46 $headers = curl_exec ($ch); 47 curl_close($ch); 48 $headers = substr(stristr($headers, "Last-Modified:"),15); 49 $lines=split("\n",$headers); 50 if (count($lines)>0) { 51 return strtotime($lines[0]); 52 } else { 53 return 0; 54 } 51 55 } else { 52 return time();53 }54 } else {55 $url = xmlgooglemaps_helper::tryGetLocalPath($url);56 return filemtime($url);57 } 56 $url = xmlgooglemaps_helper::tryGetLocalPath($url); 57 return filemtime($url); 58 } 59 } catch (Exception $e) { 60 return 0; 61 } 58 62 } 59 63 -
xml-google-maps/trunk/xmlgooglemaps_show.php
r146734 r148320 116 116 117 117 //GPX Files! 118 if (isset($_GET["gpxid"])) { 118 if (isset($_GET["gpxid"])) { 119 119 $url = xmlgooglemaps_dbfunctions::xmlGetPath($id); 120 120 if ($params->gpxParseMode==1) { … … 149 149 } 150 150 //GPX Mode 2 151 } else if ($params->gpxParseMode==2) { //todo151 } else if ($params->gpxParseMode==2) { 152 152 $maxwpt = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'WPT'); 153 153 for ($counter=0; $counter<$maxwpt; $counter++, $countersub++) { … … 173 173 if (($params->gpxView == "all") || ($params->gpxView == "rte")) { 174 174 //GPX Mode 1 175 if ($params->gpxParseMode==1) { //todo175 if ($params->gpxParseMode==1) { 176 176 $rtemax = $gpxdata["rte_count"]; 177 177 for ($rtecount=0;$rtecount<$rtemax; $rtecount++) { … … 189 189 } 190 190 //GPX Mode 2 191 } else if ($params->gpxParseMode==2) { //todo191 } else if ($params->gpxParseMode==2) { 192 192 $rtemax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'RTE'); 193 193 for ($rtecount=0;$rtecount<$rtemax; $rtecount++) { … … 227 227 $lastpt = ""; 228 228 //GPX Mode 1 229 if ($params->gpxParseMode==1) { //todo229 if ($params->gpxParseMode==1) { 230 230 $trkmax = $gpxdata["trk_count"]; 231 231 for ($trkcount=0;$trkcount<$trkmax; $trkcount++) { … … 258 258 } 259 259 //GPX Mode 2 260 } else if ($params->gpxParseMode==2) { //todo260 } else if ($params->gpxParseMode==2) { 261 261 $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK'); 262 262 for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {
Note: See TracChangeset
for help on using the changeset viewer.