芝麻web文件管理V1.00
tag.
if ($new_code) {
// Replace the new code in the HTML document.
$patterns = [
\chr(1) . '()' . \chr(1) . 'i',
\chr(1) . '()' . \chr(1) . 'i',
];
$replace = [
'${1}' . strtolower($new_code) . '${3}',
'${1}' . strtolower($new_code) . '${3}',
];
} else {
$patterns = [];
$replace = [];
}
// Replace codes in attributes.
preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches);
foreach ($matches[2] as $match) {
$new_code = $this->params->get(strtolower($match));
if ($new_code) {
$patterns[] = \chr(1) . '()' . \chr(1) . 'i';
$replace[] = '${1}' . $new_code . '${3}';
}
}
preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches);
foreach ($matches[2] as $match) {
$new_code = $this->params->get(strtolower($match));
if ($new_code) {
$patterns[] = \chr(1) . '()' . \chr(1) . 'i';
$replace[] = '${1}' . $new_code . '${3}';
}
}
// Replace codes in itemprop content
preg_match_all(\chr(1) . '()' . \chr(1) . 'i', $body, $matches);
foreach ($matches[2] as $match) {
$new_code = $this->params->get(strtolower($match));
if ($new_code) {
$patterns[] = \chr(1) . '()' . \chr(1) . 'i';
$replace[] = '${1}' . $new_code . '${3}';
}
}
$app->setBody(preg_replace($patterns, $replace, $body));
}
}
/**
* Prepare form.
*
* @param PrepareFormEvent $event The event object
*
* @return void
*
* @since 2.5
*/
public function onContentPrepareForm(PrepareFormEvent $event): void
{
$form = $event->getForm();
// Check we are manipulating the languagecode plugin.
if ($form->getName() !== 'com_plugins.plugin' || !$form->getField('languagecodeplugin', 'params')) {
return;
}
// Get site languages.
if ($languages = LanguageHelper::getKnownLanguages(JPATH_SITE)) {
// Inject fields into the form.
foreach ($languages as $tag => $language) {
$form->load('
');
}
}
}
}