SyndicatedPost::excerpt PHP Méthode

excerpt() public méthode

* SyndicatedPost::content()
public excerpt ( )
    function excerpt()
    {
        # Identify and sanitize excerpt: atom:summary, or rss:description
        $excerpt = $this->entry->get_description();
        # Many RSS feeds use rss:description, inadvisably, to
        # carry the entire post (typically with escaped HTML).
        # If that's what happened, we don't want the full
        # content for the excerpt.
        $content = $this->content();
        // Ignore whitespace, case, and tag cruft.
        $theExcerpt = preg_replace('/\\s+/', '', strtolower(strip_tags($excerpt)));
        $theContent = preg_replace('/\\s+/', '', strtolower(strip_tags($content)));
        if (empty($excerpt) or $theExcerpt == $theContent) {
            # If content is available, generate an excerpt.
            if (strlen(trim($content)) > 0) {
                $excerpt = strip_tags($content);
                if (strlen($excerpt) > 255) {
                    $excerpt = substr($excerpt, 0, 252) . '...';
                }
            }
        }
        return $excerpt;
    }