• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSSJanus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getStyles

 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     global $wgAllowUserCssPrefs, $wgUser;
     if ($wgAllowUserCssPrefs) {
         $options = $wgUser->getOptions();
         // Build CSS rules
         $rules = array();
         // Underline: 2 = browser default, 1 = always, 0 = never
         if ($options['underline'] < 2) {
             $rules[] = "a { text-decoration: " . ($options['underline'] ? 'underline' : 'none') . "; }";
         } else {
             # The scripts of these languages are very hard to read with underlines
             $rules[] = 'a:lang(ar), a:lang(ckb), a:lang(fa),a:lang(kk-arab), ' . 'a:lang(mzn), a:lang(ps), a:lang(ur) { text-decoration: none; }';
         }
         if ($options['justify']) {
             $rules[] = "#article, #bodyContent, #mw_content { text-align: justify; }\n";
         }
         if (!$options['showtoc']) {
             $rules[] = "#toc { display: none; }\n";
         }
         if (!$options['editsection']) {
             $rules[] = ".editsection { display: none; }\n";
         }
         if ($options['editfont'] !== 'default') {
             $rules[] = "textarea { font-family: {$options['editfont']}; }\n";
         }
         $style = implode("\n", $rules);
         if ($this->getFlip($context)) {
             $style = CSSJanus::transform($style, true, false);
         }
         return array('all' => $style);
     }
     return array();
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:38,代码来源:ResourceLoaderUserCSSPrefsModule.php


示例2: getStyles

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     global $wgUser;
     if (!$this->getConfig()->get('AllowUserCssPrefs')) {
         return array();
     }
     $options = $wgUser->getOptions();
     // Build CSS rules
     $rules = array();
     // Underline: 2 = browser default, 1 = always, 0 = never
     if ($options['underline'] < 2) {
         $rules[] = "a { text-decoration: " . ($options['underline'] ? 'underline' : 'none') . "; }";
     } else {
         # The scripts of these languages are very hard to read with underlines
         $rules[] = 'a:lang(ar), a:lang(kk-arab), a:lang(mzn), ' . 'a:lang(ps), a:lang(ur) { text-decoration: none; }';
     }
     if ($options['editfont'] !== 'default') {
         // Double-check that $options['editfont'] consists of safe characters only
         if (preg_match('/^[a-zA-Z0-9_, -]+$/', $options['editfont'])) {
             $rules[] = "textarea { font-family: {$options['editfont']}; }\n";
         }
     }
     $style = implode("\n", $rules);
     if ($this->getFlip($context)) {
         $style = CSSJanus::transform($style, true, false);
     } else {
         $style = CSSJanus::nullTransform($style);
     }
     return array('all' => $style);
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:34,代码来源:ResourceLoaderUserCSSPrefsModule.php


