MobileFrontend设置Mediawiki移动手机版本插件

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

MobileFrontend是mediawiki用来开启移动手机版本的插件,一直以来,移动对于维基百科来说都只是一个二等公民,不过从移动维基百科的未来发展方向来看,这或许会有所改变。

MobileFrontend介绍

这个被称为“MobileFrontend”的新的移动前端架构,将会取代灵活性较低的旧的移动页面,这都是为了可以支持大量的新的扩展。

MobileFrontend安装方法

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

下载插件

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

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MobileFrontend.git

修改配置文件

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

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

你可以查看Special:Version页面,检测MobileFrontend插件是否安装成功。

MobileFrontend配置

$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. https://en.wikipedia.org/w/api.php. 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 ‘mobile.mydomain.com’), 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 http://en.m.wikipedia.org from http://en.wikipedia.org, 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 en.wikipedia.org = .wikipedia.org). If you want to set this to a top domain (to cover all subdomains), be sure to include the preceding ‘.’ (eg .wikipedia.org NOT wikipedia.org).
$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 https://developers.google.com/app-indexing/webmasters/details
$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
NS_FILE,
// Otherwise category contents will be hidden
NS_CATEGORY,
// Don't collapse various forms
NS_SPECIAL,
// Just don't
NS_MEDIA,
)
In which namespaces sections shoudn’t be collapsed.

更多详细介绍,请访问以下地址:

官方网站:http://www.mediawiki.org/wiki/Extension:MobileFrontend

下载地址:https://git.wikimedia.org/zip/?r=mediawiki/extensions/MobileFrontend&h=refs/heads/master&format=gz

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

相关文章

  • 2015-05-01第七章 Form API
  • 2016-08-23恒创科技-葵兴机房上线 香港服务器终身半价 低至550元/月
  • 2016-09-24紫色背景扁平化iPhone5手机样机素材
  • 2016-10-03Blogify简约扁平化博客主题PSD模板
  • 2016-12-26恒创主机2017跨年盛典 主机/云服务器/独立服务器买就送
  • 2017-02-17问说网站长分享提升WordPress访问速度优化
  • 2017-04-01Wordpress固定链接伪静态的设置方法
  • 2017-04-04java中的Runable和Thread
  • 发布评论

    为您推荐

    恒创科技-葵兴机房上线 香港服务器终身半价 低至550元/月
    问说网 · 发布于 2016-08-23

    恒创科技-葵兴机房上线 香港服务器终身半价 低至550元/月

    最近恒创科技香港SonderCloud二期机房——葵兴机房正式投入运营,特地开展“香港服务器终身半价预订”活动。预订服务器,享受新购和续费终身半价的优惠,8G内…


    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_0_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-content/themes/mwst/loop.php on line 15

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1608

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: imagejpeg(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_0_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: imagejpeg(../uedsc/wp-content/uploads/post-thumbnail/293132_0_thumbnail.jpg): failed to open stream: Operation not permitted in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_1_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-content/themes/mwst/loop.php on line 15

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1608

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: imagejpeg(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_1_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: imagejpeg(../uedsc/wp-content/uploads/post-thumbnail/293132_1_thumbnail.jpg): failed to open stream: Operation not permitted in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_2_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-content/themes/mwst/loop.php on line 15

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1608

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: imagejpeg(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_2_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: imagejpeg(../uedsc/wp-content/uploads/post-thumbnail/293132_2_thumbnail.jpg): failed to open stream: Operation not permitted in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_3_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-content/themes/mwst/loop.php on line 15

    Warning: file_exists(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1608

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc/wp-content) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(../uedsc) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: is_dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/functions.php on line 1613

    Warning: imagejpeg(): open_basedir restriction in effect. File(../uedsc/wp-content/uploads/post-thumbnail/293132_3_thumbnail.jpg) is not within the allowed path(s): (/home/wwwroot/uedsc.com/:/tmp/:/proc/) in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Warning: imagejpeg(../uedsc/wp-content/uploads/post-thumbnail/293132_3_thumbnail.jpg): failed to open stream: Operation not permitted in /home/wwwroot/uedsc.com/wp-includes/class-wp-image-editor.php on line 420

    Blogify简约扁平化博客主题PSD模板

    Blogify简约扁平化博客主题PSD模板,Blogify是博客风格的完美小主题。利用Blogify是干净的,审美和简单的功能,确保你的博客有别于简约精致的休息…

    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    • Blogify简约扁平化博客主题PSD模板
    问说网 · 发布于 2016-10-03 · 浏览 1649 · 评论 0
    多彩好看的淘宝销售标签箭头EPS素材
    问说网 · 发布于 2016-10-21

    多彩好看的淘宝销售标签箭头EPS素材

    恒创主机2017跨年盛典 主机/云服务器/独立服务器买就送
    问说网 · 发布于 2016-12-26

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

    恒创这次跨年促销,活动力度大,活动产品多。国内/香港/韩国/美国所有节点,新购/续费多重福利,满390元送小米VR眼镜。还可以免费抽奖,蓝牙耳机,小米充电宝等。

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

    问说网站长分享提升WordPress访问速度优化

    问说网创建也有5年了,最开始并不是使用的WordPress,是使用国内的DedeCMS开源程序,中间被黑客入侵了就换成了WordPress一直用到现在,随着文章…

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

    WordPress固定链接伪静态的设置方法

    今天,想着在我机器上测试一下wordpress,虽然之前也有这个开源的程序,可是一直没有安装呢,再加上最近一直忙于其他的工作,也忽略了不少,突然想建立一个属于自…

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

    java中的Runable和Thread

    在java中可有两种方式实现多线程,一种是继承Thread类,一种是实现Runnable接口;Thread类是在java.lang包中定义的。一个类只要继承了T…

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

    解决mysql无法远程访问的问题

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

    问说网手机版

    躺着 站着 跪着轻松访问

    更多详情 关于作者

    问说网

    问说网分享与设计有关的文章素材界面和作品,提供设计教程、素材分享、界面欣赏、编程设计、设计书籍、设计师导航等内容,你可以在这里阅读、学习、分享、交流。

    13172 文章
    497 评论
    2107 人气

    更多 热门话题

    APP界面

    关注 APP界面

    文章 41506 · 浏览 3468

    APP欣赏

    关注 APP欣赏

    文章 41427 · 浏览 3195

    APP手机界面

    关注 APP手机界面

    文章 41417 · 浏览 3360

    图片素材

    关注 图片素材

    文章 29463 · 浏览 2720

    高清图片

    关注 高清图片

    文章 26530 · 浏览 2945

    更多 推荐作者

    关注 秋末残雪

    文章 106 · 评论 0

    关注 惢碎葬爱

    文章 96 · 评论 0

    关注 莪很迷茫

    文章 97 · 评论 0

    关注 流浪的脚步

    文章 86 · 评论 0

    关注 籹孒不认输

    文章 94 · 评论 0

    关注 凉城梦镜

    文章 79 · 评论 0

    
    顶部 反馈 评论 底部

    意见反馈

    感谢您对问说网的支持,提出您在使用过程中遇到的问题或宝贵建议,您的反馈对我们产品的完善有很大帮助。

    您的反馈我们已收到!

    感谢您提供的宝贵意见,我们会在1-2个工作日,通过您留下的联系方式将处理结果反馈给您!