1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Issue #1406 - Added a more intuitive comment method for plugin developers.

Usage:
$text = e107::getComment()->render('myplugin', 3, "My Subject", false);
echo $text;
This commit is contained in:
Cameron
2016-04-04 12:18:12 -07:00
parent a8f23f7179
commit 3de87776a9

View File

@@ -1011,13 +1011,29 @@ class comment
} }
/**
* Returns a rendered commenting area. (html) v2.x
* This is the only method a plugin developer should require in order to include user comments.
* @param string $plugin - directory of the plugin that will own these comments.
* @param int $id - unique id for this page/item. Usually the primary ID of your plugin's database table.
* @param string $subject
* @param bool|false $rate true = will rendered rating buttons, false will not.
* @return null|string
*/
public function render($plugin, $id, $subject, $rate=false)
{
return $this->compose_comment($plugin, 'comment', $id, 0, $subject, $rate, 'html');
}
/** /**
* Displays existing comments, and a comment entry form * Displays existing comments, and a comment entry form
* *
* @param string $table - the source table for the associated item * @param string $table - the source table for the associated item
* @param string $action - usually 'comment' or 'reply' * @param string $action - usually 'comment' or 'reply'
* @param integer $id - ID of item associated with comments (e.g. news ID) * @param integer $id - ID of item associated with comments (e.g. news ID)
* @param unknown_type $width - appears to not be used * @param int $width - appears to not be used
* @param string $subject * @param string $subject
* @param boolean $rate * @param boolean $rate
*/ */
@@ -1144,6 +1160,10 @@ class comment
{ {
echo $TEMPL; echo $TEMPL;
} }
}
elseif($return === 'html')
{
return $ns->tablerender("<span id='e-comment-total'>".$this->totalComments."</span> ".LAN_COMMENTS, $TEMPL, 'comment', true);
} }
//echo $modcomment.$comment; //echo $modcomment.$comment;
//echo $text; //echo $text;