mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Fixed piwik-analytics plugin
This commit is contained in:
parent
139f412b6a
commit
11b66abd17
|
@ -1,35 +1,36 @@
|
|||
<?php
|
||||
|
||||
class PiwikAnalyticsPlugin 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()
|
||||
{
|
||||
$oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL')
|
||||
->SetAllowedInJs(true);
|
||||
|
||||
$oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID')
|
||||
->SetAllowedInJs(true);
|
||||
|
||||
if (\method_exists($oUrl, 'SetPlaceholder'))
|
||||
{
|
||||
$oUrl->SetPlaceholder('http://');
|
||||
$oSiteID->SetPlaceholder('');
|
||||
}
|
||||
|
||||
return array($oUrl, $oSiteID);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
class PiwikAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Init()
|
||||
{
|
||||
if ('' !== $this->Config()->Get('plugin', 'piwik_url', '') &&
|
||||
'' !== $this->Config()->Get('plugin', 'site_id', ''))
|
||||
{
|
||||
$this->addJs('js/include.js');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function configMapping()
|
||||
{
|
||||
$oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL')
|
||||
->SetAllowedInJs(true);
|
||||
|
||||
$oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID')
|
||||
->SetAllowedInJs(true);
|
||||
|
||||
if (\method_exists($oUrl, 'SetPlaceholder'))
|
||||
{
|
||||
$oUrl->SetPlaceholder('http://');
|
||||
$oSiteID->SetPlaceholder('');
|
||||
}
|
||||
|
||||
return array($oUrl, $oSiteID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
$(function () {
|
||||
|
||||
|
||||
var
|
||||
sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'),
|
||||
sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id')
|
||||
|
@ -9,7 +9,7 @@ $(function () {
|
|||
if ('' !== sPiwikURL && '' !== sSiteID)
|
||||
{
|
||||
sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/';
|
||||
if (/^https?:/i.test(sPiwikURL))
|
||||
if (!/^https?:/i.test(sPiwikURL))
|
||||
{
|
||||
sPiwikURL = 'http://' + sPiwikURL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue