MediaWiki中添加CKEditor的过程

现在FCKEditor变成CKEditor了,不能用原来的Extension了。但是也有了个新的Extension,叫WYSIWYG(WhatYouSeeIsWhatYouGet,所见即所得)。链接是这里:Extension:WYSIWYG

大家根据自己的Wiki版本选择对应的就好了。下面说下我安装过程中遇到的一些问题。

根据说明文档,我把所有的文件都复制到了extensions目录下。并且根据README.md文件中说明的,在LocalSittings.php中插入了加载代码

 #13.11.13->
    require_once( "$IP/extensions/WYSIWYG/WYSIWYG.php" );

    # Examples of setting permissions using $wgGroupPermissions, for more detailed explanation see:
    #   https://www.mediawiki.org/wiki/Manual:$wgGroupPermissions#Example
    # $wgGroupPermissions['user']['wysiwyg'] = true; //Only registered users are allowed to use wysiwyg
    # $wgGroupPermissions['*']['wysiwyg'] = true;    //Everyone is allowed to use wysiwyg
    $wgGroupPermissions['*']['wysiwyg'] = true;

    $wgDefaultUserOptions['cke_show'] = 'richeditor';    //Enable CKEditor
    $wgDefaultUserOptions['riched_use_toggle'] = false;  //Editor can toggle CKEditor/WikiText
    $wgDefaultUserOptions['riched_start_disabled'] = false; //Important!!! else bug...
    $wgDefaultUserOptions['riched_toggle_remember_state'] = true; //working/bug?
    $wgDefaultUserOptions['riched_use_popup'] = false;   //Deprecated

    ##These are not compatible with WYSIWYG
    $wgFCKEditorExcludedNamespaces[] = NS_MEDIAWIKI;
    $wgFCKEditorExcludedNamespaces[] = NS_TEMPLATE;
    #13.11.13<-

    #17.01.14->
    #WikiEditor may not be compatible with WYSIWYG editor, use it with caution.
    require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );

    # Enables/disables use of WikiEditor by default but still allow users to disable it in preferences
    $wgDefaultUserOptions['usebetatoolbar'] = 1;
    $wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;

    # Displays the Preview and Changes tabs
    $wgDefaultUserOptions['wikieditor-preview'] = 0;

    # Displays the Publish and Cancel buttons on the top right side
    $wgDefaultUserOptions['wikieditor-publish'] = 0;
    #17.01.14<-

    #27.03.14->
    #This was required by SemanticMediaWiki extension in MW 1.22.4 to prevent startup error:
    $wgLocalisationUpdateDirectory = "$IP/cache";

    #These are for SemanticForms:
    enableSemantics( );
    include_once( "$IP/extensions/SemanticForms/SemanticForms.php" );

    #Optional excludes of wysiwyg in case SemanticForms and SemanticMediawiki are installed:
    $wgFCKEditorExcludedNamespaces[] = SF_NS_FORM;
    $wgFCKEditorExcludedNamespaces[] = SMW_NS_PROPERTY;
    #27.03.14<-

    #06.02.15->
    #Setting value of following variables eq. to 1 will cause wikitext text blocks
    #within specified tags to be displayed as image- element in wysiwyg mode.
    #Value eq. to 0 makes texts inside these tags editable directly as text in wysiwyg mode
    #using pre- parent tag + child tag.
    $wgFCKEditorSpecialElementWithPreTag   = 0; // 1= <pre> tags with attributes only => img- element
    #06.02.15<-

    #26.02.15->
    $wgFCKEditorSpecialElementWithTextTags = 0; // 1= <nowiki>, <source> and <syntaxhighlight> tags => img- element
    #26.02.15<-

 

本以为万事大吉,可以正常使用了,然并卵。

出现错误:Fatal error: Call to undefined function enableSemantics() in D:\xampp\htdocs\LocalSettings.php

查了不少资料,才知道因为CKEditor引用了SemanticForms,需要SemanticMediaWiki扩展支持才能正常使用。而这个是要独立安装的。

安装SemanticMediaWiki的步骤:

Step1

下载SMW

Step2

在LocalSettings.php中加入代码:

require_once "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php";
enableSemantics( 'example.org' );

step3

在MediaWiki的页面: "Special:SMWAdmin"进行如下操作

点击: "Initialise or upgrade tables" 按钮来安装数据库

点击: "Start updating data"按钮

ok,SemanticMediaWiki安装成功了。

解决了undefined function的问题。

 

但是又遇到了一个提示信息:

Warning:call_user_func() expects parameter 1 to be a valid callback ,class 'WikiEditorHooks' does not have a method 'onRegistration' in ExtensionRegistry.php on line 269

 

又查了一下原因,是因为之前开通了MediaWiki自带的WikiEditor而引起的冲突错误。

注释掉了加载代码 wfLoadExtension( 'WikiEditor' ); 后终于一切正常了。

可以在MediaWiki中使用CKEditor了。

 

posted @ 2016-03-23 13:21  努力CODE  阅读(3063)  评论(3编辑  收藏  举报