mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Fixed piwik-analytics plugin
This commit is contained in:
parent
139f412b6a
commit
11b66abd17
2 changed files with 38 additions and 37 deletions
|
|
@ -1,35 +1,36 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class PiwikAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
class PiwikAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function Init()
|
public function Init()
|
||||||
{
|
{
|
||||||
if ('' !== $this->Config()->Get('plugin', 'account', ''))
|
if ('' !== $this->Config()->Get('plugin', 'piwik_url', '') &&
|
||||||
{
|
'' !== $this->Config()->Get('plugin', 'site_id', ''))
|
||||||
$this->addJs('js/include.js');
|
{
|
||||||
}
|
$this->addJs('js/include.js');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return array
|
/**
|
||||||
*/
|
* @return array
|
||||||
public function configMapping()
|
*/
|
||||||
{
|
public function configMapping()
|
||||||
$oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL')
|
{
|
||||||
->SetAllowedInJs(true);
|
$oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL')
|
||||||
|
->SetAllowedInJs(true);
|
||||||
$oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID')
|
|
||||||
->SetAllowedInJs(true);
|
$oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID')
|
||||||
|
->SetAllowedInJs(true);
|
||||||
if (\method_exists($oUrl, 'SetPlaceholder'))
|
|
||||||
{
|
if (\method_exists($oUrl, 'SetPlaceholder'))
|
||||||
$oUrl->SetPlaceholder('http://');
|
{
|
||||||
$oSiteID->SetPlaceholder('');
|
$oUrl->SetPlaceholder('http://');
|
||||||
}
|
$oSiteID->SetPlaceholder('');
|
||||||
|
}
|
||||||
return array($oUrl, $oSiteID);
|
|
||||||
}
|
return array($oUrl, $oSiteID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
var
|
var
|
||||||
sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'),
|
sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'),
|
||||||
sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id')
|
sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id')
|
||||||
|
|
@ -9,7 +9,7 @@ $(function () {
|
||||||
if ('' !== sPiwikURL && '' !== sSiteID)
|
if ('' !== sPiwikURL && '' !== sSiteID)
|
||||||
{
|
{
|
||||||
sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/';
|
sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/';
|
||||||
if (/^https?:/i.test(sPiwikURL))
|
if (!/^https?:/i.test(sPiwikURL))
|
||||||
{
|
{
|
||||||
sPiwikURL = 'http://' + sPiwikURL;
|
sPiwikURL = 'http://' + sPiwikURL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue