Dr0ptp4kt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78265
Change subject: META Wikipedia Zero automation probe banner outcomes.
......................................................................
META Wikipedia Zero automation probe banner outcomes.
* This is in the ideation phase.
* We may go with <iframe>, CORS, or something like that.
* We may also do both <iframe>/CORS and use the latest polled banners.
* Need to think through whether to copy polled banners https:// scheme.
Change-Id: Ifbc9ee0a8d06b0cab382bbb22adf906270b838a2
---
M includes/ZeroConfigContent.php
1 file changed, 30 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroRatedMobileAccess
refs/changes/65/78265/1
diff --git a/includes/ZeroConfigContent.php b/includes/ZeroConfigContent.php
index c87684b..2d15a12 100644
--- a/includes/ZeroConfigContent.php
+++ b/includes/ZeroConfigContent.php
@@ -161,6 +161,7 @@
private function renderBanners( $conf ) {
global $wgConf;
+ global $wgOut;
wfProfileIn( __METHOD__ );
$wgConf->loadFullData();
@@ -171,6 +172,23 @@
array_flip( $conf['whitelistedLangs'] ),
array_flip( $conf['showLangs'] ) );
+ $configXcs = $wgOut->getTitle()->getRootText();
+ $auxLangs = array( 'en', 'pl' );
+ $sampledBannerLangs = count( $conf['whitelistedLangs'] ) !== 0 ?
+ array_unique( array_merge( $conf['whitelistedLangs'],
$auxLangs ) ) :
+ array_unique( array_merge( $conf['showLangs'],
$auxLangs ) );
+
+ if ( count( $conf['whitelistedLangs'] ) !== 0 ) {
+ $noShow = Xml::tags( 'td', null, 'Language not in
whitelistedLangs.' );
+ } else {
+ $langsSampled = 'All langs supported. Showing only ';
+ $langsSampled .= join( ', ', $sampledBannerLangs );
+ $langsSampled .= ' (if defined as wiki languages).';
+ $noShow = Xml::tags( 'td', null, $langsSampled );
+ }
+
+ $bannerSubdomain = !$conf['sites'] || in_array( 'm.wikipedia',
$conf['sites'] ) ? 'm' : 'zero';
+
$rows = array();
foreach ( $langs as $langCode => $_ ) {
$th = Xml::elementClean( 'th', null, $langCode );
@@ -178,9 +196,19 @@
$lang = Language::factory( $langCode );
// Get localized "wikipedia" sitename. If null, will
use default {{SITENAME}}
$sitename = $wgConf->get( 'wgSitename', str_replace(
'-', '_', $langCode ) . 'wiki' );
- $td = $td = Xml::tags( 'td', null,
+ $bannerInTheory = Xml::tags( 'td', null,
PageRenderingHooks::renderBanner( $conf, $lang,
$sitename ) );
- $rows[] = Xml::tags( 'tr', null, $th . $td );
+ if ( in_array( $langCode, $sampledBannerLangs ) ) {
+ $img = Xml::element( 'img', array(
+ 'src' =>
'http://zero-bdd.wmflabs.org/banners/' .
+ $configXcs . '-' .
$bannerSubdomain . '-' . $langCode . '-Main_Page-Nobust-topclip.png'
+ )
+ );
+ $bannerInPractice = Xml::tags( 'td', null, $img
);
+ } else {
+ $bannerInPractice = $noShow;
+ }
+ $rows[] = Xml::tags( 'tr', null, $th . $bannerInTheory
. $bannerInPractice );
}
$res = Xml::tags( 'table', array( 'class' =>
'mw-zero-config-banners' ),
Xml::tags( 'tbody', array(), join( "\n", $rows ) )
--
To view, visit https://gerrit.wikimedia.org/r/78265
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbc9ee0a8d06b0cab382bbb22adf906270b838a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ZeroRatedMobileAccess
Gerrit-Branch: master
Gerrit-Owner: Dr0ptp4kt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits