- <?php
- class Css{
- function Css($url){
- $this->url=$url;
- $this->text=implode(file($url));
- }
- function parse(){
- $this->parse = preg_split('/\{(.*?)\}/', $this->text, -1, PREG_SPLIT_DELIM_CAPTURE);
- foreach ($this->parse as $a=>$b){
- if ($a%2==1){
- $this->parse[$a]=preg_split('/([\.: ])/', $b, -1, PREG_SPLIT_NO_EMPTY );
- }
- }
- }
- function coloration_synthaxique(){
- $this->aff=nl2br($this->text);
- $this->aff=preg_replace('/(\{.*?\})/i','<font color="#0077FF">\\1</font>',$this->aff);
- $this->aff=preg_replace('/(:\s?\S*?\s?;)/i','<span style="color:#FF0000;">\\1</span>',$this->aff);
- }
- var $parse;
- var $url;
- var $text;
- }
- $a=new Css('site.css');
- $a->parse();
- print_r($a->parse);
- ?>
<?php
class Css{
function Css($url){
$this->url=$url;
$this->text=implode(file($url));
}
function parse(){
$this->parse = preg_split('/\{(.*?)\}/', $this->text, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($this->parse as $a=>$b){
if ($a%2==1){
$this->parse[$a]=preg_split('/([\.: ])/', $b, -1, PREG_SPLIT_NO_EMPTY );
}
}
}
function coloration_synthaxique(){
$this->aff=nl2br($this->text);
$this->aff=preg_replace('/(\{.*?\})/i','<font color="#0077FF">\\1</font>',$this->aff);
$this->aff=preg_replace('/(:\s?\S*?\s?;)/i','<span style="color:#FF0000;">\\1</span>',$this->aff);
}
var $parse;
var $url;
var $text;
}
$a=new Css('site.css');
$a->parse();
print_r($a->parse);
?>