|
| 1 | +<?php |
| 2 | +defined('_JEXEC') or die( 'Restricted access' ); |
| 3 | +//error_reporting(E_ALL); |
| 4 | +//ini_set('display_errors', 1); |
| 5 | + |
| 6 | +jimport('joomla.user.user'); |
| 7 | +jimport( 'simpleschema.category' ); |
| 8 | +jimport( 'simpleschema.person' ); |
| 9 | +jimport( 'simpleschema.blog.post' ); |
| 10 | +jimport( 'simpleschema.blog.comment' ); |
| 11 | + |
| 12 | +require_once( EBLOG_HELPERS . '/date.php' ); |
| 13 | +require_once( EBLOG_HELPERS . '/string.php' ); |
| 14 | +require_once( EBLOG_CLASSES . '/adsense.php' ); |
| 15 | + |
| 16 | +class EasyblogApiResourceComments extends ApiResource |
| 17 | +{ |
| 18 | + |
| 19 | + public function __construct( &$ubject, $config = array()) { |
| 20 | + parent::__construct( $ubject, $config = array() ); |
| 21 | + |
| 22 | + } |
| 23 | + |
| 24 | + public function get() { |
| 25 | + $input = JFactory::getApplication()->input; |
| 26 | + $model = EasyBlogHelper::getModel( 'Blog' ); |
| 27 | + $id = $input->get('id', null, 'INT'); |
| 28 | + $comments = array(); |
| 29 | + |
| 30 | + $rows = $model->getBlogComment($id); |
| 31 | + |
| 32 | + foreach ($rows as $row) { |
| 33 | + $item = new CommentSchema; |
| 34 | + $item->commentid = $row->; |
| 35 | + $item->postid = $id; |
| 36 | + |
| 37 | + $comments[] = $item; |
| 38 | + } |
| 39 | + |
| 40 | + $this->plugin->setResponse( $comments ); |
| 41 | + |
| 42 | + } |
| 43 | + |
| 44 | + public static function getName() { |
| 45 | + |
| 46 | + } |
| 47 | + |
| 48 | + public static function describe() { |
| 49 | + |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments