topical media & game development
mashup-flickr-11-Complete-lib-NewsItem.php / php
<?php
class NewsItem
{
var keywords = null;
var maxKeywords = 20;
// Some common words to ignore
var rssItem)
{
rssItem;
url, this->photos, array('url' => link));
}
function getPhotos()
{
return this->rssItem['title'];
}
function getDescription()
{
return this->rssItem['link'];
}
function getKeywords()
{
if (s = this->getDescription();
this->splitIntoWords(this->keywords = words);
}
return data)
{
// Remove any possessive apostrophes
data);
// remove all except alphanumeric characters and spaces
s);
return preg_split('/ +/', data)
{
names = data);
words, data as word), this->isGoodKeyword(words, strtolower(words) >= words;
}
function isGoodKeyword(/', word), word))
{
return true;
}
// If it is more than five characters, it must be a good word
if (strlen(data)
{
currentName = "";
data as firstLetter = substr(firstLetter == strtoupper (currentName .= count++;
}
else
{
// This word does not begin with an upper case letter
if (names, trim(currentName = "";
names;
}
}
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.