扩展:Php标签

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

Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎català • ‎dansk • ‎español • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎sicilianu • ‎suomi • ‎русский • ‎العربية • ‎中文 • ‎日本語
MediaWiki扩展手册
OOjs UI icon advanced.svg
PhpTags
发布状态: 测试
实现 Tag, Parser function, Hook
描述 允许用户使用带PHP语法的魔术表达式
作者 Pavel Astakhov (pastakhovtalk)
最新版本 5.5.0 (2015-11-20)
MediaWiki 1.25+
PHP 5.3+
数据更新
许可协议 GNU General Public License 2.0 or later
下载
例子 test.foxway.org
参数
  • $wgPhpTagsMaxLoops
  • $wgPhpTagsNamespaces
  • $wgPhpTagsBytecodeExptime
标签
phptag
使用的钩子
ParserFirstCallInit
UnitTestsList
ParserLimitReport
PhpTagsRuntimeFirstInit
ParserAfterTidy
ArticleDeleteComplete
PageContentSaveComplete
CodeMirrorGetExtensionMode
翻译PhpTags扩展如果在translatewiki.net可用
检查使用和版本矩阵。
问题 开放的工作 · 报告错误

PhpTags扩展允许用户使用带PHP语法魔术表达式,它允许您创建和使用兼容但不独立的MediaWiki扩展,设计适用于扩展设计时的初步性能测试。更多……

描述

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.

用法

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>

它将显示:

Hello world!!! 

预览

功能ucfirst执行于扩展:PhpTags_Functions。 更多详细信息可见此处

安装

  • 如果使用Vagrant ,请通过vagrant roles enable phptags --provision安装
手动安装
  • 下载文件,并将其放置在您extensions/文件夹中的PhpTags目录内。
  • 将下列代码放置在您的LocalSettings.php的底部:
    require_once "$IP/extensions/PhpTags/PhpTags.php";
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

可选安装

附加安装

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.

主要的扩展有:

Others are Extension:PhpTags SMW and Extension:PhpTags Storage.

配置变量

名称 描述 默认
$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天)