first commit
This commit is contained in:
369
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/CHANGELOG.md
vendored
Normal file
369
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
|
||||
## [Unreleased]
|
||||
### Changed
|
||||
- Comments that start with `>` or `->` are now considered malformed in accordance with [section 12.1.6](https://html.spec.whatwg.org/multipage/syntax.html#comments) of the [HTML specification](https://html.spec.whatwg.org/multipage/). Comments may still contain the strings `<!--` or `--!>` and they may still end with `<!-` contrary to the specification.
|
||||
|
||||
## [2.0-RC2] - 2019-11-09
|
||||
|
||||
**Important**: This is a release **candidate**, which means some features might not yet be stable or emit unexpected behavior. Please don't hesitate to report broken or unstable features.
|
||||
|
||||
### Added
|
||||
- Added a `README` file.
|
||||
- Added a `composer` file.
|
||||
- Added `.travis.yml` for automated unit tests with `Travis-CI`.
|
||||
- Added the magic method `__debugInfo` to `HtmlDocument` and `HtmlNode` in order to reduce the memory footprint and to prevent recursion errors when using `print_r` and `var_dump`.
|
||||
- Added the magic method `__call` to `HtmlDocument` and `HtmlNode` as a wrapper for deprecated methods using the lowercase calling convention (see below).
|
||||
- Added unit tests `attribute_test.php`, `callback_test.php`, `debug_info_test.php`, `doctype_test.php`, `script_test.php`, `server_side_script_test.php`, `style_test.php` and `dom_manipulation_test.php`.
|
||||
- Added and extended unit tests for `cdata_test.php` and `comment_test.php`.
|
||||
- Added a new `Debug` class to inform users about deprecated functions, malformed documents and parsing issues.
|
||||
- Added full support for `script` element parsing.
|
||||
### Changed
|
||||
- Renamed unit test `simple_html_dom_test.php` to `htmldocument_test.php`.
|
||||
- Renamed unit test `simple_html_dom_node_test.php` to `htmlnode_test.php`.
|
||||
- Changed the implementation of destructors for better garbage collection.
|
||||
- Changed how literal elements (`script`, `style`, `cdata`, "comment" and `code`) are handled by `HtmlDocument`.
|
||||
### Deprecated
|
||||
- `HtmlDocument::clear()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `unset()` instead.
|
||||
- `HtmlDocument::load_file()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlDocument::loadFile()` instead.
|
||||
- `HtmlNode::children()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::childNodes()` instead.
|
||||
- `HtmlNode::first_child()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::firstChild()` instead.
|
||||
- `HtmlNode::has_child()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::hasChild()` instead.
|
||||
- `HtmlNode::last_child()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::lastChild()` instead.
|
||||
- `HtmlNode::next_sibling()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::nextSibling()` instead.
|
||||
- `HtmlNode::prev_sibling()` has been deprecated and will be removed in the next major version of simplehtmldom. Use `HtmlNode::previousSibling()` instead.
|
||||
- Support for Smarty scripts has been deprecated and will be removed in the next major version of simplehtmldom.
|
||||
- Support for server-side scripts has been deprecated and will be removed in the next major version of simplehtmldom.
|
||||
### Removed
|
||||
- Removed the `testcase/` folder as all tests are covered by unit tests inside `tests/`.
|
||||
### Fixed
|
||||
- Fixed a bug with boolean attributes that were incorrectly represented with a value of "1" when saving the DOM.
|
||||
- Fixed a bug with comment and CDATA parsing that could cause an infinite loop if any of these elements contained `script`, `style`, `code`, server-side php or Smarty tags.
|
||||
- Fixed a bug with comment and CDATA parsing that resulted in whitespace and newlines being removed when loading a document with `$stripRN = true` (default setting).
|
||||
- Fixed a bug with attribute values that resulted in incorrectly encoded content when using `outertext()`, `innertext()` or `save()`.
|
||||
- Fixed a bug with charset encoding that resulted in partially encoded documents depending on the use of `outertext()` and `innertext()` [#178](https://sourceforge.net/p/simplehtmldom/bugs/178/)
|
||||
- Fixed multiple bugs related to DOM manipulation when using `HtmlDocument::createElement()`, `HtmlDocument::createTextNode()` and `HtmlNode::appendChild()`.
|
||||
|
||||
## [2.0-RC1] - 2019-10-20
|
||||
|
||||
**Important**: This is a release **candidate**, which means some features might not yet be stable or emit unexpected behavior. Please don't hesitate to report broken or unstable features.
|
||||
|
||||
### Added
|
||||
- Added unit tests
|
||||
- Added tests for whitespace handling.
|
||||
- Added tests for entity decoding.
|
||||
- Added tests for node functions after calling remove().
|
||||
- Added tests for `maxLen` in `file_get_html`.
|
||||
- Added tests for `simple_html_dom_node`.
|
||||
- Added tests for `HtmlWeb`.
|
||||
- Added test for bug [#172](https://sourceforge.net/p/simplehtmldom/bugs/172/)
|
||||
- Added optional argument `$trim = true` to `$node->text()`
|
||||
- Added attribute value normalization
|
||||
- https://www.w3.org/TR/html/syntax.html#attribute-values
|
||||
- https://www.w3.org/TR/xml/#AVNormalize
|
||||
- Added automatic HTML entity decoding when loading documents [feature:#52]
|
||||
- Added [the negation pseudo-class](https://www.w3.org/TR/selectors-3/#negation)
|
||||
- Added `simple_html_dom::expect()`.
|
||||
- Added `simple_html_dom_node::expect()`.
|
||||
- Added the ability to parse CDATA sections.
|
||||
- Added `HtmlWeb` to directly load webpages via cURL or fopen as DOM.
|
||||
- Added `HtmlDocument`, `HtmlNode`, `HtmlWeb` and `constants` to namespace `simplehtmldom`.
|
||||
- Added a new element type `HDOM_TYPE_CDATA` for CDATA sections.
|
||||
- Added full support for parsing comments and CDATA sections.
|
||||
### Changed
|
||||
- `simple_html_dom::doc` is now unset after loading the DOM.
|
||||
- `simple_html_dom::restore_noise()` now clears restored elements.
|
||||
- `simple_html_dom_node::_[HDOM_INFO_ENDSPACE]` now only exists if needed.
|
||||
- `simple_html_dom_node::_[HDOM_INFO_SPACE]`
|
||||
- Now stores elements by attribute names.
|
||||
- Now only exists if needed (defaults to `array(' ', '', '')`).
|
||||
- `simple_html_dom_node::_[HDOM_INFO_QUOTE]`
|
||||
- Now stores elements by attribute names.
|
||||
- Now only exists if needed (defaults to `HDOM_QUOTE_DOUBLE`).
|
||||
- `simple_html_dom_node::text()` now supports all block and inline level elements.
|
||||
- `simple_html_dom_node::text()` now skips empty block elements.
|
||||
- `simple_html_dom_node::text()` now properly handles ` ` characters.
|
||||
- `simple_html_dom_node::removeChild()` now removes all types of children.
|
||||
- Increased `MAX_FILE_SIZE` from 0.6 MB (600000 Bytes) to 2.5 MiB (2621440 Bytes)
|
||||
- `HDOM_INFO_INNER` (innertext) is now stored as part of the owning element.
|
||||
- Moved and renamed `simple_html_dom` to `HtmlDocument`.
|
||||
- Moved and renamed `simple_html_dom_node` to `HtmlNode`.
|
||||
- Moved constants to `constants.php`
|
||||
- Moved `HDOM_TYPE_*`, `HDOM_INFO_*` and `HDOM_QUOTE_*` constants into `HtmlNode`.
|
||||
### Removed
|
||||
- Removed `/example/scraping/example_scraping_general.php`.
|
||||
- Removed `/example/simple_html_dom_utility.php`.
|
||||
- Removed `/app`.
|
||||
- Removed `/testcase/reader`.
|
||||
- Removed `simple_html_dom_node::tag_start`.
|
||||
### Fixed
|
||||
- Fixed fatal error when removing nodes from the DOM (#172)
|
||||
- Fixed `simple_html_dom::parse()` to work after removing elements from the DOM.
|
||||
- Fixed `simple_html_dom_node::text()` to properly handle UTF-8 characters.
|
||||
- Fixed all scripts in the example folder.
|
||||
- Fixed `file_get_html` to return false if the file size is larger than `maxLen`.
|
||||
- Fixed a bug that caused the parser to convert UTF-8 to UTF-8 on mistake.
|
||||
- Fixed `simple_html_dom::loadFile` to properly forward arguments to `simple_html_dom::load_file`.
|
||||
- Fixed handling of optional closing tags to end on the last element.
|
||||
- Fixed broken support for `text` nodes when using `find` (#175).
|
||||
|
||||
## [1.9] - 2019-05-30
|
||||
### Added
|
||||
- Added unit test for bug reports
|
||||
- Added test for bug [#153](https://sourceforge.net/p/simplehtmldom/bugs/153/)
|
||||
- Added test for bug [#163](https://sourceforge.net/p/simplehtmldom/bugs/163/)
|
||||
- Added test for bug [#166](https://sourceforge.net/p/simplehtmldom/bugs/166/)
|
||||
- Added test for bug [#169](https://sourceforge.net/p/simplehtmldom/bugs/169/)
|
||||
- Added unit test for character sets UTF-8, CP1251 and CP1252 (#142)
|
||||
- Added support for meta charset to parse_charset
|
||||
- Added detection for CP1251 to parse_charset, using iconv
|
||||
- Added LICENSE file (MIT) to the project root
|
||||
- Added functions to `simple_html_dom_node`
|
||||
- `remove`: Removes the current node recursively from the DOM tree
|
||||
- `removeChild`: Removes a child node recursively from the DOM tree
|
||||
- `hasClass`: Checks if the current node has the specified class name
|
||||
- `addClass`: Adds one or more classes to the current node
|
||||
- `removeClass`: Removes one or more classes from the current node
|
||||
- `save`: Saves the current node to disk
|
||||
### Changed
|
||||
- Changed manual from custom implementation to MkDocs (https://www.mkdocs.org/)
|
||||
### Fixed
|
||||
- Fixed warning when trying to clear() the DOM on a null nodes list (#153)
|
||||
- Fixed missing whitespace when returning plaintext (#163)
|
||||
- Fixed broken detection of duplicate attributes (#166)
|
||||
- Fixed broken detection of CP1252 (ISO-8859-1) documents (#142)
|
||||
- Fixed error using next-sibling combinator ('E + F') on last child
|
||||
- Fixed selector parsing for attribute selectors ending on "s" or "i" (#169)
|
||||
|
||||
## [1.8.1] - 2019-01-13
|
||||
### Fixed
|
||||
- Fixed various bugs related to parsing classes and ids
|
||||
|
||||
## [1.8] - 2019-01-13
|
||||
### Added
|
||||
- Added documentation for `simple_html_dom_node::find`
|
||||
- Added documentation for `simple_html_dom_node::parse_selector`
|
||||
- Added documentation for `simple_html_dom_node::seek`
|
||||
- Added documentation for `simple_html_dom_node::match`
|
||||
- Added unit tests for bug reports
|
||||
- Added test for bug [#62](https://sourceforge.net/p/simplehtmldom/bugs/62/)
|
||||
- Added test for bug [#79](https://sourceforge.net/p/simplehtmldom/bugs/79/)
|
||||
- Added test for bug [#144](https://sourceforge.net/p/simplehtmldom/bugs/144/)
|
||||
- Added unit tests for CSS selectors
|
||||
- Added ability to define constants before simple_html_dom does
|
||||
- 'DEFAULT_TARGET_CHARSET'
|
||||
- 'DEFAULT_BR_TEXT'
|
||||
- 'DEFAULT_SPAN_TEXT'
|
||||
- 'MAX_FILE_SIZE'
|
||||
- Added support for CSS combinators
|
||||
- Added support for Child Combinator (`>`)
|
||||
- Added support for Next Sibling Combinator (`+`)
|
||||
- Added support for Subsequent Sibling Combinator (`~`)
|
||||
- Added support for multiclass selectors (`.class.class.class`)
|
||||
- Added support for multi-attribute selectors (`[attr1][attr2][attribute3]`)
|
||||
- Added support for attribute selectors
|
||||
- Added support for pipe selectors (`|=`)
|
||||
- Added support for tilde selectors (`~=`)
|
||||
- Added support for case sensitivity selectors (`i` and `s`)
|
||||
- Added unit tests for PHP compatibility to PHP 5.6+
|
||||
- Added coding standard using PHP_CodeSniffer
|
||||
### Changed
|
||||
- Removed automatic filtering of 'tbody' selectors (#79)
|
||||
> Remove 'tbody' from all selectors to maintain the previous state!
|
||||
- Coding standard using PHP_CodeSniffer
|
||||
### Fixed
|
||||
- Fixed broken CSS selector attributes with value "0" (#62)
|
||||
- Fixed broken simple_html_dom::load_file
|
||||
- Fixed forward slashes in CSS selector breaks value matching using '*=' (#144)
|
||||
- Fixed Universal Selectors
|
||||
|
||||
## [1.7] - 2018-12-10
|
||||
### Added
|
||||
- Added code documentation to improve readability
|
||||
- Added unit tests for `simple_html_dom::$self_closing_tags`
|
||||
- Added unit tests for `simple_html_dom::$optional_closing_tags`
|
||||
- Added unit tests for bug reports
|
||||
- Added test for bug [#56](https://sourceforge.net/p/simplehtmldom/bugs/56/)
|
||||
- Added test for bug [#97](https://sourceforge.net/p/simplehtmldom/bugs/97/)
|
||||
- Added test for bug [#116](https://sourceforge.net/p/simplehtmldom/bugs/116/)
|
||||
- Added test for bug [#121](https://sourceforge.net/p/simplehtmldom/bugs/127/)
|
||||
- Added test for bug [#127](https://sourceforge.net/p/simplehtmldom/bugs/127/)
|
||||
- Added test for bug [#154](https://sourceforge.net/p/simplehtmldom/bugs/154/)
|
||||
- Added test for bug [#160](https://sourceforge.net/p/simplehtmldom/bugs/160/)
|
||||
- Added unit tests for memory management of the parser
|
||||
- Added bit flags to `simple_html_dom::load()`
|
||||
- Added bit flag `HDOM_SMARTY_AS_TEXT` to optionally filter Smarty scripts (#154)\
|
||||
**Note**: Smarty scripts are no longer filtered by default!\
|
||||
- Added build script to automate releases
|
||||
- Added support for attributes without whitespace to separate them
|
||||
### Changed
|
||||
- Improved documentation and readability for `$self_closing_tags`
|
||||
- Improved documentation and readability for `$block_tags`
|
||||
- Improved documentation and readability for `$optional_closing_tags`
|
||||
- Updated list of `simple_html_dom::$self_closing_tags`
|
||||
- Removed 'spacer' (obsolete)
|
||||
- Added 'area'
|
||||
- Added 'col'
|
||||
- Added 'meta'
|
||||
- Added 'param'
|
||||
- Added 'source'
|
||||
- Added 'track'
|
||||
- Added 'wbr'
|
||||
- Updated list of `simple_html_dom::$optional_closing_tags`
|
||||
- Removed `nobr` (obsolete)
|
||||
- Added 'th' as closable element to 'td'
|
||||
- Added 'td' as closable element to 'th'
|
||||
- Added 'optgroup' with 'optgroup' and 'option' as closable elements
|
||||
- Added 'optgroup' as closable element to 'option'
|
||||
- Added 'rp' with 'rp' and 'rt' as closable elements
|
||||
- Added 'rt' with 'rt' and 'rp' as closable elements
|
||||
- Clarified meaning of `simple_html_dom->parent`
|
||||
- Changed default `$offset` for `file_get_html()` from -1 to 0 (#161)
|
||||
- Changed `simple_html_dom::load()` to remove script tags before replacing newline characters
|
||||
- `simple_html_dom_node::text()` no longer adds whitespace to top level span elements (only to sub-elements)
|
||||
- `simple_html_dom_node::text()` adds blank lines between paragraphs
|
||||
- Normalized line endings in the repository to LF via `.gitattributes`
|
||||
- Improved performance of `simple_html_dom::parse_charset()` by approximately 25%
|
||||
- Improved performance of `simple_html_dom::parse()` by approximately 10%
|
||||
### Deprecated
|
||||
- `str_get_html()` is deprecated and should be replaced by `new simple_html_dom()`
|
||||
### Removed
|
||||
- Removed protected function `simple_html_dom::copy_until_char_escaped()`
|
||||
### Fixed
|
||||
- Fixed compatibility issues with PHP 7.3
|
||||
- Fixed typo (#147)
|
||||
- Fixed handling of incorrectly escaped text (#160)
|
||||
- Restore functionality of `$maxLen` in `file_get_html()`
|
||||
- Fixed load_file breaks if an error occurred in another script
|
||||
|
||||
## [1.6] - 2014-05-28
|
||||
### Added
|
||||
- Added some ability to insert and create nodes
|
||||
- Add ability to search the "noise" array
|
||||
|
||||
## [1.5] - 2012-09-10
|
||||
### Added
|
||||
- Added flag: LOCK_EX while calling "file_put_contents()"
|
||||
- Added support for detecting the source html character set. This is used to convert characters when plaintext is requested.
|
||||
- Other little fixes and features, too numerous to categorize
|
||||
### Changed
|
||||
- Error of "file_get_contents()" will be thrown as an exception
|
||||
### Fixed
|
||||
- Fixed the typo of "token_blank_t"
|
||||
- Memory leak fixed
|
||||
|
||||
## [1.11] - 2008-12-14
|
||||
### Added
|
||||
- Supports xpath generated from Firebug
|
||||
- New method "dump" of "simple_html_dom_node"
|
||||
- New attribute "xmltext" of "simple_html_dom_node"
|
||||
### Changed
|
||||
- Remove preg_quote on selector match function: `[attribute*=value]`
|
||||
- Element "Comment" will treat as children
|
||||
### Fixed
|
||||
- Fixed the problem with `<pre>`
|
||||
- Fixed bug #2207477 (does not load some pages properly)
|
||||
- Fixed bug #2315853 (Error with character after < sign)
|
||||
|
||||
## [1.10] - 2008-10-25
|
||||
### Changed
|
||||
- Negative indexes supports of "find" method, thanks for Vadim Voituk
|
||||
- Constructor with automatically load contents either text or file/url, thanks for Antcs
|
||||
- Fully supports wildcard in selectors
|
||||
### Fixed
|
||||
- Fixed bug of confusing by the < symbol inside the text
|
||||
- Fixed bug of dash in selectors
|
||||
- Fixed bug of `<nobr>`
|
||||
- Fixed bug #2155883 (Nested List Parses Incorrectly)
|
||||
- Fixed bug #2155113 (error with unclosed html tags)
|
||||
|
||||
## [1.00] - 2008-09-05
|
||||
### Added
|
||||
- New method "getAllAttributes" of "simple_html_dom_node"
|
||||
- Supports full javascript string in selector: `$e->find("a[onclick=alert('hello')]")`
|
||||
### Changed
|
||||
- Changed selector "*=" to case-insensitive
|
||||
### Fixed
|
||||
- Fixed the bug of selector in some critical conditions
|
||||
- Fixed the bug of striping php tags
|
||||
- Fixed the bug of remove_noise()
|
||||
- Fixed the bug of noise in attributes
|
||||
|
||||
## [0.99] - 2008-08-03
|
||||
### Changed
|
||||
- Performance tuning (boost 10%)
|
||||
- Memory requirement reduced by 25%
|
||||
- Changed function name from "file_get_dom()" to "file_get_html()"
|
||||
- Changed function name from "str_get_dom()" to "str_get_html()"
|
||||
### Fixed
|
||||
- Fixed bug #2011286 (Error with unclosed html tags)
|
||||
- Fixed bug #2012551 (Error parsing divs)
|
||||
- Fixed bug #2020924 (Error for missed tag)
|
||||
- Fixed bug (problem with `<body>` tag's innertext)
|
||||
|
||||
## [0.98] - 2008-06-24
|
||||
### Added
|
||||
- Supports "multiple class" selector feature: `<div class="a b c"></div>`
|
||||
- New "callback function" feature
|
||||
- New "multiple selectors" feature: $dom->find('p,a,b')
|
||||
- New examples
|
||||
- Supports extract contents from HTML features: $dom->plaintext
|
||||
### Changed
|
||||
- Performance tuning (boost 20%)
|
||||
- Changed simple_html_dom_node method name from "text()" to "makeup()"
|
||||
### Fixed
|
||||
- Fixed the bug of $dom->clear()
|
||||
- Fixed the bug of text nodes' innertext
|
||||
- Fixed the bug of comment nodes' innertext
|
||||
- Fixed the bug of descendant selector with optional tags
|
||||
|
||||
## [0.97] - 2008-05-09
|
||||
### Added
|
||||
- New node type "comment" (eg. $dom->find('comment'))
|
||||
- Add self-closing tags: 'base', 'spacer'
|
||||
- New example "simple_html_dom_utility.php"
|
||||
### Changed
|
||||
- File and class name changed (html_dom_parser->simple_html_dom)
|
||||
### Removed
|
||||
- ($dom->save_file) will not support anymore
|
||||
- Remove example "example_customize_parser.php"
|
||||
### Fixed
|
||||
- Fixed the bug of outertext (th)
|
||||
- Fixed the bug of regular expression escaping chars ($dom->find)
|
||||
- Fixed the bug while line-breaker and "\t" in tags
|
||||
|
||||
## [0.96] - 2008-04-27
|
||||
### Added
|
||||
- Reference section in manual
|
||||
- Added traverse section in manual
|
||||
- Added the solution while server behind proxy in FAQ (Thanks to Yousuke Shaggy)
|
||||
- New method to remove attribute.
|
||||
- New DOM operations(first_child, last_child, next_sibling, previous_sibling) (Request #1936000)
|
||||
### Changed
|
||||
- Now file_get_dom supports full file_get_contents parameters
|
||||
### Fixed
|
||||
- Fixed the bug of self-closing tags in the end of file
|
||||
- Fixed the bug of blanks in the end of tag
|
||||
- Fixed some typo of testcase
|
||||
|
||||
## [0.95] - 2008-04-13
|
||||
### Added
|
||||
- Supports tag name with namespace
|
||||
### Changed
|
||||
- New attribute filters (Thanks to Yousuke Kumakura)
|
||||
- Refine structure of testcase
|
||||
### Fixed
|
||||
- Fix the bug of optional-closing tags
|
||||
- Fix the bug of parsing the line break next to the tag's name
|
||||
|
||||
## [0.94] - 2008-04-06
|
||||
### Added
|
||||
- Add FAQ section in manual
|
||||
### Fixed
|
||||
- Fixed infinity loop while the source content is BAD HTML
|
||||
- Fixed the bug of adding new attributes to self-closing tags
|
||||
- Fixed the bug of customize parser without $dom->remove_noise()
|
||||
151
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/Debug.php
vendored
Normal file
151
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/Debug.php
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php namespace simplehtmldom;
|
||||
|
||||
/**
|
||||
* Website: http://sourceforge.net/projects/simplehtmldom/
|
||||
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* See the LICENSE file in the project root for more information.
|
||||
*
|
||||
* Authors:
|
||||
* S.C. Chen
|
||||
* John Schlick
|
||||
* Rus Carroll
|
||||
* logmanoriginal
|
||||
*
|
||||
* Contributors:
|
||||
* Yousuke Kumakura
|
||||
* Vadim Voituk
|
||||
* Antcs
|
||||
*
|
||||
* Version $Rev$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements functions for debugging purposes. Debugging can be enabled and
|
||||
* disabled on demand. Debug messages are send to error_log by default but it
|
||||
* is also possible to register a custom debug handler.
|
||||
*/
|
||||
class Debug {
|
||||
|
||||
private static $enabled = false;
|
||||
private static $debugHandler = null;
|
||||
private static $callerLock = array();
|
||||
|
||||
/**
|
||||
* Checks whether debug mode is enabled.
|
||||
*
|
||||
* @return bool True if debug mode is enabled, false otherwise.
|
||||
*/
|
||||
public static function isEnabled()
|
||||
{
|
||||
return self::$enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables debug mode
|
||||
*/
|
||||
public static function enable()
|
||||
{
|
||||
self::$enabled = true;
|
||||
self::log('Debug mode has been enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables debug mode
|
||||
*/
|
||||
public static function disable()
|
||||
{
|
||||
self::log('Debug mode has been disabled');
|
||||
self::$enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the debug handler.
|
||||
*
|
||||
* `null`: error_log (default)
|
||||
*/
|
||||
public static function setDebugHandler($function = null)
|
||||
{
|
||||
if ($function === self::$debugHandler) return;
|
||||
|
||||
self::log('New debug handler registered');
|
||||
self::$debugHandler = $function;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the actual log function. It allows to set a custom backtrace to
|
||||
* eliminate traces of this class.
|
||||
*/
|
||||
private static function log_trace($message, $backtrace)
|
||||
{
|
||||
$idx = 0;
|
||||
$debugMessage = '';
|
||||
|
||||
foreach($backtrace as $caller)
|
||||
{
|
||||
if (!isset($caller['file']) && !isset($caller['line'])) {
|
||||
break; // Unknown caller
|
||||
}
|
||||
|
||||
$debugMessage .= ' [' . $caller['file'] . ':' . $caller['line'];
|
||||
|
||||
if ($idx > 1) { // Do not include the call to Debug::log
|
||||
$debugMessage .= ' '
|
||||
. $caller['class']
|
||||
. $caller['type']
|
||||
. $caller['function']
|
||||
. '()';
|
||||
}
|
||||
|
||||
$debugMessage .= ']';
|
||||
|
||||
// Stop at the first caller that isn't part of simplehtmldom
|
||||
if (!isset($caller['class']) || strpos($caller['class'], 'simplehtmldom\\') !== 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
$idx++;
|
||||
}
|
||||
|
||||
$output = '[DEBUG] ' . trim($debugMessage) . ' "' . $message . '"';
|
||||
|
||||
if (is_null(self::$debugHandler)) {
|
||||
error_log($output);
|
||||
} else {
|
||||
call_user_func_array(self::$debugHandler, array($output));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a debug message to error_log if debug mode is enabled. Does nothing
|
||||
* if debug mode is disabled.
|
||||
*
|
||||
* @param string $message The message to add to error_log
|
||||
*/
|
||||
public static function log($message)
|
||||
{
|
||||
if (!self::isEnabled()) return;
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||
self::log_trace($message, $backtrace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a debug message to error_log if debug mode is enabled. Does nothing
|
||||
* if debug mode is disabled. Each message is logged only once.
|
||||
*
|
||||
* @param string $message The message to add to error_log
|
||||
*/
|
||||
public static function log_once($message)
|
||||
{
|
||||
if (!self::isEnabled()) return;
|
||||
|
||||
// Keep track of caller (file & line)
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||
if (in_array($backtrace[0], self::$callerLock, true)) return;
|
||||
|
||||
self::$callerLock[] = $backtrace[0];
|
||||
self::log_trace($message, $backtrace);
|
||||
}
|
||||
}
|
||||
1105
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlDocument.php
vendored
Normal file
1105
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlDocument.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
353
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlElement.php
vendored
Normal file
353
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlElement.php
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2022, logmanoriginal
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
namespace simplehtmldom;
|
||||
|
||||
class HtmlElement
|
||||
{
|
||||
const A = 'a';
|
||||
const ABBR = 'abbr';
|
||||
const ADDRESS = 'address';
|
||||
const AREA = 'area';
|
||||
const ARTICLE = 'article';
|
||||
const ASIDE = 'aside';
|
||||
const AUDIO = 'audio';
|
||||
const B = 'b';
|
||||
const BASE = 'base';
|
||||
const BDI = 'bdi';
|
||||
const BDO = 'bdo';
|
||||
const BLOCKQUOTE = 'blockquote';
|
||||
const BR = 'br';
|
||||
const BUTTON = 'button';
|
||||
const CANVAS = 'canvas';
|
||||
const CITE = 'cite';
|
||||
const CODE = 'code';
|
||||
const COL = 'col';
|
||||
const DATA = 'data';
|
||||
const DATALIST = 'datalist';
|
||||
const DEL = 'del';
|
||||
const DETAILS = 'details';
|
||||
const DFN = 'dfn';
|
||||
const DIV = 'div';
|
||||
const DL = 'dl';
|
||||
const EM = 'em';
|
||||
const EMBED = 'embed';
|
||||
const FIELDSET = 'fieldset';
|
||||
const FIGURE = 'figure';
|
||||
const FOOTER = 'footer';
|
||||
const FORM = 'form';
|
||||
const H1 = 'h1';
|
||||
const H2 = 'h2';
|
||||
const H3 = 'h3';
|
||||
const H4 = 'h4';
|
||||
const H5 = 'h5';
|
||||
const H6 = 'h6';
|
||||
const HEADER = 'header';
|
||||
const HGROUP = 'hgroup';
|
||||
const HR = 'hr';
|
||||
const I = 'i';
|
||||
const IFRAME = 'iframe';
|
||||
const IMG = 'img';
|
||||
const INPUT = 'input';
|
||||
const INS = 'ins';
|
||||
const KBD = 'kbd';
|
||||
const LABEL = 'label';
|
||||
const LINK = 'link';
|
||||
const MAIN = 'main';
|
||||
const MAP = 'map';
|
||||
const MARK = 'mark';
|
||||
const MATH = 'math';
|
||||
const MENU = 'menu';
|
||||
const META = 'meta';
|
||||
const METER = 'meter';
|
||||
const NAV = 'nav';
|
||||
const NOSCRIPT = 'noscript';
|
||||
const OBJECT = 'object';
|
||||
const OL = 'ol';
|
||||
const OUTPUT = 'output';
|
||||
const P = 'p';
|
||||
const PARAM = 'param';
|
||||
const PICTURE = 'picture';
|
||||
const PRE = 'pre';
|
||||
const PROGRESS = 'progress';
|
||||
const Q = 'q';
|
||||
const RUBY = 'ruby';
|
||||
const S = 's';
|
||||
const SAMP = 'samp';
|
||||
const SCRIPT = 'script';
|
||||
const SECTION = 'section';
|
||||
const SELECT = 'select';
|
||||
const SLOT = 'slot';
|
||||
const SMALL = 'small';
|
||||
const SOURCE = 'source';
|
||||
const SPAN = 'span';
|
||||
const STRONG = 'strong';
|
||||
const STYLE = 'style';
|
||||
const SUB = 'sub';
|
||||
const SUP = 'sup';
|
||||
const SVG = 'svg';
|
||||
const TABLE = 'table';
|
||||
const TEMPLATE = 'template';
|
||||
const TEXTAREA = 'textarea';
|
||||
const TIME = 'time';
|
||||
const TITLE = 'title';
|
||||
const TRACK = 'track';
|
||||
const U = 'u';
|
||||
const UL = 'ul';
|
||||
// TODO: Rename '_VAR' to 'VAR' when changing language level to PHP 7.0+
|
||||
const _VAR = 'var';
|
||||
const VIDEO = 'video';
|
||||
const WBR = 'wbr';
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#embedded-content-2
|
||||
static function isEmbeddedContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::AUDIO
|
||||
|| $element === self::CANVAS
|
||||
|| $element === self::EMBED
|
||||
|| $element === self::IFRAME
|
||||
|| $element === self::IMG
|
||||
|| $element === self::MATH
|
||||
|| $element === self::OBJECT
|
||||
|| $element === self::PICTURE
|
||||
|| $element === self::SVG
|
||||
|| $element === self::VIDEO;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#heading-content
|
||||
static function isHeadingContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::H1
|
||||
|| $element === self::H2
|
||||
|| $element === self::H3
|
||||
|| $element === self::H4
|
||||
|| $element === self::H5
|
||||
|| $element === self::H6
|
||||
|| $element === self::HGROUP;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#interactive-content
|
||||
static function isInteractiveContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::A
|
||||
|| $element === self::AUDIO
|
||||
|| $element === self::BUTTON
|
||||
|| $element === self::DETAILS
|
||||
|| $element === self::EMBED
|
||||
|| $element === self::IFRAME
|
||||
|| $element === self::IMG
|
||||
|| $element === self::INPUT
|
||||
|| $element === self::LABEL
|
||||
|| $element === self::SELECT
|
||||
|| $element === self::TEXTAREA
|
||||
|| $element === self::VIDEO;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#metadata-content
|
||||
static function isMetadataContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::BASE
|
||||
|| $element === self::LINK
|
||||
|| $element === self::META
|
||||
|| $element === self::NOSCRIPT
|
||||
|| $element === self::SCRIPT
|
||||
|| $element === self::STYLE
|
||||
|| $element === self::TEMPLATE
|
||||
|| $element === self::TITLE;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#palpable-content
|
||||
static function isPalpableContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::A
|
||||
|| $element === self::ABBR
|
||||
|| $element === self::ADDRESS
|
||||
|| $element === self::ARTICLE
|
||||
|| $element === self::ASIDE
|
||||
|| $element === self::AUDIO
|
||||
|| $element === self::B
|
||||
|| $element === self::BDI
|
||||
|| $element === self::BDO
|
||||
|| $element === self::BLOCKQUOTE
|
||||
|| $element === self::BUTTON
|
||||
|| $element === self::CANVAS
|
||||
|| $element === self::CITE
|
||||
|| $element === self::CODE
|
||||
|| $element === self::DATA
|
||||
|| $element === self::DETAILS
|
||||
|| $element === self::DFN
|
||||
|| $element === self::DIV
|
||||
|| $element === self::DL
|
||||
|| $element === self::EM
|
||||
|| $element === self::EMBED
|
||||
|| $element === self::FIELDSET
|
||||
|| $element === self::FIGURE
|
||||
|| $element === self::FOOTER
|
||||
|| $element === self::FORM
|
||||
|| $element === self::H1
|
||||
|| $element === self::H2
|
||||
|| $element === self::H3
|
||||
|| $element === self::H4
|
||||
|| $element === self::H5
|
||||
|| $element === self::H6
|
||||
|| $element === self::HEADER
|
||||
|| $element === self::HGROUP
|
||||
|| $element === self::I
|
||||
|| $element === self::IFRAME
|
||||
|| $element === self::IMG
|
||||
|| $element === self::INPUT
|
||||
|| $element === self::INS
|
||||
|| $element === self::KBD
|
||||
|| $element === self::LABEL
|
||||
|| $element === self::MAIN
|
||||
|| $element === self::MAP
|
||||
|| $element === self::MARK
|
||||
|| $element === self::MATH
|
||||
|| $element === self::MENU
|
||||
|| $element === self::METER
|
||||
|| $element === self::NAV
|
||||
|| $element === self::OBJECT
|
||||
|| $element === self::OL
|
||||
|| $element === self::OUTPUT
|
||||
|| $element === self::P
|
||||
|| $element === self::PRE
|
||||
|| $element === self::PROGRESS
|
||||
|| $element === self::Q
|
||||
|| $element === self::RUBY
|
||||
|| $element === self::S
|
||||
|| $element === self::SAMP
|
||||
|| $element === self::SECTION
|
||||
|| $element === self::SELECT
|
||||
|| $element === self::SMALL
|
||||
|| $element === self::SPAN
|
||||
|| $element === self::STRONG
|
||||
|| $element === self::SUB
|
||||
|| $element === self::SUP
|
||||
|| $element === self::SVG
|
||||
|| $element === self::TABLE
|
||||
|| $element === self::TEXTAREA
|
||||
|| $element === self::TIME
|
||||
|| $element === self::U
|
||||
|| $element === self::UL
|
||||
|| $element === self::_VAR
|
||||
|| $element === self::VIDEO;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
||||
static function isPhrasingContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::A
|
||||
|| $element === self::ABBR
|
||||
|| $element === self::AREA
|
||||
|| $element === self::AUDIO
|
||||
|| $element === self::B
|
||||
|| $element === self::BDI
|
||||
|| $element === self::BDO
|
||||
|| $element === self::BR
|
||||
|| $element === self::BUTTON
|
||||
|| $element === self::CANVAS
|
||||
|| $element === self::CITE
|
||||
|| $element === self::CODE
|
||||
|| $element === self::DATA
|
||||
|| $element === self::DATALIST
|
||||
|| $element === self::DEL
|
||||
|| $element === self::DFN
|
||||
|| $element === self::EM
|
||||
|| $element === self::EMBED
|
||||
|| $element === self::I
|
||||
|| $element === self::IFRAME
|
||||
|| $element === self::IMG
|
||||
|| $element === self::INPUT
|
||||
|| $element === self::INS
|
||||
|| $element === self::KBD
|
||||
|| $element === self::LABEL
|
||||
|| $element === self::LINK
|
||||
|| $element === self::MAP
|
||||
|| $element === self::MARK
|
||||
|| $element === self::MATH
|
||||
|| $element === self::META
|
||||
|| $element === self::METER
|
||||
|| $element === self::NOSCRIPT
|
||||
|| $element === self::OBJECT
|
||||
|| $element === self::OUTPUT
|
||||
|| $element === self::PICTURE
|
||||
|| $element === self::PROGRESS
|
||||
|| $element === self::Q
|
||||
|| $element === self::RUBY
|
||||
|| $element === self::S
|
||||
|| $element === self::SAMP
|
||||
|| $element === self::SCRIPT
|
||||
|| $element === self::SELECT
|
||||
|| $element === self::SLOT
|
||||
|| $element === self::SMALL
|
||||
|| $element === self::SPAN
|
||||
|| $element === self::STRONG
|
||||
|| $element === self::SUB
|
||||
|| $element === self::SUP
|
||||
|| $element === self::SVG
|
||||
|| $element === self::TEMPLATE
|
||||
|| $element === self::TEXTAREA
|
||||
|| $element === self::TIME
|
||||
|| $element === self::U
|
||||
|| $element === self::_VAR
|
||||
|| $element === self::VIDEO
|
||||
|| $element === self::WBR;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#sectioning-content
|
||||
static function isSectioningContent($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::ARTICLE
|
||||
|| $element === self::ASIDE
|
||||
|| $element === self::NAV
|
||||
|| $element === self::SECTION;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
|
||||
static function isRawTextElement($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::SCRIPT
|
||||
|| $element === self::STYLE;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
||||
static function isVoidElement($element)
|
||||
{
|
||||
$element = strtolower($element);
|
||||
|
||||
return $element === self::AREA
|
||||
|| $element === self::BASE
|
||||
|| $element === self::BR
|
||||
|| $element === self::COL
|
||||
|| $element === self::EMBED
|
||||
|| $element === self::HR
|
||||
|| $element === self::IMG
|
||||
|| $element === self::INPUT
|
||||
|| $element === self::LINK
|
||||
|| $element === self::META
|
||||
|| $element === self::PARAM
|
||||
|| $element === self::SOURCE
|
||||
|| $element === self::TRACK
|
||||
|| $element === self::WBR;
|
||||
}
|
||||
}
|
||||
1461
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlNode.php
vendored
Normal file
1461
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlNode.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
135
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlWeb.php
vendored
Normal file
135
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/HtmlWeb.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php namespace simplehtmldom;
|
||||
|
||||
/**
|
||||
* Website: http://sourceforge.net/projects/simplehtmldom/
|
||||
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* See the LICENSE file in the project root for more information.
|
||||
*
|
||||
* Authors:
|
||||
* S.C. Chen
|
||||
* John Schlick
|
||||
* Rus Carroll
|
||||
* logmanoriginal
|
||||
*
|
||||
* Contributors:
|
||||
* Yousuke Kumakura
|
||||
* Vadim Voituk
|
||||
* Antcs
|
||||
*
|
||||
* Version $Rev$
|
||||
*/
|
||||
|
||||
include_once 'HtmlDocument.php';
|
||||
|
||||
class HtmlWeb {
|
||||
|
||||
/**
|
||||
* @return HtmlDocument Returns the DOM for a webpage
|
||||
* @return null Returns null if the cURL extension is not loaded and allow_url_fopen=Off
|
||||
* @return null Returns null if the provided URL is invalid (not PHP_URL_SCHEME)
|
||||
* @return null Returns null if the provided URL does not specify the HTTP or HTTPS protocol
|
||||
*/
|
||||
function load($url)
|
||||
{
|
||||
if(!filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if($scheme = parse_url($url, PHP_URL_SCHEME)) {
|
||||
switch(strtolower($scheme)) {
|
||||
case 'http':
|
||||
case 'https': break;
|
||||
default: return null;
|
||||
}
|
||||
|
||||
if(extension_loaded('curl')) {
|
||||
return $this->load_curl($url);
|
||||
} elseif(ini_get('allow_url_fopen')) {
|
||||
return $this->load_fopen($url);
|
||||
} else {
|
||||
error_log(__FUNCTION__ . ' requires either the cURL extension or allow_url_fopen=On in php.ini');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* cURL implementation of load
|
||||
*/
|
||||
private function load_curl($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||
|
||||
// There is no guarantee this request will be fulfilled
|
||||
// -- https://www.php.net/manual/en/function.curl-setopt.php
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, MAX_FILE_SIZE);
|
||||
|
||||
// There is no guarantee this request will be fulfilled
|
||||
$header = array(
|
||||
'Accept: text/html', // Prefer HTML format
|
||||
'Accept-Charset: utf-8', // Prefer UTF-8 encoding
|
||||
);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
|
||||
$doc = curl_exec($ch);
|
||||
|
||||
if(curl_getinfo($ch, CURLINFO_RESPONSE_CODE) !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if(strlen($doc) > MAX_FILE_SIZE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HtmlDocument($doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* fopen implementation of load
|
||||
*/
|
||||
private function load_fopen($url)
|
||||
{
|
||||
// There is no guarantee this request will be fulfilled
|
||||
$context = stream_context_create(array('http' => array(
|
||||
'header' => array(
|
||||
'Accept: text/html', // Prefer HTML format
|
||||
'Accept-Charset: utf-8', // Prefer UTF-8 encoding
|
||||
),
|
||||
'ignore_errors' => true // Always fetch content
|
||||
)));
|
||||
|
||||
$doc = file_get_contents($url, false, $context, 0, MAX_FILE_SIZE + 1);
|
||||
|
||||
if(isset($http_response_header)) {
|
||||
foreach($http_response_header as $rh) {
|
||||
// https://stackoverflow.com/a/1442526
|
||||
$parts = explode(' ', $rh, 3);
|
||||
|
||||
if(preg_match('/HTTP\/\d\.\d/', $parts[0])) {
|
||||
$code = $parts[1];
|
||||
}
|
||||
} // Last code is final status
|
||||
|
||||
if(!isset($code) || $code !== '200') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($doc) > MAX_FILE_SIZE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HtmlDocument($doc);
|
||||
}
|
||||
|
||||
}
|
||||
21
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/LICENSE
vendored
Normal file
21
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 S.C. Chen, John Schlick, logmanoriginal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
116
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/README.md
vendored
Normal file
116
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/README.md
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
# PHP Simple HTML DOM Parser
|
||||
|
||||
[](https://github.com/simplehtmldom/simplehtmldom/blob/master/LICENSE)
|
||||
[](https://sourceforge.com/projects/simplehtmldom/files/simplehtmldom/)
|
||||
[](https://github.com/simplehtmldom/simplehtmldom/actions/workflows/basic_tests.yml)
|
||||
[](https://packagist.org/packages/simplehtmldom/simplehtmldom)
|
||||
|
||||
simplehtmldom is a fast and reliable HTML DOM parser for PHP.
|
||||
|
||||
## Key features
|
||||
|
||||
* Purely PHP-based DOM parser (no XML extensions required).
|
||||
* Works with well-formed and broken HTML documents.
|
||||
* Loads webpages, local files and document strings.
|
||||
* Supports CSS selectors.
|
||||
|
||||
## Requirements
|
||||
|
||||
simplehtmldom requires **PHP 5.6 or higher** with [ext-iconv](https://www.php.net/manual/en/book.iconv.php) enabled. Following extensions enable additional features of the parser:
|
||||
|
||||
* [ext-mbstring](https://secure.php.net/manual/en/book.mbstring.php) (recommended) \
|
||||
Enables better detection for multi-byte documents.
|
||||
* [ext-curl](https://secure.php.net/manual/en/book.curl.php) \
|
||||
Enables cURL support for the class `HtmlWeb`.
|
||||
* [ext-openssl](https://secure.php.net/manual/en/book.openssl.php) (recommended when using cURL) \
|
||||
Enables SSL support for cURL.
|
||||
|
||||
## Installation
|
||||
|
||||
**Manually**:
|
||||
|
||||
Download the latest release from [SourceForge](https://sourceforge.net/projects/simplehtmldom/files/latest) and extract the files in the vendor folder of your project.
|
||||
|
||||
**Composer**:
|
||||
|
||||
```sh
|
||||
composer require simplehtmldom/simplehtmldom
|
||||
```
|
||||
|
||||
**Git**:
|
||||
|
||||
```
|
||||
git clone git://git.code.sf.net/p/simplehtmldom/repository simplehtmldom
|
||||
```
|
||||
|
||||
_Note_: The [GitHub repository](https://github.com/simplehtmldom/simplehtmldom) serves as a mirror for the SourceForge project. We currently accept pull requests and issues only via SourceForge.
|
||||
|
||||
## Usage
|
||||
|
||||
This example illustrates how to return the page title:
|
||||
|
||||
<details><summary>Manually</summary>
|
||||
|
||||
```
|
||||
<?php
|
||||
include_once 'HtmlWeb.php';
|
||||
use simplehtmldom\HtmlWeb;
|
||||
|
||||
$client = new HtmlWeb();
|
||||
$html = $client->load('https://www.google.com/search?q=simplehtmldom');
|
||||
|
||||
// Returns the page title
|
||||
echo $html->find('title', 0)->plaintext . PHP_EOL;
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>Using composer</summary>
|
||||
|
||||
```
|
||||
<?php
|
||||
include_once 'vendor/autoload.php';
|
||||
use simplehtmldom\HtmlWeb;
|
||||
|
||||
$client = new HtmlWeb();
|
||||
$html = $client->load('https://www.google.com/search?q=simplehtmldom');
|
||||
|
||||
// Returns the page title
|
||||
echo $html->find('title', 0)->plaintext . PHP_EOL;
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Find more examples in the installation folder under `examples`.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation for this library is hosted at [https://simplehtmldom.sourceforge.io/docs/](https://simplehtmldom.sourceforge.io/docs/)
|
||||
|
||||
## Getting involved
|
||||
|
||||
There are various ways for you to get involved with simplehtmldom. Here are a few:
|
||||
|
||||
* Share this project with your friends (Twitter, Facebook, ..._you name it_...).
|
||||
* Report [bugs](https://sourceforge.net/p/simplehtmldom/bugs/) (SourceForge).
|
||||
* Request [features](https://sourceforge.net/p/simplehtmldom/feature-requests/) (SourceForge).
|
||||
* Discuss existing bugs, features and ideas.
|
||||
|
||||
If you want to contribute code to the project, please open a [feature request](https://sourceforge.net/p/simplehtmldom/feature-requests/) and include your patch with the message.
|
||||
|
||||
## Authors
|
||||
|
||||
* [S.C. Chen](https://sourceforge.net/u/me578022/)
|
||||
* [John Schlick](https://sourceforge.net/u/john_schlick/)
|
||||
* [logmanoriginal](https://sourceforge.net/u/logmanoriginal/)
|
||||
* Rus Carroll
|
||||
* Yousuke Kumakura
|
||||
* Vadim Voituk
|
||||
|
||||
## License
|
||||
|
||||
The source code for simplehtmldom is licensed under the MIT license. For further information read the LICENSE file in the root directory (should be located next to this README file).
|
||||
|
||||
## Technical notes
|
||||
|
||||
simplehtmldom is a purely PHP-based DOM parser that doesn't rely on external libraries like [libxml](https://www.php.net/manual/en/book.libxml.php), [SimpleXML](https://www.php.net/manual/en/book.simplexml.php) or [PHP DOM](https://www.php.net/manual/en/book.dom.php). Doing so provides better control over the parsing algorithm and a much simpler API that even novice users can learn to use in a short amount of time.
|
||||
66
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/composer.json
vendored
Normal file
66
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/composer.json
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "simplehtmldom/simplehtmldom",
|
||||
"description": "A fast, simple and reliable HTML document parser for PHP.",
|
||||
"keywords": [
|
||||
"php",
|
||||
"html",
|
||||
"dom",
|
||||
"parser",
|
||||
"simple",
|
||||
"simplehtmldom"
|
||||
],
|
||||
"homepage": "https://simplehtmldom.sourceforge.io/",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "S.C. Chen",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "John Schlick",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "logmanoriginal",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://sourceforge.net/p/simplehtmldom/bugs/",
|
||||
"wiki": "https://simplehtmldom.sourceforge.io/docs/",
|
||||
"source": "https://sourceforge.net/p/simplehtmldom/repository/",
|
||||
"rss": "https://sourceforge.net/p/simplehtmldom/news/feed.rss"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"./"
|
||||
],
|
||||
"exclude-from-classmap": [
|
||||
"/example/",
|
||||
"/docs/",
|
||||
"/tests/",
|
||||
"simple_html_dom.php"
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6 || ^7",
|
||||
"squizlabs/php_codesniffer": "^2",
|
||||
"phpcompatibility/php-compatibility": "^9",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "Allows better decoding for multi-byte documents",
|
||||
"ext-curl": "Needed to support cURL downloads in class HtmlWeb",
|
||||
"ext-openssl": "Allows loading HTTPS pages when using cURL"
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
1921
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/composer.lock
generated
vendored
Normal file
1921
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/constants.php
vendored
Normal file
28
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/constants.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php namespace simplehtmldom;
|
||||
|
||||
/**
|
||||
* Website: http://sourceforge.net/projects/simplehtmldom/
|
||||
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* See the LICENSE file in the project root for more information.
|
||||
*
|
||||
* Authors:
|
||||
* S.C. Chen
|
||||
* John Schlick
|
||||
* Rus Carroll
|
||||
* logmanoriginal
|
||||
*
|
||||
* Contributors:
|
||||
* Yousuke Kumakura
|
||||
* Vadim Voituk
|
||||
* Antcs
|
||||
*
|
||||
* Version $Rev$
|
||||
*/
|
||||
|
||||
defined(__NAMESPACE__ . '\DEFAULT_TARGET_CHARSET') || define(__NAMESPACE__ . '\DEFAULT_TARGET_CHARSET', 'UTF-8');
|
||||
defined(__NAMESPACE__ . '\DEFAULT_BR_TEXT') || define(__NAMESPACE__ . '\DEFAULT_BR_TEXT', "\r\n");
|
||||
defined(__NAMESPACE__ . '\DEFAULT_SPAN_TEXT') || define(__NAMESPACE__ . '\DEFAULT_SPAN_TEXT', ' ');
|
||||
defined(__NAMESPACE__ . '\MAX_FILE_SIZE') || define(__NAMESPACE__ . '\MAX_FILE_SIZE', 2621440);
|
||||
const HDOM_SMARTY_AS_TEXT = 1;
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
Debug::disable ()
|
||||
```
|
||||
|
||||
Globally disables debug messages.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
Debug::enable ()
|
||||
```
|
||||
|
||||
Globally enables debug messages.
|
||||
27
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/Debug/index.md
vendored
Normal file
27
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/Debug/index.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Provides the ability to see debug messages for deprecated functions, malformed documents and parsing issues. Debug messages can be sent to a custom message handler or written to error_log (default).
|
||||
|
||||
## Example
|
||||
|
||||
```php
|
||||
<?php
|
||||
include_once 'HtmlDocument.php';
|
||||
include_once 'Debug.php';
|
||||
use simplehtmldom\HtmlDocument;
|
||||
use simplehtmldom\Debug;
|
||||
|
||||
Debug::enable();
|
||||
|
||||
$dom = new HtmlDocument();
|
||||
$dom->load('<html></html>');
|
||||
$dom->root->children(); // This causes a deprecation warning
|
||||
|
||||
Debug::disable();
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
```
|
||||
[DEBUG] [/var/www/html/simplehtmldom/Debug.php:30] [/var/www/html/simplehtmldom/test.php:7] "Debug mode has been enabled"
|
||||
[DEBUG] [/var/www/html/simplehtmldom/HtmlNode.php:83] [/var/www/html/simplehtmldom/test.php:11] "simplehtmldom\HtmlNode->children() has been deprecated and will be removed in the next major version of simplehtmldom. Use simplehtmldom\HtmlNode->childNodes() instead."
|
||||
[DEBUG] [/var/www/html/simplehtmldom/Debug.php:38] [/var/www/html/simplehtmldom/test.php:13] "Debug mode has been disabled"
|
||||
```
|
||||
5
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/Debug/log.md
vendored
Normal file
5
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/Debug/log.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
Debug::log (string $message)
|
||||
```
|
||||
|
||||
Logs a debug message if the debugger is enabled. Does nothing if the debugger is disabled.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
Debug::log_once (string $message)
|
||||
```
|
||||
|
||||
Logs a debug message if the debugger is enabled. Does nothing if the debugger is disabled. Each message is logged only once (based on file and line number).
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
Debug::setDebugHandler ( [$function = null] )
|
||||
```
|
||||
|
||||
Sets the debug handler for debug messages. Uses `error_log` if `$function = null` (default).
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__call ($function, $arguments)
|
||||
```
|
||||
|
||||
Serves as a wrapper for deprecated methods. See [magic methods](https://www.php.net/manual/en/language.oop5.overloading.php#object.call) for more information.
|
||||
@@ -0,0 +1,18 @@
|
||||
```php
|
||||
__construct ( [ string $str = null [, bool $lowercase = true [, bool $forceTagsClosed = true [, string $target_charset = DEFAULT_TARGET_CHARSET [, bool $stripRN = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT [, int $options = 0 ]]]]]]]]) : object
|
||||
```
|
||||
|
||||
Creates a new `HtmlDocument` object.
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------------|------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `str` | The HTML document string. |
|
||||
| `lowercase` | Tag names are parsed in lowercase letters if enabled. |
|
||||
| `forceTagsClosed` | Tags inside block tags are forcefully closed if the closing tag was omitted. |
|
||||
| `target_charset` | Defines the target charset for text returned by the parser. |
|
||||
| `stripRN` | Newline characters are replaced by whitespace if enabled. |
|
||||
| `defaultBRText` | Defines the default text to return for `<br>` elements. |
|
||||
| `defaultSpanText` | Defines the default text to return for `<span>` elements. |
|
||||
| `options` | Additional options for the parser. Currently supports `'HDOM_SMARTY_AS_TEXT'` to remove [Smarty](https://www.smarty.net/) scripts. |
|
||||
|
||||
Returns the object.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__debugInfo ( )
|
||||
```
|
||||
|
||||
Returns debugging information about the current object.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__destruct ()
|
||||
```
|
||||
|
||||
Destroys the current object and clears memory.
|
||||
@@ -0,0 +1,15 @@
|
||||
```php
|
||||
__get ( string $name ) : mixed
|
||||
```
|
||||
|
||||
See [magic methods](http://php.net/manual/en/language.oop5.overloading.php#object.get)
|
||||
|
||||
Supports following names:
|
||||
|
||||
| Name | Description |
|
||||
|------------------|----------------------------------------------|
|
||||
| `outertext` | Returns the outer text of the root element. |
|
||||
| `innertext` | Returns the inner text of the root element. |
|
||||
| `plaintext` | Returns the plain text of the root element. |
|
||||
| `charset` | Returns the charset for the document. |
|
||||
| `target_charset` | Returns the target charset for the document. |
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__toString () : string
|
||||
```
|
||||
|
||||
Returns the inner text of the root element of the DOM.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
as_text_node ( string $tag ) : bool
|
||||
```
|
||||
|
||||
Adds a tag as text node.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------------------|
|
||||
| `tag` | The element's tag name. |
|
||||
|
||||
Returns true on success.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
childNodes ( [ int $idx = -1 ] ) : mixed
|
||||
```
|
||||
|
||||
Returns children of the root element.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------------|
|
||||
| `idx` | Index of the child element to return. |
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
copy_skip ( string $chars ) : string
|
||||
```
|
||||
|
||||
Skips characters starting at the current parsing position in the document. Sets the parsing position to the first character not in the provided list of characters.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------------------------|
|
||||
| `chars` | A list of characters to skip. |
|
||||
|
||||
Returns the skipped characters.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
copy_until ( string $chars ) : string
|
||||
```
|
||||
|
||||
Copies all characters starting at the current parsing position in the document. Sets the parsing position to the first character that matches any of the characters in the provided list of characters.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|------------------------------------------|
|
||||
| `chars` | A list of characters to stop copying at. |
|
||||
|
||||
Returns the copied characters.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
copy_until ( string $char ) : string
|
||||
```
|
||||
|
||||
Copies all characters starting at the current parsing position in the document. Sets the parsing position to the first character that matches the provided character.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------|
|
||||
| `char` | A character to stop copying at. |
|
||||
|
||||
Returns the copied characters.
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
createElement ( string $name [, string $value = null ] ) : object
|
||||
```
|
||||
|
||||
Creates a new element.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------|
|
||||
| `name` | Name of the element |
|
||||
| `value` | Value of the element |
|
||||
|
||||
Returns the element.
|
||||
@@ -0,0 +1,7 @@
|
||||
```php
|
||||
createTextNode ( string $value ) : object
|
||||
```
|
||||
|
||||
Creates a new text element.
|
||||
|
||||
Returns the element.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
dump ( [ bool show_attr = true ] ) : string
|
||||
```
|
||||
|
||||
Dumps the entire DOM into a string. Useful for debugging purposes.
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------|---------------------------------------------------|
|
||||
| `show_attr` | Attributes are included in the dump when enabled. |
|
||||
|
||||
Returns the DOM tree as string.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
expect (
|
||||
string $selector
|
||||
[, int $idx = null ]
|
||||
[, bool $lowercase = false ]
|
||||
) : mixed
|
||||
```
|
||||
|
||||
Finds elements in the DOM.
|
||||
Returns null if no match was found.
|
||||
See [`find`](find.md) for a description of parameters and selectors.
|
||||
@@ -0,0 +1,13 @@
|
||||
```php
|
||||
find ( string $selector [, int $idx = null [, bool $lowercase = false ]] ) : mixed
|
||||
```
|
||||
|
||||
Finds elements in the DOM.
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------|--------------------------------------------------|
|
||||
| `selector` | A [CSS style selector](../HtmlNode/find.md). |
|
||||
| `idx` | Index of the element to return. |
|
||||
| `lowercase` | Matches tag names case insensitive when enabled. |
|
||||
|
||||
Returns an array of matches or a single element if `idx` is defined.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
firstChild () : object
|
||||
```
|
||||
|
||||
Returns the first child of the root element.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
getElementById ( string $id ) : object
|
||||
```
|
||||
|
||||
Searches an element by id.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------|
|
||||
| `id` | ID of the element to find. |
|
||||
|
||||
Returns the element or null if no match was found.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
getElementByTagName ( string $name ) : object
|
||||
```
|
||||
|
||||
Searches an element by tag name.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------------|
|
||||
| `name` | Tag name of the element to find. |
|
||||
|
||||
Returns the element or null if no match was found.
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
getElementsById ( string $id [, int $idx = null ] ) : object
|
||||
```
|
||||
|
||||
Searches elements by id.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|--------------------------------------------------------|
|
||||
| `id` | ID of the element to find. |
|
||||
| `idx` | Returns the element at the specified index if defined. |
|
||||
|
||||
Returns the element(s) or null if no match was found.
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
getElementsByTagName ( string $name [, int $idx = -1 ] ) : object
|
||||
```
|
||||
|
||||
Searches elements by tag name.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------------------|
|
||||
| `name` | Tag name of the element to find. |
|
||||
| `idx` | Returns the element at the specified index. |
|
||||
|
||||
Returns the element(s) or null if no match was found.
|
||||
@@ -0,0 +1,30 @@
|
||||
Represents the [DOM](https://en.wikipedia.org/wiki/Document_Object_Model) in memory. Provides functions to parse documents and access individual elements (see [`HtmlNode`](../HtmlNode/index.md)).
|
||||
|
||||
## Public Properties
|
||||
|
||||
| Property | Description |
|
||||
|---------------------|-----------------------------------------------------------------------------------------|
|
||||
| `root` | Root node of the document. |
|
||||
| `nodes` | List of top-level nodes in the document. |
|
||||
| `callback` | Callback function that is called for each element in the DOM when generating outertext. |
|
||||
| `lowercase` | If enabled, all tag names are converted to lowercase when parsing documents. |
|
||||
| `original_size` | Original document size in bytes. |
|
||||
| `size` | Current document size in bytes. |
|
||||
| `_charset` | Charset of the original document. |
|
||||
| `_target_charset` | Target charset for the current document. |
|
||||
| `default_br_text` | Text to return for `<br>` elements. |
|
||||
| `default_span_text` | Text to return for `<span>` elements. |
|
||||
|
||||
## Protected Properties
|
||||
|
||||
| Property | Description |
|
||||
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `pos` | Current parsing position within `doc`. |
|
||||
| `doc` | The original document. |
|
||||
| `char` | Character at position `pos` in `doc`. |
|
||||
| `cursor` | Current element cursor in the document. |
|
||||
| `parent` | Parent element node. |
|
||||
| `noise` | Noise from the original document (i.e. scripts, comments, etc...). |
|
||||
| `token_blank` | Tokens that are considered whitespace in HTML. |
|
||||
| `block_tags` | A list of tag names where remaining unclosed tags are forcibly closed. |
|
||||
| `optional_closing_tags` | A list of tag names where the closing tag can be omitted. |
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
lastChild () : object
|
||||
```
|
||||
|
||||
Returns the last child of the root element.
|
||||
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
link_nodes ( object &$node, bool $is_child )
|
||||
```
|
||||
|
||||
Links the provided node to the DOM tree.
|
||||
|
||||
| Parameter | Description |
|
||||
|------------|----------------------------------------------------------------------------|
|
||||
| `node` | The node to link to the DOM tree. |
|
||||
| `is_child` | If active, makes the node a sibling of the current node (child of parent). |
|
||||
@@ -0,0 +1,16 @@
|
||||
```php
|
||||
load ( string $str [, bool $lowercase = true [, bool $stripRN = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT [, int $options = 0 ]]]]]) : object
|
||||
```
|
||||
|
||||
Loads the provided HTML document string.
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------------|------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `str` | The HTML document string. |
|
||||
| `lowercase` | Tag names are parsed in lowercase letters if enabled. |
|
||||
| `stripRN` | Newline characters are replaced by whitespace if enabled. |
|
||||
| `defaultBRText` | Defines the default text to return for `<br>` elements. |
|
||||
| `defaultSpanText` | Defines the default text to return for `<span>` elements. |
|
||||
| `options` | Additional options for the parser. Currently supports `'HDOM_SMARTY_AS_TEXT'` to remove [Smarty](https://www.smarty.net/) scripts. |
|
||||
|
||||
Returns the object.
|
||||
@@ -0,0 +1,7 @@
|
||||
```php
|
||||
loadFile (...)
|
||||
```
|
||||
|
||||
Loads an HTML document from file. Supports arguments of [`file_get_contents`](http://php.net/manual/en/function.file-get-contents.php).
|
||||
|
||||
Returns the object.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
parse ()
|
||||
```
|
||||
|
||||
Parses the document. This function is called after the document was loaded into `$this->doc`.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
parse_attr ( object $node, string $name, array &$space )
|
||||
```
|
||||
|
||||
Parses a single attribute starting at the current parsing position in the document.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `node` | The current element (node). |
|
||||
| `name` | The attribute name. |
|
||||
| `space` | An array of whitespace surrounding the current attribute (see [Attribute Whitespace](../HtmlNode/definitions.md#attribute-whitespace)). |
|
||||
@@ -0,0 +1,13 @@
|
||||
```php
|
||||
parse_charset ()
|
||||
```
|
||||
|
||||
Parses the charset.
|
||||
|
||||
If the callback function `get_last_retrieve_url_contents_content_type` exists, it is assumed to return the content type header for the current document as string.
|
||||
|
||||
Uses the charset from the metadata of the page if defined.
|
||||
|
||||
If none of the previous conditions are met, the charset is determined by `mb_detect_encoding` if multibyte support is active.
|
||||
|
||||
If multibyte support is not active the charset is assumed to be `'UTF-8'`.
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
prepare ( string $str [, bool $lowercase = true [, string $defaultBRText = DEFAULT_BR_TEXT [, string $defaultSpanText = DEFAULT_SPAN_TEXT ]]] )
|
||||
```
|
||||
|
||||
Initializes the DOM object.
|
||||
|
||||
| Parameters | Description |
|
||||
|-------------------|-----------------------------------------------------------|
|
||||
| `str` | The HTML document string. |
|
||||
| `lowercase` | Tag names are parsed in lowercase letters if enabled. |
|
||||
| `defaultBRText` | Defines the default text to return for `<br>` elements. |
|
||||
| `defaultSpanText` | Defines the default text to return for `<span>` elements. |
|
||||
@@ -0,0 +1,7 @@
|
||||
```php
|
||||
read_tag () : bool
|
||||
```
|
||||
|
||||
Reads a single tag starting at the current parsing position in the document. The tag is automatically added to the DOM.
|
||||
|
||||
Returns true if a tag was found.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
remove_callback ()
|
||||
```
|
||||
|
||||
Removes the callback set by [`set_callback`](set_callback.md).
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
remove_noise ( string $pattern [, bool $remove_tag = false] )
|
||||
```
|
||||
|
||||
Replaces noise in the document (i.e. scripts) by placeholders and adds the removed contents to `$this->noise`.
|
||||
|
||||
_Note_: Noise is replaced by placeholders in order to allow restoring the original contents. Placeholders take the form of `'___noise___1000'` where the number is increased by one for each removed noise.
|
||||
|
||||
| Parameter | Description |
|
||||
|--------------|---------------------------------------------------------------------|
|
||||
| `pattern` | A regular expression that matches the noise to remove. |
|
||||
| `remove_tag` | Removes the entire match when enabled or sub-matches when disabled. |
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
restore_noise ( string $text ) : string
|
||||
```
|
||||
|
||||
Restores noise in the provided string by replacing noise placeholders by their original contents.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------------------------------------------------|
|
||||
| `text` | A string (potentially) containing noise placeholders. |
|
||||
|
||||
Returns the string with original contents restored or the original string if it doesn't contain noise placeholders.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
save ( [ string $filepath = '' ] ) : string
|
||||
```
|
||||
|
||||
Writes the current DOM to file.
|
||||
|
||||
| Parameter | Description |
|
||||
|------------|--------------------------------------------------------|
|
||||
| `filepath` | Writes to file if the provided file path is not empty. |
|
||||
|
||||
Returns the document string.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
search_noise ( string $text ) : string
|
||||
```
|
||||
|
||||
Find a single noise element by providing the noise placeholder text.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|--------------------------------|
|
||||
| `text` | The noise placeholder to find. |
|
||||
|
||||
Returns the original contents for the placeholder.
|
||||
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
set_callback ( string $function_name )
|
||||
```
|
||||
|
||||
Sets the callback function which is called on each element of the DOM when building outertext.
|
||||
The function must accept a single parameter of type `HtmlNode`.
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------------|-----------------------|
|
||||
| `function_name` | Name of the function. |
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__call ($function, $arguments)
|
||||
```
|
||||
|
||||
Serves as a wrapper for deprecated methods. See [magic methods](https://www.php.net/manual/en/language.oop5.overloading.php#object.call) for more information.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
__construct ( [ object $dom ] ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------------------------------------|
|
||||
| `dom` | An object of type [`HtmlDocument`](../HtmlDocument/index.md). |
|
||||
|
||||
Constructs a new object of type `HtmlNode`, assigns `$dom` as DOM object and adds itself to the list of nodes in `$dom`.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__debugInfo ( )
|
||||
```
|
||||
|
||||
Returns debugging information about the current object.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__destruct ( )
|
||||
```
|
||||
|
||||
Destructs the current object and frees memory.
|
||||
20
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/__get.md
vendored
Normal file
20
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/__get.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
```php
|
||||
__get ( string $name ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------------------------------------------|
|
||||
| `name` | `outertext`, `innertext`, `plaintext`, `xmltext` or attribute name. |
|
||||
|
||||
See [magic methods](http://php.net/manual/en/language.oop5.overloading.php#object.get)
|
||||
|
||||
If the provided name is a valid attribute name, returns the attribute value. Otherwise, a value according to the table below.
|
||||
|
||||
| Name | Description |
|
||||
|-------------|-------------------------------------------------------------------------------------------|
|
||||
| `outertext` | Returns the outer text of the current node. |
|
||||
| `innertext` | Returns the inner text of the current node. |
|
||||
| `plaintext` | Returns the plain text of the current node. |
|
||||
| `xmltext` | Returns the xml representation for the inner text of the current node as a CDATA section. |
|
||||
|
||||
Returns nothing if the provided name is neither a valid attribute name, nor a valid parameter name.
|
||||
@@ -0,0 +1,17 @@
|
||||
```php
|
||||
__isset ( string $name ) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------------------------------------|
|
||||
| `name` | `outertext`, `innertext`, `plaintext` or attribute name. |
|
||||
|
||||
See [magic methods](http://php.net/manual/en/language.oop5.overloading.php#object.get)
|
||||
|
||||
Returns true if the provided name is a valid attribute name or any of the values in the table below. False otherwise.
|
||||
|
||||
| Name | Description |
|
||||
|-------------|---------------------------------------------|
|
||||
| `outertext` | Returns the outer text of the current node. |
|
||||
| `innertext` | Returns the inner text of the current node. |
|
||||
| `plaintext` | Returns the plain text of the current node. |
|
||||
16
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/__set.md
vendored
Normal file
16
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/__set.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
```php
|
||||
__set ( string $name, mixed $value )
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------------------|
|
||||
| `name` | `outertext`, `innertext` or attribute name. |
|
||||
| `value` | Value to set. |
|
||||
|
||||
See [magic methods](http://php.net/manual/en/language.oop5.overloading.php#object.get)
|
||||
|
||||
Sets the outer text of the current node to `$value` if `$name` is `outertext`.
|
||||
|
||||
Sets the inner text of the current node to `$value` if `$name` is `innertext`.
|
||||
|
||||
Otherwise, adds or updates an attribute with name `$name` and value `$value` to the current node.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__toString ( ) : string
|
||||
```
|
||||
|
||||
Returns the outer text of the current node.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
__unset ( string $name )
|
||||
```
|
||||
|
||||
Removes the attribute with name `$name` from the current node if it exists.
|
||||
@@ -0,0 +1,21 @@
|
||||
```php
|
||||
addClass ( mixed $class )
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|------------------------------------------------|
|
||||
| `class` | Specifies one or more class names to be added. |
|
||||
|
||||
Adds one or more class names to the current node.
|
||||
|
||||
**Remarks**
|
||||
|
||||
* To add more than one class, separate the class names with space or provide them as an array.
|
||||
|
||||
**Examples**
|
||||
|
||||
```php
|
||||
$node->addClass('hidden');
|
||||
$node->addClass('article important');
|
||||
$node->addClass(array('article', 'new'));
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
appendChild ( object $node ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|------------------------------------------------------|
|
||||
| `node` | An object of type [`HtmlNode`](../HtmlNode/index.md) |
|
||||
|
||||
Makes the current node parent of the node provided to this function.
|
||||
|
||||
Returns the provided node.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
childNodes ( [ int $idx = -1 ] ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------------------------------------|
|
||||
| `idx` | Index of the node to return or `-1` to return all nodes. |
|
||||
|
||||
Returns all or one specific child node from the current node.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
clear ( )
|
||||
```
|
||||
|
||||
Sets all properties in the current node, which contain objects, to null.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
convert_text ( string $text ) : string
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|------------------|
|
||||
| `text` | Text to convert. |
|
||||
|
||||
Assumes that the provided text is in the form of the configured source character set (see [`sourceCharset`](../HtmlDocument/index.md)) and converts it to the specified target character set (see [`targetCharset`](../HtmlDocument/index.md)).
|
||||
|
||||
Returns the converted text.
|
||||
@@ -0,0 +1,92 @@
|
||||
The definitions below are an essential part of the parser.
|
||||
|
||||
## Node Types
|
||||
|
||||
The type of node is determined during parsing and represented by one of the elements in the list below.
|
||||
|
||||
| Type | Description |
|
||||
|---------------------|---------------------------------------------------------------------|
|
||||
| `HDOM_TYPE_ELEMENT` | Start tag (i.e. `<html>`) |
|
||||
| `HDOM_TYPE_COMMENT` | HTML comment (i.e. `<!-- Hello, World! -->`) |
|
||||
| `HDOM_TYPE_TEXT` | Plain text (i.e. `Hello, World!`) |
|
||||
| `HDOM_TYPE_ROOT` | Root element. There can always only be one root element in the DOM. |
|
||||
| `HDOM_TYPE_UNKNOWN` | Unknown type (i.e. CDATA, DOCTYPE, etc...) |
|
||||
|
||||
### Example
|
||||
|
||||
```html
|
||||
<!DOCTYPE html><html><!-- Hello, World! --></html>Hello, World!
|
||||
```
|
||||
|
||||
_Note_: `HDOM_TYPE_ROOT` always exists regardless of the actual document structure.
|
||||
|
||||
| HTML | Node Type |
|
||||
|--------------------------|---------------------|
|
||||
| | `HDOM_TYPE_ROOT` |
|
||||
| `<!DOCTYPE html>` | `HDOM_TYPE_UNKNOWN` |
|
||||
| `<html>` | `HDOM_TYPE_ELEMENT` |
|
||||
| `<!-- Hello, World! -->` | `HDOM_TYPE_COMMENT` |
|
||||
| `Hello, World!` | `HDOM_TYPE_TEXT` |
|
||||
|
||||
## Quote Types
|
||||
|
||||
Identifies the quoting type on attribute values.
|
||||
|
||||
| Type | Description |
|
||||
|---------------------|----------------------|
|
||||
| `HDOM_QUOTE_DOUBLE` | Double quotes (`""`) |
|
||||
| `HDOM_QUOTE_SINGLE` | Single quotes (`''`) |
|
||||
| `HDOM_QUOTE_NO` | Not quoted (flag) |
|
||||
|
||||
_Note_: Attributes with no values (flags) are stored as `HDOM_QUOTE_NO`.
|
||||
|
||||
### Example
|
||||
|
||||
```html
|
||||
<p class="paragraph" id='info1' hidden>Hello, World!</p>
|
||||
```
|
||||
|
||||
| Attribute | Description |
|
||||
|---------------------|---------------------|
|
||||
| `class="paragraph"` | `HDOM_QUOTE_DOUBLE` |
|
||||
| `id='info1'` | `HDOM_QUOTE_SINGLE` |
|
||||
| `hidden` | `HDOM_QUOTE_NO` |
|
||||
|
||||
## Node Info Types
|
||||
|
||||
Each node stores additional information (metadata) that is identified by the elements below.
|
||||
|
||||
| Type | Description |
|
||||
|----------------------|--------------------------------------------------------------------------------------------------------------------|
|
||||
| `HDOM_INFO_BEGIN` | Cursor position for the start tag of a node. |
|
||||
| `HDOM_INFO_END` | Cursor position for the end tag of a node. A value of zero indicates a node with no end tag (missing closing tag). |
|
||||
| `HDOM_INFO_QUOTE` | Quote type for attribute values. The value must be an element of [Quote Type](#quote-types). |
|
||||
| `HDOM_INFO_SPACE` | Array of whitespace around attributes (see [Attribute Whitespace](#attribute-whitespace)). |
|
||||
| `HDOM_INFO_TEXT` | Non-HTML text in tags (i.e. comments, doctype, etc...). |
|
||||
| `HDOM_INFO_INNER` | Inner text of a node. |
|
||||
| `HDOM_INFO_OUTER` | Outer text of a node. |
|
||||
| `HDOM_INFO_ENDSPACE` | Whitespace at the end of a tag before the closing bracket. |
|
||||
|
||||
## Attribute Whitespace
|
||||
|
||||
Whitespace around attributes is stored in the form of an array with three elements:
|
||||
|
||||
| Element | Description |
|
||||
|---------|-----------------------------------------------------------|
|
||||
| `0` | Whitespace before the attribute name. |
|
||||
| `1` | Whitespace between attribute name and the equal sign. |
|
||||
| `2` | Whitespace between the equal sign and the attribute value |
|
||||
|
||||
### Example
|
||||
|
||||
```html
|
||||
<p class="paragraph" id = 'info1'hidden>Hello, World!</p>
|
||||
```
|
||||
|
||||
_Note_: Whitespace before attribute names is not displayed in the browser. It is, however, part of the attributes.
|
||||
|
||||
| Attribute | Description |
|
||||
|----------------------|--------------------------------------|
|
||||
| ` class="paragraph"` | `[0] => ' ', [1] => '', [2] => ''` |
|
||||
| ` id = 'info1'` | `[0] => ' ', [1] => ' ', [2] => ' '` |
|
||||
| `hidden` | `[0] => '', [1] => '', [2] => ''` |
|
||||
10
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/dump.md
vendored
Normal file
10
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/dump.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
dump ( [ bool $show_attr = false [, int $depth = 0 ]] )
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------|--------------------------------------------------------|
|
||||
| `show_attr` | Attribute names are included in the output if enabled. |
|
||||
| `depth` | Depth of the current element |
|
||||
|
||||
Dumps information about the current node and all child nodes recursively.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
dump_node ( [ bool $echo = true ] ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------------------------|
|
||||
| `echo` | Echoes the dump details directly if enabled. |
|
||||
|
||||
Dumps information about the current document node. Returns a string if `$echo` is set to false, null otherwise.
|
||||
@@ -0,0 +1,11 @@
|
||||
```php
|
||||
expect (
|
||||
string $selector
|
||||
[, int $idx = null ]
|
||||
[, bool $lowercase = false ]
|
||||
) : mixed
|
||||
```
|
||||
|
||||
Finds elements in the DOM.
|
||||
Returns null if no match was found.
|
||||
See [`find`](find.md) for a description of parameters and selectors.
|
||||
43
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/find.md
vendored
Normal file
43
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/find.md
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
```php
|
||||
find (
|
||||
string $selector
|
||||
[, int $idx = null ]
|
||||
[, bool $lowercase = false ]
|
||||
) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------|------------------------------------------------------------|
|
||||
| `selector` | [CSS](https://www.w3.org/TR/selectors/) selector. |
|
||||
| `idx` | Index of element to return. |
|
||||
| `lowercase` | Matches tag names case insensitive (lowercase) if enabled. |
|
||||
|
||||
Finds one or more nodes in the current document, using CSS selectors.
|
||||
|
||||
* Returns null if no match was found.
|
||||
* Returns an array of [`HtmlNode`](index.md) if `$idx` is null.
|
||||
* Returns an object of type [`HtmlNode`](index.md) if `$idx` is anything __but__ null.
|
||||
|
||||
## Supported Selectors
|
||||
|
||||
| Selector | Description |
|
||||
|------------------------------------|------------------------------------------------------------------------------------------------|
|
||||
| `*` | [Universal selector](https://www.w3.org/TR/selectors/#the-universal-selector) |
|
||||
| `E` | [Type (tag name) selector](https://www.w3.org/TR/selectors/#type-selectors) |
|
||||
| `E#id` | [ID selector](https://www.w3.org/TR/selectors/#id-selectors) |
|
||||
| `E.class` | [Class selector](https://www.w3.org/TR/selectors/#class-html) |
|
||||
| `E[attr]` | [Attribute selector](https://www.w3.org/TR/selectors/#attribute-selectors) |
|
||||
| `E[attr="value"]` | [Attribute selector](https://www.w3.org/TR/selectors/#attribute-selectors) |
|
||||
| `E[attr="value"] i` | [Case-sensitivity](https://www.w3.org/TR/selectors/#attribute-case) |
|
||||
| `E[attr="value"] s` | [Case-sensitivity](https://www.w3.org/TR/selectors/#attribute-case) |
|
||||
| `E[attr~="value"]` | [Attribute selector](https://www.w3.org/TR/selectors/#attribute-selectors) |
|
||||
| `E[attr^="value"]` | [Substring matching attribute selector](https://www.w3.org/TR/selectors/#attribute-substrings) |
|
||||
| `E[attr$="value"]` | [Substring matching attribute selector](https://www.w3.org/TR/selectors/#attribute-substrings) |
|
||||
| `E[attr*="value"]` | [Substring matching attribute selector](https://www.w3.org/TR/selectors/#attribute-substrings) |
|
||||
| <code>E[attr|="value"]</code> | [Attribute selector](https://www.w3.org/TR/selectors/#attribute-selectors) |
|
||||
| `E F` | [Descendant combinator](https://www.w3.org/TR/selectors/#descendant-combinators) |
|
||||
| `E > F` | [Child combinator](https://www.w3.org/TR/selectors/#child-combinators) |
|
||||
| `E + F` | [Next-sibling combinator](https://www.w3.org/TR/selectors/#adjacent-sibling-combinators) |
|
||||
| `E ~ F` | [Subsequent-sibling combinator](https://www.w3.org/TR/selectors/#general-sibling-combinators) |
|
||||
| `E, F` | [Selector list](https://www.w3.org/TR/selectors/#selector-list) |
|
||||
| `E:not(s)` | [Negation pseudo-class](https://www.w3.org/TR/selectors-3/#negation) |
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
find_ancestor_tag ( string $tag ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|----------------------------------|
|
||||
| `tag` | Tag name of the element to find. |
|
||||
|
||||
Returns the first matching node that matches the specified tag name or null if no match was found.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
firstChild ( ) : mixed
|
||||
```
|
||||
|
||||
Returns the first child node of the current node or null if the current nod has no child nodes.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
getAllAttributes ( ) : array
|
||||
```
|
||||
|
||||
Returns all attributes for the current node.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
getAttribute ( string $name ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------|
|
||||
| `name` | Attribute name. |
|
||||
|
||||
Returns the value for the attribute `$name`.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
getElementById ( string $id ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `id` | Element id. |
|
||||
|
||||
Returns the first element with the specified id.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
getElementByTagName ( string $name ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `name` | Tag name. |
|
||||
|
||||
Returns the first element with the specified tag name.
|
||||
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
getElementsById ( string $id [, int $idx = null] ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------------------|
|
||||
| `id` | Element id. |
|
||||
| `idx` | Index of element to return. |
|
||||
|
||||
Returns all elements with the specified id if `$idx` is null, or a specific one if `$idx` is a valid index.
|
||||
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
getElementsByTagName ( string $name [, int $idx = null ] ) : mixed
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|---------------------------------|
|
||||
| `name` | Tag name. |
|
||||
| `idx` | Index of the element to return. |
|
||||
|
||||
Returns all elements with the specified tag name if `$idx` is null, or a specific one if `$idx` is a valid index.
|
||||
@@ -0,0 +1,7 @@
|
||||
```php
|
||||
get_display_size ( ) : mixed
|
||||
```
|
||||
|
||||
Returns false if the current node is not an image.
|
||||
|
||||
Returns an associative array of two elements - `height` and `width` - that represent the display size of the image.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
hasAttribute ( string $name ) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|------------------------|
|
||||
| `name` | Name of the attribute. |
|
||||
|
||||
Returns true if the current node has an attribute with the specified name.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
hasChildNodes ( ) : bool
|
||||
```
|
||||
|
||||
Returns true if the current node has one or more child nodes.
|
||||
@@ -0,0 +1,15 @@
|
||||
```php
|
||||
hasClass ( string $class ) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------------------------------|
|
||||
| `class` | Specifies the class name to search for. |
|
||||
|
||||
Returns true if the current node has the specified class name.
|
||||
|
||||
**Examples**
|
||||
|
||||
```php
|
||||
$node->hasClass('article');
|
||||
```
|
||||
24
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/index.md
vendored
Normal file
24
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/index.md
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Represents a single node in the DOM tree (see [`HtmlDocument`](../HtmlDocument/index.md)).
|
||||
|
||||
## Public Properties
|
||||
|
||||
| Property | Description |
|
||||
|-------------|----------------------------------------------------------|
|
||||
| `_` | Node meta data (i.e. type of node). |
|
||||
| `attr` | List of attributes. |
|
||||
| `children` | List of child nodes. |
|
||||
| `nodes` | List of nodes. |
|
||||
| `nodetype` | Node type. |
|
||||
| `parent` | Parent node object. |
|
||||
| `tag` | Node's tag name. |
|
||||
| `tag_start` | Start position of the tag name in the original document. |
|
||||
|
||||
## Protected Properties
|
||||
|
||||
None.
|
||||
|
||||
## Private Properties
|
||||
|
||||
| Property | Description |
|
||||
|----------|------------------------------------------------------------------|
|
||||
| `dom` | The DOM object (see [`HtmlDocument`](../HtmlDocument/index.md)). |
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
innertext ( ) : string
|
||||
```
|
||||
|
||||
Returns the inner text (everything inside the opening and closing tags) of the current node.
|
||||
@@ -0,0 +1,12 @@
|
||||
```php
|
||||
is_block_element ( object $node ) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `node` | A node |
|
||||
|
||||
Returns true if the provided element is a block level element.
|
||||
|
||||
Find more information about block level elements at
|
||||
[https://www.w3resource.com/html/HTML-block-level-and-inline-elements.php](https://www.w3resource.com/html/HTML-block-level-and-inline-elements.php)
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
is_utf8 ( string $str ) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------|
|
||||
| `str` | String to test. |
|
||||
|
||||
Returns true if the provided string is a valid UTF-8 string.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
lastChild ( ) : object
|
||||
```
|
||||
|
||||
Returns the last child of the current node or null if the current node has no child elements.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
makeup ( ) : string
|
||||
```
|
||||
|
||||
Returns the HTML representation of the current node.
|
||||
17
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/match.md
vendored
Normal file
17
wp-content/plugins/wp-optimize-premium/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/match.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
```php
|
||||
match (
|
||||
string $exp
|
||||
, string $pattern
|
||||
, string $value
|
||||
, string $case_sensitivity
|
||||
) : bool
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|--------------------|------------------|
|
||||
| `exp` | Expression |
|
||||
| `pattern` | Pattern |
|
||||
| `value` | Value |
|
||||
| `case_sensitivity` | Case sensitivity |
|
||||
|
||||
Matches a single attribute value against the specified attribute selector. See also [`find`](find.md).
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
nextSibling ( ) : object
|
||||
```
|
||||
|
||||
Returns the next sibling of the current node or null if the current node has no next sibling.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
nodeName ( ) : string
|
||||
```
|
||||
|
||||
Returns the name of the current node (tag name).
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
outertext ( ) : string
|
||||
```
|
||||
|
||||
Returns the outer text (everything including the opening and closing tags) of the current node.
|
||||
@@ -0,0 +1,10 @@
|
||||
```php
|
||||
parent ( [ object $parent = null ] ) : object
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-----------------|
|
||||
| `parent` | The parent node |
|
||||
|
||||
* Returns the parent node of the current node if `$parent` is null.
|
||||
* Sets the parent node of the current node if `$parent` is not null. In this case the current node is automatically added to the list of nodes in the parent node.
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
parentNode () : object
|
||||
```
|
||||
|
||||
Returns the current's node parent.
|
||||
@@ -0,0 +1,9 @@
|
||||
```php
|
||||
parse_selector ( string $selector_string ) : array
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
|-------------------|---------------------|
|
||||
| `selector_string` | The selector string |
|
||||
|
||||
Parses a CSS selector into an internal format for further use. See also [`find`](find.md).
|
||||
@@ -0,0 +1,5 @@
|
||||
```php
|
||||
previousSibling ( ) : object
|
||||
```
|
||||
|
||||
Returns the previous sibling of the current node, or null if the current node has no previous sibling.
|
||||
@@ -0,0 +1,37 @@
|
||||
```php
|
||||
remove ( )
|
||||
```
|
||||
|
||||
Removes the current node recursively from the DOM.
|
||||
Does nothing if the node has no parent (root node);
|
||||
|
||||
**Example**
|
||||
|
||||
```php
|
||||
$html->load(<<<EOD
|
||||
<html>
|
||||
<body>
|
||||
<table>
|
||||
<tr><th>Title</th></tr>
|
||||
<tr><td>Row 1</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
EOD
|
||||
);
|
||||
|
||||
$table = $html->find('table', 0);
|
||||
$table->remove();
|
||||
|
||||
echo $html;
|
||||
|
||||
/**
|
||||
* Returns
|
||||
*
|
||||
* <html> <body> </body> </html>
|
||||
*/
|
||||
```
|
||||
|
||||
**Remarks**
|
||||
|
||||
* Whitespace immediately **before** the removed node will remain in the DOM.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user