Exemple #1
0
/**
 * Easy and extended border radius
 * Adds vendor-specific versions of border-radius and adds border-top-radius,
 * border-bottom-radius, border-left-radius and border-right-radius
 * For IE, only general radius works. And make sure, border-radius declaration 
 * comes before any (box-)shadow-declaration in CSS-code!
 * 
 * Usage:     border-radius[-top/-bottom/-left/-right/-top-left/...]: value;
 * Example 1: border-top-radius:4px;
 * Example 2: border-bottom-left-radius:2em;
 * Status:    Stable
 * Version:   1.1
 * 
 * @param mixed &$parsed
 * @return void
 */
function borderradius(&$parsed)
{
    global $cssp, $browser;
    $htc_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') . '/plugins/borderradius/chromacorners.htc';
    foreach ($parsed as $block => $css) {
        foreach ($parsed[$block] as $selector => $styles) {
            foreach ($styles as $property => $values) {
                if (preg_match('/border(?:-(top|right|bottom|left)(?:-(right|left))*)*-radius/', $property, $matches)) {
                    // Create the new rules and insert them
                    $borderradius_rules = borderradius_glue_rules($matches, $values);
                    $borderradius_rules['behavior'][] = 'url(' . $htc_path . ')';
                    $cssp->insert_properties($borderradius_rules, $block, $selector, null, $property);
                    // Comment the newly inserted properties
                    foreach ($borderradius_rules as $border_property => $border_value) {
                        CSSP::comment($parsed[$block][$selector], $border_property, 'Added by border radius plugin');
                    }
                    // Remove Top/Left/Bottom/Right shortcuts
                    if (count($matches) == 2) {
                        unset($parsed[$block][$selector][$property]);
                    }
                }
            }
        }
    }
}
Exemple #2
0
/**
 * Easy and extended border radius
 * Adds vendor-specific versions of border-radius and adds border-top-radius,
 * border-bottom-radius, border-left-radius and border-right-radius
 * For IE, only general radius works. And make sure, border-radius declaration 
 * comes before any (box-)shadow-declaration in CSS-code!
 * 
 * Usage:     border-radius[-top/-bottom/-left/-right/-top-left/...]: value;
 * Example 1: border-top-radius:4px;
 * Example 2: border-bottom-left-radius:2em;
 * Status:    Stable
 * Version:   1.1
 * 
 * @param mixed &$parsed
 * @return void
 */
function borderradius(&$parsed)
{
    global $cssp;
    foreach ($parsed as $block => $css) {
        foreach ($parsed[$block] as $selector => $styles) {
            foreach ($styles as $property => $values) {
                if (preg_match('/border(?:-(top|right|bottom|left)(?:-(right|left))*)*-radius/', $property, $matches)) {
                    // Create the new rules and insert them
                    $borderradius_rules = borderradius_glue_rules($matches, $values);
                    $cssp->insert_properties($borderradius_rules, $block, $selector, null, $property);
                    // Comment the newly inserted properties
                    foreach ($borderradius_rules as $border_property => $border_value) {
                        CSSP::comment($parsed[$block][$selector], $border_property, 'Added by border radius plugin');
                    }
                    // Remove Top/Left/Bottom/Right shortcuts
                    if (count($matches) == 2) {
                        unset($parsed[$block][$selector][$property]);
                    }
                }
            }
        }
    }
}