MediaWiki中添加CKEditor的過程

如今FCKEditor變成CKEditor了,不能用原來的Extension了。可是也有了個新的Extension,叫WYSIWYG(WhatYouSeeIsWhatYouGet,所見即所得)。連接是這裏:Extension:WYSIWYGphp

你們根據本身的Wiki版本選擇對應的就行了。下面說下我安裝過程當中遇到的一些問題。數據庫

根聽說明文檔,我把全部的文件都複製到了extensions目錄下。而且根據README.md文件中說明的,在LocalSittings.php中插入了加載代碼ide

 #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<-

 

本覺得萬事大吉,能夠正常使用了,然並卵。ui

出現錯誤:Fatal error: Call to undefined function enableSemantics() in D:\xampp\htdocs\LocalSettings.phpspa

查了很多資料,才知道由於CKEditor引用了SemanticForms,須要SemanticMediaWiki擴展支持才能正常使用。而這個是要獨立安裝的。.net

安裝SemanticMediaWiki的步驟:code

Step1orm

下載SMWblog

Step2ci

在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了。

相關文章
相關標籤/搜索