Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

is now able to create Elements for which no class exists

git-svn-id: http://svn.php.net/repository/pear/packages/XML_XUL/trunk@154994 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 3e5a4a38d82bd072ff7d3111b82a0d94de8ea957 1 parent 62d01fc
Stephan Schmidt authored
Showing with 17 additions and 10 deletions.
  1. +17 −10 XUL/Document.php
View
27 XUL/Document.php
@@ -276,19 +276,26 @@ function &createElement( $name, $attributes = array(), $cdata = null, $replaceEn
{
$classname = sprintf( 'XML_XUL_Element_%s', $name );
$file = sprintf( 'XML/XUL/Element/%s.php', ucfirst($name) );
- require_once $file;
+ if( !@include_once $file )
+ {
+ $el = &new XML_XUL_Element( $attributes, $cdata );
+ $el->elementName = strtolower( $name );
+ }
+ else
+ {
+ $el = &new $classname( $attributes, $cdata );
+ }
- $el = &new $classname( $attributes, $cdata );
- $el->setNamespace($this->_ns);
- $el->setDocument($this);
- $el->replaceEntities = $replaceEntities;
+ $el->setNamespace($this->_ns);
+ $el->setDocument($this);
+ $el->replaceEntities = $replaceEntities;
- if ($this->_autoValidate) {
- $result = $el->validateAttributes();
- if (PEAR::isError($result)) {
- return $result;
+ if ($this->_autoValidate) {
+ $result = $el->validateAttributes();
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
- }
return $el;
}
Please sign in to comment.
Something went wrong with that request. Please try again.