[pLog-svn] r1908 - in plugins/trunk: . karma

oscar at devel.plogworld.net oscar at devel.plogworld.net
Wed Apr 27 17:45:33 GMT 2005


Author: oscar
Date: 2005-04-27 17:45:32 +0000 (Wed, 27 Apr 2005)
New Revision: 1908

Added:
   plugins/trunk/karma.php
Modified:
   plugins/trunk/karma/pluginkarma.class.php
Log:
added karma.php to the karma plugin, so that we can use the file robots.txt file to prevent bots from crawling through the karma links. Now all links generated by the plugin refer to karma.php so it's just a matter of adding karma.php to the list of files/folders that shoulnd't be crawled.


Modified: plugins/trunk/karma/pluginkarma.class.php
===================================================================
--- plugins/trunk/karma/pluginkarma.class.php	2005-04-26 16:42:17 UTC (rev 1907)
+++ plugins/trunk/karma/pluginkarma.class.php	2005-04-27 17:45:32 UTC (rev 1908)
@@ -22,7 +22,7 @@
 			$this->id = "karma";
 			$this->description = "Implements karma rating for posts";
 			$this->author = "The pLog Team";
-			$this->locales = Array( "en_UK" , "zh_TW" , "zh_CN" );
+			$this->locales = Array();
 			
 			$this->init();
 		}
@@ -75,7 +75,7 @@
 		function getPositiveUrl( $post )
 		{
 			$url =& $this->blogInfo->getBlogRequestGenerator();
-			$karmaUrl = $url->getIndexUrl()."?op=karmaRate&mode=1&articleId=".$post->getId()."&blogId=".$post->getBlog();
+			$karmaUrl = $url->getBaseUrl()."/karma.php?op=karmaRate&mode=1&articleId=".$post->getId()."&blogId=".$post->getBlog();
 			
 			return $karmaUrl;
 		}
@@ -89,7 +89,7 @@
 		function getNegativeUrl( $post )
 		{
 			$url =& $this->blogInfo->getBlogRequestGenerator();
-			$karmaUrl = $url->getIndexUrl()."?op=karmaRate&mode=2&articleId=".$post->getId()."&blogId=".$post->getBlog();
+			$karmaUrl = $url->getBaseUrl()."/karma.php?op=karmaRate&mode=2&articleId=".$post->getId()."&blogId=".$post->getBlog();
 			
 			return $karmaUrl;			
 		}

Added: plugins/trunk/karma.php
===================================================================
--- plugins/trunk/karma.php	2005-04-26 16:42:17 UTC (rev 1907)
+++ plugins/trunk/karma.php	2005-04-27 17:45:32 UTC (rev 1908)
@@ -0,0 +1,14 @@
+<?php
+
+    if (!defined( "PLOG_CLASS_PATH" )) {
+        define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
+    }
+    
+    /**
+     * this file is not really necessary but it can help when creating files
+     * like robots.txt to prevent bots from visiting the karma links and 
+     * increasing/decreasing the karma scores of each one of them. 
+     */ 
+    
+    include_once( PLOG_CLASS_PATH."index.php" );
+?>




More information about the pLog-svn mailing list