[pLog-svn] r5392 - plugins/branches/lifetype-1.2/categorycloud

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri May 11 00:12:20 EDT 2007


Author: jondaley
Date: 2007-05-11 00:12:20 -0400 (Fri, 11 May 2007)
New Revision: 5392

Modified:
   plugins/branches/lifetype-1.2/categorycloud/plugincategorycloud.class.php
Log:
copied a bunch of stuff from tagcloud, since the plugins are so similar

Modified: plugins/branches/lifetype-1.2/categorycloud/plugincategorycloud.class.php
===================================================================
--- plugins/branches/lifetype-1.2/categorycloud/plugincategorycloud.class.php	2007-05-11 04:11:51 UTC (rev 5391)
+++ plugins/branches/lifetype-1.2/categorycloud/plugincategorycloud.class.php	2007-05-11 04:12:20 UTC (rev 5392)
@@ -23,7 +23,7 @@
             $this->author    = "Mariano Draghi (cHagHi)";
             $this->desc      = "This plugin offers a CategoryCloud for a specific Blog";
             
-            $this->version   = '20070510';
+            $this->version   = "20070511";
             $this->locales   = Array( "en_UK", "es_ES" );
             
             if( $source == "admin" )
@@ -44,6 +44,11 @@
         {
             $this->init();
             
+            if (defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" )) {
+                // register the events we want
+                $this->registerNotification( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
+            }
+                    
             $this->registerAdminAction( "categorycloud", "PluginCategoryCloudConfigAction" );
             $this->registerAdminAction( "updateCategoryCloudConfig", "PluginCategoryCloudUpdateConfigAction" );
             $menu =& Menu::getMenu();
@@ -54,16 +59,17 @@
         
         function register()
         {
+            $blogSettings = $this->blogInfo->getSettings();
+            $this->pluginEnabled = $blogSettings->getValue( "plugin_categorycloud_enabled" );
+            if(!$this->isEnabled())
+                return;
+
             $config =& Config::getConfig();
             $this->cacheFolder = $config->getValue('temp_folder');
             $this->cacheFolder = $this->cacheFolder.'/categorycloud/'.$this->blogInfo->getId();
             if( !File::exists( $this->cacheFolder )) {
                 File::createDir( $this->cacheFolder, 0755 );
             }
-            
-            $blogSettings = $this->blogInfo->getSettings();
-            $this->pluginEnabled = $blogSettings->getValue( "plugin_categorycloud_enabled" );
-            
         }
         
         
@@ -80,16 +86,25 @@
          */
         function process( $eventType, $params )
         {
+            $validEvent = false;
+            
+            // Looking for EVENT_POST_POST_ADD, EVENT_POST_POST_UPDATE, EVENT_POST_POST_DELETE
+            // or EVENT_POST_ADMIN_PURGE_TEMP_FOLDER (if defined)
+            if ( $eventType == EVENT_POST_POST_ADD || 
+                 $eventType == EVENT_POST_POST_UPDATE ||
+                 $eventType == EVENT_POST_POST_DELETE ||
+                (defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" ) && $eventType == EVENT_POST_ADMIN_PURGE_TEMP_FOLDER) )
+            {
+                $validEvent = true;
+            }
+
             // make sure we're processing the right event!
-            if( $eventType != EVENT_POST_POST_ADD &&
-                $eventType != EVENT_POST_POST_UPDATE &&
-                $eventType != EVENT_POST_POST_DELETE )
+            if( $validEvent == false) 
             {
                 return true;
             }
-            
-            // make sure that the plugin is enabled
-			if( !$this->isEnabled())
+
+            if(!$this->isEnabled())
             {
                 return true;
             }
@@ -109,13 +124,10 @@
         lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
 
 		$blogId = $this->blogInfo->getId();
-
-		$blogSettings = $this->blogInfo->getSettings();
-        $pluginEnabled = $blogSettings->getValue( "plugin_categorycloud_enabled" );
+        $blogSettings = $this->blogInfo->getSettings();
         
-        if (!$pluginEnabled) {
-            return;
-        }
+        if(!$this->isEnabled())
+            return false;
 
    		$maxSize = $blogSettings->getValue( "plugin_categorycloud_max_size" );
 		$maxWeight = $blogSettings->getValue( "plugin_categorycloud_max_weight" );



More information about the pLog-svn mailing list