Prev | Current Page 239 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

title = title;
this.content = content;
createdOn = Date.now();
publishedOn = null;
}
private function getExcerpt() : String
{
if(definedExcerpt != null)
return definedExcerpt;
else
return content.substr(0, 10) + ??? ...???;
}
private function setExcerpt(value : String) : String
{
definedExcerpt = value;
return definedExcerpt;
}
private function getOnlineInfo() : String
{
if(publishedOn == null)
return ???Not yet on-line???;
else
{
// getTime() returns the time in milliseconds since 1970-01-01
// we have to divide the time span by 24 hours=24*60*60*1000=86400000
var daysOnline = (Date.now().getTime()-publishedOn.getTime())/86400000;
return if(daysOnline < 1)
???Published Today???;
else if(daysOnline < 2)
???Published Yesterday???;
else if(daysOnline < 7)
???Published ??? + Math.floor(daysOnline) + ??? days ago???;
else
???Published on ??? + DateTools.format(publishedOn, ???%Y-%m-%d???);
}
}
public function isOnline() : Bool
{
return publishedOn != null
& & publishedOn.getTime() < = Date.


Pages:
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251