{$ctx->lang('as_form_password')}:
HTML; $js = << Sign out HTML; } // uploads page // ------------ function uploads($ctx, $uploads, $error) { return <<if_true($error, $ctx->formError, $error)}
{$ctx->lang('blog_upload_form_file')}:
{$ctx->lang('blog_upload_form_custom_name')}:
{$ctx->lang('blog_upload_form_note')}:
{$ctx->for_each($uploads, fn($u) => $ctx->uploadsItem( id: $u->id, name: $u->name, direct_url: $u->getDirectUrl(), note: $u->note, addslashes_note: $u->note, markdown: $u->getMarkdown(), size: $u->getSize(), ))}
HTML; } function uploadsItem($ctx, $id, $direct_url, $note, $addslashes_note, $markdown, $name, $size) { return <<
{$ctx->lang('blog_upload_show_md')} | Edit note | {$ctx->lang('blog_upload_delete')}
{$name}
{$ctx->if_true($note, '
'.$note.'
')}
{$size}
HTML; } function postForm($ctx, string|Stringable $title, string|Stringable $text, string|Stringable $short_name, string|Stringable $tags = '', bool $is_edit = false, $error_code = null, ?bool $saved = null, ?bool $visible = null, string|Stringable|null $post_url = null, ?int $post_id = null): array { $form_url = !$is_edit ? '/write/' : $post_url.'edit/'; $html = <<if_true($error_code, '
'.$ctx->lang('err_blog_'.$error_code).'
')} {$ctx->if_true($saved, '
'.$ctx->lang('info_saved').'
')}
{$ctx->lang('blog_write_form_title')}
{$ctx->lang('blog_write_form_text')}
{$ctx->lang('blog_write_form_tags')}
{$ctx->lang('blog_write_form_options')}
{$ctx->lang('blog_write_form_short_name')}
 
HTML; $js_params = json_encode($is_edit ? ['edit' => true, 'id' => $post_id] : (object)[]); $js = "AdminWriteForm.init({$js_params});"; return [$html, $js]; } function pageForm($ctx, string|Stringable $title, string|Stringable $text, string|Stringable $short_name, bool $is_edit = false, $error_code = null, ?bool $saved = null, bool $visible = false): array { $form_url = '/'.$short_name.'/'.($is_edit ? 'edit' : 'create').'/'; $html = <<if_true($error_code, '
'.$ctx->lang('err_pages_'.$error_code).'
')} {$ctx->if_true($saved, '
'.$ctx->lang('info_saved').'
')}
{$ctx->lang('pages_write_form_title')}
{$ctx->lang('pages_write_form_text')}
{$ctx->if_then_else($is_edit, fn() => $ctx->pageFormEditOptions($short_name, $visible), fn() => $ctx->pageFormAddOptions($short_name))}
HTML; $js_params = json_encode(['pages' => true, 'edit' => $is_edit]); $js = <<
{$ctx->lang('pages_write_form_short_name')}
{$ctx->lang('pages_write_form_options')}
HTML; } function pageFormAddOptions($ctx, $short_name) { return <<
HTML; } function pageNew($ctx, $short_name) { return << HTML; } // misc function formError($ctx, $error) { return <<{$ctx->lang('error')}: {$error} HTML; } function markdownPreview($ctx, $unsafe_html, $title) { return << {$ctx->if_true($title, '

'.$title.'

')}
{$unsafe_html}
HTML; }