allwiki首页  
天下维客 你可以修改的网络知识库
首页最近更改优秀条目专题展示电脑科技词典软件学习网络知识电脑安全明星时尚天下百科
 

MediaWiki修改:预置初始编辑文本

天下维客,你可以修改的网络知识库

Jump to: navigation, search

目录

安装破解

本破解易于安装.

第一步: 创建 MediaWiki:New

首先,在您的wiki中创建一个“MediaWiki:New”。您必须以管理员身份登录系统才能创建该页面。当前页当中的任何文本和格式将作为默认内容出现在每篇文章当中。 First, create MediaWiki:New in your wiki. You will have to login as an administrator to create this page. The page should include whatever text and formatting should appear by default in each article.

第二步: 编辑“EditPage.php”页面

编辑

includes/EditPage.php
。注意:编辑此文件可能会导致您的wiki出现问题,所以需要格外小心。 找到
function editForm
。在函数顶部得变量中,添加以下内容:
$startText = '';

找到类似下面代码的语句:

if(!$this->mTitle->getArticleID()) { # new article
 $wgOut->addWikiText(wfmsg('newarticletext'));
}

在上述代码的if条件语句中,添加如下内容:

if(!$this->preview) {
 $startText = htmlspecialchars(wfMsgForContent("new"));
}

添加完成后的内容如下所示:

if(!$this->mTitle->getArticleID()) { # new article
 $wgOut->addWikiText(wfmsg('newarticletext'));
 if(!$this->preview) {
  $startText = htmlspecialchars(wfMsgForContent("new"));
 }
}
最后,找到第一个代码块
textarea
<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='{$rows}'
 cols='{$cols}'{$ew}>" .
 htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) . 
 "
</textarea>
Edit
includes/EditPage.php
. Warning: editing this file could lead to problems throughout your wiki, so be very careful. Find
function editForm
. In the list of variables at the top of this function, add this:
$startText = '';

Find an if statement that looks like this:

if(!$this->mTitle->getArticleID()) { # new article
 $wgOut->addWikiText(wfmsg('newarticletext'));
}

Within that statement, nest this if statement:

if(!$this->preview) {
 $startText = htmlspecialchars(wfMsgForContent("new"));
}

So the overall statement now looks like this:

if(!$this->mTitle->getArticleID()) { # new article
 $wgOut->addWikiText(wfmsg('newarticletext'));
 if(!$this->preview) {
  $startText = htmlspecialchars(wfMsgForContent("new"));
 }
}
Finally, find the first
textarea
block of code:
<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='{$rows}'
 cols='{$cols}'{$ew}>" .
 htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) . 
 "
</textarea>
Between the . and ", add
$startText .
, so now you have this:
<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='{$rows}'
 cols='{$cols}'{$ew}>" .
 htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) . $startText .
 "
</textarea>

If the article is new and not being previewed, the contents of MediaWiki:New will be added to the editing textbox. Otherwise, nothing is added.

Step 3: Upload and Test

If you worked on a local copy of
EditPage.php
, upload this file to your live
includes
directory. Try editing a new article and an old article, and confirm that the hack works as intended.


原文参见: Starting text hack

MediaWiki扩展简明教程 Inputbox帮助文档 使用Spam黑名单 内容折叠隐藏 动态文章列表 指定图片链接
代码高亮处理 预置初始编辑文本 页面访问限制 所见即所得编辑器 QQ在线信息
交流:扩展使用 投票与评分 内容随机展示 wikitex 改进设想 ...更多
加入google地图和51地图标注功能 Ajax五颗星评分插件
mediawiki图标

MediaWiki是全球最著名和最流行的开源wiki程序,运行于PHP+MySQL环境。MediaWiki从2002年2月25日被维基百科全书选用,并有大量其他应用实例。

MediaWiki功能齐备,中文支持良好,且学习资源丰富,是建立wiki网站的首选后台程序。目前国内的天下维客等站点都采用这套系统。

MediaWiki的开发得到维基媒体基金会的支持,一直保值着持续更新。目前最新版本为1.12.x。

mediawiki知识


mediawiki建站

mediawiki资源

国外站需代理访问

→ 更多mediawiki资料  相关资源:wiki知识 wiki文摘  QQ群:22134343 / 3680101-wiki建站与应用 5903157-电脑使用

Personal tools
工具
金银币拍卖 金币拍卖预展  金银币网店 熊猫金银币 生肖金银币