WordPress.org

Plugin Directory

Changeset 747727


Ignore:
Timestamp:
07/29/13 09:41:18 (9 months ago)
Author:
kirilln
Message:

Bug fix: timestamp parsing issues "Warning: gmmktime() expects parameter 5 to be long, string given in ...wp-content/plugins/tweet-blender/lib/lib.php on line 381

Location:
tweet-blender/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tweet-blender/trunk/lib/lib.php

    r746692 r747727  
    11<?php 
    22 
    3 // Version 4.0.0b4 
     3// Version 4.0.1 
    44 
    55// aliases for sources 
     
    298298} 
    299299 
    300 function tb_get_url_content($url) 
    301 { 
    302   $string = ''; 
    303    
    304   # preferred way is to use curl 
    305   if (function_exists('curl_init')){ 
    306     $ch = curl_init(); 
    307    
    308       curl_setopt ($ch, CURLOPT_URL, $url); 
    309       curl_setopt ($ch, CURLOPT_HEADER, 0); 
    310    
    311       ob_start(); 
    312    
    313       curl_exec ($ch); 
    314       curl_close ($ch); 
    315       $string = ob_get_contents(); 
    316    
    317       ob_end_clean(); 
    318   } 
    319   # plan B is to use file_get_contents 
    320   elseif (function_exists('file_get_contents')) { 
    321     $string = @file_get_contents($url);    
    322   } 
    323   # fallback is to use fopen 
    324   else { 
    325     if ($fh = fopen($url, 'rb')) { 
    326       clearstatcache(); 
    327       if ($fsize = @filesize($url)) { 
    328         $string = fread($fh, $fsize); 
    329       } 
    330       else { 
    331           while (!feof($fh)) { 
    332             $string .= fread($fh, 8192); 
    333           } 
    334       } 
    335       fclose($fh); 
    336     } 
    337   } 
    338     return $string;     
    339 } 
    340  
    341300function tb_verbal_time($timestamp) { 
    342301    $periods = array(__("second",'tweetblender'), __("minute",'tweetblender'), __("hour",'tweetblender'), __("day",'tweetblender'), __("week",'tweetblender'), __("month",'tweetblender'), __("year",'tweetblender')); 
     
    367326} 
    368327 
    369 // search: Wed, 27 May 2009 15:52:40 +0000 
    370 // user feed: Thu May 21 00:09:16 +0000 2009 
     328// old search: Wed, 27 May 2009 15:52:40 +0000 
     329// new search and   user feed: Thu May 21 00:09:16 +0000 2009 
    371330function tb_str2time($date_string) { 
    372331    $mnum = array('Jan' => 1,'Feb' => 2, 'Mar' => 3, 'Apr' => 4, 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec' => 12); 
    373332 
    374 //  if (strpos($date_string, ',') !== false) { 
    375 //      list($wday,$mday, $mon, $year, $hour,$min,$sec,$offset) = preg_split('/[\s\:]/',$date_string); 
    376 //  } 
    377 //  else { 
     333    if (strpos($date_string, ',') !== false) { 
     334        list($wday,$mday, $mon, $year, $hour,$min,$sec,$offset) = preg_split('/[\s\:]/',$date_string); 
     335    } 
     336    else { 
    378337        list($wday,$mon,$mday,$hour,$min,$sec,$offset,$year) = preg_split('/[\s\:]/',$date_string); 
    379 //  } 
    380      
    381     return gmmktime($hour,$min,$sec,$mnum[$mon],$mday,$year); 
     338    } 
     339     
     340    if (($timestamp = gmmktime($hour,$min,$sec,$mnum[$mon],$mday,$year)) > 0 ) { 
     341        return $timestamp; 
     342    } 
     343    else { 
     344        return time(); 
     345    } 
    382346} 
    383347 
  • tweet-blender/trunk/readme.txt

    r746692 r747727  
    44Requires at least: 2.8.0 
    55Tested up to: 3.5.2 
    6 Stable tag: 4.0.0 
     6Stable tag: 4.0.1 
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5907095 
    88 
     
    197197== Changelog == 
    198198 
     199= 4.0.1 = 
     200* Bug fix: timestamp parsing issues "Warning: gmmktime() expects parameter 5 to be long, string given in ...wp-content/plugins/tweet-blender/lib/lib.php on line 381 
     201 
    199202= 4.0.0 = 
    200203* Tested with WordPress 3.5.2 
Note: See TracChangeset for help on using the changeset viewer.