[ PHPXref.com ] [ Generated: Sun Jul 20 18:29:26 2008 ] [ LnBlog 0.7.0 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/plugins/ -> sidebar_archives.php (source)

   1  <?php
   2  
   3  # Plugin: Archives

   4  # A sidebar plugin to display months of archives.

   5  #

   6  # This plugin provides quick, easy access to blog archives.  It produces a

   7  # sidebar panel with a link for each month for which there are entries, up

   8  # to a configurable maximum.

   9  
  10  class Archives extends Plugin {
  11  
  12  	function Archives() {
  13          $this->plugin_name = _("List the months of archives for a blog.");
  14          $this->plugin_version = "0.2.0";
  15          $this->addOption("max_months", _("Number of months to show"), 6, "text");
  16          $this->addOption("title", _("Sidebar section title"), 
  17                           _("Archives"), "text");
  18          $this->getConfig();
  19      }
  20  
  21  	function output($parm=false) {
  22          $blg = NewBlog();
  23          if (! $blg->isBlog()) return false;
  24          
  25          $root = $blg->getURL();
  26          $month_list = $blg->getRecentMonthList($this->max_months);
  27  ?>
  28  <?php if ($this->title) { ?>
  29  <h3><a href="<?php echo $root.BLOG_ENTRY_PATH; ?>/"><?php echo $this->title; ?></a></h3>
  30  <?php } ?>
  31  <ul>
  32  <?php
  33          foreach ($month_list as $month) {
  34              $ts = mktime(0, 0, 0, $month["month"], 1, $month["year"]);
  35              if (USE_STRFTIME) $link_desc = fmtdate("%B %Y", $ts);
  36              else              $link_desc = fmtdate("F Y", $ts);
  37  ?>
  38  <li><a href="<?php echo $month["link"]; ?>"><?php echo $link_desc; ?></a></li>
  39  <?php 
  40          }  # End of foreach loop.

  41  ?>
  42  <li><a href="<?php echo $blg->uri('listall'); ?>"><?php p_("Show all entries"); ?></a></li>
  43  </ul><?php
  44      }  # End of function

  45  }
  46  
  47  $arch = new Archives();
  48  $arch->registerEventHandler("sidebar", "OnOutput", "output");
  49  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]