<?php
-/* ***** BEGIN LICENSE BLOCK *****
- *
- * The contents of this file are subject to Austrian copyright reegulations
- * ("Urheberrecht"); you may not use this file except in compliance with
- * those laws.
- * This contents and any derived work, if it gets distributed in any way,
- * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
- * either express or implied.
- *
- * The Original Code is KaiRo's extended DOM document classes.
- *
- * The Initial Developer of the Original Code is
- * KaiRo - Robert Kaiser.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Robert Kaiser <kairo@kairo.at>
- *
- * ***** END LICENSE BLOCK ***** */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
class ExtendedDocument extends DOMDocument {
// ExtendedDocument PHP class
// appends an ExtendedDocument::createElementJSFile() as a child of this document (see there for params)
// returns the new child
//
- // public function appendCOMElement($module, $attributes)
- // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
- // returns the new child
- //
// public function createElementLink($target, [$value])
// returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
//
//
// public function createElementJSFile($jsURL)
// returns an ExtendedElement that is an HTML <script> of JavaScript type linking to the file given by the URL
- //
- // public function createCOMElement($module, $attributes)
- // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
- // given name=>value array as attributes
function __construct($version = '1.0', $encoding = 'utf-8') {
// make sure the default DOMDocument constructor runs
public function appendJSFile($jsdata) {
return $this->appendChild($this->createElementJSFile($jsdata));
}
- public function appendCOMElement($module, $attributes) {
- return $this->appendChild($this->createCOMElement($module, $attributes));
- }
public function appendHTMLMarkup($htmldata, $parentNode = null) {
if (is_null($parentNode)) { $parentNode =& $this; }
$jselem->setAttribute('src', $jsURL);
return $jselem;
}
-
- public function createCOMElement($module, $attributes) {
- $com_elem = $this->createElementNS(COM_NS, $module);
- if (is_array($attributes) && count($attributes)) {
- foreach ($attributes as $name=>$value) {
- $com_elem->setAttribute($name, $value);
- }
- }
- return $com_elem;
- }
}
class ExtendedElement extends DOMElement {
// appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
// NO return value!
//
- // public function appendCOMElement($module, $attributes)
- // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
- // returns the new child
- //
- // public function appendCOMElement($module, $attributes)
- // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
+ // public function appendJSFile($jsURL)
+ // appends an ExtendedDocument::createElementJSFile() as a child of this element (see there for params)
// returns the new child
public function appendElement($name, $value = '') {
public function appendJSFile($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata));
}
- public function appendCOMElement($module, $attributes) {
- return $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
- }
}
class ExtendedDocumentFragment extends DOMDocumentFragment {
// appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
// NO return value!
//
- // public function appendCOMElement($module, $attributes)
- // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
- // returns the new child
- //
- // public function appendCOMElement($module, $attributes)
- // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
+ // public function appendJSFile($jsURL)
+ // appends an ExtendedDocument::createElementJSFile() as a child of this fragment (see there for params)
// returns the new child
public function appendElement($name, $value = '') {
public function appendJSFile($jsdata) {
return $this->appendChild($this->ownerDocument->createElementJSFile($jsdata));
}
- public function appendCOMElement($module, $attributes) {
- return $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
- }
}
?>