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
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -8,21 +8,18 @@
|
|||
*/
|
||||
namespace Piwik\Plugins\ExampleRssWidget;
|
||||
|
||||
use Piwik\WidgetsList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ExampleRssWidget extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
public function registerEvents()
|
||||
{
|
||||
return array(
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
'WidgetsList.addWidgets' => 'addWidgets'
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -30,10 +27,4 @@ class ExampleRssWidget extends \Piwik\Plugin
|
|||
{
|
||||
$stylesheets[] = "plugins/ExampleRssWidget/stylesheets/rss.less";
|
||||
}
|
||||
|
||||
public function addWidgets()
|
||||
{
|
||||
WidgetsList::add('Example Widgets', 'Piwik.org Blog', 'ExampleRssWidget', 'rssPiwik');
|
||||
WidgetsList::add('Example Widgets', 'Piwik Changelog', 'ExampleRssWidget', 'rssChangelog');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -54,7 +54,7 @@ class RssRenderer
|
|||
$i = 0;
|
||||
|
||||
$items = array();
|
||||
if(!empty($rss->channel->item)) {
|
||||
if (!empty($rss->channel->item)) {
|
||||
$items = $rss->channel->item;
|
||||
}
|
||||
foreach ($items as $post) {
|
||||
|
|
|
|||
|
|
@ -1,29 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* 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\ExampleRssWidget;
|
||||
|
||||
use Exception;
|
||||
use Piwik\Common;
|
||||
use Piwik\Piwik;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Controller extends \Piwik\Plugin\Controller
|
||||
class Widgets extends \Piwik\Plugin\Widgets
|
||||
{
|
||||
protected $category = 'About Piwik';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->addWidget('Piwik.org Blog', 'rssPiwik');
|
||||
$this->addWidget('Piwik Changelog', 'rssChangelog');
|
||||
}
|
||||
|
||||
public function rssPiwik()
|
||||
{
|
||||
try {
|
||||
$rss = new RssRenderer('http://feeds.feedburner.com/Piwik');
|
||||
$rss->showDescription(true);
|
||||
|
||||
return $rss->get();
|
||||
} catch (Exception $e) {
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->error($e);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,19 +42,23 @@ class Controller extends \Piwik\Plugin\Controller
|
|||
$rss->setCountPosts(1);
|
||||
$rss->showDescription(true);
|
||||
$rss->showContent(false);
|
||||
|
||||
return $rss->get();
|
||||
} catch (Exception $e) {
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $e
|
||||
* @return string
|
||||
*/
|
||||
protected function error($e)
|
||||
private function error($e)
|
||||
{
|
||||
return '<div class="pk-emptyDataTable">'
|
||||
. Piwik::translate('General_ErrorRequest')
|
||||
. ' - ' . $e->getMessage() . '</div>';
|
||||
. Piwik::translate('General_ErrorRequest', array('', ''))
|
||||
. ' - ' . $e->getMessage() . '</div>';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ExampleRssWidget",
|
||||
"description": "Example Plugin: This plugin showcases how to create a new widget that displays a user submitted RSS feed.",
|
||||
"description": "Piwik Platform showcase: how to create a new widget that displays a user submitted RSS feed.",
|
||||
"version": "1.0",
|
||||
"keywords": ["example", "feed", "widget"],
|
||||
"homepage": "http://piwik.org",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue