enhancePostContent/inc/class.epcfilteracronym.php

59 lines
1.7 KiB
PHP
Raw Normal View History

2022-12-12 22:39:12 +00:00
<?php
if (!defined('DC_RC_PATH')) {
return null;
}
class epcFilterAcronym extends epcFilter
{
protected function init(): string
{
$this->setProperties([
'priority' => 700,
'name' => __('Acronym'),
'help' => __('Explain some acronyms. First term of the list is the acornym and second term the explanation.'),
'has_list' => true,
'htmltag' => 'acronym',
'class' => ['acronym.epc-acronym'],
'replace' => '<acronym class="epc-acronym" title="%s">%s</acronym>',
'widget' => '<acronym title="%s">%s</acronym>',
]);
$this->setSettings([
'style' => ['font-weight: bold;'],
'notag' => 'a,acronym,abbr,dfn,h1,h2,h3',
'tplValues' => ['EntryContent'],
'pubPages' => ['post.html'],
]);
return 'acronym';
}
public function publicContent($tag, $args)
{
while ($this->records()->fetch()) {
$args[0] = enhancePostContent::replaceString(
$this->records()->epc_key,
sprintf($this->replace, __($this->records()->epc_value), '\\1'),
$args[0],
$this
);
}
return null;
}
public function widgetList($content, $w, &$list)
{
while ($this->records()->fetch()) {
$list[] = enhancePostContent::matchString(
$this->records()->epc_key,
sprintf($this->widget, __($this->records()->epc_value), '\\1'),
$content,
$this
);
}
return null;
}
}