update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
27
www/analytics/plugins/PiwikPro/PiwikPro.php
Normal file
27
www/analytics/plugins/PiwikPro/PiwikPro.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\PiwikPro;
|
||||
|
||||
class PiwikPro extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function registerEvents()
|
||||
{
|
||||
return array(
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
);
|
||||
}
|
||||
|
||||
public function getStylesheetFiles(&$stylesheets)
|
||||
{
|
||||
$stylesheets[] = 'plugins/PiwikPro/stylesheets/widget.less';
|
||||
}
|
||||
}
|
||||
65
www/analytics/plugins/PiwikPro/Promo.php
Normal file
65
www/analytics/plugins/PiwikPro/Promo.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\PiwikPro;
|
||||
|
||||
class Promo
|
||||
{
|
||||
protected $linkTitles = array('Read more', 'Learn more');
|
||||
|
||||
protected $content = array(
|
||||
array(
|
||||
'campaignContent' => 'discoverPower',
|
||||
'text' => 'Discover the power of open-source combined with enterprise-grade support and premium functionalities.'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'bringEnterpriseLevel',
|
||||
'text' => 'Bring your analytics to enterprise level. Upgrade your Piwik platform and receive access to numerous premium features and assistance from our experts.'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'funnelAnalytics',
|
||||
'text' => 'Want Funnel Analytics? Get Premium features and enterprise-grade support from the makers of Piwik.'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'monitoringAndIncident',
|
||||
'text' => 'Do you need 24/7 Monitoring and Incident Handling for your Piwik? Get Premium features and enterprise-grade support from the makers of Piwik.'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'slowingDown',
|
||||
'text' => 'Is your Piwik slowing down? The Piwik makers can help with your server setup!'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'excitingFeatures',
|
||||
'text' => 'Want to know how to use all the exciting features in Piwik? Try our User training to be up to speed with working with Piwik.'
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'slowingDown',
|
||||
'text' => 'Did you know you can adjust the look and feel of Piwik to your brand, and even replace "Piwik" with your product name? Try our White Label product!',
|
||||
),
|
||||
array(
|
||||
'campaignContent' => 'metaSites',
|
||||
'text' => 'Did you know you can aggregate the tracked data across hundreds of sites and display it in a single dashboard? Get Premium features and enterprise-grade support.',
|
||||
),
|
||||
);
|
||||
|
||||
public function getLinkTitle()
|
||||
{
|
||||
$titles = $this->linkTitles;
|
||||
shuffle($titles);
|
||||
|
||||
return array_shift($titles);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$content = $this->content;
|
||||
shuffle($content);
|
||||
|
||||
return array_shift($content);
|
||||
}
|
||||
}
|
||||
82
www/analytics/plugins/PiwikPro/Widgets.php
Normal file
82
www/analytics/plugins/PiwikPro/Widgets.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\PiwikPro;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\PiwikPro\Advertising;
|
||||
use Piwik\Plugins\ExampleRssWidget\RssRenderer;
|
||||
use Piwik\View;
|
||||
|
||||
class Widgets extends \Piwik\Plugin\Widgets
|
||||
{
|
||||
protected $category = 'About Piwik';
|
||||
|
||||
/**
|
||||
* @var Advertising
|
||||
*/
|
||||
private $advertising;
|
||||
|
||||
/**
|
||||
* @var Promo
|
||||
*/
|
||||
private $promo;
|
||||
|
||||
public function __construct(Advertising $advertising, Promo $promo)
|
||||
{
|
||||
$this->advertising = $advertising;
|
||||
$this->promo = $promo;
|
||||
}
|
||||
|
||||
protected function init()
|
||||
{
|
||||
if ($this->advertising->arePiwikProAdsEnabled()) {
|
||||
$this->addWidget('PiwikPro_WidgetBlogTitle', 'rssPiwikPro');
|
||||
$this->addWidget('PiwikPro_WidgetPiwikProAd', 'promoPiwikPro');
|
||||
}
|
||||
}
|
||||
|
||||
public function rssPiwikPro()
|
||||
{
|
||||
try {
|
||||
$rss = new RssRenderer('https://piwik.pro/feed/');
|
||||
$rss->showDescription(true);
|
||||
|
||||
return $rss->get();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function promoPiwikPro()
|
||||
{
|
||||
$view = new View('@PiwikPro/promoPiwikProWidget');
|
||||
|
||||
$promo = $this->promo->getContent();
|
||||
|
||||
$view->ctaLinkUrl = $this->advertising->getPromoUrlForOnPremises('PromoWidget', $promo['campaignContent']);
|
||||
$view->ctaText = $promo['text'];
|
||||
$view->ctaLinkTitle = $this->promo->getLinkTitle();
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $e
|
||||
* @return string
|
||||
*/
|
||||
private function error($e)
|
||||
{
|
||||
return '<div class="pk-emptyDataTable">'
|
||||
. Piwik::translate('General_ErrorRequest', array('', ''))
|
||||
. ' - ' . $e->getMessage() . '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
13
www/analytics/plugins/PiwikPro/config/test.php
Normal file
13
www/analytics/plugins/PiwikPro/config/test.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Piwik\Tests\Framework\Mock\PiwikPro\Advertising;
|
||||
use Piwik\Plugins\PiwikPro\tests\Framework\Mock\Promo;
|
||||
|
||||
return array(
|
||||
'Piwik\PiwikPro\Advertising' => function () {
|
||||
return new Advertising();
|
||||
},
|
||||
'Piwik\Plugins\PiwikPro\Promo' => function () {
|
||||
return new Promo();
|
||||
}
|
||||
);
|
||||
BIN
www/analytics/plugins/PiwikPro/images/promo.png
Normal file
BIN
www/analytics/plugins/PiwikPro/images/promo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
6
www/analytics/plugins/PiwikPro/lang/en.json
Normal file
6
www/analytics/plugins/PiwikPro/lang/en.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"PiwikPro": {
|
||||
"WidgetBlogTitle": "Piwik PRO Blog",
|
||||
"WidgetPiwikProAd": "Piwik PRO: Advanced Analytics & Services"
|
||||
}
|
||||
}
|
||||
5
www/analytics/plugins/PiwikPro/plugin.json
Normal file
5
www/analytics/plugins/PiwikPro/plugin.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "PiwikPro",
|
||||
"description": "Provides widgets to follow Piwik PRO blog and to see info about Piwik PRO services and products.",
|
||||
"theme": false
|
||||
}
|
||||
29
www/analytics/plugins/PiwikPro/stylesheets/widget.less
Normal file
29
www/analytics/plugins/PiwikPro/stylesheets/widget.less
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
.promoWidget {
|
||||
// hard coded background color because image has hardcoded background
|
||||
background-color: white;
|
||||
|
||||
.promo {
|
||||
padding: 20px;
|
||||
&:after {
|
||||
content: '';
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
overflow: hidden;
|
||||
}
|
||||
hr {
|
||||
margin: 0px;
|
||||
}
|
||||
.link {
|
||||
padding: 20px;
|
||||
}
|
||||
.icon {
|
||||
margin-top:20px;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<div class="promoWidget">
|
||||
<div class="promo">
|
||||
<img class="icon" src="plugins/PiwikPro/images/promo.png">
|
||||
<p class="text">
|
||||
{{ ctaText }}
|
||||
<br /><br />
|
||||
<a class="btn" href="{{ ctaLinkUrl|e('html_attr') }}" target="_blank" rel="noreferrer">
|
||||
{{ ctaLinkTitle }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue