[pLog-svn] r5135 - in plugins/branches/lifetype-1.2: blogtimes rsd sitemap tagcloud
Oscar Renalias
oscar at renalias.net
Tue Mar 20 07:22:47 EDT 2007
I think we shouldn't make an assumption regarding the event number,
which by the way, you should add to 1.2.1 as well as the code needed
to generate it.
I would modify the plugin so that it first check if the event is
available and if it is, then attach itself to this even. If it isn't
then nothing should happen. Or what does everybody else think?
On 3/20/07, pwestbro at devel.lifetype.net <pwestbro at devel.lifetype.net> wrote:
> Author: pwestbro
> Date: 2007-03-20 05:48:30 -0400 (Tue, 20 Mar 2007)
> New Revision: 5135
>
> Modified:
> plugins/branches/lifetype-1.2/blogtimes/pluginblogtimes.class.php
> plugins/branches/lifetype-1.2/rsd/pluginrsd.class.php
> plugins/branches/lifetype-1.2/sitemap/pluginsitemap.class.php
> plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php
> Log:
> Added support for the flush temporary folder event to several plugins
>
>
> Modified: plugins/branches/lifetype-1.2/blogtimes/pluginblogtimes.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/blogtimes/pluginblogtimes.class.php 2007-03-20 09:38:06 UTC (rev 5134)
> +++ plugins/branches/lifetype-1.2/blogtimes/pluginblogtimes.class.php 2007-03-20 09:48:30 UTC (rev 5135)
> @@ -1,7 +1,14 @@
> <?php
>
> lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
> +
> + // This is temporary. Make sure that the event is defined, even when run
> + // on LifeType 1.2.0
> + if (!defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" )) {
> + define( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER", EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT + 1);
> + }
>
> +
> /**
> * Plugin that offers blogtimes for current blog
> * Original Author: Matt Mullenweg http://photomatt.net
> @@ -56,7 +63,11 @@
> function initAdmin()
> {
> $this->init();
> +
> + // register the admin events we want
> + $this->registerNotification( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
>
> +
> $this->registerAdminAction( "blogtimes", "PluginBlogTimesConfigAction" );
> $this->registerAdminAction( "updateBlogTimesConfig", "PluginBlogTimesUpdateConfigAction" );
>
> @@ -110,7 +121,7 @@
> function process( $eventType, $params )
> {
> // make sure we're processing the right event!
> - if( $eventType != EVENT_POST_POST_ADD )
> + if( $eventType != EVENT_POST_POST_ADD && $eventType != EVENT_POST_ADMIN_PURGE_TEMP_FOLDER )
> {
> return true;
> }
>
> Modified: plugins/branches/lifetype-1.2/rsd/pluginrsd.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/rsd/pluginrsd.class.php 2007-03-20 09:38:06 UTC (rev 5134)
> +++ plugins/branches/lifetype-1.2/rsd/pluginrsd.class.php 2007-03-20 09:48:30 UTC (rev 5135)
> @@ -20,6 +20,12 @@
>
> lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
>
> + // This is temporary. Make sure that the event is defined, even when run
> + // on LifeType 1.2.0
> + if (!defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" )) {
> + define( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER", EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT + 1);
> + }
> +
> class PluginRsd extends PluginBase
> {
> var $pluginEnabled;
> @@ -40,7 +46,10 @@
> }
>
> function initAdmin()
> - {
> + {
> + // register the events we want
> + $this->registerNotification( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
> +
> $this->registerAdminAction( "rsdConfig", "PluginRsdConfigAction" );
> $this->registerAdminAction( "updateRsdConfig", "PluginRsdUpdateConfigAction" );
>
> @@ -85,6 +94,36 @@
> return $str;
> }
>
> + /**
> + * process the events that we have registered
> + *
> + * @see PluginBase::process
> + * @see PluginManager
> + */
> + function process( $eventType, $params )
> + {
> + // make sure we're processing the right event!
> + if( $eventType != EVENT_POST_ADMIN_PURGE_TEMP_FOLDER )
> + {
> + return true;
> + }
> +
> + // Load all of the settings for this blog
> + $this->register();
> +
> + // make sure that the plugin is enabled
> + if( !$this->isEnabled())
> + {
> + return true;
> + }
> +
> + $this->createRSD( );
> +
> + return true;
> + }
> +
> +
> +
> function createRSD()
> {
> $rsdFile = $this->cacheFolder."/rsd.xml";
>
> Modified: plugins/branches/lifetype-1.2/sitemap/pluginsitemap.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/sitemap/pluginsitemap.class.php 2007-03-20 09:38:06 UTC (rev 5134)
> +++ plugins/branches/lifetype-1.2/sitemap/pluginsitemap.class.php 2007-03-20 09:48:30 UTC (rev 5135)
> @@ -4,6 +4,13 @@
> // TODO: httpclient isn't used?
> lt_include( PLOG_CLASS_PATH."class/net/http/httpclient.class.php" );
>
> + // This is temporary. Make sure that the event is defined, even when run
> + // on LifeType 1.2.0
> + if (!defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" )) {
> + define( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER", EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT + 1);
> + }
> +
> +
> /**
> * implements notification of
> */
> @@ -42,6 +49,9 @@
> {
> $this->init();
>
> + // register the events we want
> + $this->registerNotification( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
> +
> // register an action that will allow users to see which comments have not been
> // accepted yet
> $this->registerAdminAction( "sitemapPluginSettings", "AdminSiteMapPluginSettingsAction" );
> @@ -84,7 +94,8 @@
> // make sure we're processing the right event!
> if( $eventType != EVENT_POST_POST_ADD &&
> $eventType != EVENT_POST_POST_UPDATE &&
> - $eventType != EVENT_POST_POST_DELETE )
> + $eventType != EVENT_POST_POST_DELETE &&
> + $eventType != EVENT_POST_ADMIN_PURGE_TEMP_FOLDER )
> {
> return true;
> }
>
> Modified: plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php 2007-03-20 09:38:06 UTC (rev 5134)
> +++ plugins/branches/lifetype-1.2/tagcloud/plugintagcloud.class.php 2007-03-20 09:48:30 UTC (rev 5135)
> @@ -1,7 +1,13 @@
> <?php
>
> -lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
> + lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
>
> + // This is temporary. Make sure that the event is defined, even when run
> + // on LifeType 1.2.0
> + if (!defined( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER" )) {
> + define( "EVENT_POST_ADMIN_PURGE_TEMP_FOLDER", EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT + 1);
> + }
> +
>
> /*
> * This plugin generate TagCloud for a specific Blog
> @@ -50,7 +56,10 @@
> function initAdmin()
> {
> $this->init();
> -
> +
> + // register the events we want
> + $this->registerNotification( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
> +
> $this->registerAdminAction( "tagcloud", "PluginTagCloudConfigAction" );
> $this->registerAdminAction( "updateTagCloudConfig", "PluginTagCloudUpdateConfigAction" );
> $menu =& Menu::getMenu();
> @@ -90,14 +99,22 @@
> // make sure we're processing the right event!
> if( $eventType != EVENT_POST_POST_ADD &&
> $eventType != EVENT_POST_POST_UPDATE &&
> - $eventType != EVENT_POST_POST_DELETE )
> + $eventType != EVENT_POST_POST_DELETE &&
> + $eventType != EVENT_POST_ADMIN_PURGE_TEMP_FOLDER )
> {
> return true;
> }
>
> - // make sure that the plugin is enabled
> - if(!$this->isEnabled())
> + // Load all of the settings for this blog
> + $this->register();
> +
> + // do nothing if the plugin is not enabled!
> + $blogSettings = $this->blogInfo->getSettings();
> + if( !$blogSettings->getValue( "plugin_tagcloud_enabled" ))
> + {
> + // error_log( "plugin not enabled" );
> return true;
> + }
>
> // Update the Blogtime png
> $this->createCloud();
>
> _______________________________________________
> 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