[pLog-svn] r778 - plugins/trunk

mark at devel.plogworld.net mark at devel.plogworld.net
Thu Jan 20 16:04:29 GMT 2005


Author: mark
Date: 2005-01-20 16:04:28 +0000 (Thu, 20 Jan 2005)
New Revision: 778

Removed:
   plugins/trunk/pluginnofollow.class.php
Log:
?\229?\183?\178?\231?\167?\187?\233?\153?\164?\230?\170?\148?\230?\161?\136/?\232?\179?\135?\230?\150?\153?\229?\164?\190

Deleted: plugins/trunk/pluginnofollow.class.php
===================================================================
--- plugins/trunk/pluginnofollow.class.php	2005-01-20 16:04:11 UTC (rev 777)
+++ plugins/trunk/pluginnofollow.class.php	2005-01-20 16:04:28 UTC (rev 778)
@@ -1,88 +0,0 @@
-<?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/plugin/eventpluginbase.class.php" );
-
-	class PluginNoFollow extends PluginBase
-	{
-		function PluginNoFollow()
-		{
-			$this->PluginBase();
-
-			$this->id      = "nofollow";
-			$this->author  = "Minstrel Chiu";
-			$this->desc    = "Prevents comment spams with 'rel=nofollow'";
-
-			$this->locales = Array( "en_UK" , "zh_TW" );
-
-			$this->init();
-		}
-
-		function init()
-		{
-            $this->registerAdminAction( "nofollow", "PluginNoFollowConfigAction" );
-			$this->registerAdminAction( "updateNoFollowConfig", "PluginNoFollowUpdateConfigAction" );
-			
-			$menu =& Menu::getMenu();
-			if( !$menu->entryExists( "/menu/controlCenter/manageSpamActivities" ))						
-				$this->addMenuEntry( "/menu/controlCenter", "manageSpamActivities", "", "", true, false );			
-            $this->addMenuEntry( "/menu/controlCenter/manageSpamActivities", "NoFollow", "?op=nofollow", "" );            
-
-			$this->registerNotification( EVENT_PRE_COMMENT_ADD );
-		}
-
-		function process($eventType, $params)
-		{
-            if ( $eventType != EVENT_PRE_COMMENT_ADD )
-                return true;
-                
-		    $blogSettings = $this->blogInfo->getSettings();
-		    $pluginEnabled = $blogSettings->getValue( "plugin_nofollow_enabled" );
-            if ( $pluginEnabled != 1 )
-                return true;
-
-			$comment = $params["comment"];
-
-			$text = $comment->getText();
-			$text = $this->nofollow($text);
-
-			$comment->setText($text);
-
-			$params["comment"] = $comment;
-
-			return true;
-		}
-
-		function nofollow($text)
-		{
-			if(!isset($text))
-				return $text;
-
-			return preg_replace_callback('#<a\s([^>]*\s*href\s*=[^>]*)>#i', array(&$this, 'nofollow_process'), $text);
-		}
-
-		function nofollow_process($matches)
-		{
-			$text = $matches[1];
-
-			preg_match_all('/[^=[:space:]]*\s*=\s*"[^"]*"|[^=[:space:]]*\s*=\s*\'[^\']*\'|[^=[:space:]]*\s*=[^[:space:]]*/', $text, $attr);
-			$rel_arr = preg_grep('/^rel\s*=/i', $attr[0]);
-
-			if(count($rel_arr)>0)
-				$rel = array_pop($rel_arr);
-
-			if($rel)
-			{
-				$rel = preg_replace('/^(rel\s*=\s*[\'"]?)/i', '\1nofollow ', $rel);
-			}
-			else
-			{
-				$rel = 'rel="nofollow"';
-			}
-
-			$attr = preg_grep('/^rel\s*=/i', $attr[0], PREG_GREP_INVERT);
-
-			return '<a ' . join(' ', $attr) . ' ' . $rel . '>';
-		}
-	}
-?>
\ No newline at end of file




More information about the pLog-svn mailing list