Source for file Html.php
Documentation is available at Html.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see https://nette.org
- 12: *
- 19: */
- 27: /**
- 28: * HTML helper.
- 29: *
- 30: * <code>
- 31: * $anchor = Html::el('a')->href($link)->setText('Nette');
- 32: * $el->class = 'myclass';
- 33: * echo $el;
- 34: *
- 35: * echo $el->startTag(), $el->endTag();
- 36: * </code>
- 37: *
- 41: */
- 43: {
- 61: 'base'=>1,'col'=>1,'link'=>1,'param'=>1,'basefont'=>1,'frame'=>1,'isindex'=>1,'wbr'=>1,'embed'=>1);
- 65: /**
- 66: * Static factory.
- 70: */
- 72: {
- 81: }
- 86: }
- 88: }
- 92: /**
- 93: * Changes element's name.
- 98: */
- 100: {
- 103: }
- 108: }
- 112: /**
- 113: * Returns element's name.
- 115: */
- 117: {
- 119: }
- 123: /**
- 124: * Is element empty?
- 126: */
- 128: {
- 130: }
- 134: /**
- 135: * Overloaded setter for element's attribute.
- 139: */
- 141: {
- 143: }
- 147: /**
- 148: * Overloaded getter for element's attribute.
- 151: */
- 153: {
- 155: }
- 159: /**
- 160: * Overloaded unsetter for element's attribute.
- 163: */
- 165: {
- 167: }
- 171: /**
- 172: * Overloaded setter for element's attribute.
- 176: */
- 178: {
- 183: // append empty value -> ignore
- 190: }
- 193: }
- 197: /**
- 198: * Special setter for element's attribute.
- 202: */
- 204: {
- 208: }
- 211: }
- 215: /**
- 216: * Sets element's HTML content.
- 220: */
- 222: {
- 231: }
- 236: }
- 240: /**
- 241: * Sets element's textual content.
- 245: */
- 247: {
- 249: trigger_error('Html::setText(..., TRUE) is deprecated; use Html::setHtml(...) instead.', E_USER_WARNING);
- 253: }
- 255: }
- 259: /**
- 260: * Gets element's textual content.
- 262: */
- 264: {
- 269: }
- 271: }
- 275: /**
- 276: * Adds new element's child.
- 279: */
- 281: {
- 283: }
- 287: /**
- 288: * Creates and adds a new Html child.
- 292: */
- 294: {
- 297: }
- 301: /**
- 302: * Inserts child node.
- 308: */
- 310: {
- 317: }
- 321: }
- 324: }
- 328: /**
- 329: * Inserts (replaces) child node (\ArrayAccess implementation).
- 333: */
- 335: {
- 337: }
- 341: /**
- 342: * Returns child node (\ArrayAccess implementation).
- 345: */
- 347: {
- 349: }
- 353: /**
- 354: * Exists child node? (\ArrayAccess implementation).
- 357: */
- 359: {
- 361: }
- 365: /**
- 366: * Removes child node (\ArrayAccess implementation).
- 369: */
- 371: {
- 374: }
- 375: }
- 379: /**
- 380: * Required by the \Countable interface.
- 382: */
- 384: {
- 386: }
- 390: /**
- 391: * Removed all children.
- 393: */
- 395: {
- 397: }
- 401: /**
- 402: * Iterates over a elements.
- 406: */
- 408: {
- 410: $deep = $deep > 0 ? RecursiveIteratorIterator::SELF_FIRST : RecursiveIteratorIterator::CHILD_FIRST;
- 415: }
- 416: }
- 420: /**
- 421: * Returns all of children.
- 422: * return array
- 423: */
- 425: {
- 427: }
- 431: /**
- 432: * Renders element's start tag, content and end tag.
- 435: */
- 437: {
- 440: // empty elements are finished now
- 443: }
- 445: // add content
- 448: }
- 454: }
- 455: }
- 457: // add end tag
- 460: return "\n" . str_repeat("\t", $indent - 1) . $s . "\n" . str_repeat("\t", max(0, $indent - 2));
- 461: }
- 463: }
- 468: {
- 470: }
- 474: /**
- 475: * Returns element's start tag.
- 477: */
- 479: {
- 481: return '<' . $this->name . $this->attributes() . (self::$xhtml && $this->isEmpty ? ' />' : '>');
- 485: }
- 486: }
- 490: /**
- 491: * Returns element's end tag.
- 493: */
- 495: {
- 497: }
- 501: /**
- 502: * Returns element's attributes.
- 504: */
- 506: {
- 509: }
- 513: {
- 514: // skip NULLs and false boolean attributes
- 517: // true boolean attribute
- 519: // in XHTML must use unminimized form
- 521: // in HTML should use minimized form
- 527: // prepare into temporary array
- 530: // skip NULLs & empty string; composite 'style' vs. 'others'
- 533: // composite 'style' vs. 'others'
- 535: }
- 542: }
- 544: // add new attribute
- 546: . str_replace(array('&', '"', '<', '>', '@'), array('&', '"', '<', '>', '@'), $value)
- 548: }
- 550: }
- 554: /**
- 555: * Clones all children too.
- 556: */
- 558: {
- 562: }
- 563: }
- 564: }
- 566: }
- 570: /**
- 571: * Recursive HTML element iterator. See Html::getIterator().
- 572: *
- 576: */
- 578: {
- 580: /**
- 581: * The sub-iterator for the current element.
- 583: */
- 585: {
- 587: }
- 589: }