Fix page assembly

This commit is contained in:
Matthew Exon 2020-10-21 16:25:51 +01:00 committed by Matthew Exon
parent b9c08ad651
commit 697241c42a

View file

@ -835,6 +835,9 @@ function retriever_content($a) {
}
if ($a->argv[1]) {
$retriever_rule = get_retriever_rule($a->argv[1], local_user(), false);
if (!$retriever_rule) {
$retriever_rule = ['id' => 0, 'data' => ['enable' => 0, 'modurl' => '', 'pattern' => '', 'replace' => '', 'images' => 0, 'storecookies' => 0, 'cookiedata' => '', 'customxslt' => '', 'include' => '', 'exclude' => '']];
}
if (!empty($_POST["id"])) {
$retriever_rule = get_retriever_rule($a->argv[1], local_user(), true);
@ -873,31 +876,31 @@ function retriever_content($a) {
}
$template = Renderer::getMarkupTemplate('/rule-config.tpl', 'addon/retriever/');
$a->page['content'] .= Renderer::replaceMacros($template, array(
DI::page()['content'] .= Renderer::replaceMacros($template, array(
'$enable' => array(
'retriever_enable',
DI::l10n()->t('Enabled'),
array_key_exists('enable', $retriever_rule['data']) ? $retriever_rule['data']['enable'] : ""),
$retriever_rule['data']['enable']),
'$modurl' => array(
'retriever_modurl',
DI::l10n()->t('Modify URL'),
array_key_exists('modurl', $retriever_rule['data']) ? $retriever_rule['data']['modurl'] : "",
$retriever_rule['data']['modurl'],
DI::l10n()->t("Modify each article's URL with regular expressions before retrieving.")),
'$pattern' => array(
'retriever_pattern',
DI::l10n()->t('URL Pattern'),
array_key_exists('pattern', $retriever_rule['data']) ? $retriever_rule['data']['pattern'] : "",
$retriever_rule['data']['pattern'],
DI::l10n()->t('Regular expression matching part of the URL to replace')),
'$replace' => array(
'retriever_replace',
DI::l10n()->t('URL Replace'),
array_key_exists('replace', $retriever_rule['data']) ? $retriever_rule['data']['replace'] : "",
$retriever_rule['data']['replace'],
DI::l10n()->t('Text to replace matching part of above regular expression')),
'$allow_images' => DI::config()->get('retriever', 'allow_images'),
'$images' => array(
'retriever_images',
DI::l10n()->t('Download Images'),
array_key_exists('images', $retriever_rule['data']) ? $retriever_rule['data']['images'] : ""),
$retriever_rule['data']['images']),
'$retrospective' => array(
'retriever_retrospective',
DI::l10n()->t('Retrospectively Apply'),
@ -906,17 +909,17 @@ function retriever_content($a) {
'storecookies' => array(
'retriever_storecookies',
DI::l10n()->t('Store cookies'),
array_key_exists('storecookies', $retriever_rule['data']) ? $retriever_rule['data']['storecookies'] : "",
$retriever_rule['data']['storecookies'],
DI::l10n()->t("Preserve cookie data across fetches.")),
'$cookiedata' => array(
'retriever_cookiedata',
DI::l10n()->t('Cookie Data'),
array_key_exists('cookiedata', $retriever_rule['data']) ? $retriever_rule['data']['cookiedata'] : "",
$retriever_rule['data']['cookiedata'],
DI::l10n()->t("Latest cookie data for this feed. Netscape cookie file format.")),
'$customxslt' => array(
'retriever_customxslt',
DI::l10n()->t('Custom XSLT'),
array_key_exists('customxslt', $retriever_rule['data']) ? $retriever_rule['data']['customxslt'] : "",
$retriever_rule['data']['customxslt'],
DI::l10n()->t("When standard rules aren't enough, apply custom XSLT to the article")),
'$title' => DI::l10n()->t('Retrieve Feed Content'),
'$help' => DI::baseUrl()->get(true) . '/retriever/help',