Wiki source for ChangesClipFooter


Show raw source

>>Tested with: WikkaWiki version **1.1.6.4**, in the footer only.
Example: [[www.prepare4descent.net/DescentiaPedia | DescentiaPedia]]>>=====Changes Clip in the Footer=====
ChangesClipFooter 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:
%%(php;1;changesclipft.php)
<?php
// call from footer.php/templates
//actions/changesclipft.php
// original author: Marc Mayfield (http://www.IntegratedElf.com)
// date: 20 June 2006
// based on: actions/recentchanges.php
// license: [[GPL]]
// http://www.gnu.org/copyleft/gpl.html
// This code may be reused/redistributed freely, so long as this heading
// is present.
//
// Provide a list of recent changes made within the wiki. Presentation includes:
// - 'Recent Changes' heading
// - Two-line description of change
// - Linked page name
// - Change note
// - First characters of body
// - change timestamp and changer
// - link to 'RecentChanges'
// - CSS: span class="clip"
// 19 April 2008: minor hacks by WillyP (http://www.wikkawiki.org/WillyPs) for use in use in footer and to match style of commentsclip.
//--ToDo: when there is no note and the body of the page is shown, strip formating data so only text of content is shown.

if(!defined('CHANGES_CLIP_QTY')) define('CHANGES_CLIP_QTY', 5);
if(!defined('CHANGES_CLIP_DATE_FORMAT')) define('CHANGES_CLIP_DATE_FORMAT', 'D, d M Y');
if(!defined('CHANGES_CLIP_TIME_FORMAT')) define('CHANGES_CLIP_TIME_FORMAT', 'H:i T');
if(!defined('CHANGES_CLIP_SHOW_BODY')) define('CHANGES_CLIP_SHOW_BODY', true);
// irregardless, will not show body if a note is shown. True = show body only if there is no note.
if(!defined('CHANGES_CLIP_BODY_LENGTH')) define('CHANGES_CLIP_BODY_LENGTH', 100);
if(!defined('CHANGES_CLIP_SHOW_NOTE')) define('CHANGES_CLIP_SHOW_NOTE', true);
if(!defined('CHANGES_CLIP_NOTE_LENGTH')) define('CHANGES_CLIP_NOTE_LENGTH', 100);
//i18n USE WIKI FORMATING
if(!defined('CHANGES_CLIP_HEADING')) define('CHANGES_CLIP_HEADING', '==Recently Changed Pages==');
if(!defined('CHANGES_CLIP_UNREG')) define('CHANGES_CLIP_UNREG', '//(unregistered user)//');
if(!defined('CHANGES_CLIP_NOTE_NONE')) define('CHANGES_CLIP_NOTE_NONE', '//(no note provided for this change)//');
if(!defined('CHANGES_CLIP_READ_NONE')) define('CHANGES_CLIP_READ_NONE', '//Sorry, you do not have read access to this page.//');
if(!defined('CHANGES_CLIP_MORE')) define('CHANGES_CLIP_MORE', '**//[[RecentChanges]]//**');

if ($pages = $this->LoadRecentlyChanged())
{
$curday = "";
echo $this->Format(CHANGES_CLIP_HEADING);
foreach ($pages as $i => $page)
{
if (($i < CHANGES_CLIP_QTY) || !CHANGES_CLIP_QTY)
{
list($day, $time) = explode(' ', $page['time']);
{
$dateformatted = date(CHANGES_CLIP_DATE_FORMAT, strtotime($day));
}
$timeformatted = date(CHANGES_CLIP_TIME_FORMAT, strtotime($page['time']));
$page_edited_by = $page["user"];
if (!$this->LoadUser($page_edited_by)) $page_edited_by .= " " . ($this->Format(CHANGES_CLIP_UNREG));
$body = "";
$note = "";
if (CHANGES_CLIP_SHOW_NOTE && $page['note'] != "")
{
//limit amount of characters shown
$note = " (" . $this->htmlspecialchars_ent (substr($page['note'],0,CHANGES_CLIP_NOTE_LENGTH));
{
if (strlen($page['note']) > CHANGES_CLIP_NOTE_LENGTH)
{
$note = $note . '…)';
} else {
$note = $note . ')';
}
}
} else {
if ($note = "")
{
$note = ' ' . ($this->Format(CHANGES_CLIP_NOTE_NONE)); // show a message if there is no note
}
if (CHANGES_CLIP_SHOW_BODY) //show body clip if there is no note
{
$body = " " . $this->htmlspecialchars_ent(substr($page['body'],0,CHANGES_CLIP_BODY_LENGTH)) . "...";
}
}
// show "..." if note is too long


// print entry
$pagetag = $page["tag"];
if ($this->HasAccess("read", $pagetag))
{
print'<span class="clip">'.($this->Link($pagetag, "", "", 0).$note.$body."<br />"."  ".$dateformatted." ".$timeformatted."  by: ".$this->Link($page_edited_by, "", "", 0)."</span><br />");
} else {
print'<span class="clip">'.($pagetag."<br />".$page[time]." " . ($this->Format(CHANGES_CLIP_READ_NONE)) . "</span><br />");
}
}

}
}
echo'<span class="clip">'. ($this->Format(CHANGES_CLIP_MORE))."</span>";
?>
%%

----
See also:
ActionsInFooter
----
Categories:
CategoryStyle
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki