A free, self-hostable news aggregator…
Allow CssXPath updates with composer (#4368)
Artur Weigandtd6fd78b96837
diff --git a/.markdownlintignore b/.markdownlintignoreindex b31ea81ba..1a634e542 100644--- a/.markdownlintignore+++ b/.markdownlintignore@@ -1,4 +1,4 @@-lib/CssXPath/+lib/phpgt/lib/phpmailer/node_modules/p/scripts/vendor/diff --git a/.typos.toml b/.typos.tomlindex b05117ccf..3e150d7dc 100644--- a/.typos.toml+++ b/.typos.toml@@ -29,7 +29,7 @@ extend-exclude = ["bin/","data/","docs/fr/",- "lib/CssXPath/",+ "lib/phpgt/","lib/phpmailer/","lib/SimplePie/","node_modules/",diff --git a/lib/.gitignore b/lib/.gitignoreindex f1e6fdd7e..b599767a7 100644--- a/lib/.gitignore+++ b/lib/.gitignore@@ -1,6 +1,12 @@autoload.phpcomposer.lockcomposer/+phpgt/cssxpath/.github/+phpgt/cssxpath/.gitignore+phpgt/cssxpath/.scrutinizer.yml+phpgt/cssxpath/composer.json+phpgt/cssxpath/CONTRIBUTING.md+phpgt/cssxpath/test/phpmailer/phpmailer/*oauth*phpmailer/phpmailer/COMMITMENT*phpmailer/phpmailer/composer.*diff --git a/lib/CssXPath/NotYetImplementedException.php b/lib/CssXPath/NotYetImplementedException.phpdeleted file mode 100644index 70d9492cf..000000000--- a/lib/CssXPath/NotYetImplementedException.php+++ /dev/null@@ -1,4 +0,0 @@-<?php-namespace Gt\CssXPath;--class NotYetImplementedException extends CssXPathException {}diff --git a/lib/composer.json b/lib/composer.jsonindex 3d307f6e8..6fdc90ef4 100644--- a/lib/composer.json+++ b/lib/composer.json@@ -6,9 +6,11 @@"license": "AGPL-3.0","require": {"php": ">=7.0.0",+ "phpgt/cssxpath": "v1.1.4","phpmailer/phpmailer": "6.6.0"},"config": {+ "sort-packages": true,"vendor-dir": "./"},"scripts": {diff --git a/lib/lib_rss.php b/lib/lib_rss.phpindex a4a9df36a..96a9cb2a8 100644--- a/lib/lib_rss.php+++ b/lib/lib_rss.php@@ -52,8 +52,11 @@ function classAutoloader($class) {include(LIB_PATH . '/' . str_replace('_', '/', $class) . '.php');} elseif (strpos($class, 'SimplePie') === 0) {include(LIB_PATH . '/SimplePie/' . str_replace('_', '/', $class) . '.php');- } elseif (strpos($class, 'CssXPath') !== false) {- include(LIB_PATH . '/CssXPath/' . basename(str_replace('\\', '/', $class)) . '.php');+ } elseif (str_starts_with($class, 'Gt\\CssXPath\\')) {+ $prefix = 'Gt\\CssXPath\\';+ $base_dir = LIB_PATH . '/phpgt/cssxpath/src/';+ $relative_class_name = substr($class, strlen($prefix));+ require $base_dir . str_replace('\\', '/', $relative_class_name) . '.php';} elseif (str_starts_with($class, 'PHPMailer\\PHPMailer\\')) {$prefix = 'PHPMailer\\PHPMailer\\';$base_dir = LIB_PATH . '/phpmailer/phpmailer/src/';diff --git a/lib/CssXPath/LICENSE b/lib/phpgt/cssxpath/LICENSEsimilarity index 100%rename from lib/CssXPath/LICENSErename to lib/phpgt/cssxpath/LICENSEdiff --git a/lib/CssXPath/README.md b/lib/phpgt/cssxpath/README.mdsimilarity index 100%rename from lib/CssXPath/README.mdrename to lib/phpgt/cssxpath/README.mddiff --git a/lib/CssXPath/CssXPathException.php b/lib/phpgt/cssxpath/src/CssXPathException.phpsimilarity index 50%rename from lib/CssXPath/CssXPathException.phprename to lib/phpgt/cssxpath/src/CssXPathException.phpindex bd7798243..81ad3ac9d 100644--- a/lib/CssXPath/CssXPathException.php+++ b/lib/phpgt/cssxpath/src/CssXPathException.php@@ -3,4 +3,4 @@ namespace Gt\CssXPath;use RuntimeException;-class CssXPathException extends RuntimeException {}+class CssXPathException extends RuntimeException {}\ No newline at end of filediff --git a/lib/phpgt/cssxpath/src/NotYetImplementedException.php b/lib/phpgt/cssxpath/src/NotYetImplementedException.phpnew file mode 100644index 000000000..39d12b3bc--- /dev/null+++ b/lib/phpgt/cssxpath/src/NotYetImplementedException.php@@ -0,0 +1,4 @@+<?php+namespace Gt\CssXPath;++class NotYetImplementedException extends CssXPathException {}\ No newline at end of filediff --git a/lib/CssXPath/Translator.php b/lib/phpgt/cssxpath/src/Translator.phpsimilarity index 100%rename from lib/CssXPath/Translator.phprename to lib/phpgt/cssxpath/src/Translator.phpdiff --git a/phpcs.xml b/phpcs.xmlindex 2d53b5996..21458e27d 100644--- a/phpcs.xml+++ b/phpcs.xml@@ -3,8 +3,8 @@<description>Created with the PHP Coding Standard Generator. https://edorian.github.com/php-coding-standard-generator/</description><arg name="extensions" value="php,phtml,css,js"/><arg name="tab-width" value="4"/>- <exclude-pattern>./lib/CssXPath/</exclude-pattern><exclude-pattern>./lib/SimplePie/</exclude-pattern>+ <exclude-pattern>./lib/phpgt/</exclude-pattern><exclude-pattern>./lib/phpmailer/</exclude-pattern><exclude-pattern>./lib/http-conditional.php</exclude-pattern><exclude-pattern>./node_modules/</exclude-pattern>diff --git a/tests/lib/CssXPath/CssXPathTest.php b/tests/lib/CssXPath/CssXPathTest.phpnew file mode 100644index 000000000..c6fe24fc8--- /dev/null+++ b/tests/lib/CssXPath/CssXPathTest.php@@ -0,0 +1,8 @@+<?php++class CssXPathTest extends PHPUnit\Framework\TestCase+{+ public function testCssXPathTranslatorClassExists() {+ $this->assertTrue(class_exists('Gt\\CssXPath\\Translator'));+ }+}diff --git a/tests/lib/PHPMailer/PHPMailerTest.php b/tests/lib/PHPMailer/PHPMailerTest.phpindex 4707e2a1e..8fc14b815 100644--- a/tests/lib/PHPMailer/PHPMailerTest.php+++ b/tests/lib/PHPMailer/PHPMailerTest.php@@ -1,7 +1,7 @@<?php-class PHPMailerTest extends PHPUnit\Framework\TestCase {-+class PHPMailerTest extends PHPUnit\Framework\TestCase+{public function testPHPMailerClassExists() {$this->assertTrue(class_exists('PHPMailer\\PHPMailer\\PHPMailer'));}