Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed double colon syntax

  • Loading branch information...
commit 410cb60d0644cf489ca517bf85cf580ecd0f3856 1 parent c0a9740
Pete Boere authored
Showing with 148 additions and 147 deletions.
  1. +148 −147 CSS_Crush.php
View
295 CSS_Crush.php
@@ -1,47 +1,47 @@
<?php
/**
- *
+ *
* CSS Crush
* @version 1.0
- *
- *
+ *
+ *
* CSS pre-processor that collates a host CSS file and its imports into one,
- * applies specified CSS variables, applies search/replace macros,
+ * applies specified CSS variables, applies search/replace macros,
* minifies then outputs cached file.
- *
+ *
* Validates cached file by checking the host-file and all imported files
* and comparing the date-modified timestamps.
- *
- *
+ *
+ *
* Example usage:
- *
- * <?php
- * include 'CSS_Crush.php';
+ *
+ * <?php
+ * include 'CSS_Crush.php';
* $path_to_compiled_file = CSS_Crush::file( '/css/screen.css' );
* ?>
- *
+ *
* <link rel="stylesheet" type="text/css" href="<?php echo $path_to_compiled_file; ?>" media="screen" />
- *
+ *
*/
class CSS_Crush {
-
+
private static $config;
- // Properties available to each 'file' process
+ // Properties available to each 'file' process
private static $options;
private static $compileName;
private static $compileSuffix;
private static $variables;
private static $literals;
private static $literalCount;
-
- // Pattern matching
- private static $regex = array(
+
+ // Pattern matching
+ private static $regex = array(
'imports' => '#@import +(?:url)? *\(? *([\'"])?(.+\.css)\1? *\)? *;?#',
'variables'=> '#@variables\s+\{\s*(.*?)\s*\};?#s',
'comments' => '#/\*(.*?)\*/#s',
);
-
+
// Init gets called manually post class definition
private static $initialized = false;
public static function init () {
@@ -53,16 +53,16 @@ public static function init () {
self::$config->path = null;
self::$config->baseDir = null;
self::$config->baseURL = null;
-
+
$docRoot = $_SERVER[ 'DOCUMENT_ROOT' ];
// workaround trailing slash issues
$docRoot = ( substr( $docRoot, -1 ) == '/' ) ? substr( $docRoot, 0, -1 ) : $docRoot;
-
+
if ( defined( 'STDIN' ) and $_SERVER[ 'argc' ] > 0 ) {
// Command line
self::log( 'Command line mode' );
self::$cli = true;
- }
+ }
else {
// Running on a server
self::log( 'Server mode' );
@@ -71,12 +71,12 @@ public static function init () {
}
self::$regex = (object) self::$regex;
}
-
+
// Initialize config data, create config file if needed
private static function loadConfig () {
$config =& self::$config;
- if (
- file_exists( $config->path ) and
+ if (
+ file_exists( $config->path ) and
$config->data and
$config->data[ 'originPath' ] == $config->path
) {
@@ -94,7 +94,7 @@ private static function loadConfig () {
$config->data = array();
}
}
-
+
private static function setPath ( $new_dir ) {
$config =& self::$config;
$docRoot = $config->docRoot;
@@ -114,19 +114,19 @@ private static function setPath ( $new_dir ) {
throw new Exception( __METHOD__ . ': Directory un-writable' );
}
self::log( 'Permissions updated' );
- }
+ }
$config->path = "{$new_dir}/" . $config->file;
$config->baseDir = $new_dir;
$config->baseURL = substr( $new_dir, strlen( $docRoot ) );
}
-
-
+
+
################################################################################################
# Public API
/**
* Process host CSS file and return a new compiled file
- *
+ *
* @param string $file Absolute or relative path to the host CSS file
* @param mixed $options An array of options or null
* @return string The public path to the compiled file or an empty string
@@ -139,40 +139,40 @@ public static function file ( $file, $options = null ) {
else if ( strpos( $file, '/' ) === 0 ) {
// WWW root path
self::setPath( dirname( self::$config->docRoot . $file ) );
- }
+ }
else {
// Relative path
self::setPath( dirname( dirname( __FILE__ ) . '/' . $file ) );
}
-
+
self::loadConfig();
$config =& self::$config;
-
+
// Make basic information about the hostfile accessible
$hostfile = new stdClass;
$hostfile->name = basename( $file );
$hostfile->path = "{$config->baseDir}/{$hostfile->name}";
$hostfile->mtime = filemtime( $hostfile->path );
-
+
if ( !file_exists( $hostfile->path ) ) {
- // If host file doesn't exist return an empty string
+ // If host file doesn't exist return an empty string
return '';
}
-
+
self::parseOptions( $options );
-
+
// Compiled filename we're searching for
self::$compileName = basename( $hostfile->name, '.css' ) . self::$compileSuffix;
-
+
// Check for a valid compiled file
$validCompliledFile = self::validateCache( $hostfile );
if ( is_string( $validCompliledFile ) ) {
return $validCompliledFile;
}
-
+
// Compile
$output = self::compile( $hostfile );
-
+
// Add in boilerplate
$output = self::getBoilerplate() . "\n{$output}";
@@ -184,14 +184,14 @@ public static function file ( $file, $options = null ) {
return '';
}
}
-
+
/**
* Clear config file and compiled files for the specified directory
- *
+ *
* @param string System path to the directory
*/
public static function clearCache ( $dir = '' ) {
- if ( empty( $dir ) ) {
+ if ( empty( $dir ) ) {
$dir = dirname( __FILE__ );
}
else if ( !file_exists( $dir ) ) {
@@ -211,9 +211,9 @@ public static function clearCache ( $dir = '' ) {
}
}
}
-
+
public static $cli;
-
+
public static function cli ( $file, $options = null ) {
// Make basic information about the hostfile accessible
$hostfile = new stdClass;
@@ -226,10 +226,10 @@ public static function cli ( $file, $options = null ) {
self::parseOptions( $options );
return self::compile( $hostfile );
}
-
+
/**
* Flag for enabling debug mode
- *
+ *
* @var boolean
*/
public static $debug = false;
@@ -240,10 +240,10 @@ public static function cli ( $file, $options = null ) {
public static function log () {
if ( !self::$debug ) {
return;
- }
+ }
static $log = '';
$args = func_get_args();
- if ( !count( $args ) ) {
+ if ( !count( $args ) ) {
// No arguments, return the log
return $log;
}
@@ -254,7 +254,7 @@ public static function log () {
$log .= $arg . '<hr>';
}
else {
- $out = '<pre>';
+ $out = '<pre>';
ob_start();
print_r( $arg );
$out .= ob_get_clean();
@@ -268,13 +268,13 @@ public static function log () {
public static function getBoilerplate () {
return <<<TXT
-/*
+/*
* File created by CSS Crush
* http://github.com/peteboere/css-crush
*/
TXT;
}
-
+
private static function parseOptions ( &$options ) {
// Create default options for those not set
$option_defaults = array(
@@ -283,7 +283,7 @@ private static function parseOptions ( &$options ) {
'minify' => true,
'versioning' => true,
);
- self::$options = is_array( $options ) ?
+ self::$options = is_array( $options ) ?
array_merge( $option_defaults, $options ) : $option_defaults;
}
@@ -293,74 +293,74 @@ private static function compile ( &$hostfile ) {
self::$variables = array();
self::$literalCount = 0;
$regex = self::$regex;
-
+
// Collate hostfile and imports
$output = self::collateImports( $hostfile );
-
+
// Extract literals
$re = '#(\'|")(?:\\1|[^\1])*?\1#';
$cb_extractStrings = self::createCallback( 'cb_extractStrings' );
$output = preg_replace_callback( $re, $cb_extractStrings, $output );
-
+
// Extract comments
$cb_extractComments = self::createCallback( 'cb_extractComments' );
$output = preg_replace_callback( $regex->comments, $cb_extractComments, $output );
-
+
// Extract variables
$cb_extractVariables = self::createCallback( 'cb_extractVariables' );
$output = preg_replace_callback( $regex->variables, $cb_extractVariables, $output );
-
+
// Search and replace variables
$re = '#var\(\s*([A-Z0-9_-]+)\s*\)#i';
$cb_placeVariables = self::createCallback( 'cb_placeVariables' );
$output = preg_replace_callback( $re, $cb_placeVariables, $output);
-
+
// Optionally apply macros
if ( self::$options[ 'macros' ] !== false ) {
self::applyMacros( $output );
}
-
- // Optionally minify (after macros since macros may introduce un-wanted whitespace)
+
+ // Optionally minify (after macros since macros may introduce un-wanted whitespace)
if ( self::$options[ 'minify' ] !== false ) {
self::minify( $output );
}
-
+
// Expand selectors
$re = '#([^}{]+){#s';
$cb_expandSelector = self::createCallback( 'cb_expandSelector' );
$output = preg_replace_callback( $re, $cb_expandSelector, $output);
-
+
// Restore all comments
$cb_restoreLiteral = self::createCallback( 'cb_restoreLiteral' );
$output = preg_replace_callback( '#(___c\d+___)#', $cb_restoreLiteral, $output);
-
+
// Restore all literals
$cb_restoreLiteral = self::createCallback( 'cb_restoreLiteral' );
$output = preg_replace_callback( '#(___\d+___)#', $cb_restoreLiteral, $output);
-
- // Release un-needed memory
+
+ // Release un-needed memory
self::$literals = self::$variables = null;
-
+
return $output;
}
private static function validateCache ( &$hostfile ) {
$config = self::$config;
-
+
// Search base directory for an existing compiled file
foreach ( scandir( $config->baseDir ) as $filename ) {
-
+
if ( self::$compileName != $filename ) {
continue;
}
// Cached file exists
self::log( 'Cached file exists' );
-
+
$existingfile = new stdClass;
$existingfile->name = $filename;
$existingfile->path = "{$config->baseDir}/{$existingfile->name}";
$existingfile->URL = "{$config->baseURL}/{$existingfile->name}";
-
+
// Start off with the host file then add imported files
$all_files = array( $hostfile->mtime );
@@ -380,14 +380,14 @@ private static function validateCache ( &$hostfile ) {
unlink( $existingfile->path );
return false;
}
- }
+ }
$existing_options = $config->data[ $existingfile->name ][ 'options' ];
$existing_datesum = $config->data[ $existingfile->name ][ 'datem_sum' ];
- if (
+ if (
$existing_options == self::$options and
$existing_datesum == array_sum( $all_files )
- ) {
+ ) {
// Files have not been modified and config is the same: return the old file
self::log( "Files have not been modified, returning existing
file '{$existingfile->URL}'" );
@@ -415,22 +415,22 @@ private static function collateImports ( &$hostfile ) {
$config =& self::$config;
$compileName = self::$compileName;
$regex = self::$regex;
-
+
// Obfuscate any directives within comment blocks
$cb_obfuscateDirectives = self::createCallback( 'cb_obfuscateDirectives' );
$str = preg_replace_callback( $regex->comments, $cb_obfuscateDirectives, $str );
-
+
// Initialize config object
$config->data[ $compileName ] = array();
-
+
// Keep track of relative paths with nested imports
$relativeContext = '';
// Detect whether we're leading from an absolute filepath
- $absoluteFlag = false;
+ $absoluteFlag = false;
$imports_mtimes = array();
$imports_filenames = array();
$import = new stdClass;
-
+
while ( preg_match( $regex->imports, $str, $match, PREG_OFFSET_CAPTURE ) ) {
// Matched a file import statement
$text = $match[0][0]; // Full match
@@ -441,7 +441,7 @@ private static function collateImports ( &$hostfile ) {
self::log('Absolute path');
$segments = array( $config->docRoot, $import->name );
$relativeContext = '';
- $absoluteFlag = true;
+ $absoluteFlag = true;
}
else {
// Relative path
@@ -450,34 +450,34 @@ private static function collateImports ( &$hostfile ) {
$segments = array_filter( array( $root, $relativeContext, $import->name ) );
if ( $absoluteFlag ) {
$relativeContext = dirname( substr( $import->path, strlen( $config->baseDir ) + 1 ) );
- }
- $absoluteFlag = false;
+ }
+ $absoluteFlag = false;
}
$import->path = realpath( implode( '/', $segments ) );
-
+
//self::log( 'Relative context: ' . $relativeContext );
//self::log( 'Import filepath: ' . $import->path );
-
+
$preStatement = substr( $str, 0, $offset );
$postStatement = substr( $str, $offset + strlen( $text ) );
-
+
if ( $import->content = @file_get_contents( $import->path ) ) {
// Imported file exists, so construct new content
-
+
// Add import details to config
$imports_mtimes[] = filemtime( $import->path );
- $imports_filenames[] = $relativeContext ?
+ $imports_filenames[] = $relativeContext ?
"{$relativeContext}/{$import->name}" : $import->name;
-
+
// Obfuscate any directives within comment blocks
- $import_content = preg_replace_callback(
+ $import_content = preg_replace_callback(
$regex->imports, $cb_obfuscateDirectives, $import->content );
-
+
// Set relative context if there is a nested import statement
if ( preg_match( $regex->imports, $import->content ) ) {
$dirName = dirname( $import->name );
if ( $dirName != '.' ) {
- $relativeContext =
+ $relativeContext =
!empty( $relativeContext ) ? "{$relativeContext}/{$dirName}" : $dirName;
}
}
@@ -493,20 +493,20 @@ private static function collateImports ( &$hostfile ) {
$str = $preStatement . $postStatement;
}
}
-
+
$config->data[ $compileName ][ 'imports' ] = $imports_filenames;
$config->data[ $compileName ][ 'datem_sum' ] = array_sum( $imports_mtimes ) + $hostfile->mtime;
$config->data[ $compileName ][ 'options' ] = self::$options;
-
+
// Need to store the current path so we can check we're using the right config path later
$config->data[ 'originPath' ] = $config->path;
- if ( !self::$cli ) {
+ if ( !self::$cli ) {
// Save config changes
file_put_contents( $config->path, serialize( $config->data ) );
}
self::log( $config->data );
-
+
return $str;
}
@@ -519,9 +519,9 @@ private static function applyMacros ( &$str ) {
array_shift( $parts );
$property = implode( '-', $parts );
$csscrushs[ $property ] = $func;
- }
+ }
}
- // Determine which macros to apply
+ // Determine which macros to apply
$opts = self::$options[ 'macros' ];
$maclist = array();
if ( $opts === true ) {
@@ -539,24 +539,25 @@ private static function applyMacros ( &$str ) {
$wrapper = '$prop = "' . $property . '";' .
'$result = ' . $callback . '( $prop, $match[2] );' .
'return $result ? $match[1] . $result . $match[3] : $match[0];';
- $str = preg_replace_callback(
- '#([\{\s;]+)' . $property . '\s*:\s*' . '([^;\}]+)' . '([;\}])#',
+ $str = preg_replace_callback(
+ '#([\{\s;]+)' . $property . '\s*:\s*' . '([^;\}]+)' . '([;\}])#',
create_function ( '$match', $wrapper ),
$str );
- }
-
- // Backwards compatable double-colon syntax
- $str = str_replace( '::', ':', $str );
+ }
+
+ // Backwards compatable double-colon syntax for pseudo elements
+ $str = preg_replace( '#\:\:(after|before|first-letter|first-line)#', ':$1', $str );
+
}
-
+
private static function minify ( &$str ) {
// Colons cannot be globally matched safely because of pseudo-selectors etc.
$innerbrace = create_function(
'$match',
- 'return preg_replace( \'#\s*:\s*#\', \':\', $match[0] );'
+ 'return preg_replace( \'#\s*:\s*#\', \':\', $match[0] );'
);
$str = preg_replace_callback( '#\{[^}]+\}#s', $innerbrace, trim( $str ) );
-
+
$replacements = array(
'#\s{2,}#' => ' ', // Remove double spaces
'#\s*(;|,|\{)\s*#' => '$1', // Clean-up around delimiters
@@ -568,11 +569,11 @@ private static function minify ( &$str ) {
'#([^/d])0(\.\d+)#' => '$1$2', // Strip leading zeros on floats
'#(\[)\s*|\s*(\])|(\()\s*|\s*(\))#' => '${1}${2}${3}${4}', // Clean-up bracket internal space
'#\s*([>~+=])\s*#' => '$1', // Clean-up around combinators
- '#\#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3#i'
+ '#\#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3#i'
=> '#$1$2$3', // Reduce Hex codes
);
- $str = preg_replace(
+ $str = preg_replace(
array_keys( $replacements ), array_values( $replacements ), $str );
}
@@ -580,16 +581,16 @@ private static function minify ( &$str ) {
# Search / replace callbacks
private static function createCallback ( $name ) {
- return create_function( '$m',
+ return create_function( '$m',
'return call_user_func( array( "' . __CLASS__ . '", "' . $name . '" ), $m );' );
}
-
+
public static function cb_extractStrings ( $match ) {
$label = "___" . ++self::$literalCount . "___";
self::$literals[ $label ] = $match[0];
return $label;
}
-
+
public static function cb_extractComments ( $match ) {
$comment = $match[0];
$flagged = strpos( $comment, '/*!' ) === 0;
@@ -600,14 +601,14 @@ public static function cb_extractComments ( $match ) {
}
return '';
}
-
+
public static function cb_extractVariables ( $match ) {
$vars = preg_split( '#\s*;\s*#', $match[1], null, PREG_SPLIT_NO_EMPTY );
foreach ( $vars as $var ) {
$parts = preg_split( '#\s*:\s*#', $var, null, PREG_SPLIT_NO_EMPTY );
if ( count( $parts ) == 2 ) {
list( $property, $value ) = $parts;
- }
+ }
else {
continue;
}
@@ -617,7 +618,7 @@ public static function cb_extractVariables ( $match ) {
}
return '';
}
-
+
public static function cb_placeVariables ( $match ) {
$key = $match[1];
if ( isset( self::$variables[ $key ] ) ) {
@@ -627,15 +628,15 @@ public static function cb_placeVariables ( $match ) {
return '';
}
}
-
+
public static function cb_expandSelector_braces ( $match ) {
$label = "__any" . ++self::$literalCount . "__";
self::$literals[ $label ] = $match[1];
return $label;
}
-
+
public static function cb_expandSelector ( $match ) {
- // http://dbaron.org/log/20100424-any
+ // http://dbaron.org/log/20100424-any
$text = $match[0];
$between = $match[1];
if ( strpos( $between, ':any' ) === false ) {
@@ -643,12 +644,12 @@ public static function cb_expandSelector ( $match ) {
}
$cb_expandSelector_braces = self::createCallback( 'cb_expandSelector_braces' );
- $between = preg_replace_callback(
+ $between = preg_replace_callback(
'#:any\(([^)]*)\)#', $cb_expandSelector_braces, $between );
-
+
// Strip any comment labels
$between = preg_replace( '#\s*___c\d+___\s*#', '', $between );
-
+
$re_comma = '#\s*,\s*#';
$matched_statements = preg_split( $re_comma, $between );
@@ -656,7 +657,7 @@ public static function cb_expandSelector ( $match ) {
foreach ( $matched_statements as $matched_statement ) {
$pos = strpos( $matched_statement, '__any' );
if ( $pos !== false ) {
- // Contains an :any statement so we expand
+ // Contains an :any statement so we expand
$chain = array( '' );
do {
if ( $pos === 0 ) {
@@ -679,7 +680,7 @@ public static function cb_expandSelector ( $match ) {
$matched_statement = substr( $matched_statement, $pos );
}
} while ( ( $pos = strpos( $matched_statement, '__any' ) ) !== false );
-
+
// Finish off
foreach ( $chain as &$row ) {
$stack[] = $row . $matched_statement;
@@ -690,22 +691,22 @@ public static function cb_expandSelector ( $match ) {
$stack[] = $matched_statement;
}
}
-
+
// Preserving the original whitespace for easier debugging
$first = rtrim( array_shift( $stack ) );
$finish = array_map( 'trim', $stack );
array_unshift( $finish, $first );
return implode( ',', $finish ) . '{';
}
-
+
public static function cb_obfuscateDirectives ( $match ) {
return str_replace( '@', '(at)', $match[0] );
}
-
+
public static function cb_restoreLiteral ( $match ) {
return self::$literals[ $match[0] ];
}
-
+
}
################################################################################################
@@ -744,7 +745,7 @@ public static function cb_restoreLiteral ( $match ) {
}
if ( !$file or !file_exists( $file ) ) {
return;
- }
+ }
if ( isset( $options[ 'm' ] ) ) {
$params[ 'macros' ] = explode( ',', $options[ 'm' ] );
}
@@ -757,9 +758,9 @@ public static function cb_restoreLiteral ( $match ) {
if ( isset( $options[ 'n' ] ) or isset( $options[ 'nominify' ] ) ) {
$params[ 'minify' ] = false;
}
-
+
$output = CSS_Crush::cli( $file, $params );
-
+
$outputFile = isset( $options[ 'o' ] );
if ( $outputFile ) {
$outputFile = $options[ 'o' ];
@@ -767,7 +768,7 @@ public static function cb_restoreLiteral ( $match ) {
else {
$outputFile = isset( $options[ 'output' ] ) ? $options[ 'output' ] : false;
}
-
+
if ( $outputFile ) {
$output = CSS_Crush::getBoilerplate() . "\n{$output}";
file_put_contents( $outputFile, $output );
@@ -790,76 +791,76 @@ function csscrush_Opacity ( $prop, $val ) {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity={$msval});
zoom:1;
{$prop}: {$val}";
- return preg_replace( "#\s+#", ' ', $out );
+ return preg_replace( "#\s+#", ' ', $out );
}
}
// Fix display:inline-block in ie6/7
-if ( !function_exists( 'csscrush_Display' ) ) {
+if ( !function_exists( 'csscrush_Display' ) ) {
function csscrush_Display ( $prop, $val ) {
- if ( $val == 'inline-block' ) {
+ if ( $val == 'inline-block' ) {
return "{$prop}:{$val};*{$prop}:inline;*zoom:1";
}
return "{$prop}:{$val}";
}
}
// Fix min-height in ie6
-if ( !function_exists( 'csscrush_Min_Height' ) ) {
+if ( !function_exists( 'csscrush_Min_Height' ) ) {
function csscrush_Min_Height ( $prop, $val ) {return "{$prop}:{$val};_height:{$val}";}
}
///////////// CSS3 /////////////
-if ( !function_exists( 'csscrush_Border_Radius' ) ) {
+if ( !function_exists( 'csscrush_Border_Radius' ) ) {
function csscrush_Border_Radius ( $prop, $val ) {
return "-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Border_Top_Left_Radius' ) ) {
+if ( !function_exists( 'csscrush_Border_Top_Left_Radius' ) ) {
function csscrush_Border_Top_Left_Radius ( $prop, $val ) {
return "-moz-border-radius-topleft:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Border_Top_Right_Radius' ) ) {
+if ( !function_exists( 'csscrush_Border_Top_Right_Radius' ) ) {
function csscrush_Border_Top_Right_Radius ( $prop, $val ) {
return "-moz-border-radius-topright:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Border_Bottom_Right_Radius' ) ) {
+if ( !function_exists( 'csscrush_Border_Bottom_Right_Radius' ) ) {
function csscrush_Border_Bottom_Right_Radius ( $prop, $val ) {
return "-moz-border-radius-bottomright:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Border_Bottom_Left_Radius' ) ) {
+if ( !function_exists( 'csscrush_Border_Bottom_Left_Radius' ) ) {
function csscrush_Border_Bottom_Left_Radius ( $prop, $val ) {
return "-moz-border-radius-bottomleft:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Box_Shadow' ) ) {
+if ( !function_exists( 'csscrush_Box_Shadow' ) ) {
function csscrush_Box_Shadow ( $prop, $val ) {
return "-webkit-{$prop}:{$val};-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Transform' ) ) {
+if ( !function_exists( 'csscrush_Transform' ) ) {
function csscrush_Transform ( $prop, $val ) {
return "-o-{$prop}:{$val};-webkit-{$prop}:{$val};-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Transition' ) ) {
+if ( !function_exists( 'csscrush_Transition' ) ) {
function csscrush_Transition ( $prop, $val ) {
return "-o-{$prop}:{$val};-webkit-{$prop}:{$val};-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Background_Size' ) ) {
+if ( !function_exists( 'csscrush_Background_Size' ) ) {
function csscrush_Background_Size ( $prop, $val ) {
return "-o-{$prop}:{$val};-webkit-{$prop}:{$val};-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Box_Sizing' ) ) {
+if ( !function_exists( 'csscrush_Box_Sizing' ) ) {
function csscrush_Box_Sizing ( $prop, $val ) {
return "-webkit-{$prop}:{$val};-moz-{$prop}:{$val};{$prop}:{$val}";
}
}
-if ( !function_exists( 'csscrush_Background_Image' ) ) {
+if ( !function_exists( 'csscrush_Background_Image' ) ) {
function csscrush_Background_Image ( $prop, $val ) {
if ( strpos( $val, 'linear-gradient' ) !== false ) {
$val = substr( $val, strpos( $val, '(' ) + 1 );
@@ -880,9 +881,9 @@ function csscrush_Background_Image ( $prop, $val ) {
background-image: -webkit-gradient(
linear, left top, left bottom, color-stop( 0, {$col1} ), color-stop( 1, {$col2} ));
background-image:-moz-linear-gradient(top, {$col1}, {$col2});
- background-image:linear-gradient(top, {$col1}, {$col2});";
- return preg_replace( "#\s+#", ' ', $out );
- }
+ background-image:linear-gradient(top, {$col1}, {$col2});";
+ return preg_replace( "#\s+#", ' ', $out );
+ }
return false;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.