Conditions | 4 |
Paths | 6 |
Total Lines | 26 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function save($data) |
||
29 | { |
||
30 | if (version_compare(JVERSION, '3.0', 'lt')) { |
||
31 | JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table'); |
||
32 | } |
||
33 | |||
34 | $data = (object) $data; |
||
35 | $article = JTable::getInstance('content'); |
||
36 | $article->title = $data->title; |
||
|
|||
37 | $article->alias = JFilterOutput::stringURLSafe($data->title); |
||
38 | $article->introtext = '<p>'.$data->description.'</p>'; |
||
39 | $article->created = JFactory::getDate()->toSQL();; |
||
40 | $article->created_by_alias = $data->user; |
||
41 | $article->state = 1; |
||
42 | $article->access = 1; |
||
43 | $article->metadata = '{"page_title":"'.$data->title.'","author":"'.$data->user.'","robots":""}'; |
||
44 | $article->language = '*'; |
||
45 | |||
46 | if (!$article->check()) { |
||
47 | throw new Exception($article->getError()); |
||
48 | return FALSE; |
||
49 | } |
||
50 | |||
51 | if (!$article->store(TRUE)) { |
||
52 | throw new Exception($article->getError()); |
||
53 | return FALSE; |
||
54 | } |
||
57 |