-
Notifications
You must be signed in to change notification settings - Fork 1
/
CssParser.php
executable file
·40 lines (36 loc) · 963 Bytes
/
CssParser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
* UWS - Universal Wealth System
* CssParser.php
* Class CssParse
* GPL license
* author: Fabio Barone
* date: 30. Nov. 2009
*
* This file parses the @.css file in order to retrieve the user's colors
* for the chats. It is currently not used anymore, as chat colors are not
* integrated into the UWS.
*/
class CssParser {
function parse() {
//read css
$userColors = array();
$myCssLines = file("@.css");
$userName = '';
for ($i=0; $i<count($myCssLines); $i++) {
$cssLine = $myCssLines[$i];
if (substr($cssLine, 0, 1) == ".") {
$cssWords = explode("\t", $cssLine);
$userName = substr($cssWords[0], 1, strlen($cssWords[0])-1);
$userName = str_replace(" ", "", $userName);
$colorDef = $cssWords[1];
$pos = strpos($colorDef, "color:");
$color = substr($colorDef, $pos+6, 7);
$userColors[$userName] = $color;
$userColors[strtolower($userName)] = $color;
}
}
return $userColors;
} //function
} //class
?>