Plugin Directory

Changeset 140192


Ignore:
Timestamp:
07/28/2009 07:46:13 PM (17 years ago)
Author:
hendrikwill
Message:

checking unit_system param of Google weather API output to convert Fahrenheit to Celsius

Location:
wp-google-weather/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-google-weather/trunk/readme.txt

    r139837 r140192  
    4343== Installation ==
    4444
    45 1.  Unzip and upload files the files to wp-content/plugins/wp-google-weather
    46 
    47 2.  Activate the plugin
    48 
    49 3.  Go to Themes > Widgets and drag WP Google Weather widget to your sidebar
    50 
    51 4.  Specify title, city, country (optional), temperature as Celsius or Fahrenheit and language (ISO 639-1 code)
    52 
    53 5.  decide whether it should display only today's weather or also a 3 day forecast
     451. Unzip and upload files the files to /wp-content/plugins/wp-google-weather
     462. Activate the plugin
     473. Go to Themes > Widgets and drag WP Google Weather widget to your sidebar
     484. Specify title, city, country (optional), temperature as Celsius or Fahrenheit and language (ISO 639-1 code)
     495. decide whether it should display only today's weather or also a 3 day forecast
    5450
    5551
    5652== Screenshots ==
    5753
    58 1. Screenshot widget options
    59 2. Screenshot frontend view
     541. Widget options
     552. Frontend view
    6056
    6157
     
    7672
    7773== Changelog ==
    78 no updates yet
     74= 0.2 - 28.07.2009 =
     75* checking unit_system param of Google weather API output to convert Fahrenheit to Celsius (thanks Mike)
    7976
     77= 0.1 - 25.07.2009  =
     78* initial release
     79* fixed include path (thanks Dietmar)
    8080
    8181== Todos ==
    8282
    8383* add admin_notices after install, direct link to widget page
    84 * add language pack for backend
     84* add translation for backend
    8585* choose from different styles
    86 
  • wp-google-weather/trunk/wp-google-weather.php

    r139868 r140192  
    44Plugin URI: http://imwill.com/wp-google-weather/
    55Description: Displays a weather widget using the Google weather API.
    6 Version: 0.1
     6Version: 0.2
    77Author: Hendrik Will
    88Author URI: http://imwill.com
     
    164164        $xmlData  = simplexml_load_string(utf8_encode($output));
    165165       
     166        $unit_system = $xmlData->weather->forecast_information->unit_system['data'];
     167       
    166168        #define conditions array
    167169        $conditions = array();
     
    183185            $conditions['forecast'][$i]['low'] = $xmlData->weather->forecast_conditions[$i]->low['data'];
    184186            $conditions['forecast'][$i]['condition'] = $xmlData->weather->forecast_conditions[$i]->condition['data'];
     187        }
     188       
     189        #convert Fahrenheit to Celsius if needed
     190        if($unit_system=='US' AND ($temp=='c')) {
     191            for($i=0; $i<=3; $i++) {
     192                $conditions['forecast'][$i]['high'] = intval(($conditions['forecast'][$i]['high']-32)*5/9);
     193                $conditions['forecast'][$i]['low'] = intval(($conditions['forecast'][$i]['low']-32)*5/9);
     194            }
    185195        }
    186196       
Note: See TracChangeset for help on using the changeset viewer.