Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/shared/Graph/style.php
<?php
function parseCss($file) {
	$findClasses = array("plot","plot_title", "plot_bar");
	$lines=file($file);

	$inClass = false;
	$currentClass = "";
	foreach ($lines as $line) {
		if ($inClass) {
			preg_match("/(.*):(.*);/", $line, $matches);
			$matches[1] = trim($matches[1], " \t");
			$matches[2] = trim($matches[2], " \t");
			if ($matches[1] != "" && $matches[2] != "") {
				if (preg_match("/#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})/", $matches[2], $colors)) {
					$red = hexdec($colors[1]);
					$green = hexdec($colors[2]);
					$blue = hexdec($colors[3]);
					$classColors{$matches[1]} = array($red, $green, $blue);
				}
			}
		} else {
			foreach ($findClasses as $class) {
				if (preg_match("/\.".$class."[ ]*?{/", $line)) {
					$inClass = true;
					$currentClass=$class;
					$classColors = array();
					break;
				}
			}
		} 
		if ($inClass && preg_match("/}/", $line)) {
			$returnClasses{$currentClass} = $classColors;
			$classColors = array();
			$inClass = false;
			$currentClass = "";
		}
	}
	return($returnClasses);
}
?>
Return current item: TVEz - Media Library