示例3: setupSkinUserCss

 /**
  *
  */
 function setupSkinUserCss(OutputPage $out)
 {
     global $wgContLang;
     $qb = $this->qbSetting();
     $rules = array();
     if (2 == $qb) {
         # Right
         $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
         $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
     } elseif (1 == $qb || 3 == $qb) {
         $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
         $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
         if (3 == $qb) {
             $rules[] = "#quickbar { position: fixed; padding: 4px; }";
         }
     } elseif (4 == $qb) {
         $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
         $rules[] = "#quickbar { border-right: 1px solid gray; }";
         $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
     }
     $style = implode("\n", $rules);
     if ($wgContLang->getDir() === 'rtl') {
         $style = CSSJanus::transform($style, true, false);
     }
     $out->addInlineStyle($style);
     parent::setupSkinUserCss($out);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:30,代码来源:Standard.php


示例4: getStyles

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     if (!$this->getConfig()->get('AllowUserCssPrefs')) {
         return [];
     }
     $options = $context->getUserObj()->getOptions();
     // Build CSS rules
     $rules = [];
     // Underline: 2 = skin default, 1 = always, 0 = never
     if ($options['underline'] < 2) {
         $rules[] = "a { text-decoration: " . ($options['underline'] ? 'underline' : 'none') . "; }";
     }
     $style = implode("\n", $rules);
     if ($this->getFlip($context)) {
         $style = CSSJanus::transform($style, true, false);
     }
     return ['all' => $style];
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:22,代码来源:ResourceLoaderUserCSSPrefsModule.php


示例5: setupSkinUserCss

 function setupSkinUserCss(OutputPage $out)
 {
     parent::setupSkinUserCss($out);
     $out->addModuleStyles('skins.simple');
     /* Add some userprefs specific CSS styling */
     global $wgUser, $wgContLang;
     $rules = array();
     $underline = "";
     if ($wgUser->getOption('underline') < 2) {
         $underline = "text-decoration: " . $wgUser->getOption('underline') ? 'underline' : 'none' . ";";
     }
     /* Also inherits from resourceloader */
     if (!$wgUser->getOption('highlightbroken')) {
         $rules[] = "a.new, a.stub { color: inherit; text-decoration: inherit;}";
         $rules[] = "a.new:after { color: #CC2200; {$underline};}";
         $rules[] = "a.stub:after { {$underline}; }";
     }
     $style = implode("\n", $rules);
     if ($wgContLang->getDir() === 'rtl') {
         $style = CSSJanus::transform($style, true, false);
     }
     $out->addInlineStyle($style);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:23,代码来源:Simple.php


示例6: getStyles

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     if (!$this->getConfig()->get('AllowUserCssPrefs')) {
         return [];
     }
     $options = $context->getUserObj()->getOptions();
     // Build CSS rules
     $rules = [];
     // Underline: 2 = skin default, 1 = always, 0 = never
     if ($options['underline'] < 2) {
         $rules[] = "a { text-decoration: " . ($options['underline'] ? 'underline' : 'none') . "; }";
     }
     if ($options['editfont'] !== 'default') {
         // Double-check that $options['editfont'] consists of safe characters only
         if (preg_match('/^[a-zA-Z0-9_, -]+$/', $options['editfont'])) {
             $rules[] = "textarea { font-family: {$options['editfont']}; }\n";
         }
     }
     $style = implode("\n", $rules);
     if ($this->getFlip($context)) {
         $style = CSSJanus::transform($style, true, false);
     }
     return ['all' => $style];
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:28,代码来源:ResourceLoaderUserCSSPrefsModule.php


示例7: fn_merge_styles


//.........这里部分代码省略.........
            $m_prefix = '';
            $m_suffix = '';
            if (!empty($src['media'])) {
                $m_prefix = "\n@media " . $src['media'] . " {\n";
                $m_suffix = "\n}\n";
            }
            if (strpos($src['file'], '.css') !== false) {
                $output .= "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
            } elseif ($area != 'C' || empty($theme_manifest['converted_to_css'])) {
                $less_output_chunk = '';
                if (file_exists($src['file'])) {
                    if ($area == 'C' && (empty($theme_manifest['parent_theme']) || $theme_manifest['parent_theme'] == 'basic')) {
                        $less_output_chunk = "\n" . $m_prefix . fn_get_contents($src['file']) . $m_suffix;
                    } else {
                        $less_output_chunk = "\n" . $m_prefix . '@import "' . str_replace($relative_path . '/', '', $src['relative']) . '";' . $m_suffix;
                    }
                }
                if (!empty($params['reflect_less'])) {
                    if (preg_match('{/addons/([^/]+)/}is', $src['relative'], $m)) {
                        $less_reflection['output']['addons'][$m[1]] .= $less_output_chunk;
                    } else {
                        $less_reflection['output']['main'] .= $less_output_chunk;
                    }
                }
                $less_output .= $less_output_chunk;
            }
        }
        $header = str_replace('[files]', implode("\n", $names), Registry::get('config.js_css_cache_msg'));
        if (!empty($styles)) {
            $less_output .= $styles;
        }
        // Prepend all styles with prefix
        if (!empty($prepend_prefix)) {
            $less_output = $output . "\n" . $less_output;
            $output = '';
        }
        if (!empty($output)) {
            $compiled_css = Less::parseUrls($output, Storage::instance('assets')->getAbsolutePath($relative_path), fn_get_theme_path('[themes]/[theme]/media', $area));
        }
        if (!empty($theme_manifest['converted_to_css']) && $area == 'C') {
            $theme_css_path = fn_get_theme_path('[themes]/[theme]', $area) . '/css';
            $pcl_filepath = $theme_css_path . '/' . Themes::$compiled_less_filename;
            if (file_exists($pcl_filepath)) {
                $compiled_css .= fn_get_contents($pcl_filepath);
            }
            list($installed_addons) = fn_get_addons(array('type' => 'active'));
            foreach ($installed_addons as $addon) {
                $addon_pcl_filpath = $theme_css_path . "/addons/{$addon['addon']}/" . Themes::$compiled_less_filename;
                if (file_exists($pcl_filepath)) {
                    $compiled_css .= fn_get_contents($addon_pcl_filpath);
                }
            }
        }
        if (!empty($less_output)) {
            $less = new Less();
            if (!empty($params['compressed'])) {
                $less->setFormatter('compressed');
            }
            $less->setImportDir($relative_path);
            try {
                $compiled_less = $less->customCompile($less_output, Storage::instance('assets')->getAbsolutePath($relative_path), array(), $prepend_prefix, $area);
            } catch (Exception $e) {
                $skip_save = true;
                $shift = 4;
                $message = '<div style="border: 2px solid red; padding: 5px;">LESS ' . $e->getMessage();
                if (preg_match("/line: (\\d+)/", $message, $m)) {
                    $lo = explode("\n", $less_output);
                    $message .= '<br /><br /><pre>' . implode("\n", array_splice($lo, intval($m[1]) - $shift, $shift * 2)) . '</pre>';
                }
                $message .= '</div>';
                fn_set_notification('E', __('error'), $message);
            }
        }
        if (empty($skip_save)) {
            $compiled_content = $compiled_css . "\n" . $compiled_less;
            // Move all @import links to the Top of the file.
            if (preg_match_all('/@import url.*?;/', $compiled_content, $imports)) {
                $compiled_content = preg_replace('/@import url.*?;/', '', $compiled_content);
                foreach ($imports[0] as $import_link) {
                    $compiled_content = $import_link . "\n" . $compiled_content;
                }
            }
            if ($make_rtl) {
                $compiled_content = \CSSJanus::transform($compiled_content);
                $compiled_content = "body {\ndirection: rtl;\n}\n" . $compiled_content;
            }
            Storage::instance('assets')->put($relative_path . '/' . $filename, array('contents' => $header . $compiled_content, 'compress' => false, 'caching' => true));
            if (!empty($params['use_scheme'])) {
                fn_put_contents(fn_get_cache_path(false) . 'theme_editor/' . $filename, $output . '#LESS#' . $less_output);
            }
            if (!empty($params['reflect_less'])) {
                $less_reflection['import_dirs'] = array($relative_path);
                fn_put_contents(fn_get_cache_path(false) . 'less_reflection.json', json_encode($less_reflection));
            }
        }
        Debugger::checkpoint('After styles compilation');
    }
    $url = Storage::instance('assets')->getUrl($relative_path . '/' . $filename);
    return $url;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:101,代码来源:fn.common.php


