Home » HTML » HTML_Common2
Abstract base class for HTML classes (PHP5 port of HTML_Common package).
Download latest release 2.3.1 (there might be newer Composer installable version)
License: BSD License
Description
HTML_Common2 package provides methods for HTML code display and attributes handling.
* Provides methods to set, remove, merge HTML attributes.
* Handles global document options (charset, linebreak and indentation characters).
* Provides methods to handle indentation and HTML comments (useful in subclasses).
Documentation
Maintainers
- Alexey Borzov (avb) — lead, active
- Klaus Guenther (thesaur) — lead, inactive
Dependencies
Required
- PHP (>= 5.6.0)
- PEAR Installer (>= 1.10.0)
Releases
- 2.3.1 (stable, 2022-03-31)
Release notes
License: BSD License
This release is mostly needed for running psalm on HTML_QuickForm2 package
* Type hints fixed to better reflect reality
* CS fixes, minor changes to parseAttributes() method - 2.3.0 (stable, 2022-03-26)
Release notes
License: BSD License
* Upgraded tests, PHPUnit-Polyfills is used to run them on PHP 5.6 to PHP 8.1
* Test suite now runs on Github Actions rather than on Travis
* The package runs under PHP 8.1 without E_DEPRECATED messages
* Minimum required PHP version is now 5.6 - 2.2.0 (stable, 2021-04-25)
Release notes
License: BSD License
* Minimum required PHP version is now 5.4
* Added constants for predefined global option names
* Fixed composer autoloading to prevent errors on classmap generation,
see https://github.com/pear/HTML_QuickForm2/issues/4 - 2.1.2 (stable, 2019-04-07)
Release notes
License: BSD License
Minor updates to tests setup, no code changes
Removed include-path from composer.json, use autoloading when installing with composer
- 2.1.1 (stable, 2014-06-18)
Release notes
License: BSD License
Minor updates to PHPDoc and tests setup, no code changes
- 2.1.0 (stable, 2012-04-08)
Release notes
License: BSD License
* HTML_Common2 now implements ArrayAccess, allowing more intuitive attribute
handling similar to that of SimpleXML extension
* Unit tests properly run under recent PHPUnit versions and from SVN checkout
* Coding standards fixes - 2.0.0 (stable, 2010-10-20)
Release notes
License: BSD License
* Due to addition of end-user docs to PEAR manual, the package is now
declared stable
* Added array type hinting to removeAttributeArray() and getAttributesString()
methods
* Packaging fix: tests now install without redundant subdirectory, to
@test_dir@/HTML_Common2 rather than to @test_dir@/HTML_Common2/tests - 2.0.0RC1 (beta, 2009-09-27)
Release notes
License: BSD License
* HTML_Common2::getOption() now returns an array of all options if no option
name is given (see request #11209), setOption() can accept an array of options
* Implemented hasClass() / addClass() / removeClass() methods for working with
element's CSS classes (see request #10191).
* Packaging fixes: added AllTests.php, updated PEAR installer dependency - 2.0.0beta1 (beta, 2007-05-04)
Release notes
License: BSD License
* Use phpunit/PHPUnit rather than pear/PHPUnit2 for unit testing needs
* "Fluent interfaces": all methods that didn't return anything now
return $this. The following methods are affected: mergeAttributes(),
removeAttribute(), setAttribute(), setAttributes(), setComment() and
setIndentLevel(). - 0.3.0 (alpha, 2006-10-16)
Release notes
License: BSD License
Radical changes to API are not expected after this release, you may use the
package for development.Changes:
* Renamed 'encoding' option to 'charset', as htmlspecialchars() parameter is named
* Removed toHtml() and display() methods, __toString() is now declared abstract
* Attribute values are always converted to strings
* Minor performance tweaks
* Switched to BSD license and package.xml 2.0 - 0.2.0 (devel, 2006-07-03)
Release notes
License: PHP License
* $attributes array is now protected rather than private (and thus renamed
from $_attributes)
* parseAttributes() was renamed to prepareAttributes(), string parsing logic
was extracted into the new parseAttributes() method
* Added magic __toString() method as an alias for toHtml(), deprecated
display(): it is now possible to print an instance of HTML_Common2 subclass
by simply using the 'echo $object;'
* It is now possible to watch some attributes for changes, this can be used to
- Make attributes read-only (like 'type' attribute of <input /> tag)
- Do some custom processing (update the element's value if its name changes) - 0.1.0 (devel, 2004-10-27)
Release notes
License: PHP License
First release of a new major version.
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #4670 | Closed | Req | 2005-06-23 | Add $options to constructor | |
| #4737 | Bogus | Bug | 2005-07-04 | Class doesn't extend PEAR | |
| #10191 | Closed | Req | 2007-02-26 | [patch] add disabled/class methods to HTML_QuickForm_element | |
| #11209 | Closed | Req | 2.0.0beta1 | 2007-06-02 | Make options's visibility protected |
| #13024 | Wont fix | Req | 2.0.0beta1 | 2008-01-31 | abstract __toString() useless and inconsistent |
| #16039 | Bogus | Bug | 2.0.0beta1 | 2009-03-17 | getAttributesString() uses ENT_QUOTES which breaks IE |
| #16941 | Bogus | Bug | 2.0.0RC1 | 2009-12-23 | logic error in prepareAttributes |
| #17597 | Bogus | Bug | 2.0.0RC1 | 2010-07-15 | package is empty |
| #19118 | Closed | Req | SVN | 2011-12-09 | This version of PHPUnit is not supported. |
| #21051 | Open | Req | 2.1.1 | 2016-04-11 | Keep case |