Skip to content

placeholders in settings.php? #124

@Klap-in

Description

@Klap-in

I observe regularly authors use php code in the settings strings in settings.php. In the strings in lang.php they can use sprintf() with %s etc as placeholders. Is it worth to consider something like that for settings? how?

  • Via placeholders in the string: as submissions are submitted via the Tool, it is probably too easy to suggest wrong alternatives (i.e. names of other config settings). (however, it is all html, so that impose also a bit such a risk).

  • Or add a metadata setting that allows configuring the replacements. Not sure if it easy to propose there php variables, for some cases it might be executed too early ($lang['..']).

  • ...?

Examples:

A path with php:

$lang['confhowhardstyle'] = 'Choose image :<br>1 : <img src="'.DOKU_BASE.'lib/plugins/howhard/images/style1/3.png"><br>2 : <img src="'.DOKU_BASE.'lib/plugins/howhard/images/style2/3.png"><br><br>3 : <img src="'.DOKU_BASE.'lib/plugins/howhard/images/style3/3.png"><br><br>4 : <img src="'.DOKU_BASE.'lib/plugins/howhard/images/style4/3.png">';

References to other settings:

$lang['index_priority'] = "Priority order of pages used as index pages, between start, inside and outside. Exemple with the namespace foo:bar: start= foo:bar:".$conf['start']." ; outside= foo:bar ; inside= foo:bar:bar";

Reference to other strings:

$lang['missing_mmdb_warning'] = "<br />To install GeoLite2-City.mmdb, go to the quickstats admin page and click the <b>" . $lang['btn_download'] . " </b> Button";

Config plugin code:
https://github.com/dokuwiki/dokuwiki/blob/11f4950ced97a3542fb13bd54b2e57521f1fa62c/lib/plugins/config/admin.php#L127

https://github.com/dokuwiki/dokuwiki/blob/11f4950ced97a3542fb13bd54b2e57521f1fa62c/lib/plugins/config/core/Setting/Setting.php#L213

https://github.com/dokuwiki/dokuwiki/blob/11f4950ced97a3542fb13bd54b2e57521f1fa62c/lib/plugins/config/core/Setting/Setting.php#L274-L279

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions