MediaWiki
1.23.2
|
This is a PHP port of CSSJanus, a utility that transforms CSS style sheets written for LTR to RTL. More...
Static Public Member Functions | |
static | transform ( $css, $swapLtrRtlInURL=false, $swapLeftRightInURL=false) |
Transform an LTR stylesheet to RTL. More... | |
Static Private Member Functions | |
static | buildPatterns () |
Build patterns we can't define above because they depend on other patterns. More... | |
static | calculateNewBackgroundPosition ( $matches) |
Callback for calculateNewBackgroundPosition() More... | |
static | fixBackgroundPosition ( $css) |
Flip horizontal background percentages. More... | |
static | fixBorderRadius ( $css) |
Swaps appropriate corners in four-part border-radius rules. More... | |
static | fixCursorProperties ( $css) |
Flip East and West in rules like cursor: nw-resize;. More... | |
static | fixDirection ( $css) |
Replace direction: ltr; with direction: rtl; and vice versa. More... | |
static | fixFourPartNotation ( $css) |
Swap the second and fourth parts in four-part notation rules like padding: 1px 2px 3px 4px;. More... | |
static | fixLeftAndRight ( $css) |
Flip rules like left: , padding-right: , etc. More... | |
static | fixLeftRightInURL ( $css) |
Replace 'left' with 'right' and vice versa in background URLs. More... | |
static | fixLtrRtlInURL ( $css) |
Replace 'ltr' with 'rtl' and vice versa in background URLs. More... | |
static | fixShadows ( $css) |
Negates horizontal offset in box-shadow and text-shadow rules. More... | |
Static Private Attributes | |
static | $patterns |
This is a PHP port of CSSJanus, a utility that transforms CSS style sheets written for LTR to RTL.
The original Python version of CSSJanus is Copyright 2008 by Google Inc. and is distributed under the Apache license. This PHP port is Copyright 2010 by Roan Kattouw and is dual-licensed under the GPL (as in the comment above) and the Apache (as in the original code) licenses.
Original code: http://code.google.com/p/cssjanus/source/browse/trunk/cssjanus.py License of original code: http://code.google.com/p/cssjanus/source/browse/trunk/LICENSE
Definition at line 37 of file CSSJanus.php.
|
staticprivate |
Build patterns we can't define above because they depend on other patterns.
Definition at line 90 of file CSSJanus.php.
References $patterns.
Referenced by transform().
|
staticprivate |
Callback for calculateNewBackgroundPosition()
$matches | array |
Definition at line 352 of file CSSJanus.php.
References $matches.
|
staticprivate |
Flip horizontal background percentages.
$css | string |
Definition at line 331 of file CSSJanus.php.
Referenced by transform().
|
staticprivate |
Swaps appropriate corners in four-part border-radius rules.
Needs to undo the effect of fixFourPartNotation() on those rules, too.
$css | string |
Definition at line 282 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Flip East and West in rules like cursor: nw-resize;.
$css | string |
Definition at line 248 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Replace direction: ltr; with direction: rtl; and vice versa.
The original implementation only does this inside body selectors and misses "body\n{\ndirection:ltr;\n}". This function does not have these problems.
See http://code.google.com/p/cssjanus/issues/detail?id=15 and TODO: URL
$css | string |
Definition at line 195 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Swap the second and fourth parts in four-part notation rules like padding: 1px 2px 3px 4px;.
Unlike the original implementation, this function doesn't suffer from the bug where whitespace is not preserved when flipping four-part rules and four-part color rules with multiple whitespace characters between colors are not recognized. See http://code.google.com/p/cssjanus/issues/detail?id=16
$css | string |
Definition at line 269 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Flip rules like left: , padding-right: , etc.
$css | string |
Definition at line 235 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Replace 'left' with 'right' and vice versa in background URLs.
$css | string |
Definition at line 222 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Replace 'ltr' with 'rtl' and vice versa in background URLs.
$css | string |
Definition at line 209 of file CSSJanus.php.
References $css.
Referenced by transform().
|
staticprivate |
Negates horizontal offset in box-shadow and text-shadow rules.
$css | string |
Definition at line 297 of file CSSJanus.php.
References $css, and $matches.
Referenced by transform().
Transform an LTR stylesheet to RTL.
string | $css | stylesheet to transform |
$swapLtrRtlInURL | Boolean: If true, swap 'ltr' and 'rtl' in URLs | |
$swapLeftRightInURL | Boolean: If true, swap 'left' and 'right' in URLs |
Definition at line 139 of file CSSJanus.php.
References $css, buildPatterns(), fixBackgroundPosition(), fixBorderRadius(), fixCursorProperties(), fixDirection(), fixFourPartNotation(), fixLeftAndRight(), fixLeftRightInURL(), fixLtrRtlInURL(), and fixShadows().
Referenced by OutputPage\addInlineStyle(), OutputPage\buildCssLinks(), WebInstallerOutput\getCSS(), ResourceLoaderUserCSSPrefsModule\getStyles(), ResourceLoaderWikiModule\getStyles(), ResourceLoaderFileModule\readStyleFile(), CSSJanusTest\testTransform(), CSSJanusTest\testTransformAdvanced(), and CSSJanusTest\testTransformBroken().
|
staticprivate |
Definition at line 39 of file CSSJanus.php.
Referenced by buildPatterns().