Thread: [pLog-CVS] plog_plugins/plugins plugintopcommentposts.class.php,NONE,1.1 plugintopreadposts.class.ph
Brought to you by:
jondaley
From: Oscar R. <phu...@us...> - 2004-05-26 20:35:07
|
Update of /cvsroot/plog/plog_plugins/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20029/plugins Modified Files: pluginarticlereferers.class.php pluginemailecryption.class.php pluginrecentcomments.class.php pluginrecenttrackbacks.class.php Added Files: plugintopcommentposts.class.php plugintopreadposts.class.php Log Message: updated all mark's plugins, and added two more! :) Index: pluginrecentcomments.class.php =================================================================== RCS file: /cvsroot/plog/plog_plugins/plugins/pluginrecentcomments.class.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pluginrecentcomments.class.php 22 May 2004 19:25:11 -0000 1.1 --- pluginrecentcomments.class.php 26 May 2004 20:34:56 -0000 1.2 *************** *** 16,20 **** { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers the most recently article comments. Usage as follow:<br /><br /><strong>{assign var=comments value=\$recentcomments->getRecentComments()}<br />{foreach from=\$comments item=comment}<br />{assign var=postid value=\$comment->getArticleId()}<br />{assign var=post value=\$recentcomments->getCommentArticle(\$postid)}<br /><li><a href="{\$url->postPermalink(\$post)}">{\$comment->getUsername()} &gt;&gt; {\$post->getTopic()}</a></li><br />{/foreach}</strong>"; $this->PluginBase(); --- 16,20 ---- { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers the most recently article comments. Usage as follow:<br /><br />Add the following code to header.template<br /><br /><strong><p><br />{assign var=comments value=\$recentcomments->getRecentComments()}<br />{foreach from=\$comments item=comment}<br />{assign var=postid value=\$comment->getArticleId()}<br />{assign var=post value=\$recentcomments->getCommentArticle(\$postid)}<br />{if \$comment->getUserUrl()}<br /><li><a title="{\$comment->getText()|truncate:150:"..."|escape}" href="{\$comment->getUserUrl()}">{\$comment->getUsername()}</a> &gt;&gt; <a href="{\$url->postPermalink(\$post)}">{\$post->getTopic()}</a></li> <br />{else}<br /><li><a title="{\$comment->getText()|truncate:150:"..."|escape}" href="{\$url->postPermalink(\$post)}">{\$comment->getUsername()}</a> &gt;&gt; <a href="{\$url->postPermalink(\$post)}">{\$post->getTopic()}</a></li><br />{/if}<br />{/foreach}<br /></p></strong><br /><br />You can use <br /><br /><strong>getRecentComments(5)</strong> to get recent 5 comments. The default view is BLOG. <br /><strong>getRecentComments(10, 'SITE')</strong> to get recent 10 comments from SITE view. It is very convenient for pLog Host Provider.<br /><br />"; $this->PluginBase(); *************** *** 24,28 **** * Returns the recent comments object of current blog */ ! function getRecentComments($maxComments = 15, $date = 0) { $comments = new ArticleComments(); --- 24,28 ---- * Returns the recent comments object of current blog */ ! function getRecentComments($maxComments = 20, $based = 'BLOG') { $comments = new ArticleComments(); *************** *** 31,39 **** $blogId = $this->blogInfo->getId(); ! $query = "SELECT * FROM ".$prefix."articles_comments"; ! if( $date > 0 ) ! $query .= " AND date < '$date'"; ! ! $query .= " ORDER BY date DESC"; if( $maxComments > 0 ) --- 31,44 ---- $blogId = $this->blogInfo->getId(); ! if ($based == 'BLOG') { ! $query = "SELECT ".$prefix."articles_comments.* FROM ".$prefix."articles_comments, ".$prefix."articles"; ! $query .= " WHERE ".$prefix."articles_comments.article_id = ".$prefix."articles.id AND ".$prefix."articles.blog_id = ".$blogId; ! $query .= " ORDER BY ".$prefix."articles_comments.date DESC"; ! } elseif ($based == 'SITE') { ! $query = "SELECT * FROM ".$prefix."articles_comments"; ! $query .= " ORDER BY date DESC"; ! } else { ! return false; ! } if( $maxComments > 0 ) Index: pluginrecenttrackbacks.class.php =================================================================== RCS file: /cvsroot/plog/plog_plugins/plugins/pluginrecenttrackbacks.class.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pluginrecenttrackbacks.class.php 22 May 2004 19:25:11 -0000 1.1 --- pluginrecenttrackbacks.class.php 26 May 2004 20:34:56 -0000 1.2 *************** *** 15,19 **** { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers the most recently article trackbacks. Usage as follow:<br /><br /><strong>{assign var=trackbacks value=\$recenttrackbacks->getRecentTrackbacks()}<br />{foreach from=\$trackbacks item=trackback}<br />{assign var=postid value=\$trackback->getArticleId()}<br />{assign var=post value=\$recenttrackbacks->getTrackbackArticle(\$postid)}<br /><li><a href="{\$trackback->getUrl()}">{\$trackback->getTitle()}</a> &gt;&gt; <a href="{\$url->postPermalink(\$post)}">{\$post->getTopic()}</a></li><br />{/foreach}</strong>"; $this->PluginBase(); } --- 15,19 ---- { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers the most recently article trackbacks. Usage as follow:<br /><br />Add the following code to header.template<br /><br /><strong><p><br />{assign var=trackbacks value=\$recenttrackbacks->getRecentTrackbacks()}<br />{foreach from=\$trackbacks item=trackback}<br />{assign var=postid value=\$trackback->getArticleId()}<br />{assign var=post value=\$recenttrackbacks->getTrackbackArticle(\$postid)}<br /><li><a title="{\$trackback->getTitle()}" href="{\$trackback->getUrl()}">{\$trackback->getBlogName()}</a> &gt;&gt; <a href="{\$url->postPermalink(\$post)}">{\$post->getTopic()}</a></li><br />{/foreach}<br /></p></strong><br /><br />You can use <br /><br /><strong>getRecentTrackbacks(5)</strong> to get recent 5 trackbacks. The default view is BLOG. <br /><strong>getRecentTrackbacks(10, 'SITE')</strong> to get recent 10 trackbacks from SITE view. It is very convenient for pLog Host Provider.<br /><br />"; $this->PluginBase(); } *************** *** 22,26 **** * Returns the recent trackbacks object of current blog */ ! function getRecentTrackbacks($maxTrackbacks = 20, $date = 0) { $trackbacks = new Trackbacks(); --- 22,26 ---- * Returns the recent trackbacks object of current blog */ ! function getRecentTrackbacks($maxTrackbacks = 20, $based = 'BLOG') { $trackbacks = new Trackbacks(); *************** *** 29,38 **** $blogId = $this->blogInfo->getId(); ! $query = "SELECT * FROM ".$prefix."trackbacks"; ! if( $date > 0 ) ! $query .= " AND date < '$date'"; ! ! $query .= " ORDER BY date DESC"; ! if( $maxTrackbacks > 0 ) $query .= " LIMIT 0,".$maxTrackbacks; --- 29,43 ---- $blogId = $this->blogInfo->getId(); ! if ($based == 'BLOG') { ! $query = "SELECT ".$prefix."trackbacks.* FROM ".$prefix."trackbacks, ".$prefix."articles"; ! $query .= " WHERE ".$prefix."trackbacks.article_id = ".$prefix."articles.id AND ".$prefix."articles.blog_id = ".$blogId; ! $query .= " ORDER BY ".$prefix."trackbacks.date DESC"; ! } elseif ($based == 'SITE') { ! $query = "SELECT * FROM ".$prefix."trackbacks"; ! $query .= " ORDER BY date DESC"; ! } else { ! return false; ! } ! if( $maxTrackbacks > 0 ) $query .= " LIMIT 0,".$maxTrackbacks; Index: pluginarticlereferers.class.php =================================================================== RCS file: /cvsroot/plog/plog_plugins/plugins/pluginarticlereferers.class.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pluginarticlereferers.class.php 22 May 2004 19:25:11 -0000 1.1 --- pluginarticlereferers.class.php 26 May 2004 20:34:56 -0000 1.2 *************** *** 15,19 **** { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers you the get the referers of the specific article. Usage as follow:<br /><br /><strong><p><br /> <h3>{\$locale->tr("referers")}</h3><br /> {assign var=postid value=\$post->getId()}<br /> {assign var=referers value=\$articlereferers->getArticleReferers(\$postid)}<br /> {foreach from=\$referers item=referer}<br /> <li><a href="{\$referer->getUrl()}">{\$referer->getUrl()}</a> ({\$referer->getCount()})</li><br /> {/foreach}<br /> </p></strong>"; $this->PluginBase(); --- 15,19 ---- { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers you to get the referers of the specific article. Usage as follow:<br /><br />Add the following code to postandcomments.template<br /><br /><strong><p><br /><h3>{\$locale->tr("referers")}</h3><br />{assign var=postid value=\$post->getId()}<br />{assign var=referers value=\$articlereferers->getArticleReferers(\$postid)}<br />{foreach from=\$referers item=referer}<br /><li><a href="{\$referer->getUrl()}">{\$referer->getUrl()}</a> ({\$referer->getCount()})</li><br />{/foreach}<br /></p></strong><br /><br />"; $this->PluginBase(); --- NEW FILE: plugintopcommentposts.class.php --- <?php include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" ); include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/article.class.php" ); /** * Plugin that offers features to returns the top comment posts object of current blog */ class PluginTopCommentPosts extends PluginBase { function PluginTopCommentPosts() { $this->author = "Mark Wu"; $this->desc = "This plugin offers the rank list of articles by number of comments. Usage as follow:<br /><br />Add the following code to footer.template<br /><br /><strong><p><br /><strong>³Ì¦h¤Hµû½×ªº¤å³¹¡G</strong><br /><br />{assign var=posts value=\$topcommentposts->getTopCommentPosts()}<br />{foreach from=\$posts item=post}<br />{assign var=postid value=\$post->getId()}<br /><li><a title="{\$post->getText()|truncate:150:"..."|escape}" href="{\$url->postLink(\$post)}">{\$post->getTopic()}</a> ({\$topcommentposts->getArticleCommentCount(\$postid)} ½g)</li><br />{/foreach}<br /></p></strong> <br /><br />You can use <br /><br /><strong>getTopCommentPosts(5)</strong> to get top 5 comment posts. The default view is BLOG. <br /><strong>getTopCommentPosts(10, 'SITE')</strong> to get top 10 comment posts from SITE view. It is very convenient for pLog Host Provider.<br /><br />"; $this->PluginBase(); } /** * Returns the top comment posts object of current blog */ function getTopCommentPosts($maxPosts = 3, $based = 'BLOG') { $comments = new ArticleComments(); $config = new Config(); $prefix = $config->getValue('db_prefix'); $blogId = $this->blogInfo->getId(); if ($based == 'BLOG') { $query = "SELECT ".$prefix."articles_comments.article_id,count(".$prefix."articles_comments.article_id) as comment_count"; $query .= " FROM ".$prefix."articles_comments, ".$prefix."articles"; $query .= " WHERE ".$prefix."articles_comments.article_id = ".$prefix."articles.id AND ".$prefix."articles.blog_id = ".$blogId; $query .= " GROUP BY ".$prefix."articles_comments.article_id ORDER BY comment_count DESC"; } elseif ($based == 'SITE') { $query = "SELECT article_id,count(article_id) as comment_count FROM ".$prefix."articles_comments"; $query .= " GROUP BY article_id ORDER BY comment_count DESC"; } else { return false; } if( $maxPosts > 0 ) $query .= " LIMIT 0,".$maxPosts; $result = $comments->_db->Execute( $query ); if( !$result ) return false; $topcommentposts = Array(); while( $row = $result->FetchRow()) { $article = $this->getArticle($row["article_id"]); array_push( $topcommentposts, $article); } return $topcommentposts; } function getArticleCommentCount($artId) { $comments = new ArticleComments(); $config = new Config(); $prefix = $config->getValue('db_prefix'); $blogId = $this->blogInfo->getId(); $query = "SELECT article_id,count(article_id) as comment_count FROM ".$prefix."articles_comments"; $query .= " WHERE article_id = ".$artId." GROUP BY article_id"; $result = $comments->_db->Execute( $query ); if( !$result ) return false; $row = $result->FetchRow( $result ); $articlecommentcount = $row["comment_count"]; return $articlecommentcount; } function getArticle( $artId ) { $articles = new Articles(); $config = new Config(); $prefix = $config->getValue('db_prefix'); $blogId = $this->blogInfo->getId(); $query = "SELECT * FROM ".$prefix."articles WHERE id = ".$artId; $query .= " AND blog_id = ".$blogId; $query .= ";"; // we send the query and then fetch the first array with the result $result = $articles->_db->Execute( $query ); if( $result == false ) return false; if ( $result->RecordCount() == 0) return false; $row = $result->FetchRow( $result ); $article = $articles->_fillArticleInformation( $row ); return $article; } } PluginManager::registerPlugin( "topcommentposts", "PluginTopCommentPosts" ); ?> --- NEW FILE: plugintopreadposts.class.php --- <?php include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" ); include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/article.class.php" ); /** * Plugin that offers features to returns the top read posts object of current blog */ class PluginTopReadPosts extends PluginBase { function PluginTopReadPosts() { $this->author = "Mark Wu"; $this->desc = "This plugin offers the rank list of articles by number of read. Usage as follow:<br /><br />Add the following code to footer.template<br /><br /><strong><p><br /><strong>Top Read Posts</strong><br /><br />{assign var=posts value=\$topreadposts->getTopReadPosts()}<br />{foreach from=\$posts item=post}<br /><li><a title="{\$post->getText()|truncate:150:"..."|escape}" href="{\$url->postLink(\$post)}">{\$post->getTopic()}</a> ({\$post->getNumReads()} Times)</li><br />{/foreach}<br /></p></strong> <br /><br />You can use <br /><br /><strong>getTopReadPosts(5)</strong> to get top 5 read posts. The default view is BLOG. <br /><strong>getTopReadPosts(10, 'SITE')</strong> to get top 10 read posts from SITE view. It is very convenient for pLog Host Provider.<br /><br />"; $this->PluginBase(); } /** * Returns the top read posts object of current blog */ function getTopReadPosts($maxPosts = 3, $based = 'BLOG') { $articles = new Articles(); $config = new Config(); $prefix = $config->getValue('db_prefix'); $blogId = $this->blogInfo->getId(); if ($based == 'BLOG') { $query = "SELECT * FROM ".$prefix."articles"; $query .= " WHERE blog_id = ".$blogId; $query .= " ORDER BY num_reads DESC"; } elseif ($based == 'SITE') { $query = "SELECT * FROM ".$prefix."articles"; $query .= " ORDER BY num_reads DESC"; } else { return false; } if( $maxPosts > 0 ) $query .= " LIMIT 0,".$maxPosts; $result = $articles->_db->Execute( $query ); if( !$result ) return false; $topreadposts = Array(); while( $row = $result->FetchRow()) { $article = $articles->_fillArticleInformation( $row ); array_push( $topreadposts, $article); } return $topreadposts; } } PluginManager::registerPlugin( "topreadposts", "PluginTopReadPosts" ); ?> Index: pluginemailecryption.class.php =================================================================== RCS file: /cvsroot/plog/plog_plugins/plugins/pluginemailecryption.class.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pluginemailecryption.class.php 26 May 2004 16:27:19 -0000 1.1 --- pluginemailecryption.class.php 26 May 2004 20:34:56 -0000 1.2 *************** *** 13,17 **** { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers you to encrypt e-mail address with javascript to prevent spam spider to get the real e-mail address from your blog. Usage as follow:<br /><br /><strong>{if \$comment->getUserEmail()}<br /><script type="text/javascript"><br />{assign var="email" value=\$comment->getUserEmail()}<br />{\$emailencryption->getEmailEncryptionImageLink(\$email,"/imgs/aemail.gif")}<br /></script><br />{/if} <br />{if \$comment->getUserUrl()}<br /><a href="{\$comment->getUserUrl()}">{\$comment->getUsername()}</a> | {\$locale->formatDate(\$postDate, "%d/%m/%Y, %H:%M")}<br />{else}<br />{\$comment->getUsername()} | {\$locale->formatDate(\$postDate, "%d/%m/%Y, %H:%M")}<br />{/if}</strong><br /><br />You can use <strong>{\$emailencryption->getEmailEncryptionTextLink(\$email,\$text)}</strong> to generate a URL with text, or use <strong>{\$emailencryption->getEmailEncryptionImageLink(\$email,\$image_path)}</strong> to generate URL with image."; $this->PluginBase(); --- 13,17 ---- { $this->author = "Mark Wu"; ! $this->desc = "This plugin offers you to encrypt e-mail address with javascript to prevent spam spider to get the real e-mail address from your blog. Usage as follow:<br /><br />Add the following code to header.template<br /><br /><strong><script type="text/javascript" src="js/emailhider/emailHider.js"></script><br /></strong><br />And, also place the following code in postandcomments.template<br /><br /><strong>{\$comment->getUsername()} | {\$locale->formatDate(\$postDate, "%d/%m/%Y, %H:%M")}</strong><br /><br />with<br /><br /><strong>{if \$comment->getUserEmail()}<br /><script type="text/javascript"><br />{assign var="email" value=\$comment->getUserEmail()}<br />{\$emailencryption->getEmailEncryptionImageLink(\$email,"/imgs/aemail.gif")}<br /></script><br />{/if} <br />{if \$comment->getUserUrl()}<br /><a href="{\$comment->getUserUrl()}">{\$comment->getUsername()}</a> | {\$locale->formatDate(\$postDate, "%d/%m/%Y, %H:%M")}<br />{else}<br />{\$comment->getUsername()} | {\$locale->formatDate(\$postDate, "%d/%m/%Y, %H:%M")}<br />{/if}</strong><br /><br />And, you can use <br /><br /><strong>{\$emailencryption->getEmailEncryptionTextLink(\$email,\$text)}</strong> to generate a URL with text, or use <br /><strong>{\$emailencryption->getEmailEncryptionImageLink(\$email,\$full_image_path_or_url)}</strong> to generate URL with image.<br /><br />"; $this->PluginBase(); |