Download the PHP package dustinwilson/texturize without Composer
On this page you can find all versions of the php package dustinwilson/texturize. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dustinwilson/texturize
More information about dustinwilson/texturize
Files in dustinwilson/texturize
Package texturize
Short Description Translates ASCII punctuation characters into typographically-correct punctuation
License MIT
Informations about the package texturize
Texturize
Translates -- "texturizes" -- ASCII punctuation characters into typographically-correct punctuation. Based loosely off of an ancient Wordpress method used for the same purpose. The major difference with this library is that this library can translate strings in complex markup and within attributes.
Warning Before Using
I have used this code in various forms for more than 10 years, but I am releasing it initially as "beta" software because there are no tests. Writing tests for this will be superficial, but I have to have time to do it.
Requirements
- PHP 8.0.2 or newer with the following extensions:
- dom extension
- Composer 2.0 or newer
Documentation
Texturize is a single static class.
dW\Texturize
Properties
- curlyQuotes (bool): If true, texturizes curly quotes (eg: "" to “”).
- dashes (bool): If true, texturizes dashes (eg: -- to –).
- ellipses (bool): If true, texturizes ellipses (eg: ... to …).
- ignoredAncestors (array): An array of element names whose text node descendants will be ignored.
- includedAttributes (array): An array of XPath snippets corresponding to attributes that should be texturized.
dW\Texturize::withString
"Texturizes" a given string.
data
: The string to "texturize"
dW\Texturize::withDOM
"Texturizes" a given \DOMDocument
or \DOMElement
. It is aware of adjacent elements and will successfully translate complex DOM structures.
node
: The\DOMDocument
or\DOMElement
to texturize.
All versions of texturize with dependencies
ext-dom Version *