diff options
author | fox <[email protected]> | 2021-08-18 07:51:19 +0300 |
---|---|---|
committer | fox <[email protected]> | 2021-08-18 07:51:19 +0300 |
commit | 28eafa2bcd6e327e7014174c4efd4c10d9491e27 (patch) | |
tree | efd9e28718eff791dcaa7ffddbac44c38deedfb8 /plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM | |
parent | a73e3bec45c5523910c711cf882976b71781ac9e (diff) | |
parent | b6b6771d8d7dcf13938d1578099074b0123a5d5e (diff) |
Merge pull request 'pull latest readability-php via composer' (#42) from niehztog/tt-rss:update-readability into master
Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/42
Diffstat (limited to 'plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM')
15 files changed, 246 insertions, 0 deletions
diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php new file mode 100644 index 000000000..91729f3b1 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMAttr.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMAttr extends \DOMAttr +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php new file mode 100644 index 000000000..4535e4e99 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCdataSection.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMCdataSection extends \DOMCdataSection +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php new file mode 100644 index 000000000..e4db11a06 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMCharacterData.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMCharacterData extends \DOMCharacterData +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php new file mode 100644 index 000000000..13b004aff --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMComment.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMComment extends \DOMComment +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php new file mode 100644 index 000000000..81e9c7de6 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocument.php @@ -0,0 +1,30 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMDocument extends \DOMDocument +{ + use NodeTrait; + + public function __construct($version, $encoding) + { + parent::__construct($version, $encoding); + + $this->registerNodeClass('DOMAttr', DOMAttr::class); + $this->registerNodeClass('DOMCdataSection', DOMCdataSection::class); + $this->registerNodeClass('DOMCharacterData', DOMCharacterData::class); + $this->registerNodeClass('DOMComment', DOMComment::class); + $this->registerNodeClass('DOMDocument', self::class); + $this->registerNodeClass('DOMDocumentFragment', DOMDocumentFragment::class); + $this->registerNodeClass('DOMDocumentType', DOMDocumentType::class); + $this->registerNodeClass('DOMElement', DOMElement::class); + $this->registerNodeClass('DOMEntity', DOMEntity::class); + $this->registerNodeClass('DOMEntityReference', DOMEntityReference::class); + $this->registerNodeClass('DOMNode', DOMNode::class); + $this->registerNodeClass('DOMNotation', DOMNotation::class); + $this->registerNodeClass('DOMProcessingInstruction', DOMProcessingInstruction::class); + $this->registerNodeClass('DOMText', DOMText::class); + } +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php new file mode 100644 index 000000000..bcb89468d --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentFragment.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMDocumentFragment extends \DOMDocumentFragment +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php new file mode 100644 index 000000000..18705a7a7 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMDocumentType.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMDocumentType extends \DOMDocumentType +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php new file mode 100644 index 000000000..c07670bf7 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMElement extends \DOMElement +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php new file mode 100644 index 000000000..8493e7319 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntity.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMEntity extends \DOMEntity +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php new file mode 100644 index 000000000..32cecb75c --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMEntityReference.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMEntityReference extends \DOMEntityReference +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php new file mode 100644 index 000000000..7c3c4f3a2 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNode.php @@ -0,0 +1,14 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +/** + * @method getAttribute($attribute) + * @method hasAttribute($attribute) + */ +class DOMNode extends \DOMNode +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php new file mode 100644 index 000000000..5149c0b98 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNodeList.php @@ -0,0 +1,82 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +/** + * Class DOMNodeList. + * + * This is a fake DOMNodeList class that allows adding items to the list. The original class is static and the nodes + * are defined automagically when instantiating it. This fake version behaves exactly the same way but adds the function + * add() that allows to insert new DOMNodes into the DOMNodeList. + * + * It cannot extend the original DOMNodeList class because the functionality behind the property ->length is hidden + * from the user and cannot be extended, changed, or tweaked. + */ +class DOMNodeList implements \Countable, \IteratorAggregate +{ + /** + * @var array + */ + protected $items = []; + + /** + * @var int + */ + protected $length = 0; + + /** + * To allow access to length in the same way that DOMNodeList allows. + * + * {@inheritdoc} + */ + public function __get($name) + { + switch ($name) { + case 'length': + return $this->length; + default: + trigger_error(sprintf('Undefined property: %s::%s', static::class, $name)); + } + } + + /** + * @param DOMNode|DOMElement|DOMComment $node + * + * @return DOMNodeList + */ + public function add($node) + { + $this->items[] = $node; + $this->length++; + + return $this; + } + + /** + * @param int $offset + * + * @return DOMNode|DOMElement|DOMComment + */ + public function item(int $offset) + { + return $this->items[$offset]; + } + + /** + * @return int|void + */ + public function count(): int + { + return $this->length; + } + + /** + * To make it compatible with iterator_to_array() function. + * + * {@inheritdoc} + */ + public function getIterator(): \ArrayIterator + { + return new \ArrayIterator($this->items); + } +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php new file mode 100644 index 000000000..2e888ce00 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMNotation.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMNotation extends \DOMNotation +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php new file mode 100644 index 000000000..9dd4c5c70 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMProcessingInstruction.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMProcessingInstruction extends \DOMProcessingInstruction +{ + use NodeTrait; +} diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMText.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMText.php new file mode 100644 index 000000000..42c575b49 --- /dev/null +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMText.php @@ -0,0 +1,10 @@ +<?php + +namespace andreskrey\Readability\Nodes\DOM; + +use andreskrey\Readability\Nodes\NodeTrait; + +class DOMText extends \DOMText +{ + use NodeTrait; +} |