diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /plugins/ExampleRssWidget | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'plugins/ExampleRssWidget')
-rw-r--r-- | plugins/ExampleRssWidget/Controller.php | 7 | ||||
-rw-r--r-- | plugins/ExampleRssWidget/ExampleRssWidget.php | 62 | ||||
-rw-r--r-- | plugins/ExampleRssWidget/Rss.php | 23 | ||||
-rw-r--r-- | plugins/ExampleRssWidget/templates/styles.css | 43 |
4 files changed, 67 insertions, 68 deletions
diff --git a/plugins/ExampleRssWidget/Controller.php b/plugins/ExampleRssWidget/Controller.php index c356ee7205..41e6691f9d 100644 --- a/plugins/ExampleRssWidget/Controller.php +++ b/plugins/ExampleRssWidget/Controller.php @@ -21,21 +21,20 @@ class Piwik_ExampleRssWidget_Controller extends Piwik_Controller $rss = new Piwik_ExampleRssWidget_Rss('http://feeds.feedburner.com/Piwik'); $rss->showDescription(true); echo $rss->get(); - } catch(Exception $e) { + } catch (Exception $e) { $this->error($e); } } public function rssChangelog() { - try - { + try { $rss = new Piwik_ExampleRssWidget_Rss('http://feeds.feedburner.com/PiwikReleases'); $rss->setCountPosts(1); $rss->showDescription(false); $rss->showContent(true); echo $rss->get(); - } catch(Exception $e) { + } catch (Exception $e) { $this->error($e); } } diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php index 0c174345ee..4fac8a6f73 100644 --- a/plugins/ExampleRssWidget/ExampleRssWidget.php +++ b/plugins/ExampleRssWidget/ExampleRssWidget.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik_Plugins * @package Piwik_ExampleRssWidget */ @@ -15,22 +15,22 @@ */ class Piwik_ExampleRssWidget extends Piwik_Plugin { - /** - * Return information about this plugin. - * - * @see Piwik_Plugin - * - * @return array - */ - public function getInformation() - { - return array( - 'description' => Piwik_Translate('ExampleRssWidget_PluginDescription'), - 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => '0.1', - ); - } + /** + * Return information about this plugin. + * + * @see Piwik_Plugin + * + * @return array + */ + public function getInformation() + { + return array( + 'description' => Piwik_Translate('ExampleRssWidget_PluginDescription'), + 'author' => 'Piwik', + 'author_homepage' => 'http://piwik.org/', + 'version' => '0.1', + ); + } /** * Returns a list of registered hooks. @@ -38,22 +38,22 @@ class Piwik_ExampleRssWidget extends Piwik_Plugin * @return array */ public function getListHooksRegistered() - { - return array( + { + return array( 'AssetManager.getCssFiles' => 'getCssFiles', - 'WidgetsList.add' => 'addWidgets' + 'WidgetsList.add' => 'addWidgets' ); - } + } + + /** + * @param Piwik_Event_Notification $notification notification object + */ + public function getCssFiles($notification) + { + $cssFiles = & $notification->getNotificationObject(); - /** - * @param Piwik_Event_Notification $notification notification object - */ - public function getCssFiles( $notification ) - { - $cssFiles = &$notification->getNotificationObject(); - - $cssFiles[] = "plugins/ExampleRssWidget/templates/styles.css"; - } + $cssFiles[] = "plugins/ExampleRssWidget/templates/styles.css"; + } public function addWidgets() { diff --git a/plugins/ExampleRssWidget/Rss.php b/plugins/ExampleRssWidget/Rss.php index 678001da8d..ee95a8a56d 100644 --- a/plugins/ExampleRssWidget/Rss.php +++ b/plugins/ExampleRssWidget/Rss.php @@ -42,8 +42,7 @@ class Piwik_ExampleRssWidget_Rss public function get() { - try - { + try { $rss = Zend_Feed::import($this->url); } catch (Zend_Feed_Exception $e) { echo "Error while importing feed: {$e->getMessage()}\n"; @@ -53,27 +52,23 @@ class Piwik_ExampleRssWidget_Rss $output = '<div style="padding:10px 15px;"><ul class="rss">'; $i = 0; - foreach($rss as $post) - { + foreach ($rss 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>'; + $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>'; + if ($this->showContent) { + $output .= '<div class="rss-content">' . $post->content() . '</div>'; } $output .= '</li>'; - if(++$i == $this->count) - { + if (++$i == $this->count) { break; } } diff --git a/plugins/ExampleRssWidget/templates/styles.css b/plugins/ExampleRssWidget/templates/styles.css index 185e57088b..5676571a7e 100644 --- a/plugins/ExampleRssWidget/templates/styles.css +++ b/plugins/ExampleRssWidget/templates/styles.css @@ -1,28 +1,33 @@ .rss ul { - list-style:none outside none; - padding:0; + list-style: none outside none; + padding: 0; } + .rss li { - line-height:140%; - margin:0.5em 0 1em; + line-height: 140%; + margin: 0.5em 0 1em; } -.rss-title, .rss-date { - float:left; - font-size:14px; - line-height:140%; + +.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-title { + color: #2583AD; + margin: 0 0.5em 0.2em 0; + font-weight: bold; +} + .rss-date { - color:#999999; - margin:0; + color: #999999; + margin: 0; } + .rss-content, .rss-description { - clear:both; - line-height:1.5em; - font-size:11px; - color:#333333; + clear: both; + line-height: 1.5em; + font-size: 11px; + color: #333333; } |