diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..4926c28
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,34 @@
+name: Tests
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ tests:
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [7.4, '8.0', 8.1]
+
+ name: PHP ${{ matrix.php }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: dom, curl, libxml, mbstring, zip
+ coverage: none
+
+ - name: Install dependencies
+ run: |
+ composer update --prefer-dist --no-interaction --no-progress
+
+ - name: Execute tests
+ run: vendor/bin/phpunit --verbose
diff --git a/README.md b/README.md
index d125461..30bb658 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,20 @@
InlineStyle
===========
-[](https://travis-ci.org/christiaan/InlineStyle)
-[](https://scrutinizer-ci.com/g/christiaan/InlineStyle/)
+
+
+
+
+
+
+
+
+
+
+
+
+
+This is a fork of the original repository (christiaan/InlineStyle)[https://github.com/christiaan/InlineStyle] by [Christiaan Baartse
+](https://github.com/christiaan)
InlineStyle provides an easy way to apply embedded and external stylesheets
directly as inline styles on the HTML tags. This is especially targetted at mail
@@ -10,51 +23,59 @@ for HTML tags.
Installation
------------
-Run
- composer.phar require inlinestyle/inlinestyle
+```
+composer require inlinestyle/inlinestyle
+```
+
Or add the following to your composer.json file
- "require": {
- "inlinestyle/inlinestyle": "1.*"
- }
+```
+"require": {
+ "inlinestyle/inlinestyle": "^2.0"
+}
+```
-Usage
+## Usage
-----
Use composer to download required dependencies.
Import InlineStyle
-
- use \InlineStyle\InlineStyle;
-
+```
+use \InlineStyle\InlineStyle;
+```
Create a new InlineStyle object from either a HTML string or HTML file.
-
- $htmldoc = new InlineStyle("testfiles/test.html");
-
+```
+$htmldoc = new InlineStyle("testfiles/test.html");
+```
or
-
- $htmldoc = new InlineStyle(file_get_contents("http://github.com"));
-
+```
+$htmldoc = new InlineStyle(file_get_contents("http://github.com"));
+```
### Apply the embedded and external stylesheets
-
+-----
First we'll have to extract the stylesheets from the document and then we have
to apply them.
-
- $htmldoc->applyStylesheet($htmldoc->extractStylesheets());
-
+```
+$htmldoc->applyStylesheet($htmldoc->extractStylesheets());
+```
The second param is the base url that is used to parse the links to external
stylesheets.
-
- $htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, "http://github.com"));
+```
+$htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, "http://github.com"));
+```
### Applying additional stylesheets
This class can also be used to apply a given css template to each processed HTML
file.
-
- $htmldoc->applyStylesheet(file_get_contents("testfiles/external.css"));
+```
+$htmldoc->applyStylesheet(file_get_contents("testfiles/external.css"));
+```
### Retrieving the modified HTML
After calling applyStylesheet various times the resulting HTML can be retrieved as a string using getHTML.
- $html = $htmldoc->getHTML();
+```
+$html = $htmldoc->getHTML();
+```
diff --git a/composer.json b/composer.json
index 155edd3..388ed2d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,5 @@
{
- "name": "inlinestyle/inlinestyle",
+ "name": "codeat3/inlinestyle",
"type": "library",
"description": "Apply CSS stylesheets directly as inline styles to a HTML document",
"keywords": ["css", "email", "inline"],
@@ -13,13 +13,20 @@
}
],
"require": {
- "php": ">=5.3.3",
- "symfony/css-selector": ">=2.1"
+ "php": "^7.4|^8.0",
+ "symfony/css-selector": "^5.0|^6.0|^7.0"
},
"require-dev": {
- "phpunit/phpunit": "3.7.*"
+ "phpunit/phpunit": "^9.0"
},
"autoload": {
- "psr-0": { "InlineStyle": "" }
+ "psr-4": {
+ "Codeat3\\InlineStyle\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\": "tests"
+ }
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 6cd729e..5a7c485 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -13,7 +13,7 @@
>
Paragraph 1
+Paragraph 2
+Paragraph 1
+Paragraph 2
+Paragraph
Strong @@ -307,6 +385,7 @@ function testMultipleStylesheets28() { HTML; + $this->assertEquals($expected, $htmldoc->getHTML()); } @@ -316,8 +395,12 @@ function testMediaStylesheets31() { $expected = << -