note 51817 added to ref.dom
| From: | spammable69 at hotmail dot com | Date: | Tue, 12 Apr 2005 05:18:36 +0000 |
| Subject: | note 51817 added to ref.dom | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87878@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/ref.dom.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51817
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51817&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51817&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51817&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51817&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51817&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51817&report=yes
Search -- http://master.php.net/manage/user-notes.php