Plugin Directory

Changeset 690032


Ignore:
Timestamp:
04/01/2013 01:36:03 PM (13 years ago)
Author:
finalan
Message:

bugfix: Error in 14Tage: PHP Class DateInterval is only available with PHP Version 5.3 and higher - Problem fixed with a workaround

Location:
ttlive/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ttlive/trunk/index.php

    r690020 r690032  
    44Plugin URI: http://www.svbb-tischtennis.de/
    55Description: A simple wordpress plugin to get the data from the ttlive-system and show it on my wp-post or wp-page
    6 Version: 0.8
     6Version: 0.7
    77Author: finalan
    88Author URI: http://www.svbb-tischtennis.de
     
    371371    if($xml = simplexml_load_file($params['filename'], NULL, ($debug==1)?LIBXML_NOERROR:NULL))
    372372    {
    373         $expiration_date = new DateTime();
    374         $date_interval = new DateInterval('P'.$params['showxdays'].'D');
    375         $date_interval->invert = $params['display_type'];       
    376         $expiration_date->sub($date_interval);
     373        //works only with php 5.3 and higher
     374        //$expiration_date = new DateTime();
     375        //$date_interval = new DateInterval('P'.$params['showxdays'].'D');
     376        //$date_interval->invert = $params['display_type'];
     377        //$expiration_date->sub($date_interval);
     378       
     379        if ( $params['display_type'] == "0" ) {
     380            $op = "-";
     381        } else {
     382            $op = "+";         
     383        }
     384       
     385        $expiration_date = new DateTime(date("d-m-Y",strtotime($op.$params['showxdays'].' day')));
    377386       
    378387        $plan .= "<table class='" . $tableclassname . "'>\n";
     
    516525    if($xml = simplexml_load_file($params['filename'], NULL, ($debug==1)?LIBXML_NOERROR:NULL))
    517526    {
    518         $expiration_date = new DateTime();
    519         $date_interval = new DateInterval('P'.$params['showxdays'].'D');
    520         $date_interval->invert = $params['display_type'];       
    521         $expiration_date->sub($date_interval);
     527        //works only with php 5.3 and higher
     528        //$expiration_date = new DateTime();
     529        //$date_interval = new DateInterval('P'.$params['showxdays'].'D');
     530        //$date_interval->invert = $params['display_type'];     
     531        //$expiration_date->sub($date_interval);
     532       
     533        if ( $params['display_type'] == "0" ) {
     534            $op = "-";
     535        } else {
     536            $op = "+";         
     537        }
     538       
     539        $expiration_date = new DateTime(date("d-m-Y",strtotime($op.$params['showxdays'].' day')));
    522540       
    523541        $zeile;
     
    950968    }
    951969
    952 } // class Foo_Widget
    953 // register Foo_Widget widget
     970} // class TTLive_Widget
     971// register TTLive_Widget widget
    954972add_action( 'widgets_init', create_function( '', 'register_widget( "ttlive_widget" );' ) );
    955973
  • ttlive/trunk/readme.txt

    r690020 r690032  
    8080== Changelog ==
    8181
     82= 0.8.1 =
     83* bugfix: Error in 14Tage: PHP Class DateInterval is only available with PHP Version 5.3 and higher - Problem fixed with a workaround
     84
    8285= 0.8 =
    8386* added new parameter showxdays --> 14Tage: Anzahl der Tage die dargestell werden sollen (default = 14)
Note: See TracChangeset for help on using the changeset viewer.