2015-05-30 15:21:33 +00:00
|
|
|
<?php
|
2023-01-02 00:00:05 +00:00
|
|
|
/**
|
|
|
|
* @brief comListe, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Benoit de Marne, Pierre Van Glabeke and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
|
|
|
if (!defined('DC_RC_PATH')) {
|
|
|
|
return null;
|
|
|
|
}
|
2015-05-30 15:21:33 +00:00
|
|
|
|
2023-01-04 23:47:36 +00:00
|
|
|
dcCore::app()->addBehavior('initWidgets', [comListeWidget::class,'initWidget']);
|
2015-05-30 15:21:33 +00:00
|
|
|
|
2023-01-02 00:00:05 +00:00
|
|
|
class comListeWidget
|
2015-05-30 15:21:33 +00:00
|
|
|
{
|
2023-01-02 00:00:05 +00:00
|
|
|
public static function initWidget($w)
|
|
|
|
{
|
|
|
|
$w->create(
|
|
|
|
'comListe',
|
|
|
|
__('Comments list'),
|
|
|
|
['comListeWidget','publicWidget'],
|
|
|
|
null,
|
2023-01-03 23:50:34 +00:00
|
|
|
__('Link to comments list public page')
|
2023-01-02 00:00:05 +00:00
|
|
|
)
|
|
|
|
->addTitle(__('Comments list'))
|
|
|
|
->setting(
|
|
|
|
'link_title',
|
2023-01-03 23:50:34 +00:00
|
|
|
__('Link title: (leave empty to use page title'),
|
2023-01-02 00:00:05 +00:00
|
|
|
__('Comments list')
|
|
|
|
)
|
|
|
|
->addHomeOnly()
|
|
|
|
->addContentOnly()
|
|
|
|
->addClass()
|
|
|
|
->addOffline();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function publicWidget($w)
|
|
|
|
{
|
|
|
|
if ($w->offline
|
|
|
|
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|
|
|
|| !dcCore::app()->blog->settings->get(basename(__DIR__))->get('enable')
|
|
|
|
) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $w->renderDiv(
|
|
|
|
$w->content_only,
|
|
|
|
'comliste ' . $w->class,
|
|
|
|
'',
|
|
|
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
|
|
|
sprintf(
|
|
|
|
'<p><a href="%s">%s</a></p>',
|
|
|
|
dcCore::app()->blog->url . dcCore::app()->url->getBase('comListe'),
|
2023-01-03 23:50:34 +00:00
|
|
|
$w->link_title ? html::escapeHTML($w->link_title) : (dcCore::app()->blog->settings->get(basename(__DIR__))->get('page_title') ?? __('Comments list'))
|
2023-01-02 00:00:05 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|