Jump to content

扩展:Php标签

From mediawiki.org
This page is a translated version of the page Extension:PhpTags and the translation is 48% complete.
MediaWiki扩展手册
PhpTags
发行状态: 不再維護
实现 标签 , 解析器函数 , 函数钩
描述 允许用户使用带PHP语法的魔术表达式
作者 Pavel Astakhov (pastakhov留言)
最新版本 5.5.0 (2015-11-20)
MediaWiki 1.25+
PHP 5.3+
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
  • $wgPhpTagsMaxLoops
  • $wgPhpTagsNamespaces
  • $wgPhpTagsBytecodeExptime
phptag
季度下載量 2 (Ranked 138th)
前往translatewiki.net翻譯PhpTags扩展
問題 开启的任务 · 报告错误

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执行于Extension:PhpTags_Functions More details can be found in the quick start guide.

安裝

  • 下载文件,并将解压后的PhpTags文件夹移动到extensions/目录中。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PhpTags
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'PhpTags' );
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。


使用Vagrant安装:

  • 如果使用Vagrant ,请通过vagrant roles enable phptags --provision安装


可选安装

附加安装

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.

主要的扩展有:

配置参数

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