Jump to content

Extensión:PhpTags

From mediawiki.org
This page is a translated version of the page Extension:PhpTags and the translation is 39% complete.
Manual de extensiones de MediaWiki
PhpTags
Estado de lanzamiento: sin mantenimiento
Implementación Etiqueta , Función del analizador , Gancho
Descripción Permite usar las expresiones mágicas con la sintaxis del lenguaje PHP
Autor(es) Pavel Astakhov (pastakhovdiscusión)
Última versión 5.5.0 (2015-11-20)
MediaWiki 1.25+
PHP 5.3+
Licencia GNU Licencia Pública general 2.0 o posterior
Descarga
  • $wgPhpTagsMaxLoops
  • $wgPhpTagsNamespaces
  • $wgPhpTagsBytecodeExptime
phptag
Descargas trimestrales 2 (Ranked 134th)
Traduce la extensión PhpTags si está disponible en translatewiki.net
Asuntos Tareas abiertas · Reportar un bug

The PhpTags extension implements the concept of Magic expressions with PHP language syntax that allows you to create and use compatible but not monolithic MediaWiki extensions, which greatly increases the convenience, flexibility and performance. More ...

Descripción

The PhpTags extension has its own the runtime environment PHP code which supports scalar types, arrays, variables, operators, control structures. It also supports constants, functions and objects but it does not implement any of them except for some language constructs.

When using a function, object or constant PhpTags calls corresponding extension. Therefore, a set of constants, functions, objects and actions that they produce only depend on additionally installed compatible extensions which can be found here.

PhpTags designed so to be as similar to native PHP, therefore you should have the illusion of direct execution PHP code although this never happens.

Uso

The code should be placed between the tags ‎<phptag> and ‎</phptag>. It can be located in any namespace if it is allowed by the variable $wgPhpTagsNamespaces.

<phptag>
$foo = 'hello world';
echo ucfirst( $foo . "!!!\n" );
</phptag>

Mostrará:

Hello world!!! 
the function ucfirst is implemented in Extensión:Funciones PhpTags . More details can be found in the quick start guide.

Instalación

  • Descarga y extrae los archivos en un directorio denominado «PhpTags» dentro de la carpeta extensions/.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PhpTags
  • Añade el siguiente código en la parte final de tu archivo LocalSettings.php :
    wfLoadExtension( 'PhpTags' );
    
  • Yes Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.


Instalación Vagrant:

  • Si se utiliza Vagrant , instala con vagrant roles enable phptags --provision


Instalación opcional

Instalación adicional

The PhpTags extension (core) implements magic expressions only and not, for instance, any PHP function.

For additional features such as functions, you can install additional extensions which are compatible with the magic expressions of the PhpTags extension.

Las principales extensiones son:

Parámetros de configuración

Nombre Descripción Default
$wgPhpTagsMaxLoops Maximum number of allowed loops 1000
$wgPhpTagsNamespaces Array of namespaces in which the PhpTags extension is allowed to use. Boolean true allows usage in all namespaces true
$wgPhpTagsBytecodeExptime Storage time of the compiled bytecode in cache (30 days) 2592000 (30 días)