Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Becker <halfdan@xnorfz.de>2013-03-28 02:38:07 +0400
committerFabian Becker <halfdan@xnorfz.de>2013-03-28 02:38:07 +0400
commit0b1bffd8a4123c9abb599bb00c68ffa5f304eb6d (patch)
tree30c73c52b3897944871360f9a3817903ab904e20 /plugins/ExampleRssWidget
parent8f4dc7fc80eb452148b715ee7e592d21d185e82b (diff)
Proper visibility definitions.
Code cleanup.
Diffstat (limited to 'plugins/ExampleRssWidget')
-rw-r--r--plugins/ExampleRssWidget/Controller.php9
-rw-r--r--plugins/ExampleRssWidget/ExampleRssWidget.php11
-rw-r--r--plugins/ExampleRssWidget/Rss.php26
3 files changed, 33 insertions, 13 deletions
diff --git a/plugins/ExampleRssWidget/Controller.php b/plugins/ExampleRssWidget/Controller.php
index 672b73f355..c356ee7205 100644
--- a/plugins/ExampleRssWidget/Controller.php
+++ b/plugins/ExampleRssWidget/Controller.php
@@ -15,7 +15,7 @@
*/
class Piwik_ExampleRssWidget_Controller extends Piwik_Controller
{
- function rssPiwik()
+ public function rssPiwik()
{
try {
$rss = new Piwik_ExampleRssWidget_Rss('http://feeds.feedburner.com/Piwik');
@@ -25,9 +25,11 @@ class Piwik_ExampleRssWidget_Controller extends Piwik_Controller
$this->error($e);
}
}
- function rssChangelog()
+
+ public function rssChangelog()
{
- try {
+ try
+ {
$rss = new Piwik_ExampleRssWidget_Rss('http://feeds.feedburner.com/PiwikReleases');
$rss->setCountPosts(1);
$rss->showDescription(false);
@@ -37,6 +39,7 @@ class Piwik_ExampleRssWidget_Controller extends Piwik_Controller
$this->error($e);
}
}
+
protected function error($e)
{
echo '<div class="pk-emptyDataTable">'
diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php
index d1ab6e03f8..0c174345ee 100644
--- a/plugins/ExampleRssWidget/ExampleRssWidget.php
+++ b/plugins/ExampleRssWidget/ExampleRssWidget.php
@@ -31,8 +31,13 @@ class Piwik_ExampleRssWidget extends Piwik_Plugin
'version' => '0.1',
);
}
-
- public function getListHooksRegistered()
+
+ /**
+ * Returns a list of registered hooks.
+ *
+ * @return array
+ */
+ public function getListHooksRegistered()
{
return array(
'AssetManager.getCssFiles' => 'getCssFiles',
@@ -43,7 +48,7 @@ class Piwik_ExampleRssWidget extends Piwik_Plugin
/**
* @param Piwik_Event_Notification $notification notification object
*/
- function getCssFiles( $notification )
+ public function getCssFiles( $notification )
{
$cssFiles = &$notification->getNotificationObject();
diff --git a/plugins/ExampleRssWidget/Rss.php b/plugins/ExampleRssWidget/Rss.php
index 0522cfb01a..678001da8d 100644
--- a/plugins/ExampleRssWidget/Rss.php
+++ b/plugins/ExampleRssWidget/Rss.php
@@ -19,25 +19,31 @@ class Piwik_ExampleRssWidget_Rss
protected $count = 3;
protected $showDescription = false;
protected $showContent = false;
- function __construct($url)
+
+ public function __construct($url)
{
$this->url = $url;
}
- function showDescription($bool)
+
+ public function showDescription($bool)
{
$this->showDescription = $bool;
}
- function showContent($bool)
+
+ public function showContent($bool)
{
$this->showContent = $bool;
}
- function setCountPosts($count)
+
+ public function setCountPosts($count)
{
$this->count = $count;
}
- function get()
+
+ public function get()
{
- try {
+ try
+ {
$rss = Zend_Feed::import($this->url);
} catch (Zend_Feed_Exception $e) {
echo "Error while importing feed: {$e->getMessage()}\n";
@@ -46,6 +52,7 @@ class Piwik_ExampleRssWidget_Rss
$output = '<div style="padding:10px 15px;"><ul class="rss">';
$i = 0;
+
foreach($rss as $post)
{
$title = $post->title();
@@ -58,14 +65,19 @@ class Piwik_ExampleRssWidget_Rss
{
$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;
+ if(++$i == $this->count)
+ {
+ break;
+ }
}
+
$output .= '</ul></div>';
return $output;
}