Skip to content

Commit

Permalink
Merge pull request #8 from Didldu-Florian/master
Browse files Browse the repository at this point in the history
Version Update
  • Loading branch information
HRIT-Florian authored Feb 26, 2017
2 parents 1bef92f + 772d1de commit 554cbe9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions dd_disable_mailto.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @version 1-2-1-0 // Y-m-d 2016-10-04
* @version 1-2-2-0 // Y-m-d 2017-02-26
* @author HR IT-Solutions Florian Häusler https://www.hr-it-solutions.com
* @copyright Copyright (C) 2011 - 2016 Didldu e.K. | HR IT-Solutions
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
Expand All @@ -17,6 +17,8 @@
class plgSystemDD_Disable_MailTo extends JPlugin
{

protected $app;

// Plugin info constants
const TYPE = 'system';
const NAME = 'dd_disable_mailto';
Expand All @@ -34,11 +36,9 @@ function __construct( $subject )
$this->plugin = JPluginHelper::getPlugin(self::TYPE, self::NAME);
$this->params = new JRegistry($this->plugin->params);

$app = JFactory::getApplication();

if ($app->isAdmin()){ // Trigger Events only in Backend
if ($this->app->isAdmin()){ // Trigger Events only in Backend

$option = $app->input->get->get("option",0,"STR");
$option = $this->app->input->get->get("option",0,"STR");

if($option === "com_plugins" ){ // And only on plugin page, to save performance

Expand Down Expand Up @@ -78,16 +78,15 @@ public function onAfterRoute(){
*/
public function onAfterRender()
{
$app = JFactory::getApplication();
// Front end
if ($app instanceof JApplicationSite)
if ($this->app instanceof JApplicationSite)
{

if ($this->params->get('remove_mailto_link',0)) // Remove mailTo link Option
{
$html = $app->getBody();
$html = $this->app->getBody();
$html = $this->remveMailtoLink($html);
$app->setBody($html);
$this->app->setBody($html);
}

}
Expand All @@ -113,7 +112,7 @@ private function redirectOldMailtoLinks()
{
if(strpos(JUri::current(), 'component/mailto') !== false){
$alternativeURL = $this->params->get('redirect_mailto_url');
JFactory::getApplication()->redirect(JURI::base() . $alternativeURL,301);
$this->app->redirect(JURI::base() . $alternativeURL,301);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dd_disable_mailto.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="system" method="upgrade">
<name>PLG_SYSTEM_DD_DISABLE_MAILTO</name>
<version>1.2.1.1</version>
<version>1.2.2.0</version>
<creationDate>01.10.2016</creationDate>
<author>HR IT-Solutions Florian Häusler</author>
<authorEmail>[email protected]</authorEmail>
Expand Down

0 comments on commit 554cbe9

Please sign in to comment.