当前位置: 首页>>代码示例>>PHP>>正文


PHP OutputPage::transformCssMedia方法代码示例

本文整理汇总了PHP中OutputPage::transformCssMedia方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::transformCssMedia方法的具体用法?PHP OutputPage::transformCssMedia怎么用?PHP OutputPage::transformCssMedia使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputPage的用法示例。


在下文中一共展示了OutputPage::transformCssMedia方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertTransformCssMediaCase

 /**
  * Tests a particular case of transformCssMedia, using the given input, globals,
  * expected return, and message
  *
  * Asserts that $expectedReturn is returned.
  *
  * options['printableQuery'] - value of query string for printable, or omitted for none
  * options['handheldQuery'] - value of query string for handheld, or omitted for none
  * options['handheldForIPhone'] - value of the $wgHandheldForIPhone global
  * options['media'] - passed into the method under the same name
  * options['expectedReturn'] - expected return value
  * options['message'] - PHPUnit message for assertion
  *
  * @param array $args key-value array of arguments as shown above
  */
 protected function assertTransformCssMediaCase($args)
 {
     $queryData = array();
     if (isset($args['printableQuery'])) {
         $queryData['printable'] = $args['printableQuery'];
     }
     if (isset($args['handheldQuery'])) {
         $queryData['handheld'] = $args['handheldQuery'];
     }
     $fauxRequest = new FauxRequest($queryData, false);
     $this->setMWGlobals(array('wgRequest' => $fauxRequest, 'wgHandheldForIPhone' => $args['handheldForIPhone']));
     $actualReturn = OutputPage::transformCssMedia($args['media']);
     $this->assertSame($args['expectedReturn'], $actualReturn, $args['message']);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:29,代码来源:OutputPageTest.php

示例2: makeCombinedStyles

 /**
  * Combines an associative array mapping media type to CSS into a
  * single stylesheet with "@media" blocks.
  *
  * @param array $stylePairs Array keyed by media type containing (arrays of) CSS strings
  * @return array
  */
 public static function makeCombinedStyles(array $stylePairs)
 {
     $out = array();
     foreach ($stylePairs as $media => $styles) {
         // ResourceLoaderFileModule::getStyle can return the styles
         // as a string or an array of strings. This is to allow separation in
         // the front-end.
         $styles = (array) $styles;
         foreach ($styles as $style) {
             $style = trim($style);
             // Don't output an empty "@media print { }" block (bug 40498)
             if ($style !== '') {
                 // Transform the media type based on request params and config
                 // The way that this relies on $wgRequest to propagate request params is slightly evil
                 $media = OutputPage::transformCssMedia($media);
                 if ($media === '' || $media == 'all') {
                     $out[] = $style;
                 } elseif (is_string($media)) {
                     $out[] = "@media {$media} {\n" . str_replace("\n", "\n\t", "\t" . $style) . "}";
                 }
                 // else: skip
             }
         }
     }
     return $out;
 }
开发者ID:ErdemA,项目名称:mediawiki,代码行数:33,代码来源:ResourceLoader.php

示例3: makeCombinedStyles

 /**
  * Combines an associative array mapping media type to CSS into a
  * single stylesheet with @media blocks.
  *
  * @param $styles Array: List of CSS strings keyed by media type
  *
  * @return string
  */
 public static function makeCombinedStyles(array $styles)
 {
     $out = '';
     foreach ($styles as $media => $style) {
         // Transform the media type based on request params and config
         // The way that this relies on $wgRequest to propagate request params is slightly evil
         $media = OutputPage::transformCssMedia($media);
         if ($media === null) {
             // Skip
         } elseif ($media === '' || $media == 'all') {
             // Don't output invalid or frivolous @media statements
             $out .= "{$style}\n";
         } else {
             $out .= "@media {$media} {\n" . str_replace("\n", "\n\t", "\t" . $style) . "\n}\n";
         }
     }
     return $out;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:ResourceLoader.php


注:本文中的OutputPage::transformCssMedia方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。