| [ PHPXref.com ] | [ Generated: Sun Jul 20 18:29:26 2008 ] | [ LnBlog 0.7.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 class Recent extends Plugin { 3 4 function Recent() { 5 $this->plugin_desc = _("Show some of the more recent posts in the sidebar."); 6 $this->plugin_version = "0.2.0"; 7 $this->addOption("old_header", 8 _("Header for main blog page (entries not on main page)"), 9 _("Older Entries")); 10 $this->addOption("recent_header", 11 _("Header for other pages (newest entries)"), 12 _("Recent Entries")); 13 $this->addOption("num_entries", 14 _("Number of entries to show"), "Blog default", "text"); 15 $this->addOption("show_main", 16 _("Show link to main blog page"), true, "checkbox"); 17 $this->getConfig(); 18 } 19 20 function output($parm=false) { 21 22 $blg = NewBlog(); 23 if (! $blg->isBlog()) return false; 24 if ( !($this->num_entries > 0) ) $this->num_entries = false; 25 26 # Show some of the more recent entries. If we're on the "front page" 27 # of the blog, then show the next set of entries. Otherwise, show the 28 # most recent entries. 29 $is_index = ( current_url() == $blg->uri('blog') || 30 current_url() == $blg->uri('blog')."index.php"); 31 32 if ($is_index) { 33 $next_list = $blg->getNextMax($this->num_entries); 34 } else { 35 $next_list = $blg->getRecent($this->num_entries); 36 } 37 38 if ( count($next_list) > 0 ) { 39 if ($is_index) { 40 ?> 41 <h3><a href="<?echo $blg->getURL(); ?>"><?php echo $this->old_header ?></a></h3> 42 <?php 43 } else { # !$is_index 44 ?> 45 <h3><a href="<?echo $blg->getURL(); ?>"><?php echo $this->recent_header; ?></a></h3> 46 <?php 47 } # End inner if 48 ?> 49 <ul> 50 <?php 51 foreach ($next_list as $ent) { 52 ?> 53 <li><a href="<?php echo $ent->permalink(); ?>"><?php echo $ent->subject; ?></a></li> 54 <?php 55 } # End foreach 56 if ($this->show_main) { # Link to main page ?> 57 <li style="margin-top: 0.5em"><a href="<?php echo $blg->getURL();?>"><?php p_("Show home page");?></a></li><?php 58 } ?> 59 </ul> 60 <?php 61 } # End outer if 62 } #End function init_output 63 64 } 65 66 $rec = new Recent(); 67 $rec->registerEventHandler("sidebar", "OnOutput", "output"); 68 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |