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('#
  • (.*?)
  • #', ' ', $content); + } + + /** + * Redirect old mailto links to home by HTTP STATUS 301 method + * @return string without list elemenent email-icon + * @since Version 3.6.2 + */ + private function redirectOldMailtoLinks() + { + if(strpos(JUri::current(), 'component/mailto') !== false){ + JFactory::getApplication()->redirect(JURI::base(),301); + } } /** diff --git a/dd_disable_mailto.xml b/dd_disable_mailto.xml index e87d278..28e6c00 100644 --- a/dd_disable_mailto.xml +++ b/dd_disable_mailto.xml @@ -1,7 +1,7 @@ PLG_SYSTEM_DD_DISABLE_MAILTO - 1.1.0.0 + 1.2.0.0 01.01.2016 Didldu e.K. Florian Häusler info@hr-it-solutions.com @@ -34,6 +34,24 @@ + + + + + + + + diff --git a/dd_disable_mailto_script.php b/dd_disable_mailto_script.php index 36b905e..2ddcf1b 100644 --- a/dd_disable_mailto_script.php +++ b/dd_disable_mailto_script.php @@ -1,4 +1,11 @@ This removes also the "recommend to a friend link" and the "recommend to a friend form" from frontend.

    Plugin must be enabled to trigger enable/disable events. To undo changes, just need to uninstall Plugin." PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_DISABLE_MAILTO_LABEL="Mailto Component" -PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_DISABLE_MAILTO="This will enable/disable Joomla locked Mailto Component. Set disable to disable mailto function!" \ No newline at end of file +PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_DISABLE_MAILTO="This will enable/disable Joomla locked Mailto Component. Set disable to disable mailto function!" +PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_REMOVE_MAILTO_LINK_LABEL="Remove mailto link from frontend
    (experimental: configured based on tpl protostar ) " +PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_REMOVE_MAILTO_LINK="This will remove all bootstrap