[pLog-svn] r4517 - in plugins/trunk: . nofollow nofollow/templates
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Jan 5 13:25:22 GMT 2007
Author: oscar
Date: 2007-01-05 13:25:22 +0000 (Fri, 05 Jan 2007)
New Revision: 4517
Added:
plugins/trunk/nofollow/
plugins/trunk/nofollow/pluginnofollow.class.php
plugins/trunk/nofollow/templates/nofollow.template
Removed:
plugins/trunk/nofollow/pluginnofollow.class.php
plugins/trunk/nofollow/templates/nofollow.template
Log:
plugin moved back
Copied: plugins/trunk/nofollow (from rev 4515, plugins/trunk/unported/nofollow)
Deleted: plugins/trunk/nofollow/pluginnofollow.class.php
===================================================================
--- plugins/trunk/unported/nofollow/pluginnofollow.class.php 2007-01-05 13:08:02 UTC (rev 4515)
+++ plugins/trunk/nofollow/pluginnofollow.class.php 2007-01-05 13:25:22 UTC (rev 4517)
@@ -1,99 +0,0 @@
-<?php
- include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-
- class PluginNoFollow extends PluginBase
- {
- var $pluginEnabled;
-
- function PluginNoFollow()
- {
- $this->PluginBase();
-
- $this->id = "nofollow";
- $this->author = "Original by Minstrel Chiu, Modified by Mark Wu";
- $this->desc = "Prevents comment spams with 'rel=nofollow'";
-
- $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN", "es_ES" );
-
- $this->init();
- }
-
- function init()
- {
- $this->registerAdminAction( "nofollow", "PluginNoFollowConfigAction" );
- $this->registerAdminAction( "updateNoFollowConfig", "PluginNoFollowUpdateConfigAction" );
-
- $menu =& Menu::getMenu();
- if( !$menu->entryExists( "/menu/controlCenter/manageAntiSpamPlugins" ))
- $this->addMenuEntry( "/menu/controlCenter", "manageAntiSpamPlugins", "", "", true, false );
- $this->addMenuEntry( "/menu/controlCenter/manageAntiSpamPlugins", "NoFollow", "?op=nofollow", "" );
-
- $this->registerNotification( EVENT_PRE_COMMENT_ADD );
- }
-
- function register()
- {
- $blogSettings = $this->blogInfo->getSettings();
- $this->pluginEnabled = $blogSettings->getValue( "plugin_nofollow_enabled" );
- }
-
- function isEnabled()
- {
- return $this->pluginEnabled;
- }
-
- 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
Copied: plugins/trunk/nofollow/pluginnofollow.class.php (from rev 4516, plugins/trunk/unported/nofollow/pluginnofollow.class.php)
Deleted: plugins/trunk/nofollow/templates/nofollow.template
===================================================================
--- plugins/trunk/unported/nofollow/templates/nofollow.template 2007-01-05 13:08:02 UTC (rev 4515)
+++ plugins/trunk/nofollow/templates/nofollow.template 2007-01-05 13:25:22 UTC (rev 4517)
@@ -1,24 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=NoFollow title=$locale->tr("nofollow_plugin")}
-<form name="nofollowPluginConfig" method="post">
- <fieldset class="inputField">
- <legend>{$locale->tr("label_configuration")}</legend>
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <div class="field">
- <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("nofollow_plugin_enabled")}
- </div>
- </div>
-
- </fieldset>
-
- <div class="buttons">
- <input type="hidden" name="op" value="updateNoFollowConfig" />
- <input type="reset" name="{$locale->tr("reset")}" />
- <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
- </div>
-</form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Copied: plugins/trunk/nofollow/templates/nofollow.template (from rev 4516, plugins/trunk/unported/nofollow/templates/nofollow.template)
More information about the pLog-svn
mailing list