Skip to content
View in the app

A better way to browse. Learn more.

ernestdefoe.online

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
ernestdefoe.online

Extensions, themes & support for Flarum and Invision Community

Vibe coding for the community web. Report a bug, request a feature, or dig into the source — this is where the tools you use get built, in the open.

We do custom Bespoke Invision Community apps. If you have an idea for something you want then use the contact form to get in touch with us.
Knowledge base

Things that cost me a day, so they cost you none

Working notes from building Invision Community and Flarum applications. Mostly the failures that give no error at all — the ones where everything installs cleanly and quietly does the wrong thing.

92 articles

Invision Community 5

86 articles

Extensions and contracts

39

What each extension point is for, what it must declare, and what happens when it is wrong — which is usually nothing visible.

Languages and text

5

The string table, translation, and the places where text does not appear where you expected it to.

Theming, templates and forms

9

Theme hooks, CSS that survives both colour schemes, and building forms that do not throw on render.

Background work and scheduled tasks

5

The queue system, work that has to happen after the response, and jobs that finish without doing anything.

Data, settings and storage

11

The database layer, settings, tags, file storage, and backing up a live site.

AI features and expectations

5

What these features do, what they cost, and what buyers reasonably but wrongly assume they do.

Application structure and releases

11

The JSON files an application is made of, versioning and upgrade steps, and testing from the command line.

Realtime, chat and calls

1

WebSocket gateways, relays and the server-side pieces live features depend on — where "it works when I test it" and "it works for your members" are different claims.

Nothing matches that.

addToStack() often returns a placeholder, not translated text

Member::loggedIn()->language()->addToStack( 'my_key' ) looks like a function that returns a translated string. Sometimes it is. Often it returns a deferred placeholder that is substituted later, when the output is rendered.

What actually happens

If the language words are already loaded, you get real text. If they are not, the key is added to an output stack and a placeholder comes back:

public function addToStack( string $key, ?bool $vle = TRUE, array $options = array() ): string

Rendering later calls parseOutputForDisplay(), which walks the output and swaps placeholders for text. Note its signature — it takes the output by reference:

public function parseOutputForDisplay( mixed &$output ): void

The trap: storing the result

Anything that takes the return value and puts it somewhere that is not rendered through the normal output path stores the placeholder. Written to the database, it stays a placeholder for ever:

// WRONG - may store a placeholder, not a title
$title = $lang->addToStack( 'myapp_generated_title', FALSE, array( 'sprintf' => array( $name ) ) );
Post::create( $item, $title );

// RIGHT - force resolution first
$title = $lang->addToStack( 'myapp_generated_title', FALSE, array( 'sprintf' => array( $name ) ) );
$lang->parseOutputForDisplay( $title );
Post::create( $item, $title );

This bites hardest in background tasks and queue jobs, where no page is being rendered and nothing calls the parser for you.

The second trap: escaping the placeholder is not escaping the text

If a value is interpolated into a language string, escaping the result of addToStack() achieves nothing — at that moment the result may be a placeholder, and the real value is substituted raw afterwards.

// WRONG - escapes a placeholder; the title is substituted raw later
$out = htmlspecialchars( $lang->addToStack( 'x_posted_y', FALSE, array( 'sprintf' => array( $userTitle ) ) ) );

// RIGHT - escape the ARGUMENT going in
$out = $lang->addToStack( 'x_posted_y', FALSE, array( 'sprintf' => array( htmlspecialchars( $userTitle, ENT_QUOTES, 'UTF-8' ) ) ) );

Escape what goes into the string, never what comes out.

Verified against

Invision Community 5.0.19, by reading system/Lang/Lang.php.


User Feedback

Recommended Comments

There are no comments to display.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.