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 '