Plugin Directory

Changeset 216526


Ignore:
Timestamp:
03/12/2010 04:42:23 AM (16 years ago)
Author:
rjune
Message:

Fixed timezone issues

Location:
gcal-sidebar/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gcal-sidebar/trunk/gcal-sidebar.php

    r210019 r216526  
    44Plugin URI: http://www.oriontechnologysolutions.com/gcal-sidebar/
    55Description: Pulls a Google Calendar feed and displays it in your sidebar.
    6 Version: 0.5
     6Version: 1.0
    77Author: Orion Technology Solutions
    88Author URI: http://www.oriontechnologysolutions.com
     
    9191        <div>
    9292        <h4>Optional</h4>
    93         <p><label for="<?php echo $this->get_field_id('tz_offset'); ?>"><?php _e('Timezone Offset:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('tz_offset'); ?>" name="<?php echo $this->get_field_name('tz_offset'); ?>" type="text" value="<?php echo $tz_offset; ?>" /></label></p>
    94 
    9593        <p><label for="<?php echo $this->get_field_id('map_link'); ?>"><?php _e('Display link to map:'); ?>
    9694            <select name="<?php echo $this->get_field_name('map_link'); ?>" id="<?php echo $this->get_field_id('map_link'); ?>" >
     
    117115            <input class="widefat" id="<?php echo $this->get_field_id('priv_id'); ?>" name="<?php echo $this->get_field_name('priv_id'); ?>" type="text" value="<?php echo $priv_id; ?>" />
    118116        </p>
     117
     118        <p><label for="<?php echo $this->get_field_id('tz_offset'); ?>"><?php _e('Timezone Offset:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('tz_offset'); ?>" name="<?php echo $this->get_field_name('tz_offset'); ?>" type="text" value="<?php echo $tz_offset; ?>" /></label></p>
     119
    119120        </div>
    120121        <?php
     
    180181        $priv_id = trim(esc_attr($instance['priv_id']));
    181182
    182         if ($tz_offset == '')
    183             $tz_offset = 0;
    184         else if((-24 < $tz_offset) && ($tz_offset < 24))
    185             $tz_offset = $tz_offset * 60 * 60;
    186 
    187183        if($rs_offset == '')
    188184            $rs_offset = 0;
     
    200196        $static_url = $instance['static_url_option'];
    201197        $xml = new SimpleXMLElement($xmlstr);
     198
     199        $gcal = $xml->children('http://schemas.google.com/gCal/2005');
     200        $ctz = $gcal->timezone->attributes()->value;   
     201
     202        if ($tz_offset == '') {
     203            $tz_offset = 0;
     204            date_default_timezone_set ( $ctz );
     205        }
     206        else if((-24 < $tz_offset) && ($tz_offset < 24)) {
     207            $tz_offset = $tz_offset * 60 * 60;
     208        }
    202209
    203210        echo '<ul id="events">';
     
    216223            }
    217224            else {
    218                 $event_link = $entry->link->attributes()->href;
     225                $event_link = $entry->link->attributes()->href . "&ctz=" . $ctz;
    219226            }
    220227   
  • gcal-sidebar/trunk/readme.txt

    r210019 r216526  
    55Requires at least: 2.8
    66Tested up to: 2.9.2
    7 Stable tag: 0.5
     7Stable tag: 1.0
    88
    99Gcal Sidebar pulls a Google calendar feed and displays it in the sidebar of your wordpress blog.
     
    3434== Changelog ==
    3535
     36= 1.0 =
     37* Pull timezone from the calendar instead of relying on the current system or user input.
     38* Moved timezone offset option to end of the config as it should be almost never required now.
     39
    3640= 0.5 =
    3741* Rearranged the widget config to put common items near the top.
Note: See TracChangeset for help on using the changeset viewer.