/**
  * @dataProvider getGetPluralLicenseInfo
  */
 public function testGetPluralLicenseInfo($isDisabledValue, $license, $expectedResult)
 {
     $msgObj = $this->getMockBuilder('Message')->disableOriginalConstructor()->getMock();
     $msgObj->expects($this->any())->method('isDisabled')->will($this->returnValue($isDisabledValue));
     $msgObj->expects($this->any())->method('text')->will($this->returnValue('and '));
     $this->assertEquals($expectedResult, MobileFrontendSkinHooks::getPluralLicenseInfo($license, $msgObj));
 }
 /**
  * ResourceLoaderGetConfigVars hook handler
  * This should be used for variables which vary with the html
  * and for variables this should work cross skin including anonymous users
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
  *
  * @param array $vars
  * @return boolean
  */
 public static function onResourceLoaderGetConfigVars(&$vars)
 {
     $context = MobileContext::singleton();
     $config = $context->getMFConfig();
     $pageProps = $config->get('MFQueryPropModules');
     $searchParams = $config->get('MFSearchAPIParams');
     // Avoid API warnings and allow integration with optional extensions.
     if (defined('PAGE_IMAGES_INSTALLED')) {
         $pageProps[] = 'pageimages';
         $searchParams = array_merge_recursive($searchParams, array('piprop' => 'thumbnail', 'pithumbsize' => MobilePage::SMALL_IMAGE_WIDTH, 'pilimit' => 50));
     }
     // We need to check that first descriptions are enabled (the server admin has installed
     // Wikidata) and then secondly that it is okay to display them prominently in the UI
     // For instance a server admin may want to make them available in the page via JS for gadgets
     // but not build them into their experience.
     $displayDescriptions = $config->get('MFDisplayWikibaseDescription');
     $useDescriptions = $config->get('MFUseWikibaseDescription');
     if ($context->isBetaGroupMember()) {
         $displayDescriptions = true;
     }
     // When set turn on Wikidata descriptions
     // https://phabricator.wikimedia.org/T101719
     if ($useDescriptions && $displayDescriptions) {
         if (!in_array('pageterms', $pageProps)) {
             $pageProps[] = 'pageterms';
         }
         $searchParams = array_merge_recursive($searchParams, array('wbptterms' => 'description'));
     }
     // Get the licensing agreement that is displayed in the uploading interface.
     $wgMFUploadLicense = MobileFrontendSkinHooks::getLicense('upload');
     $vars += array('wgMFSearchAPIParams' => $searchParams, 'wgMFQueryPropModules' => $pageProps, 'wgMFSearchGenerator' => $config->get('MFSearchGenerator'), 'wgMFNearbyEndpoint' => $config->get('MFNearbyEndpoint'), 'wgMFThumbnailSizes' => array('tiny' => MobilePage::TINY_IMAGE_WIDTH, 'small' => MobilePage::SMALL_IMAGE_WIDTH), 'wgMFContentNamespace' => $config->get('MFContentNamespace'), 'wgMFEditorOptions' => $config->get('MFEditorOptions'), 'wgMFLicense' => MobileFrontendSkinHooks::getLicense('editor'), 'wgMFUploadLicenseLink' => $wgMFUploadLicense['link']);
     if ($context->shouldDisplayMobileView()) {
         $vars['wgImagesDisabled'] = $context->imagesDisabled();
     }
     // add CodeMirror specific things, if it is installed (for CodeMirror editor)
     if (class_exists('CodeMirrorHooks')) {
         $vars += CodeMirrorHooks::getGlobalVariables(MobileContext::singleton());
         $vars['wgMFCodeMirror'] = true;
     }
     return true;
 }
 /**
  * Prepares the footer for the skins serving the desktop and mobile sites.
  * @param Skin $skin
  * @param QuickTemplate $tpl
  */
 public static function prepareFooter($skin, $tpl)
 {
     $title = $skin->getTitle();
     $req = $skin->getRequest();
     $ctx = MobileContext::singleton();
     // Certain pages might be blacklisted and not have a mobile equivalent.
     if (!$ctx->isBlacklistedPage()) {
         if ($ctx->shouldDisplayMobileView()) {
             MobileFrontendSkinHooks::mobileFooter($skin, $tpl, $ctx, $title, $req);
         } else {
             MobileFrontendSkinHooks::desktopFooter($skin, $tpl, $ctx, $title, $req);
         }
     }
 }