1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Comments engine can now be easily replaced by plugins using e_comment.php. Added "facebook comments" to the social plugin as an example. See admin -> manage -> Comments Manager to enable. (plugin scan may be required if upgrading from github)

This commit is contained in:
Cameron
2015-04-08 14:51:06 -07:00
parent 2972efb5c0
commit 1bc43a35ff
4 changed files with 128 additions and 18 deletions

View File

@@ -86,6 +86,7 @@ class comments_admin_ui extends e_admin_ui
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
protected $prefs = array(
'comments_engine' => array('title'=>"Engine", 'type'=>'dropdown', 'writeParms'=>array()),
'comments_disabled' => array('title'=>PRFLAN_161, 'type'=>'boolean', 'writeParms'=>'inverse=1'), // Same as 'writeParms'=>'reverse=1&enabled=LAN_DISABLED&disabled=LAN_ENABLED'
'anon_post' => array('title'=>PRFLAN_32, 'type'=>'boolean'),
'comments_icon' => array('title'=>PRFLAN_89, 'type'=>'boolean'),
@@ -95,6 +96,40 @@ class comments_admin_ui extends e_admin_ui
);
public function init()
{
$engine = e107::pref('core', 'comments_engine');
if($engine != 'e107') // Hide all other prefs.
{
$this->prefs = array(
'comments_engine' => array('title'=>"Engine", 'type'=>'dropdown', 'writeParms'=>array()),
'comments_disabled' => array('title'=>PRFLAN_161, 'type'=>'boolean', 'writeParms'=>'inverse=1'),
);
}
$this->prefs['comments_engine']['writeParms']['optArray'] = array('e107'=>'e107');
$addons = e107::getAddonConfig('e_comment');
foreach($addons as $plugin=>$config)
{
foreach($config as $val)
{
$id = $plugin."::".$val['function'];
$this->prefs['comments_engine']['writeParms']['optArray'][$id] = $val['name'];
}
}
// print_a($addons);
}
public function afterUpdate($new_data, $old_data, $id)
{
if(($new_data['comment_type'] == 0 || $new_data['comment_type'] == 'news' ))