Prefers summaries over full content , but will return full content if a
summary does not exist.
To prefer full content instead, use {@see \get_content}
Uses , , or
public function build(\SimplePie_Item $feed) { $data = new ArrayCollection(); $data->set('title', $feed->get_title()); $data->set('url', $feed->get_permalink()); $data->set('description', $feed->get_description()); return $data; }
function filter(SimplePie_Item $item, array $patterns) { foreach ($patterns as $pattern) { switch ($pattern["field"]) { case "title": if (preg_match($pattern["regex"], $item->get_title())) { return false; } break; case "summary": if (preg_match($pattern["regex"], $item->get_description())) { return false; } break; case "content": if (preg_match($pattern["regex"], $item->get_content())) { return false; } break; case "url": if (preg_match($pattern["regex"], $item->get_permalink())) { return false; } break; case "category": foreach ($item->get_categories() as $category) { if (preg_match($pattern["regex"], $category->get_term()) || preg_match($pattern["regex"], $category->get_label())) { return false; } } break; default: die("Filter not implemented for field " . $pattern["field"]); } } return true; }
/** * Implements CollectionAbstract::buildDocument(). * * @param IndexDocument $document * @param \SimplePie_Item $data */ public function buildDocument(IndexDocument $document, $data) { $document->source = $this->_feed->get_title(); $document->subject = $this->_feed->get_description(); $document->title = $data->get_title(); $document->link = $data->get_link(); $document->description = $data->get_description(); $document->creator = (array) $data->get_author(); $document->date = $data->get_date(); // PHP properties cannot have dashes (-), and the fields below have // dashes in the field name. $document->source_link = $this->_feed->get_link(); $document->getField('source_link')->setName('source-link'); $document->item_subject = $this->_feed->get_link(); $document->getField('item_subject')->setName('item-subject'); }
function get_description($description_only = false) { return apply_filters('feedwordpie_item_get_description', parent::get_description($description_only), $description_only, $this); }
/** * Populate an item from a feed item * * @param $item \Planetflow3\Domain\Model\Item * @param $feedItem \SimplePie_Item * @return void */ protected function populateItemProperties(Item $item, \SimplePie_Item $feedItem) { $item->setLink($feedItem->get_link()); $item->setTitle($feedItem->get_title()); $item->setDescription($feedItem->get_description()); $item->setContent($feedItem->get_content(TRUE)); $item->setPublicationDate(new \DateTime($feedItem->get_date())); $item->setAuthor($feedItem->get_author()); }
/** * Pieces together the title attribute without using inline ternary conditional statements * * @access public * @param SimplePie_Item $item The item to generate the title attribute for. * @param integer $length The number of characters to return in the description. * @param string $date_format The format to use when displaying dates on items. Uses values from http://php.net/strftime, NOT http://php.net/date. * @return string The string for the title attribute. */ function get_title_attr($item, $length, $date_format) { // Get a handle for the item's parent feed object for PHP 4.x. $parent = $item->get_feed(); $title_attr = ''; $title_attr .= $item->get_title(); // The title of the post $title_attr .= ' :: '; // The separator between the title and the description (required by MooTools) $title_attr .= newsblocks::cleanup($item->get_description(), $length); // The cleaned-up and shortened version of the description $title_attr .= '<span>'; // This marks the beginning of the date/domain line (and is CSS styleable) // Does the item have a timestamp? if ($item->get_local_date($date_format)) { $title_attr .= $item->get_local_date($date_format); // Use the locale-friendly version for non-English languages. $title_attr .= ' // '; // Visual separator. } $title_attr .= newsblocks::name($parent->subscribe_url()); // The domain name that the item is coming from. $title_attr .= '</span>'; // Mark the end of the date/domain line. return $title_attr; }
/** * @return string twitterified description */ function get_description($description_only = false) { $desc = $this->twitterify(parent::get_description($description_only)); return $desc; }