| @@ 46-58 (lines=13) @@ | ||
| 43 | * @param $string |
|
| 44 | * @return mixed|string |
|
| 45 | */ |
|
| 46 | private function cleanup($string) |
|
| 47 | { |
|
| 48 | $string = str_replace(array("\r", "\n"), '', $string); |
|
| 49 | $string = str_replace(array("\t"), ' ', $string); |
|
| 50 | $string = str_replace('"', '\'', $string); |
|
| 51 | $string = preg_replace('|/\*.*?\*/|', '', $string); |
|
| 52 | $string = preg_replace('/\s\s+/', ' ', $string); |
|
| 53 | ||
| 54 | $string = trim($string); |
|
| 55 | $string = rtrim($string, ';'); |
|
| 56 | ||
| 57 | return $string; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Convert a property-string into an object |
|
| @@ 27-39 (lines=13) @@ | ||
| 24 | * @param string $string |
|
| 25 | * @return string |
|
| 26 | */ |
|
| 27 | private function cleanup($string) |
|
| 28 | { |
|
| 29 | $string = str_replace(array("\r", "\n"), '', $string); |
|
| 30 | $string = str_replace(array("\t"), ' ', $string); |
|
| 31 | $string = str_replace('"', '\'', $string); |
|
| 32 | $string = preg_replace('|/\*.*?\*/|', '', $string); |
|
| 33 | $string = preg_replace('/\s\s+/', ' ', $string); |
|
| 34 | ||
| 35 | $string = trim($string); |
|
| 36 | $string = rtrim($string, '}'); |
|
| 37 | ||
| 38 | return $string; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * Convert a rule-string into an object |
|
| @@ 50-63 (lines=14) @@ | ||
| 47 | * @param string $css |
|
| 48 | * @return string |
|
| 49 | */ |
|
| 50 | private function doCleanup($css) |
|
| 51 | { |
|
| 52 | // remove media queries |
|
| 53 | $css = preg_replace('/@media [^{]*{([^{}]|{[^{}]*})*}/', '', $css); |
|
| 54 | ||
| 55 | $css = str_replace(array("\r", "\n"), '', $css); |
|
| 56 | $css = str_replace(array("\t"), ' ', $css); |
|
| 57 | $css = str_replace('"', '\'', $css); |
|
| 58 | $css = preg_replace('|/\*.*?\*/|', '', $css); |
|
| 59 | $css = preg_replace('/\s\s+/', ' ', $css); |
|
| 60 | $css = trim($css); |
|
| 61 | ||
| 62 | return $css; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||