扩展:Php标签
![]() 發佈狀態: 测试版 |
|
---|---|
实现 | 标签 , 解析器函数 , 钩子 |
描述 | 允许用户使用带PHP语法的魔术表达式 |
作者 | Pavel Astakhov (pastakhov讨论) |
最新版本 | 5.5.0 (2015-11-20) |
MediaWiki | 1.25+ |
PHP | 5.3+ |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
|
|
phptag |
|
季度下載量 | 14 (Ranked 162nd) |
翻譯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!!!
安裝
- 下载文件,并将其放置在您
extensions/
文件夹中的PhpTags
目录内。 - 将下列代码放置在您的
LocalSettings.php
的底部:require_once "$IP/extensions/PhpTags/PhpTags.php";
完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
Vagrant安装:
- 如果使用Vagrant ,请通过
vagrant roles enable phptags --provision
安装
可选安装
- CodeMirror extension provides code highlighting in article editor
附加安装
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.
主要的扩展有:
- 扩展:PhpTags Wiki - lets you query various data from MediaWiki core
- Extension:PhpTags Functions - contains many functions for data processing
- Extension:PhpTags Widgets - displays the data in different ways
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天) |
- Beta status extensions/zh
- Tag extensions/zh
- Parser function extensions/zh
- Hook extensions/zh
- GPL licensed extensions/zh
- Extensions in Wikimedia version control/zh
- ExtensionTypes extensions/zh
- ParserAfterTidy extensions/zh
- ParserFirstCallInit extensions/zh
- ParserLimitReport extensions/zh
- PhpTagsRuntimeFirstInit extensions/zh
- All extensions/zh
- Modifiable variables extensions/zh