update Piwik to version 2.16 (fixes #91)

This commit is contained in:
oliver 2016-04-10 18:55:57 +02:00
commit d885a4baa9
5833 changed files with 418860 additions and 226988 deletions

View 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';
}
}

View 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);
}
}

View 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>';
}
}

View 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();
}
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,6 @@
{
"PiwikPro": {
"WidgetBlogTitle": "Piwik PRO Blog",
"WidgetPiwikProAd": "Piwik PRO: Advanced Analytics & Services"
}
}

View 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
}

View 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;
}
}

View file

@ -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>