BASE . LOG, 'log_file_id' => $LOG_FILE_ID, 'log_per_date' => true, ]); // define a list of from to color sets for conversion test $PAGE_NAME = 'TEST CLASS: HTML BUILD'; print ""; print "" . $PAGE_NAME . ""; print ""; print '
Class Test Master
'; print '

' . $PAGE_NAME . '

'; $el = new Element('div', 'el-1', 'Content', ['red'], ['onClick' => 'javascript:alert(\'JS alert\');']); print "
" . htmlentities($el->buildHtml()) . "
"; $el_o = new Element('div', 'u-id', '', ['base', 'cool']); $el_o_1 = new Element('span', 's-id-1', 'Span A', ['bold']); $el_o_2 = new Element('span', 's-id-2', 'Span B'); $el_o_3 = new Element('a', 'link-a', 'Title', ['l-highlight'], ['OnClick' => 'Foo();']); $el_o_2->addSub($el_o_3); $el_o->addSub($el_o_1, $el_o_2); $el_o_1->addCss('italic', 'green', 'italic', 'font-large') ->removeCss('green'); $el_o_2->addCss('wrong-css') ->removeCss('wrong-css', 'correct-css'); $el_o_2->addCss('a', 'b')->removeCss('correct-css'); $el_o_1->addSub($el_o_2); // var_dump($el2); $el_o_list = []; $el_o_list[] = new Element('foo', 'foo-A'); $el_o_list[] = new Element('bar', 'foo-B'); $el_o_list[] = new Element('baz', 'foo-C'); $el_o_list[] = new Element('br'); $el_o_list[] = new Element('input', 'tag', '', [], ['name' => 'foo', 'value' => 'ABC']); // $el2->resetSub(); // var_dump($el2); echo "
"; print "EL_O:
" . print_r($el_o, true) . "
"; echo "
"; print "buildHtml():
" . htmlentities($el_o->buildHtml()) . "
"; /* echo "
"; print "phfo(\$el_o):
" . htmlentities($el_o::printHtmlFromObject($el_o, true)) . "
"; */ echo "
"; print "phfa(\$el_list):
" . htmlentities($el_o::buildHtmlFromList($el_o_list, true)) . "
"; echo "
"; // self loop $el_s = new Element('div', 'id-s', 'Self'); try { $el_s->addSub($el_s, new Element('span', '', 'Span')); } catch (HtmlBuilderExcpetion $e) { print "E: " . $e->getMessage() . " | " . $e->getTraceAsString() . "
"; } // var_dump($el_s); print "el_s, buildHtml():
" . htmlentities($el_s->buildHtml()) . "
"; $el_s_2 = new Element('div', 'id-s', 'Self', []); $el_s_2->addSub( new Element('span', 's-1', 's 1'), new Element('span', 's-2', 's 2'), ); $el_s_3 = new Element('div', 'id-3', 'ID 3'); try { $el_s_3->addSub($el_s_2); $el_s_2->addSub($el_s_2); } catch (HtmlBuilderExcpetion $e) { print "E: " . $e->getMessage() . " | " . $e->getTraceAsString() . "
"; } // print "
" . var_export($el_s_3, true) . "
"; print "el_s_3, buildHtml():
" . htmlentities($el_s_3->buildHtml()) . "
"; echo "
"; Error::resetMessages(); try { $el_er = new Element(''); } catch (HtmlBuilderExcpetion $e) { print "E: " . $e->getMessage() . " | " . $e->getTraceAsString() . "
"; if ($e->getPrevious() !== null) { print "E: " . $e->getPrevious()->getMessage() . " | " . $e->getPrevious()->getTraceAsString() . "
"; } } print "Errors:
" . print_r(Error::getMessages(), true) . "
"; print "Warning: " . Support::printToString(Error::hasWarning()) . "
"; print "Error: " . Support::printToString(Error::hasError()) . "
"; Error::resetMessages(); try { $el_er = new Element('123123'); } catch (HtmlBuilderExcpetion $e) { print "E: " . $e->getMessage() . " | " . $e->getTraceAsString() . "
"; if ($e->getPrevious() !== null) { print "E: " . $e->getPrevious()->getMessage() . " | " . $e->getPrevious()->getTraceAsString() . "
"; } } print "Errors:
" . print_r(Error::getMessages(), true) . "
"; print "Warning: " . Support::printToString(Error::hasWarning()) . "
"; print "Error: " . Support::printToString(Error::hasError()) . "
"; print ""; // __END__