Sign out
HTML;
}
// uploads page
// ------------
function uploads($ctx, $uploads, $error) {
return <<if_true($error, $ctx->formError, $error)}
{$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->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').'
')}
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').'
')}
|
|
HTML;
$js_params = json_encode(['pages' => true, 'edit' => $is_edit]);
$js = <<
|
|
|
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;
}