Skip to content

Commit a7d1b7b

Browse files
boneliferclaude
andauthored
Screenshot the wiki's BBCodes page (#26)
Adds two custom BBCodes to the board, makes one wiki-only, and shoots Extensions > Wiki > BBCodes. Only when the extension has the setting. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2acdce9 commit a7d1b7b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎phpbb-test-board/screenshots.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,23 @@ def edit_conflict(mode: str, article: str) -> None:
384384
shoot.shot("wiki-start-values", "app.php/wiki/Release%202.0?action=edit&start_from=Start%20Release&sid={sid}",
385385
admin=True, selector="#page-body")
386386

387+
# The admin's own BBCodes, one of them made wiki-only. Only when the extension has the setting.
388+
has_wiki_only = board.php("echo class_exists('\\\\phpbbmodders\\\\wiki\\\\wiki\\\\wiki_only_bbcodes') ? 'yes' : 'no';").strip().endswith("yes")
389+
if has_wiki_only:
390+
board.php("$ids = [];"
391+
"foreach ([['note=', '[note={SIMPLETEXT}]{TEXT}[/note]', '<div class=\"note\"><b>{SIMPLETEXT}</b> {TEXT}</div>', 'Note box: [note=Title]text[/note]'],"
392+
" ['youtube', '[youtube]{URL}[/youtube]', '<a href=\"{URL}\">{URL}</a>', 'YouTube video: [youtube]link[/youtube]']] as $i => $b) {"
393+
" $ids[] = NUM_CORE_BBCODES + $i + 1;"
394+
" $db->sql_query('INSERT INTO ' . BBCODES_TABLE . ' ' . $db->sql_build_array('INSERT', ["
395+
" 'bbcode_id' => NUM_CORE_BBCODES + $i + 1, 'bbcode_tag' => $b[0], 'bbcode_match' => $b[1], 'bbcode_tpl' => $b[2],"
396+
" 'bbcode_helpline' => $b[3], 'display_on_posting' => 1, 'first_pass_match' => '', 'first_pass_replace' => '',"
397+
" 'second_pass_match' => '', 'second_pass_replace' => '']));"
398+
"}"
399+
"$config->set('wiki_only_bbcodes', (string) $ids[0]);", check=True)
400+
board.purge_cache()
401+
shoot.shot("wiki-acp-bbcodes", "adm/index.php?i=-phpbbmodders-wiki-acp-bbcodes_module&mode=settings&sid={sid}",
402+
admin=True, full_page=True)
403+
387404
def highlight_button(p) -> None:
388405
p.add_style_tag(content=".bbcode-wikilink { outline: 3px solid #d31141; outline-offset: 2px; }")
389406
shoot.shot("wiki-link-button", "app.php/wiki/Requirements?action=edit&sid={sid}", admin=True,

0 commit comments

Comments
 (0)