Extension:PHPTemplates/ja

この拡張機能ができること
This extension allows you to embed white-listed PHP code in pages. Why the misnomer "PHPTemplates"? Because ultimately for reviewing code similar to Extension:FlaggedRevs, it would be nice to limit PHPTemplates's scope to templates starting with. However, it is much easier at this time to plug into the MediaWiki parser via the general tag hook.

使用法
That's all at this moment (yes, it will output "0"). The PHP grammar is rather complex, and trimming it down takes time.

ダウンロード手順
Please copy and paste the code found at GitHub and place it under. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

インストール
To install this extension, add the following to LocalSettings.php:

利用者の自由の制限
You can enhance PHPTemplates to somewhat cap the resources used. Duly note that enhancing in this context means amending the grammar and generating a new parser.

Validation
While parsing the source, you can count the number of statements and their levels of nesting and require that certain limits are not exceeded.

Runtime
Instead of just validating the source, you can amend it on the fly and transform for example:

to:

There will probably be some bombs that cannot be guarded against this way, but it should cover most common mistakes.

関連項目

 * Extension:Foxway/ja Another way to embed PHP code in pages.