Exemple #1
0
function parseItem($blog, $item, $ts)
{
    if ($ts != 0 && $item->pubdate <= $ts) {
        logmsg('Zatrzymanie na wpisie: %s', StringUtils::removeAccents($item->title));
        return false;
    }
    logmsg('  - Parsowanie wpisu: %s', StringUtils::removeAccents($item->title));
    $post = new Post();
    $post->setBlog($blog);
    foreach ($item->tags as $name) {
        $tag = TagPeer::retriveByName($name, true);
        if ($post->addTag($tag)) {
            logmsg('    - Znaleziono tag: %s', $name);
        }
    }
    if ($post->hasTags()) {
        $shortened = $post->setFullContent($item->content);
        $post->setLink(htmlspecialchars($item->link));
        $post->setTitle($item->title);
        $post->setCreatedAt($item->pubdate);
        $post->setShortened($shortened);
        $post->save();
    } else {
        logmsg('    - Nie znaleziono tagow');
    }
    return true;
}
Exemple #2
0
 public static function tagize($string)
 {
     $string = StringUtils::removeAccents($string);
     $string = strtolower($string);
     $string = str_replace(' ', '_', $string);
     return $string;
 }