示例8: getStyles

 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     global $wgScriptPath;
     $styles = array();
     foreach ($this->getPages($context) as $titleText => $options) {
         if ($options['type'] !== 'style') {
             continue;
         }
         $title = Title::newFromText($titleText);
         if (!$title || $title->isRedirect()) {
             continue;
         }
         $media = isset($options['media']) ? $options['media'] : 'all';
         $style = $this->getContent($title);
         if (strval($style) === '') {
             continue;
         }
         if ($this->getFlip($context)) {
             $style = CSSJanus::transform($style, true, false);
         }
         $style = CSSMin::remap($style, false, $wgScriptPath, true);
         if (!isset($styles[$media])) {
             $styles[$media] = array();
         }
         if (strpos($titleText, '*/') === false) {
             $style = "/* {$titleText} */\n" . $style;
         }
         $styles[$media][] = $style;
     }
     return $styles;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:35,代码来源:ResourceLoaderWikiModule.php


示例9: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param $path String: File path of style file to read
  * @param $flip bool
  *
  * @return String: CSS data in script file
  * @throws MWException if the file doesn't exist
  */
 protected function readStyleFile($path, $flip)
 {
     $localPath = $this->getLocalPath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     $style = file_get_contents($localPath);
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $dirname = dirname($path);
     if ($dirname == '.') {
         // If $path doesn't have a directory component, don't prepend a dot
         $dirname = '';
     }
     $dir = $this->getLocalPath($dirname);
     $remoteDir = $this->getRemotePath($dirname);
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $dir));
     return CSSMin::remap($style, $dir, $remoteDir, true);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:34,代码来源:ResourceLoaderFileModule.php


