[pLog-svn] r4787 - plugins/branches/lifetype-1.2/authimage

Oscar Renalias oscar at renalias.net
Mon Feb 19 16:07:03 EST 2007


I guess you're right. I could save the value of the $source parameter  
in PluginBase::$source and then add a PluginBase::getSource() method  
in case it is neded later on... I'm sure that the same sort of  
optimization that we've just added to the constructor of the plugin  
could be used somewhere else.

Is that what you had in mind?

On 19 Feb 2007, at 23:04, Jon Daley wrote:

>  	Should PluginBase() be PluginBase($source) and save the value
> somewhere?  Does it make sense to need it anywhere else?  I am not  
> sure if
> it does, I just thought this might be a "base" sort of change,  
> rather than
> each plugin keeping track of it.
>
>   On Mon, 19 Feb 2007, oscar at devel.lifetype.net wrote:
>
>> Author: oscar
>> Date: 2007-02-19 15:55:46 -0500 (Mon, 19 Feb 2007)
>> New Revision: 4787
>>
>> Modified:
>>   plugins/branches/lifetype-1.2/authimage/pluginauthimage.class.php
>> Log:
>> this small change saves us 500kb of memory and a couple thousand  
>> method calls when index.php loads its plugins...
>>
>>
>> Modified: plugins/branches/lifetype-1.2/authimage/ 
>> pluginauthimage.class.php
>> ===================================================================
>> --- plugins/branches/lifetype-1.2/authimage/ 
>> pluginauthimage.class.php	2007-02-19 20:54:56 UTC (rev 4786)
>> +++ plugins/branches/lifetype-1.2/authimage/ 
>> pluginauthimage.class.php	2007-02-19 20:55:46 UTC (rev 4787)
>> @@ -20,22 +20,32 @@
>>         var $default;
>>         var $cacheFolder;
>>
>> -        function PluginAuthImage()
>> +        function PluginAuthImage( $source = "" )
>>         {
>>             $this->PluginBase();
>>
>>             $this->id      = "authimage";
>>             $this->author  = "Mark Wu";
>> -            $this->desc    = 'This plugin offers extra comment  
>> authentication for LifeType. The idea is inspired by <a  
>> href="http://www.gudlyf.com/index.php?p=376">WordPress AuthImage  
>> Plugin</a> written by Gudlyf.';
>> +            $this->desc    = 'This plugin offers extra comment  
>> authentication for LifeType.';
>>             $this->version = '1.0.1';
>>
>>             $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN",  
>> "es_ES", "de_DE" );
>> -
>> -            $this->init();
>> +
>> +			if( $source == "index" )
>> +				$this->init();
>> +			else
>> +				$this->initAdmin();
>>         }
>>
>> 		function init()
>> 		{
>> +			// register the filter
>> +			$this->registerFilter( "AuthImageFilter" );
>> +			$this->registerBlogAction( "AuthImageShow",  
>> "PluginAuthImageShowAction" );
>> +		}
>> +
>> +		function initAdmin()
>> +		{
>>             include_once( PLOG_CLASS_PATH."class/template/menu/ 
>> menu.class.php" );
>>
>> 			// register the filter
>> @@ -50,7 +60,7 @@
>> 			if( !$menu->entryExists( "/menu/controlCenter/ 
>> manageAntiSpamPlugins" ))
>> 				$this->addMenuEntry( "/menu/controlCenter",  
>> "manageAntiSpamPlugins", "", "" );
>>
>> -            $this->addMenuEntry( "/menu/controlCenter/ 
>> manageAntiSpamPlugins", "AuthImage", "?op=authimage", "" );
>> +            $this->addMenuEntry( "/menu/controlCenter/ 
>> manageAntiSpamPlugins", "AuthImage", "?op=authimage", "" );
>> 		}
>>
>> 		function register()
>> @@ -68,7 +78,7 @@
>> 			$this->key = $blogSettings->getValue( "plugin_authimage_key" );
>> 			$this->expiredTime = $blogSettings->getValue 
>> ( "plugin_authimage_expiredtime" );
>> 			if ($this->expiredTime == "") $this->expiredTime = 3600;
>> -			$this->default = $blogSettings->getValue 
>> ( "plugin_authimage_default" );
>> +			$this->default = $blogSettings->getValue 
>> ( "plugin_authimage_default" );
>> 		}
>>
>> 	    function isEnabled()
>>
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>>
>
> -- 
> Jon Daley
> http://jon.limedaley.com/
>
> One of the "Best T-Shirts of 1998"
> "I am the person your parents warned you about"
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>



More information about the pLog-svn mailing list