MobileFrontend设置Mediawiki移动手机版本插件 - 插件脚本 - 问说网


问说网 · 发布于 2014-10-12 · 字数14585 · 浏览 4116 · 评论 0





如果你使用Vagrant,可以通过vagrant enable-role mobilefrontend && vagrant provision安装。


下载MobileFrontend插件,解压MobileFrontend文件到extensions/目录,如果你是一个开发者,并且使用 Git ,可以使用下面的指令安装MobileFrontend

git clone


然后修改 LocalSettings.php 文件,在文档的末尾加入如下代码:

require_once "$IP/extensions/MobileFrontend/MobileFrontend.php";
$wgMFAutodetectMobileView = true;



$wgMFAutodetectMobileView = true; 可以让插件自动转换为手机版本的网页,更多的参数配置请看下表:

Setting name Default value Description
$wgMFDefaultSkinClass 'SkinMinerva' The default skin for MobileFrontend; defaults to SkinMinerva
$wgMFUseCentralAuthToken false Allow editing (uploading) to external CentralAuth-enabled wikis where the user might not be logged in.
$wgMFPhotoUploadEndpoint URL of MediaWiki API entry point to which upload images. If it’s an empty string, upload locally.
$wgMFUploadMinEdits 0 Specify how many edits a user need to use mobile upload.
$wgMFNearbyEndpoint An optional alternative API to query for nearby pages, e.g. If set forces nearby to operate in JSONP mode.
$wgMFContentNamespace NS_MAIN The content namespace(s) that Special:Nearby and Special:Random should use. Should be one or more of NS_* constants, pipe-separated.
$wgMFPhotoUploadWiki null ID/database name of the wiki with uploaded images. If null, use local database.
$wgMobileFrontendLogo false, default no logo URL to the logo used in the mobile view. Should be 35 × 22 px.
Example: “{$wgScriptPath}/mf-logo.png” for the file mf-logo.png in your wiki’s root folder.
$wgMobileUrlTemplate Template used to transcode regular URLs into mobile URLs (optional, and probably an overkill for low-traffic sites). Can either be set as a static domain (eg ‘’), or can use a template based off the host portion of your desktop domain. The token ‘%h0’ represents the first portion of the hostname, ‘%h1’ the second, and so on. For example, to achieve from, you would use: %h0.m.%h1.%h2
$wgMobileFrontendFormatCookieExpiry null The number of seconds the ‘useformat’ cookie should be valid (used to keep you on mobile or desktop view of site when manually toggling between the two). If unset, defaults to $wgCookieExpiration.
$wgMFRemovableClasses array(// These rules will be used for all transformations
'base' => array(),
// HTML view
'HTML' => array(),
Make the classes, tags and IDs stripped from page content configurable. Each item will be stripped from the page. The extension adds some classes by default.
$wgMFCustomLogos array( array() ) Makes the logos configurable. Example: array( 'site' => 'mysite', 'copyright' => 'img.jpg' ) Note that ‘copyright’ controls the image shown in the footer of the mobile page.
$wgMFNoindexPages true Set to false to allow search engines to index your mobile pages. So far, Google seems to mix mobile and non-mobile pages in its search results, creating confusion.
$wgMFStopRedirectCookieHost null Set the domain of the stopMobileRedirect cookie.
If this value is not set, it will default to the top domain of the host name (eg = If you want to set this to a top domain (to cover all subdomains), be sure to include the preceding ‘.’ (eg NOT
$wgMFEnableDesktopResources Whether or not to load desktop-specific ResourceLoader resources. Current usecase is for deciding whether or not to load JS for unsetting the stopMobileRedirect cookie.
$wgMFTrademarkSitename false Whether to append ™ to the sitename in page footer, or ® to the sitename for alt text in footer if using a custom copyright logo. Defaults off to avoid being confusing. You can also edit the MediaWiki:Mobile-frontend-footer-sitename interface message directly.
$wgDeviceDetectionClass 'DeviceDetection' Name of the class used for mobile device detection, must be inherited from IDeviceDetector
$wgMFNearby false Whether geodata related functionality should be enabled, such as Special:Nearby. Requires GeoData extension.
$wgMFNearbyRange 10000 The range in meters that should be searched to find nearby pages on Special:Nearby (defaults to 10km).
$wgMFMinCachedPageSize 64 * 1024 Pages with smaller parsed HTML size are not cached. Set to 0 to cache everything or to some large value to disable caching completely.
$wgMFAutodetectMobileView false Whether or not the MobileFrontend extension autodetects devices for mobile view on its own, rather than using detection at the proxy/webserver layer, or using third party tools like Apache AMF. Depending on your setup, this is probably the easiest method of device detection, though least performant.If this option is set to true file cache must be disabled by setting $wgUseFileCache to false (otherwise autodetection won’t be reliable due to cached copies being shown).
$wgMFEnableSiteNotice false Controls whether site notices should be shown.
$wgMFShowMobileViewToTablets false Controls whether tablets should be shown the mobile site. Works only if $wgMFAutodetectMobileView is true.
$wgMFPhotoUploadAppendToDesc (wiki)text to append to photo description during photo upload.
$wgMFEnableXAnalyticsLogging false Whether or not to enable the use of the X-Analytics HTTP response header. This header is used for analytics purposes; see Analytics/Kraken/Data Formats/X-Analytics.
$wgMFAnonymousEditing false Whether to respect $wgGroupPermissions or not: if set to false, disables editing for unregistered users. No major bugs with anonymous editing are currently known: you are encouraged to set the setting to true and report problems.
$wgMFLeadPhotoUploadCssSelector 'img, .navbox' A CSS selector which is used by mf-photo.js to test whether to prompt the user photo uploads on the current page. When the selector matches no elements the photo uploader will show.

Warning Warning: This is an advanced config variable so use caution in editing.
$wgMFEnableCssAnimations true Enable CSS animations in all browsers that support them
$wgMFNoMobileCategory false Database key (=page title with underscores instead of spaces etc.) of the category which members will never display mobile view
$wgMFNoMobilePages array() Prefixed names of pages that will never display mobile view
$wgMFAjaxUploadProgressSupport true Temporary boolean variable to enable/disable progress bars in the photo uploader
$wgMFDeviceWidthTablet 768 Minimum available screen width (in pixels) at which a device can be considered a tablet/desktop
$wgMFDeviceWidthMobileSmall 280 Devices with available screen of this value and less will have some styles adapted for improved reading on small screens.
$wgMFKeepGoing false Whether or not to use the KeepGoing feature.
$wgMFTidyMobileViewSections true Controls whether API action=mobileview should have every HTML section tidied for invalid markup
$wgMFMobileHeader 'X-WAP' Requests containing header with this name will be considered as coming from mobile devices. The default value is for backwards compatibility. Set to false to explicitly disable this way of detection.
$wgMFEnableMinervaBetaFeature false Controls whether the “Minerva as a desktop skin” beta feature is enabled
$wgMFEnableNearbyPagesBetaFeature false Controls whether the “Nearby pages” beta feature is enabled
$wgMFCollapseSectionsByDefault true Controls whether to collapse sections by default.
Leave at default true for “encyclopedia style”, where the section 0 lead text will always be visible and subsequent sections may be collapsed by default.
Set to false for “dictionary style”, sections are not collapsed.
$wgMFAppPackageId false ID of the App to deep link to replacing the browser. Set false to have no such link. See
$wgMFAppScheme 'http' Scheme to use for the deep link. Per default, ‘http’ is used.
$wgMFPageActions array( 'edit', 'talk', 'upload', 'watch' ) Controls, which page action show and which not. Allowed: edit, talk, upload, watch
$wgMFEnableBeta false Whether beta and alpha modes are enabled.
$wgMFNamespacesWithoutCollapsibleSections array(
// Authorship and licensing information should be visible initially
// Otherwise category contents will be hidden
// Don't collapse various forms
// Just don't
In which namespaces sections shoudn’t be collapsed.




本文系作者 问说网 授权问说网发表,并经问说网编辑,转载请注明出处和 本文链接


  • 2016-09-24紫色背景扁平化iPhone5手机样机素材
  • 2016-10-21多彩好看的淘宝销售标签箭头EPS素材
  • 2017-02-17问说网站长分享提升WordPress访问速度优化
  • 2017-04-01Wordpress固定链接伪静态的设置方法
  • 2017-04-04java中的Runable和Thread
  • 2017-04-05解决mysql无法远程访问的问题
  • 2017-04-19ASP.NET MVC 4 中的JSON数据交互的方法
  • 2018-04-19用易拉罐制作路由器Wi-Fi放大器有用吗?
  • 发布评论


    问说网 · 发布于 2016-09-24





    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    问说网 · 发布于 2016-10-03 · 浏览 1531 · 评论 0
    恒创主机2017跨年盛典 主机/云服务器/独立服务器买就送
    问说网 · 发布于 2016-12-26

    恒创主机2017跨年盛典 主机/云服务器/独立服务器买就送


    问说网 · 发布于 2017-02-17



    问说网 · 发布于 2017-04-01



    问说网 · 发布于 2017-04-04



    问说网 · 发布于 2017-04-05


    问题描述 2003 server 32bit+IIS+护卫神+安全狗+navicat 2.root@%已配置 3.干掉护卫神,安全狗,防火墙…

    问说网 · 发布于 2017-04-19

    ASP.NET MVC 4 中的JSON数据交互的方法

    前台Ajax请求很多时候需要从后台获取JSON格式数据,一般有以下方式: 拼接字符串 1 return Content("{\"id\":\"1\",\"nam…


    躺着 站着 跪着轻松访问

    更多详情 关于作者



    13169 文章
    497 评论
    2099 人气

    更多 热门话题


    关注 APP界面

    文章 41506 · 浏览 3314


    关注 APP欣赏

    文章 41427 · 浏览 3045


    关注 APP手机界面

    文章 41417 · 浏览 3184


    关注 图片素材

    文章 29463 · 浏览 2573


    关注 高清图片

    文章 26530 · 浏览 2797

    更多 推荐作者

    关注 秋天的孤寂

    文章 99 · 评论 0

    关注 惢碎葬爱

    文章 96 · 评论 0

    关注 怎麽继续

    文章 90 · 评论 2

    关注 倾听寂寞

    文章 83 · 评论 0

    关注 莪很迷茫

    文章 97 · 评论 0

    关注 流浪的脚步

    文章 86 · 评论 0

    顶部 反馈 评论 底部