diff --git a/README.md b/README.md
index fc646d6..c5bf435 100644
--- a/README.md
+++ b/README.md
@@ -11,9 +11,9 @@ It´s possible to disable mailto function for each article, but not globally by
Here that Disable MailTo Plugin helps. It allows the activation and deactivation of the component by plugin settins.
By default, com_mailto will be disabled. Just need to install Disable MailTo, it´s all, simple and effective.
-This Plugin is like a switch to fire enable/disable com_mailto just on plugin save. So, it´s not realay a System Plugin,
+This plugin is like a switch to fire enable/disable com_mailto just on plugin save. So, it´s not realy a system plugin,
it´s a way beetween to optimize page load performance and bring that feature.
-**Plugin must be enabled to trigger enable/disable events. To undo changes, just need to uninstall Plugin.**
+**Plugin must be enabled to trigger enable/disable events. To undo changes, just need to uninstall plugin.**
# System requirements
Joomla 3.x +
diff --git a/dd_disable_mailto.php b/dd_disable_mailto.php
index bfd1694..a5812b3 100644
--- a/dd_disable_mailto.php
+++ b/dd_disable_mailto.php
@@ -1,6 +1,6 @@
isAdmin()){ // Trigger Events only in Backend
+ // Load plugin parameters
+ $this->plugin = JPluginHelper::getPlugin(self::TYPE, self::NAME);
+ $this->params = new JRegistry($this->plugin->params);
- $input = JFactory::getApplication()->input;
- $option = $input->get->get("option",0,"STR");
+ $app = JFactory::getApplication();
- if($option === "com_plugins" ){ // And only on plugin page, to save performance
+ if ($app->isAdmin()){ // Trigger Events only in Backend
+
+ $option = $app->input->get->get("option",0,"STR");
- // Load plugin parameters
- $this->plugin = JPluginHelper::getPlugin(self::TYPE, self::NAME);
- $this->params = new JRegistry($this->plugin->params);
+ if($option === "com_plugins" ){ // And only on plugin page, to save performance
$disable_mailTo = $this->params->get('disable_mailto',0);
@@ -52,7 +53,67 @@ function __construct( $subject )
}
}
+ }
+
+
+ /**
+ * onAfterRoute Event
+ * - redirectOldMailtoLinks
+ * @since Version 3.6.2
+ */
+ public function onAfterRoute(){
+
+ // Redirect old mailTo otion
+ if ($this->params->get('redirect_mailto',0))
+ {
+ $this->redirectOldMailtoLinks(); // Redirect
+ }
+
+ }
+
+ /**
+ * onAfterRender Event
+ * - remveMailtoLink
+ * @since Version 3.6.2
+ */
+ public function onAfterRender()
+ {
+ $app = JFactory::getApplication();
+ // Front end
+ if ($app instanceof JApplicationSite)
+ {
+
+ if ($this->params->get('remove_mailto_link',0)) // Remove mailTo link Option
+ {
+ $html = $app->getBody();
+ $html = $this->remveMailtoLink($html);
+ $app->setBody($html);
+ }
+
+ }
+ }
+
+ /**
+ * Remove bootstrap mailto list link (like protostar, etc...) method
+ * @return string without list elemenent email-icon
+ * @since Version 3.6.2
+ */
+ private function remveMailtoLink($content)
+ {
+ return preg_replace('#