diff --git a/README.md b/README.md index 00c9fa8..977a57c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ Don't you just hate it when your beautiful HTML markup is mutilated due to a tem Use this plugin to indent the HTML markup output by WordPress using the [Dindent](https://github.com/gajus/dindent) library. It only does its thing when you are not logged in. +## Requirements + +* PHP 5.3 or greater +* Mbstring extension + ## Installation ### Composer (with [Bedrock](https://roots.io/bedrock/)) diff --git a/html-markup-indenter.php b/html-markup-indenter.php index f949eb6..6dea16a 100644 --- a/html-markup-indenter.php +++ b/html-markup-indenter.php @@ -3,7 +3,7 @@ Plugin Name: HTML Markup Indenter Plugin URI: https://github.com/joppuyo/html-markup-cleaner Description: Indents the HTML markup output by WordPress -Version: 1.0.1 +Version: 2.0.0 Author: Johannes Siipola Author URI: https://siipo.la */ @@ -20,7 +20,7 @@ }); add_action('shutdown', function () { - if (html_markup_indenter_is_html() && !is_user_logged_in()) { + if (extension_loaded('mbstring') && html_markup_indenter_is_html() && !is_user_logged_in()) { $final = ''; $levels = ob_get_level(); for ($i = 0; $i < $levels; $i++) { @@ -39,3 +39,11 @@ function html_markup_indenter_is_html() { } return false; } + +add_action('admin_notices', function() { + if (!extension_loaded('mbstring')) { + echo '

'; + echo __("Mbstring PHP extension is not loaded. HTML Markup Indenter has been disabled.", 'html-markup-indenter'); + echo '

'; + } +}); diff --git a/readme.txt b/readme.txt index d1e1463..c39d42e 100644 --- a/readme.txt +++ b/readme.txt @@ -6,14 +6,22 @@ Tested up to: 4.9.4 Requires PHP: 5.3.0 or greater License: License: GPLv3 or later -Indents the HTML markup output by WordPress +Indents the HTML markup output by WordPress. == Description == -Indents the HTML markup output by WordPress using the [Dindent](https://github.com/gajus/dindent) library. It only does its thing when you are not logged in. +Indents the HTML markup output by WordPress using the [Dindent](https://github.com/gajus/dindent) library. It only does its thing when you are not logged in. Requires PHP mbstring extension to be installed. == Installation == 1. Upload the plugin folder to the /wp-content/plugins/ directory 2. Activate the plugin through the Plugins menu in WordPress +== Changelog == + += 2.0.0 = +* Make Mbstring extension a requirement + += 1.0.1 = +* Only indent HTML markup + = 1.0.0 = * Initial release