Additions:
CommentsClip is the name of an action I included in the footer of
DescentiaPedia∞. I made some changes from the original code (recentcomments.php... or was it recentlycommented.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:
Deletions:
CommentsClip is the name of an action I included in the footer of
DescentiaPedia∞. I made some changes from the original code(recentcomments.php... or was it Recentlycommented.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:
CommentsClip is the name of an action I included in the footer of
DescentiaPedia∞. I made some changes from the original code(recentcomments.php... or was it Recentlycommented.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
/**
* Display a list of recent comments.
*
* @package Actions
* @name CommentsClip
*
* @author {@link http://wikkawiki.org/DarTar Dario Taraborelli} (preliminary code cleanup)
* @author {@link http://wikkawiki.org/NickDamoulakis Nick Damoulakis} (ACL check)
* @author {@link http://wikkawiki.org/WillyP WillyP} (minor hack to match 'changesclip' style, and to be able to use this in a footer. Added COMMENT_QTY, more link)
* @since
*
* @input none
* Tested with 1.1.6.4
*/
//constants
if(!
defined('COMMENT_CLIP_DATE_FORMAT')) define('COMMENT_CLIP_DATE_FORMAT',
'D, d M Y');
if(!
defined('COMMENT_CLIP_TIME_FORMAT')) define('COMMENT_CLIP_TIME_FORMAT',
'H:i T');
if(!
defined('COMMENT_CLIP_SNIPPET_LENGTH')) define('COMMENT_CLIP_SNIPPET_LENGTH',
100);
//i18n USE WIKI FORMATTING
if (!
defined('COMMENTS_CLIP_HEADING')) define('COMMENTS_CLIP_HEADING',
'==Recent Comments==');
if (!
defined('COMMENT_CLIP_AUTHOR_DIVIDER')) define ('COMMENT_CLIP_AUTHOR_DIVIDER',
', comment by ');
if (!
defined('NO_RECENT_COMMENTS_CLIP')) define ('NO_RECENT_COMMENTS_CLIP',
'There are no recent comments%s');
if (!
defined('NO_READABLE_RECENT_COMMENTS_CLIP')) define ('NO_READABLE_RECENT_COMMENTS_CLIP',
'There are no recent comments you can read.');
if(!
defined('COMMENT_CLIP_MORE')) define('COMMENT_CLIP_MORE',
'**//[[RecentlyCommented]]//**');
$readable = 0;
$username = '';
if(isset($_REQUEST['user']))
{
$username = $this->htmlspecialchars_ent($_REQUEST['user']);
}
echo $this->
Format(COMMENTS_CLIP_HEADING
);
if ($comments = $this->LoadRecentComments(COMMENT_CLIP_QTY, $username))
{
$curday = '';
foreach ($comments as $comment)
{
if ($this->HasAccess('comment', $comment['page_tag']))
{
$readable++;
// day header
if ($day != $curday)
{
$dateformatted =
date(COMMENT_CLIP_DATE_FORMAT,
strtotime($day));
}
$timeformatted =
date(COMMENT_CLIP_TIME_FORMAT,
strtotime($comment['time']));
$comment_preview =
str_replace('<br />',
'',
$comment['comment']);
$comment_preview =
substr($comment_preview,
0, COMMENT_CLIP_SNIPPET_LENGTH
);
if (strlen($comment['comment']) > COMMENT_CLIP_SNIPPET_LENGTH
)
{
$comment_preview = $comment_preview.'…';
}
$pagetag = $page["tag"];
if ($this->HasAccess("read", $pagetag))
{ print '<span class="clip">'.
($this->
Link($comment['page_tag']).
': '.
$comment_preview.
'<br /> '.
$dateformatted.
' '.
$timeformatted.
" by: ".
$this->
Format($comment['user']).
"</span><br />");
}
}
}
if ($readable == 0)
{
echo '<em class="error">'.NO_READABLE_RECENT_COMMENTS_CLIP.
'</em><br />';
}
}
else
{
{
echo '<em class="error">'.
sprintf(NO_RECENT_COMMENTS_CLIP,
" by $username.").
'</em><br />';
}
else
{
echo '<em class="error">'.
sprintf(NO_RECENT_COMMENTS_CLIP,
".").
'</em><br />';
}
}
echo '<span class="clip">'.
($this->
Format(COMMENT_CLIP_MORE
)).
"</span>";
?>