Esempio n. 1
0
 public function testFetch()
 {
     $news = new model\News();
     $lastNews = $news->createPost($this->title, $this->testedContent[0], $this->testedAccountId);
     $lastFetchedNews = $news->last();
     $allNews = $news->all();
     $this->assertEquals($lastNews, $lastFetchedNews);
     $this->assertTrue($news->isCollection($allNews));
     $this->assertEquals(3, strlen($news->lastPreview(3)));
 }
Esempio n. 2
0
             $news->createPost($news_title, $news_content, $me->getAccountss()->getFirst()->getAccountId(), $tag);
             $parts['new_successful_submit'] = true;
         } catch (InvalidArgumentException $e) {
             $parts['new_successful_submit'] = false;
         }
     }
 }
 // Fetch the news
 try {
     $news = new model\News();
     if (in('tag_query')) {
         // Search for specific tag
         $all_news = $news->findByTag(in('tag_query'));
         $parts['search_title'] = 'Result for #' . htmlentities(in('tag_query'));
     } else {
         $all_news = $news->all();
     }
 } catch (InvalidArgumentException $e) {
     $all_news = array();
 }
 $parts['all_news'] = $all_news;
 $template = prep_page($view, 'News Board', $parts, array());
 function to_tags($str_tags)
 {
     $tags = array();
     if (strpos($str_tags, ',') !== false) {
         $tags = explode(',', $str_tags);
     } elseif (!empty($str_tags)) {
         $tags = array($str_tags);
     }
     if (empty($tags)) {