示例10: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param $path String: File path of style file to read
  * @param $flip bool
  *
  * @return String: CSS data in script file
  * @throws MWException if the file doesn't exist
  */
 protected function readStyleFile($path, $flip, ResourceLoaderContext $context)
 {
     $localPath = $this->getLocalPath($path);
     if (!file_exists($localPath)) {
         throw new MWException(__METHOD__ . ": style file not found: \"{$localPath}\"");
     }
     // Wikia - change begin - @author: wladek
     $style = self::getFileContents($localPath, $context);
     // Wikia - change end
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $dirname = dirname($path);
     if ($dirname == '.') {
         // If $path doesn't have a directory component, don't prepend a dot
         $dirname = '';
     }
     $dir = $this->getLocalPath($dirname);
     $remoteDir = $this->getRemotePath($dirname, $context);
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $dir));
     return CSSMin::remap($style, $dir, $remoteDir, true, $this->localBasePath);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:ResourceLoaderFileModule.php


示例11: getStyles

 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 public function getStyles(ResourceLoaderContext $context)
 {
     global $wgAllowUserCssPrefs;
     if ($wgAllowUserCssPrefs) {
         $options = $this->contextUserOptions($context);
         // Build CSS rules
         $rules = array();
         if ($options['underline'] < 2) {
             $rules[] = "a { text-decoration: " . ($options['underline'] ? 'underline' : 'none') . "; }";
         } else {
             # The scripts of these languages are very hard to read with underlines
             $rules[] = 'a:lang(ar), a:lang(ckb), a:lang(fa),a:lang(kk-arab), ' . 'a:lang(mzn), a:lang(ps), a:lang(ur) { text-decoration: none; }';
         }
         if ($options['highlightbroken']) {
             $rules[] = "a.new, #quickbar a.new { color: #ba0000; }\n";
         } else {
             $rules[] = "a.new, #quickbar a.new, a.stub, #quickbar a.stub { color: inherit; }";
             $rules[] = "a.new:after, #quickbar a.new:after { content: '?'; color: #ba0000; }";
             $rules[] = "a.stub:after, #quickbar a.stub:after { content: '!'; color: #772233; }";
         }
         if ($options['justify']) {
             $rules[] = "#article, #bodyContent, #mw_content { text-align: justify; }\n";
         }
         if (!$options['showtoc']) {
             $rules[] = "#toc { display: none; }\n";
         }
         if (!$options['editsection']) {
             $rules[] = ".editsection { display: none; }\n";
         }
         if ($options['editfont'] !== 'default') {
             $rules[] = "textarea { font-family: {$options['editfont']}; }\n";
         }
         $style = implode("\n", $rules);
         if ($this->getFlip($context)) {
             $style = CSSJanus::transform($style, true, false);
         }
         return array('all' => $style);
     }
     return array();
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:44,代码来源:ResourceLoaderUserOptionsModule.php


示例12: buildExemptModules

 /**
  * Build exempt modules and legacy non-ResourceLoader styles.
  *
  * @return string|WrappedStringList HTML
  */
 protected function buildExemptModules()
 {
     global $wgContLang;
     $resourceLoader = $this->getResourceLoader();
     $chunks = [];
     // Things that go after the ResourceLoaderDynamicStyles marker
     $append = [];
     // Exempt 'user' styles module (may need 'excludepages' for live preview)
     if ($this->isUserCssPreview()) {
         $append[] = $this->makeResourceLoaderLink('user.styles', ResourceLoaderModule::TYPE_STYLES, ['excludepage' => $this->getTitle()->getPrefixedDBkey()]);
         // Load the previewed CSS. Janus it if needed.
         // User-supplied CSS is assumed to in the wiki's content language.
         $previewedCSS = $this->getRequest()->getText('wpTextbox1');
         if ($this->getLanguage()->getDir() !== $wgContLang->getDir()) {
             $previewedCSS = CSSJanus::transform($previewedCSS, true, false);
         }
         $append[] = Html::inlineStyle($previewedCSS);
     }
     // We want site, private and user styles to override dynamically added styles from
     // general modules, but we want dynamically added styles to override statically added
     // style modules. So the order has to be:
     // - page style modules (formatted by ResourceLoaderClientHtml::getHeadHtml())
     // - dynamically loaded styles (added by mw.loader before ResourceLoaderDynamicStyles)
     // - ResourceLoaderDynamicStyles marker
     // - site/private/user styles
     // Add legacy styles added through addStyle()/addInlineStyle() here
     $chunks[] = implode('', $this->buildCssLinksArray()) . $this->mInlineStyles;
     $chunks[] = Html::element('meta', ['name' => 'ResourceLoaderDynamicStyles', 'content' => '']);
     foreach ($this->rlExemptStyleModules as $group => $moduleNames) {
         $chunks[] = $this->makeResourceLoaderLink($moduleNames, ResourceLoaderModule::TYPE_STYLES);
     }
     return self::combineWrappedStrings(array_merge($chunks, $append));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:38,代码来源:OutputPage.php


示例13: getCSS

 /**
  * Get the raw vector CSS, flipping if needed
  *
  * @todo Possibly get rid of this function and use ResourceLoader in the manner it was
  *   designed to be used in, rather than just grabbing a list of filenames from it,
  *   and not properly handling such details as media types in module definitions.
  *
  * @param string $dir 'ltr' or 'rtl'
  * @return String
  */
 public function getCSS($dir)
 {
     // All CSS files these modules reference will be concatenated in sequence
     // and loaded as one file.
     $moduleNames = array('mediawiki.legacy.shared', 'skins.common.interface', 'skins.vector.styles', 'mediawiki.legacy.config');
     $prepend = '';
     $css = '';
     $resourceLoader = new ResourceLoader();
     foreach ($moduleNames as $moduleName) {
         /** @var ResourceLoaderFileModule $module */
         $module = $resourceLoader->getModule($moduleName);
         $cssFileNames = $module->getAllStyleFiles();
         wfSuppressWarnings();
         foreach ($cssFileNames as $cssFileName) {
             if (!file_exists($cssFileName)) {
                 $prepend .= ResourceLoader::makeComment("Unable to find {$cssFileName}.");
                 continue;
             }
             if (!is_readable($cssFileName)) {
                 $prepend .= ResourceLoader::makeComment("Unable to read {$cssFileName}. " . "Please check file permissions.");
                 continue;
             }
             try {
                 if (preg_match('/\\.less$/', $cssFileName)) {
                     // Run the LESS compiler for *.less files (bug 55589)
                     $compiler = ResourceLoader::getLessCompiler();
                     $cssFileContents = $compiler->compileFile($cssFileName);
                 } else {
                     // Regular CSS file
                     $cssFileContents = file_get_contents($cssFileName);
                 }
                 if ($cssFileContents) {
                     // Rewrite URLs, though don't bother embedding images. While static image
                     // files may be cached, CSS returned by this function is definitely not.
                     $cssDirName = dirname($cssFileName);
                     $css .= CSSMin::remap($cssFileContents, $cssDirName, '..' . str_replace(array($GLOBALS['IP'], DIRECTORY_SEPARATOR), array('', '/'), $cssDirName), false);
                 } else {
                     $prepend .= ResourceLoader::makeComment("Unable to read {$cssFileName}.");
                 }
             } catch (Exception $e) {
                 $prepend .= ResourceLoader::formatException($e);
             }
             $css .= "\n";
         }
         wfRestoreWarnings();
     }
     $css = $prepend . $css;
     if ($dir == 'rtl') {
         $css = CSSJanus::transform($css, true);
     }
     return $css;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:62,代码来源:WebInstallerOutput.php


示例14: getCSS

 /**
  * Get the raw vector CSS, flipping if needed
  * @param $dir String 'ltr' or 'rtl'
  * @return String
  */
 public function getCSS($dir)
 {
     $skinDir = dirname(dirname(dirname(__FILE__))) . '/skins';
     $vectorCssFile = "{$skinDir}/vector/screen.css";
     $configCssFile = "{$skinDir}/common/config.css";
     $css = '';
     wfSuppressWarnings();
     $vectorCss = file_get_contents($vectorCssFile);
     $configCss = file_get_contents($configCssFile);
     wfRestoreWarnings();
     if (!$vectorCss || !$configCss) {
         $css = "/** Your webserver cannot read {$vectorCssFile} or {$configCssFile}, please check file permissions */";
     }
     $css .= str_replace('images/', '../skins/vector/images/', $vectorCss) . "\n" . str_replace('images/', '../skins/common/images/', $configCss);
     if ($dir == 'rtl') {
         $css = CSSJanus::transform($css, true);
     }
     return $css;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:24,代码来源:WebInstallerOutput.php


示例15: testTransform

 /**
  * @dataProvider provideData
  */
 public function testTransform($input, $settings, $output, $name)
 {
     $this->assertEquals($output, CSSJanus::transform($input, $settings['swapLtrRtlInUrl'], $settings['swapLeftRightInUrl']), $name);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:7,代码来源:CSSJanusTest.php


示例16: addInlineStyle

 /**
  * Adds inline CSS styles
  * @param $style_css Mixed: inline CSS
  * @param $flip False or String: Set to 'flip' to flip the CSS if needed
  */
 public function addInlineStyle($style_css, $flip = false)
 {
     if ($flip === 'flip' && $this->getLang()->isRTL()) {
         # If wanted, and the interface is right-to-left, flip the CSS
         $style_css = CSSJanus::transform($style_css, true, false);
     }
     $this->mInlineStyles .= Html::inlineStyle($style_css);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:13,代码来源:OutputPage.php


示例17: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param string $path File path of style file to read
  * @param bool $flip
  * @param ResourceLoaderContext $context (optional)
  *
  * @return string CSS data in script file
  * @throws MWException If the file doesn't exist
  */
 protected function readStyleFile($path, $flip, $context = null)
 {
     $localPath = $this->getLocalPath($path);
     $remotePath = $this->getRemotePath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     if ($this->getStyleSheetLang($localPath) === 'less') {
         $compiler = $this->getLessCompiler($context);
         $style = $this->compileLessFile($localPath, $compiler);
         $this->hasGeneratedStyles = true;
     } else {
         $style = file_get_contents($localPath);
     }
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $localDir = dirname($localPath);
     $remoteDir = dirname($remotePath);
     // Get and register local file references
     $localFileRefs = CSSMin::getAllLocalFileReferences($style, $localDir);
     foreach ($localFileRefs as $file) {
         if (file_exists($file)) {
             $this->localFileRefs[] = $file;
         } else {
             $this->missingLocalFileRefs[] = $file;
         }
     }
     return CSSMin::remap($style, $localDir, $remoteDir, true);
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:44,代码来源:ResourceLoaderFileModule.php


示例18: setupSkinUserCss

 function setupSkinUserCss(OutputPage $out)
 {
     global $wgContLang;
     $qb = $this->qbSetting();
     $rules = array();
     if (2 == $qb) {
         # Right
         $rules[] = "#quickbar { position: absolute; right: 4px; }";
         $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
     } elseif (1 == $qb) {
         $rules[] = "#quickbar { position: absolute; left: 4px; }";
         $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
     } elseif (3 == $qb) {
         # Floating left
         $rules[] = "#quickbar { position:absolute; left:4px }";
         $rules[] = "#topbar { margin-left: 148px }";
         $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
         $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}";
         # Hides from IE
     } elseif (4 == $qb) {
         # Floating right
         $rules[] = "#quickbar { position: fixed; right: 4px; }";
         $rules[] = "#topbar { margin-right: 148px }";
         $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
         $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}";
         # Hides from IE
     }
     $style = implode("\n", $rules);
     if ($wgContLang->getDir() === 'rtl') {
         $style = CSSJanus::transform($style, true, false);
     }
     $out->addInlineStyle($style);
     parent::setupSkinUserCss($out);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:34,代码来源:CologneBlue.php


示例19: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param string $path File path of style file to read
  * @param bool $flip
  * @param ResourceLoaderContext $context
  *
  * @return string CSS data in script file
  * @throws MWException If the file doesn't exist
  */
 protected function readStyleFile($path, $flip, $context)
 {
     $localPath = $this->getLocalPath($path);
     $remotePath = $this->getRemotePath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     if ($this->getStyleSheetLang($localPath) === 'less') {
         $style = $this->compileLessFile($localPath, $context);
         $this->hasGeneratedStyles = true;
     } else {
         $style = file_get_contents($localPath);
     }
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $localDir = dirname($localPath);
     $remoteDir = dirname($remotePath);
     // Get and register local file references
     $localFileRefs = CSSMin::getLocalFileReferences($style, $localDir);
     foreach ($localFileRefs as $file) {
         if (file_exists($file)) {
             $this->localFileRefs[] = $file;
         } else {
             $this->missingLocalFileRefs[] = $file;
         }
     }
     // Don't cache this call. remap() ensures data URIs embeds are up to date,
     // and urls contain correct content hashes in their query string. (T128668)
     return CSSMin::remap($style, $localDir, $remoteDir, true);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:45,代码来源:ResourceLoaderFileModule.php


示例20: testTransformBroken

 /**
  * @dataProvider provideTransformBrokenCases
  * @group Broken
  */
 function testTransformBroken($code, $expectedOutput)
 {
     $flipped = CSSJanus::transform($code);
     $this->assertEquals($expectedOutput, $flipped, 'Test flipping');
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:9,代码来源:CSSJanusTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSSMin类代码示例发布时间:2022-05-20
下一篇:
PHP CSSContentParser类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap