public function testDataUrl() { $f = new Kwf_Assets_Dependency_File_Css('kwf/tests/Kwf/Assets/DependencyCss/dataUrl.css'); $c = $f->getContents('en'); $this->assertEquals('body { background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); } body { background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); } body { background-image: url(\'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\'); } body { background-image: url(\'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\'); } body { background-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); } body { background-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); }', trim($c)); }
public static function parseMasterStyles($masterContent) { $styles = array(); if (strpos($masterContent, '.kwfup-webStandard') === false) { return $styles; } preg_match_all('#^ *.kwfup-webStandard *((span|p|h[1-6])\\.?([^ ]*)) *{([^}]*)} */\\* +(.*?) +\\*/#m', $masterContent, $m); foreach (array_keys($m[1]) as $i) { $tagName = $m[2][$i]; $styles[] = array('id' => 'master' . $i, 'name' => $m[5][$i], 'tagName' => $tagName, 'className' => $m[3][$i], 'styles' => Kwf_Assets_Dependency_File_Css::expandAssetVariables($m[4][$i], 'web')); } return $styles; }