add icons for Character groups
This commit is contained in:
commit
2d9a41a5fe
3461 changed files with 594457 additions and 0 deletions
53
www/analytics/plugins/ExampleRssWidget/Controller.php
Normal file
53
www/analytics/plugins/ExampleRssWidget/Controller.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @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\Piwik;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Controller extends \Piwik\Plugin\Controller
|
||||
{
|
||||
public function rssPiwik()
|
||||
{
|
||||
try {
|
||||
$rss = new RssRenderer('http://feeds.feedburner.com/Piwik');
|
||||
$rss->showDescription(true);
|
||||
return $rss->get();
|
||||
} catch (Exception $e) {
|
||||
return $this->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function rssChangelog()
|
||||
{
|
||||
try {
|
||||
$rss = new RssRenderer('http://feeds.feedburner.com/PiwikReleases');
|
||||
$rss->setCountPosts(1);
|
||||
$rss->showDescription(true);
|
||||
$rss->showContent(false);
|
||||
return $rss->get();
|
||||
} catch (Exception $e) {
|
||||
return $this->error($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $e
|
||||
*/
|
||||
protected function error($e)
|
||||
{
|
||||
return '<div class="pk-emptyDataTable">'
|
||||
. Piwik::translate('General_ErrorRequest')
|
||||
. ' - ' . $e->getMessage() . '</div>';
|
||||
}
|
||||
}
|
||||
39
www/analytics/plugins/ExampleRssWidget/ExampleRssWidget.php
Normal file
39
www/analytics/plugins/ExampleRssWidget/ExampleRssWidget.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\ExampleRssWidget;
|
||||
|
||||
use Piwik\WidgetsList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ExampleRssWidget extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
{
|
||||
return array(
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
'WidgetsList.addWidgets' => 'addWidgets'
|
||||
);
|
||||
}
|
||||
|
||||
public function getStylesheetFiles(&$stylesheets)
|
||||
{
|
||||
$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');
|
||||
}
|
||||
}
|
||||
84
www/analytics/plugins/ExampleRssWidget/RssRenderer.php
Normal file
84
www/analytics/plugins/ExampleRssWidget/RssRenderer.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\ExampleRssWidget;
|
||||
use Piwik\Http;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class RssRenderer
|
||||
{
|
||||
protected $url = null;
|
||||
protected $count = 3;
|
||||
protected $showDescription = false;
|
||||
protected $showContent = false;
|
||||
|
||||
public function __construct($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function showDescription($bool)
|
||||
{
|
||||
$this->showDescription = $bool;
|
||||
}
|
||||
|
||||
public function showContent($bool)
|
||||
{
|
||||
$this->showContent = $bool;
|
||||
}
|
||||
|
||||
public function setCountPosts($count)
|
||||
{
|
||||
$this->count = $count;
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
try {
|
||||
$content = Http::fetchRemoteFile($this->url);
|
||||
$rss = simplexml_load_string($content);
|
||||
} catch (\Exception $e) {
|
||||
echo "Error while importing feed: {$e->getMessage()}\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$output = '<div style="padding:10px 15px;"><ul class="rss">';
|
||||
$i = 0;
|
||||
|
||||
$items = array();
|
||||
if(!empty($rss->channel->item)) {
|
||||
$items = $rss->channel->item;
|
||||
}
|
||||
foreach ($items as $post) {
|
||||
$title = $post->title;
|
||||
$date = @strftime("%B %e, %Y", strtotime($post->pubDate));
|
||||
$link = $post->link;
|
||||
|
||||
$output .= '<li><a class="rss-title" title="" target="_blank" href="?module=Proxy&action=redirect&url=' . $link . '">' . $title . '</a>' .
|
||||
'<span class="rss-date">' . $date . '</span>';
|
||||
if ($this->showDescription) {
|
||||
$output .= '<div class="rss-description">' . $post->description . '</div>';
|
||||
}
|
||||
|
||||
if ($this->showContent) {
|
||||
$output .= '<div class="rss-content">' . $post->content . '</div>';
|
||||
}
|
||||
$output .= '</li>';
|
||||
|
||||
if (++$i == $this->count) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</ul></div>';
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
15
www/analytics/plugins/ExampleRssWidget/plugin.json
Normal file
15
www/analytics/plugins/ExampleRssWidget/plugin.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "ExampleRssWidget",
|
||||
"description": "Example Plugin: This plugin showcases how to create a new widget that displays a user submitted RSS feed.",
|
||||
"version": "1.0",
|
||||
"keywords": ["example", "feed", "widget"],
|
||||
"homepage": "http://piwik.org",
|
||||
"license": "GPL v3+",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Piwik",
|
||||
"email": "hello@piwik.org",
|
||||
"homepage": "http://piwik.org"
|
||||
}
|
||||
]
|
||||
}
|
||||
33
www/analytics/plugins/ExampleRssWidget/stylesheets/rss.less
Normal file
33
www/analytics/plugins/ExampleRssWidget/stylesheets/rss.less
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
.rss ul {
|
||||
list-style: none outside none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.rss li {
|
||||
line-height: 140%;
|
||||
margin: 0.5em 0 1em;
|
||||
}
|
||||
|
||||
.rss-title, .rss-date {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
.rss-title {
|
||||
color: #2583AD;
|
||||
margin: 0 0.5em 0.2em 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.rss-date {
|
||||
color: #999999;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rss-content, .rss-description {
|
||||
clear: both;
|
||||
line-height: 1.5em;
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue