mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Move plugins to webmail repository.
This commit is contained in:
parent
17958b15cb
commit
cf0968b5a8
32 changed files with 4348 additions and 0 deletions
20
plugins/google-analytics/LICENSE
Normal file
20
plugins/google-analytics/LICENSE
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 RainLoop Team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
1
plugins/google-analytics/README
Normal file
1
plugins/google-analytics/README
Normal file
|
|
@ -0,0 +1 @@
|
|||
Embed Google Analytics (Universal Analytics) code into your webmail installation pages.
|
||||
1
plugins/google-analytics/VERSION
Normal file
1
plugins/google-analytics/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.4
|
||||
43
plugins/google-analytics/index.php
Normal file
43
plugins/google-analytics/index.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
class GoogleAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Init()
|
||||
{
|
||||
if ('' !== $this->Config()->Get('plugin', 'account', ''))
|
||||
{
|
||||
$this->addJs('js/include.js');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function configMapping()
|
||||
{
|
||||
return array(
|
||||
\RainLoop\Plugins\Property::NewInstance('account')->SetLabel('Account')
|
||||
->SetAllowedInJs(true)
|
||||
->SetDescription('UA-XXXXXXXX-X')
|
||||
->SetDefaultValue(''),
|
||||
\RainLoop\Plugins\Property::NewInstance('domain_name')->SetLabel('Domain Name')
|
||||
->SetAllowedInJs(true)
|
||||
->SetDefaultValue(''),
|
||||
\RainLoop\Plugins\Property::NewInstance('universal_analytics')->SetLabel('Use Universal Analytics')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||
->SetAllowedInJs(true)
|
||||
->SetDefaultValue(true),
|
||||
\RainLoop\Plugins\Property::NewInstance('track_pageview')->SetLabel('Track Pageview')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||
->SetAllowedInJs(true)
|
||||
->SetDefaultValue(true),
|
||||
\RainLoop\Plugins\Property::NewInstance('send_events')->SetLabel('Send Events')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||
->SetAllowedInJs(true)
|
||||
->SetDefaultValue(false)
|
||||
);
|
||||
}
|
||||
}
|
||||
95
plugins/google-analytics/js/include.js
Normal file
95
plugins/google-analytics/js/include.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
|
||||
$(function () {
|
||||
|
||||
var
|
||||
sAccount = window.rl.pluginSettingsGet('google-analytics', 'account'),
|
||||
sDomain = window.rl.pluginSettingsGet('google-analytics', 'domain_name'),
|
||||
bUniversalAnalytics = !!window.rl.pluginSettingsGet('google-analytics', 'universal_analytics'),
|
||||
bTrackPageview = !!window.rl.pluginSettingsGet('google-analytics', 'track_pageview'),
|
||||
bSendEvent = !!window.rl.pluginSettingsGet('google-analytics', 'send_events'),
|
||||
fSendEvent = null
|
||||
;
|
||||
|
||||
if (sAccount && '' !== sAccount)
|
||||
{
|
||||
if (bUniversalAnalytics)
|
||||
{
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
if (window.ga)
|
||||
{
|
||||
if (sDomain)
|
||||
{
|
||||
window.ga('create', sAccount, sDomain);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.ga('create', sAccount);
|
||||
}
|
||||
|
||||
if (bTrackPageview)
|
||||
{
|
||||
window.ga('send', 'pageview');
|
||||
window.setInterval(function () {
|
||||
window.ga('send', 'pageview');
|
||||
}, 1000 * 60 * 2);
|
||||
}
|
||||
|
||||
if (bSendEvent)
|
||||
{
|
||||
fSendEvent = function(sCategory, sAction, sLabel) {
|
||||
window.ga('send', 'event', sCategory, sAction, sLabel);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
window._gaq = window._gaq || [];
|
||||
window._gaq.push(['_setAccount', sAccount]);
|
||||
|
||||
if (sDomain)
|
||||
{
|
||||
window._gaq.push(['_setDomainName', sDomain]);
|
||||
}
|
||||
|
||||
if (bTrackPageview)
|
||||
{
|
||||
window._gaq.push(['_trackPageview']);
|
||||
window.setInterval(function () {
|
||||
window._gaq.push(['_trackPageview']);
|
||||
}, 1000 * 60 * 2);
|
||||
}
|
||||
|
||||
if (bSendEvent)
|
||||
{
|
||||
fSendEvent = function(sCategory, sAction, sLabel) {
|
||||
window._gaq.push(['_trackEvent', sCategory, sAction, sLabel]);
|
||||
};
|
||||
}
|
||||
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
}
|
||||
|
||||
if (fSendEvent)
|
||||
{
|
||||
window.rl.addHook('ajax-default-response', function (sAction, oData, sType) {
|
||||
switch (sAction)
|
||||
{
|
||||
case 'Login':
|
||||
case 'SendMessage':
|
||||
case 'MessageMove':
|
||||
case 'MessageDelete':
|
||||
fSendEvent('RainLoop', sAction,
|
||||
'success' === sType && oData && oData['Result'] ? 'true' : 'false');
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue