PHPverse 2025

Voting

The Note You're Voting On

spammable69 at hotmail dot com
20 years ago
I wrote a framework to implement the StyleSheet interfaces as specified on the W3C website. The code is written in PHP, and is NOT a complete implementation. Use it how ya like. I was planning on adding the CSSStyleSheet interfaces as well. Feel free to ask.

<?
class StyleSheetList {
public length;
private self;

function __construct ( ) {
$this->self = array();
}

function __get($property, $&ret) {
if($property == 'length')
$ret = count($this->self);
return true;
}

function __set($property, $val) {
if($property == 'length')
return true;
}

function item( $index ) {
return $this->self[$index];
}
}

class MediaList extends StyleSheetList {

function appendMedium ( $newMedium ) {
array_push($this->self, $newMedium);
}

function deleteMedium ( $oldMedium ) {
foreach($this->self as $item) {
if( $item == $oldMedium ) {
$item = $this->self[ $this->length-1 ];
array_pop($this->self);
break;
}
}
}
}

class DocumentStyle {
public styleSheets;

function __construct ( ) {
$this->styleSheets = new StyleSheetList();
}

function __set($property, $val) {
if($property == 'styleSheets')
return true;
}
}

class LinkStyle {
public sheet;

function __construct () {
$this->sheet = new StyleSheet();
}

function __set($property, $val) {
if($property == 'sheet')
return true;
}
}

class StyleSheet {
public type;
public disabled;
public ownerNode;
public parentStyleSheet;
public href;
public title;
public media;

function __construct( $type, $disabled, $ownerNode, $parentStyleSheet, $href, $title){
$this->type = $type;
$this->disabled = $disabled;
$this->media = new MediaList();
$this->ownerNode = $ownerNode;
$this->parentStyleSheet = $parentStyleSheet;
$this->href = $href;
$this->title = $title;
}
}
?>

Only contactable via http://murpsoft.com/contact.html

<< Back to user notes page

To Top