diff --git a/plugins/latest_posts/languages/en_US.json b/plugins/latest_posts/languages/en_US.json new file mode 100644 index 00000000..4740606c --- /dev/null +++ b/plugins/latest_posts/languages/en_US.json @@ -0,0 +1,15 @@ +{ + "plugin-data": + { + "name": "Latest posts", + "description": "Shows the latest posts published.", + "author": "Bludit", + "email": "", + "website": "https://github.com/dignajar/bludit-plugins", + "version": "1.0", + "releaseDate": "2016-01-08" + }, + + "home": "Home", + "show-home-link": "Show home link" +} \ No newline at end of file diff --git a/plugins/latest_posts/plugin.php b/plugins/latest_posts/plugin.php new file mode 100644 index 00000000..d8dc1af5 --- /dev/null +++ b/plugins/latest_posts/plugin.php @@ -0,0 +1,59 @@ +dbFields = array( + 'label'=>'Latest posts', + 'amount'=>5 + ); + } + + public function form() + { + global $Language; + + $html = '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + + return $html; + } + + public function siteSidebar() + { + // This function is declared in 70.posts.php + $posts = buildPostsForPage(0, $this->getDbField('amount'), true, false); + + $html = '
'; + + // Print the label if not empty. + $label = $this->getDbField('label'); + if( !empty($label) ) { + $html .= '

'.$label.'

'; + } + + $html .= '
'; + $html .= ''; + $html .= '
'; + $html .= '
'; + + return $html; + } +} \ No newline at end of file