500,
'name' => __('Link'),
'help' => __('Link some words. First term of the list is the term to link and second term the link.'),
'has_list' => true,
'htmltag' => 'a',
'class' => ['a.epc-link'],
'replace' => '%s',
'widget' => '%s',
];
}
protected function initSettings(): array
{
return [
'style' => ['text-decoration: none; font-style: italic; color: #0000FF;'],
'notag' => 'a,h1,h2,h3',
'tplValues' => ['EntryContent'],
'pubPages' => ['post.html'],
];
}
public function publicContent(string $tag, array $args): void
{
while ($this->records()->fetch()) {
$args[0] = Epc::replaceString(
$this->records()->f('epc_key'),
sprintf($this->replace, '\\1', $this->records()->f('epc_value'), '\\1'),
$args[0],
$this
);
}
}
public function widgetList(string $content, WidgetsElement $w, ArrayObject $list): void
{
while ($this->records()->fetch()) {
$list[] = Epc::matchString(
$this->records()->f('epc_key'),
sprintf($this->widget, $this->records()->f('epc_value'), $this->records()->f('epc_value'), '\\1'),
$content,
$this
);
}
}
}