diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..43b26f3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+# Created by .ignore support plugin (hsz.mobi)
+vendor
+composer.lock
+source
+.phpstorm-oxid.meta.php
+ab_htmlmin.iml
\ No newline at end of file
diff --git a/models/ab_htmlmin.php b/Core/UtilsView.php
similarity index 75%
rename from models/ab_htmlmin.php
rename to Core/UtilsView.php
index 01d889e..5778c38 100644
--- a/models/ab_htmlmin.php
+++ b/Core/UtilsView.php
@@ -11,17 +11,14 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not, see
*/
-class ab_htmlmin extends ab_htmlmin_parent {
+
+namespace AlfredBez\HtmlMin\Core;
+
+class UtilsView extends UtilsView_parent {
protected function _fillCommonSmartyProperties($oSmarty)
{
parent::_fillCommonSmartyProperties($oSmarty);
- $cfg = oxRegistry::getConfig();
-
- $aPluginsDir = $oSmarty->plugins_dir;
- $aPluginsDir[] = $cfg->getModulesDir()."/ab_htmlmin/smarty/plugins/";
$oSmarty->load_filter('output' , 'trimwhitespace');
-
- $oSmarty->plugins_dir = $aPluginsDir;
}
}
diff --git a/README.md b/README.md
index 38ba5c0..ab67f02 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,6 @@ Enables Smarty 'trimwhitespace' Outputfilter to minify HTML Code
Download
------------
-There are several ways to download the module:
-### Download-Option 1: Download via composer (recommended)
first you need [composer](https://getcomposer.org/download/)
add the module to your composer.json
@@ -21,34 +19,8 @@ add the module to your composer.json
}
```
-### Download-Option 2: Download using git clone
-```git clone https://github.com/alfredbez/ab_htmlmin.git```
-
-### Download-Option 3: Download ZIP
-[download](https://github.com/alfredbez/ab_htmlmin/archive/master.zip) and extract zip
-
-----
-
-If you downloaded the module manually or via git:
- * rename the folder to 'ab_htmlmin' if the folder name is 'ab_htmlmin-master'
- * you have to move the folder 'ab_htmlmin' to your 'modules'-folder.
-
----
**Don't forget to activate module in the OXID backend**
-----
-
-After uploading the module, your directory should look like this:
-
-```
-├── index.php
-├── bootstrap.php
-├── config.inc.php
-├── ...
-└── modules
- └── ab_htmlmin
- ├── README.md
- ├── metadata.php
- └── models
-```
+----
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 6c57557..2c4c791 100644
--- a/composer.json
+++ b/composer.json
@@ -1,9 +1,10 @@
{
"name": "alfredbez/ab_htmlmin",
- "type": "oxid-module",
+ "type": "oxideshop-module",
+ "keywords": ["oxid", "modules", "eShop"],
"description": "entfernt unnötige Whitespaces aus dem HTML-Code",
"require": {
- "composer/installers": "~1.0"
+ "oxid-esales/oxideshop-ce": "^v6.0"
},
"authors": [
{
@@ -11,5 +12,15 @@
"email": "alfred.bez@gmail.com"
}
],
+ "extra": {
+ "oxideshop": {
+ "target-directory": "ab/htmlmin"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "AlfredBez\\HtmlMin\\": "../../../source/modules/ab/htmlmin"
+ }
+ },
"minimum-stability": "dev"
}
diff --git a/metadata.php b/metadata.php
index 9636e27..9d8454e 100644
--- a/metadata.php
+++ b/metadata.php
@@ -1,7 +1,7 @@
* Author URI: http://www.alfredbez.de
*/
@@ -9,20 +9,20 @@
/**
* Metadata version
*/
-$sMetadataVersion = '1.1';
+$sMetadataVersion = '2';
/**
* Module information
*/
-$aModule = array(
- 'id' => 'ab_htmlmin',
- 'title' => 'Alfred Bez :: HTML minify',
- 'description' => 'entfernt unnötige Whitespaces aus dem HTML-Code',
- 'version' => '1.0',
- 'author' => 'Alfred Bez',
- 'url' => 'http://www.alfredbez.de',
- 'email' => 'alfred.bez@gmail.com',
- 'extend' => array(
- 'oxutilsview' => 'ab_htmlmin/models/ab_htmlmin'
- )
-);
+$aModule = [
+ 'id' => 'ab_htmlmin',
+ 'title' => 'Alfred Bez :: HTML minify',
+ 'description' => 'entfernt unnötige Whitespaces aus dem HTML-Code',
+ 'version' => '2.0',
+ 'author' => 'Alfred Bez',
+ 'url' => 'http://www.alfredbez.de',
+ 'email' => 'alfred.bez@gmail.com',
+ 'extend' => [
+ \OxidEsales\Eshop\Core\UtilsView::class => \AlfredBez\HtmlMin\Core\UtilsView::class,
+ ],
+];
diff --git a/smarty/plugins/outputfilter.trimwhitespace.php b/smarty/plugins/outputfilter.trimwhitespace.php
deleted file mode 100644
index 62ab4e7..0000000
--- a/smarty/plugins/outputfilter.trimwhitespace.php
+++ /dev/null
@@ -1,90 +0,0 @@
-.*?#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
- foreach ($matches as $match) {
- $store[] = $match[0][0];
- $_length = strlen($match[0][0]);
- $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
- $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
-
- $_offset += $_length - strlen($replace);
- $_store ++;
- }
- }
-
- // Strip all HTML-Comments
- // yes, even the ones in