[pLog-svn] r7012 - plog/branches/lifetype-1.2/class/plugin

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Jul 31 02:24:21 EDT 2010


Author: jondaley
Date: 2010-07-31 02:24:21 -0400 (Sat, 31 Jul 2010)
New Revision: 7012

Modified:
   plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php
Log:
don't allow a plugin to register for a particular event more than once

Modified: plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php	2010-07-31 06:05:10 UTC (rev 7011)
+++ plog/branches/lifetype-1.2/class/plugin/pluginmanager.class.php	2010-07-31 06:24:21 UTC (rev 7012)
@@ -368,9 +368,15 @@
                 $this->_pluginEventList["$eventType"] = Array();
             }
 
-            // and then add the plugin to the list
-            $this->_pluginEventList["$eventType"][] =& $pluginClass;
+                // don't let a plugin register twice for the same event
+                // takes care of bad programmers, and also double registering on the
+                // plugincenter page
+            if(isset($this->_pluginEventList["$eventType"][$pluginClass->id]))
+                return false;
 
+                // and then add the plugin to the list
+            $this->_pluginEventList["$eventType"][$pluginClass->id] =& $pluginClass;
+
             return true;
         }
 



More information about the pLog-svn mailing list