Changeset 74
- Timestamp:
- 06/26/07 10:32:17 (19 months ago)
- Files:
-
- 1 modified
-
hacks/trunk/feedphp/feed.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hacks/trunk/feedphp/feed.php
r72 r74 6 6 * 7 7 * author: Antonio Cavedoni <http://cavedoni.com/> 8 * version: 0. 128 * version: 0.2 9 9 * revision: $Id$ 10 10 * license: BSD … … 110 110 public function addItem($params) 111 111 { 112 if (strlen($params['pubDate']) == 10) { 113 // yyyy-mm-dd 114 $d = strptime($params['pubDate'], "%Y-%m-%d"); 115 } else if (strlen($params['pubDate']) == 19) { 116 // yyyy-mm-dd hh:mm:ss 117 $d = strptime($params['pubDate'], "%Y-%m-%d %H:%M:%S"); 118 } 119 120 $itemDate = mktime( 121 $d['tm_hour'], 122 $d['tm_min'], 123 $d['tm_sec'], 124 $d['tm_mon'], 125 $d['tm_mday'], 126 $d['tm_year'] 127 ); 128 112 129 $item = array( 113 130 'title' => $params['title'], 114 131 'link' => $params['link'], 115 132 'description' => $params['description'], 116 'pubDate' => date_create($params['pubDate'])133 'pubDate' => $itemDate 117 134 ); 118 135 … … 136 153 public function rfc3339Date($date) 137 154 { 138 return $date->format('Y-m-d\TH:i:s\Z');155 return date('Y-m-d\TH:I:S\Z', $date); 139 156 } 140 157 141 158 public function rfc2822Date($date) 142 159 { 143 return $date->format('r');160 return date('r', $date); 144 161 } 145 162 … … 222 239 { 223 240 header('Content-type: '. $this->mimeType .'; charset='. $this->charset); 224 $this->doConditionalGet( $this->latestPostDate()->format('U'));241 $this->doConditionalGet(date('U', $this->latestPostDate())); 225 242 print $this->write(); 226 243 } … … 304 321 $this->writer->writeElement('pubDate', 305 322 $this->rfc2822Date($item['pubDate'])); 306 if ( $item['author']) {323 if (array_key_exists('author', $item)) { 307 324 $this->writer->writeElement('author', 308 325 "{$item['authorEmail']} ({$item['author']})");