Revision [20366]

This is an old revision of ChangesClipFooter made by WillyPs on 2008-12-06 20:12:25.

 

Tested with: WikkaWiki version 1.1.6.4, in the footer only.
Example: www.prepare4descent.net/DescentiaPedia DescentiaPedia

ChangesClip

ChangesClip is the name of an action I included in the footer of www.prepare4descent.net/DescentiaPedia DescentiaPedia. I made some changes from the original code(recentchanges.php) in order to work this into the footer, and to style this to match DescentiaPedia. I have not tested this to see if it can be still used in a page. Nor have I tested this in any version of wikka other than 1.1.6.4. Here is the code:
changesclipft.php (line 1)
  1. <?php
  2. // call from footer.php/templates
  3. //actions/changesclipft.php
  4. // original author: Marc Mayfield  (http://www.IntegratedElf.com)  
  5. // date: 20 June 2006
  6. // based on: actions/recentchanges.php
  7. // license: [[GPL]]
  8. //          http://www.gnu.org/copyleft/gpl.html
  9. // This code may be reused/redistributed freely, so long as this heading
  10. // is present.
  11. //
  12. // Provide a list of recent changes made within the wiki. Presentation includes:
  13. //  - 'Recent Changes' heading
  14. //  -  Two-line description of change
  15. //  - Linked page name
  16. //  - Change note
  17. //  - First characters of body
  18. //  - change timestamp and changer
  19. //  - link to 'RecentChanges'
  20. //  - CSS: span class="clip"
  21. // 19 April 2008: minor hacks by WillyP (http://www.wikkawiki.org/WillyPs) for use in use in footer and to match style of commentsclip.
  22. //--ToDo: when there is no note and the body of the page is shown, strip formating data so only text of content is shown.
  23.  
  24. if(!defined('CHANGES_CLIP_QTY')) define('CHANGES_CLIP_QTY', 5);
  25. if(!defined('CHANGES_CLIP_DATE_FORMAT')) define('CHANGES_CLIP_DATE_FORMAT', 'D, d M Y');
  26. if(!defined('CHANGES_CLIP_TIME_FORMAT')) define('CHANGES_CLIP_TIME_FORMAT', 'H:i T');
  27. if(!defined('CHANGES_CLIP_SHOW_BODY')) define('CHANGES_CLIP_SHOW_BODY', true);
  28. // irregardless, will not show body if a note is shown.  True = show body only if there is no note.
  29. if(!defined('CHANGES_CLIP_BODY_LENGTH')) define('CHANGES_CLIP_BODY_LENGTH', 100);
  30. if(!defined('CHANGES_CLIP_SHOW_NOTE')) define('CHANGES_CLIP_SHOW_NOTE', true);
  31. if(!defined('CHANGES_CLIP_NOTE_LENGTH')) define('CHANGES_CLIP_NOTE_LENGTH', 100);
  32. //i18n   USE WIKI FORMATING
  33. if(!defined('CHANGES_CLIP_HEADING')) define('CHANGES_CLIP_HEADING', '==Recently Changed Pages==');
  34. if(!defined('CHANGES_CLIP_UNREG')) define('CHANGES_CLIP_UNREG', '//(unregistered user)//');
  35. if(!defined('CHANGES_CLIP_NOTE_NONE')) define('CHANGES_CLIP_NOTE_NONE', '//(no note provided for this change)//');
  36. if(!defined('CHANGES_CLIP_READ_NONE')) define('CHANGES_CLIP_READ_NONE', '//Sorry, you do not have read access to this page.//');
  37. if(!defined('CHANGES_CLIP_MORE')) define('CHANGES_CLIP_MORE', '**//[[RecentChanges]]//**');
  38.  
  39. if ($pages = $this->LoadRecentlyChanged())
  40. {
  41.     $curday = "";
  42.         echo $this->Format(CHANGES_CLIP_HEADING);
  43.     foreach ($pages as $i => $page)
  44.     {
  45.         if (($i < CHANGES_CLIP_QTY) || !CHANGES_CLIP_QTY)
  46.         {
  47.             list($day, $time) = explode(' ', $page['time']);
  48.             {
  49.                 $dateformatted = date(CHANGES_CLIP_DATE_FORMAT, strtotime($day));
  50.             }
  51.                 $timeformatted = date(CHANGES_CLIP_TIME_FORMAT, strtotime($page['time']));
  52.             $page_edited_by = $page["user"];   
  53.             if (!$this->LoadUser($page_edited_by)) $page_edited_by .= "&nbsp;" . ($this->Format(CHANGES_CLIP_UNREG));
  54.             $body = "";
  55.             $note = "";
  56.             if (CHANGES_CLIP_SHOW_NOTE && $page['note'] != "")
  57.             {
  58.     //limit amount of characters shown
  59.             $note = "&nbsp;(" . $this->htmlspecialchars_ent (substr($page['note'],0,CHANGES_CLIP_NOTE_LENGTH));
  60.                 {
  61.                     if (strlen($page['note']) > CHANGES_CLIP_NOTE_LENGTH)
  62.                         {
  63.                         $note = $note . '&#8230;)';
  64.                         } else {
  65.                             $note = $note . ')';
  66.                             }
  67.                 }
  68.             } else {
  69.                 if ($note = "")
  70.                     {
  71.                     $note = '&nbsp;' . ($this->Format(CHANGES_CLIP_NOTE_NONE)); // show a message if there is no note
  72.                     }
  73.                     if (CHANGES_CLIP_SHOW_BODY) //show body clip if there is no note
  74.                     {
  75.                     $body = "&nbsp;" . $this->htmlspecialchars_ent(substr($page['body'],0,CHANGES_CLIP_BODY_LENGTH)) . "...";
  76.                     }
  77.                 }
  78.         // show "..." if note is too long  
  79.            
  80.            
  81.             // print entry
  82.             $pagetag = $page["tag"];
  83.             if ($this->HasAccess("read", $pagetag))
  84.             {
  85.                 print'<span class="clip">'.($this->Link($pagetag, "", "", 0).$note.$body."<br />"."&nbsp;&nbsp;".$dateformatted."&nbsp;".$timeformatted."&nbsp;&nbsp;by: ".$this->Link($page_edited_by, "", "", 0)."</span><br />");
  86.             } else {
  87.                 print'<span class="clip">'.($pagetag."<br />".$page[time]."&nbsp;" . ($this->Format(CHANGES_CLIP_READ_NONE)) . "</span><br />");
  88.             }
  89.         }
  90.        
  91.     }
  92. }
  93. echo'<span class="clip">'. ($this->Format(CHANGES_CLIP_MORE))."</span>";
  94. ?>
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki