[pLog-svn] r5389 - plugins/branches/lifetype-1.2/tagcloud

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu May 10 23:58:02 EDT 2007


Author: jondaley
Date: 2007-05-10 23:58:02 -0400 (Thu, 10 May 2007)
New Revision: 5389

Modified:
   plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php
Log:
cleaned up a little - mostly due to debugging the pass by reference bug

Modified: plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php
===================================================================
--- plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php	2007-05-11 03:21:41 UTC (rev 5388)
+++ plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php	2007-05-11 03:58:02 UTC (rev 5389)
@@ -11,12 +11,12 @@
 	
         var $pluginEnabled;
         var $cacheFolder;
-
+         
         /*
         * Constructor
         */
         function PluginTagCloud( $source = "" ){
-        
+
             $this->author = "Ben Yacoub Hatem";
             $this->desc = "This plugin generate TagCloud for a specific Blog, usage
                     :<br/>
@@ -66,6 +66,11 @@
         
         function register()
         {
+            $blogSettings = $this->blogInfo->getSettings();
+            $this->pluginEnabled = $blogSettings->getValue( "plugin_tagcloud_enabled" );
+            if(!$this->isEnabled())
+                return;
+            
             $config =& Config::getConfig();
             $this->cacheFolder = $config->getValue('temp_folder');
             $this->cacheFolder = $this->cacheFolder.'/tagcloud/'.$this->blogInfo->getId();
@@ -73,8 +78,6 @@
                 File::createDir( $this->cacheFolder, 0755 );
             }
             
-           $blogSettings = $this->blogInfo->getSettings();
-           $this->pluginEnabled = $blogSettings->getValue( "plugin_tagcloud_enabled" );
     
         }
         
@@ -99,7 +102,8 @@
             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) ) {
+                (defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" ) && $eventType == EVENT_POST_ADMIN_PURGE_TEMP_FOLDER) )
+            {
                 $validEvent = true;
             }
 
@@ -108,12 +112,9 @@
             {
                 return true;
             }
-        
-            // do nothing if the plugin is not enabled!
-            $blogSettings = $this->blogInfo->getSettings();
-            if( !$blogSettings->getValue( "plugin_tagcloud_enabled" ))
+
+            if(!$this->isEnabled())
             {
-                // error_log( "plugin not enabled" );
                 return true;
             }
                         
@@ -134,7 +135,7 @@
 		$blogId = $this->blogInfo->getId();
 		$blogSettings = $this->blogInfo->getSettings();
         
-        if (!$this->pluginEnabled)
+        if(!$this->isEnabled())
             return false;
 
         $MaxArticles = $blogSettings->getValue( "plugin_tagcloud_max_articles" );
@@ -158,7 +159,6 @@
 		    " AND a.status=1 AND a.blog_id = " . $blogId . 
 		    " ORDER BY a.date DESC LIMIT 0,$MaxArticles;";
 	
-	
 		$result = $this->db->Execute($query);
         if(!$result || ($result->RecordCount() == 0))
 		    return false;



More information about the pLog-svn mailing list