auth->isSuperAdmin()) { return null; } $redir = empty($_REQUEST['redir']) ? dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir']; # -- Get settings -- $s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); $fac_formats = json_decode($s->get('formats'), true); if (!is_array($fac_formats)) { $fac_formats = []; } # -- Set settings -- if (!empty($_POST['save'])) { try { $fac_formats = []; foreach ($_POST['fac_formats'] as $uid => $f) { if (!empty($f['name'])) { $fac_formats[$uid] = $f; } } // fix 2021.08.21 : formats are now global $s->drop('formats'); $s->put( 'formats', json_encode($fac_formats), 'string', 'Formats of feeds contents', true, true ); dcCore::app()->blog->triggerBlog(); dcAdminNotices::addSuccessNotice( __('Configuration successfully updated.') ); http::redirect( dcCore::app()->admin->list->getURL('module=' . basename(__DIR__) . '&conf=1&redir=' . dcCore::app()->admin->list->getRedir()) ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } # -- Display form -- $i = 1; foreach ($fac_formats as $uid => $f) { if (empty($f['name'])) { continue; } echo '

' . sprintf(__('Format %s'), $i) . '

' . __('General') . '

' . form::field( [ 'fac_formats[' . $uid . '][name]', 'fac_formats_' . $uid . '_name', ], 20, 255, empty($f['name']) ? '' : $f['name'], 'maximal' ) . '

' . __('In order to remove a format, leave its name empty.') . '

' . form::field( [ 'fac_formats[' . $uid . '][dateformat]', 'fac_formats_' . $uid . '_dateformat', ], 20, 255, empty($f['dateformat']) ? '' : $f['dateformat'], 'maximal' ) . '

' . __('Use date format of Dotclear or leave empty to use default date format of blog.') . '

' . form::field( [ 'fac_formats[' . $uid . '][lineslimit]', 'fac_formats_' . $uid . '_lineslimit', ], 5, 4, empty($f['lineslimit']) ? '' : $f['lineslimit'], 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Title') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitletext]', 'fac_formats_' . $uid . '_linestitletext', ], 20, 255, empty($f['linestitletext']) ? '' : $f['linestitletext'], 'maximal' ) . '

' . __('Format can be:') . '%D : ' . __('Date') . ', %T : ' . __('Title') . ', %A : ' . __('Author') . ', %E : ' . __('Description') . ', %C : ' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitleover]', 'fac_formats_' . $uid . '_linestitleover', ], 20, 255, empty($f['linestitleover']) ? '' : $f['linestitleover'], 'maximal' ) . '

' . __('Format can be:') . '%D : ' . __('Date') . ', %T : ' . __('Title') . ', %A : ' . __('Author') . ', %E : ' . __('Description') . ', %C : ' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitlelength]', 'fac_formats_' . $uid . '_linestitlelength', ], 5, 4, empty($f['linestitlelength']) ? '' : $f['linestitlelength'], 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Description') . '

' . form::field( [ 'fac_formats[' . $uid . '][linesdescriptionlength]', 'fac_formats_' . $uid . '_linesdescriptionlength', ], 5, 4, empty($f['linesdescriptionlength']) ? '' : $f['linesdescriptionlength'], 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linescontentlength]', 'fac_formats_' . $uid . '_linescontentlength', ], 5, 4, empty($f['linescontentlength']) ? '' : $f['linescontentlength'], 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

'; $i++; } $uid = uniqid(); echo '

' . __('New format') . '

' . __('General') . '

' . form::field( [ 'fac_formats[' . $uid . '][name]', 'fac_formats_' . $uid . '_name', ], 20, 255, '', 'maximal' ) . '

' . __('In order to remove a format, leave its name empty.') . '

' . form::field( [ 'fac_formats[' . $uid . '][dateformat]', 'fac_formats_' . $uid . '_dateformat', ], 20, 255, '', 'maximal' ) . '

' . __('Use date format of Dotclear or leave empty to use default date format of blog.') . '

' . form::field( [ 'fac_formats[' . $uid . '][lineslimit]', 'fac_formats_' . $uid . '_lineslimit', ], 5, 4, 5, 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Title') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitletext]', 'fac_formats_' . $uid . '_linestitletext', ], 20, 255, '%T', 'maximal' ) . '

' . __('Format can be:') . '%D : ' . __('Date') . ', %T : ' . __('Title') . ', %A : ' . __('Author') . ', %E : ' . __('Description') . ', %C : ' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitleover]', 'fac_formats_' . $uid . '_linestitleover', ], 20, 255, '%D', 'maximal' ) . '

' . __('Format can be:') . '%D : ' . __('Date') . ', %T : ' . __('Title') . ', %A : ' . __('Author') . ', %E : ' . __('Description') . ', %C : ' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linestitlelength]', 'fac_formats_' . $uid . '_linestitlelength', ], 5, 4, 150, 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Description') . '

' . form::field( [ 'fac_formats[' . $uid . '][linesdescriptionlength]', 'fac_formats_' . $uid . '_linesdescriptionlength', ], 5, 4, 350, 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Content') . '

' . form::field( [ 'fac_formats[' . $uid . '][linescontentlength]', 'fac_formats_' . $uid . '_linescontentlength', ], 5, 4, 350, 'maximal' ) . '

' . __('Leave lengh empty for no limit.') . '

' . __('Informations') . '

' . __('Theme') . '

' . __('Theme must have behavoir publicEntryAfterContent.') . ' ' . __('To add feed to an entry edit this entry and put in sidebar the url of the feed and select a format.') . '

' . __('Structure') . '
' . html::escapeHTML('

' . __('Title of feed') . '

' . __('Description of feed') . '

' . __('Title of entry') . '
' . __('Description of entry') . '
') . '
'; dcPage::helpBlock('fac');