setProperties([
'priority' => 900,
'name' => __('Tag'),
'help' => __('Highlight tags of your blog.'),
'htmltag' => 'a',
'class' => ['a.epc-tag'],
'replace' => '%s',
'widget' => '%s',
]);
$this->setSettings([
'style' => ['text-decoration: none; border-bottom: 3px double #CCCCCC;'],
'notag' => 'a,h1,h2,h3',
'tplValues' => ['EntryContent'],
'pubPages' => ['post.html'],
]);
return 'tag';
}
public function publicContent(string $tag, array $args): void
{
if (!dcCore::app()->plugins->moduleExists('tags')) {
return;
}
$metas = dcCore::app()->meta->getMetadata(['meta_type' => 'tag']);
while ($metas->fetch()) {
$args[0] = Epc::replaceString(
$metas->meta_id,
sprintf($this->replace, dcCore::app()->blog->url . dcCore::app()->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
$args[0],
$this
);
}
}
public function widgetList(string $content, WidgetsElement $w, array &$list): void
{
if (!dcCore::app()->plugins->moduleExists('tags')) {
return;
}
$metas = dcCore::app()->meta->getMetadata(['meta_type' => 'tag']);
while ($metas->fetch()) {
$list[] = Epc::matchString(
$metas->meta_id,
sprintf($this->widget, dcCore::app()->blog->url . dcCore::app()->url->getBase('tag') . '/' . $metas->meta_id, '\\1'),
$content,
$this
);
}
}
}