Extension:PHPTemplates/de

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:PHPTemplates and the translation is 4% complete.

Other languages:
Deutsch • ‎English • ‎español • ‎polski • ‎sicilianu • ‎日本語
MediaWiki-Erweiterungen
OOjs UI icon advanced.svg
PHPTemplates
Erscheinungsstatus: experimentell
Einbindung Tag
Beschreibung Allows execution of PHP code embedded in pages
Autor(en) Tim.landscheidttalk
Letzte Version 0.1dev
MediaWiki 1.19svn
PHP 5.2.13
Lizenz GNU General Public License 3.0 or later
Herunterladen
Tags
phpcode
Verwendete Hooks
ParserFirstCallInit
Übersetze die PHPTemplates Erweiterung wenn sie auf translatewiki.net verfügbar ist
Prüfe die Benutzungs- und Versionsmatrix.

What can this extension do?

This extension allows you to embed white-listed PHP code in pages. Why the misnomer "PHPTemplates"? Because ultimately for reviewing code similar to Erweiterung:Flagged Revisions , it would be nice to limit PHPTemplates's scope to templates starting with <?php. However, it is much easier at this time to plug into the MediaWiki parser via the general tag hook.

Usage

<phpcode>$a=$b+$c;echo($a);</phpcode>

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

Download instructions

Please copy and paste the code found at GitHub and place it under $IP/extensions/PHPTemplates/.

$IP steht für den Installationspfad (oder "Verzeichnis") deiner MediaWiki-Installation, dem selben Verzeichnis das die LocalSettings.php, index.php etc. beinhaltet.

Installation

To install this extension, add the following to LocalSettings.php :

require_once("$IP/extensions/PHPTemplates/PHPTemplates.php");

Limiting your users' freedom

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:

while (true);

to:

while (wfAbortIfResourcesLimitExceeded () && (true));

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

Siehe auch