Skip to content

Commit

Permalink
Merge pull request #1 from Didldu-Florian/master
Browse files Browse the repository at this point in the history
Version 1-1-0-0 initial commit
  • Loading branch information
HRIT-Florian authored Oct 1, 2016
2 parents da39dec + 7167134 commit c3a7e6a
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

76 changes: 76 additions & 0 deletions dd_disable_mailto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**
* @version 1-1-0-0 // Y-m-d 2016-10-01
* @author Didldu e.K. 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
**/

defined('_JEXEC') or die;

jimport('joomla.plugin.plugin');
jimport('joomla.access.access');

/**
* Joomla! system plugin to disable mailto extension
*/
class plgSystemDD_Disable_MailTo extends JPlugin
{

// Plugin info constants
const TYPE = 'system';
const NAME = 'dd_disable_mailto';

/**
* onUserAfterSave Events
* @since Version 3.6.2
*/
function __construct( $subject )
{

parent::__construct($subject);

if (JFactory::getApplication()->isAdmin()){ // Trigger Events only in Backend

$input = JFactory::getApplication()->input;
$option = $input->get->get("option",0,"STR");

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

// Load plugin parameters
$this->plugin = JPluginHelper::getPlugin(self::TYPE, self::NAME);
$this->params = new JRegistry($this->plugin->params);

$disable_mailTo = $this->params->get('disable_mailto',0);

if(!$disable_mailTo){
$this->set_mailTo(false);
} else {
$this->set_mailTo();
}

}

}

}

/**
* Enable / Disable com_mailto extension method
* @param $enable boolean true = enabled
* @since Version 3.6.2
*/
private function set_mailTo($enable = true)
{
$enable = intval($enable);
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__extensions')
->set($db->quoteName('enabled') . ' = ' . $enable)
->where($db->quoteName('element') . ' = ' . $db->quote('com_mailto'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'));
$db->setQuery($query);
$db->execute();
}

}
40 changes: 40 additions & 0 deletions dd_disable_mailto.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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.1.0.0</version>
<creationDate>01.01.2016</creationDate>
<author>Didldu e.K. Florian Häusler</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>Didldu e.K. Florian Häusler https://www.hr-it-solutions.com</authorUrl>
<copyright>Copyright (C) 2011 - 2016 Didldu e.K. | HR IT-Solutions</copyright>
<license>GNU/GPLv2 only</license>
<description>PLG_SYSTEM_DD_DISABLE_MAILTO_XML_DESCRIPTION</description>
<files>
<filename plugin="dd_disable_mailto">dd_disable_mailto.php</filename>
<filename>index.html</filename>
<filename>dd_disable_mailto_script.php</filename>
</files>
<languages>
<language tag="en-GB">language/en-GB/en-GB.plg_system_dd_disable_mailto.sys.ini</language>
</languages>
<scriptfile>dd_disable_mailto_script.php</scriptfile>
<updateservers>
<server type="collection" priority="1" name="HR IT-Solutions Updates">http://www.hr-it-solutions.com/jextensions/update.xml</server>
</updateservers>

<config>
<fields name="params">
<fieldset name="basic">
<field name="disable_mailto"
type="radio"
default="0"
label="PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_DISABLE_MAILTO_LABEL"
description="PLG_SYSTEM_DD_DISABLE_MAILTO_FIELD_DISABLE_MAILTO"
class="btn-group" >
<option value="1">JENABLED</option>
<option value="0">JDISABLED</option>
</field>
</fieldset>
</fields>
</config>
</extension>
21 changes: 21 additions & 0 deletions dd_disable_mailto_script.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
defined('_JEXEC') or die();

class plgSystemDD_Disable_MailToInstallerScript
{
/**
* Reset Joomla default settings
* @since Version 3.6.2
*/
public function uninstall()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__extensions')
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('element') . ' = ' . $db->quote('com_mailto'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'));
$db->setQuery($query);
$db->execute();
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>
9 changes: 9 additions & 0 deletions language/en-GB/en-GB.plg_system_dd_disable_mailto.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; @version 1-1-0-0 // Y-m-d 2016-10-01
; @author Didldu e.K. 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

PLG_SYSTEM_DD_DISABLE_MAILTO="DD Disable Mailto"
PLG_SYSTEM_DD_DISABLE_MAILTO_XML_DESCRIPTION="System plugin to disable mailto function!<br>This removes also the "recommend to a friend link" and the "recommend to a friend form" from frontend.<br><br><b>Plugin must be enabled to trigger enable/disable events. To undo changes, just need to uninstall Plugin.</b>"
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!"
1 change: 1 addition & 0 deletions language/en-GB/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><title></title>

0 comments on commit c3a7e6a

Please sign in to comment.