Plugin Directory

Changeset 148320


Ignore:
Timestamp:
08/23/2009 09:52:20 AM (17 years ago)
Author:
dschuesae
Message:
 
Location:
xml-google-maps/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • xml-google-maps/trunk/readme.txt

    r144007 r148320  
    44Requires at least: 2.1
    55Tested up to: 2.8
    6 Stable tag: 1.11
     6Stable tag: 1.12
    77Donate link: http://www.matusz.ch/donate_xmlgooglemapswpplugin.htm
    88
     
    5959
    6060== Changes ==
     61Version 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
    6169Version 1.11
    6270<ul>
  • xml-google-maps/trunk/xmlgooglemaps.php

    r146734 r148320  
    55 Feed URI: http://www.matusz.ch/blog/tags/xml-google-maps-wp-plugin/feed/
    66 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.11
     7 Version: 1.12
    88 Author: Patrick Matusz
    99 Author URI: http://www.matusz.ch/blog/
     
    1313
    1414//Versionsinformationen
    15 define("XML_GOOGLE_MAPS_VERSION","1.11",true);
     15define("XML_GOOGLE_MAPS_VERSION","1.12",true);
    1616define("XML_GOOGLE_MAPS_DB_VERSION",2,true);
    1717
     
    162162function xmlgooglemaps_converter_kmx($content) {
    163163   
    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);
    165165       
    166166    for ($i=0; $i< count($found[0]);$i++) {
     
    225225   
    226226   
    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);
    228228
    229229    for ($i=0; $i< count($found[0]);$i++) {
     
    259259                if (($params->gpxElevationChart == "show") || ($params->gpxSpeedChart == "show") || ($params->gpxCheckpointTable == "show") || ($params->gpxHeartRateChart == "show") ) {
    260260                    //GPX Mode 1
    261                     if ($params->gpxParseMode==1) { //todo                 
     261                    if ($params->gpxParseMode==1) {                    
    262262                        $gpxfile = new xmlgooglemaps_gpxParser();
    263263                    //GPX Mode 2
    264                     } else if ($params->gpxParseMode==2) {  //todo
     264                    } else if ($params->gpxParseMode==2) { 
    265265                        $gpxfile = new xmlgooglemaps_gpxParser2();
    266266                    }
     
    268268                        $gpxfile->parse($file);
    269269                    }
     270                   
    270271                    $gpxdata = $gpxfile->output;
    271272                    if (($params->gpxView == "all") || ($params->gpxView == "trk")) {                       
     
    279280                        $dist = 0;
    280281                        //GPX Mode 1
    281                         if ($params->gpxParseMode==1) { //todo                 
     282                        if ($params->gpxParseMode==1) {                    
    282283                            $trkmax = $gpxdata["trk_count"];
    283284                        //GPX Mode 2
    284                         } else if ($params->gpxParseMode==2) {  //todo
     285                        } else if ($params->gpxParseMode==2) { 
    285286                            $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK');                           
    286287                        }                           
    287288                        for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {
    288289                            //GPX Mode 1
    289                             if ($params->gpxParseMode==1) { //todo                 
     290                            if ($params->gpxParseMode==1) {                    
    290291                                $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"];
    291292                            //GPX Mode 2
    292                             } else if ($params->gpxParseMode==2) {  //todo
     293                            } else if ($params->gpxParseMode==2) { 
    293294                                $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount);
    294295                                $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id);
     
    297298                            for ($trkptcount=0;$trkptcount<$trkptmax; $trkptcount++, $trkptcountsub++) {
    298299                                //GPX Mode 1
    299                                 if ($params->gpxParseMode==1) { //todo                                                 
     300                                if ($params->gpxParseMode==1) {                                                    
    300301                                    $pt = $gpxdata["trk".$trkcount]["trkpt".$trkptcount];
    301302                                    if ($ptcount==0) {
     
    315316                                    }                               
    316317                                //GPX Mode 2
    317                                 } else if ($params->gpxParseMode==2) {  //todo
     318                                } else if ($params->gpxParseMode==2) { 
    318319                                    if ($trkptcount % $params->gpxParseMode2MaxLimit == 0) {
    319320                                        $trkpts = xmlgooglemaps_dbfunctions::gpxGetSubItems($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id,$trkptcount,$params->gpxParseMode2MaxLimit);
     
    490491                                $lastheartrate = 0;
    491492                                //GPX Mode 1
    492                                 if ($params->gpxParseMode==1) { //todo                 
     493                                if ($params->gpxParseMode==1) {                    
    493494                                    $trkmax = $gpxdata["trk_count"];
    494495                                //GPX Mode 2
    495                                 } else if ($params->gpxParseMode==2) {  //todo
     496                                } else if ($params->gpxParseMode==2) { 
    496497                                    $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK');                           
    497498                                }                                                       
     
    500501                                for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {                                 
    501502                                    //GPX Mode 1
    502                                     if ($params->gpxParseMode==1) { //todo                 
     503                                    if ($params->gpxParseMode==1) {                    
    503504                                        $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"];
    504505                                    //GPX Mode 2
    505                                     } else if ($params->gpxParseMode==2) {  //todo
     506                                    } else if ($params->gpxParseMode==2) { 
    506507                                        $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount);
    507508                                        $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id);
     
    510511                                        if (($params->gpxCheckpointInterval>0) ) {                                                                             
    511512                                            //GPX Mode 1
    512                                             if ($params->gpxParseMode==1) { //todo 
     513                                            if ($params->gpxParseMode==1) {    
    513514                                                $include = $trkptcount % $params->gpxInterval;                                     
    514515                                                $pt = $gpxdata["trk".$trkcount]["trkpt".$trkptcount];
     
    680681                                for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {
    681682                                    //GPX Mode 1
    682                                     if ($params->gpxParseMode==1) { //todo                                     
     683                                    if ($params->gpxParseMode==1) {                                        
    683684                                        $trkptmax=$gpxdata["trk".$trkcount]["trkpt_count"];
    684685                                        for ($trkptcount=0;$trkptcount<$trkptmax; $trkptcount++) {
     
    688689                                        }
    689690                                    //GPX Mode 2                                       
    690                                     } else if ($params->gpxParseMode==2) { //todo               
     691                                    } else if ($params->gpxParseMode==2) {              
    691692                                        $trkrow = xmlgooglemaps_dbfunctions::gpxGetMainItem($gpxfile->gpxfileid,'TRK',$trkcount);
    692693                                        $trkptmax = xmlgooglemaps_dbfunctions::gpxGetSubItemCount($gpxfile->gpxfileid,'TRKPT',$trkrow->item_id);
  • xml-google-maps/trunk/xmlgooglemaps_gpxParser2.php

    r146734 r148320  
    1818   var $state = "init";   
    1919   var $innertext;
    20    var $lasterror = "";
    2120   
    2221   //ID's
     
    4241            $this->url_lastmodified = xmlgooglemaps_helper::getFileModifiedDate($this->url);
    4342           
    44             if (xmlgooglemaps_dbfunctions::gpxGetFileModDate($this->gpxfileid)!= $this->url_lastmodified) {
     43            if ((xmlgooglemaps_dbfunctions::gpxGetFileModDate($this->gpxfileid)!= $this->url_lastmodified) || ($this->url_lastmodified==0)) {
    4544                return true;
    4645            } else {
     
    6362       $filecontent = xmlgooglemaps_helper::getFileContent($url);
    6463       $this->url_lastmodified = xmlgooglemaps_helper::getFileModifiedDate($url);
    65        
     64                    
    6665       if ($filecontent === false) {
    6766           xml_parser_free($this->xml_obj);
    6867           $err=error_get_last();
    69            $this->lasterror = sprintf("PHP Error: %s in %s at line %d",$err["message"],$err["file"],$err["line"]);
    7068           error_reporting($old);
     69           die(sprintf("PHP Error: %s in %s at line %d",$err["message"],$err["file"],$err["line"]));           
    7170           return false;
    7271       } 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            }
    7480       }
    7581       
    7682       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",
    7884                        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)));         
    8086           xml_parser_free($this->xml_obj);
    8187           return false;
  • xml-google-maps/trunk/xmlgooglemaps_helper.php

    r146734 r148320  
    3333   
    3434    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                }
    5155            } 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        }
    5862    }
    5963
  • xml-google-maps/trunk/xmlgooglemaps_show.php

    r146734 r148320  
    116116
    117117    //GPX Files!
    118     if (isset($_GET["gpxid"])) {       
     118    if (isset($_GET["gpxid"])) {
    119119        $url = xmlgooglemaps_dbfunctions::xmlGetPath($id);     
    120120        if ($params->gpxParseMode==1) {
     
    149149                }
    150150            //GPX Mode 2
    151             } else if ($params->gpxParseMode==2) { //todo
     151            } else if ($params->gpxParseMode==2) {
    152152                $maxwpt = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'WPT');
    153153                for ($counter=0; $counter<$maxwpt; $counter++, $countersub++) {
     
    173173        if (($params->gpxView == "all") || ($params->gpxView == "rte")) {           
    174174            //GPX Mode 1
    175             if ($params->gpxParseMode==1) { //todo
     175            if ($params->gpxParseMode==1) {
    176176                $rtemax = $gpxdata["rte_count"];
    177177                for ($rtecount=0;$rtecount<$rtemax; $rtecount++) {
     
    189189                }
    190190            //GPX Mode 2
    191             } else if ($params->gpxParseMode==2) { //todo
     191            } else if ($params->gpxParseMode==2) {
    192192                $rtemax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'RTE');
    193193                for ($rtecount=0;$rtecount<$rtemax; $rtecount++) {
     
    227227            $lastpt = "";
    228228            //GPX Mode 1
    229             if ($params->gpxParseMode==1) { //todo         
     229            if ($params->gpxParseMode==1) {            
    230230                $trkmax = $gpxdata["trk_count"];
    231231                for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {
     
    258258                }
    259259            //GPX Mode 2
    260             } else if ($params->gpxParseMode==2) { //todo
     260            } else if ($params->gpxParseMode==2) {
    261261                $trkmax = xmlgooglemaps_dbfunctions::gpxGetMainItemCount($gpxfile->gpxfileid,'TRK');
    262262                for ($trkcount=0;$trkcount<$trkmax; $trkcount++) {
Note: See TracChangeset for help on using the changeset viewer.